Wikipedia
enwiki
https://en.wikipedia.org/wiki/Main_Page
MediaWiki 1.39.0-wmf.19
first-letter
Media
Special
Talk
User
User talk
Wikipedia
Wikipedia talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
Portal
Portal talk
Draft
Draft talk
TimedText
TimedText talk
Module
Module talk
Gadget
Gadget talk
Gadget definition
Gadget definition talk
Barack Obama
0
534366
1097068833
1097068661
2022-07-08T12:35:39Z
Kyleung05
37982885
wikitext
text/x-wiki
{{Short description|President of the United States from 2009 to 2017}}
{{redirect2|Barack|Obama|other uses|Barack (disambiguation)|and|Obama (disambiguation)|and|Barack Obama (disambiguation)}}
{{pp-move-indef}}
{{pp-semi|small=yes}}
{{pp|rpff request|small=yes}}
{{Use American English|date=September 2020}}
{{Use mdy dates|date=June 2022}}
{{Infobox officeholder
| image = President Barack Obama.jpg
| alt = Obama standing with his arms folded and smiling.
| order = 44th
| office = President of the United States
| caption = Official portrait, 2012
| vicepresident = [[Joe Biden]]
| term_start = January 20, 2009
| term_end = January 20, 2017
| predecessor = [[George W. Bush]]
| successor = [[Donald Trump]]
| jr/sr1 = United States Senator
| state1 = [[Illinois]]
| term_start1 = January 3, 2005
| term_end1 = November 16, 2008
| predecessor1 = [[Peter Fitzgerald (politician)|Peter Fitzgerald]]
| successor1 = [[Roland Burris]]
| state_senate2 = Illinois
| district2 = [[Illinois's 13th Senate district|13th]]
| predecessor2 = [[Alice Palmer (politician)|Alice Palmer]]
| term_start2 = January 8, 1997
| term_end2 = November 4, 2004
| successor2 = [[Kwame Raoul]]
| birth_name = Barack Hussein Obama II
| birth_date = {{Birth date and age|1961|8|4|mf=yes}}
| birth_place = [[Honolulu]], [[Hawaii]], U.S.
| death_date =
| death_place =
| party = [[Democratic Party (United States)|Democratic]]
| spouse = {{marriage|[[Michelle Obama|Michelle Robinson]]|October 3, 1992}}
| children = {{flatlist|
* [[Malia Obama|Malia]]
* [[Sasha Obama|Sasha]]
}}
| parents = {{plainlist|
* [[Barack Obama Sr.]]
* [[Ann Dunham]]
}}
| relatives = [[Family of Barack Obama]]
| residence = [[Kalorama (Washington, D.C.)]]
| education = [[Punahou School]]
| alma_mater = {{unbulleted list|[[Occidental College]] |[[Columbia University]] ([[Bachelor of Arts|BA]])|[[Harvard Law School|Harvard University]] ([[Juris Doctor|JD]])}}
| occupation = {{hlist|Politician|lawyer|author}}
| awards = [[List of honors and awards received by Barack Obama|List of honors and awards]]
| signature = Barack Obama signature.svg
| signature_alt = Cursive signature in ink
| website = {{unbulleted list|{{URL|https://barackobama.com|Official website}}|{{URL|https://www.obama.org|Obama Foundation}}|{{URL|obamawhitehouse.archives.gov|White House Archives}}}}
}}
{{Barack Obama sidebar}}
'''Barack Hussein Obama II''' ({{IPAc-en|audio=En-us-Barack-Hussein-Obama.ogg|b|ə|ˈ|r|ɑː|k|_|h|uː|ˈ|s|eɪ|n|_|oʊ|ˈ|b|ɑː|m|ə}} {{respell|bə|RAHK}} {{respell|hoo|SAYN}} {{respell|oh|BAH|mə}};<ref>{{YouTube|clMEg4-N7ao|"Barack Hussein Obama Takes The Oath Of Office"}}. January 20, 2009.</ref> born August 4, 1961) is an American politician <!--NOTE: The lead sentence should stick to what he is primarily known for. The infobox is there to include additional occupations.-->who served as the 44th [[president of the United States]] from 2009 to 2017. He was the first African-American <!-- DO NOT LINK PER MOS:OVERLINK --> president of the United States.<ref name="FirstBlackPrez"/> A member of the [[Democratic Party (United States)|Democratic Party]], he previously served as a [[U.S. senator]] from [[Illinois]] from 2005 to 2008 and as an [[Illinois state senator]] from 1997 to 2004. <!--PLEASE DO NOT CHANGE FROM "AFRICAN AMERICAN", per consensus. See discussions and FAQ (Q2) on the talk page.-->
Obama was born in [[Honolulu]], [[Hawaii]]. After graduating from [[Columbia University]] in 1983, he worked as a [[Community organizing|community organizer]] in [[Chicago]]. In 1988, he enrolled in [[Harvard Law School]], where he was the first black president of the ''[[Harvard Law Review]]''. After graduating, he became a civil rights attorney and an academic, teaching constitutional law at the [[University of Chicago Law School]] from 1992 to 2004. Turning to elective politics, he [[Illinois Senate career of Barack Obama|represented the 13th district]] in the [[Illinois Senate]] from 1997 until 2004, when he [[2004 United States Senate election in Illinois|ran for the U.S. Senate]]. Obama received national attention in 2004 with his March Senate primary win, his well-received July [[2004 Democratic National Convention|Democratic National Convention]] [[2004 Democratic National Convention keynote address|keynote address]], and his landslide November election to the Senate. In 2008, a year after beginning [[Barack Obama 2008 presidential campaign|his campaign]], and after [[2008 Democratic Party presidential primaries|a close primary campaign]] against [[Hillary Clinton]], he was nominated by the Democratic Party for president. Obama was elected over [[Republican Party (United States)|Republican]] nominee [[John McCain]] in the [[2008 United States presidential election|general election]] and was [[First inauguration of Barack Obama|inaugurated]] alongside his running mate [[Joe Biden]], on January 20, 2009. Nine months later, he was named the [[2009 Nobel Peace Prize]] laureate, a decision that drew a mixture of praise and criticism.
Obama signed many landmark bills into law during his first two [[Presidency of Barack Obama|years in office]]. The main reforms include: the [[Affordable Care Act]] (ACA or "Obamacare"), although without a [[public health insurance option]]; the [[Dodd–Frank Wall Street Reform and Consumer Protection Act]]; and the [[Don't Ask, Don't Tell Repeal Act of 2010]]. The [[American Recovery and Reinvestment Act of 2009|American Recovery and Reinvestment Act]] and [[Tax Relief, Unemployment Insurance Reauthorization, and Job Creation Act of 2010|Tax Relief, Unemployment Insurance Reauthorization, and Job Creation Act]] served as economic stimuli amidst the [[Great Recession in the United States|Great Recession]]. After a [[United States debt-ceiling crisis of 2011|lengthy debate over the national debt limit]], he signed the [[Budget Control Act of 2011|Budget Control]] and the [[American Taxpayer Relief Act of 2012|American Taxpayer Relief Acts]]. In foreign policy, he increased U.S. troop levels in [[War in Afghanistan (2001–present)|Afghanistan]], reduced nuclear weapons with the United States–[[Russia]] [[New START]] treaty, and [[Withdrawal of U.S. troops from Iraq (2007–2011)|ended military involvement]] in the [[Iraq War]]. In 2011, Obama ordered the drone-strike killing of [[Anwar al-Awlaki]], a US citizen and suspected [[al-Qaeda]] operative, leading to controversy. He ordered [[2011 military intervention in Libya|military involvement in Libya]] for the implementation of the [[United Nations Security Council Resolution 1973|UN Security Council Resolution 1973]], contributing to the overthrow of [[Muammar Gaddafi]]. He also ordered the [[Killing of Osama bin Laden#Operation Neptune Spear|military operation]] that resulted in the death of [[Osama bin Laden]].
After winning [[2012 United States presidential election|re-election]] by defeating Republican opponent [[Mitt Romney]], Obama was [[Second inauguration of Barack Obama|sworn in for a second term]] on January 20, 2013. During this term, he condemned the [[Global surveillance disclosures (2013–present)|2013 Snowden leaks]] as unpatriotic, but called for more restrictions on the [[National Security Agency]] (NSA) to address privacy issues. Obama also promoted inclusion for [[LGBT American]]s. His administration filed briefs that urged the [[Supreme Court of the United States|Supreme Court]] to strike down [[Same-sex marriage in the United States|same-sex marriage]] bans as unconstitutional (''[[United States v. Windsor]]'' and ''[[Obergefell v. Hodges]]''); same-sex marriage was [[Same-sex marriage in the United States|legalized]] nationwide in 2015 after the Court ruled so in ''Obergefell''. He advocated for [[Gun politics in the United States|gun control]] in response to the [[Sandy Hook Elementary School shooting]], indicating support for a ban on [[assault weapons]], and issued wide-ranging executive actions concerning [[global warming]] and immigration. In foreign policy, he ordered [[American-led intervention in Iraq (2014–present)|military interventions in Iraq]] and [[American-led intervention in the Syrian civil war|Syria]] in response to gains made by [[Islamic State|ISIL]] after the 2011 withdrawal from Iraq, promoted discussions that led to the 2015 [[Paris Agreement]] on global climate change, oversaw the deadly [[Kunduz hospital airstrike]], drew down [[Withdrawal of United States troops from Afghanistan (2011–2016)|U.S. troops in Afghanistan]] in 2016, initiated [[International sanctions during the Ukrainian crisis|sanctions against Russia]] following the [[Annexation of Crimea by the Russian Federation|Annexation of Crimea]] and again after [[Russian interference in the 2016 United States elections|interference in the 2016 U.S. elections]], brokered the [[Joint Comprehensive Plan of Action]] nuclear deal with Iran, and [[Cuban thaw|normalized U.S. relations with Cuba]]. Obama nominated [[Barack Obama Supreme Court candidates|three justices to the Supreme Court]]: [[Sonia Sotomayor]] and [[Elena Kagan]] were confirmed as justices, while [[Merrick Garland]] was [[Merrick Garland Supreme Court nomination|denied hearings or a vote]] from the Republican-majority [[United States Senate|Senate]]. Obama left office on January 20, 2017, and continues to reside in [[Washington, D.C.]]
During Obama's [[Presidency of Barack Obama|terms as president]], the United States' reputation abroad, as well as the American economy, significantly improved. Scholars and historians rank him among [[Historical rankings of presidents of the United States|the upper to mid tier]] of American presidents. Since leaving office, Obama has remained active in Democratic politics, including campaigning for candidates in the [[2018 United States elections|2018 midterm elections]], appearing at the [[2020 Democratic National Convention]] and campaigning for Biden during the [[2020 United States presidential election|2020 presidential election]]. Outside of politics, Obama has published three [[Bibliography of Barack Obama|bestselling books]]: ''[[Dreams from My Father]]'' (1995)'', [[The Audacity of Hope]]'' (2006) and ''[[A Promised Land]]'' (2020).
{{TOC limit|4}}
==Early life and career==
{{Main|Early life and career of Barack Obama}}
[[File:Ann Dunham with father and children.jpg|thumb|left|[[Stanley Armour Dunham]], [[Ann Dunham]], [[Maya Soetoro-Ng|Maya Soetoro]] and Barack Obama, (L to R) mid-1970s in [[Honolulu]]]]
Obama was born on August 4, 1961,<ref name="biography">{{cite web |year = 2008 |title = President Barack Obama |publisher = The White House |url=https://www.whitehouse.gov/administration/president-obama |access-date = December 12, 2008 |url-status=dead | archive-url=https://web.archive.org/web/20091026043047/http://www.whitehouse.gov/administration/president-obama |archive-date=October 26, 2009 }}</ref> at [[Kapiolani Medical Center for Women and Children]] in [[Honolulu]], [[Hawaii]].<ref name="birth-certificate" /><ref name="maraniss">{{cite news |author = Maraniss, David |date = August 24, 2008 |title = Though Obama had to leave to find himself, it is Hawaii that made his rise possible |newspaper = The Washington Post |page = A22 |url=https://www.washingtonpost.com/wp-dyn/content/article/2008/08/23/AR2008082301620.html |access-date = October 28, 2008 }}</ref><ref>{{cite news |author = Nakaso, Dan |date = December 22, 2008 |title = Twin sisters, Obama on parallel paths for years |newspaper = [[The Honolulu Advertiser]] |page = B1 |url=http://the.honoluluadvertiser.com/article/2008/Dec/22/ln/hawaii812220320.html |access-date = January 22, 2011 }}</ref> He is the only president born outside the [[contiguous United States|contiguous 48 states]].<ref name="BarretoO'Bryant2013">{{cite book|last1=Barreto|first1=Amílcar Antonio|first2=Richard L.|last2=O'Bryant|title=American Identity in the Age of Obama|chapter-url=https://books.google.com/books?id=5VQVAgAAQBAJ&pg=PT18|access-date=May 8, 2017|date=November 12, 2013|publisher=Taylor & Francis|isbn=978-1-317-93715-9|pages=18–19|chapter=Introduction}}</ref> He was born to an American mother and a Kenyan father. His mother, [[Ann Dunham]] (1942–1995), was born in [[Wichita, Kansas]]; she was mostly of English descent.<ref>Obama (1995, 2004), p. 12.</ref> In July 2012, [[Ancestry.com]] found a strong likelihood that Dunham was descended from [[John Punch (slave)|John Punch]], an enslaved African man who lived in the [[Colony of Virginia]] during the seventeenth century.<ref name="ancestry">[http://corporate.ancestry.com/press/press-releases/2012/07/ancestry.com-discovers-president-obama-related-to-first-documented-slave-in-america/ "Ancestry.com Discovers Ph Suggests"] {{webarchive|url=https://web.archive.org/web/20150402094350/http://corporate.ancestry.com/press/press-releases/2012/07/ancestry.com-discovers-president-obama-related-to-first-documented-slave-in-america/ |date=April 2, 2015 }}, ''[[The New York Times]]''. July 30, 2012.</ref><ref>Hennessey, Kathleen. [https://articles.latimes.com/2012/jul/30/news/la-pn-obama-related-to-legendary-virginia-slave-genealogist-says-20120730 "Obama related to legendary Virginia slave, genealogists say"], ''[[Los Angeles Times]]''. July 30, 2012.</ref> Obama's father, [[Barack Obama Sr.]] (1934–1982),<ref>Maraniss (2012), <span class="plainlinks">[https://www.google.com/books/edition/Barack_Obama/Wnna9CLtblAC?&gbpv=1&pg=PT65 p. 65]</span>: He had been born inside the euphorbia hedges of the K'obama homestead on June 18, 1934.</ref><ref>Liberties (2012), <span class="plainlinks">[https://books.google.com/books?id=8d9NAAAAQBAJ&pg=SL1-PA202 p. 202]</span>: The age of the father is questionable since most of the documents Barack Hussein Obama filled out during his United States student visa was June 18, 1934; however, Obama II's book ''Dreams of My Father'' states his birth date was June 18, 1936. Check out Immigration and Naturalization Service records, and those documents also indicate the birth date to be June 18, 1934, thereby making Obama Sr. twenty-seven at the birth of Obama II instead of the annotated twenty-five on the birth certificate.</ref> was a married<ref name="autogenerated2">{{cite news|last=Jacobs |first=Sally |url=https://www.npr.org/2011/07/11/137553552/president-obamas-father-a-bold-and-reckless-life |title=President Obama's Father: A 'Bold And Reckless Life' |publisher=NPR |date=July 6, 2011 |access-date=January 16, 2020}}</ref><ref>{{cite news|last=Swaine |first=Jon |url=https://www.telegraph.co.uk/news/worldnews/barackobama/8481779/Barack-Obamas-father-forced-out-of-US-in-1960s.html |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/news/worldnews/barackobama/8481779/Barack-Obamas-father-forced-out-of-US-in-1960s.html |archive-date=January 10, 2022 |url-access=subscription |url-status=live |title=Barack Obama's father 'forced out of US in 1960s' |newspaper=Telegraph |date=April 29, 2011 |access-date=January 16, 2020}}{{cbignore}}</ref><ref>{{cite news|first=Rachel L. |last=Swarns |url=https://www.nytimes.com/2016/06/19/nyregion/letters-by-and-about-barack-obamas-father.html |archive-url=https://web.archive.org/web/20160618145445/http://www.nytimes.com/2016/06/19/nyregion/letters-by-and-about-barack-obamas-father.html |archive-date=June 18, 2016 |url-access=subscription |url-status=live |title=Words of Obama's Father Still Waiting to Be Read by His Son |work=The New York Times |access-date=January 16, 2020}}</ref> [[Luo people of Kenya and Tanzania|Luo Kenyan]] from [[Nyang'oma Kogelo]].<ref name="autogenerated2" /><ref>{{cite news|author=David R Arnott |url=https://www.nbcnews.com/news/photo/obamas-old-school-his-ancestral-village-world-reacts-us-presidential-flna1C6912948 |title=From Obama's old school to his ancestral village, world reacts to US presidential election |work=NBC News |access-date=January 16, 2020}}</ref> Obama's parents met in 1960 in a [[Russian language]] class at the [[University of Hawaii at Manoa]], where his father was a foreign student on a scholarship.<ref name="Jones 2007">{{cite news |author = Jones, Tim |date = March 27, 2007 |title = Barack Obama: Mother not just a girl from Kansas; Stanley Ann Dunham shaped a future senator |newspaper = [[Chicago Tribune]] |page = 1 (Tempo) |url=http://gbppr.dyndns.org/~gbpprorg/obama/barack.mother.txt |url-status=dead |archive-url=https://web.archive.org/web/20170207112933/http://gbppr.dyndns.org/~gbpprorg/obama/barack.mother.txt |archive-date = February 7, 2017 }}</ref><ref name="Obama 1995, 2004, pp. 9–10">Obama (1995, 2004), pp. 9–10.
* Scott (2011), pp. 80–86.
* Jacobs (2011), pp. 115–118.
* Maraniss (2012), pp. 154–160.</ref> The couple married in [[Wailuku, Hawaii]], on February 2, 1961, six months before Obama was born.<ref name="Ripley 2008">{{cite news |author = Ripley, Amanda |date = April 9, 2008 |title = The story of Barack Obama's mother |magazine = [[Time (magazine)|Time]] |url=http://content.time.com/time/magazine/article/0,9171,1729685,00.html |access-date = April 9, 2007 }}</ref><ref>Scott (2011), p. 86.
* Jacobs (2011), pp. 125–127.
* Maraniss (2012), pp. 160–163.</ref>
In late August 1961, a few weeks after he was born, Barack and his mother moved to the [[University of Washington]] in [[Seattle]], where they lived for a year. During that time, Barack's father completed his undergraduate degree in [[economics]] in Hawaii, graduating in June 1962. He left to attend graduate school on a scholarship at [[Harvard University]], where he earned an [[Master of Arts|M.A.]] in economics. Obama's parents divorced in March 1964.<ref>Scott (2011), pp. 87–93.
* Jacobs (2011), pp. 115–118, 125–127, 133–161.
* Maraniss (2012), pp. 170–183, 188–189.</ref> Obama Sr. returned to Kenya in 1964, where he married for a third time and worked for the Kenyan government as the Senior Economic Analyst in the Ministry of Finance.<ref>Obama "Dreams from My Father a Story of Race and Inheritance"</ref> He visited his son in Hawaii only once, at Christmas 1971,<ref>Scott (2011), pp. 142–144.
* Jacobs (2011), pp. 161–177, 227–230.
* Maraniss (2012), pp. 190–194, 201–209, 227–230.</ref> before he was killed in an automobile accident in 1982, when Obama was 21 years old.<ref>{{cite news |author = Ochieng, Philip |date = November 1, 2004 |title = From home squared to the US Senate: how Barack Obama was lost and found |newspaper = [[The EastAfrican]] |location = Nairobi |url=http://www.nationmedia.com/EastAfrican/01112004/Features/PA2-11.html |archive-date = September 27, 2007 |archive-url=https://web.archive.org/web/20070927223905/http://www.nationmedia.com/EastAfrican/01112004/Features/PA2-11.html }}
* {{cite news |author = Merida, Kevin |date = December 14, 2007 |title = The ghost of a father |newspaper = The Washington Post |page = A12 |url=https://www.washingtonpost.com/wp-dyn/content/story/2007/12/13/ST2007121301893.html |access-date = June 25, 2008 }}
* Jacobs (2011), pp. 251–255.
* Maraniss (2012), pp. 411–417.</ref> Recalling his early childhood, Obama said: "That my father looked nothing like the people around me—that he was black as pitch, my mother white as milk—barely registered in my mind."<ref name="Obama 1995, 2004, pp. 9–10" /> He described his struggles as a young adult to reconcile social perceptions of his multiracial heritage.<ref>{{cite news |author = Serrano, Richard A. |date = March 11, 2007 |title = Obama's peers didn't see his angst |newspaper = Los Angeles Times |page = A20 |url=https://www.latimes.com/news/politics/la-na-obamahawaii11-2007mar11,0,199085,full.story |access-date = March 13, 2007 |url-status=dead |archive-url=https://web.archive.org/web/20081108080115/http://www.latimes.com/news/politics/la-na-obamahawaii11-2007mar11,0,199085,full.story |archive-date = November 8, 2008 }}
* Obama (1995, 2004), Chapters 4 and 5.</ref>
In 1963, Dunham met [[Lolo Soetoro]] at the [[University of Hawaii]]; he was an [[Native Indonesian|Indonesian]] [[East–West Center]] [[graduate student]] in [[geography]]. The couple married on [[Molokai]] on March 15, 1965.<ref>Scott (2011), pp. 97–103.
* Maraniss (2012), pp. 195–201, 225–230.</ref> After two one-year extensions of his [[J-1 visa]], Lolo returned to [[Indonesia]] in 1966. His wife and stepson followed sixteen months later in 1967. The family initially lived in the Menteng Dalam neighborhood in the [[Tebet, South Jakarta|Tebet]] district of [[South Jakarta]]. From 1970, they lived in a wealthier neighborhood in the [[Menteng]] district of [[Central Jakarta]].<ref>Maraniss (2012), pp. 195–201, 209–223, 230–244.</ref>
===Education===
[[File:Barry Soetoro school record.jpg|thumb|Barack Obama's school record in St. Francis of Assisi Catholic Elementary School. Obama was enrolled as "Barry Soetoro" (no. 1), and was wrongly recorded as an Indonesian citizen (no. 3) and a Muslim (no. 4).<ref>{{Cite news|last=Suhartono|first=Anton|date=March 19, 2010|title=Sekolah di SD Asisi, Obama Berstatus Agama Islam|work=Okezone|url=https://nasional.okezone.com/read/2010/03/19/337/313977/sekolah-di-sd-asisi-obama-berstatus-agama-islam|language=Indonesian|access-date=January 21, 2021}}</ref>]]
At the age of six, Obama and his mother had moved to Indonesia to join his stepfather. From age six to ten, he attended local [[Indonesian Language|Indonesian-language]] schools: ''Sekolah Dasar Katolik Santo Fransiskus Asisi'' (St. Francis of Assisi Catholic Elementary School) for two years and [[State Elementary School Menteng 01|''Sekolah Dasar Negeri Menteng 01'']] (State Elementary School Menteng 01) for one and a half years, supplemented by English-language [[Calvert School]] homeschooling by his mother.<ref>Maraniss (2012), pp. 216, 221, 230, 234–244.</ref><ref>{{cite web |url=https://www.calverteducation.com/calvert/barack-obama-calvert-homeschooler |title = Barack Obama: Calvert Homeschooler?—Calvert Education Blog |publisher = calverteducation.com |access-date = November 25, 2015 |date = January 25, 2014 }}</ref> As a result of his four years in [[Jakarta]], he was able to speak [[Indonesian language|Indonesian]] fluently as a child.<ref>{{cite web |url=https://www.youtube.com/watch?v=JYIK9QtNu3w |title = Wawancara Eksklusif RCTI dengan Barack Obama (Part 2) |date = March 2010 |website = YouTube |access-date = February 12, 2018}}</ref><ref name="in Jakarta" /><ref name="in Jakarta2">{{cite web |title = Obama's Indonesian pleasantries: the video |url=https://languagelog.ldc.upenn.edu/nll/?p=1052 |author = Zimmer, Benjamin |date = January 23, 2009 |access-date = October 7, 2012 |website = Language Log |publisher = [[University of Pennsylvania]] }}</ref> During his time in Indonesia, Obama's stepfather taught him to be resilient and gave him "a pretty hardheaded assessment of how the world works."<ref>{{Cite news |url=https://www.newsweek.com/what-barack-obama-learned-his-father-88011 |title=What Barack Obama Learned from His Father |last=Meacham |first=Jon |date=August 22, 2008 |newspaper=Newsweek |archive-url=https://web.archive.org/web/20170107100237/http://www.newsweek.com/what-barack-obama-learned-his-father-88011?rx=us |archive-date=January 7, 2017 |url-status=live |access-date=January 9, 2017 }}</ref>
In 1971, Obama returned to [[Honolulu]] to live with his maternal grandparents, [[Madelyn Dunham|Madelyn]] and [[Stanley Armour Dunham|Stanley Dunham]]. He attended [[Punahou School]]—a private [[University-preparatory school|college preparatory school]]—with the aid of a scholarship from fifth grade until he graduated from high school in 1979.<ref>{{cite news |author = Serafin, Peter |date = March 21, 2004 |title = Punahou grad stirs up Illinois politics |newspaper = [[Honolulu Star-Bulletin]] |url=http://archives.starbulletin.com/2004/03/21/news/story4.html |access-date = March 20, 2008 }}
* {{cite news |author = Scott, Janny |date = March 14, 2008 |title = A free-spirited wanderer who set Obama's path |work = The New York Times |page = A1 |url=https://www.nytimes.com/2008/03/14/us/politics/14obama.html |archive-url=https://web.archive.org/web/20080314042735/http://www.nytimes.com/2008/03/14/us/politics/14obama.html |archive-date=March 14, 2008 |url-access=subscription |url-status=live |access-date = November 18, 2011 }}
* Obama (1995, 2004), Chapters 3 and 4.
* Scott (2012), pp. 131–134.
* Maraniss (2012), pp. 264–269.</ref> In his youth, Obama went by the nickname "Barry".<ref>{{cite news |url=https://www.newsweek.com/when-barry-became-barack-84255 |title = When Barry Became Barack |last = Wolffe |first = Richard |date = March 22, 2008 |access-date = March 21, 2016 |work = [[Newsweek]] }}</ref> Obama lived with his mother and half-sister, [[Maya Soetoro-Ng|Maya Soetoro]], in Hawaii for three years from 1972 to 1975 while his mother was a graduate student in [[anthropology]] at the [[University of Hawaii]].<ref>Scott (2011), pp. 139–157.
* Maraniss (2012), pp. 279–281.</ref> Obama chose to stay in Hawaii when his mother and half-sister returned to Indonesia in 1975, so his mother could begin anthropology field work.<ref>Scott (2011), pp. 157–194.
* Maraniss (2012), pp. 279–281, 324–326.</ref> His mother spent most of the next two decades in Indonesia, divorcing Lolo in 1980 and earning a [[PhD]] degree in 1992, before dying in 1995 in Hawaii following unsuccessful treatment for [[ovarian cancer|ovarian]] and [[uterine cancer]].<ref>Scott (2011), pp. 214, 294, 317–346.</ref>
Of his years in Honolulu, Obama wrote: "The opportunity that Hawaii offered — to experience a variety of cultures in a climate of mutual respect — became an integral part of my world view, and a basis for the values that I hold most dear."<ref>{{cite news |author = Reyes, B.J. |date = February 8, 2007 |title = Punahou left lasting impression on Obama |newspaper = Honolulu Star-Bulletin |url=http://archives.starbulletin.com/2007/02/08/news/story02.html |access-date = February 10, 2007 |quote = As a teenager, Obama went to parties and sometimes sought out gatherings on military bases or at the University of Hawaii that were attended mostly by blacks. }}</ref> Obama has also written and talked about using [[alcohol (drug)|alcohol]], [[marijuana]], and [[cocaine]] during his teenage years to "push questions of who I was out of my mind."<ref>{{cite news|author=Elliott, Philip |agency=Associated Press |date=November 21, 2007 |title=Obama gets blunt with N.H. students |newspaper=[[The Boston Globe]] |page=8A |url=http://articles.boston.com/2007-11-21/news/29233371_1_barack-obama-education-plan-campaign-trail |access-date=May 18, 2012 |url-status=dead |archive-url=https://web.archive.org/web/20120407214401/http://articles.boston.com/2007-11-21/news/29233371_1_barack-obama-education-plan-campaign-trail |archive-date=April 7, 2012 }}</ref> Obama was also a member of the "choom gang", a self-named group of friends who spent time together and occasionally smoked marijuana.<ref>{{cite news |last=Karl |first=Jonathan |work = ABC News |date = May 25, 2012 |title = Obama and his pot-smoking "choom gang" |url=https://abcnews.go.com/blogs/politics/2012/05/obama-and-his-pot-smoking-choom-gang/ |access-date = May 25, 2012 }}
* {{cite book |first = Barack |last = Obama |year = 2004 |orig-date = 1995 |url=https://books.google.com/books?id=HRCHJp-V0QUC&pg=PA93 |title = Dreams from My Father: A Story of Race and Inheritance |pages = 93–94 |access-date = June 3, 2016 |isbn = 978-0-307-39412-5 }}
* {{cite book |first = David |last = Maraniss |year = 2012 |url=https://books.google.com/books?id=Wnna9CLtblAC&q=choom |title = Barack Obama: The Story |at = pages with "choom gang" |access-date = June 3, 2016 |isbn = 978-1-4391-6753-3 }}
* for analysis of the political impact of the quote and Obama's more recent admission that he smoked marijuana as a teenager ("When I was a kid, I inhaled"), see:
* {{cite news |author = Seelye, Katharine Q. |date = October 24, 2006 |title = Obama offers more variations from the norm |newspaper = The New York Times |page = A21 |url=https://query.nytimes.com/gst/fullpage.html?res=9D07E2DB173FF937A15753C1A9609C8B63 |access-date = October 29, 2006 }}
* {{cite news |author = Romano, Lois |date = January 3, 2007 |title = Effect of Obama's candor remains to be seen |newspaper = The Washington Post |page = A1 |url=https://www.washingtonpost.com/wp-dyn/content/article/2007/01/02/AR2007010201359.html |access-date = January 14, 2007 }}</ref><ref>{{cite web |url=https://www.pbs.org/video/frontline-choice-2012-again/ |title = FRONTLINE The Choice 2012 |publisher = PBS |date = October 9, 2012 |access-date = October 29, 2012 }}</ref>
====College and research jobs====
After graduating from high school in 1979, Obama moved to [[Los Angeles]] to attend [[Occidental College]] on a full scholarship. In February 1981, Obama made his first public speech, calling for Occidental to participate in the [[disinvestment from South Africa]] in response to that nation's policy of [[apartheid]].<ref name="Occidental" /> In mid-1981, Obama traveled to Indonesia to visit his mother and half-sister Maya, and visited the families of college friends in [[Pakistan]] for three weeks.<ref name="Occidental" /> Later in 1981, he [[College transfer|transferred]] to [[Columbia University]] in [[New York City]] as a [[Junior (education year)|junior]], where he majored in [[political science]] with a specialty in [[international relations]]<ref>{{cite news |author = Boss-Bicak, Shira |date = January 2005 |title = Barack Obama '83 |magazine = Columbia College Today |issn = 0572-7820 |url=http://www.college.columbia.edu/cct_archive/jan05/cover.php |access-date = October 1, 2006 |archive-url=https://web.archive.org/web/20080905121815/http://www.college.columbia.edu/cct_archive/jan05/cover.php |archive-date = September 5, 2008 |url-status=dead }}</ref> and in [[English literature]]<ref>{{Cite news|url=https://obamawhitehouse.archives.gov/the-press-office/2014/06/26/remarks-president-town-hall|title=Remarks by the President in Town Hall|date=June 26, 2014|via=[[NARA|National Archives]]|work=[[whitehouse.gov]]|access-date=October 15, 2016}}</ref> and lived off-campus on West 109th Street.<ref>{{cite news |url=https://nymag.com/arts/all/approvalmatrix/approval-matrix-2012-8-27/ |title = The Approval Matrix |date = August 27, 2012 |work = New York }}</ref> He graduated with a [[Bachelor of Arts]] degree in 1983 and a 3.7 [[Grading (education)#United States|GPA]]. After graduating, Obama worked for about a year at the [[Business International Corporation]], where he was a financial researcher and writer,<ref>{{cite news |url=https://www.npr.org/templates/story/story.php?storyId=92337754 |title=Obama's Early Brush With Financial Markets |last=Horsley |first=Scott |date=July 9, 2008 |publisher=[[NPR]] |access-date=July 17, 2017}}</ref><ref>{{cite web |author = Obama, Barack |year = 1998 |title = Curriculum vitae |publisher = The University of Chicago Law School |url=http://www.law.uchicago.edu/faculty/obama/cv.html |archive-date = May 9, 2001 |archive-url=https://web.archive.org/web/20010509024017/http://www.law.uchicago.edu/faculty/obama/cv.html |access-date = October 1, 2006 }}
* {{cite news |author = Issenberg, Sasha |date = August 6, 2008 |title = Obama shows hints of his year in global finance; Tied markets to social aid |newspaper = The Boston Globe |page = 1A |url=https://www.boston.com/news/nation/articles/2008/08/06/obama_shows_hints_of_his_year_in_global_finance/ |access-date = August 6, 2008 |archive-url=https://web.archive.org/web/20091107145054/http://www.boston.com/news/nation/articles/2008/08/06/obama_shows_hints_of_his_year_in_global_finance?page=full |archive-date = November 7, 2009 |url-status=dead }}</ref> then as a project coordinator for the [[New York Public Interest Research Group]] on the [[City College of New York]] campus for three months in 1985.<ref>{{cite news |author = Scott, Janny |date = July 30, 2007 |title = Obama's account of New York often differs from what others say |newspaper = The New York Times |page = B1 |url=https://www.nytimes.com/2007/10/30/us/politics/30obama.html |archive-url=https://web.archive.org/web/20071031000738/http://www.nytimes.com/2007/10/30/us/politics/30obama.html |archive-date=October 31, 2007 |url-access=subscription |url-status=live |access-date = July 31, 2007 }}
* Obama (1995, 2004), pp. 133–140.
* Mendell (2007), pp. 62–63.</ref><ref name="Who's Who 2008">{{cite book |editor = Chassie, Karen |year = 2007 |title = Who's Who in America, 2008 |page = 3468 |place = New Providence, NJ |publisher = Marquis Who's Who |isbn = 978-0-8379-7011-0 }}</ref><ref>{{cite news |url=http://www.newsday.com/news/new-york/obama-stood-out-even-during-brief-1985-nypirg-job-1.885513 |title = Obama stood out, even during brief 1985 NYPIRG job |date = November 9, 2008 |newspaper = Newsday |first = Jason |last = Fink }}</ref>
====Community organizer and Harvard Law School====
Two years after graduating from Columbia, Obama moved from New York to Chicago when he was hired as director of the [[Developing Communities Project]], a church-based community organization originally comprising eight Catholic parishes in [[Roseland, Chicago|Roseland]], [[West Pullman, Chicago|West Pullman]], and [[Riverdale, Chicago|Riverdale]] on Chicago's [[South Side, Chicago|South Side]]. He worked there as a community organizer from June 1985 to May 1988.<ref name="Who's Who 2008" /><ref>{{cite magazine|last=Lizza |first=Ryan |date=March 19, 2007 |title=The agitator: Barack Obama's unlikely political education |magazine=The New Republic |volume=236 |issue=12 |pages=22–26, 28–29 |issn=0028-6583 |url=http://www.tnr.com/article/the-agitator-barack-obamas-unlikely-political-education |access-date=August 21, 2007 }}
* {{cite news|last1=Secter |first1=Bob |last2=McCormick |first2=John |date=March 30, 2007 |title=Portrait of a pragmatist |newspaper=Chicago Tribune |page=1 |url=https://www.chicagotribune.com/news/nationworld/chi-0703300121mar30-archive,0,2491692,full.story |archive-url=https://web.archive.org/web/20091214172131/http://www.chicagotribune.com/news/nationworld/chi-0703300121mar30-archive%2C0%2C2491692%2Cfull.story |access-date=May 18, 2012 |archive-date=December 14, 2009 |url-status=dead }}
* Obama (1995, 2004), pp. 140–295.
* Mendell (2007), pp. 63–83.</ref> He helped set up a job training program, a college preparatory tutoring program, and a tenants' rights organization in [[Altgeld Gardens Homes (Chicago, Illinois)|Altgeld Gardens]].<ref name="Harvard Law 1990a">{{cite news |last = Matchan |first = Linda |date = February 15, 1990 |title = A Law Review breakthrough |newspaper = The Boston Globe |page = 29 |url=https://www.boston.com/news/politics/2008/articles/1990/02/15/a_law_review_breakthrough |access-date = June 15, 2008 }}
* {{cite news |last = Corr |first = John |date = February 27, 1990 |title = From mean streets to hallowed halls |newspaper = The Philadelphia Inquirer |page = C01 |format = paid archive |url=http://nl.newsbank.com/nl-search/we/Archives?p_multi=PI%7CDN%7C&p_product=PHNP&p_theme=phnp&p_action=search&p_maxdocs=200&s_dispstring=Author%28John%20Corr%29%20AND%20date%2802/27/1990%20to%2002/27/1990%29%20AND%20date%28all%29&p_field_advanced-0=Author&p_text_advanced-0=%28John%20Corr%29&p_bool_advanced-1=AND&p_params_advanced-1=date:B,E&p_field_advanced-1=YMD_date&p_text_advanced-1=%2802/27/1990%20to%2002/27/1990%29Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date = June 6, 2008 }}</ref> Obama also worked as a consultant and instructor for the [[Gamaliel Foundation]], a community organizing institute.<ref>{{cite magazine |last = Obama |first = Barack |date = August–September 1988 |title = Why organize? Problems and promise in the inner city |magazine = Illinois Issues |volume = 14 |issue = 8–9 |pages = 40–42 |issn = 0738-9663 }} reprinted in:{{break}}{{cite book |editor = Knoepfle, Peg |year = 1990 |title = After Alinsky: community organizing in Illinois |place = Springfield, IL |publisher = Sangamon State University |pages = 35–40 |isbn = 978-0-9620873-3-2 |quote = He has also been a consultant and instructor for the Gamaliel Foundation, an organizing institute working throughout the Midwest. }}</ref> In mid-1988, he traveled for the first time in Europe for three weeks and then for five weeks in Kenya, where he met many of his [[Family of Barack Obama#Paternal relations|paternal relatives]] for the first time.<ref name="Obama 2012">{{cite book |last = Obama |first = Auma |year = 2012 |title = And then life happens: a memoir |location = New York |publisher = St. Martin's Press |isbn = 978-1-250-01005-6 |pages = 189–208, 212–216 }}</ref><ref>Obama (1995, 2004), pp. 299–437.
* Maraniss (2012), pp. 564–570.</ref>
{{external media | float = right | video1 = [http://bostonlocaltv.org/catalog/V_UDAMVZGA4JEY06N Derrick Bell threatens to leave Harvard], April 24, 1990, 11:34, [[WGBH Educational Foundation|Boston TV Digital Archive]]<ref name="wgbh">{{cite news |url=http://bostonlocaltv.org/catalog/V_UDAMVZGA4JEY06N |title=Ten O'Clock News; Derrick Bell threatens to leave Harvard |date=April 24, 1990 |work=[[WGBH Educational Foundation|WGBH]], [[American Archive of Public Broadcasting]] |publisher=WGBH and the [[Library of Congress]] |location=Boston and Washington, D.C. |access-date=September 23, 2016}}</ref> Student Barack Obama introduces Professor Derrick Bell starting at 6:25. }}
Despite being offered a full scholarship to [[Northwestern University School of Law]], Obama enrolled at [[Harvard Law School]] in the fall of 1988, living in nearby [[Somerville, Massachusetts]].<ref>{{cite news |newspaper=Somerville Scout |issue=January/February 2014 |page=26 |title=Something in the Water |url=https://scoutsomerville.com/feature-something-in-the-water/ |author1=Joey Del Ponte |author2=Somerville Scout Staff |quote=Barack Obama lived in the big, ivy-covered brick building at 365 Broadway{{nbs}}... From 1988 to 1991, the future president resided in a basement apartment while attending Harvard Law School. |access-date=January 1, 2020 |archive-date=January 1, 2020 |archive-url=https://web.archive.org/web/20200101163528/https://scoutsomerville.com/feature-something-in-the-water/ |url-status=dead }}</ref> He was selected as an editor of the ''[[Harvard Law Review]]'' at the end of his first year,<ref name="Harvard Law 2007">{{cite news |first1 = Michael |last1 = Levenson |first2 = Jonathan |last2 = Saltzman |date = January 28, 2007 |title = At Harvard Law, a unifying voice |newspaper = Boston Globe |page = 1A |url=http://archive.boston.com/news/local/articles/2007/01/28/at_harvard_law_a_unifying_voice/ |access-date = June 15, 2008 }}
* {{cite news |author = Kantor, Jodi |date = January 28, 2007 |title = In law school, Obama found political voice |newspaper = The New York Times |page = A1 |url=https://www.nytimes.com/2007/01/28/us/politics/28obama.html |archive-url=https://web.archive.org/web/20070307091848/http://www.nytimes.com/2007/01/28/us/politics/28obama.html |archive-date=March 7, 2007 |url-access=subscription |url-status=live |access-date = June 15, 2008 }}
* {{cite news |author = Mundy, Liza |date = August 12, 2007 |title = A series of fortunate events |newspaper = The Washington Post |page = W10 |url=https://www.washingtonpost.com/wp-dyn/content/article/2007/08/08/AR2007080802038_pf.html |access-date = June 15, 2008 }}
* Mendell (2007), pp. 80–92.</ref> president of the journal in his second year,<ref name="Harvard Law 1990a" /><ref name="Harvard Law 1990b">{{cite news |author = Butterfield, Fox |date = February 6, 1990 |title = First black elected to head Harvard's Law Review |newspaper = The New York Times |page = A20 |url = https://www.nytimes.com/1990/02/06/us/first-black-elected-to-head-harvard-s-law-review.html |access-date = June 15, 2008 }}
* {{cite news |author = Ybarra, Michael J |date = February 7, 1990 |title = Activist in Chicago now heads Harvard Law Review |newspaper = Chicago Tribune |page = 3 |url = https://www.chicagotribune.com/news/ct-xpm-1990-02-07-9001110408-story.html |access-date = October 29, 2011 }}
* {{cite news |author = Drummond, Tammerlin |date = March 12, 1990 |title = Barack Obama's law; Harvard Law Review's first black president plans a life of public service |newspaper = Los Angeles Times |page = E1 |format = paid archive |url = https://pqasb.pqarchiver.com/latimes/access/60017156.html?dids=60017156:60017156&FMT=ABS&FMTS=ABS:FT |access-date = June 15, 2008 |archive-date = June 17, 2008 |archive-url = https://web.archive.org/web/20080617150504/http://pqasb.pqarchiver.com/latimes/access/60017156.html?dids=60017156:60017156&FMT=ABS&FMTS=ABS:FT |url-status = dead }}
* {{cite magazine |last = Evans |first = Gaynelle |date = March 15, 1990 |title = Opening another door: The saga of Harvard's Barack H. Obama |magazine = Black Issues in Higher Education |volume = 7 |issue = 1 |page = 5 |issn = 0742-0277 |url = https://diverseeducation.com/article/11791/ |access-date = May 18, 2012 }}
* {{cite news |author = Pugh, Allison J. |agency = Associated Press |date = April 18, 1990 |title = Law Review's first black president aims to help poor |newspaper = The Miami Herald |page = C01 |url = https://allisonpugh.weebly.com/uploads/4/4/7/8/44787215/miami_herald__22law_review_president_22.pdf |access-date = January 1, 2020 }}</ref> and research assistant to the constitutional scholar [[Laurence Tribe]] while at Harvard for two years.<ref>{{YouTube|wzmmBZ7i4BQ}}</ref> During his summers, he returned to Chicago, where he worked as a [[Associate attorney#Summer associates|summer associate]] at the law firms of [[Sidley Austin]] in 1989 and [[Hopkins & Sutter]] in 1990.<ref>{{cite news |author = Aguilar, Louis |date = July 11, 1990 |title = Survey: Law firms slow to add minority partners |archive-url=https://web.archive.org/web/20080929145015/https://pqasb.pqarchiver.com/chicagotribune/access/28774085.html?dids=28774085:28774085&FMT=ABS&FMTS=ABS:FT |archive-date=September 29, 2008 |newspaper = Chicago Tribune |page = 1 (Business) |url=https://pqasb.pqarchiver.com/chicagotribune/access/28774085.html?dids=28774085:28774085&FMT=ABS&FMTS=ABS:FT |access-date = June 15, 2008 }}</ref> After graduating with a [[Juris Doctor]] ''[[magna cum laude]]''<ref name="Juris Doctor" /> from Harvard in 1991, he returned to Chicago.<ref name="Harvard Law 2007" /> Obama's election as the [[List of African-American firsts|first black president of the ''Harvard Law Review'']] gained national media attention<ref name="Harvard Law 1990a" /><ref name="Harvard Law 1990b" /> and led to a publishing contract and advance for a book about race relations,<ref name="Scott 2008a">{{cite news |author = Scott, Janny |date = May 18, 2008 |title = The story of Obama, written by Obama |newspaper = The New York Times |page = A1 |url=https://www.nytimes.com/2008/05/18/us/politics/18memoirs.html |access-date = June 15, 2008 }}
* Obama (1995, 2004), pp. xiii–xvii.</ref> which evolved into a personal memoir. The manuscript was published in mid-1995 as ''[[Dreams from My Father]]''.<ref name="Scott 2008a" />
====University of Chicago Law School====
In 1991, Obama accepted a two-year position as Visiting Law and Government Fellow at the [[University of Chicago Law School]] to work on his first book.<ref name="Scott 2008a" /><ref name="Fellow" /> He then taught [[constitutional law]] at the University of Chicago Law School for twelve years, first as a [[lecturer]] from 1992 to 1996, and then as a senior lecturer from 1996 to 2004.<ref>{{cite web |date = March 27, 2008 |title = Statement regarding Barack Obama |publisher = University of Chicago Law School |url=http://www.law.uchicago.edu/media/index.html |access-date = June 5, 2008 |archive-url=https://web.archive.org/web/20080608225931/http://www.law.uchicago.edu/media/index.html |archive-date = June 8, 2008 |url-status=dead }}
* {{cite web |last=Miller |first=Joe |date = March 28, 2008 |title = Was Barack Obama really a constitutional law professor? |work=FactCheck.org |url=https://www.factcheck.org/2008/03/obama-a-constitutional-law-professor/ |access-date = May 18, 2012 }}
* {{cite web |last=Holan |first=Angie Drobnic |date=March 7, 2008 |title = Obama's 20 years of experience |work=PolitiFact.com |url=https://www.politifact.com/truth-o-meter/article/2008/mar/07/obamas-20-years-experience/ |access-date = June 10, 2008 }}</ref>
From April to October 1992, Obama directed Illinois's [[Project Vote]], a [[voter registration campaign]] with ten staffers and seven hundred volunteer registrars; it achieved its goal of registering 150,000 of 400,000 unregistered African Americans in the state, leading ''[[Crain's Chicago Business]]'' to name Obama to its 1993 list of "40 under Forty" powers to be.<ref name="Forty" />
===Family and personal life===
{{Main|Family of Barack Obama}}
In a 2006 interview, Obama highlighted the diversity of [[family of Barack Obama|his extended family]]: "It's like a little mini-United Nations," he said. "I've got relatives who look like [[Bernie Mac]], and I've got relatives who look like [[Margaret Thatcher]]."<ref>{{cite web |url=http://www.oprah.com/slideshow/oprahshow/oprahshow1_ss_20061018/10 |title = Keeping Hope Alive: Barack Obama Puts Family First |date = October 18, 2006|website = The Oprah Winfrey Show |access-date = June 24, 2008}}</ref> Obama has a half-sister with whom he was raised ([[Maya Soetoro-Ng]]) and seven other half-siblings from his Kenyan father's family—six of them living.<ref>{{cite news |first=Scott |last=Fornek |title=Half Siblings: 'A Complicated Family' |date=September 9, 2007 |url=http://www.suntimes.com/news/politics/obama/familytree/545462,BSX-News-wotrees09.stng |archive-url=https://www.webcitation.org/5msGZ6sKn?url=http://www.suntimes.com/news/politics/obama/familytree/545462,BSX-News-wotrees09.stng |archive-date=January 18, 2010 |work=Chicago Sun-Times |access-date=June 24, 2008 |url-status=dead}} See also: {{cite news |url=http://www.suntimes.com/images/cds/special/family_tree.html |archive-url=https://web.archive.org/web/20080703042659/http://www.suntimes.com/images/cds/special/family_tree.html |archive-date=July 3, 2008 |title=Interactive Family Tree |date=September 9, 2007 |work=Chicago Sun-Times |access-date=June 24, 2008 }}</ref> Obama's mother was survived by her Kansas-born mother, [[Madelyn Dunham]],<ref>{{cite news |first=Scott |last=Fornek |title=Madelyn Payne Dunham: 'A Trailblazer' |date=September 9, 2007 |url=http://www.suntimes.com/news/politics/obama/familytree/545449,BSX-News-wotreeee09.stng |archive-url=https://web.archive.org/web/20090304232433/http://www.suntimes.com/news/politics/obama/familytree/545449,BSX-News-wotreeee09.article |archive-date=March 4, 2009 |work=Chicago Sun-Times |access-date=June 24, 2008 |url-status=live}}</ref> until her death on November 2, 2008,<ref>{{cite news |url=http://www.cnn.com/2008/POLITICS/11/03/obama.grandma/index.html |title = Obama's grandmother dies after battle with cancer |publisher = CNN |access-date = November 4, 2008 |date = November 3, 2008 |archive-url=https://web.archive.org/web/20081103235343/http://www.cnn.com/2008/POLITICS/11/03/obama.grandma/index.html |archive-date = November 3, 2008 |url-status=live }}</ref> two days before his election to the presidency. Obama also has roots in Ireland; he met with his Irish cousins in [[Moneygall]] in May 2011.<ref>{{cite news |url=https://www.huffingtonpost.com/megan-smolenyak-smolenyak/tracing-barack-obamas-roo_b_859151.html |title = Tracing Barack Obama's Roots to Moneygall |date = May 9, 2011 |work = The Huffington Post |first = Megan |last = Smolenyak }}</ref> In ''Dreams from My Father'', Obama ties his mother's family history to possible Native American ancestors and distant relatives of [[Jefferson Davis]], [[President of the Confederate States of America]] during the [[American Civil War]]. He also shares distant ancestors in common with [[George W. Bush]] and [[Dick Cheney]], among others.<ref>Obama (1995, 2004), p. 13. For reports on Obama's maternal genealogy, including slave owners, Irish connections, and common ancestors with George W. Bush, [[Dick Cheney]], and [[Harry S. Truman]], see: {{cite news|first1=David |last1=Nitkin |first2=Harry |last2=Merritt |title=A New Twist to an Intriguing Family History |date=March 2, 2007 |url=http://www.baltimoresun.com/news/nationworld/politics/bal-te.obama02mar02,0,3453027.story |archive-url=https://web.archive.org/web/20070930033339/http://www.baltimoresun.com/news/nationworld/politics/bal-te.obama02mar02%2C0%2C3453027.story |archive-date=September 30, 2007 |work=The Baltimore Sun |access-date=June 24, 2008 |url-status=dead }}</ref><ref>{{cite news|first=Mary |last=Jordan |title=Tiny Irish Village Is Latest Place to Claim Obama as Its Own |date=May 13, 2007 |url=https://www.washingtonpost.com/wp-dyn/content/article/2007/05/12/AR2007051201551.html |newspaper=The Washington Post |access-date=June 24, 2008 }}</ref><ref>{{cite news|title=Obama's Family Tree Has a Few Surprises |date=September 8, 2007 |publisher=CBS 2 (Chicago) |url=http://cbs2chicago.com/topstories/Barack.Obama.family.2.339709.html |agency=Associated Press |access-date=June 24, 2008 |archive-url=https://web.archive.org/web/20080602215833/http://cbs2chicago.com/topstories/Barack.Obama.family.2.339709.html |archive-date=June 2, 2008 }}</ref>
Obama lived with anthropologist [[Sheila Miyoshi Jager]] while he was a community organizer in Chicago in the 1980s.<ref name="theindependentbeforemichelle">{{cite news|last1=Hosie|first1=Rachel|title=BEFORE MICHELLE: THE STORY OF BARACK OBAMA'S PROPOSAL TO SHEILA MIYOSHI JAGER|url=https://www.independent.co.uk/life-style/before-michelle-barack-obama-sheila-miyoshi-jager-engagement-chicago-us-president-david-j-garrow-a7714771.html|access-date=May 11, 2017|work=The Independent|date=May 3, 2017}}</ref> He proposed to her twice, but both Jager and her parents turned him down.<ref name="theindependentbeforemichelle" /><ref name="tobiasoberlincollegeprofessor">{{cite news|last1=Tobias|first1=Andrew J.|title=Oberlin College professor received unsuccessful marriage proposal from Barack Obama in 1980s, new biography reveals|url=http://www.cleveland.com/politics/index.ssf/2017/05/oberlin_college_professor_rece.html|access-date=May 11, 2017|work=The Plain Dealer|date=May 3, 2017}}</ref> The relationship was not made public until May 2017, several months after his presidency had ended.<ref name="tobiasoberlincollegeprofessor" />
[[File:Obama family portrait in the Green Room.jpg|thumb|Obama poses in the [[Green Room (White House)|Green Room]] of the White House with wife Michelle and daughters Sasha and Malia, 2009]]
In June 1989, Obama met [[Michelle Obama|Michelle Robinson]] when he was employed as a summer associate at the Chicago law firm of [[Sidley Austin]].<ref>Obama (2006), pp. 327–332. See also: {{cite news |first = Sarah |last = Brown |title = Obama '85 masters balancing act |work = The Daily Princetonian |url=http://www.dailyprincetonian.com/2005/12/07/14049 |date = December 7, 2005 |access-date = February 9, 2009 |archive-url=https://web.archive.org/web/20090220165725/http://www.dailyprincetonian.com/2005/12/07/14049/ |archive-date = February 20, 2009 }}</ref> Robinson was assigned for three months as Obama's adviser at the firm, and she joined him at several group social functions but declined his initial requests to date.<ref>Obama (2006), p. 329.</ref> They began dating later that summer, became engaged in 1991, and were married on October 3, 1992.<ref>{{cite news |author=Fornek, Scott |title=Michelle Obama: 'He Swept Me Off My Feet' |date=October 3, 2007 |url=http://www.suntimes.com/news/politics/obama/585261,CST-NWS-wedding03.stng |archive-url=https://web.archive.org/web/20091208051056/http://www.suntimes.com/news/politics/obama/585261,CST-NWS-wedding03.stng |archive-date=December 8, 2009 |work=Chicago Sun-Times |access-date=April 28, 2008 |url-status=dead}}</ref> After suffering a miscarriage, Michelle underwent [[in vitro fertilization]] to conceive their children.<ref>{{cite news|url=https://www.telegraph.co.uk/news/2018/11/09/michelle-obama-had-miscarriage-used-ivf-conceive-girls/ |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/news/2018/11/09/michelle-obama-had-miscarriage-used-ivf-conceive-girls/ |archive-date=January 10, 2022 |url-access=subscription |url-status=live|title=Michelle Obama had miscarriage, used IVF to conceive girls|first=Ben|last=Riley-Smith|date=November 9, 2018|access-date=November 15, 2018|newspaper=The Telegraph}}{{cbignore}}</ref> The couple's first daughter, Malia Ann, was born in 1998,<ref>{{cite news |url=http://www.politico.com/blogs/jonathanmartin/0708/Born_on_the_4th_of_July.html |title = Born on the 4th of July |date = July 4, 2008 |access-date = July 10, 2008 |work = Politico |last = Martin |first = Jonathan |archive-url=https://web.archive.org/web/20080710073536/http://www.politico.com/blogs/jonathanmartin/0708/Born_on_the_4th_of_July.html |archive-date = July 10, 2008 |url-status=live }}</ref> followed by a second daughter, Natasha ("Sasha"), in 2001.<ref>Obama (1995, 2004), p. 440, and Obama (2006), pp. 339–340. See also: {{cite web |title = Election 2008 Information Center: Barack Obama |url=http://www.gannettnewsservice.com/?cat=153 |publisher = Gannett News Service |access-date = April 28, 2008 }}</ref> The Obama daughters attended the [[University of Chicago Laboratory Schools]]. When they moved to Washington, D.C., in January 2009, the girls started at the [[Sidwell Friends School]].<ref>{{cite web |url=http://iht.com/articles/ap/2008/11/22/america/Obama-School.php |archive-url=https://web.archive.org/web/20090129194323/http://iht.com/articles/ap/2008/11/22/america/Obama-School.php |title = Obamas choose private Sidwell Friends School |website = International Herald Tribune |date = November 22, 2008 |access-date = July 2, 2015 |archive-date = January 29, 2009 }}</ref> The Obamas had two [[Portuguese Water Dog]]s; the first, a male named [[Bo (dog)|Bo]], was a gift from Senator [[Ted Kennedy]].<ref>{{cite news |url=https://www.nytimes.com/2009/04/13/us/politics/13obama.html |archive-url=https://web.archive.org/web/20090416023426/http://www.nytimes.com/2009/04/13/us/politics/13obama.html |archive-date=April 16, 2009 |url-access=subscription |url-status=live |title = One Obama Search Ends With a Puppy Named Bo |work = The New York Times |date = April 13, 2009 |access-date = December 22, 2010 |first = Helene |last = Cooper }}</ref> In 2013, Bo was joined by [[Sunny (dog)|Sunny]], a female.<ref name=Feldmann>{{Cite journal |last = Feldmann |first = Linda |title = New little girl arrives at White House. Meet Sunny Obama. (+video) |url=http://www.csmonitor.com/USA/DC-Decoder/Decoder-Wire/2013/0820/New-little-girl-arrives-at-White-House.-Meet-Sunny-Obama.-video |journal = Christian Science Monitor |access-date = August 20, 2013 |date = August 20, 2013 }}</ref> Bo died of cancer on May 8, 2021.<ref>{{Cite news|last=Wang|first=Amy|date=May 8, 2021|title=Obamas announce death of dog Bo, 'a true friend and loyal companion'|url=https://www.washingtonpost.com/science/2021/05/08/obama-dog-bo-dies/|access-date=May 8, 2021|newspaper=The Washington Post}}</ref>
[[File:Barack Obama playing basketball with members of Congress and Cabinet secretaries 2.jpg|thumb|upright|left|alt=Obama about to take a shot while three other players look at him. One of those players attempts to block Obama.|Obama playing in a [[Pick-up game|pickup game]] on the [[White House]] basketball court, 2009]]
Obama is a supporter of the [[Chicago White Sox]], and he threw out the first pitch at the [[2005 American League Championship Series|2005 ALCS]] when he was still a senator.<ref>{{cite news |title = Barack Obama: White Sox 'serious' ball |date = August 25, 2008 |first = Mark |last = Silva |work = Chicago Tribune |url=http://www.swamppolitics.com/news/politics/blog/2008/08/barack_obama_white_sox_serious.html |archive-url=https://web.archive.org/web/20080829134235/http://www.swamppolitics.com/news/politics/blog/2008/08/barack_obama_white_sox_serious.html |archive-date = August 29, 2008 }}</ref> In 2009, he threw out the ceremonial first pitch at the [[2009 Major League Baseball All-Star Game|All-Star Game]] while wearing a White Sox jacket.<ref>{{cite web |title = Barack Obama Explains White Sox Jacket, Talks Nats in All-Star Booth Visit |date = July 14, 2009 |publisher = MLB Fanhouse |url=http://www.yardbarker.com/all_sports/articles/barack_obama_explains_white_sox_jacket_talks_nats_in_all_star_booth_visit/803700 |access-date = December 6, 2009 |archive-url=https://web.archive.org/web/20120704194211/http://www.yardbarker.com/all_sports/articles/barack_obama_explains_white_sox_jacket_talks_nats_in_all_star_booth_visit/803700 |archive-date = July 4, 2012 |url-status = dead }}</ref> He is also primarily a [[Chicago Bears]] football fan in the [[National Football League|NFL]], but in his childhood and adolescence was a [[Steeler Nation|fan of the Pittsburgh Steelers]], and rooted for them ahead of their victory in [[Super Bowl XLIII]] 12 days after he took office as president.<ref name="Steelers">{{cite news |last = Branigin |first = William |title = Steelers Win Obama's Approval |newspaper = The Washington Post |date = January 30, 2009 |url=https://www.washingtonpost.com/wp-dyn/content/article/2009/01/29/AR2009012903196.html |quote = But other than the Bears, the Steelers are probably the team that's closest to my heart. }}</ref> In 2011, Obama invited the [[1985 Chicago Bears season|1985 Chicago Bears]] to the White House; the team had not visited the White House after their [[Super Bowl XX|Super Bowl win]] in 1986 due to the [[Space Shuttle Challenger disaster]].<ref>{{cite web |last = Mayer |first = Larry |url=http://www.chicagobears.com/news/article-1/85-Bears-honored-by-President-Obama-at-White-House/A3C494F7-6681-44BB-850A-61EEE18315E4 |title = 1985 Bears honored by President Obama |publisher = [[Chicago Bears]] |date = October 7, 2011 |access-date = November 4, 2012 |archive-url=https://web.archive.org/web/20130507094538/http://www.chicagobears.com/news/article-1/85-Bears-honored-by-President-Obama-at-White-House/A3C494F7-6681-44BB-850A-61EEE18315E4 |archive-date = May 7, 2013 |url-status=dead }}</ref> He plays basketball, a sport he participated in as a member of his high school's varsity team,<ref>{{cite news |first = Jodi |last = Kantor |title = One Place Where Obama Goes Elbow to Elbow |date = June 1, 2007 |url=https://www.nytimes.com/2007/06/01/us/politics/01hoops.html |work = The New York Times |access-date = April 28, 2008 |archive-url=https://web.archive.org/web/20090401222632/http://www.nytimes.com/2007/06/01/us/politics/01hoops.html|archive-date=April 1, 2009 |url-status=live }} See also: {{cite news |title = The Love of the Game |format = video |date = April 15, 2008 |work = Real Sports with Bryant Gumbel |publisher = HBO |url=http://www.hbo.com/real-sports-with-bryant-gumbel/episodes#/real-sports-with-bryant-gumbel/episodes/0/133-april-15-2008/index.html |access-date = October 12, 2011 }}</ref> and he is left-handed.<ref>{{cite news |url=https://www.nytimes.com/2009/01/22/us/politics/22obama.html |archive-url=https://web.archive.org/web/20090123145020/http://www.nytimes.com/2009/01/22/us/politics/22obama.html |archive-date=January 23, 2009 |url-access=subscription |url-status=live |title = On First Day, Obama Quickly Sets a New Tone |last = Stolberg |first = Sheryl Gay |author2 = Kirkpatrick, David D. |author3 = Shane, Scott |date = January 22, 2009 |work = The New York Times |page = 1 |access-date = September 7, 2012 }}</ref>
In 2005, the Obama family applied the proceeds of a book deal and moved from a [[Hyde Park, Chicago]] condominium to a $1.6{{nbs}}million house (equivalent to ${{Inflation|US|1.6|2005|r=1}}{{nbs}}million in {{Inflation-year|US}}) in neighboring [[Kenwood, Chicago]].<ref>{{cite news |first=Jeff |last=Zeleny |title=The first time around: Sen. Obama's freshman year |date=December 24, 2005 |url=https://www.chicagotribune.com/news/local/chi-051224obama,0,1779783,full.story |work=Chicago Tribune |access-date=April 28, 2008 |archive-url=https://web.archive.org/web/20110513214525/http://www.chicagotribune.com/news/local/chi-051224obama%2C0%2C1779783%2Cfull.story |archive-date=May 13, 2011 |url-status=dead }}</ref> The purchase of an adjacent lot—and sale of part of it to Obama by the wife of developer, campaign donor and friend [[Tony Rezko]]—attracted media attention because of Rezko's subsequent indictment and conviction on political corruption charges that were unrelated to Obama.<ref name="corruption charges" />
In December 2007, ''[[Money (magazine)|Money Magazine]]'' estimated Obama's net worth at $1.3{{nbs}}million (equivalent to ${{Inflation|US|1.3|2007|r=1}}{{nbs}}million in {{Inflation-year|US}}).<ref>{{cite news |title = Obama's Money |date = December 7, 2007 |url=https://money.cnn.com/galleries/2007/moneymag/0712/gallery.candidates.moneymag/5.html |publisher = [[CNNMoney]] |access-date = April 28, 2008 |first = Marlys |last = Harris |archive-url=https://web.archive.org/web/20080424113420/https://money.cnn.com/galleries/2007/moneymag/0712/gallery.candidates.moneymag/5.html |archive-date = April 24, 2008 |url-status=live }}{{break}}See also:{{cite news |first = Zachary A |last = Goldfarb |title = Measuring Wealth of the '08 Candidates |date = March 24, 2007 |url=https://www.washingtonpost.com/wp-dyn/content/article/2007/03/24/AR2007032400305.html |newspaper = The Washington Post |access-date = April 28, 2008 }}</ref> Their 2009 tax return showed a household income of $5.5{{nbs}}million—up from about $4.2{{nbs}}million in 2007 and $1.6{{nbs}}million in 2005—mostly from sales of his books.<ref>{{cite news |first = Jeff |last = Zeleny |title = Book Sales Lifted Obamas' Income in 2007 to a Total of $4.2 Million |url=https://www.nytimes.com/2008/04/17/us/politics/17obama.html |date = April 17, 2008 |work = The New York Times |access-date = April 28, 2008 |archive-url=https://web.archive.org/web/20090416015848/http://www.nytimes.com/2008/04/17/us/politics/17obama.html|archive-date=April 16, 2009 |url-status=live }}</ref><ref>{{cite news |url=https://www.washingtonpost.com/wp-dyn/content/article/2010/04/15/AR2010041504485.html |title = Obamas report $5.5 million in income on 2009 tax return |newspaper = The Washington Post |date = April 16, 2010 |access-date = December 22, 2010 |first1 = Michael D. |last1 = Shear |first2 = David S. |last2 = Hilzenrath }}</ref> On his 2010 income of $1.7{{nbs}}million, he gave 14 percent to non-profit organizations, including $131,000 to [[Fisher House Foundation]], a charity assisting wounded veterans' families, allowing them to reside near where the veteran is receiving medical treatments.<ref>{{cite news |url=https://www.pbs.org/newshour/businessdesk/2011/04/how-much-did-president-obama-m.html |date = April 18, 2011 |title = How Much Did President Obama Make in 2010? |work = [[PBS NewsHour]] |first = Paul |last = Solman |archive-url=https://web.archive.org/web/20110502113725/http://www.pbs.org/newshour/businessdesk/2011/04/how-much-did-president-obama-m.html |archive-date = May 2, 2011 |access-date = January 27, 2012 }}</ref><ref>{{cite news |url=https://www.pbs.org/newshour/rundown/2011/04/the-obamas-gave-131000-to-the-fisher-house-foundation-last-year-what-is-it.html |date = April 27, 2011 |title = The Obamas Gave $131,000 to Fisher House Foundation in 2010; What Is It? |work = [[PBS NewsHour]] |first = Paul |last = Solman |archive-url=https://web.archive.org/web/20140129072652/http://www.pbs.org/newshour/rundown/2011/04/the-obamas-gave-131000-to-the-fisher-house-foundation-last-year-what-is-it.html |archive-date = January 29, 2014 |access-date = January 27, 2012 }}</ref> Per his 2012 financial disclosure, Obama may be worth as much as $10{{nbs}}million.<ref name="networth12">{{cite news |url=http://content.usatoday.com/communities/theoval/post/2012/05/obama-worth-as-much-as-10-million/1 |title = Obama worth as much as $10 million |last = Wolf |first = Richard |date = May 16, 2012 |work = [[USA Today]] |access-date = June 16, 2012 }}</ref>
===Religious views===
Obama is a [[Protestant]] Christian whose religious views developed in his adult life.<ref name="Christian" /> He wrote in ''[[The Audacity of Hope]]'' that he "was not raised in a religious household." He described his mother, raised by non-religious parents, as being detached from religion, yet "in many ways the most spiritually awakened person{{nbsp}}... I have ever known", and "a lonely witness for [[secular humanism]]." He described his father as a "confirmed [[Atheism|atheist]]" by the time his parents met, and his stepfather as "a man who saw religion as not particularly useful." Obama explained how, through working with [[black church]]es as a [[Community organizing|community organizer]] while in his twenties, he came to understand "the power of the African-American religious tradition to spur social change."<ref name="social change" />
[[File:Obamas at church on Inauguration Day 2013.jpg|thumb|The Obamas worship at [[African Methodist Episcopal Church]] in Washington, D.C., January 2013]]
In January 2008, Obama told ''[[Christianity Today]]'': "I am a Christian, and I am a devout Christian. I believe in the [[Redeemer (Christianity)|redemptive death]] and [[resurrection of Jesus]] Christ. I believe that faith gives me a path to be cleansed of sin and have eternal life."<ref>{{cite news |last1 = Pulliam |first1 = Sarah |last2 = Olsen |first2 = Ted |url=http://www.christianitytoday.com/ct/2008/januaryweb-only/104-32.0.html?start=2 |title = Q&A: Barack Obama |work = Christianity Today |date = January 23, 2008 |access-date = January 4, 2013 }}</ref> On September 27, 2010, Obama released a statement commenting on his religious views, saying: {{blockquote|I'm a Christian by choice. My family didn't—frankly, they weren't folks who went to church every week. And my mother was one of the most spiritual people I knew, but she didn't raise me in the church. So I came to my Christian faith later in life, and it was because the precepts of [[Jesus Christ]] spoke to me in terms of the kind of life that I would want to lead—being my brothers' and sisters' keeper, [[Golden Rule|treating others as they would treat me]].<ref name="APbychoice">{{cite news|url=https://www.huffingtonpost.com/2010/09/28/obama-christian-by-choice_n_742124.html|title=Obama 'Christian By Choice': President Responds To Questioner|last1=Babington|first1=Charles|last2=Superville|first2=Darlene|agency=Associated Press|date=September 28, 2010|work=The Huffington Post|url-status=dead|archive-url=https://web.archive.org/web/20110511232554/http://www.huffingtonpost.com/2010/09/28/obama-christian-by-choice_n_742124.html|archive-date=May 11, 2011}}</ref><ref name="ABCVideobychoice">{{cite news|url=http://blogs.abcnews.com/politicalpunch/2010/09/president-obama-i-am-a-christian-by-choicethe-precepts-of-jesus-spoke-to-me.html|title=President Obama: 'I am a Christian By Choice ... The Precepts of Jesus Spoke to Me'|work=[[ABC News]]|date=September 29, 2010|access-date=December 27, 2016|archive-url=https://archive.today/20120713041729/http://abcnews.go.com/blogs/politics/2010/09/president-obama-i-am-a-christian-by-choicethe-precepts-of-jesus-spoke-to-me/|archive-date=July 13, 2012|url-status=dead}}</ref>}}
Obama met [[Trinity United Church of Christ]] pastor [[Jeremiah Wright]] in October 1987 and became a member of Trinity in 1992.<ref name="Trinity" /> During Obama's first presidential campaign in May 2008, he resigned from Trinity after [[Jeremiah Wright controversy|some of Wright's statements were criticized]].<ref>{{cite news |agency = Associated Press |date = November 17, 2008 |title = Obama's church choice likely to be scrutinized |work = NBC News |url=https://www.nbcnews.com/id/27775757 |access-date = January 20, 2009 }}</ref> Since moving to Washington, D.C., in 2009, the Obama family has attended several Protestant churches, including [[Shiloh Baptist Church (Washington, D.C.)|Shiloh Baptist Church]] and [[St. John's Episcopal Church, Lafayette Square|St. John's Episcopal Church]], as well as Evergreen Chapel at [[Camp David]], but the members of the family do not attend church on a regular basis.<ref>{{cite news |last=Parker |first=Ashley |url=https://www.nytimes.com/2013/12/29/us/as-the-obamas-celebrate-christmas-rituals-of-faith-stay-on-the-sidelines.html |archive-url=https://web.archive.org/web/20131230064130/http://www.nytimes.com//2013/12/29/us/as-the-obamas-celebrate-christmas-rituals-of-faith-stay-on-the-sidelines.html |archive-date=December 30, 2013 |url-access=subscription |url-status=live |title=As the Obamas Celebrate Christmas, Rituals of Faith Become Less Visible |work=The New York Times |date=December 28, 2013 |access-date=January 15, 2017 }}</ref><ref>{{cite news |last=Gilgoff |first=Dan |url=https://www.usnews.com/news/blogs/god-and-country/2009/06/30/time-report-white-house-reaction-raise-more-questions-about-obamas-church-hunt |title=TIME Report, White House Reaction Raise More Questions About Obama's Church Hunt |work=U.S. News & World Report |date=June 30, 2009 |access-date=January 15, 2017 }}</ref><ref>{{cite news |url=https://washington.cbslocal.com/2014/04/22/first-lady-we-use-sundays-for-naps-if-were-not-going-to-church/ |title=First Lady: We Use Sundays For Naps If We're Not Going To Church |publisher=CBS DC |agency=Associated Press |date=April 22, 2014 |access-date=January 15, 2017 }}</ref>
In 2016, he said that he gets inspiration from a few items that remind him "of all the different people I've met along the way", adding: "I carry these around all the time. I'm not that superstitious, so it's not like I think I necessarily have to have them on me at all times." The items, "a whole bowl full", include rosary beads given to him by [[Pope Francis]], a figurine of the Hindu deity [[Hanuman]], a [[Coptic cross]] from Ethiopia, a small [[Buddha statue]] given by a monk, and a metal poker chip that used to be the lucky charm of a motorcyclist in Iowa.<ref>{{cite news |title=Revealed: Obama always carries Hanuman statuette in pocket |url=https://www.thehindu.com/news/international/Revealed-Obama-always-carries-Hanuman-statuette-in-pocket/article14001552.ece |access-date=April 8, 2021 |work=[[The Hindu]] |date=January 16, 2016 |language=en-IN}}</ref><ref>{{cite web |title=Obama Reveals Lucky Charms During Interview |url=https://www.youtube.com/watch?v=ox6LidnmbPM |publisher=[[Associated Press]] |access-date=April 8, 2021 |language=en |date=January 16, 2016}}</ref>
== Legal career ==
=== Civil Rights attorney ===
He joined Davis, Miner, Barnhill & Galland, a 13-attorney law firm specializing in civil rights litigation and neighborhood economic development, where he was an [[associate attorney|associate]] for three years from 1993 to 1996, then [[of counsel]] from 1996 to 2004.{{failed verification|date=October 2021}} In 1994, he was listed as one of the lawyers in ''Buycks-Roberson v. Citibank Fed. Sav. Bank'', 94 C 4094 (N.D. Ill.).<ref>{{cite web |url=https://www.clearinghouse.net/chDocs/public/FH-IL-0011-9000.pdf |title = Civil Docket for Case #: 1:94-cv-04094 |author = <nowiki>United States District Court: Northern District of Illinois—CM/ECF LIVE, Ver 3.0 (Chicago)</nowiki> |date = July 6, 1994 |publisher = clearinghouse.net |access-date = June 3, 2016 }}</ref> This [[Class-action lawsuit|class action lawsuit]] was filed in 1994 with Selma Buycks-Roberson as lead plaintiff and alleged that Citibank Federal Savings Bank had engaged in practices forbidden under the [[Equal Credit Opportunity Act]] and the [[Fair Housing Act]].<ref>{{cite web |url=https://www.clearinghouse.net/detail.php?id=10112 |title = Buycks-Roberson v. Citibank Fed. Sav. Bank—Civil Rights Litigation Clearinghouse |publisher = clearinghouse.net |access-date = November 25, 2015 }}</ref> The case was settled out of court.<ref>{{cite web |url=https://www.clearinghouse.net/chDocs/public/FH-IL-0011-0008.pdf |title = Settlement Agreement |author = United States District Court for the Northern District of Illinois Eastern Division |date = January 16, 1988 |publisher = clearinghouse.net |access-date = June 3, 2016 }}</ref> Final judgment was issued on May 13, 1998, with Citibank Federal Savings Bank agreeing to pay attorney fees.<ref>{{cite web |url=https://www.clearinghouse.net/chDocs/public/FH-IL-0011-0010.pdf |title = Final Judgment and Order of Dismissal |author = United States District Court For the Northern District of Illinois Eastern Division |date = May 13, 1998 |publisher = clearinghouse.net |access-date = June 3, 2016 }}</ref>
From 1994 to 2002, Obama served on the boards of directors of the [[Woods Fund of Chicago]]—which in 1985 had been the first foundation to fund the Developing Communities Project—and of the [[Joyce Foundation]].<ref name="Who's Who 2008" /> He served on the board of directors of the [[Chicago Annenberg Challenge]] from 1995 to 2002, as founding president and chairman of the board of directors from 1995 to 1999.<ref name="Who's Who 2008" /> Obama's law license became inactive in 2007.<ref>{{cite web |url=https://www.factcheck.org/2012/06/the-obamas-law-licenses/ |title = The Obamas' Law Licenses |publisher = FactCheck.org |date = June 14, 2012 |access-date = July 16, 2012 |last=Gore |first=D'Angelo }}</ref><ref name="DavisMiner" />
== Legislative career ==
=== Illinois Senate (1997–2004) ===
{{Main|Illinois Senate career of Barack Obama}}
[[File:Obamamiltondavis1.jpg|thumb|State Senator Obama and others celebrate the naming of a street in Chicago after [[ShoreBank]] co-founder Milton Davis in 1998]]
Obama was elected to the [[Illinois Senate]] in 1996, succeeding Democratic State Senator [[Alice Palmer (politician)|Alice Palmer]] from Illinois's 13th District, which, at that time, spanned Chicago South Side neighborhoods from [[Hyde Park, Chicago|Hyde Park]]–[[Kenwood, Chicago|Kenwood]] south to [[South Shore, Chicago|South Shore]] and west to [[Chicago Lawn, Chicago|Chicago Lawn]].<ref>{{cite news |first1=David |last1=Jackson |last2=Long |first2=Ray |title=Obama Knows His Way Around a Ballot |date=April 3, 2007 |url=https://www.chicagotribune.com/news/politics/obama/chi-070403obama-ballot-archive,0,5693903.story |archive-url=https://web.archive.org/web/20081011054057/http://www.chicagotribune.com/news/politics/obama/chi-070403obama-ballot-archive%2C0%2C5693903.story |work=Chicago Tribune |access-date=May 18, 2012 |archive-date=October 11, 2008 |url-status=dead }}
* {{cite book |last = White |first = Jesse |author-link = Jesse White (politician) |year = 2001 |chapter = Legislative Districts of Cook County, 1991 Reapportionment |chapter-url=http://www.sos.state.il.us/publications/02bluebook/legislative_branch/legdistrictmaps.pdf |title = Illinois Blue Book 2001–2002 |place = Springfield |publisher = [[Illinois Secretary of State]] |page = 65 |access-date = July 16, 2011 |url-status=dead |archive-url=https://web.archive.org/web/20080226221919/http://www.sos.state.il.us/publications/02bluebook/legislative_branch/legdistrictmaps.pdf |archive-date = February 26, 2008 }} State Sen. District 13 = State Rep. Districts 25 & 26.</ref> Once elected, Obama gained bipartisan support for legislation that reformed ethics and health care laws.<ref>{{cite news|first=Peter |last=Slevin |title=Obama Forged Political Mettle in Illinois Capitol |date=February 9, 2007 |url=https://www.washingtonpost.com/wp-dyn/content/article/2007/02/08/AR2007020802262.html |newspaper=The Washington Post |access-date=April 20, 2008 }}</ref><ref>{{cite news|first=Scott |last=Helman |title=In Illinois, Obama dealt with Lobbyists |date=September 23, 2007 |url=https://www.boston.com/news/nation/articles/2007/09/23/in_illinois_obama_dealt_with_lobbyists/ |work=The Boston Globe |access-date=April 20, 2008 |archive-url=https://web.archive.org/web/20080416235513/http://www.boston.com/news/nation/articles/2007/09/23/in_illinois_obama_dealt_with_lobbyists/ |archive-date=April 16, 2008 |url-status=live }} See also:{{cite news|title=Obama Record May Be Gold Mine for Critics |date=January 17, 2007 |work=CBS News |url=https://www.cbsnews.com/stories/2007/01/17/politics/main2369157.shtml |agency=Associated Press |access-date=April 20, 2008 |archive-url=https://web.archive.org/web/20080412223055/http://www.cbsnews.com/stories/2007/01/17/politics/main2369157.shtml |archive-date=April 12, 2008 |url-status=live }}</ref> He sponsored a law that increased [[tax credit]]s for low-income workers, negotiated [[welfare reform]], and promoted increased subsidies for childcare.<ref name="Scott20070730">{{cite news |first = Janny |last = Scott |title = In Illinois, Obama Proved Pragmatic and Shrewd |date = July 30, 2007 |url=https://www.nytimes.com/2007/07/30/us/politics/30obama.html |work = The New York Times |access-date = April 20, 2008 |archive-url=https://web.archive.org/web/20081210135903/http://www.nytimes.com/2007/07/30/us/politics/30obama.html|archive-date=December 10, 2008 |url-status=live }}</ref> In 2001, as co-chairman of the bipartisan Joint Committee on Administrative Rules, Obama supported Republican Governor Ryan's [[payday loan]] regulations and [[Predatory lending|predatory mortgage lending]] regulations aimed at averting home [[foreclosure]]s.<ref>{{cite news |last=Allison| first=Melissa |date=December 15, 2000 |title=State takes on predatory lending; Rules would halt single-premium life insurance financing |url=https://pqasb.pqarchiver.com/chicagotribune/access/65214450.html?dids=65214450:65214450&FMT=ABS&FMTS=ABS:FT |format=paid archive |work=Chicago Tribune |page=1 (Business) |access-date=June 1, 2008 |archive-url=https://web.archive.org/web/20080617151154/https://pqasb.pqarchiver.com/chicagotribune/access/65214450.html?dids=65214450%3A65214450&FMT=ABS&FMTS=ABS%3AFT |archive-date=June 17, 2008 |url-status=live }}</ref><ref>{{cite news |first1=Ray |last1=Long |first2=Melissa |last2=Allison |date=April 18, 2001 |title=Illinois OKs predatory loan curbs; State aims to avert home foreclosures |url=https://pqasb.pqarchiver.com/chicagotribune/access/71459393.html?dids=71459393:71459393&FMT=ABS&FMTS=ABS:FT |format=paid archive |work=Chicago Tribune |page=1 |access-date=June 1, 2008 |archive-date=December 18, 2008 |archive-url=https://web.archive.org/web/20081218011718/http://pqasb.pqarchiver.com/chicagotribune/access/71459393.html?dids=71459393:71459393&FMT=ABS&FMTS=ABS:FT |url-status=dead }}</ref>
He was reelected to the Illinois Senate in 1998, defeating Republican Yesse Yehudah in the general election, and was re-elected again in 2002.<ref>{{cite web |url=http://www.senatedem.state.il.us/obama/index.html |title = 13th District: Barack Obama |access-date = April 20, 2008 |date = August 24, 2000 |publisher = Illinois State Senate Democrats |archive-url=https://web.archive.org/web/20000824102110/http://www.senatedem.state.il.us/obama/index.html |archive-date = August 24, 2000 }}</ref><ref>{{cite web |url=http://www.senatedem.state.il.us/obama/index.html |title = 13th District: Barack Obama |access-date = April 20, 2008 |date = October 9, 2004 |publisher = Illinois State Senate Democrats |archive-url=https://web.archive.org/web/20040802233730/http://www.senatedem.state.il.us/obama/index.html |archive-date = August 2, 2004 }}</ref> In 2000, he lost a [[2000 Illinois's 1st congressional district election|Democratic primary race]] for [[Illinois's 1st congressional district]] in the [[United States House of Representatives]] to four-term incumbent [[Bobby Rush]] by a margin of two to one.<ref name="Democratic primary" />
In January 2003, Obama became chairman of the Illinois Senate's Health and Human Services Committee when Democrats, after a decade in the minority, regained a majority.<ref>{{cite news|first=Jackie |last=Calmes |title=Statehouse Yields Clues to Obama |date=February 23, 2007 |url=https://www.wsj.com/public/article/SB117219748197216894-Sn6oV_4KLQHp_xz7CjYLuyjv3Jg_20070324.html |work=The Wall Street Journal |access-date=April 20, 2008 |url-status=dead |archive-url=https://web.archive.org/web/20080918032039/http://online.wsj.com/public/article/SB117219748197216894-Sn6oV_4KLQHp_xz7CjYLuyjv3Jg_20070324.html |archive-date=September 18, 2008 }}</ref> He sponsored and led unanimous, bipartisan passage of legislation to monitor [[racial profiling]] by requiring police to record the race of drivers they detained, and legislation making Illinois the first state to mandate videotaping of homicide interrogations.<ref name="Scott20070730" /><ref>{{cite news|author=Tavella, Anne Marie |date=April 14, 2003 |title=Profiling, taping plans pass Senate |url=http://nl.newsbank.com/nl-search/we/Archives?p_product=ADHB&p_theme=adhb&p_action=search&p_text_search-0=Profiling,%20AND%20taping%20AND%20plans%20AND%20pass%20AND%20Senate |format=paid archive |work=Daily Herald |page=17 |access-date=June 1, 2008 }}</ref><ref>{{cite news|author=Haynes, V. Dion |date=June 29, 2003 |title=Fight racial profiling at local level, lawmaker says; U.S. guidelines get mixed review |url=https://pqasb.pqarchiver.com/chicagotribune/access/352884461.html?dids=352884461:352884461&FMT=ABS&FMTS=ABS:FT |format=paid archive |work=Chicago Tribune |page=8 |access-date=June 1, 2008 |archive-url=https://web.archive.org/web/20080617150449/https://pqasb.pqarchiver.com/chicagotribune/access/352884461.html?dids=352884461%3A352884461&FMT=ABS&FMTS=ABS%3AFT |archive-date=June 17, 2008 |url-status=live }}</ref><ref>{{cite news |last=Pearson |first=Rick |date=July 17, 2003 |title=Taped confessions to be law; State will be 1st to pass legislation |url=https://pqasb.pqarchiver.com/chicagotribune/access/370136121.html?dids=370136121:370136121&FMT=ABS&FMTS=ABS:FT |format=paid archive |work=Chicago Tribune |page=1 (Metro) |access-date=June 1, 2008 |archive-date=December 18, 2008 |archive-url=https://web.archive.org/web/20081218011706/http://pqasb.pqarchiver.com/chicagotribune/access/370136121.html?dids=370136121:370136121&FMT=ABS&FMTS=ABS:FT |url-status=dead }}</ref> During his 2004 general election campaign for the U.S. Senate, police representatives credited Obama for his active engagement with police organizations in enacting [[Capital punishment in the United States|death penalty]] reforms.<ref>{{cite news |first1 = Sam |last1 = Youngman |last2 = Blake |first2 = Aaron |title = Obama's Crime Votes Are Fodder for Rivals |date = March 14, 2007 |url=http://thehill.com/homenews/news/11316-obamas-crime-votes-are-fodder-for-rivals |work = The Hill |access-date = May 18, 2012 }} See also: {{cite news |title = US Presidential Candidate Obama Cites Work on State Death Penalty Reforms |date = November 12, 2007 |work = International Herald Tribune |url=http://www.iht.com/articles/ap/2007/11/12/america/NA-POL-US-Obama-Death-Penalty.php |archive-url=https://web.archive.org/web/20080607111231/http://www.iht.com/articles/ap/2007/11/12/america/NA-POL-US-Obama-Death-Penalty.php |agency = Associated Press |access-date = May 18, 2012 |archive-date = June 7, 2008 }}</ref> Obama resigned from the Illinois Senate in November 2004 following his election to the U.S. Senate.<ref>{{cite news|first=Melanie |last=Coffee |title=Attorney Chosen to Fill Obama's State Senate Seat |date=November 6, 2004 |publisher=HPKCC |url=http://www.hydepark.org/hpkccnews/raoul.htm#ap |agency=Associated Press |access-date=April 20, 2008 |archive-url=https://web.archive.org/web/20080516174431/http://www.hydepark.org/hpkccnews/raoul.htm |archive-date=May 16, 2008 |url-status=dead }}</ref>
=== 2004 U.S. Senate campaign ===
{{Main|2004 United States Senate election in Illinois}}
[[File:2004 United States Senate election in Illinois results map by county.svg|left|upright=.6|thumb|Results of the 2004 U.S. Senate race in Illinois; Obama won the counties in blue.]]
In May 2002, Obama commissioned a poll to assess his prospects in a 2004 U.S. Senate race. He created a campaign committee, began raising funds, and lined up political media consultant [[David Axelrod (political consultant)|David Axelrod]] by August 2002. Obama formally announced his candidacy in January 2003.<ref>{{cite news |last = Helman |first = Scott |date = October 12, 2007 |title = Early defeat launched a rapid political climb |newspaper = [[The Boston Globe]] |page = 1A |url=https://www.boston.com/news/nation/articles/2007/10/12/early_defeat_launched_a_rapid_political_climb |access-date = April 13, 2008 }}</ref>
Obama was an early opponent of the [[George W. Bush]] administration's [[2003 invasion of Iraq]].<ref>{{cite news |last = Strausberg |first = Chinta |date = September 26, 2002 |title = Opposition to war mounts |newspaper = Chicago Defender |page = 1 |url=http://www.highbeam.com/doc/1P3-220062931.html |archive-url=https://web.archive.org/web/20110511195931/http://www.highbeam.com/doc/1P3-220062931.html |url-status=dead |archive-date = May 11, 2011 |format = paid archive |access-date = February 3, 2008 }}</ref> On October 2, 2002, the day President Bush and Congress agreed on the [[Iraq Resolution|joint resolution]] authorizing the [[Iraq War]],<ref name="Rose Garden" /> Obama addressed the first high-profile Chicago [[Protests against the Iraq War|anti-Iraq War rally]],<ref name="Federal Plaza" /> and spoke out against the war.<ref name="spoke out" /> He addressed another anti-war rally in March 2003 and told the crowd "it's not too late" to stop the war.<ref name="stop the war" />
Decisions by Republican incumbent [[Peter Fitzgerald (politician)|Peter Fitzgerald]] and his Democratic predecessor [[Carol Moseley Braun]] to not participate in the election resulted in wide-open Democratic and Republican primary contests involving 15 candidates.<ref>{{cite news |last = Davey |first = Monica |date = March 7, 2004 |title = Closely watched Illinois Senate race attracts 7 candidates in millionaire range |url=https://www.nytimes.com/2004/03/07/politics/campaign/07ILLI.html |archive-url=https://web.archive.org/web/20090416015834/http://www.nytimes.com/2004/03/07/politics/campaign/07ILLI.html|archive-date=April 16, 2009 |newspaper = [[The New York Times]] |page = 19 |access-date = April 13, 2008 }}</ref> In the March 2004 primary election, Obama won in an unexpected landslide—which overnight made him a rising star within the [[Democratic National Committee|national Democratic Party]], started speculation about a presidential future, and led to the reissue of his memoir, ''Dreams from My Father''.<ref name="future" /> In July 2004, Obama delivered the keynote address at the [[2004 Democratic National Convention]],<ref>{{cite news |last = Bernstein |first = David |date = June 2007 |title = The Speech |magazine = Chicago Magazine |url=http://www.chicagomag.com/Chicago-Magazine/June-2007/The-Speech |access-date = April 13, 2008 }}</ref> seen by nine million viewers. His speech was well received and elevated his status within the Democratic Party.<ref name="status" />
Obama's expected opponent in the general election, Republican primary winner [[Jack Ryan (politician)|Jack Ryan]], withdrew from the race in June 2004.<ref>{{cite news |date = June 25, 2004 |title = Ryan drops out of Senate race in Illinois |publisher = CNN |url=http://www.cnn.com/2004/ALLPOLITICS/06/25/il.ryan/ |access-date = May 18, 2012 }}
* Mendell (2007), pp. 260–271.</ref> Six weeks later, [[Alan Keyes]] accepted the Republican nomination to replace Ryan.<ref>{{cite news |last = Lannan |first = Maura Kelly |agency = Associated Press |date = August 9, 2004 |title = Alan Keyes enters U.S. Senate race in Illinois against rising Democratic star |newspaper = [[The San Diego Union-Tribune]] |url=http://legacy.signonsandiego.com/news/politics/20040809-0849-illinoissenate.html |access-date = April 13, 2008 |archive-url=https://web.archive.org/web/20111214115053/http://legacy.signonsandiego.com/news/politics/20040809-0849-illinoissenate.html |archive-date = December 14, 2011 |url-status=dead }}</ref> In the [[2004 United States Senate election in Illinois|November 2004 general election]], Obama won with 70 percent of the vote, the largest margin of victory for a Senate candidate in Illinois history.<ref name="margin" /> He took 92 of the state's 102 counties, including several where Democrats traditionally do not do well.
=== U.S. Senate (2005–2008) ===
{{See also|United States Senate career of Barack Obama|List of bills sponsored by Barack Obama in the United States Senate}}
[[File:BarackObamaportrait.jpg|thumb|upright|Official portrait of Obama as a member of the United States Senate]]
Obama was sworn in as a senator on January 3, 2005,<ref>{{CongBio|o000167|inline=1|date=October 12, 2011}}</ref> becoming the only Senate member of the [[Congressional Black Caucus]].<ref>{{cite web |title = Member Info |url=http://www.house.gov/kilpatrick/cbc/member_info.html |archive-url=https://web.archive.org/web/20080709114659/http://www.house.gov/kilpatrick/cbc/member_info.html |archive-date = July 9, 2008 |publisher = Congressional Black Caucus |access-date = June 25, 2008 }}</ref> He introduced two initiatives that bore his name: Lugar–Obama, which expanded the [[Nunn–Lugar Cooperative Threat Reduction]] concept to conventional weapons;<ref>{{cite web |url=http://obama.senate.gov/press/070111-lugar-obama_non/ |title = Lugar–Obama Nonproliferation Legislation Signed into Law by the President |date = January 11, 2007 |publisher = Richard Lugar U.S. Senate Office |access-date = April 27, 2008 |archive-url=https://web.archive.org/web/20081218154746/http://obama.senate.gov/press/070111-lugar-obama_non/ |archive-date = December 18, 2008 }} See also: {{cite news |first1 = Richard G. |last1 = Lugar |last2 = Obama |first2 = Barack |title = Junkyard Dogs of War |date = December 3, 2005 |url=https://www.washingtonpost.com/wp-dyn/content/article/2005/12/02/AR2005120201509.html |newspaper = The Washington Post |access-date = April 27, 2008 }}</ref> and the [[Federal Funding Accountability and Transparency Act of 2006]], which authorized the establishment of USAspending.gov, a web search engine on federal spending.<ref>{{cite news |first = John |last = McCormack |title = Google Government Gone Viral |date = December 21, 2007 |url=http://www.weeklystandard.com/Content/Public/Articles/000/000/014/502njiqx.asp |work = Weekly Standard |access-date = April 27, 2008 |archive-url=https://web.archive.org/web/20080423235240/http://www.weeklystandard.com/Content/Public/Articles/000/000/014/502njiqx.asp |archive-date = April 23, 2008 |url-status=live }} See also: {{cite web |title = President Bush Signs Coburn–Obama Transparency Act |date = September 26, 2006 |url=http://coburn.senate.gov/ffm/index.cfm?FuseAction=LegislativeFloorAction.Home&ContentRecord_id=eb582f19-802a-23ad-41db-7a7cb464cfdb |archive-url=https://web.archive.org/web/20080501233103/http://coburn.senate.gov/ffm/index.cfm?FuseAction=LegislativeFloorAction.Home&ContentRecord_id=eb582f19-802a-23ad-41db-7a7cb464cfdb |archive-date = May 1, 2008 |publisher = Tom Coburn U.S. Senate Office |access-date = April 27, 2008 }}</ref> On June 3, 2008, Senator Obama—along with Senators [[Tom Carper]], [[Tom Coburn]], and [[John McCain]]—introduced follow-up legislation: Strengthening Transparency and Accountability in Federal Spending Act of 2008.<ref>{{cite web |url=http://www.govtrack.us/congress/bills/110/s3077 |title = S. 3077: Strengthening Transparency and Accountability in Federal Spending Act of 2008: 2007–2008 (110th Congress) |publisher = Govtrack.us |date = June 3, 2008 |access-date = May 18, 2012 }}</ref> He also [[Sponsor (legislative)|cosponsored]] the [[Secure America and Orderly Immigration Act]].<ref>{{cite web |first = 109th Congress, 1st Session |last = U.S. Senate |title = S. 1033, Secure America and Orderly Immigration Act |date = May 12, 2005 |url=https://www.congress.gov/bill/109th-congress/senate-bill/1033/cosponsors |publisher = Library of Congress |access-date = February 25, 2017}}</ref>
In December 2006, President Bush signed into law the [[Democratic Republic of the Congo]] Relief, Security, and Democracy Promotion Act, marking the first federal legislation to be enacted with Obama as its primary sponsor.<ref>{{cite web |title = Democratic Republic of the Congo |date = April 2006 |url=http://www.usccb.org/sdwp/international/drc0406.shtml |publisher = United States Conference of Catholic Bishops |access-date = January 26, 2012 |archive-url=https://web.archive.org/web/20110108193726/http://www.usccb.org/sdwp/international/drc0406.shtml |archive-date = January 8, 2011 }}</ref><ref>{{cite web |title = The IRC Welcomes New U.S. Law on Congo |date = January 5, 2007 |url=http://www.theirc.org/news/the-irc-welcomes-new-us-law.html |publisher = International Rescue Committee |access-date = April 27, 2008 |archive-url=https://web.archive.org/web/20110807061958/http://www.rescue.org/news/the-irc-welcomes-new-us-law.html |archive-date = August 7, 2011 }}</ref> In January 2007, Obama and Senator Feingold introduced a corporate jet provision to the [[Honest Leadership and Open Government Act]], which was signed into law in September 2007.<ref>{{cite news|first=Nathaniel |last=Weixel |title=Feingold, Obama Go After Corporate Jet Travel |date=November 15, 2007 |url=http://thehill.com/leading-the-news/feingold-obama-go-after-corporate-jet-travel-2007-11-15.html |work=The Hill |access-date=April 27, 2008 |archive-url=https://web.archive.org/web/20080515201902/http://thehill.com/leading-the-news/feingold-obama-go-after-corporate-jet-travel-2007-11-15.html |archive-date=May 15, 2008 |url-status=live }}</ref><ref>{{cite news|first=Nathaniel |last=Weixel |title=Lawmakers Press FEC on Bundling Regulation |date=December 5, 2007 |url=http://thehill.com/leading-the-news/lawmakers-press-fec-on-bundling-regulation-2007-12-05.html |work=The Hill |access-date=April 27, 2008 |archive-url=https://web.archive.org/web/20080416162108/http://thehill.com/leading-the-news/lawmakers-press-fec-on-bundling-regulation-2007-12-05.html |archive-date=April 16, 2008 |url-status=live }} See also: {{cite news|title=Federal Election Commission Announces Plans to Issue New Regulations to Implement the Honest Leadership and Open Government Act of 2007 |date=September 24, 2007 |publisher=Federal Election Commission |url=http://www.fec.gov/press/press2007/20070924travel.shtml |access-date=April 27, 2008 |archive-url=https://web.archive.org/web/20080411220016/http://www.fec.gov/press/press2007/20070924travel.shtml |archive-date=April 11, 2008 |url-status=dead }}</ref>
[[File:Lugar-Obama.jpg|thumb|alt=Gray-haired man and Obama stand, wearing casual polo shirts. Obama wears sunglasses and holds something slung over his right shoulder.|left|Obama and U.S. Senator [[Richard Lugar]] (R-IN) visit a Russian facility for dismantling mobile missiles (August 2005)<ref>{{cite web |title = Nunn–Lugar Report |date = August 2005 |publisher = Richard Lugar U.S. Senate Office |url=http://lugar.senate.gov/nunnlugar/pdf/trip_report_2005.pdf |archive-url=https://web.archive.org/web/20080501002134/http://lugar.senate.gov/nunnlugar/pdf/trip_report_2005.pdf |archive-date = May 1, 2008 |access-date = April 30, 2008 }}</ref>]]
Later in 2007, Obama sponsored an amendment to the Defense Authorization Act to add safeguards for personality-disorder military discharges.<ref>{{cite web |title = Obama, Bond Hail New Safeguards on Military Personality Disorder Discharges, Urge Further Action |date = October 1, 2007 |url=http://bond.senate.gov/public/index.cfm?FuseAction=PressRoom.NewsReleases&ContentRecord_id=5C1EBFEB-1321-0E36-BA7D-04630AEFAD31 |publisher = Kit Bond U.S. Senate Office |access-date = April 27, 2008 |archive-url=https://web.archive.org/web/20101205075008/http://bond.senate.gov/public/index.cfm?FuseAction=PressRoom.NewsReleases&ContentRecord_id=5C1EBFEB-1321-0E36-BA7D-04630AEFAD31 |archive-date = December 5, 2010 }}</ref> This amendment passed the full Senate in the spring of 2008.<ref>{{cite web |title = Obama, Bond Applaud Senate Passage of Amendment to Expedite the Review of Personality Disorder Discharge Cases |url=http://obama.senate.gov/press/080314-obama_bond_appl/ |archive-url=https://web.archive.org/web/20081218154824/http://obama.senate.gov/press/080314-obama_bond_appl/ |archive-date = December 18, 2008 |date = March 14, 2008 }}</ref> He sponsored the [[Disinvestment from Iran|Iran Sanctions Enabling Act]] supporting divestment of state pension funds from Iran's oil and gas industry, which was never enacted but later incorporated in the [[Comprehensive Iran Sanctions, Accountability, and Divestment Act of 2010]];<ref>{{cite web|url=https://www.govtrack.us/congress/bills/111/s1065|title=Iran Sanctions Enabling Act of 2009 (2009—S. 1065)|website=GovTrack.us|access-date=August 27, 2018}}</ref> and co-sponsored legislation to reduce risks of nuclear terrorism.<ref name="nuclear terrorism" /> Obama also sponsored a Senate amendment to the [[State Children's Health Insurance Program]], providing one year of job protection for family members caring for soldiers with combat-related injuries.<ref>{{cite web |title = Senate Passes Obama, McCaskill Legislation to Provide Safety Net for Families of Wounded Service Members |date = August 2, 2007 |url=http://obama.senate.gov/press/070802-senate_passes_o_1/ |publisher = Barack Obama U.S. Senate Office |access-date = April 27, 2008 |archive-url=https://web.archive.org/web/20081218154819/http://obama.senate.gov/press/070802-senate_passes_o_1/ |archive-date = December 18, 2008 }}</ref>
Obama held assignments on the Senate Committees for [[United States Senate Committee on Foreign Relations|Foreign Relations]], [[United States Senate Committee on Environment and Public Works|Environment and Public Works]] and [[United States Senate Committee on Veterans' Affairs|Veterans' Affairs]] through December 2006.<ref>{{cite web |url=http://obama.senate.gov/committees/ |date = December 9, 2006 |title = Committee Assignments |access-date = April 27, 2008 |publisher = Barack Obama U.S. Senate Office |archive-url=https://web.archive.org/web/20061209190827/http://obama.senate.gov/committees/ |archive-date = December 9, 2006 }}</ref> In January 2007, he left the Environment and Public Works committee and took additional assignments with [[United States Senate Committee on Health, Education, Labor and Pensions|Health, Education, Labor and Pensions]] and [[United States Senate Committee on Homeland Security and Governmental Affairs|Homeland Security and Governmental Affairs]].<ref>{{cite news |title = Obama Gets New Committee Assignments |date = November 15, 2006 |publisher = Barack Obama U.S. Senate Office |url=http://obama.senate.gov/news/061115-obama_gets_new/ |agency = Associated Press |access-date = April 27, 2008 |archive-url=https://web.archive.org/web/20081218154741/http://obama.senate.gov/news/061115-obama_gets_new/ |archive-date = December 18, 2008 }}</ref> He also became Chairman of the Senate's subcommittee on [[United States Senate Foreign Relations Subcommittee on Europe and Regional Security Cooperation|European Affairs]].<ref>{{cite news |first = Tom |last = Baldwin |title = 'Stay at home' Barack Obama comes under fire for a lack of foreign experience |date = December 21, 2007 |url=https://www.thetimes.co.uk/article/stay-at-home-barack-obama-comes-under-fire-for-a-lack-of-foreign-experience-2qjm86d9l2n |work = Sunday Times (UK) |access-date = April 27, 2008 }}</ref> As a member of the Senate Foreign Relations Committee, Obama made official trips to Eastern Europe, the Middle East, Central Asia and Africa. He met with [[Mahmoud Abbas]] before Abbas became [[President of the Palestinian National Authority]], and gave a speech at the [[University of Nairobi]] in which he condemned corruption within the Kenyan government.<ref name="Kenyan" />
Obama [[resignation from the United States Senate|resigned his Senate seat]] on November 16, 2008, to focus on his transition period for the presidency.<ref name="transition period" />
==Presidential campaigns==
===2008===
{{Main|2008 United States presidential election|Barack Obama 2008 presidential primary campaign|Barack Obama 2008 presidential campaign}}
[[File:Flickr Obama Springfield 01.jpg|thumb|alt=Photograph|Obama on stage with wife and daughters just before announcing presidential candidacy in [[Springfield, Illinois]], February 10, 2007]]
[[File:ElectoralCollege2008.svg|thumb|upright=1.3|alt=Electoral map of the 2008 U.S. presidential election|2008 electoral vote results. Obama won 365–173.]]
On February 10, 2007, Obama announced his candidacy for President of the [[United States]] in front of the [[Old State Capitol State Historic Site (Illinois)|Old State Capitol]] building in [[Springfield, Illinois]].<ref name="ChicagoTribune_Pearson_20070210">{{cite news|url=https://www.chicagotribune.com/news/politics/chi-070210obama-pearson1-story,0,3768114.story |title=Obama: I'm running for president |work=Chicago Tribune |last1=Pearson |first1=Rick |last2=Long |first2=Ray |date=February 10, 2007 |access-date=September 20, 2008 |archive-url=https://web.archive.org/web/20070813115846/http://www.chicagotribune.com/news/politics/chi-070210obama-pearson1-story%2C0%2C3768114.story |archive-date=August 13, 2007 |url-status=live }}</ref><ref name="BBC20070210">{{cite news |title = Obama Launches Presidential Bid |date = February 10, 2007 |url=http://news.bbc.co.uk/2/hi/americas/6349081.stm |work = BBC News |access-date = January 14, 2008 |archive-url=https://web.archive.org/web/20080202060802/http://news.bbc.co.uk/2/hi/americas/6349081.stm |archive-date = February 2, 2008 |url-status=live }}</ref> The choice of the announcement site was viewed as symbolic because it was also where [[Abraham Lincoln]] delivered his historic [[Lincoln's House Divided Speech|"House Divided"]] speech in 1858.<ref name="ChicagoTribune_Pearson_20070210" /><ref name="ChicagoTribune_Parsons20070210">{{cite news |url=http://www.highbeam.com/doc/1G1-159132539.html |archive-url=https://web.archive.org/web/20110511195905/http://www.highbeam.com/doc/1G1-159132539.html |url-status=dead |archive-date = May 11, 2011 |title = Obama's launch site: Symbolic Springfield: Announcement venue evokes Lincoln legacy |last = Parsons |first = Christi |date = February 10, 2007 |work = Chicago Tribune |access-date = June 12, 2009 }}</ref> Obama emphasized issues of rapidly ending the [[Iraq War]], increasing [[Energy policy of the United States|energy independence]], and [[Health care reform in the United States|reforming the health care system]],<ref>{{cite news|title=Barack Obama on the Issues: What Would Be Your Top Three Overall Priorities If Elected? |url=http://projects.washingtonpost.com/2008-presidential-candidates/issues/candidates/barack-obama/#top-priorities |newspaper=The Washington Post |access-date=April 14, 2008 |archive-url=https://web.archive.org/web/20080509140350/http://projects.washingtonpost.com/2008-presidential-candidates/issues/candidates/barack-obama/ |archive-date=May 9, 2008 |url-status=dead }} See also:
* {{cite book |last = Thomas |first = Evan |title = A Long Time Coming |url=https://archive.org/details/alongtimecominge00thom |url-access = registration |publisher = [[PublicAffairs]] |year = 2009 |location = New York |page = [https://archive.org/details/alongtimecominge00thom/page/74 74] |isbn = 978-1-58648-607-5 |author-link = Evan Thomas }}
* {{cite news|first=Michael |last=Falcone |title=Obama's 'One Thing' |date=December 21, 2007 |url=http://thecaucus.blogs.nytimes.com/2007/12/21/obamas-one-thing/ |work=The New York Times |access-date=April 14, 2008 }}</ref> in a campaign that projected themes of hope and change.<ref>{{cite news |url=https://www.independent.co.uk/opinion/leading-articles/leading-article-the-obama-promise-of-hope-and-change-981761.html |title = The Obama promise of hope and change |work = The Independent |location = London |date = November 1, 2008 |archive-url=https://web.archive.org/web/20110515091856/http://www.independent.co.uk/opinion/leading-articles/leading-article-the-obama-promise-of-hope-and-change-981761.html |archive-date = May 15, 2011 }}</ref>
Numerous candidates entered the [[2008 Democratic Party presidential primaries|Democratic Party presidential primaries]]. The field narrowed to a duel between Obama and Senator [[Hillary Clinton]] after early contests, with the race remaining close throughout the primary process but with Obama gaining a steady lead in pledged [[Delegate (American politics)|delegates]] due to better long-range planning, superior fundraising, dominant organizing in [[caucus]] states, and better exploitation of delegate allocation rules.<ref name="allocation" />
On June 2, 2008, Obama had received enough votes to clinch his election. On all previous occasions the defeated candidate had immediately conceded and endorsed the winner. Clinton however refused to do so. On June 6, 2008, Obama unexpectedly flew to a meeting of AIPAC (The American Israel Public Action Committee) where he made a wildly applauded speech in which he declared that "Jerusalem will remain the capital of Israel, and it must remain undivided", contrary to his previous views about the Palestinian issue.<ref>{|title = AIPAC's Role in the 2008 Election Coming Under Increasingly Critical Scrutiny |url=https://www.wrmea.org/008-september-october/aipacs-role-in-the-2008-election-coming-under-increasingly-critical-scrutiny.html}</ref> This opened the door to additional Jewish funding for his presidential campaign.
On June 7, 2008, Clinton ended her campaign and endorsed Obama.<ref>{{cite news |last1 = Nagourney |first1 = Adam |first2 = Jeff |last2 = Zeleny |title = Clinton to End Bid and Endorse Obama |url=https://www.nytimes.com/2008/06/05/us/politics/04cnd-campaign.html |archive-url=https://web.archive.org/web/20080605014013/http://www.nytimes.com/2008/06/05/us/politics/04cnd-campaign.html |archive-date=June 5, 2008 |url-access=subscription |url-status=live |work = The New York Times |date = June 5, 2008 |access-date = November 20, 2010 }}</ref>
On August 23, 2008, Obama announced his [[2008 Democratic Party vice presidential candidate selection|selection]] of [[Delaware]] Senator [[Joe Biden]] as his vice presidential running mate.<ref name=nagourney>{{cite news |access-date = September 20, 2008 |url=https://www.nytimes.com/2008/08/24/us/politics/24biden.html |last1 = Nagourney |first1 = Adam |first2 = Jeff |last2 = Zeleny |work = The New York Times |date = August 23, 2008 |title = Obama Chooses Biden as Running Mate |archive-url=https://web.archive.org/web/20090401222653/http://www.nytimes.com/2008/08/24/us/politics/24biden.html|archive-date=April 1, 2009 |url-status=live }}</ref> Obama selected Biden from a field speculated to include former Indiana Governor and Senator [[Evan Bayh]] and Virginia Governor [[Tim Kaine]].<ref name=nagourney /> At the [[2008 Democratic National Convention|Democratic National Convention]] in [[Denver]], Colorado, Hillary Clinton called for her supporters to endorse Obama, and she and [[Bill Clinton]] gave convention speeches in his support.<ref>{{Cite news|last=Baldwin|first=Tom|date=August 27, 2008|title=Hillary Clinton: 'Barack is my candidate'|language=en|work=[[The Times]]|url=https://www.thetimes.co.uk/article/hillary-clinton-barack-is-my-candidate-50w3d5n7wm9|access-date=December 15, 2021|issn=0140-0460}}</ref><ref>{{Cite news|last=Nagourney|first=Adam|date=August 28, 2008|title=Obama Wins Nomination; Biden and Bill Clinton Rally Party|language=en-US|work=The New York Times|url=https://www.nytimes.com/2008/08/28/us/politics/28DEMSDAY.html |archive-url=https://web.archive.org/web/20080827212341/http://www.nytimes.com/2008/08/28/us/politics/28DEMSDAY.html |archive-date=August 27, 2008 |url-access=subscription |url-status=live|access-date=December 15, 2021|issn=0362-4331}}</ref> Obama delivered his acceptance speech at [[Invesco Field at Mile High]] stadium to a crowd of about eighty-four thousand; the speech was viewed by over three million people worldwide.<ref name="npr1409">{{cite news |url=https://www.npr.org/templates/story/story.php?storyId=92301409 |title = Obama To Accept Nomination at Mile High Stadium |publisher = NPR |date = July 7, 2008 |access-date = December 22, 2010 |last1 = Liasson |first1 = Mara |last2 = Norris |first2 = Michele }}</ref><ref name="acceptance" /><ref>{{cite news |url=https://www.latimes.com/entertainment/news/la-na-tvcritic29-2008aug29,0,3593116.story|title=Barack Obama, Al Gore Raise the Roof at Invesco Field|newspaper=[[Los Angeles Times]]|first=Robert|last=Lloyd|date=August 29, 2008|access-date=August 29, 2008}}</ref>
During both the primary process and the general election, Obama's campaign set numerous fundraising records, particularly in the quantity of small donations.<ref name="small donations" /> On June 19, 2008, Obama became the first major-party presidential candidate to turn down [[Campaign finance in the United States#Public financing of campaigns|public financing]] in the general election since the system was created in 1976.<ref name="Bloomberg_Salant_20080619">{{cite news |last = Salant |first = Jonathan D. |title = Obama Won't Accept Public Money in Election Campaign |url=https://article.wn.com/view/2008/06/19/Obama_Wont_Accept_Public_Money_in_Election_Campaign/ |publisher = [[Bloomberg L.P.|Bloomberg]] |date = June 19, 2008 |access-date = June 19, 2008}}</ref>
[[John McCain]] was nominated as the Republican candidate, and he selected [[Sarah Palin]] as his running mate. Obama and McCain engaged in three [[United States presidential election debates|presidential debates]] in September and October 2008.<ref name="presidential debates" /> On November 4, Obama won the presidency with 365 [[Electoral College (United States)|electoral votes]] to 173 received by McCain.<ref name="electoral votes" /> Obama won 52.9 percent of the [[Election|popular vote]] to McCain's 45.7 percent.<ref>{{cite web |url=http://www.realclearpolitics.com/epolls/2008/president/us/general_election_mccain_vs_obama-225.html |title = General Election: McCain vs. Obama |access-date = February 20, 2009 |publisher = Real Clear Politics |archive-url=https://web.archive.org/web/20090217083055/http://www.realclearpolitics.com//epolls//2008//president//us//general_election_mccain_vs_obama-225.html |archive-date = February 17, 2009 |url-status=live }}</ref> He became the first African-American to be elected president.<ref name="FirstBlackPrez">{{cite news |url=http://news.bbc.co.uk/1/hi/world/americas/us_elections_2008/7709978.stm |title = Obama wins historic US election |work = BBC News |date = November 5, 2008 |access-date = November 5, 2008 |archive-url=https://web.archive.org/web/20081218083153/http://news.bbc.co.uk/1/hi/world/americas/us_elections_2008/7709978.stm |archive-date = December 18, 2008 |url-status=live }}
* {{cite news |access-date = November 5, 2008 |url=https://www.nytimes.com/2008/11/05/us/politics/05elect.html |title = Obama Elected President as Racial Barrier Falls |first = Adam |last = Nagourney |date = November 4, 2008 |work = The New York Times |archive-url=https://web.archive.org/web/20081209071842/http://www.nytimes.com/2008/11/05/us/politics/05elect.html |archive-date = December 9, 2008 |url-status=live }}
* {{cite news |access-date = November 5, 2008 |url=http://www.cnn.com/2008/POLITICS/11/04/election.president/index.html |title = Obama: 'This is your victory' |publisher = CNN |date = November 5, 2008 |archive-url=https://web.archive.org/web/20081104231227/http://www.cnn.com/2008/POLITICS/11/04/election.president/index.html |archive-date = November 4, 2008 |url-status=live }}</ref> Obama delivered [[Barack Obama election victory speech, 2008|his victory speech]] before hundreds of thousands of supporters in Chicago's [[Grant Park (Chicago)|Grant Park]].<ref name="independent1">{{cite news |access-date = November 5, 2008 |url=https://www.independent.co.uk/news/world/americas/change-has-come-says-presidentelect-obama-992930.html |title = Change has come, says President-elect Obama |work = The Independent |location = London |date = November 5, 2008 |last = Johnson |first = Wesley |archive-url=https://web.archive.org/web/20081209055411/http://www.independent.co.uk/news/world/americas/change-has-come-says-presidentelect-obama-992930.html |archive-date = December 9, 2008 |url-status=live }}</ref> He is one of the three United States senators moved directly from the U.S. Senate to the White House, the others are [[Warren G. Harding]] and [[John F. Kennedy]].<ref>{{Cite web|title=U.S. Senate: Senators Who Became President|url=https://www.senate.gov/artandhistory/history/common/briefing/senators_became_president.htm|access-date=August 27, 2021|website=senate.gov}}</ref>
===2012===
{{Main|2012 United States presidential election|Barack Obama 2012 presidential campaign}}
[[File:ElectoralCollege2012.svg|thumb|upright=1.3|alt=Electoral map of the 2012 U.S. presidential election|2012 electoral vote results. Obama won 332–206.]]
On April 4, 2011, Obama filed election papers with the [[Federal Election Commission]] and then announced his reelection campaign for 2012 in a video titled "It Begins with Us" that he posted on his website.<ref>{{cite news |title = Obama Begins Re-Election Facing New Political Challenges |url=http://thecaucus.blogs.nytimes.com/2011/04/04/obama-launches-re-election-facing-new-political-challenges/ |date = April 4, 2011 |first = Michael D. |last = Shear |work = The New York Times (blog) |archive-url=https://web.archive.org/web/20110405205656/http://thecaucus.blogs.nytimes.com/2011/04/04/obama-launches-re-election-facing-new-political-challenges/ |archive-date = April 5, 2011 }}</ref><ref>{{cite news |title = Obama announces re-election bid |url=http://www.upi.com/Top_News/US/2011/04/04/Obama-announces-re-election-bid/UPI-95081301905800/?dailybrief |date = April 4, 2011 |work = [[United Press International]] |archive-url=https://web.archive.org/web/20110510011832/http://www.upi.com/Top_News/US/2011/04/04/Obama-announces-re-election-bid/UPI-95081301905800/?dailybrief |archive-date = May 10, 2011 }}</ref><ref>{{cite news |title = Obama Opens 2012 Campaign, With Eye on Money and Independent Voters |url=https://www.nytimes.com/2011/04/05/us/politics/05obama.html |date = April 4, 2011 |first1 = Jeff |last1 = Zeleny |work = The New York Times |first2 = Jackie |last2 = Calmes |name-list-style = amp |access-date = April 5, 2011 |archive-url=https://web.archive.org/web/20121115021431/http://www.nytimes.com/2011/04/05/us/politics/05obama.html|archive-date=November 15, 2012 }}</ref> As the incumbent president, he ran virtually unopposed in the [[Democratic Party presidential primaries, 2012|Democratic Party presidential primaries]],<ref name="CNN-clinch1">{{cite news |url=http://politicalticker.blogs.cnn.com/2012/04/03/leading-presidential-candidate-to-clinch-nomination-tuesday/ |title = Leading presidential candidate to clinch nomination Tuesday |publisher = CNN (blog) |last = Yoon |first = Robert |date = April 3, 2012 |access-date = May 2, 2012 }}</ref> and on April 3, 2012, Obama secured the 2778 [[2012 Democratic National Convention|convention]] delegates needed to win the Democratic nomination.<ref name="CNN-clinch2">{{cite news |url=http://politicalticker.blogs.cnn.com/2012/04/03/breaking-obama-clinches-democratic-nomination/ |title = Obama clinches Democratic nomination |publisher = CNN (blog) |date = April 3, 2012 |access-date = April 3, 2012 }}</ref>
At the [[2012 Democratic National Convention|Democratic National Convention]] in [[Charlotte, North Carolina]], Obama and [[Joe Biden]] were formally nominated by former President [[Bill Clinton]] as the Democratic Party candidates for president and vice president in the general election. Their main opponents were Republicans [[Mitt Romney]], the former governor of Massachusetts, and Representative [[Paul Ryan]] of Wisconsin.<ref>{{cite news |last = Cohen |first = Tom |title = Clinton says Obama offers a better path forward for America |url=http://edition.cnn.com/2012/09/05/politics/democratic-convention-wrap/index.html |publisher = CNN |date = September 6, 2012 |access-date = July 5, 2015 }}</ref>
On November 6, 2012, Obama won 332 [[Electoral College (United States)|electoral votes]], exceeding the 270 required for him to be reelected as president.<ref>{{cite news|last=Lauter |first=David |title=Romney campaign gives up in Florida |url=https://www.chicagotribune.com/news/la-pn-romney-concedes-florida-election-20121108,0,415187.story |archive-url=https://web.archive.org/web/20121109020204/http://www.chicagotribune.com/news/la-pn-romney-concedes-florida-election-20121108%2C0%2C415187.story |archive-date=November 9, 2012 |newspaper=Chicago Tribune |date=November 8, 2012 |access-date=July 5, 2015 |url-status=dead }}</ref><ref>{{cite news |last = Barnes |first = Robert |title = Obama wins a second term as U.S. president |url=https://www.washingtonpost.com/politics/decision2012/after-grueling-campaign-polls-open-for-election-day-2012/2012/11/06/d1c24c98-2802-11e2-b4e0-346287b7e56c_story.html |newspaper = The Washington Post |date = November 6, 2012 |access-date = July 5, 2015 }}</ref><ref>{{cite news |last1 = Welch |first1 = William M. |last2 = Strauss |first2 = Gary |title = With win in critical battleground states, Obama wins second term |url=https://www.usatoday.com/story/news/politics/2012/11/06/election-day-obama-romney/1680933/ |newspaper = USA Today |date = November 7, 2012 |access-date = July 5, 2015 }}</ref> With 51.1 percent of the popular vote,<ref name="FEC">{{cite web |url=http://www.fec.gov/pubrec/fe2012/federalelections2012.pdf |title = Election Results for the U.S. President, the U.S. Senate and the U.S. House of Representatives |publisher = [[Federal Elections Commission]] |author = FEC |date = July 2013 |access-date = August 20, 2013 |page = 5 }}</ref> Obama became the first Democratic president since [[Franklin D. Roosevelt]] to win the [[List of United States presidential elections by popular vote margin|majority of the popular vote]] twice.<ref>{{cite news |last=Brownstein |first=Ronald |title=The U.S. has reached a demographic milestone—and it's not turning back |url=http://www.nationaljournal.com/thenextamerica/demographics/the-u-s-has-reached-a-demographic-milestone-and-it-s-not-turning-back-20121109 |work=[[National Journal]] |date=November 9, 2012 |archive-url=https://web.archive.org/web/20121111231854/http://www.nationaljournal.com/thenextamerica/demographics/the-u-s-has-reached-a-demographic-milestone-and-it-s-not-turning-back-20121109 |archive-date=November 11, 2012 |access-date=July 5, 2015 }}</ref><ref>{{cite news |url=http://www.thenation.com/blog/171178/obama-has-great-big-mandate-and-he-must-use-it |title = Obama's 3 Million Vote, Electoral College Landslide, Majority of States Mandate |last = Nichols |first = John |date = November 9, 2012 |work = The Nation |access-date = November 18, 2012 }}</ref> Obama addressed supporters and volunteers at Chicago's [[McCormick Place]] after his reelection and said: "Tonight you voted for action, not politics as usual. You elected us to focus on your jobs, not ours. And in the coming weeks and months, I am looking forward to reaching out and working with leaders of both parties."<ref>{{cite news|last=Lee|first=Kristen A.|title=Election 2012: President Obama gives victory speech in front of thousands in Chicago, 'I have never been more hopeful about America{{'-}}|url=http://www.nydailynews.com/news/politics/president-obama-victory-speech-hopeful-america-article-1.1197895|access-date=November 8, 2012|newspaper=Daily News|location=New York|date=November 7, 2012}}</ref><ref name="NYT20130121">{{cite news|url=https://www.nytimes.com/2013/01/22/us/politics/obama-inauguration-draws-hundreds-of-thousands.html |archive-url=https://web.archive.org/web/20130121151143/http://www.nytimes.com/2013/01/22/us/politics/obama-inauguration-draws-hundreds-of-thousands.html |archive-date=January 21, 2013 |url-access=subscription |url-status=live|title=Obama Offers Liberal Vision: 'We Must Act{{'-}}|newspaper=[[The New York Times]]|first=Michael|last=Shear|date=January 21, 2013|access-date=July 10, 2013}}</ref>
==Presidency (2009–2017)==
[[File:Official portrait of Barack Obama.jpg|thumb|First official portrait of Barack Obama as President of the United States, 2009]]
{{Main|Presidency of Barack Obama}}
{{for timeline|Timeline of the Barack Obama presidency}}
===First 100 days===
{{Main|First 100 days of Barack Obama's presidency}}
[[File:US President Barack Obama taking his Oath of Office - 2009Jan20.jpg|thumb|Obama takes [[Oath of office of the President of the United States|the oath of office]] administered by [[Chief Justice of the United States|Chief Justice]] [[John Roberts|John G. Roberts Jr.]] at [[United States Capitol|the Capitol]], January 20, 2009|alt=Photograph]]
The [[First inauguration of Barack Obama|inauguration of Barack Obama]] as the 44th president took place on January 20, 2009. In his first few days in office, Obama issued [[executive order]]s and [[Presidential memorandum|presidential memoranda]] directing the U.S. military to develop plans to withdraw troops from Iraq.<ref>{{cite news |title=Obama asks Pentagon for responsible Iraq drawdown |date=January 23, 2009 |url=https://www.post-gazette.com/news/nation/2009/01/22/Obama-asks-Pentagon-for-responsible-Iraq-drawdown/stories/200901220423 |work=[[Pittsburgh Post-Gazette]] |first1=Anne |last1=Gearan |first2=Lolita C. |last2=Baldor |agency=Associated Press |access-date=February 23, 2020 }}</ref> He ordered the closing of the [[Guantanamo Bay detention camp]],<ref>{{cite news |url=https://www.nytimes.com/2009/01/22/washington/22gitmo.html |title = Obama Orders Halt to Prosecutions at Guantánamo |last = Glaberson |first = William |date = January 21, 2009 |work = The New York Times |access-date = February 3, 2009 |archive-url=https://web.archive.org/web/20090416015909/http://www.nytimes.com/2009/01/22/washington/22gitmo.html|archive-date=April 16, 2009 }}</ref> but Congress prevented the closure by refusing to appropriate the required funds<ref>{{cite news |title = Senate blocks transfer of Gitmo detainees |url=https://www.nbcnews.com/id/30826649 |date=May 20, 2009 |work = [[NBC News]] |agency = Associated Press |mode = cs2 |access-date = March 22, 2011 }}</ref><ref>{{cite web |title=Presidential Memorandum—Closure of Detention Facilities at the Guantanamo Bay Naval Base |url=https://obamawhitehouse.archives.gov/the-press-office/presidential-memorandum-closure-dentention-facilities-guantanamo-bay-naval-base |date=December 15, 2009 |first=Barack |last=Obama |mode = cs2 |via=[[NARA|National Archives]] |work=[[whitehouse.gov]] |access-date = March 22, 2011 }}</ref><ref>{{cite news |title=Obama signs Defense authorization bill |url=https://federalnewsnetwork.com/congress/2011/01/obama-signs-defense-authorization-bill/ |date = January 7, 2011 |first = Jared |last = Serbu |publisher = [[Federal News Radio]] |mode = cs2 |access-date = March 22, 2011 }}</ref> and preventing moving any Guantanamo detainee.<ref>{{cite news |url=https://www.npr.org/2013/01/23/169922171/obamas-promise-to-close-guantanamo-prison-falls-short |title = Obama's Promise To Close Guantanamo Prison Falls Short |last = Northam |first = Jackie |date = January 23, 2013 |access-date = April 22, 2013 |publisher = [[NPR]] }}</ref> Obama reduced the secrecy given to presidential records.<ref>{{cite web|url=https://www.whitehouse.gov/the_press_office/ExecutiveOrderPresidentialRecords/ |title=Executive Order—Presidential Records |access-date=January 22, 2009 |archive-url=https://web.archive.org/web/20090122234307/http://www.whitehouse.gov/the_press_office/ExecutiveOrderPresidentialRecords/ |archive-date=January 22, 2009 |url-status=dead }}</ref> He also revoked President [[George W. Bush]]'s restoration of President [[Ronald Reagan]]'s [[Mexico City policy]] which prohibited federal aid to international [[family planning]] organizations that perform or provide counseling about [[abortion]].<ref>{{cite web |last = Obama |first = Barack |date = January 23, 2009 |title = Mexico City Policy and assistance for voluntary population planning (Presidential memorandum) |publisher = The White House |url=https://www.gpo.gov/fdsys/pkg/CFR-2010-title3-vol1/pdf/CFR-2010-title3-vol1-other-id197.pdf |access-date = September 21, 2012}}
* {{cite news |last = Meckler |first = Laura |date = January 24, 2009 |title = Obama lifts 'gag rule' on family-planning groups |newspaper = The Wall Street Journal |page = A3 |url=https://www.wsj.com/articles/SB123272364299610287 |access-date = September 21, 2012 }}
* {{cite news |last1 = Stein |first1 = Rob |last2 = Shear |first2 = Michael |date = January 24, 2009 |title = Funding restored to groups that perform abortions, other care |newspaper = The Washington Post |page = A3 |url=https://www.washingtonpost.com/wp-dyn/content/article/2009/01/23/AR2009012302814.html |access-date = September 21, 2012 |quote = Lifting the Mexico City Policy would not permit U.S. tax dollars to be used for abortions, but it would allow funding to resume to groups that provide other services, including counseling about abortions. }}</ref>
===Domestic policy===
{{See also|Social policy of the Barack Obama administration}}
The first bill signed into law by Obama was the [[Lilly Ledbetter Fair Pay Act of 2009]], relaxing the [[statute of limitations]] for equal-pay lawsuits.<ref>{{cite news |title = Obama Signs Equal-Pay Legislation |work = The New York Times |first=Sheryl Gay|last=Stolberg|url=https://www.nytimes.com/2009/01/30/us/politics/30ledbetter-web.html |archive-url=https://web.archive.org/web/20090130125449/http://www.nytimes.com/2009/01/30/us/politics/30ledbetter-web.html |archive-date=January 30, 2009 |url-access=subscription |url-status=live |access-date = June 15, 2009 |date = January 30, 2009 }}</ref> Five days later, he signed the reauthorization of the [[State Children's Health Insurance Program]] to cover an additional four million uninsured children.<ref>{{cite news|title=Obama signs into law expansion of SCHIP health care program for children |work=Chicago Tribune |url=https://www.chicagotribune.com/news/nationworld/chi-kids-health-care_thufeb05,0,30310.story |access-date=June 15, 2009 |first=Noam N. |last=Levey |archive-url=https://web.archive.org/web/20090430194400/http://www.chicagotribune.com/news/nationworld/chi-kids-health-care_thufeb05%2C0%2C30310.story |archive-date=April 30, 2009 |url-status=dead |date=February 5, 2009 }}</ref> In March 2009, Obama reversed a Bush-era policy that had limited funding of [[embryonic stem cell]] research and pledged to develop "strict guidelines" on the research.<ref>{{cite news |url=http://www.cnn.com/2009/POLITICS/03/09/obama.stem.cells/index.html |title = Obama overturns Bush policy on stem cells |publisher = CNN |date = March 9, 2009 |access-date = April 18, 2010 |archive-url=https://web.archive.org/web/20100330183125/http://www.cnn.com/2009/POLITICS/03/09/obama.stem.cells/index.html |archive-date = March 30, 2010 }}</ref>
[[File:Barack Obama addresses joint session of Congress 2009-02-24.jpg|thumb|left|Obama delivers a [[Barack Obama speech to joint session of Congress, February 2009|speech at joint session of Congress]] with Vice President [[Joe Biden]] and [[Speaker of the United States House of Representatives|House Speaker]] [[Nancy Pelosi]] on February 24, 2009.]]
Obama appointed two women to serve on the Supreme Court in the first two years of his presidency. He nominated [[Sonia Sotomayor]] on May 26, 2009, to replace retiring [[Associate Justice of the Supreme Court of the United States|Associate Justice]] [[David Souter]]; she was confirmed on August 6, 2009,<ref>{{cite news |title = Senate confirms Sotomayor for Supreme Court |url=https://edition.cnn.com/2009/POLITICS/08/06/sonia.sotomayor/ |first1=Lisa |last1=Desjardins |first2=Kristi |last2=Keck |first3=Bill |last3=Mears |date = August 6, 2009 |publisher = CNN |access-date = August 6, 2009 }}</ref> becoming the first Supreme Court Justice of [[Hispanic]] descent.<ref>{{cite news |url=http://www.cnn.com/2009/POLITICS/05/26/supreme.court/index.html |first1=Peter |last1=Hamby |first2=Ed |last2=Henry |first3=Suzanne |last3=Malveaux |first4=Bill |last4=Mears |title = Obama nominates Sotomayor to Supreme Court |access-date = September 13, 2014 }}</ref> Obama nominated [[Elena Kagan]] on May 10, 2010, to replace retiring Associate Justice [[John Paul Stevens]]. She was confirmed on August 5, 2010, bringing the number of women sitting simultaneously on the Court to three for the first time in American history.<ref>{{cite news |url = https://www.theledger.com/article/LK/20101004/News/608110519/LL/ |title = New Era Begins on High Court: Kagan Takes Place as Third Woman |last = Sherman |first = Mark |date = October 4, 2010 |agency = Associated Press |access-date = November 13, 2010 |archive-date = October 10, 2017 |archive-url = https://web.archive.org/web/20171010074850/http://www.theledger.com/article/LK/20101004/News/608110519/LL/ |url-status = dead }}</ref>
On March 11, 2009, Obama created the [[White House Council on Women and Girls]], which formed part of the [[White House Office of Intergovernmental Affairs|Office of Intergovernmental Affairs]], having been established by {{Executive Order|13506}} with a broad mandate to advise him on issues relating to the welfare of American women and girls.<ref name="Executive">''Executive Order 13506'', Washington, DC: President Barack Obama, The White House, March 11, 2009, Obama, B. Retrieved January 27, 2014.</ref> The council was chaired by [[Senior Advisor to the President]] [[Valerie Jarrett]].<ref name="Sexualassault">{{cite web |url=https://obamawhitehouse.archives.gov/blog/2014/01/22/renewed-call-action-end-rape-and-sexual-assault |title = A renewed call to action to end rape and sexual assault |first=Valerie |last=Jarrett |access-date = September 13, 2014 |via= [[NARA|National Archives]] |work= [[whitehouse.gov]] |date = January 23, 2014 }}</ref> Obama also established the [[White House Task Force to Protect Students from Sexual Assault]] through a government memorandum on January 22, 2014, with a broad mandate to advise him on issues relating to sexual assault on college and university campuses throughout the United States.<ref name="Sexualassault" /><ref name="Memo">{{cite web |url=https://obamawhitehouse.archives.gov/the-press-office/2014/01/22/memorandum-establishing-white-house-task-force-protect-students-sexual-a |title = Memorandum: Establishing White House Task Force to Protect Students from Sexual Assault |access-date = September 13, 2014 |via= [[NARA|National Archives]] |work= [[whitehouse.gov]] |date = January 22, 2014 }}</ref><ref name="Freedom">{{cite news |url = https://www.msnbc.com/morning-joe/obama-we-have-power-end-sexual-assaults |title = Obama admin: Freedom from sexual assault a basic human right |publisher = MSNBC |access-date = September 13, 2014 |date = January 22, 2014 |archive-date = January 25, 2014 |archive-url = https://web.archive.org/web/20140125031015/http://www.msnbc.com/morning-joe/obama-we-have-power-end-sexual-assaults |url-status = dead }}</ref> The co-chairs of the Task Force were Vice President Joe Biden and Jarrett.<ref name="Memo" /> The Task Force was a development out of the White House Council on Women and Girls and [[Office of the Vice President of the United States]], and prior to that the 1994 [[Violence Against Women Act]] first drafted by Biden.<ref name="Report">{{cite web |url=http://www.sapr.mil/public/docs/research/201401_WhiteHouse_CouncilonWomenandGirls_RapeandSexualAssault.pdf |title=Rape and sexual assault: A renewed call to action |work=White House Council on Women and Girls |location=Washington, D.C. |publisher=White House Council on Women and Girls & Office of the Vice President |date=January 2014 |access-date=June 10, 2014 |archive-url=https://web.archive.org/web/20140402015447/http://www.sapr.mil/public/docs/research/201401_WhiteHouse_CouncilonWomenandGirls_RapeandSexualAssault.pdf |archive-date=April 2, 2014|url-status=dead }}</ref>
In a [[Space policy of the Barack Obama administration|major space policy speech]] in April 2010, Obama announced a planned change in direction at [[NASA]], the U.S. space agency. He ended plans for a return of [[human spaceflight]] to the moon and development of the [[Ares I]] rocket, [[Ares V]] rocket and [[Constellation program]], in favor of funding [[Earth science]] projects, a new rocket type, research and development for an eventual crewed mission to Mars, and ongoing missions to the [[International Space Station]].<ref>{{cite news |first1=Robert |last1=Block |first2=Mark K. |last2=Matthews |url=https://www.latimes.com/archives/la-xpm-2010-jan-27-la-na-nasa-budget27-2010jan27-story.html |title = White House won't fund NASA moon program |quote = President Obama's budget proposal includes no money for the Ares I and Ares V rocket or Constellation program. Instead, NASA would be asked to monitor climate change and develop a new rocket |date = January 27, 2010 |work = Los Angeles Times |access-date = January 30, 2011 }}</ref>
[[File:Barack Obama visiting victims of 2012 Aurora shooting.jpg|thumb|Obama visits an [[2012 Aurora, Colorado shooting|Aurora shooting]] victim at [[University of Colorado Hospital]], 2012.]]
On January 16, 2013, one month after the [[Sandy Hook Elementary School shooting]], Obama signed 23 executive orders and outlined a series of sweeping proposals regarding [[Gun politics in the United States|gun control]].<ref>{{cite news |url=https://www.bbc.co.uk/news/world-us-canada-21049942 |work = BBC News |title = US gun debate: Obama unveils gun control proposals |first = Mark |last = Mardell |date = January 16, 2013 |access-date = January 16, 2013 }}</ref> He urged Congress to reintroduce an [[Federal Assault Weapons Ban|expired ban]] on military-style [[assault weapons]], such as those used in several recent mass shootings, impose limits on ammunition magazines to 10 rounds, introduce background checks on all gun sales, pass a ban on possession and sale of armor-piercing bullets, introduce harsher penalties for gun-traffickers, especially unlicensed dealers who buy arms for criminals and approving the appointment of the head of the federal [[Bureau of Alcohol, Tobacco, Firearms and Explosives]] for the first time since 2006.<ref>{{cite news |title = What's in Obama's Gun Control Proposal |url=https://www.nytimes.com/interactive/2013/01/16/us/obama-gun-control-proposal.html |work = The New York Times |date = January 16, 2013 |access-date = February 12, 2013 }}</ref> On January 5, 2016, Obama announced new executive actions extending background check requirements to more gun sellers.<ref>{{cite news |url=https://edition.cnn.com/2016/01/05/politics/obama-gun-control-executive-action/ |title=Obama announces gun control executive action (full transcript) |work=CNN|date=January 5, 2016 |access-date=January 7, 2016 }}</ref> In a 2016 editorial in ''The New York Times'', Obama compared the struggle for what he termed "common-sense gun reform" to [[women's suffrage]] and other [[civil rights movements]] in American history.<ref>{{cite news |last=Obama |first=Barack |url=https://www.nytimes.com/2016/01/08/opinion/president-barack-obama-guns-are-our-shared-responsibility.html |title=Barack Obama: Guns Are Our Shared Responsibility |work=The New York Times |date=January 7, 2016 |access-date=January 7, 2016 }}</ref>
In 2011, Obama signed a four-year renewal of the Patriot Act.<ref>{{cite news |url=https://www.nbcnews.com/id/43180202/ns/us_news-security/t/obama-europe-signs-patriot-act-extension/ |work=[[NBC News]] |title=Obama, in Europe, signs Patriot Act extension | date=May 27, 2011|access-date= August 8, 2019}}</ref> Following the [[Global surveillance disclosures (2013–present)|2013 global surveillance disclosures]] by [[whistleblower]] [[Edward Snowden]], Obama condemned the leak as unpatriotic,<ref name="CNN-Snowden">{{cite news |work=CNN|url=http://www.cnn.com/2013/08/12/politics/obama-snowden-whistleblower | title=Fact-checking Obama's claims about Snowden | date=August 13, 2013 | access-date=August 8, 2019 |last=Wolf |first=Z. Byron}}</ref> but called for increased restrictions on the [[National Security Agency]] (NSA) to address violations of privacy.<ref>{{cite news |url=https://www.reuters.com/article/usa-security-obama-idUSL1N0MS1QW20140403?type=companyNews| title=Obama's NSA overhaul may require phone carriers to store more data| date=April 3, 2014 | work=Reuters | access-date=August 8, 2019 | author=Hosenball, Mark}}</ref><ref>{{cite news |last=Ackerman |first=Spencer |date=January 17, 2014 |title=Obama to overhaul NSA's bulk storage of Americans' telephone data |url=https://www.theguardian.com/world/2014/jan/17/obama-end-nsa-bulk-storage-telephone-metadata |work=[[The Guardian]] |access-date=August 12, 2019 }}</ref> Obama continued and expanded surveillance programs set up by George W. Bush, while implementing some reforms.<ref name=":0">{{Cite web |last=Roth |first=Kenneth |date=2017-01-09 |title=Barack Obama's Shaky Legacy on Human Rights |url=https://www.hrw.org/news/2017/01/09/barack-obamas-shaky-legacy-human-rights |access-date=2022-06-26 |website=[[Human Rights Watch]] |language=en}}</ref> He supported legislation that would have limited the NSA's ability to collect phone records in bulk under a single program and supported bringing more transparency to the [[United States Foreign Intelligence Surveillance Court|Foreign Intelligence Surveillance Court]] (FISC).<ref name=":0" />
<!--
<ref>{{cite news |url=https://www.huffingtonpost.com/2013/06/17/obama-nsa-surveillance_n_3455771.html | title=Obama Defends NSA Surveillance Program, Says It's 'Transparent' | work=The Huffington Post | date=June 17, 2013 | access-date=February 21, 2014 |last=Reilly |first=Molly}}</ref>
-->
====LGBT rights and same-sex marriage====
On October 8, 2009, Obama signed the [[Matthew Shepard and James Byrd Jr. Hate Crimes Prevention Act]], a measure that expanded the [[Hate crime laws in the United States#Federal prosecution of hate crimes|1969 United States federal hate-crime law]] to include crimes motivated by a victim's actual or perceived gender, sexual orientation, gender identity, or disability.<ref>{{cite news |url=https://edition.cnn.com/2009/POLITICS/10/28/hate.crimes/ |title=Obama signs hate crimes bill into law |work=CNN|date=October 28, 2009 |access-date=October 12, 2011}}</ref> On October 30, 2009, Obama lifted the ban on travel to the United States by those infected with [[HIV]]. The lifting of the ban was celebrated by [[Immigration Equality]].<ref>{{cite news |last=Preston |first=Julia |date=October 30, 2009 |url=https://www.nytimes.com/2009/10/31/us/politics/31travel.html |archive-url=https://web.archive.org/web/20100407213122/http://www.nytimes.com/2009/10/31/us/politics/31travel.html |archive-date=April 7, 2010 |url-access=subscription |url-status=live |title=Obama Lifts a Ban on Entry Into U.S. by H.I.V.-Positive People |newspaper=The New York Times |access-date=February 8, 2017 }}</ref> On December 22, 2010, Obama signed the [[Don't Ask, Don't Tell Repeal Act of 2010]], which fulfilled a promise made in the 2008 presidential campaign<ref>{{cite news |url=https://www.theguardian.com/world/2010/dec/22/obama-repeals-dont-ask-dont-tell |title = 'Don't ask, don't tell' repealed as Obama signs landmark law |work = The Guardian |location = London |date = December 22, 2010 |access-date = June 2, 2018 |archive-url=https://web.archive.org/web/20101223060037/http://www.guardian.co.uk/world/2010/dec/22/obama-repeals-dont-ask-dont-tell |archive-date = December 23, 2010}}</ref><ref>{{cite news|author=Sheryl Gay Stolberg|url=https://www.nytimes.com/2010/12/23/us/politics/23military.html |archive-url=https://web.archive.org/web/20110512170430/http://www.nytimes.com/2010/12/23/us/politics/23military.html |archive-date=May 12, 2011 |url-access=subscription |url-status=live|title=Obama Signs Away 'Don't Ask, Don't Tell'|date=December 23, 2010|newspaper=The New York Times}}</ref> to end the [[don't ask, don't tell]] policy of 1993 that had prevented gay and lesbian people from serving openly in the [[United States Armed Forces]].<ref>{{cite web |last=Lee |first=Jesse |url=https://obamawhitehouse.archives.gov/blog/2010/12/22/president-signs-repeal-dont-ask-dont-tell-out-many-we-are-one |title=The President Signs Repeal of "Don't Ask Don't Tell": "Out of Many, We Are One" |access-date = December 22, 2010|via=[[NARA|National Archives]] |work=[[whitehouse.gov]] |date = December 22, 2010 }}</ref> In 2016, the Pentagon ended the policy that barred [[Transgender personnel in the United States military|transgender people from serving openly in the military]].<ref name=TransBan1>{{cite news|url=https://www.theguardian.com/us-news/2016/jun/30/us-military-ends-ban-transgender-service-members |first1=Molly |last1=Redden |first2=Amanda |last2=Holpuch |title=US military ends ban on transgender service members|work=The Guardian|date=June 30, 2016}}</ref>
[[File:Celebrating a new America -lovewins 58242 (18588276403).jpg|thumb|The [[White House]] was illuminated in rainbow colors on the evening of the Supreme Court [[Obergefell v. Hodges|same-sex marriage ruling]], June 26, 2015.]]
As a candidate for the Illinois state senate in 1996, Obama stated he favored legalizing [[Same-sex marriage in the United States|same-sex marriage]].<ref name="WCT0114">{{cite news |last = Baim |first = Tracy |title = Windy City Times exclusive: Obama's Marriage Views Changed. WCT Examines His Step Back |url=http://www.windycitymediagroup.com/lgbt/Windy-City-Times-exclusive-Obamas-Marriage-Views-Changed-WCT-Examines-His-Step-Back/20524.html |access-date = May 10, 2012 |newspaper = [[Windy City Times]] |date = January 14, 2009 }}</ref> During his Senate run in 2004, he said he supported civil unions and domestic partnerships for same-sex partners but opposed same-sex marriages.<ref name="WCT0204">{{cite news |last = Baim |first = Tracy |title = Obama Seeks U.S. Senate seat |url=http://www.windycitymediagroup.com/gay/lesbian/news/ARTICLE.php?AID=3931 |access-date = May 10, 2012 |newspaper = [[Windy City Times]] |date = February 4, 2004 }}</ref> In 2008, he reaffirmed this position by stating "I believe marriage is between a man and a woman. I am not in favor of gay marriage."<ref>{{Cite news|url=https://www.politifact.com/truth-o-meter/statements/2012/may/11/barack-obama/president-barack-obamas-shift-gay-marriage/|title=President Barack Obama's shifting stance on gay marriage|work=PolitiFact|access-date=November 28, 2018}}</ref> On May 9, 2012, shortly after the official launch of his campaign for re-election as president, Obama said his views had evolved, and he publicly affirmed his personal support for the legalization of same-sex marriage, becoming the first sitting U.S. president to do so.<ref>{{cite news |url=https://www.cbsnews.com/news/obama-backs-same-sex-marriage/ |first=Corbett |last=Daly |title=Obama backs same-sex marriage |work=[[CBS News]] |date=May 9, 2012 |access-date = May 9, 2012 }}</ref><ref name="The Huffington Post">{{cite news |url=https://www.huffingtonpost.com/2012/05/09/obama-gay-marriage_n_1503245.html |title = Obama Backs Gay Marriage |last = Stein |first = Sam |date = May 9, 2012 |work = The Huffington Post |access-date = July 5, 2015 }}</ref> During his second [[Second inauguration of Barack Obama|inaugural address]] on January 21, 2013,<ref name="NYT20130121" /> Obama became the first U.S. president in office to call for full equality for gay Americans, and the first to mention [[LGBT rights in the United States|gay rights]] or the word "gay" in an inaugural address.<ref>{{cite news |last = Robillard |first = Kevin |title = First inaugural use of the word 'gay' |url=https://www.politico.com/story/2013/01/first-inaugural-use-of-the-word-gay-086499 |access-date = January 21, 2013 |work = Politico |date = January 21, 2013 }}</ref><ref>{{cite news |title = Obama Inauguration Speech Makes History With Mention of Gay Rights Struggle, Stonewall Uprising |url=https://www.huffingtonpost.com/2013/01/21/obama-inauguration-speech-stonewall-gays_n_2520962.html |work = The Huffington Post |access-date = January 21, 2013 |first = Noah |last = Michelson |date = January 21, 2013 }}</ref> In 2013, the Obama administration filed briefs that urged the [[Supreme Court of the United States|Supreme Court]] to rule in favor of same-sex couples in the cases of ''[[Hollingsworth v. Perry]]'' (regarding [[Same-sex marriage in the United States|same-sex marriage]])<ref name="huffpo-amicus">{{cite news |url=https://www.huffingtonpost.com/2013/02/28/obama-gay-marriage_n_2783912.html |title = Obama Administration: Gay Marriage Ban Unconstitutional In Prop. 8 Supreme Court Case |last = Reilly |first = Ryan J. |date = February 28, 2013 |work = [[The Huffington Post]] |access-date = April 21, 2013 }}</ref> and ''[[United States v. Windsor]]'' (regarding the [[Defense of Marriage Act]]).<ref name="cnn-amicus">{{cite news |url=https://edition.cnn.com/2013/02/22/politics/supreme-court-marriage |title=Obama administration weighs in on defense of marriage law |last = Mears |first = Bill |date = February 27, 2013 |publisher = CNN |access-date = April 21, 2013 }}</ref>
====Economic policy====
{{Main|Economic policy of the Barack Obama administration}}
[[File:20090124 WeeklyAddress.ogv|thumbtime=1:3|thumb|Obama presents his first [[commons:Obama Administration weekly video addresses|weekly address]] as president of the United States on January 24, 2009, discussing the [[American Recovery and Reinvestment Act of 2009]]|alt=Photograph]]
On February 17, 2009, Obama signed the [[American Recovery and Reinvestment Act of 2009]], a $787{{nbs}}billion [[stimulus (economics)|economic stimulus]] package aimed at helping the economy recover from the [[Great Recession|deepening worldwide recession]].<ref>{{cite news |url=http://www.cnn.com/2009/POLITICS/02/13/stimulus/index.html |title = Stimulus package en route to Obama's desk |access-date = March 29, 2009 |publisher = CNN |date = February 14, 2009 |archive-url=https://web.archive.org/web/20090330094958/http://www.cnn.com/2009/POLITICS/02/13/stimulus/index.html |archive-date = March 30, 2009 |url-status=live }}</ref> The act includes increased federal spending for health care, infrastructure, education, various tax breaks and [[tax incentive|incentives]], and direct assistance to individuals.<ref name="direct assistance" /> In March 2009, Obama's [[Treasury Secretary]], [[Timothy Geithner]], took further steps to manage the [[financial crisis of 2007–08|financial crisis]], including introducing the [[Public–Private Investment Program for Legacy Assets]], which contains provisions for buying up to $2{{nbs}}trillion in depreciated real estate assets.<ref name="markets opened" />
[[File:U.S. Total Deficits vs. National Debt Increases 2001-2010.png|thumb|[[United States federal budget|Deficit]] and [[National debt of the United States|debt]] increases, 2001–2016]]
Obama intervened in the [[automotive industry crisis of 2008–10|troubled automotive industry]]<ref>{{cite news|title=White House questions viability of GM, Chrysler |date=March 30, 2009 |work=The Huffington Post |url=https://www.huffingtonpost.com/2009/03/30/obama-denies-bailout-fund_n_180563.html |url-status=dead |archive-url=https://web.archive.org/web/20090407010806/http://www.huffingtonpost.com/2009/03/30/obama-denies-bailout-fund_n_180563.html |archive-date=April 7, 2009 }}</ref> in March 2009, renewing loans for [[General Motors]] (GM) and [[Chrysler]] to continue operations while reorganizing. Over the following months the White House set terms for both firms' bankruptcies, including the [[Chrysler Chapter 11 reorganization|sale of Chrysler]] to Italian automaker [[Fiat]]<ref>{{cite news |title = Chrysler and Union Agree to Deal Before Federal Deadline |url=https://www.nytimes.com/2009/04/27/business/27chrysler.html |archive-url=https://web.archive.org/web/20090428062100/http://www.nytimes.com/2009/04/27/business/27chrysler.html |archive-date=April 28, 2009 |url-access=subscription |url-status=live |work = The New York Times |first1 = Nick |last1 = Bunkley |first2 = Bill |last2 = Vlasic |date = April 27, 2009 |access-date = April 12, 2010 }}</ref> and a [[General Motors Chapter 11 reorganization|reorganization of GM]] giving the U.S. government a temporary 60 percent equity stake in the company.<ref>{{cite news|title=GM Begins Bankruptcy Process With Filing for Affiliate |first1=John |last1=Hughes |first2=Caroline |last2=Salas |first3=Jeff |last3=Green |first4=Bob |last4=Van Voris |url=http://bloomberg.com/apps/news?pid=20601087&sid=aw4F_L7E4xYg |agency=[[Bloomberg News]] |date=June 1, 2009 |access-date=July 5, 2015 |url-status=dead |archive-url=https://web.archive.org/web/20100613163056/http://www.bloomberg.com/apps/news?pid=20601087 |archive-date=June 13, 2010 }}</ref> In June 2009, dissatisfied with the pace of economic stimulus, Obama called on his cabinet to accelerate the investment.<ref name="Christopher Conkey and Louise Radnofsky">{{cite news |title = Obama Presses Cabinet to Speed Stimulus Spending |date = June 9, 2009 |work = The Wall Street Journal |publisher = News Corp |url=https://www.wsj.com/articles/SB124445867883193821 |first1 = Christopher |last1 = Conkey |first2 = Louise |last2 = Radnofsky |access-date = July 5, 2015 }}</ref> He signed into law the [[Car Allowance Rebate System]], known colloquially as "Cash for Clunkers", which temporarily boosted the economy.<ref>{{cite news |url=https://www.washingtonpost.com/wp-dyn/content/article/2009/08/20/AR2009082002699.html |title = U.S. Says 'Cash for Clunkers' Program Will End on Monday |last = Hedgpeth |first = Dana |newspaper = The Washington Post |date = August 21, 2009 |access-date = March 26, 2010 }}</ref><ref>{{cite news |url=http://www.time.com/time/business/article/0,8599,1918692,00.html |archive-url=https://web.archive.org/web/20090828040214/http://www.time.com/time/business/article/0,8599,1918692,00.html |url-status= dead |archive-date= August 28, 2009 |title = Was Cash for Clunkers a Success? |last = Szczesny |first = Joseph R. |magazine = Time |date = August 26, 2009 |access-date = March 26, 2010 }}</ref><ref>{{cite journal |last1 = Mian |first1 = Atif R. |first2 = Amir |last2 = Sufi |s2cid = 219352572 |title = The Effects of Fiscal Stimulus: Evidence from the 2009 'Cash for Clunkers' Program |date = September 1, 2010 |ssrn = 1670759 |doi = 10.2139/ssrn.1670759 |journal=The Quarterly Journal of Economics|volume=127|issue=3|pages=1107–1142}}</ref>
The Bush and Obama administrations authorized spending and loan guarantees from the [[Federal Reserve System|Federal Reserve]] and the [[United States Department of the Treasury|Department of the Treasury]]. These guarantees totaled about $11.5{{nbs}}trillion, but only $3{{nbs}}trillion had been spent by the end of November 2009.<ref>{{cite news |title = CNNMoney.com's bailout tracker |work=CNNMoney |page = 20 |volume = 06 |url=https://money.cnn.com/news/storysupplement/economy/bailouttracker/ |access-date = March 26, 2010 |last = Goldman |first = David |date = April 6, 2009 }}</ref> On August 2, 2011, after a lengthy congressional debate over whether to raise the nation's debt limit, Obama signed the bipartisan [[Budget Control Act of 2011]]. The legislation enforced limits on discretionary spending until 2021, established a procedure to increase the debt limit, created a Congressional Joint Select Committee on Deficit Reduction to propose further deficit reduction with a stated goal of achieving at least $1.5{{nbs}}trillion in budgetary savings over 10 years, and established automatic procedures for reducing spending by as much as $1.2{{nbs}}trillion if legislation originating with the new joint select committee did not achieve such savings.<ref>{{cite web |last = Stein |first = Sylvie |url=http://firstread.msnbc.msn.com/_news/2011/08/02/7231805-a-breakdown-of-the-debt-limit-legislation |archive-url=https://web.archive.org/web/20120114001916/http://firstread.msnbc.msn.com/_news/2011/08/02/7231805-a-breakdown-of-the-debt-limit-legislation |archive-date = January 14, 2012 |title = First Read—A breakdown of the debt-limit legislation |publisher = MSNBC |access-date = August 3, 2011 }}</ref> By passing the legislation, Congress was able to prevent a [[Federal government of the United States|U.S. government]] [[Default (finance)|default]] on its obligations.<ref>{{cite news |url=https://www.nbcnews.com/id/43967924 |title = House passes debt ceiling bill |work = NBC News |date = March 8, 2011 |access-date = August 3, 2011 }}</ref>
The unemployment rate rose in 2009, reaching a peak in October at 10.0 percent and averaging 10.0 percent in the fourth quarter. Following a decrease to 9.7 percent in the first quarter of 2010, the unemployment rate fell to 9.6 percent in the second quarter, where it remained for the rest of the year.<ref name="Theodossiou">{{cite journal |last1 = Theodossiou |first1 = Eleni |last2 = Hipple |first2 = Steven F. |year = 2011 |title = Unemployment Remains High in 2010 |journal = Monthly Labor Review |volume = 134 |issue = 3 |pages = 3–22 |url=http://www.bls.gov/opub/mlr/2011/03/art1full.pdf |access-date = April 7, 2011 |archive-url=https://web.archive.org/web/20110508050328/http://www.bls.gov/opub/mlr/2011/03/art1full.pdf |archive-date = May 8, 2011 }}</ref> Between February and December 2010, employment rose by 0.8 percent, which was less than the average of 1.9 percent experienced during comparable periods in the past four employment recoveries.<ref name="Eddlemon">{{cite journal |last1 = Eddlemon |first1 = John P. |year = 2011 |title = Payroll Employment Turns the Corner in 2010 |journal = Monthly Labor Review |volume = 134 |issue = 3 |pages = 23–32 |url=http://www.bls.gov/opub/mlr/2011/03/art2full.pdf |access-date = April 7, 2011 |archive-url=https://web.archive.org/web/20110506195757/http://www.bls.gov/opub/mlr/2011/03/art2full.pdf |archive-date = May 6, 2011 }}</ref> By November 2012, the unemployment rate fell to 7.7 percent,<ref>{{cite web |url=http://data.bls.gov/pdq/SurveyOutputServlet |title = Unemployment Rate |publisher = [[Bureau of Labor Statistics]] |access-date = December 11, 2012 }}</ref> decreasing to 6.7 percent in the last month of 2013.<ref>{{cite web |url=http://data.bls.gov/timeseries/LNS14000000 |title = Unemployment Rate |publisher = [[Bureau of Labor Statistics]] |access-date = January 10, 2014 }}</ref> During 2014, the unemployment rate continued to decline, falling to 6.3 percent in the first quarter.<ref>{{cite web |url=http://data.bls.gov/timeseries/LNS14000000 |title = Unemployment Rate |publisher = [[Bureau of Labor Statistics]] |access-date = June 6, 2014 }}</ref> GDP growth returned in the third quarter of 2009, expanding at a rate of 1.6 percent, followed by a 5.0 percent increase in the fourth quarter.<ref name="BEA1">{{cite web |url=http://bea.gov/national/nipaweb/TableView.asp?SelectedTable=1&ViewSeries=NO&Java=no&Request3Place=N&3Place=N&FromView=YES&Freq=Qtr&FirstYear=2009&LastYear=2010&3Place=N&Update=Update&JavaBox=no#Mid |title = Percent Change in Real Gross Domestic Product (Quarterly) |website = National Income and Product Accounts Table |publisher = [[Bureau of Economic Analysis]] |access-date = April 7, 2011 |archive-url=https://web.archive.org/web/20110512014536/http://bea.gov/national/nipaweb/TableView.asp?SelectedTable=1&ViewSeries=NO&Java=no&Request3Place=N&3Place=N&FromView=YES&Freq=Qtr&FirstYear=2009&LastYear=2010&3Place=N&Update=Update&JavaBox=no#Mid |archive-date = May 12, 2011 |url-status=dead }}</ref> Growth continued in 2010, posting an increase of 3.7 percent in the first quarter, with lesser gains throughout the rest of the year.<ref name="BEA1" /> In July 2010, the [[Federal Reserve System|Federal Reserve]] noted that economic activity continued to increase, but its pace had slowed, and chairman [[Ben Bernanke]] said the economic outlook was "unusually uncertain".<ref>{{cite news |last = Harding |first = Robin |title = Beige Book survey reports signs of slowdown |url=http://www.ft.com/cms/s/0/dac3245a-9a7b-11df-87fd-00144feab49a.html |work = [[Financial Times]] |access-date = July 29, 2010 |date = July 28, 2010 |archive-url=https://web.archive.org/web/20100729184009/http://www.ft.com/cms/s/0/dac3245a-9a7b-11df-87fd-00144feab49a.html|archive-date=July 29, 2010 }}</ref> Overall, the economy expanded at a rate of 2.9 percent in 2010.<ref>{{cite web |url=http://bea.gov/national/nipaweb/TableView.asp?SelectedTable=1&ViewSeries=NO&Java=no&Request3Place=N&3Place=N&FromView=YES&Freq=Year&FirstYear=2009&LastYear=2010&3Place=N&Update=Update&JavaBox=no#Mid |title = Percent Change in Real Gross Domestic Product (Annual) |website = National Income and Product Accounts Table |publisher = Bureau of Economic Analysis |access-date = April 7, 2011 |archive-url=https://web.archive.org/web/20110512014513/http://bea.gov/national/nipaweb/TableView.asp?SelectedTable=1&ViewSeries=NO&Java=no&Request3Place=N&3Place=N&FromView=YES&Freq=Year&FirstYear=2009&LastYear=2010&3Place=N&Update=Update&JavaBox=no#Mid |archive-date = May 12, 2011 |url-status=dead }}</ref>
[[File:US Employment Statistics.svg|thumb|left|upright=1.35|US employment statistics ([[unemployment rate]] and monthly changes in net employment) during Obama's tenure as U.S. president<ref>{{cite web |url=http://data.bls.gov/timeseries/LNS14000000 |title = Unemployment Rate |publisher = [[Bureau of Labor Statistics]] |access-date=September 12, 2018}}</ref><ref>{{cite web |url=http://data.bls.gov/timeseries/CES0000000001?output_view=net_1mth |title = 1-month net change in employment |publisher = [[Bureau of Labor Statistics]] |access-date=September 12, 2018}}</ref>]]
The [[Congressional Budget Office]] (CBO) and a broad range of economists credit Obama's stimulus plan for economic growth.<ref name="estimated" /><ref name="newc" /> The CBO released a report stating that the stimulus bill increased employment by 1–2.1{{nbs}}million,<ref name="newc">{{cite news |url=https://www.nytimes.com/2009/11/21/business/economy/21stimulus.html |title = New Consensus Sees Stimulus Package as Worthy Step |work = The New York Times |date = November 20, 2009 |access-date = December 21, 2010 |first1 = Jackie |last1 = Calmes |first2 = Michael |last2 = Cooper |archive-url=https://web.archive.org/web/20110511230904/http://www.nytimes.com/2009/11/21/business/economy/21stimulus.html|archive-date=May 11, 2011 }}</ref><ref>{{cite news |url=http://thehill.com/blogs/blog-briefing-room/news/83253-cbo-stimulus-created-as-many-as-21-million-jobs |title = CBO: Stimulus created as many as 2.1 million jobs |date = February 23, 2010 |access-date = April 25, 2010 }}</ref><ref>{{cite news |url=https://www.nytimes.com/2009/11/02/opinion/02krugman.html |archive-url=https://web.archive.org/web/20091105001423/http://www.nytimes.com/2009/11/02/opinion/02krugman.html |archive-date=November 5, 2009 |url-access=subscription |url-status=live |title = Too Little of a Good Thing |work = The New York Times |date = November 2, 2009 |access-date = December 22, 2010 |first = Paul |last = Krugman }}</ref><ref>{{cite news |last = Isidore |first = Chris |url=https://money.cnn.com/2010/01/29/news/economy/gdp/index.htm |title = Best economic growth in six years |publisher = CNN |date = January 29, 2010 |access-date = April 18, 2010 }}</ref> while conceding that "it is impossible to determine how many of the reported jobs would have existed in the absence of the stimulus package."<ref name="estimated">{{cite web |url=http://www.cbo.gov/publication/42715 |title = Estimated Impact of the American Recovery and Reinvestment Act on Employment and Economic Output |date = November 22, 2011 |publisher = Congressional Budget Office |access-date = February 21, 2012 }}</ref> Although an April 2010, survey of members of the [[National Association for Business Economics]] showed an increase in job creation (over a similar January survey) for the first time in two years, 73 percent of 68 respondents believed the stimulus bill has had no impact on employment.<ref>{{cite web|url=http://www.nabe.com/publib/indsum.html |title=New NABE Survey Shows Business Recovery Gaining Momentum, with More Jobs Ahead |access-date=April 26, 2010 |archive-url=https://web.archive.org/web/20100502053859/http://www.nabe.com/publib/indsum.html |archive-date=May 2, 2010 |url-status=dead }}</ref> The economy of the United States has grown faster than the other original [[NATO]] members by a wider margin under President Obama than it has anytime since the end of [[World War II]].<ref>{{cite web |work=Politics that Work |url=http://politicsthatwork.com/graphs/gdp-growth-vs-nato-president |title=U.S. GDP Growth Relative to Original NATO Members |date=March 9, 2015 }}</ref> The [[OECD|Organisation for Economic Co-operation and Development]] credits the much faster growth in the United States to the stimulus plan of the U.S. and the austerity measures in the European Union.<ref>{{cite news |first=Irene |last=Chapple |url=https://edition.cnn.com/2013/05/29/business/oecd-u-s-europe-economic-recovery/ |title=OECD: U.S. will recover faster, Europe faces unemployment crisis |work=CNN|date=May 29, 2013 }}</ref>
Within a month of the [[2010 United States elections|2010 midterm elections]], Obama announced a compromise deal with the Congressional Republican leadership that included a temporary, two-year extension of the [[Bush tax cuts|2001 and 2003 income tax rates]], a one-year [[Federal Insurance Contributions Act tax|payroll tax]] reduction, continuation of unemployment benefits, and a new rate and exemption amount for [[Estate tax in the United States|estate taxes]].<ref>{{cite news |url=https://www.nytimes.com/2010/12/08/us/politics/08cong.html |archive-url=https://web.archive.org/web/20101209044154/http://www.nytimes.com/2010/12/08/us/politics/08cong.html |archive-date=December 9, 2010 |url-access=subscription |url-status=live |title = Democrats Skeptical of Obama on New Tax Plan |last1 = Herszenhorn |first1 = David M. |last2 = Stolberg |first2 = Sheryl Gay |newspaper = The New York Times |date = December 7, 2010 }}</ref> The compromise overcame opposition from some in both parties, and the resulting $858{{nbs}}billion [[Tax Relief, Unemployment Insurance Reauthorization, and Job Creation Act of 2010]] passed with bipartisan majorities in both houses of Congress before Obama signed it on December 17, 2010.<ref>{{cite news |url=http://www.cnn.com/2010/POLITICS/12/17/tax.deal/index.html |title = Obama signs tax deal into law |publisher = CNN |date = December 17, 2010 |access-date = December 17, 2010 }}</ref>
In December 2013, Obama declared that growing [[Income inequality in the United States|income inequality]] is a "defining challenge of our time" and called on Congress to bolster the safety net and raise wages. This came on the heels of the [[Fast food worker strikes|nationwide strikes of fast-food workers]] and [[Pope Francis]]' criticism of inequality and [[trickle-down economics]].<ref>{{cite news |url=https://finance.yahoo.com/news/obama-income-inequality-defining-challenge-164430631.html |title = Obama: Income Inequality a Defining Challenge |first = Jim |last = Kuhnhenn |agency = Associated Press |date = December 4, 2013 |access-date = January 9, 2014 }}</ref> Obama urged Congress to ratify a 12-nation free trade pact called the [[Trans-Pacific Partnership]].<ref>{{cite news |url=https://www.cbsnews.com/news/president-obama-makes-trade-deal-a-top-priority-in-remaining-months/ |title=President Obama uses his final months to bring congressional approval of a 12-nation free trade pact called the Trans-Pacific Partnership |date=September 5, 2016 |work=CBS News |access-date=September 5, 2016}}</ref>
====Environmental policy====
{{See also|Climate change policy of the United States|Energy policy of the Barack Obama administration}}
[[File:Obama-venice-la.jpg|thumb|Obama at a 2010 briefing on the [[BP oil spill]] at the [[United States Coast Guard|Coast Guard]] Station Venice in [[Venice, Louisiana]]]]
On April 20, 2010, an explosion destroyed an offshore [[drilling rig]] at the [[Macondo Prospect]] in the [[Gulf of Mexico]], causing a [[Deepwater Horizon oil spill|major sustained oil leak]]. Obama visited the Gulf, announced a federal investigation, and formed a bipartisan commission to recommend new safety standards, after a review by [[United States Secretary of the Interior|Secretary of the Interior]] [[Ken Salazar]] and concurrent Congressional hearings. He then announced a six-month moratorium on new [[deepwater drilling]] permits and leases, pending regulatory review.<ref>{{cite news |title = Obama Halts Drilling Projects, Defends Actions |publisher = NPR |date = May 27, 2010 |url=https://www.npr.org/templates/story/story.php?storyId=127205462&ps=rs }}</ref> As multiple efforts by BP failed, some in the media and public expressed confusion and criticism over various aspects of the incident, and stated a desire for more involvement by Obama and the federal government.<ref>{{cite news |first = Patrik |last = Jonsson |url=http://www.csmonitor.com/USA/Politics/2010/0529/Gulf-oil-spill-Obama-s-big-political-test |title = Gulf oil spill: Obama's big political test |work = [[The Christian Science Monitor]] |date = May 29, 2010 |access-date = June 6, 2010 |archive-url=https://web.archive.org/web/20100601094118/http://www.csmonitor.com/USA/Politics/2010/0529/Gulf-oil-spill-Obama-s-big-political-test |archive-date = June 1, 2010 |url-status=live }}</ref> Prior to the oil spill, on March 31, 2010, Obama ended a ban on oil and gas drilling along the majority of the [[East Coast of the United States]] and along the coast of [[Arctic Alaska|northern Alaska]] in an effort to win support for an energy and climate bill and to reduce foreign imports of oil and gas.<ref>{{Cite news|last=Neuman|first=Scott|date=March 31, 2010|title=Obama Ends Ban On East Coast Offshore Drilling|language=en|work=NPR|url=https://www.npr.org/templates/story/story.php?storyId=125378223|access-date=October 30, 2021}}</ref>
In July 2013, Obama expressed reservations and said he "would reject the [[Keystone XL pipeline]] if it increased carbon pollution [or] greenhouse emissions."<ref>{{cite news |last=Goldenberg |first=Suzanne |date=July 28, 2013 |url=https://www.theguardian.com/environment/2013/jul/28/obama-reservations-keystone-pipeline-project |title=Barack Obama expresses reservations about Keystone XL pipeline project |work=The Guardian |location=London }}</ref><ref>{{cite news |last=Stein |first=Sam |date=June 25, 2013 |url=https://www.huffpost.com/entry/obama-keystone_n_3497292 |title=Obama: Keystone XL Should Not Be Approved If It Will Increase Greenhouse Gas Emissions |work=The Huffington Post }}</ref> On February 24, 2015, Obama vetoed a bill that would have authorized the pipeline.<ref>{{cite news |url=https://www.npr.org/sections/thetwo-way/2015/02/24/388738159/obama-to-veto-keystone-xl-pipeline-today-without-drama-or-fanfare-or-delay |title=Obama Vetoes Keystone XL Pipeline Bill |date = February 24, 2015 |access-date = February 24, 2015 |publisher=NPR |first=Krishnadev |last=Calamur }}</ref> It was the third veto of Obama's presidency and his first major veto.<ref>{{cite news |url=http://thehill.com/policy/energy-environment/234615-senate-fails-to-override-obama-keystone-veto |title = Keystone veto override fails |date = March 4, 2015 |first = Laura |last = Barron-Lopez |website = [[The Hill (newspaper)|The Hill]] |publisher = Capitol Hill Publishing |access-date = July 2, 2015 }}</ref>
In December 2016, Obama permanently banned new offshore oil and gas drilling in most United States-owned waters in the [[Atlantic Ocean|Atlantic]] and [[Arctic Ocean]]s using the 1953 Outer Continental Shelf Act.<ref>{{Cite news|date=December 21, 2016|title=Obama bans oil drilling 'permanently' in millions of acres of ocean|language=en-GB|work=BBC News|url=https://www.bbc.com/news/world-us-canada-38387525|access-date=October 30, 2021}}</ref><ref>{{Cite news|last=Smith|first=David|date=December 20, 2016|title=This article is more than 4 years old Barack Obama bans oil and gas drilling in most of Arctic and Atlantic oceans|work=The Guardian|url=https://www.theguardian.com/us-news/2016/dec/20/barack-obama-bans-oil-gas-drilling-arctic-atlantic|access-date=October 30, 2021}}</ref><ref>{{Cite news|last1=Volcovici|first1=Valerie|last2=Gardner|first2=Timothy|date=December 20, 2016|title=Obama bans new oil, gas drilling off Alaska, part of Atlantic coast|language=en|work=Reuters|url=https://www.reuters.com/article/us-usa-obama-drilling-idUSKBN1492KU|access-date=October 30, 2021}}</ref>
Obama emphasized the [[Conservation movement|conservation]] of [[federal lands]] during his term in office. He used his power under the [[Antiquities Act]] to create 25 new [[National monument (United States)|national monuments]] during his presidency and expand four others, protecting a total of {{convert|553000000|acre|ha}} of federal lands and waters, more than any other U.S. president.<ref name="Monuments">{{cite news |first1=Juliet |last1=Eilperin |first2=Brady |last2=Dennis |url=https://www.washingtonpost.com/national/health-science/with-new-monuments-in-nevada-utah-obama-adds-to-his-environmental-legacy/2016/12/28/e9833f62-c471-11e6-8422-eac61c0ef74d_story.html |title=With new monuments in Nevada, Utah, Obama adds to his environmental legacy |newspaper=The Washington Post |date=December 28, 2016 }}</ref><ref>{{cite news |url=https://www.nytimes.com/2016/12/31/opinion/sunday/monuments-man.html |archive-url=https://web.archive.org/web/20170101053919/http://www.nytimes.com/2016/12/31/opinion/sunday/monuments-man.html |archive-date=January 1, 2017 |url-access=subscription |url-status=live |title=Monuments Man |newspaper=The New York Times |date=December 31, 2016 }}</ref><ref>{{cite news |url=https://www.npr.org/2016/12/29/507436648/obama-s-newly-designated-national-monuments-upset-some-lawmakers-and-constituent |title=Obama's Newly Designated National Monuments Upset Some Lawmakers |publisher=NPR |work=[[All Things Considered]] |date=December 29, 2016 }}</ref><ref>{{cite news |first=Amy R. |last=Connolly |url=https://www.upi.com/Top_News/US/2016/02/13/Obama-expands-public-lands-more-than-any-US-president/1161455298784/ |title=Obama expands public lands more than any U.S. president |work=[[United Press International]] |date=February 13, 2016 }}</ref>
====Health care reform====
{{Main|Healthcare reform in the United States}}
[[File:Obama signs health care-20100323.jpg|thumb|alt=Photograph|Obama signs the Patient Protection and Affordable Care Act at the White House, March 23, 2010.]]
Obama called for [[United States Congress|Congress]] to pass legislation reforming [[health care in the United States]], a key campaign promise and a top legislative goal.<ref name="health reform" /> He proposed an expansion of health insurance coverage to cover the uninsured, cap premium increases, and allow people to retain their coverage when they leave or change jobs. His proposal was to spend $900{{nbs}}billion over ten years and include a government insurance plan, also known as the [[public health insurance option|public option]], to compete with the corporate insurance sector as a main component to lowering costs and improving quality of health care. It would also make it illegal for insurers to drop sick people or deny them coverage for [[pre-existing condition]]s, and require every American to carry health coverage. The plan also includes medical spending cuts and taxes on insurance companies that offer expensive plans.<ref>{{cite news |url=https://www.nytimes.com/2009/09/10/us/politics/10obama.html |archive-url=https://web.archive.org/web/20090912093912/http://www.nytimes.com/2009/09/10/us/politics/10obama.html |archive-date=September 12, 2009 |url-access=subscription |url-status=live |title = Obama, Armed With Details, Says Health Plan Is Necessary |last1 = Stolberg |first1 = Sheryl Gay |last2 = Zeleny |first2 = Jeff |date = September 9, 2009 |newspaper = The New York Times |access-date = July 5, 2015 }}</ref><ref>{{cite news |first = Mike |last = Allen |url=http://www.politico.com/news/stories/0909/26907.html |title = Barack Obama will hedge on public option |work = [[Politico]] |access-date = July 5, 2015 |date = September 9, 2009 }}</ref>
[[File:PPACA Premium Chart.jpg|thumb|upright=1.35|left|Maximum Out-of-Pocket Premium as Percentage of Family Income and [[federal poverty level]], under [[Patient Protection and Affordable Care Act]], starting in 2014 (Source: [[Congressional Research Service|CRS]])<ref>{{cite web |url=https://www.fas.org/sgp/crs/misc/R41137.pdf |title = Health Insurance Premium Credits in the PPACA |publisher = Congressional Research Service |access-date = May 17, 2015 }}</ref>]]
On July 14, 2009, House Democratic leaders introduced a 1,017-page plan for overhauling the U.S. health care system, which Obama wanted Congress to approve by the end of 2009.<ref name="health reform">{{cite news|url=http://blogs.suntimes.com/sweet/2009/07/obama_july_22_2009_press_confe.html |title=Obama July 22, 2009 press conference. Transcript |work=[[Chicago Sun-Times]] |date=July 22, 2009 |access-date=July 5, 2015 |first=Lynn |last=Sweet |url-status=dead |archive-url=https://web.archive.org/web/20150416063154/http://blogs.suntimes.com/sweet/2009/07/obama_july_22_2009_press_confe.html |archive-date=April 16, 2015 }}</ref> After public debate during the Congressional summer recess of 2009, Obama delivered [[Barack Obama speech to joint session of Congress, September 2009|a speech to a joint session of Congress]] on September 9 where he addressed concerns over the proposals.<ref>{{cite news |url=http://www.cnn.com/2009/POLITICS/09/09/obama.speech/index.html |title = Obama calls for Congress to face health care challenge |date = September 9, 2009 |access-date = September 9, 2009 |publisher = CNN |archive-url=https://web.archive.org/web/20090910083332/http://www.cnn.com/2009/POLITICS/09/09/obama.speech/index.html |archive-date = September 10, 2009 |url-status=live }}</ref> In March 2009, Obama lifted a ban on using federal funds for stem cell research.<ref>{{Cite news |url=https://www.theguardian.com/world/2009/mar/10/obama-stem-cell-research |title = Stem cell |first = Daniel |last = Nasaw |newspaper = The Guardian |access-date = September 13, 2014 |date = March 10, 2009 }}</ref>
On November 7, 2009, a health care bill featuring the public option was passed in the House.<ref name="nyt1">{{cite news |url=https://www.nytimes.com/2009/11/08/health/policy/08health.html |title = Sweeping Health Care Plan Passes House |last1 = Hulse |first1 = Carl |first2 = Robert |last2 = Pear |date = November 7, 2009 |work = The New York Times |access-date = November 8, 2009 |archive-url=https://web.archive.org/web/20110331033230/http://www.nytimes.com/2009/11/08/health/policy/08health.html|archive-date=March 31, 2011 |url-status=live }}</ref><ref name="nyt">{{cite news |url=https://www.nytimes.com/2009/11/08/health/policy/08scene.html |title = Abortion Was at Heart of Wrangling |last1 = Herszenhorn |first1 = David M. |first2 = Jackie |last2 = Calmes |date = December 7, 2009 |work = The New York Times |access-date = December 6, 2009 |archive-url=https://web.archive.org/web/20110331073732/http://www.nytimes.com/2009/11/08/health/policy/08scene.html|archive-date=March 31, 2011 |url-status=live }}</ref> On December 24, 2009, the Senate passed its own bill—without a public option—on a party-line vote of 60–39.<ref>{{cite news |url=https://www.npr.org/templates/story/story.php?storyId=121854289 |title = Senate Says Yes To Landmark Health Bill |author = Hensley, Scott |date = December 24, 2009 |access-date = December 24, 2009 |publisher = [[NPR]] |archive-url=https://web.archive.org/web/20100121191700/http://www.npr.org/templates/story/story.php?storyId=121854289 |archive-date = January 21, 2010 |url-status=live }}</ref> On March 21, 2010, the [[Patient Protection and Affordable Care Act]] (ACA) passed by the Senate in December was passed in the House by a vote of 219 to 212.<ref>{{cite news |url=https://www.nytimes.com/2010/03/22/opinion/22mon5.html |title = Health Care Reform, at Last |newspaper = The New York Times |date = March 21, 2010 |access-date = March 22, 2010 |archive-url=https://web.archive.org/web/20100326095847/http://www.nytimes.com/2010/03/22/opinion/22mon5.html |archive-date = March 26, 2010 }}</ref> Obama signed the bill into law on March 23, 2010.<ref>{{cite news |url=https://www.nytimes.com/2010/03/24/health/policy/24health.html |title = Obama Signs Landmark Health Care Bill |date = March 23, 2010 |access-date = March 23, 2010 |newspaper = The New York Times |author = Gay Stolberg, Sheryl |archive-url=https://web.archive.org/web/20100325033529/http://www.nytimes.com/2010/03/24/health/policy/24health.html |archive-date = March 25, 2010 }}</ref>
The ACA includes [[Provisions of the Patient Protection and Affordable Care Act|health-related provisions]], most of which took effect in 2014, including expanding [[Medicaid]] eligibility for people making up to 133 percent{{nbs}}of the [[federal poverty level]] (FPL) starting in 2014,<ref name="cnn_ref1">{{cite news |last = Rice |first = Sabriya |url=http://www.cnn.com/2010/HEALTH/03/25/health.care.law.basics/index.html |title = 5 key things to remember about health care reform |publisher = CNN |date = March 25, 2010 |access-date = January 6, 2013 }}</ref> subsidizing insurance premiums for people making up to 400 percent{{nbs}}of the FPL ($88,000 for family of four in 2010) so their maximum "out-of-pocket" payment for annual premiums will be from 2 percent to 9.5 percent of income,<ref name="whitehouse" /><ref>{{cite news |last = Grier |first = Peter |url=http://www.csmonitor.com/USA/Politics/2010/0320/Health-care-reform-bill-101-Who-gets-subsidized-insurance |date = March 20, 2010 |title = Health Care Reform Bill 101 |newspaper = [[The Christian Science Monitor]] |access-date = July 5, 2015 }}</ref> providing incentives for businesses to provide health care benefits, prohibiting denial of coverage and denial of claims based on pre-existing conditions, establishing [[health insurance exchange]]s, prohibiting annual coverage caps, and support for medical research. According to White House and CBO figures, the maximum share of income that enrollees would have to pay would vary depending on their income relative to the federal poverty level.<ref name="whitehouse">{{cite web |url=https://obamawhitehouse.archives.gov/health-care-meeting/proposal/whatsnew/affordability |work= [[whitehouse.gov]] |title = Policies to Improve Affordability and Accountability |via= [[NARA|National Archives]] |access-date = January 6, 2013}}</ref><ref name="cbo_est">{{cite web |last = Elmendorf |first = Douglas W. |url=http://www.cbo.gov/sites/default/files/cbofiles/ftpdocs/107xx/doc10781/11-30-premiums.pdf |title = An Analysis of Health Insurance Premiums Under the Patient Protection and Affordable Care Act |publisher = Congressional Budget Office |date = November 30, 2009 |access-date = April 9, 2012 }}</ref>
[[File:Percentage of Individuals in the United States Without Health Insurance, 1963-2015.png|thumb|Percentage of Individuals in the United States without Health Insurance, 1963–2015 (Source: [[JAMA (journal)|JAMA]])<ref>{{cite journal|last1=Obama|first1=Barack|title=United States Health Care Reform|journal=JAMA|date=August 2, 2016|volume=316|issue=5|pages=525–532|doi=10.1001/jama.2016.9797|pmid=27400401|issn=0098-7484|pmc=5069435}}</ref>]]
The costs of these provisions are offset by taxes, fees, and cost-saving measures, such as new Medicare taxes for those in high-income [[tax bracket|brackets]], taxes on [[indoor tanning]], cuts to the [[Medicare Advantage]] program in favor of traditional Medicare, and fees on medical devices and pharmaceutical companies;<ref>{{Cite journal |last = Grier |first = Peter |date = March 21, 2010 |url=http://www.csmonitor.com/USA/Politics/2010/0321/Health-care-reform-bill-101-Who-will-pay-for-reform |title = Health care reform bill 101: Who will pay for reform? |journal = Christian Science Monitor |access-date = July 5, 2015 }}</ref> there is also a tax penalty for those who do not obtain health insurance, unless they are exempt due to low income or other reasons.<ref>{{cite news |url=http://www.csmonitor.com/USA/Politics/2010/0319/Health-care-reform-bill-101-Who-must-buy-insurance |title = Health care reform bill 101: Who must buy insurance? |last = Grier |first = Peter |date = March 19, 2010 |work = [[The Christian Science Monitor]] |access-date = April 7, 2010 |archive-url=https://web.archive.org/web/20100405075157/http://www.csmonitor.com/USA/Politics/2010/0319/Health-care-reform-bill-101-Who-must-buy-insurance |archive-date = April 5, 2010 }}</ref> In March 2010, the CBO estimated that the net effect of both laws will be a reduction in the federal deficit by $143{{nbs}}billion over the first decade.<ref>{{cite web |last = Elmendorf |first = Douglas W. |title = H.R. 4872, Reconciliation Act of 2010 (Final Health Care Legislation) |date = March 20, 2010 |url=http://www.cbo.gov/publication/21351 |publisher = Congressional Budget Office |access-date = January 6, 2013 }}</ref>
The law faced several legal challenges, primarily based on the argument that an individual mandate requiring Americans to buy health insurance was unconstitutional. On June 28, 2012, the Supreme Court ruled by a 5–4 vote in ''[[National Federation of Independent Business v. Sebelius]]'' that the mandate was constitutional under the U.S. Congress's taxing authority.<ref name="WP-uphold">{{cite news |first = Robert |last = Barnes |url=https://www.washingtonpost.com/politics/supreme-court-to-rule-thursday-on-health-care-law/2012/06/28/gJQAarRm8V_story.html |title = Supreme Court upholds Obama health care overhaul by 5–4 vote, approving insurance requirement |date = June 28, 2012 |newspaper = The Washington Post |agency = Associated Press |access-date = June 29, 2012 }}</ref> In ''[[Burwell v. Hobby Lobby Stores, Inc.|Burwell v. Hobby Lobby]]'' the Court ruled that "closely-held" for-profit corporations could be exempt on religious grounds under the [[Religious Freedom Restoration Act]] from regulations adopted under the ACA that would have required them to pay for insurance that covered certain contraceptives. In June 2015, the Court ruled 6–3 in ''[[King v. Burwell]]'' that subsidies to help individuals and families purchase health insurance were authorized for those doing so on both the federal exchange and state exchanges, not only those purchasing plans "established by the State", as the statute reads.<ref>{{cite news|url=https://www.usnews.com/news/articles/2015/06/25/supreme-court-upholds-obamacare-subsidies-in-king-v-burwell |title=Supreme Court Upholds Obamacare Subsidies |first=Kimberly |last=Leonard |work=[[U.S. News & World Report]] |access-date=November 25, 2015 |url-status=dead |archive-url=https://web.archive.org/web/20160116072123/http://www.usnews.com/news/articles/2015/06/25/supreme-court-upholds-obamacare-subsidies-in-king-v-burwell |archive-date=January 16, 2016 }}</ref>
===Foreign policy===
{{Main|Foreign policy of the Barack Obama administration}}
[[File:P06409PS-0571 (3594694537).jpg|June 4, 2009 − after his speech ''[[A New Beginning (speech)|A New Beginning]]'' at [[Cairo University]], U.S. President Obama participates in a roundtable interview in 2009 with among others [[Jamal Khashoggi]], [[Bambang Harymurti]] and [[Nahum Barnea]].|thumb|right]]
[[File:Barack Obama meets Stephen Harper.jpg|thumb|left|Obama meets with Canadian Prime Minister [[Stephen Harper]] in Ottawa, February 19, 2009.]]
In February and March 2009, Vice President Joe Biden and [[United States Secretary of State|Secretary of State]] Hillary Clinton made separate overseas trips to announce a "new era" in U.S. foreign relations with Russia and Europe, using the terms "break" and "[[Russian reset|reset]]" to signal major changes from the policies of the preceding administration.<ref name="preceding administration" /> Obama attempted to reach out to Arab leaders by granting his first interview to an Arab satellite TV network, [[Al Arabiya]].<ref>{{cite news |title = Obama reaches out to Muslim world on TV |work = NBC News |url=https://www.nbcnews.com/id/28869185 |access-date = June 15, 2009 |date = January 27, 2009 }}</ref> On March 19, Obama continued his outreach to the Muslim world, releasing a New Year's video message to the people and government of Iran.<ref>{{cite news |url=https://www.theguardian.com/world/2009/mar/20/barack-obama-usa |title = Barack Obama's address to Iran: Full text of Barack Obama's videotaped message to the people and leaders of Iran as they celebrate their New Year's holiday, Nowruz |date = March 20, 2013 |access-date = July 14, 2013 |work = [[The Guardian]] |location = London }}</ref><ref>{{cite news |first = Karen |last = DeYoung |title = Nation U.S. to Join Talks on Iran's Nuclear Program |date = April 9, 2009 |newspaper = The Washington Post |url=https://www.washingtonpost.com/wp-dyn/content/article/2009/04/08/AR2009040802254.html |access-date = June 15, 2009 }}</ref> On June 4, 2009, Obama delivered a speech at [[Cairo University]] in Egypt calling for "[[A New Beginning (speech)|A New Beginning]]" in relations between the Islamic world and the United States and promoting Middle East peace.<ref name="middleeast" /> On June 26, 2009, Obama condemned the Iranian government's actions towards protesters following [[2009 Iranian presidential election|Iran's 2009 presidential election]].<ref>{{cite news |url=http://www.washingtontimes.com/news/2009/jun/26/obama-dismisses-ahmadinejad-apology-request/ |title = Obama dismisses Ahmadinejad apology request |work = The Washington Times |date = June 26, 2009 |access-date = July 2, 2015 |first1 = Joseph |last1 = Weber |first2 = Stephen |last2 = Dinan }}</ref>
In 2011, Obama ordered a drone strike in Yemen which targeted and killed [[Anwar al-Awlaki]]. Awlaki was an American imam suspected of being an [[Al-Qaeda]] organizer and supporter. Awlaki became the first [[Citizenship of the United States|U.S. citizen]] to be targeted and killed by a [[Drone strike|U.S. drone strike]] without the rights of [[due process]] being afforded. The killing lead to significant controversy and may have increased Awlaki's influence. His [[Abdulrahman al-Awlaki|teenage son]] and [[Death of Nawar al-Awlaki|young daughter]], also Americans, were later killed in separate [[Raid on Yakla|US military actions]], although they were not targeted specifically.<ref>{{Cite news|last=Shane|first=Scott|date=August 27, 2015|title=The Lessons of Anwar al-Awlaki|language=en-US|work=The New York Times|url=https://www.nytimes.com/2015/08/30/magazine/the-lessons-of-anwar-al-awlaki.html |archive-url=https://web.archive.org/web/20150827141921/http://www.nytimes.com/2015/08/30/magazine/the-lessons-of-anwar-al-awlaki.html |archive-date=August 27, 2015 |url-access=subscription |url-status=live|access-date=December 7, 2021|issn=0362-4331}}</ref><ref>{{Cite web|last=Lauter|first=David|date=June 24, 2014|title=Memo justifying drone killing of American Al Qaeda leader is released|url=https://www.latimes.com/nation/nationnow/la-na-nn-drone-memo-awlaki-20140623-story.html|access-date=December 7, 2021|website=Los Angeles Times|language=en-US}}</ref>
[[File:Barack Obama and Matteo Renzi October 2016, 1.jpg|thumb|Obama meets with Italian Prime Minister [[Matteo Renzi]] at the [[White House]], October 2016.]]In March 2015, Obama declared that he had authorized U.S. forces to provide logistical and intelligence support to the Saudis in their [[Saudi Arabian-led intervention in Yemen|military intervention in Yemen]], establishing a "Joint Planning Cell" with Saudi Arabia.<ref>{{cite news|url=https://www.washingtonpost.com/world/middle_east/report-yemens-embattled-president-flees-stronghold-as-rebels-advance/2015/03/25/e0913ae2-d2d5-11e4-a62f-ee745911a4ff_story.html|title= Saudi Arabia launces air attacks in Yemen| newspaper=The Washington Post|date=March 25, 2015}}</ref><ref>{{cite news |title=Yemen conflict: US 'could be implicated in war crimes' |url=https://www.bbc.com/news/world-middle-east-37607248 |work=BBC News |date=October 10, 2016}}</ref> In 2016, the Obama administration proposed a series of [[Saudi Arabia–United States relations|arms deals with Saudi Arabia]] worth $115{{nbs}}billion.<ref>{{Cite news | last=Bayoumy | first=Yara | title=Obama administration arms sales offers to Saudi top $115 billion: ... | work=Reuters | date=September 7, 2016 |url=https://www.reuters.com/article/us-usa-saudi-security/obama-administration-arms-sales-offers-to-saudi-top-115-billion-report-idUSKCN11D2JQ }}</ref> Obama halted the sale of guided munition technology to [[Saudi Arabia]] after Saudi warplanes [[2016 Sana'a funeral airstrike|targeted a funeral]] in Yemen's capital Sanaa, killing more than 140 people.<ref>{{cite news |url=https://www.independent.co.uk/news/world/americas/us-saudi-arabia-yemen-war-support-military-houthis-bombing-campaign-crisis-a7472546.html |title=America 'agrees to stop selling some arms' to Saudi Arabia |work=The Independent |date=December 13, 2016 |archive-url=https://web.archive.org/web/20190401180257/https://www.independent.co.uk/news/world/americas/us-saudi-arabia-yemen-war-support-military-houthis-bombing-campaign-crisis-a7472546.html|archive-date=April 1, 2019 |first1=Phil |last1=Stewart |first2=Warren |last2=Strobel }}</ref>
====War in Iraq====
{{Main|Iraq War|American-led intervention in Iraq (2014–present)}}
On February 27, 2009, Obama announced that combat operations in Iraq would end within 18 months.<ref>{{cite news |agency = [[Associated Press]] |first = Ben |last = Feller |url = http://gazette.com/obama-sets-firm-withdrawal-timetable-for-iraq/article/49026 |title = Obama sets firm withdrawal timetable for Iraq |work = [[The Gazette (Colorado Springs)|The Gazette]] |date = February 27, 2009 |access-date = March 3, 2009 |archive-date = February 7, 2017 |archive-url = https://web.archive.org/web/20170207113330/http://gazette.com/obama-sets-firm-withdrawal-timetable-for-iraq/article/49026 |url-status = dead }}</ref> The Obama administration scheduled the withdrawal of combat troops to be completed by August 2010, decreasing troop's levels from 142,000 while leaving a transitional force of about 50,000 in Iraq until the end of 2011. On August 19, 2010, the last U.S. combat brigade exited Iraq. Remaining troops transitioned from combat operations to [[counter-terrorism]] and the training, equipping, and advising of Iraqi security forces.<ref>{{cite news |last = Jones |first = Athena |date = February 27, 2009 |url=http://firstread.nbcnews.com/_news/2009/02/27/4428005-obama-announces-iraq-plan |title = Obama announces Iraq plan |publisher = MSNBC |access-date = July 2, 2015 }}</ref><ref>{{cite news |author = Sykes, Hugh |url=https://www.bbc.co.uk/news/world-middle-east-11020270 |title = Last US combat brigade exits Iraq |work = BBC News |date = August 19, 2010 |access-date = December 25, 2012 }}</ref> On August 31, 2010, Obama announced that the United States combat mission in Iraq was over.<ref>{{cite news |url=https://www.theguardian.com/world/2010/sep/01/obama-formally-ends-iraq-war |place = London |work = The Guardian |title = Barack Obama ends the war in Iraq. 'Now it's time to turn the page' |first = Ewen |last = MacAskill |date = September 1, 2010 }}</ref> On October 21, 2011, President Obama announced that all U.S. troops would leave Iraq in time to be "home for the holidays."<ref>{{cite news |url=https://www.nbcnews.com/id/44990594 |title = All U.S. troops out of Iraq by end of year |work = NBC News |date = October 21, 2011 |access-date = December 25, 2012 }}</ref>
[[File:David Cameron and Barack Obama at the G20 Summit in Toronto.jpg|thumb|Meeting with UK Prime Minister [[David Cameron]] during the [[2010 G20 Toronto summit]]|alt=US President Barack Obama and British Prime Minister David Cameron trade bottles of beer to settle a bet they made on the U.S. vs. England World Cup Soccer game (which ended in a tie), during a bilateral meeting at the G20 Summit in Toronto, Canada, Saturday, June 26, 2010.]]
In June 2014, following the [[Northern Iraq offensive (June 2014)#Fall of Mosul and push into Kirkuk|capture of Mosul]] by [[Islamic State of Iraq and the Levant|ISIS]], Obama sent 275 troops to provide support and security for U.S. personnel and the U.S. Embassy in Baghdad. ISIS continued to gain ground and to commit [[Islamic State of Iraq and the Levant#Human rights abuse and war crime findings|widespread massacres and ethnic cleansing]].<ref>{{cite news |url=http://www.businessinsider.com/obama-is-sending-275-us-troops-to-iraq-2014-6 |title = Obama Is Sending 275 US Troops To Iraq |work = Business Insider |access-date = June 19, 2014 }}</ref><ref>{{Cite news |url=https://www.reuters.com/article/us-un-rights-idUSKBN0H30KB20140908 |title = New U.N. rights boss warns of 'house of blood' in Iraq, Syria |access-date = July 11, 2015 |last = Nebehay |first = Stephanie |work = Reuters |date = September 8, 2014 }}</ref> In August 2014, during the [[Sinjar massacre]], Obama ordered a [[American-led intervention in Iraq (2014–present)#United States airstrikes|campaign of U.S. airstrikes against ISIS]].<ref name="def31-10-14">{{cite web |url=http://www.defense.gov/news/newsarticle.aspx?id=123542 |title = DoD Authorizes War on Terror Award for Inherent Resolve Ops |date = October 31, 2014 |publisher = Defense.gov |access-date = November 22, 2014 }}</ref> By the end of 2014, 3,100 American ground troops were committed to the conflict<ref>{{Cite news |url=https://www.bbc.com/news/world-middle-east-30388718 |title = Islamic State: Coalition 'pledges more troops' for Iraq |work = BBC News |access-date = August 23, 2015 |date = December 8, 2014 }}</ref> and 16,000 sorties were flown over the battlefield, primarily by U.S. Air Force and Navy pilots.<ref>{{cite news |url=http://www.defensenews.com/story/defense/2015/01/19/a10-strikes-isis-11-percent/21875911/ |title = A-10 Performing 11 Percent of Anti-ISIS Sorties |last = Mehta |first = Aaron |date = January 19, 2015 |work = [[Defense News]] |access-date = August 23, 2015 }}</ref> In early 2015, with the addition of the "Panther Brigade" of the [[82nd Airborne Division]] the number of U.S. ground troops in Iraq increased to 4,400,<ref>{{cite news |url=http://www.stripes.com/news/us/1-000-soldiers-from-the-82nd-airborne-headed-to-iraq-1.320194 |title = 1,000 soldiers from the 82nd Airborne headed to Iraq |work=[[Stars and Stripes (newspaper)|Stars and Stripes]] |access-date = August 23, 2015 }}</ref> and by July American-led coalition air forces counted 44,000 sorties over the battlefield.<ref>{{cite news|url=https://www.usnews.com/news/politics/articles/2015/07/21/stealthy-jet-ensures-other-war-fighting-aircraft-survive |title=Stealthy Jet Ensures Other War-Fighting Aircraft Survive |work=[[U.S. News & World Report]] |access-date=August 23, 2015 |url-status=dead |archive-url=https://web.archive.org/web/20150813053355/http://www.usnews.com/news/politics/articles/2015/07/21/stealthy-jet-ensures-other-war-fighting-aircraft-survive |archive-date=August 13, 2015 }}</ref>
====War in Afghanistan====
{{Main|War in Afghanistan (2001–2021)}}
[[File:Barack Obama, Hamid Karzai & Asif Ali Zardari after trilateral meeting 5-6-09 1.jpg|thumb|Obama after a trilateral meeting with Afghan President [[Hamid Karzai]] (left) and Pakistani President [[Asif Ali Zardari]] (right), White House Cabinet Room, May 2009]]
Early in his presidency, Obama moved to bolster U.S. troop strength in Afghanistan.<ref name="autogenerated1">{{cite news |work = NewsHour with Jim Lehrer |url=https://www.pbs.org/newshour/bb/politics/july-dec08/obama_07-15.html |title = Obama Calls for U.S. Military to Renew Focus on Afghanistan |publisher = PBS |date = July 15, 2008 |access-date = April 18, 2010 |archive-url=https://web.archive.org/web/20100327094906/http://www.pbs.org/newshour/bb/politics/july-dec08/obama_07-15.html |archive-date = March 27, 2010 }}</ref> He announced an increase in U.S. troop levels to 17,000 military personnel in February 2009 to "stabilize a deteriorating situation in Afghanistan", an area he said had not received the "strategic attention, direction and resources it urgently requires".<ref>{{cite news |first = Amanda |last = Hodge |title = Obama launches Afghanistan Surge |date = February 19, 2009 |work = The Australian |location = Sydney |url=http://www.theaustralian.com.au/archive/news/obama-launches-afghanistan-surge/story-e6frg6t6-1111118893671 }}</ref> He replaced the military commander in Afghanistan, General [[David D. McKiernan]], with former [[Special Forces (United States Army)|Special Forces]] commander Lt. Gen. [[Stanley A. McChrystal]] in May 2009, indicating that McChrystal's Special Forces experience would facilitate the use of counterinsurgency tactics in the war.<ref name="counterinsurgency tactics" /> On December 1, 2009, Obama announced the deployment of an additional 30,000 military personnel to Afghanistan and proposed to begin troop withdrawals 18 months from that date;<ref>{{cite news |agency=Associated Press |date=December 1, 2009 |url=https://www.nbcnews.com/id/34218604 |title=Obama details Afghan war plan, troop increases |work=NBC News }}</ref> this took place in July 2011. [[David Petraeus]] replaced McChrystal in June 2010, after McChrystal's staff criticized White House personnel in a magazine article.<ref>{{cite news |url=http://www.cnn.com/2010/POLITICS/06/24/mcchrystal.gates.support/ |title = Gates says he agrees with Obama decision on McChrystal |publisher = CNN |date = June 24, 2010 |access-date = September 18, 2010 }}</ref> In February 2013, Obama said the U.S. military would reduce the troop level in Afghanistan from 68,000 to 34,000 U.S. troops by February 2014.<ref>{{cite news |last = Chandrasekaran |first = Rajiv |title = Obama wants to cut troop level in Afghanistan in half over next year |url=https://www.washingtonpost.com/world/national-security/official-obama-to-cut-troop-level-in-afghanistan-in-half-by-next-year/2013/02/12/63a044c8-7536-11e2-8f84-3e4b513b1a13_story.html |access-date = February 14, 2013 |newspaper = The Washington Post |date = February 12, 2013 }}</ref> In October 2015, the White House announced a plan to keep U.S. Forces in Afghanistan indefinitely in light of the deteriorating security situation.<ref>{{Cite news |url=https://www.bbc.com/news/world-us-canada-34536833 |title = US troops in Afghanistan: Taliban resurgence sees rethink |work = BBC News |date = October 15, 2015 |access-date = October 15, 2015 |last = Marcus |first = Jonathan }}</ref>
====Israel====
[[File:Barack Obama welcomes Shimon Peres in the Oval Office.jpg|thumb|Obama meeting with Israeli President [[Shimon Peres]] in the [[Oval Office]], May 2009|alt=President Barack Obama, at left, shakes hands with Israeli President Shimon Peres, at right, in the Oval Office on Tuesday, May 5, 2009. Standing at right looking on is U.S. Vice President Joe Biden.]]
During the initial years of the Obama administration, the U.S. increased military cooperation with Israel, including increased military aid, re-establishment of the [[Joint Political Military Group|U.S.-Israeli Joint Political Military Group]] and the Defense Policy Advisory Group, and an increase in visits among high-level military officials of both countries.<ref>{{cite news |last=Levinson |first=Charles |date=August 14, 2010 |url=https://www.wsj.com/articles/SB10001424052748703321004575427272550050504 |title=U.S., Israel Build Military Cooperation |newspaper=[[The Wall Street Journal]] |location=New York |access-date=March 1, 2011 }}</ref> The Obama administration asked Congress to allocate money toward funding the [[Iron Dome]] program in response to the waves of [[Palestinian rocket attacks on Israel]].<ref>{{cite news |last=Kampeas |first=Ron |date=October 26, 2012 |url=http://www.jewishjournal.com/nation/article/for_obama_campaign_trying_to_put_to_rest_persistent_questions_about_kishkes |title=For Obama campaign, trying to put to rest persistent questions about 'kishkes' |newspaper=Jewish Journal}}</ref> In March 2010, Obama took a public stance against plans by the government of Israeli Prime Minister [[Benjamin Netanyahu]] to continue building Jewish housing projects in predominantly Arab neighborhoods of [[East Jerusalem]].<ref>{{cite news |url=http://www1.voanews.com/english/news/Netanyahus-Office-No-Change-on-East-Jerusalem-Plans-89258402.html |title = Israel Refuses to Halt Construction in East Jerusalem |publisher = [[Voice of America]] |date = March 25, 2010 |access-date = July 2, 2015 |first = Robert |last = Berger }}</ref><ref>{{cite news |url=https://www.nytimes.com/2010/03/25/world/middleeast/25jerusalem.html |title = Israel Confirms New Building in East Jerusalem |work = The New York Times |date = March 24, 2010 |first = Isabel |last = Kershner |access-date = April 26, 2010 |archive-url=https://web.archive.org/web/20100329231159/http://www.nytimes.com/2010/03/25/world/middleeast/25jerusalem.html |archive-date = March 29, 2010 |url-status=live }}</ref> In 2011, the United States vetoed a Security Council resolution condemning [[Israeli settlement]]s, with the United States being the only nation to do so.<ref>{{cite web |url=https://www.un.org/apps/news/story.asp?NewsID=37572&Cr=palestin&Cr1 |title = United States vetoes Security Council resolution on Israeli settlements |date = February 18, 2011 |website = UN News Service Section |access-date = September 13, 2014 }}</ref> Obama supports the [[two-state solution]] to the [[Arab–Israeli conflict]] based on the 1967 borders with land swaps.<ref>{{cite news |last=Levy |first=Elior |date=May 22, 2011 |url=https://www.ynetnews.com/articles/0,7340,L-4072210,00.html |title=PA challenges Netanyahu to accept 1967 lines |work=Ynetnews |access-date=May 22, 2011 }}</ref>
In 2013, [[Jeffrey Goldberg]] reported that, in Obama's view, "with each new settlement announcement, Netanyahu is moving his country down a path toward near-total isolation."<ref name="Bloomberg">{{cite news |last = Goldberg |first = Jeffrey |title = Obama: 'Israel Doesn't Know What Its Best Interests Are' |url=https://www.bloomberg.com/news/2013-01-14/what-obama-thinks-israelis-don-t-understand-.html |access-date = January 23, 2013 |work = Bloomberg |date = January 14, 2013 }}</ref> In 2014, Obama likened the [[Zionist movement]] to the [[civil rights movement]] in the United States. He said both movements seek to bring justice and equal rights to historically persecuted peoples, explaining: "To me, being pro-Israel and pro-Jewish is part and parcel with the values that I've been fighting for since I was politically conscious and started getting involved in politics."<ref>{{cite news |last=Goldberg |first=Jeffrey |url=https://www.theatlantic.com/international/archive/2015/09/obama-netanyahu-and-the-future-of-israel/405082/ |title=After the Iran Deal: Obama, Netanyahu, and the Future of the Jewish State |work=The Atlantic |date=September 13, 2015 |access-date=September 13, 2015 }}</ref> Obama expressed support for Israel's right to defend itself during the [[2014 Israel–Gaza conflict]].<ref>{{cite news |title = Obama reaffirms Israel's right to defend itself |first=Herb|last=Keinon|url=http://www.jpost.com/Operation-Protective-Edge/Netanyahu-speaks-with-UN-chief-over-phone-363479 |date = July 19, 2014 | work= [[The Times of Israel]] }}</ref> In 2015, Obama was harshly criticized by Israel for advocating and signing the [[Joint Comprehensive Plan of Action|Iran Nuclear Deal]]; Israeli Prime Minister [[Benjamin Netanyahu]], who had advocated the U.S. congress to oppose it, said the deal was "dangerous" and "bad".<ref>{{Cite news | title=Netanyahu: Iran nuclear deal makes world much more dangerous, Israel not bound by it | newspaper=[[Haaretz]] | date=July 14, 2015 |url=https://www.haaretz.com/news/diplomacy-defense/1.665821 | access-date=January 3, 2018}}</ref>
On December 23, 2016, under the Obama Administration, the United States abstained from [[United Nations Security Council Resolution 2334]], which condemned [[Israeli settlement]] building in the occupied [[Palestinian territories]] as a violation of international law, effectively allowing it to pass.<ref>{{cite news | last1=Collinson | first1=Stephen | last2=Wright | first2=David | last3=Labott | first3=Elise | title=US Abstains as UN Demands End to Israeli Settlements |url=http://www.cnn.com/2016/12/23/politics/israel-official-rips-obama-un-settlements/ | date=December 24, 2016 | work=CNN | access-date=January 7, 2017}}</ref> Netanyahu strongly criticized the Obama administration's actions,<ref>{{Cite news | last1=Barak | first1=Ravid | title=Netanyahu on UN Settlement Vote: Israel Will Not Turn the Other Cheek |url=http://www.haaretz.com/israel-news/1.761470 | date=December 26, 2016 | newspaper=[[Haaretz]] | access-date=January 7, 2017}}</ref><ref>{{Cite news | title=Israel-Palestinians: Netanyahu Condemns John Kerry Speech |url=https://www.bbc.com/news/world-us-canada-38455753 | date=December 29, 2016 | work=BBC News | access-date=January 7, 2017 }}</ref> and the Israeli government withdrew its annual dues from the organization, which totaled $6{{nbs}}million, on January 6, 2017.<ref>{{cite web | title=Israel Halts $6{{nbs}}million to UN to Protest UN Settlements Vote |url=http://www.foxnews.com/world/2017/01/06/israel-halts-6-million-to-un-to-protest-un-settlements-vote.html | date=January 6, 2017 | publisher=[[Fox News]] (from the [[Associated Press]]) | access-date=January 7, 2017}}</ref> On January 5, 2017, the [[United States House of Representatives]] voted 342–80 to condemn the UN Resolution.<ref>{{cite news | title=House Overwhelmingly Votes to Condemn UN Resolution on Israel Settlements |url=http://www.foxnews.com/politics/2017/01/05/house-overwhelmingly-votes-to-condemn-un-resolution-on-israel-settlements.html | date=January 5, 2017 | publisher=[[Fox News]] | access-date=January 7, 2017}}</ref><ref>{{cite news | last1=Cortellessa | first1=Eric | title=US House Passes Motion Repudiating UN Resolution on Israel |url=http://www.timesofisrael.com/us-house-passes-repudiation-of-un-security-council-resolution-on-israel/ | date=January 6, 2017 | work=[[The Times of Israel]] | access-date=January 17, 2017}}</ref>
====Libya====
{{Main|2011 military intervention in Libya}}
[[File:Vladimir Putin and Barack Obama (2015-09-29) 04.jpg|thumb|President Obama meets with Russian President [[Vladimir Putin]] to discuss Syria and ISIS, September 29, 2015.]]
In February 2011, protests in Libya began against long-time dictator [[Muammar Gaddafi]] as part of the [[Arab Spring]]. They soon turned violent. In March, as forces loyal to Gaddafi advanced on rebels across Libya, calls for a no-fly zone came from around the world, including Europe, the [[Arab League]], and a resolution<ref>{{cite web |url=http://mccain.senate.gov/public/index.cfm?FuseAction=PressOffice.FloorStatements&ContentRecord_id=b63b7b6f-a466-ba23-dea8-7bc024f54655 |title = Floor Statement by Senator McCain Introducing the Senate Resolution Calling for a No-Fly Zone in Libya |publisher = Senate.gov |date = March 14, 2011 |access-date = March 28, 2011 }}</ref> passed unanimously by the U.S. Senate.<ref>{{cite news |url=http://nationaljournal.com/congress/senate-passes-resolution-calling-for-no-fly-zone-over-libya-20110301?page=1 |title = Senate Passes Resolution Calling for No-Fly Zone Over Libya |work = [[National Journal]] |date = March 1, 2011 |archive-url=https://web.archive.org/web/20110511121418/http://nationaljournal.com/congress/senate-passes-resolution-calling-for-no-fly-zone-over-libya-20110301?page=1 |archive-date = May 11, 2011 }}</ref> In response to the unanimous passage of [[United Nations Security Council Resolution 1973]] on March 17, Gaddafi—who had previously vowed to "show no mercy" to the rebels of Benghazi<ref>{{cite news |last = Winnett |first = Robert |url=https://www.telegraph.co.uk/news/worldnews/africaandindianocean/libya/8389565/Libya-UN-approves-no-fly-zone-as-British-troops-prepare-for-action.html |title = Libya: UN approves no-fly zone as British troops prepare for action |work = The Daily Telegraph |place = London |date = March 17, 2011 |archive-url=https://web.archive.org/web/20110428102507/http://www.telegraph.co.uk/news/worldnews/africaandindianocean/libya/8389565/Libya-UN-approves-no-fly-zone-as-British-troops-prepare-for-action.html |archive-date = April 28, 2011 }}</ref>—announced an immediate cessation of military activities.<ref>{{cite news |url=http://www.newstatesman.com/blogs/the-staggers/2011/03/fly-zone-ceasefire-libya |author = Shackle, Samira |title = Libya declares ceasefire |work = New Statesman blog |location = London |date = March 18, 2011 |access-date = July 16, 2011 }}</ref>
The next day, on Obama's orders, the U.S. military took part in air strikes to destroy the Libyan government's air defense capabilities to protect civilians and enforce a no-fly-zone,<ref>{{cite news |url=http://www.rttnews.com/Content/GeneralNews.aspx?Id=1580433&SM=1 |title = Obama: US to Transfer Lead Role in Libya |publisher = RTT Newswire |access-date = March 22, 2011 }}</ref> including the use of [[Tomahawk (missile)|Tomahawk missiles]], [[Northrop Grumman B-2 Spirit|B-2 Spirits]], and fighter jets.<ref>{{cite news|url=http://www.vcstar.com/news/2011/mar/23/ap-news-in-brief/ |title=Obama says US efforts in Libya have saved lives, control of operation can be turned over soon |work=[[Ventura County Star]] |agency=Associated Press |access-date=March 22, 2011 |url-status=dead |archive-url=https://web.archive.org/web/20110828104819/http://www.vcstar.com/news/2011/mar/23/ap-news-in-brief/ |archive-date=August 28, 2011 }}</ref><ref>{{cite news |author = Pannell, Ian |url=https://www.bbc.co.uk/news/world-africa-12813757 |title = Gaddafi 'not targeted' by allied strikes |work = BBC News |date = March 21, 2011 |access-date = July 3, 2011 |archive-url=https://web.archive.org/web/20110623012338/http://www.bbc.co.uk/news/world-africa-12813757 |archive-date = June 23, 2011 }}</ref><ref>{{cite news |url=https://www.theguardian.com/world/2011/mar/22/f15-fighter-crash-libya |title = F-15 fighter jet crashes in Libya |work = The Guardian |location = London |date = March 22, 2011 |access-date = March 23, 2011 |first = Sam |last = Jones |archive-url=https://web.archive.org/web/20110322190309/http://www.guardian.co.uk/world/2011/mar/22/f15-fighter-crash-libya |archive-date = March 22, 2011 |url-status=live }}</ref> Six days later, on March 25, by unanimous vote of all its 28 members, [[NATO]] took over leadership of the effort, dubbed [[Operation Unified Protector]].<ref name="NATOPressRelease">{{cite web |url=http://www.nato.int/nato_static/assets/pdf/pdf_2011_03/20110325_110325-unified-protector-no-fly-zone.pdf |title = NATO No-Fly Zone over Libya Operation UNIFIED PROTECTOR |publisher = NATO |date = March 25, 2011 }}</ref> Some Representatives<ref name="LibyaOffensive">{{cite news |url=https://www.cbsnews.com/news/is-obamas-libya-offensive-constitutional/ |title = Is Obama's Libya offensive constitutional? |work = CBS News |date = March 22, 2011 |access-date = March 22, 2011 |first = Brian |last = Montopoli }}</ref> questioned whether Obama had the constitutional authority to order military action in addition to questioning its cost, structure and aftermath.<ref>{{cite news |title = Obama's Libya Policy Makes Strange Bedfellows of Congressional Critics |url=https://www.huffingtonpost.com/2011/03/20/obama-libya_n_838219.html |work = The Huffington Post |access-date = March 26, 2011 |date = March 21, 2011 |first = Sam |last = Stein |archive-url=https://web.archive.org/web/20110323083100/http://www.huffingtonpost.com/2011/03/20/obama-libya_n_838219.html |archive-date = March 23, 2011 |url-status=live }}</ref><ref>{{cite news |title = Obama juggles Libya promises, realities |url=http://www.cnn.com/2011/POLITICS/03/25/obama.libya/index.html |publisher = CNN |access-date = March 26, 2011 |date = March 25, 2011 }}</ref> Obama later expressed regret for playing a leading role in the destabilization of Libya, calling the certain situation there "a mess."<ref>{{Cite web|first1=Allie|last1=Malloy|first2=Catherine|last2=Treyz|date=April 10, 2016|title=Obama admits worst mistake of his presidency — CNN Politics|url=https://www.cnn.com/2016/04/10/politics/obama-libya-biggest-mistake/index.html|access-date=April 24, 2021|website=CNN|language=en}}</ref> He has stated that the lack of preparation surrounding the days following the government's overthrow was the "worst mistake" of his presidency.<ref>{{Cite news|date=April 11, 2016|title=President Obama: Libya aftermath 'worst mistake' of presidency|language=en-GB|work=BBC News|url=https://www.bbc.com/news/world-us-canada-36013703|access-date=April 24, 2021}}</ref>
====Syrian Civil War====
{{See also|Foreign involvement in the Syrian Civil War#United States|American-led intervention in the Syrian Civil War}}
On August 18, 2011, several months after the start of the [[Syrian Civil War]], Obama issued a written statement that said: "The time has come for [[Bashar al-Assad|President Assad]] to step aside."<ref name=mustgo>{{cite news|title=Assad must go, Obama says|url=https://www.washingtonpost.com/politics/assad-must-go-obama-says/2011/08/18/gIQAelheOJ_story.html |access-date=November 23, 2015|newspaper=The Washington Post|date=August 18, 2011}}</ref><ref name=whstatem>{{cite web |url=https://obamawhitehouse.archives.gov/blog/2011/08/18/president-obama-future-syria-must-be-determined-its-people-president-bashar-al-assad |work=[[whitehouse.gov]] |title=President Obama: 'The future of Syria must be determined by its people, but President Bashar al-Assad is standing in their way.' |via=[[NARA|National Archives]] |date=August 18, 2011 }}</ref> This stance was reaffirmed in November 2015.<ref>{{cite news|url=https://www.wsj.com/articles/obama-says-syrian-leader-bashar-al-assad-must-go-1447925671|title=Obama Says Syrian Leader Bashar al-Assad Must Go|author=Nelson, Colleen}}</ref> In 2012, Obama authorized multiple [[Timber Sycamore|programs run by the CIA]] and the Pentagon to train anti-Assad rebels.<ref>{{Cite news|url=https://www.reuters.com/article/us-usa-syria-obama-order-idUSBRE8701OK20120802|author=Hosenball, Mark|title=Obama authorizes secret support for Syrian rebels|access-date=February 19, 2016|work=Reuters|date=August 2, 2012}}</ref> The Pentagon-run program was later found to have failed and was formally abandoned in October 2015.<ref>{{cite news|url=https://www.nytimes.com/2015/10/10/world/middleeast/pentagon-program-islamic-state-syria.html |archive-url=https://web.archive.org/web/20151009144157/http://www.nytimes.com/2015/10/10/world/middleeast/pentagon-program-islamic-state-syria.html |archive-date=October 9, 2015 |url-access=subscription |url-status=live|title=Obama Administration Ends Effort to Train Syrians to Combat ISIS|first1=Michael D. |last1=Shear |first2=Helene |last2=Cooper |first3=Eric |last3=Schmitt |access-date=February 20, 2016}}</ref><ref>{{Cite news|url=https://www.reuters.com/article/us-mideast-crisis-syria-usa-idUSKCN0S31BR20151009|title=U.S. pulls plug on Syria rebel training effort; will focus on weapons supply|first1=Phil |last1=Stewart |first2=Kate|last2=Holton|access-date=February 20, 2016|work=Reuters|date=October 9, 2015}}</ref>
In the wake of a [[Ghouta chemical attack|chemical weapons attack]] in Syria, [[U.S. Government Assessment of the Syrian Government's Use of Chemical Weapons on August 21, 2013|formally blamed]] by the Obama administration on the Assad government, Obama chose not to enforce the "red line" he had pledged<ref name="redline">{{cite news|url=http://www.washingtontimes.com/news/2015/may/17/obama-red-line-erased-as-assad-chemical-weapons-us/?page=all|title=Obama 'red line' erased as Bashar Assad's chemical weapons use goes unchecked by U.S. military|work=The Washington Times |date=May 17, 2015 |access-date=November 23, 2015}}</ref> and, rather than authorize the promised military action against Assad, went along with the Russia-brokered deal that led to Assad [[Destruction of Syria's chemical weapons|giving up chemical weapons]]; however attacks with [[chlorine gas]] continued.<ref>{{cite news|url=https://www.nytimes.com/2013/09/15/world/middleeast/syria-talks.html |archive-url=https://web.archive.org/web/20130914154144/http://www.nytimes.com/2013/09/15/world/middleeast/syria-talks.html |archive-date=September 14, 2013 |url-access=subscription |url-status=live|title=U.S. and Russia Reach Deal to Destroy Syria's Chemical Arms|author=Gordon, Michael|access-date=February 19, 2016}}</ref><ref>{{cite news|url=https://www.pbs.org/wgbh/frontline/article/syria-got-rid-of-its-chemical-weapons-but-reports-of-attacks-continue/|title=Syria Got Rid of Its Chemical Weapons—But Reports of Attacks Continue|author=Boghani, Priyanka|access-date=February 19, 2016}}</ref> In 2014, Obama authorized an [[Military intervention against ISIL|air campaign aimed primarily at ISIL]].<ref>{{cite news|url=http://www.aljazeera.com/news/middleeast/2014/09/obama-strike-wherever-it-exists-2014910223935601193.html|title=Obama outlines plan to target IS fighters|publisher=[[Al Jazeera]]|date=September 11, 2014|access-date=September 24, 2014}}</ref>
====Death of Osama bin Laden====
{{Main|Killing of Osama bin Laden}}
[[File:President Obama on Death of Osama bin Laden no watermark.webm|thumb|President Obama's address (9:28){{break}}''Also available:'' [[:File:050111 Osama Bin Laden Death Statement audioonly.ogg|Audio only]]; {{Cws |title=Full text |link=Remarks by the President on Osama bin Laden |nobullet=yes}}]]
[[File:Obama and Biden await updates on bin Laden.jpg|left|thumb|Obama and members of the national security team receive an update on [[Operation Neptune's Spear]] in the [[White House Situation Room]], May 1, 2011. See also: [[Situation Room (photograph)|''Situation Room'']]|alt=President Barack Obama and Vice President Joe Biden, along with members of the national security team, receive an update on Operation Neptune's Spear, a mission against Osama bin Laden, in one of the conference rooms of the Situation Room of the White House, on May 1, 2011. They are watching the live feed from drones operating over the bin Laden complex.]]
Starting with information received from Central Intelligence Agency operatives in July 2010, the CIA developed intelligence over the next several months that determined what they believed to be the hideout of [[Osama bin Laden]]. He was living in seclusion in [[Osama bin Laden's compound in Abbottabad|a large compound]] in [[Abbottabad]], Pakistan, a suburban area {{convert|35|mi|km}} from [[Islamabad]].<ref name="NYT-clues">{{cite news |url=https://www.nytimes.com/2011/05/03/world/asia/03intel.html |title = Clues Gradually Led to the Location of Osama bin Laden |last1 = Mazzetti |first1 = Mark |first2 = Helene |last2 = Cooper |first3 = Peter |last3 = Baker |date = May 3, 2011 |work = The New York Times |access-date = May 4, 2011 |archive-url=https://web.archive.org/web/20110503190900/http://www.nytimes.com/2011/05/03/world/asia/03intel.html |archive-date = May 3, 2011 |url-status=live }}</ref> CIA head [[Leon Panetta]] reported this intelligence to President Obama in March 2011.<ref name="NYT-clues" /> Meeting with his national security advisers over the course of the next six weeks, Obama rejected a plan to bomb the compound, and authorized a "surgical raid" to be conducted by [[United States Navy SEALs]].<ref name="NYT-clues" /> The operation took place on May 1, 2011, and resulted in the shooting death of bin Laden and the seizure of papers, computer drives and disks from the compound.<ref name="WP-binLaden">{{cite news |url=https://www.washingtonpost.com/politics/osama-bin-laden-is-killed-by-us-forces-in-pakistan/2011/05/01/AFXMZyVF_story.html |title = Osama bin Laden is killed by U.S. forces in Pakistan |newspaper = The Washington Post |access-date = September 13, 2014 |date = May 2, 2011 |first1 = Philip |last1 = Rucker |first2 = Scott |last2 = Wilson |first3 = Anne E. |last3 = Kornblut }}</ref><ref name="ND-binLaden">{{cite web |url=http://www.newsday.com/news/breaking/official-offers-details-of-bin-laden-raid-1.2853079 |title = Official offers details of bin Laden raid |website = Newsday |access-date = September 13, 2014 |date = May 2, 2011 }}</ref> DNA testing was one of five methods used to positively identify bin Laden's corpse,<ref name="ABC-binLaden">{{cite news |url=https://abcnews.go.com/Blotter/osama-bin-laden-killed/story?id=13505703 |title = Osama bin Laden Killed by U.S. Forces in Pakistan |last1 = Schabner |first1 = Dean |first2 = Karen |last2 = Travers |date = May 1, 2011 |work = ABC News |access-date = May 3, 2011 |archive-url=https://web.archive.org/web/20110504021523/http://abcnews.go.com/Blotter/osama-bin-laden-killed/story?id=13505703 |archive-date = May 4, 2011 }}</ref> which was buried at sea several hours later.<ref name="NYT-ObamaAnnounce">{{cite news|url=https://www.nytimes.com/2011/05/02/world/asia/osama-bin-laden-is-killed.html |title=Bin Laden Is Dead, Obama Says |last1=Baker |first1=Peter |first2=Helene |last2=Cooper |first3=Mark |last3=Mazzetti |date=May 2, 2011 |work=The New York Times |access-date=May 3, 2011 |archive-url=https://web.archive.org/web/20110505195308/http://www.nytimes.com/2011/05/02/world/asia/osama-bin-laden-is-killed.html |archive-date=May 5, 2011 |url-status=dead }}</ref> Within minutes of the President's announcement from Washington, DC, late in the evening on May 1, there were spontaneous celebrations around the country as crowds gathered outside the White House, and at New York City's [[World Trade Center site|Ground Zero]] and [[Times Square]].<ref name="WP-binLaden" /><ref name="Guard-ObamaAnnounce">{{cite news |last1 = Walsh |first1 = Declan |first2 = Richard |last2 = Adams |first3 = Ewen |last3 = MacAskill |url=https://www.theguardian.com/world/2011/may/02/osama-bin-laden-dead-obama |title = Osama bin Laden is dead, Obama announces |date = May 2, 2011 |work = The Guardian |place = London |access-date = May 3, 2011 |archive-url=https://web.archive.org/web/20110503154000/http://www.guardian.co.uk/world/2011/may/02/osama-bin-laden-dead-obama |archive-date = May 3, 2011 |url-status=live }}</ref> [[Reactions to the death of Osama bin Laden|Reaction to the announcement]] was positive across party lines, including from former presidents Bill Clinton and George W. Bush.<ref name="Bloom-binLaden">{{cite news |url=https://www.bloomberg.com/news/2011-05-02/death-of-bin-laden-may-strengthen-obama-s-hand-in-domestic-foreign-policy.html |title = Death of Bin Laden May Strengthen Obama's Hand in Domestic, Foreign Policy |last = Dorning |first = Mike |date = May 2, 2011 |agency = [[Bloomberg News]] |access-date = May 4, 2011 |archive-url=https://web.archive.org/web/20110503203539/http://www.bloomberg.com/news/2011-05-02/death-of-bin-laden-may-strengthen-obama-s-hand-in-domestic-foreign-policy.html |archive-date = May 3, 2011 }}</ref>
{{clear}}
====Iran nuclear talks====
{{Main|Joint Comprehensive Plan of Action}}
[[File:Barack Obama talks with Benjamin Netanyahu (8637772147).jpg|thumb|Obama talks with Benjamin Netanyahu, March 2013.]]
On October 1, 2009, the Obama administration went ahead with a Bush administration program, increasing nuclear weapons production. The "Complex Modernization" initiative expanded two existing nuclear sites to produce new bomb parts. The administration built new plutonium pits at the Los Alamos lab in New Mexico and expanded enriched uranium processing at the Y-12 facility in Oak Ridge, Tennessee.<ref>{{Cite web|url=https://www.democracynow.org/2009/10/1/headlines|title=Headlines for October 01, 2009|website=Democracy Now!}}</ref> In November 2013, the Obama administration opened [[Negotiations leading to the Joint Comprehensive Plan of Action|negotiations]] with Iran to prevent it from acquiring [[nuclear weapon]]s, which included an [[Joint Plan of Action|interim agreement]]. Negotiations took two years with numerous delays, with a deal being announced on July 14, 2015. The deal titled the "Joint Comprehensive Plan of Action" saw sanctions removed in exchange for measures that would prevent Iran from producing nuclear weapons. While Obama hailed the agreement as being a step towards a more hopeful world, the deal drew strong criticism from Republican and conservative quarters, and from Israeli Prime Minister [[Benjamin Netanyahu]].<ref>{{Cite news |title = Iran deal reached, Obama hails step toward 'more hopeful world' |url=https://www.reuters.com/article/us-iran-nuclear-idUSKCN0PM0CE20150714 |date = July 14, 2015 |access-date = July 14, 2015 |work = Reuters }}</ref><ref>{{Cite news |title = Iran, World Powers Prepare to Sign Nuclear Accord |url=https://www.wsj.com/articles/embargo-on-arms-clouds-iran-nuclear-deal-1436831280 |date = July 14, 2015 |access-date = July 14, 2015 |newspaper = The Wall Street Journal |last1 = Solomon |first1 = Jay |last2 = Norman |first2 = Laurence |last3 = Lee |first3 = Carol E. }}</ref><ref>{{cite news |title = Landmark deal reached on Iran nuclear program |url=http://edition.cnn.com/2015/07/14/politics/iran-nuclear-deal/ |date = July 14, 2015 |access-date = July 14, 2015 |publisher = CNN }}</ref> In addition, the transfer of $1.7{{nbs}}billion in cash to Iran shortly after the deal was announced was criticized by the republican party. The Obama administration said that the payment in cash was because of the "effectiveness of U.S. and international sanctions."<ref>{{cite news|url=https://www.latimes.com/nation/nationnow/la-na-iran-payment-cash-20160907-snap-story.html|title=$1.7-billion payment to Iran was all in cash due to effectiveness of sanctions, White House says|date=September 7, 2016|work=Los Angeles Times|access-date=October 30, 2019}}</ref> In order to advance the deal, the Obama administration shielded [[Hezbollah]] from the [[Drug Enforcement Administration]]'s [[Project Cassandra]] investigation regarding drug smuggling and from the [[Central Intelligence Agency]].<ref>{{cite news |url=https://www.haaretz.com/us-news/1.829686 |title=Obama Administration Reportedly Shielded Hezbollah From DEA and CIA to Save Iran Nuclear Deal |work=Haaretz |date=December 18, 2017 }}</ref><ref>{{cite news |url=https://www.politico.com/interactives/2017/obama-hezbollah-drug-trafficking-investigation/ |title=A Global Threat Emerges |work=Politico |date=December 18, 2017 |first=Josh |last=Meyer }}</ref>
On a side note, the very same year, in December 2015, Obama started a $348{{nbs}}billion worth program to back the biggest U.S. buildup of nuclear arms since Ronald Reagan left the White House.<ref>{{Cite web|url=https://www.forbes.com/sites/lorenthompson/2015/12/15/obama-backs-biggest-nuclear-arms-buildup-since-cold-war/|title=Obama Backs Biggest Nuclear Arms Buildup Since Cold War|first=Loren|last=Thompson|website=Forbes}}</ref>
====Relations with Cuba====
{{Main|Cuban thaw}}
[[File:Handshake between the President and Cuban President Raúl Castro.jpg|thumb|left|President Obama meeting with Cuban President [[Raúl Castro]] in Panama, April 2015]]
Since the spring of 2013, secret meetings were conducted between the United States and Cuba in the neutral locations of Canada and [[Vatican City]].<ref>{{cite news |last1 = Warren |first1 = Strobel |title = Secret talks in Canada, Vatican City led to Cuba breakthrough |url=https://www.reuters.com/article/us-cuba-usa-reconstruction-idUSKBN0JV2DM20141217 |work = Reuters |access-date = December 21, 2014 }}</ref> The Vatican first became involved in 2013 when [[Pope Francis]] advised the U.S. and Cuba to [[prisoner exchange|exchange prisoners]] as a gesture of goodwill.<ref>{{cite news |last1 = Morello |first1 = Carol |last2 = DeYoung |first2 = Karen |title = Secret U.S.-Cuba diplomacy ended in landmark deal on prisoners, future ties |url=https://www.washingtonpost.com/world/national-security/secret-diplomacy-with-cuba-ended-in-breakthrough-deal/2014/12/17/c51b3ed8-8614-11e4-a702-fa31ff4ae98e_story.html |newspaper = The Washington Post |access-date = December 21, 2014 }}</ref> On December 10, 2013, Cuban President [[Raúl Castro]], in a significant public moment, greeted and shook hands with Obama at the [[Death of Nelson Mandela|Nelson Mandela memorial service]] in [[Johannesburg]].<ref>{{Cite news | last1=Roberts | first1=Dan | last2=Luscombe | first2=Richard | title=Obama shakes hands with Raúl Castro for first time at Mandela memorial | newspaper=The Guardian | date=December 10, 2013 |url=https://www.theguardian.com/world/2013/dec/10/obama-shakes-hands-raul-castro-mandela-memorial | access-date=February 15, 2017}}</ref>
In December 2014, after the secret meetings, it was announced that Obama, with [[Pope Francis]] as an intermediary, had negotiated a restoration of relations with Cuba, after nearly sixty years of détente.<ref>{{cite news |first = Barbie Latza |last = Nadeau |url=http://www.thedailybeast.com/articles/2014/12/17/the-pope-s-diplomatic-miracle-ending-the-u-s-cuba-cold-war.html |title = The Pope's Diplomatic Miracle: Ending the U.S.–Cuba Cold War |work = The Daily Beast |date = December 17, 2014 |access-date = December 18, 2014 }}</ref> Popularly dubbed the [[Cuban Thaw]], ''[[The New Republic]]'' deemed the Cuban Thaw to be "Obama's finest foreign policy achievement."<ref>{{cite news |magazine=[[The New Republic]] |url=https://newrepublic.com/article/121522/cuba-obamas-biggest-foreign-policy-success |title=The Cuban Thaw Is Obama's Finest Foreign Policy Achievement to Date |first=Joel |last=Gillin |date=April 13, 2015 }}</ref> On July 1, 2015, President Obama announced that formal diplomatic relations between Cuba and the United States would resume, and embassies would be opened in Washington and [[Havana]].<ref>{{cite news |title = Obama announces re-establishment of U.S.-Cuba diplomatic ties |url=http://www.cnn.com/2015/07/01/politics/obama-note-to-castro-reestablish-ties/ |publisher = CNN |access-date = July 1, 2015 }}</ref> The countries' respective "interests sections" in one another's capitals were upgraded to embassies on July 20 and August 13, 2015, respectively.<ref>{{cite news |url=http://www.miamiherald.com/news/nation-world/world/americas/cuba/article27862504.html |title = United States and Cuba reestablish diplomatic relations |first = Mimi |last = Whitefield |work = The Miami Herald |date = July 20, 2015 |access-date = July 19, 2015 }}</ref> Obama visited Havana, Cuba for two days in March 2016, becoming the first sitting U.S. president to arrive since [[Calvin Coolidge]] in 1928.<ref>{{cite news |author1=Julie Hirschfeld Davis |first2=Damien |last2=Cave |date = March 21, 2016 |title = Obama Arrives in Cuba, Heralding New Era After Decades of Hostility |work = The New York Times |page = A1 |url=https://www.nytimes.com/2016/03/21/world/americas/obama-arrives-in-cuba.html |archive-url=https://web.archive.org/web/20160320203029/http://www.nytimes.com/2016/03/21/world/americas/obama-arrives-in-cuba.html |archive-date=March 20, 2016 |url-access=subscription |url-status=live }}</ref>
====Africa====
Obama spoke in front of the [[African Union]] in [[Addis Ababa]], Ethiopia, on July 29, 2015, the first sitting U.S. president to do so. He gave a speech encouraging the world to increase economic ties via investments and trade with the continent, and lauded the progress made in [[Education in Africa|education]], infrastructure, and [[Economy of Africa|economy]]. He also criticized the lack of democracy and leaders who refuse to step aside, discrimination against minorities ([[LGBT]] people, religious groups and ethnicities), and corruption. He suggested an intensified [[democratization]] and free trade, to significantly improve the quality of life for Africans.<ref>{{Cite news |last1 = Lee |first1 = Carol E. |title = Obama Becomes First U.S. President to Address African Union |url=https://www.wsj.com/articles/obama-becomes-first-u-s-president-to-address-african-union-1438090849 |newspaper = The Wall Street Journal |access-date = July 29, 2015 |date = July 28, 2015 }}</ref><ref>{{cite web |title = Remarks by President Obama to the People of Africa |url=https://obamawhitehouse.archives.gov/the-press-office/2015/07/28/remarks-president-obama-people-africa |access-date = July 29, 2015 |via = [[NARA|National Archives]] |work = [[whitehouse.gov]] |date = July 28, 2015 }}</ref> During his July 2015 trip, Obama also was the first U.S. president ever to [[United States presidential visits to Sub-Saharan Africa|visit]] Kenya, which is the homeland of his father.<ref>{{cite news |last1 = Ferris |first1 = Sarah |title = Obama: Proud to be first U.S. president to visit Kenya |url=http://thehill.com/homenews/administration/249189-obama-proud-to-be-first-us-president-to-visit-kenya |work = [[The Hill (newspaper)|The Hill]] |access-date = July 30, 2015 |date = July 25, 2015 }}</ref>
====Hiroshima speech====
On May 27, 2016, Obama became the first sitting American president to visit [[Hiroshima]], Japan, 71 years after the [[Atomic bombings of Hiroshima and Nagasaki|U.S. atomic bombing of Hiroshima]] towards the end of [[World War II]]. Accompanied by Japanese Prime Minister [[Shinzō Abe]], Obama paid tribute to the victims of the bombing at the [[Hiroshima Peace Memorial Museum]].<ref>{{cite news|url=https://www.bbc.co.uk/news/world-us-canada-36395350|title=President Obama visits Hiroshima|work=BBC News|access-date=June 19, 2016}}</ref> Although he was pressured to by atomic bomb survivor groups, he did not apologize for the decision to drop the bomb.<ref>{{cite news|url=https://www.usatoday.com/story/news/world/2016/05/27/obama-visit-hiroshima-bomb-site-pledges-no-apology/85022938/|title=Sympathy for victims but no apology as Obama makes historic Hiroshima visit|work=USA Today|access-date=July 13, 2021}}</ref>
====Russia====
{{See also|Russia–United States relations#From Obama's first term to election of Trump (2009–16)}}
[[File:Vladimir Putin and Barack Obama (2015-09-29) 01.jpg|thumb|Obama meets Russian President [[Vladimir Putin]] in September 2015.]]
In March 2010, an agreement was reached with the administration of Russian President [[Dmitry Medvedev]] to replace the [[START I|1991 Strategic Arms Reduction Treaty]] with a new pact reducing the number of long-range nuclear weapons in the arsenals of both countries by about a third.<ref>{{cite news |last=Baker |first=Peter |date=March 26, 2010 |url=https://www.nytimes.com/2010/03/27/world/europe/27start.html |archive-url=https://web.archive.org/web/20100328142730/http://www.nytimes.com/2010/03/27/world/europe/27start.html |archive-date=March 28, 2010 |url-access=subscription |url-status=live |title=Obama Seals Arms Control Deal With Russia |work=The New York Times }}</ref> Obama and Medvedev signed the [[New START]] treaty in April 2010, and the [[United States Senate|U.S. Senate]] ratified it in December 2010.<ref>{{cite news |url=https://www.nytimes.com/2010/12/23/world/europe/23treaty.html |archive-url=https://web.archive.org/web/20101223044444/http://www.nytimes.com/2010/12/23/world/europe/23treaty.html |archive-date=December 23, 2010 |url-access=subscription |url-status=live |work = The New York Times |first = Peter |last = Baker |title = Senate Passes Arms Control Treaty With Russia, 71–26 |date = December 22, 2010 }}</ref> In December 2011, Obama instructed agencies to consider [[LGBT rights by country or territory|LGBT rights]] when issuing financial aid to foreign countries.<ref>{{cite news |last = McVeigh |first = Karen |url=https://www.theguardian.com/world/2011/dec/07/gay-rights-us-aid-criteria |title = Gay rights must be criterion for US aid allocations, instructs Obama |newspaper = The Guardian |location = London |date = December 6, 2011 |access-date = January 4, 2013 }}</ref> In August 2013, he criticized Russia's law that discriminates against gays,<ref name="LAT80713">{{cite news |url=https://articles.latimes.com/2013/aug/07/nation/la-na-pn-obama-leno-russia-snowden-20130807 |title = Obama criticizes Russia's new anti-gay law in Leno interview |last = Parsons |first = Christi |date = August 7, 2013 |work = [[Los Angeles Times]] |access-date = August 27, 2014 }}</ref> but he stopped short of advocating a boycott of the upcoming [[2014 Winter Olympics]] in [[Sochi]], Russia.<ref name="Huffpo80913">{{cite news |url=https://www.huffingtonpost.com/2013/08/09/obama-olympic-boycott_n_3733275.html |title = Obama Opposes Olympic Boycott, Criticizes Russian Anti-Gay Law |last = Johnson |first = Luke |date = August 9, 2013 |work = [[The Huffington Post]] |access-date = August 27, 2014 }}</ref>
After [[Annexation of Crimea by the Russian Federation|Russia's invasion of Crimea]] in 2014, [[Russian military intervention in Syria|military intervention]] in Syria in 2015, and the [[2016 United States election interference by Russia|interference]] in the [[2016 United States presidential election|2016 U.S. presidential election]],<ref name="ftelect">{{cite news|url=https://www.ft.com/content/c596c0a8-a278-11e6-82c3-4351ce86813f | newspaper=[[Financial Times]] | title=US election: The Russia factor: Officials say Moscow's interference is unprecedented. Has the Kremlin achieved its goal? | date=November 4, 2016 |url-access=subscription |archive-url=https://archive.today/20170207141246/https://www.ft.com/content/c596c0a8-a278-11e6-82c3-4351ce86813f |archive-date=February 7, 2017 |url-status=live}}</ref> Obama's Russia policy was widely seen as a failure.<ref name="friedmnyt">{{cite news|first= Thomas L. |last=Friedman|url=https://www.nytimes.com/2016/10/05/opinion/lets-get-putins-attention.html |archive-url=https://web.archive.org/web/20161005073745/http://www.nytimes.com/2016/10/05/opinion/lets-get-putins-attention.html |archive-date=October 5, 2016 |url-access=subscription |url-status=live| newspaper=The New York Times| title=Let's Get Putin's Attention | date=October 5, 2016}}</ref> [[George Robertson, Baron Robertson of Port Ellen|George Robertson]], a former UK defense secretary and NATO secretary-general, said Obama had "allowed Putin to jump back on the world stage and test the resolve of the West", adding that the legacy of this disaster would last.<ref name="obexit">{{cite news|url=https://www.nytimes.com/2016/11/07/world/europe/europeans-view-obamas-exit-with-a-mix-of-admiration-and-regret.html |archive-url=https://web.archive.org/web/20161107030307/http://www.nytimes.com/2016/11/07/world/europe/europeans-view-obamas-exit-with-a-mix-of-admiration-and-regret.html |archive-date=November 7, 2016 |url-access=subscription |url-status=live | newspaper=The New York Times| title=Europeans View Obama's Exit With a Mix of Admiration and Regret | date=November 6, 2016}}</ref>
===Cultural and political image===
{{Main|Public image of Barack Obama}}
{{See also|International reactions to the 2012 United States presidential election}}
Obama's family history, upbringing, and [[Ivy League]] education differ markedly from those of African-American politicians who launched their careers in the 1960s through participation in the [[civil rights movement]].<ref>{{cite news|last=Wallace-Wells |first=Benjamin |title=The Great Black Hope: What's Riding on Barack Obama? |date=November 2004 |work=Washington Monthly |url=http://www.washingtonmonthly.com/features/2004/0411.wallace-wells.html |access-date=April 7, 2008 |archive-url=https://web.archive.org/web/20080513153556/http://www.washingtonmonthly.com/features/2004/0411.wallace-wells.html |archive-date=May 13, 2008 |url-status=dead }} See also: {{cite news|first=Janny |last=Scott |title=A Member of a New Generation, Obama Walks a Fine Line |date=December 28, 2007 |url=http://www.iht.com/articles/2007/12/28/america/obama.php |work=International Herald Tribune |access-date=April 7, 2008 |archive-url=https://web.archive.org/web/20080117005009/http://www.iht.com/articles/2007/12/28/america/obama.php |archive-date=January 17, 2008 }}</ref> Expressing puzzlement over questions about whether he is "black enough", Obama told an August 2007 meeting of the [[National Association of Black Journalists]] that "we're still locked in this notion that if you appeal to white folks then there must be something wrong."<ref>{{cite news |first = Les |last = Payne |title = In One Country, a Dual Audience |format = paid archive |date = August 19, 2007 |url = https://pqasb.pqarchiver.com/newsday/access/1322008241.html?dids=1322008241:1322008241&FMT=ABS&FMTS=ABS:FT |work = Newsday |place = New York |access-date = April 7, 2008 |archive-date = September 15, 2008 |archive-url = https://web.archive.org/web/20080915033412/http://pqasb.pqarchiver.com/newsday/access/1322008241.html?dids=1322008241:1322008241&FMT=ABS&FMTS=ABS:FT |url-status = dead }}</ref> Obama acknowledged his youthful image in an October 2007 campaign speech, saying: "I wouldn't be here if, time and again, the torch had not been passed to a new generation."<ref>{{cite news |first = Mike |last = Dorning |title = Obama Reaches Across Decades to JFK |format = paid archive |date = October 4, 2007 |url = https://pqasb.pqarchiver.com/chicagotribune/access/1353513781.html?dids=1353513781:1353513781&FMT=ABS&FMTS=ABS:FT&type=current&date=Oct+4%2C+2007&author=Mike+Dorning |work = Chicago Tribune |access-date = April 7, 2008 |archive-date = June 17, 2008 |archive-url = https://web.archive.org/web/20080617150439/http://pqasb.pqarchiver.com/chicagotribune/access/1353513781.html?dids=1353513781:1353513781&FMT=ABS&FMTS=ABS:FT&type=current&date=Oct+4%2C+2007&author=Mike+Dorning |url-status = dead }} See also: {{cite news |first = Toby |last = Harnden |title = Barack Obama is JFK Heir, Says Kennedy Aide |date = October 15, 2007 |url = https://www.telegraph.co.uk/news/worldnews/1565992/Barack-Obama-is-JFK-heir-says-Kennedy-aide.html |url-access = subscription |work = The Daily Telegraph |place = London |access-date = April 7, 2008 |archive-url = https://web.archive.org/web/20080515071852/http://www.telegraph.co.uk/news/worldnews/1565992/Barack-Obama-is-JFK-heir%2C-says-Kennedy-aide.html |archive-date = May 15, 2008 |url-status = live }}</ref>
Obama is frequently referred to as an exceptional orator.<ref name="exceptional orator" /> During his pre-inauguration transition period and continuing into his presidency, Obama delivered a series of weekly Internet video addresses.<ref>{{cite web |url=https://www.youtube.com/user/ChangeDotGov |title = YouTube—ChangeDotGov's Channel |via = YouTube |access-date = April 18, 2010 |archive-url=https://web.archive.org/web/20100220004338/http://www.youtube.com/user/ChangeDotGov|archive-date=February 20, 2010 }}</ref> In his speeches as president, Obama did not make more overt references to race relations than his predecessors,<ref>Dyson, Michael Eric. (2016). The Black Presidency: Barack Obama and the Politics of Race in America. New York: Houghton Mifflin Harcourt. p. 275. {{ISBN|978-0-544-38766-9}}.</ref><ref>{{Cite book|url=https://www.cambridge.org/core/books/governing-with-words/5D4F713A016401E3FC3922C66D371FF2|title=Governing with Words|last=Gillion|first=Daniel Q.|date=2016|website=Cambridge Core|access-date=June 5, 2019|doi=10.1017/CBO9781316412299|isbn=978-1-316-41229-9}}</ref> but according to one study, he implemented stronger policy action on behalf of African-Americans than any president since the Nixon era.<ref>{{Cite journal|last1=Butler|first1=Bennett|last2=Mendelberg|first2=Tali|last3=Haines|first3=Pavielle E.|date=2019|title="I'm Not the President of Black America": Rhetorical versus Policy Representation|journal=Perspectives on Politics|volume=17|issue=4|pages=1038–1058|doi=10.1017/S1537592719000963|issn=1537-5927|doi-access=free}}</ref>
[[File:Gallup Poll-Approval Rating-Barack Obama.svg|thumb|left|Presidential approval ratings]]
According to the [[Gallup Organization]], Obama began his presidency with a 68 percent approval rating<ref>{{cite web |url=http://www.gallup.com/poll/113962/obama-starts-job-approval.aspx |title = Obama Starts With 68% Job Approval |publisher = Gallup.com |date = January 24, 2009 |access-date = June 19, 2011 |archive-url=https://web.archive.org/web/20110616021142/http://www.gallup.com/poll/113962/Obama-Starts-Job-Approval.aspx |archive-date = June 16, 2011 }}</ref> before gradually declining for the rest of the year, and eventually bottoming out at 41 percent in August 2010,<ref>{{cite news |url=http://content.usatoday.com/communities/theoval/post/2011/04/obama-hits-low-point-in-gallup-poll/1 |title = Obama hits low point in Gallup Poll—41% |work = USA Today |date = April 15, 2011 |access-date = June 19, 2011 }}</ref> a trend similar to [[Ronald Reagan]]'s and [[Bill Clinton]]'s first years in office.<ref>{{cite web |first = Jon |last = Terbush |url=http://tpmdc.talkingpointsmemo.com/2010/12/approval-by-numbers-how-obama-compares-to-past-presidents.php |title = Approval By Numbers: How Obama Compares To Past Presidents |publisher = Tpmdc.talkingpointsmemo.com |date = December 9, 2010 |access-date = June 19, 2011 }}</ref> He experienced a small poll bounce shortly after the [[death of Osama bin Laden]] on May 2, 2011. This bounce lasted until around June 2011, when his approval numbers dropped back to where they were previously.<ref>{{cite news |last = Oliphant |first = James |date = May 11, 2011 |url=https://articles.latimes.com/2011/may/11/news/la-pn-obama-bounce-20110511 |title = Bin Laden bounce? New poll shows jump in Obama approval |work = [[Los Angeles Times]] |access-date = June 7, 2011 }}</ref><ref>{{cite news |last1 = Balz |first1 = Dan |last2 = Cohen |first2 = John |date = June 6, 2011 |url=https://www.washingtonpost.com/politics/obama-loses-bin-laden-bounce-romney-on-the-move-among-gop-contenders/2011/06/06/AGT5wiKH_story.html |title = Obama loses bin Laden bounce; Romney on the move among GOP contenders |newspaper = The Washington Post |publisher = Nash Holdings LLC |access-date = June 7, 2011 }}</ref> His approval ratings rebounded around the same time as his reelection in 2012, with polls showing an average job approval of 52 percent shortly after his second inauguration.<ref>{{cite web |url=http://www.gallup.com/poll/124922/Presidential-Job-Approval-Center.aspx |title = Presidential Job Approval Center |publisher = Gallup.com |access-date = June 23, 2015 }}</ref> Despite approval ratings dropping to 39 percent in late-2013 due to the ACA roll-out, they climbed to 50 percent in January 2015 according to Gallup.<ref>{{cite web |url=http://www.gallup.com/poll/113980/Gallup-Daily-Obama-Job-Approval.aspx |title = Gallup Daily: Obama Job Approval |date = January 22, 2015 |access-date = March 23, 2015 |website = Gallup Polling }}</ref>
Polls showed strong support for Obama in other countries both before and during his presidency.<ref>{{cite news |url=http://www.abc.net.au/news/stories/2008/09/09/2360240.htm |title = World wants Obama as president: poll |agency = Reuters |date = September 9, 2008 |work = [[ABC News (Australia)|ABC News]] }}</ref><ref>{{cite web|last1=Wike|first1=Richard|last2=Poushter|first2=Jacob|last3=Zainulbhai|first3=Hani|title=As Obama Years Draw to Close, President and U.S. Seen Favorably in Europe and Asia|url=http://www.pewglobal.org/2016/06/29/as-obama-years-draw-to-close-president-and-u-s-seen-favorably-in-europe-and-asia/|website=Global Attitudes & Trends|publisher=Pew Research Center|access-date=February 23, 2017|date=June 29, 2016}}</ref><ref>{{cite news|last1=Wan|first1=William|last2=Clement|first2=Scott|date=November 18, 2016|title=Most of the world doesn't actually see America the way Trump said it did|newspaper=[[The Washington Post]]|url=https://www.washingtonpost.com/graphics/national/obama-legacy/global-approval-rating.html|access-date=February 8, 2021}}</ref> In a February 2009 poll conducted in Western Europe and the U.S. by [[Harris Insights & Analytics|Harris Interactive]] for [[France 24]] and the ''[[International Herald Tribune]]'', Obama was rated as the most respected world leader, as well as the most powerful.<ref>{{cite news |url=https://www.nytimes.com/2009/02/06/world/americas/06iht-poll.4.19983290.html |archive-url=https://web.archive.org/web/20090927104642/http://www.nytimes.com/2009/02/06/world/americas/06iht-poll.4.19983290.html |archive-date=September 27, 2009 |url-access=subscription |url-status=live |title = Poll shows Obama atop list of most respected |last = Freed |first = John C. |date = February 6, 2009 |work = The New York Times |access-date = January 22, 2012 }}</ref> In a similar poll conducted by Harris in May 2009, Obama was rated as the most popular world leader, as well as the one figure most people would pin their hopes on for pulling the world out of the economic downturn.<ref>{{cite news |url=https://www.nytimes.com/2009/05/29/world/europe/29iht-poll.html |archive-url=https://web.archive.org/web/20090601104537/http://www.nytimes.com/2009/05/29/world/europe/29iht-poll.html |archive-date=June 1, 2009 |url-access=subscription |url-status=live |title = Obama Most Popular Leader, Poll Finds |date = May 29, 2009 |work = The New York Times |access-date = January 22, 2012 }}</ref><ref>{{cite news |title = Obama remains a popular symbol of hope |url=http://www.france24.com/en/20090529-obama-remains-popular-symbol-hope-harris-interactive-poll-world-leaders |date = June 2, 2009 |publisher = [[France 24]] |archive-url=https://web.archive.org/web/20110513050036/http://www.france24.com/en/20090529-obama-remains-popular-symbol-hope-harris-interactive-poll-world-leaders |archive-date = May 13, 2011 |access-date = January 22, 2012 }}</ref>
[[File:G8 leaders watching football.jpg|thumb|G8 leaders watching the [[2012 UEFA Champions League Final]]|alt=Prime Minister David Cameron of the United Kingdom, President Barack Obama, Chancellor Angela Merkel of Germany, José Manuel Barroso, President of the European Commission, President François Hollande of France and others react emotionally while watching the overtime shootout of the Chelsea vs. Bayern Munich [[2012 UEFA Champions League Final|Champions League final]], in the Laurel Cabin conference room during the G8 Summit at Camp David, Maryland, May 19, 2012. Cameron raises his arms triumphantly as the Chelsea team wins their first Champions League title in the overtime shootout.]]
Obama won [[Grammy Award for Best Spoken Word Album|Best Spoken Word Album]] [[Grammy Award]]s for abridged [[audiobook]] versions of ''[[Dreams from My Father]]'' in February 2006 and for ''[[The Audacity of Hope]]'' in February 2008.<ref>{{cite news |author = Goodman, Dean |date = February 10, 2008 |title = Obama or Clinton? Grammys go for Obama |work = Reuters |url=https://www.reuters.com/article/musicNews/idUSN0852813420080210 |access-date = November 24, 2008 |archive-url=https://web.archive.org/web/20081219070404/https://www.reuters.com/article/musicNews/idUSN0852813420080210 |archive-date = December 19, 2008 |url-status=live }}</ref> His [[Barack Obama presidential primary campaign, 2008#New Hampshire|concession speech]] after the New Hampshire primary was set to music by independent artists as the music video "[[Yes We Can (will.i.am song)|Yes We Can]]", which was viewed ten million times on YouTube in its first month<ref>{{cite news |url=http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/film/article3491460.ece |title = Celebrities join YouTube revolution |last = Strange |first = Hannah |date = March 5, 2008 |work = The Times |place = London |access-date = December 18, 2008 }} {{subscription required}}</ref> and received a [[Daytime Emmy Award]].<ref>{{cite news |url=http://latimesblogs.latimes.com/soundboard/2008/06/emmys-give-knuc.html |title = Emmys give knuckle bump to will.i.am; more videos on the way |last = Wappler |first = Margaret |date = June 20, 2008 |work = Los Angeles Times blogs |access-date = January 26, 2012 |archive-url=https://web.archive.org/web/20110516090327/http://latimesblogs.latimes.com/soundboard/2008/06/emmys-give-knuc.html |archive-date = May 16, 2011 }}</ref> In December 2008 and in 2012, ''[[Time (magazine)|Time]]'' magazine named Obama as its [[Time Person of the Year|Person of the Year]].<ref>{{Cite magazine |last = Scherer |first = Michael |url=http://poy.time.com/2012/12/19/person-of-the-year-barack-obama/ |title = 2012 Person of the Year: Barack Obama, the President |magazine = Time |date = December 19, 2012 |access-date = December 19, 2012 }}</ref> The 2008 awarding was for his historic candidacy and election, which ''Time'' described as "the steady march of seemingly impossible accomplishments."<ref>{{cite news|last=Von Drehle |first=David |title=Why History Can't Wait |url=http://www.time.com/time/specials/2008/personoftheyear/article/0,31682,1861543_1865068,00.html |magazine=Time |date=December 16, 2008 |access-date=December 17, 2008 |archive-url=https://web.archive.org/web/20081217223841/http://www.time.com/time/specials/2008/personoftheyear/article/0%2C31682%2C1861543_1865068%2C00.html |archive-date=December 17, 2008 |url-status=dead }}</ref> On May 25, 2011, Obama became the first president of the United States to address both houses of the [[Parliament of the United Kingdom|UK Parliament]] in [[Westminster Hall]], London. This was only the fifth occurrence since the start of the 20th century of a head of state's being extended this invitation, following [[Charles de Gaulle]] in 1960, [[Nelson Mandela]] in 1996, [[Elizabeth II|Queen Elizabeth II]] in 2002 and [[Pope Benedict XVI]] in 2010.<ref>{{cite web |first = Barack |last = Obama |url=http://www.newstatesman.com/2011/05/nations-rights-world-united |title = Full transcript—Speech to UK Parliament |via = [[New Statesman]] |date = May 25, 2011 |access-date = June 14, 2014 }}</ref><ref>{{cite web |url=http://www.parliament.uk/about/living-heritage/building/palace/westminsterhall/key-dates-wesminster-hall/keydates20th-topresent/ |title = 20th century to the present day |publisher = Parliament of the United Kingdom |date = April 21, 2010 |access-date = June 14, 2014 }}</ref>
<!--Please read the talk page to note the ongoing discussion, and also please use citation templates or expanded footnoting when citing. Raw URLs are less desirable. Thanks-->
On October 9, 2009, the [[Norwegian Nobel Committee]] announced that Obama had won the [[2009 Nobel Peace Prize]] "for his extraordinary efforts to strengthen international diplomacy and cooperation between peoples."<!--See [[WP:EGG]] before attempting to hide this link!--><ref name="nobel peace prize">{{cite web |url=http://nobelprize.org/nobel_prizes/peace/laureates/2009/ |title = The Nobel Peace Prize 2009 |publisher = Nobel Foundation |access-date = October 9, 2009 |archive-url=https://web.archive.org/web/20091010170600/http://nobelprize.org/nobel_prizes/peace/laureates/2009/ |archive-date = October 10, 2009 |url-status=live }}</ref> Obama accepted this award in [[Oslo]], Norway on December 10, 2009, with "deep gratitude and great humility."<ref name="CNN: Obama acceptance transcript">{{cite news |url=http://www.cnn.com/2009/POLITICS/12/10/obama.transcript/index.html |title = Obama: 'Peace requires responsibility' |publisher = CNN |date = December 10, 2009 |access-date = May 21, 2011 }}</ref> The award drew a mixture of praise and criticism from world leaders and media figures.<ref>{{Cite news|last=Philp|first=Catherine|date=October 10, 2009|title=Barack Obama's peace prize starts a fight|language=en|work=[[The Times]]|url=https://www.thetimes.co.uk/article/barack-obamas-peace-prize-starts-a-fight-nltk0qdq65d|access-date=December 15, 2021|issn=0140-0460}}</ref><ref>{{Cite news |first = Sharon|last= Otterman |title = World Reaction to a Nobel Surprise |newspaper = The New York Times |date = October 9, 2009 |url=http://thelede.blogs.nytimes.com/2009/10/09/world-reaction-to-a-nobel-surprise/?hp#bozoanchor |access-date = October 9, 2009 }}</ref><ref>{{cite news |url=https://www.reuters.com/article/GCA-BarackObama/idUKTRE5983AM20091009?virtualBrandChannel=11621&sp=true |title = Obama Peace Prize win has Americans asking why? |work = Reuters |access-date = October 9, 2009 |date = October 9, 2009 }}</ref><ref>{{cite news |url=https://www.nbcnews.com/id/33237202 |title = Obama: Nobel Peace Prize 'a call to action'—Politics—White House |work = NBC News |access-date = September 13, 2014 |date = October 9, 2009 }}</ref> Obama's peace prize was called a "stunning surprise" by ''[[The New York Times]]''.<ref>{{cite news |url=https://www.nytimes.com/2009/10/10/world/10nobel.html |archive-url=https://web.archive.org/web/20110501012645/http://www.nytimes.com/2009/10/10/world/10nobel.html |archive-date=May 1, 2011 |url-access=subscription |url-status=live |work = The New York Times |title = Surprise Nobel for Obama Stirs Praise and Doubts |first = Steven |last = Erlanger |date = October 10, 2009 |access-date = May 20, 2010 }}</ref> Some [[Neoconservatism|neoconservatives]] praised his speech for what they viewed as pro-American content.<ref>{{Cite news|last=Kagan|first=Robert|date=December 13, 2009|title=Robert Kagan—Obama shows he has learned from the early world resistance|newspaper=[[The Washington Post]]|url=http://www.washingtonpost.com/wp-dyn/content/article/2009/12/11/AR2009121103517.html|access-date=November 2, 2020|issn=0190-8286}}</ref><ref>{{Cite news|last=Ricks|first=Thomas E.|title=Friends like these (II): Neocons embracing Obama|url=https://foreignpolicy.com/2009/12/14/friends-like-these-ii-neocons-embracing-obama/|access-date=November 2, 2020|work=[[Foreign Policy]]}}</ref> He became the fourth U.S. president to be awarded the Nobel Peace Prize and the third to become a Nobel laureate while in office.<ref>{{cite news |url=http://www.cnn.com/2009/POLITICS/10/09/us.nobel.presidents/ |title = Obama's win unique among presidents |publisher = CNN |date = October 9, 2009 }}</ref> Obama's Nobel Prize was viewed skeptically in subsequent years, especially after the director of the Nobel Institute, [[Geir Lundestad]], said that Obama's Peace Prize did not have the desired effect of encouraging the President.<ref>{{cite news |last1 = Taylor |first1 = Adam |title = Obama's Nobel peace prize didn't have the desired effect, former Nobel official reveals |url=https://www.washingtonpost.com/news/worldviews/wp/2015/09/17/obamas-nobel-peace-prize-didnt-have-the-desired-effect-former-nobel-official-reveals/ |date=September 17, 2015 |newspaper = The Washington Post |access-date = February 4, 2016 }}</ref>
==Post-presidency (2017–present)==
[[File:58th Presidential Inaugural Ceremony 170120-D-BP749-1327.jpg|thumb|Obama with his then-new successor [[Donald Trump]] and his later successor [[Joe Biden]], at the former's [[Inauguration of Donald Trump|inauguration]] on January 20, 2017]]
[[File:Barack Obama and Donald Trump.jpg|thumb|Obama and [[Donald Trump]], January 20, 2017]]
Obama's presidency ended on January 20, 2017, upon the [[Inauguration of Donald Trump|inauguration]] of his successor, [[Donald Trump]].<ref>{{Cite news|title=How Obama felt after Trump's inauguration|language=en-GB|work=BBC News|url=https://www.bbc.co.uk/news/av/world-us-canada-42491779|access-date=March 6, 2021}}</ref><ref>{{Cite web|last=Panetta|first=Grace|title=Michelle Obama said attending Trump's inauguration as one of few people of color was 'a lot emotionally'|url=https://www.businessinsider.com/michelle-obama-trump-inauguration-a-lot-emotionally-2019-7|access-date=March 6, 2021|website=Business Insider}}</ref> The family currently rents a house in [[Kalorama, Washington, D.C.]]<ref>{{cite news|url=https://edition.cnn.com/2016/05/25/politics/obama-kalorama-washington-dc-leases-house/ |title=Peek inside Obama's post-presidential pad|last1=Kosinski|first1=Michelle |first2=Daniella |last2=Diaz |date=May 27, 2016|work=CNN|access-date=January 22, 2017}}</ref> On March 2, 2017, the [[John F. Kennedy Presidential Library and Museum]] awarded the [[Profile in Courage Award]] to Obama "for his enduring commitment to democratic ideals and elevating the standard of political courage."<ref>{{cite web|title=Former President Barack H. Obama Announced as Recipient of 2017 John F. Kennedy Profile in Courage Award|url=https://www.jfklibrary.org/About-Us/News-and-Press/Press-Releases/2017-Profile-in-Courage-Award.aspx|website=John F. Kennedy Presidential Library & Museum|publisher=John F. Kennedy Presidential Library & Museum|access-date=April 8, 2017|archive-url=https://web.archive.org/web/20170408015950/https://www.jfklibrary.org/About-Us/News-and-Press/Press-Releases/2017-Profile-in-Courage-Award.aspx|archive-date=April 8, 2017|date=March 2, 2017 |url-status=live }}</ref> His first public appearance since leaving the office was a seminar at the [[University of Chicago]] on April 24, where he appealed for a new generation to participate in politics.<ref>{{cite news|url=https://www.nytimes.com/2017/04/24/us/politics/obama-chicago.html |archive-url=https://web.archive.org/web/20170424225327/https://www.nytimes.com/2017/04/24/us/politics/obama-chicago.html |archive-date=April 24, 2017 |url-access=subscription |url-status=live|title=Obama Steps Back into Public Life, Trying to Avoid One Word: Trump|date=April 24, 2017|work=The New York Times|first=Michael D.|last=Shear}}</ref>
[[File:Obama Macri October 2017.jpg|thumb|Obama playing golf with the President of Argentina [[Mauricio Macri]], October 2017]] When Trump announced his withdrawal of the United States from the [[Paris Agreement]] on June 1, Obama released a statement disagreeing with the choice.<ref>{{cite news|url=https://edition.cnn.com/2017/06/01/politics/obama-paris-climate/ |title=Obama pans Trump withdrawal from climate deal|first=MJ|last=Lee|date=June 1, 2017|work=CNN}}</ref> After Senate Republicans revealed the [[Better Care Reconciliation Act of 2017]], their discussion draft of a health care bill to replace the Affordable Care Act, Obama released a Facebook post on June 22 calling the bill "a massive transfer of wealth from middle-class and poor families to the richest people in America."<ref>{{cite news|url=https://thehill.com/policy/healthcare/339035-obama-slams-fundamental-meanness-at-the-core-of-senate-healthcare-bill |title=Obama slams 'fundamental meanness' of Senate healthcare bill|date=June 22, 2017|first=Max|last=Greenwood|newspaper=The Hill}}</ref> On September 19, while delivering the keynote address at Goalkeepers, Obama admitted his frustration with Republicans backing "a bill that will raise costs, reduce coverage, and roll back protections for older Americans and people with pre-existing conditions."<ref>{{cite news|url=https://time.com/4949837/obamacare-repeal-barack-obama-graham-cassidy/ |title=Barack Obama Criticizes '50th or 60th' Attempt to Repeal the Affordable Care Act|date=September 20, 2017|first=Alana|last=Abramson|magazine=Time}}</ref> After Attorney General [[Jeff Sessions]] announced the termination of the [[Deferred Action for Childhood Arrivals]] (DACA) program on September 5, Obama released a Facebook post criticizing the decision.<ref>{{cite news|url=https://edition.cnn.com/2017/09/05/politics/obama-daca/index.html |title=Obama slams Trump for rescinding DACA, calls move 'cruel'|first=Kevin|last=Liptak|work=CNN|date=September 5, 2017}}</ref> Two days later, Obama partnered with former presidents Jimmy Carter, George H. W. Bush, Bill Clinton, and George W. Bush to work with [[One America Appeal]] to help the victims of [[Hurricane Harvey]] and [[Hurricane Irma]] in the [[Gulf Coast of the United States|Gulf Coast]] and [[Texas]] communities.<ref>{{cite news|url=https://thehill.com/blogs/blog-briefing-room/349993-former-presidents-add-irma-recovery-to-fundraising-appeal |title=Former presidents fundraise for Irma disaster relief|last=Shelbourne|first=Mallory|date=September 10, 2017|work=The Hill|access-date=September 11, 2017}}</ref>
Obama hosted the inaugural summit of the [[Obama Foundation]] in Chicago from October 31 to November 1, 2017.<ref>{{Cite news|last=Hope|first=Leah|date=September 14, 2017|title=Obama Foundation holds public meeting about presidential library project|url=https://abc7chicago.com/2411976/|access-date=November 17, 2020|publisher=[[WLS-TV]]}}</ref> He intends for the foundation to be the central focus of his post-presidency and part of his ambitions for his subsequent activities following his presidency to be more consequential than his time in office.<ref>{{cite news |first=Edward-Isaac |last=Dovere |url=https://www.politico.com/story/2017/10/31/barack-obama-foundation-summit-244393|title=Obama, opening his foundation's first summit, calls for fixing civic culture|work=Politico|date=October 31, 2017}}</ref>
In May 2018, Obama criticized President Trump's decision to withdraw from the nuclear deal with Iran under the Joint Comprehensive Plan of Action saying "the deal was working and it was in U.S. interests."<ref>{{Cite web|url=https://www.facebook.com/barackobama/posts/10155854913976749|archive-url=https://web.archive.org/web/20180511183521/https://www.facebook.com/barackobama/posts/10155854913976749|url-status=dead|title=Barack Obama|archive-date=May 11, 2018|via=Facebook}}</ref> Barack and Michelle Obama signed a deal on May 22, 2018, to produce docu-series, documentaries and features for [[Netflix]] under the Obamas' newly formed production company, [[Higher Ground Productions]].<ref>{{cite news |title=Obamas Sign Deal With Netflix, Form 'Higher Ground Productions' |first=Scott |last=Neuman |date=May 22, 2018 |url=https://www.npr.org/sections/thetwo-way/2018/05/22/613246456/obamas-sign-content-deal-with-netlfix-form-higher-ground-productions |publisher=NPR |access-date=September 17, 2018 }}</ref><ref>{{cite web |last1=Harris |first1=Hunter |title=The Obamas Will Produce Movies and Shows for Netflix |url=https://www.vulture.com/2018/05/the-obamas-will-produce-movies-and-shows-for-netflix.html |website=Vulture |access-date=September 17, 2018 |date=May 21, 2018 }}</ref> Higher Ground's first film, ''[[American Factory]],'' won the [[Academy Award for Best Documentary Feature]] in 2020.<ref>{{cite news|url=https://www.cnn.com/2020/01/13/entertainment/barack-and-michelle-obama-oscars/index.html|title=Barack and Michelle Obama's production company scores first Oscar nomination|last=Gonzalez|first=Sandra|date=January 13, 2020|work=CNN|access-date=January 21, 2020}}</ref>
[[File:210120-D-WD757-1249 (50861341397).jpg|thumb|right|Obama and his wife [[Michelle Obama|Michelle]] at the [[inauguration of Joe Biden]]]]
He received a 63% approval rating in Gallup's 2018 job approval poll for the past 10 U.S. presidents.<ref>{{Cite news|last=Jones|first=Jeffrey M.|date=February 15, 2018|title=Obama's First Retrospective Job Approval Rating Is 63%|publisher=[[Gallup (company)|Gallup]]|url=https://news.gallup.com/poll/226994/obama-first-retrospective-job-approval-rating.aspx|access-date=March 26, 2022}}</ref>
A pipe bomb addressed to Obama was intercepted by the Secret Service on October 24, 2018. It was one of several pipe-bombs that had been [[October 2018 United States mail bombing attempts|mailed out to Democratic lawmakers and officials]].<ref name="auto2">{{cite news|last=Pitofsky|first=Marina|title=Suspicious packages sent to Clintons, Obamas, CNN: What we know so far|url=https://www.usatoday.com/story/news/2018/10/24/suspicious-packages-delivered-clintons-obamas-cnn-what-we-know/1749205002/|newspaper=USA Today|date=October 24, 2018|language=en|archive-url=https://web.archive.org/web/20181024161609/https://www.usatoday.com/story/news/2018/10/24/suspicious-packages-delivered-clintons-obamas-cnn-what-we-know/1749205002/|archive-date=October 24, 2018|url-status=live}}</ref>
In 2019, Barack and Michelle Obama bought a home on [[Martha's Vineyard]] from [[Wyc Grousbeck]].<ref>{{cite news |last=Lukpat |first=Alyssa |date=December 5, 2019 |title=Obamas reportedly buy Martha's Vineyard waterfront estate for $11.75 million |url=https://www.bostonglobe.com/metro/2019/12/05/obamas-reportedly-buy-martha-vineyard-waterfront-estate-for-million/LeCI83nodDf735zneVfYKM/story.html |work=The Boston Globe}}</ref><ref>{{cite news |last=Howley |first=Kathleen |date=September 1, 2019 |title=Barack And Michelle Obama Are Buying Martha's Vineyard Estate From Boston Celtics Owner |url=https://www.forbes.com/sites/kathleenhowley/2019/09/01/obamas-buying-marthas-vineyard-estate-from-boston-celtics-owner/ |work=Forbes}}</ref> On October 29, 2019, Obama criticized "[[woke]]ness" and [[Cancel culture|call-out culture]] at the Obama Foundation's annual summit.<ref>{{Cite news|date=October 30, 2019|title=Barack Obama challenges 'woke' culture|language=en-GB|work=BBC News|url=https://www.bbc.com/news/world-us-canada-50239261|access-date=October 4, 2021}}</ref><ref>{{Cite news|last1=Rueb|first1=Emily S.|last2=Taylor|first2=Derrick Bryson|date=October 31, 2019|title=Obama on Call-Out Culture: 'That's Not Activism'|language=en-US|work=The New York Times|url=https://www.nytimes.com/2019/10/31/us/politics/obama-woke-cancel-culture.html |archive-url=https://web.archive.org/web/20191031174003/https://www.nytimes.com/2019/10/31/us/politics/obama-woke-cancel-culture.html |archive-date=October 31, 2019 |url-access=subscription |url-status=live|access-date=October 4, 2021|issn=0362-4331}}</ref>
Obama was reluctant to make an endorsement in the [[2020 Democratic presidential primaries]] because he wanted to position himself to unify the party, no matter who the nominee was.<ref>{{cite web |last1=Jackson |first1=John Fritze and David |title='Voters themselves must pick': Why Barack Obama isn't endorsing Joe Biden or anyone else for president |url=https://www.usatoday.com/story/news/politics/elections/2020/02/27/why-obama-wont-endorse-biden-south-carolina-super-tuesday-nears/4890693002/ |website=USA TODAY |access-date=March 18, 2022}}</ref> On April 14, 2020, Obama endorsed his former vice president [[Joe Biden]], the presumptive Democratic nominee, for president in the [[2020 United States presidential election|2020 election]], stating that he has "all the qualities we need in a president right now."<ref>{{cite news |last1=Astor |first1=Maggie |last2=Glueck |first2=Katie |title=Barack Obama Endorses Joe Biden for President |url=https://www.nytimes.com/2020/04/14/us/politics/obama-endorses-biden.html |archive-url=https://web.archive.org/web/20200414145003/https://www.nytimes.com/2020/04/14/us/politics/obama-endorses-biden.html |archive-date=April 14, 2020 |url-access=subscription |url-status=live |work=The New York Times |date=April 14, 2020}}</ref><ref>{{Cite news|title=Obama endorses Joe Biden for president|language=en-GB|work=BBC News|url=https://www.bbc.co.uk/news/av/world-us-canada-52287456|access-date=March 6, 2021}}</ref> In May 2020, Obama criticized President Trump for [[Trump administration communication during the COVID-19 pandemic|his handling]] of the [[COVID-19 pandemic in the United States|COVID-19 pandemic]], calling his response to the crisis "an absolute chaotic disaster", and stating that the consequences of [[Presidency of Donald Trump|the Trump presidency]] have been "our worst impulses unleashed, our proud reputation around the world badly diminished, and our democratic institutions threatened like never before."<ref>{{Cite news|date=August 20, 2020|title=DNC 2020: Obama blasts Trump's 'reality show' presidency|language=en-GB|work=BBC News|url=https://www.bbc.com/news/election-us-2020-53844037|access-date=March 6, 2021}}</ref> Trump retaliated by accusing Obama of having committed "the biggest political crime in American history", although he refused to say what he was talking about, telling reporters: "You know what the crime is, the crime is very obvious to everybody."<ref>{{Cite web|title=Trump Accuses Obama Of A Crime In White House Press Briefing|url=https://www.forbes.com/sites/andrewsolender/2020/05/11/trump-accuses-obama-of-a-crime-in-white-house-press-briefing/|last=Solender|first=Andrew|work=Forbes|access-date=May 12, 2020}}</ref>
Obama wrote a presidential memoir, in a $65{{nbs}}million deal with [[Penguin Random House]].<ref name="nymag">{{cite magazine |url=https://nymag.com/intelligencer/2018/06/where-is-barack-obama.html |title=Where Is Barack Obama? |first=Gabriel |last=Debenedetti |magazine=[[New York (magazine)|New York]] |date=June 24, 2018}}</ref> The book, ''[[A Promised Land]]'', was released on November 17, 2020.<ref>{{Cite news |last1=Harris |first1=Elizabeth A. |title=Obama's Memoir 'A Promised Land' Coming in November |work=[[The New York Times]] |date=September 17, 2020 |url=https://www.nytimes.com/2020/09/17/books/obama-memoir-a-promised-land.html |archive-url=https://web.archive.org/web/20200917101005/https://www.nytimes.com/2020/09/17/books/obama-memoir-a-promised-land.html |archive-date=September 17, 2020 |url-access=subscription |url-status=live |issn=0362-4331 }}</ref><ref>{{Cite news|last=Adichie|first=Chimamanda Ngozi|date=November 12, 2020|title=Chimamanda Ngozi Adichie on Barack Obama's 'A Promised Land'|work=The New York Times|url=https://www.nytimes.com/2020/11/12/books/review/barack-obama-a-promised-land.html |archive-url=https://web.archive.org/web/20201112144007/https://www.nytimes.com/2020/11/12/books/review/barack-obama-a-promised-land.html |archive-date=November 12, 2020 |url-access=subscription |url-status=live|access-date=November 17, 2020|issn=0362-4331}}</ref><ref>{{Cite news|last=Carras|first=Christi|date=September 17, 2020|title=Barack Obama's new memoir will arrive right after the presidential election|url=https://www.latimes.com/entertainment-arts/books/story/2020-09-17/barack-obama-book-memoir-a-promised-land|access-date=November 17, 2020|work=Los Angeles Times}}</ref>
In February 2021, Obama and musician [[Bruce Springsteen]] started a podcast called ''[[Renegades: Born in the USA]]'' where the two talk about "their backgrounds, music and their 'enduring love of America.{{'"}}<ref>{{cite web |last1=Gabbatt |first1=Adam |title=Barack Obama and Bruce Springsteen team up for new podcast |url=https://www.theguardian.com/us-news/2021/feb/22/barack-obama-bruce-springsteen-podcast-renegades-born-usa |website=[[The Guardian]] |access-date=March 24, 2021 |date=February 22, 2021}}</ref><ref>{{cite news |last1=Sisario |first1=Ben |title=Barack Obama and Bruce Springsteen: The Latest Podcast Duo |url=https://www.nytimes.com/2021/02/22/arts/obama-springsteen-podcast-spotify.html |archive-url=https://ghostarchive.org/archive/20211228/https://www.nytimes.com/2021/02/22/arts/obama-springsteen-podcast-spotify.html |archive-date=December 28, 2021 |url-access=limited |access-date=March 24, 2021 |work=The New York Times |date=February 22, 2021}}{{cbignore}}</ref> In late 2021, Regina Hicks had signed a deal with [[Netflix]], in a venture with his and [[Michelle Obama|Michelle]]'s [[Higher Ground Productions|Higher Ground]] to develop comedy projects.<ref>{{Cite web|last=Otterson|first=Joe|date=December 8, 2021|title='Upshaws' Co-Creator Regina Hicks Sets Netflix Overall Deal, to Develop Comedy Series With Obamas' Higher Ground|url=https://variety.com/2021/tv/news/upshaws-regina-hicks-netflix-overall-deal-obamas-higher-ground-1235129305/|access-date=December 9, 2021|website=Variety|language=en-US}}</ref> On March 4, 2022, Obama won an Audio Publishers Association (APA) Award in the best narration by the author category for the narration of his memoir ''[[A Promised Land]]''.<ref>{{Cite magazine|last=Perez|first=Lexy|title=Barack Obama, Lin-Manuel Miranda Among 2022 Audie Awards Winners|url=https://www.billboard.com/music/awards/audie-awards-2022-winners-lin-manuel-miranda-1235040071/|date=March 5, 2022|access-date=March 6, 2022|magazine=Billboard}}</ref>
On April 5, 2022, Obama visited the White House for the first time since leaving office, in an event celebrating the 12th annual anniversary of the signing of the Affordable Care Act.<ref>{{Cite web |date=April 5, 2022 |title=Remarks by President Biden, Vice President Harris, and Former President Obama on the Affordable Care Act |url=https://www.whitehouse.gov/briefing-room/speeches-remarks/2022/04/05/remarks-by-president-biden-vice-president-harris-and-former-president-obama-on-the-affordable-care-act/ |access-date=April 6, 2022 |website=The White House |language=en-US}}</ref><ref>{{Cite web |last=Benson |first=Samuel |title=Obama returns to White House for first time since leaving office |url=https://www.politico.com/news/2022/04/05/obama-returns-white-house-00023148 |access-date=April 6, 2022 |website=POLITICO |language=en}}</ref><ref>{{Cite web |date=April 5, 2022 |title=Obama's back — for a day — in White House health bill push |url=https://apnews.com/article/biden-health-business-donald-trump-john-mccain-2cbb6353329fcb541b4c8399a5981cf5 |access-date=April 6, 2022 |website=AP NEWS |language=en}}</ref>
In 2022, he narrated the Netflix documentary series ''[[Our Great National Parks]]''.<ref>{{Cite news |title=5 lessons from Obama's national parks show on Netflix |language=en-US |newspaper=Washington Post |url=https://www.washingtonpost.com/travel/2022/04/13/obama-national-parks-show-netflix/ |access-date=May 26, 2022 |issn=0190-8286}}</ref>
In June of 2022, it was announced that the Obamas and their podcast production company, [[Higher Ground Productions|Higher Ground]], signed a multi-year deal [[Audible (service)|Audible]]. The move followed Higher Ground's exit from [[Spotify]], where the company previously had a multi-year deal to create podcasts exclusively for the platform.<ref>{{Cite web |title=Barack and Michelle Obama sign with Amazon after Spotify declines to renew audio deal |url=https://fortune.com/2022/06/21/barack-michelle-obama-amazon-audible-audio-deal-spotify/ |access-date=2022-06-22 |website=Fortune |language=en}}</ref><ref>{{Cite web |last1=Chan |first1=J. Clara |date=2022-06-21 |title=The Obamas' Higher Ground Leaves Spotify for Audible Multiyear Deal |url=https://www.hollywoodreporter.com/business/digital/obama-higher-ground-audible-1235169084/ |access-date=2022-06-22 |website=The Hollywood Reporter |language=en-US}}</ref>
==Legacy==
[[File:Job Growth by U.S. President - v1.png|thumb|upright=1.7|Job growth during the presidency of Obama compared to other presidents, as measured as a cumulative percentage change from month after inauguration to end of his term]]
Obama's most significant accomplishment is generally considered to be the [[Affordable Care Act]] (ACA), provisions of which went into effect from 2010 to 2020. Many attempts by Senate Republicans to repeal the ACA, including a "skinny repeal", have thus far failed.<ref name="legacy">{{cite news|url=https://abcnews.go.com/Politics/video/obama-legacy-recovery-recession-affordable-care-act-44927003 |title=Obama Legacy Will Be Recovery from Recession, Affordable Care Act|date=January 20, 2017|work=ABC News|access-date=March 15, 2017}}</ref> However, in 2017, the penalty for violating the individual mandate was repealed effective 2019.<ref name="auto">{{Cite report |title=The Effect of Eliminating the Individual Mandate Penalty and the Role of Behavioral Factors|year=2018|work=[[Commonwealth Fund]]|doi=10.26099/SWQZ-5G92 |doi-access=free |last1=Eibner|first1=Christine|last2=Nowak|first2=Sarah}}</ref> Together with the [[Health Care and Education Reconciliation Act]] amendment, it represents the [[Health care in the United States|U.S. healthcare system]]'s most significant regulatory overhaul and expansion of coverage since the passage of [[Medicare (United States)|Medicare]] and [[Medicaid]] in 1965.<ref name="Oberlander2010">{{cite journal|last1=Oberlander|first1=Jonathan|title=Long Time Coming: Why Health Reform Finally Passed|journal=Health Affairs|date=June 1, 2010|volume=29|issue=6|pages=1112–1116|doi=10.1377/hlthaff.2010.0447|pmid=20530339|issn=0278-2715|doi-access=free}}</ref><ref name="Blumenthal2015">{{cite journal |last1=Blumenthal|first1=David|last2=Abrams|first2=Melinda|last3=Nuzum|first3=Rachel|s2cid=28486139|title=The Affordable Care Act at 5 Years |journal=New England Journal of Medicine |date=June 18, 2015 | volume=372 |issue=25 |pages=2451–2458|doi=10.1056/NEJMhpr1503614|pmid=25946142| issn=0028-4793}}</ref><ref name="CohenEtAl">{{cite book|last1=Cohen|first1=Alan B.|last2=Colby|first2=David C.|last3=Wailoo|first3=Keith A.|last4=Zelizer|first4=Julian E. | title=Medicare and Medicaid at 50: America's Entitlement Programs in the Age of Affordable Care|date=June 1, 2015|publisher=Oxford University Press|isbn=978-0-19-023156-9|url=https://books.google.com/books?id=H9DGBwAAQBAJ }}</ref><ref name="NYTsigning">{{cite news|last1=Stolberg|first1=Sheryl Gay|last2=Pear|first2=Robert | title=Obama Signs Health Care Overhaul into Law|url=https://www.nytimes.com/2010/03/24/health/policy/24health.html| work=The New York Times|date=March 23, 2010}}</ref>
Many commentators credit Obama with averting a threatened [[Depression (economics)|depression]] and pulling the economy back from the [[Great Recession]].<ref name="legacy" /> According to the [[U.S. Bureau of Labor Statistics]], the [[Obama administration]] created 11.3 million jobs from the month after [[first inauguration of Barack Obama|his first inauguration]] to the end of his term.<ref>{{cite news|last1=Long|first1=Heather|title=Final tally: Obama created 11.3 million jobs|url=https://money.cnn.com/2017/01/06/news/economy/obama-over-11-million-jobs/ |work=CNN|date=January 6, 2017}}</ref> In 2010, Obama signed into effect the [[Dodd–Frank Wall Street Reform and Consumer Protection Act]]. Passed as a response to the [[financial crisis of 2007–08]], it brought the most significant changes to [[financial regulation]] in the United States since the regulatory reform that followed the [[Great Depression]] under Democratic President [[Franklin D. Roosevelt]].<ref>{{cite news|url=https://www.cbsnews.com/pictures/barack-obama-legacy/12/ |title=Barack Obama's Legacy: Dodd-Frank Wall Street reform|work=CBS News|access-date=March 15, 2017}}</ref>
In 2009, Obama signed into law the [[National Defense Authorization Act for Fiscal Year 2010]], which contained in it the [[Matthew Shepard and James Byrd Jr. Hate Crimes Prevention Act]], the first addition to existing federal hate crime law in the United States since Democratic President [[Bill Clinton]] signed into law the Church Arson Prevention Act of 1996. The Matthew Shepard and James Byrd Jr. Hate Crimes Prevention Act expanded [[Hate crime laws in the United States|existing federal hate crime laws in the United States]] to apply to crimes motivated by a victim's actual or perceived gender, sexual orientation, gender identity, or disability, and dropped the prerequisite that the victim be engaged in a federally protected activity.{{citation needed|date=December 2021}}
As president, Obama advanced LGBT rights.<ref>{{cite news |last=Crary |first=David |date=January 4, 2017 |url=https://apnews.com/b94c8697ab2148199ca3d1b6137a9c20/lgbt-activists-view-obama-staunch-champion-their-cause |title=LGBT activists view Obama as staunch champion of their cause |work=[[Associated Press]] }}</ref> In 2010, he signed the [[Don't Ask, Don't Tell Repeal Act of 2010|Don't Ask, Don't Tell Repeal Act]], which brought an end to "[[don't ask, don't tell]]" policy in the U.S. armed forces that banned open service from [[Lesbian, gay and bisexual|LGB]] people; the law went into effect the following year.<ref>{{cite news |last=Bumiller |first=Elisabeth |date=July 22, 2011 |url=https://www.nytimes.com/2011/07/23/us/23military.html |archive-url=https://web.archive.org/web/20110723235727/http://www.nytimes.com/2011/07/23/us/23military.html |archive-date=July 23, 2011 |url-access=subscription |url-status=live |title=Obama Ends 'Don't Ask, Don't Tell' Policy |newspaper=[[The New York Times]] }}</ref> In 2016, his administration brought an end to the ban on [[transgender]] people serving openly in the U.S. armed forces.<ref>{{cite news|title=Pentagon Says Transgender Troops Can Now Serve Openly|url=https://www.npr.org/sections/thetwo-way/2016/06/30/484192442/pentagon-says-transgender-troops-can-now-serve-openly|date=June 30, 2016|last=Kennedy|first=Kennedy|work=The Two-Way|publisher=[[NPR]]}}</ref><ref name=TransBan1 /> A [[Gallup poll]], taken in the final days of Obama's term, showed that 68 percent of Americans believed the U.S. had made progress on LGBT rights during Obama's eight years in office.<ref>{{cite news |first1=Michael |last1=Smith |first2=Frank |last2=Newport |url=https://news.gallup.com/poll/201683/americans-assess-progress-obama.aspx |title=Americans Assess Progress Under Obama |publisher=The Gallup Organization |date=January 9, 2017 }}</ref>
Obama substantially escalated the use of [[drone strikes]] against suspected militants and terrorists associated with [[al-Qaeda]] and the [[Taliban]].<ref>{{cite news |last=Zenko|first=Micah |date=January 12, 2016 |title= Obama's Embrace of Drone Strikes Will Be a Lasting Legacy|url=https://www.nytimes.com/roomfordebate/2016/01/12/reflecting-on-obamas-presidency/obamas-embrace-of-drone-strikes-will-be-a-lasting-legacy|work=[[The New York Times]] |access-date= March 2, 2019}}</ref><ref>{{cite web|url=https://www.cfr.org/backgrounder/targeted-killings|title=Targeted Killings|publisher=[[Council on Foreign Relations]]}}</ref> In 2016, the last year of his presidency, the U.S. dropped 26,171 bombs on seven different countries.<ref>{{cite news |last=Grandin|first=Greg |date=January 15, 2017 |title= Why Did the US Drop 26,171 Bombs on the World Last Year?|url=https://www.thenation.com/article/archive/why-did-the-us-dropped-26171-bombs-on-the-world-last-year/tnamp/|work=[[The Nation]] |author-link=Greg Grandin|access-date= January 11, 2018}}</ref><ref>{{cite news |last=Agerholm|first=Harriet |date=January 19, 2017 |title=Map shows where President Barack Obama dropped his 20,000 bombs|url=https://www.independent.co.uk/news/world/americas/us-president-barack-obama-bomb-map-drone-wars-strikes-20000-pakistan-middle-east-afghanistan-a7534851.html|work=The Independent |access-date=January 11, 2018}}</ref> Obama left about 8,400 U.S. troops in [[Afghanistan]], 5,262 in Iraq, 503 in Syria, 133 in Pakistan, 106 in Somalia, seven in Yemen, and two in Libya at the end of his presidency.<ref>{{cite news|last1=Parsons|first1=Christi|last2=Hennigan|first2=W. J.|title=President Obama, who hoped to sow peace, instead led the nation in war|url=https://www.latimes.com/projects/la-na-pol-obama-at-war/ |work=Los Angeles Times|date=January 13, 2017}}</ref><ref>{{cite web|url=https://www.dmdc.osd.mil/appj/dwp/dwp_reports.jsp|title=DoD Personnel, Workforce Reports & Publications|website=www.dmdc.osd.mil |access-date=January 16, 2020 }}</ref>
According to [[Pew Research Center]] and [[United States Bureau of Justice Statistics]], from December 31, 2009, to December 31, 2015, inmates sentenced in U.S. federal custody declined by five percent. This is the largest decline in sentenced inmates in U.S. federal custody since Democratic President [[Jimmy Carter]]. By contrast, the federal prison population increased significantly under presidents [[Ronald Reagan]], [[George H. W. Bush]], [[Bill Clinton]], and [[George W. Bush]].<ref>{{cite web|last1=Gramlich|first1=John|title=Federal prison population fell during Obama's term, reversing recent trend|url=https://www.pewresearch.org/fact-tank/2017/01/05/federal-prison-population-fell-during-obamas-term-reversing-recent-trend/ |publisher=Pew Research Center|date=January 5, 2017}}</ref>
According to [[Julian E. Zelizer|Julian Zelizer]]'s ''The Presidency of Barack Obama'', under Obama's presidency, the "Democrats lost more than one thousand seats in state legislatures, governors' mansions, and Congress during his time in office." adding that Obama "turned out to be a very effective policymaker but not a tremendously successful party builder."<ref>{{Cite web|last=Kamarck|first=Elaine|date=April 6, 2018|title=The fragile legacy of Barack Obama|url=https://www.brookings.edu/blog/fixgov/2018/04/06/the-fragile-legacy-of-barack-obama/|url-status=live|access-date=October 30, 2021|website=[[Brookings Institution|Brookings]]|language=en-US|archive-url=https://web.archive.org/web/20180406205333/https://www.brookings.edu/blog/fixgov/2018/04/06/the-fragile-legacy-of-barack-obama/ |archive-date=April 6, 2018 }}</ref>
During Obama's presidency, a record 3.2 million people [[Deportation and removal from the United States|were deported from the United States]].<ref name="nydn_Obama">{{Cite web|author=|date=September 1, 2016|title=Obama deported record number of immigrants, despite Trump's claim|url=http://www.nydailynews.com/news/politics/obama-deported-record-number-immigrants-trump-claim-article-1.2774180|work=[[New York Daily News]]|quote=|access-date=November 15, 2016}}</ref> His record deportations earned Obama the nickname "Deporter in Chief".<ref>{{cite news|last=Golash-Boza|first=Tanya|date=November 1, 2014|title='Deporter in chief' Obama has alienated Latino voters|newspaper=[[Al Jazeera America]]|url=http://america.aljazeera.com/opinions/2014/11/obama-deportationimmigrationreformmidtermelections.html|access-date=November 30, 2020}}</ref> In February 2020, Biden called the deportation of hundreds of thousands of people without criminal records under the Obama administration a "big mistake".<ref>{{Cite web|last=Barrow|first=Bill|date=February 15, 2020|title=For first time, Biden calls Obama deportations 'big mistake'|url=https://abcnews.go.com/Politics/wireStory/time-biden-calls-obama-deportations-big-mistake-69010125|url-status=live|access-date=October 30, 2021|website=ABC News|publisher=Associated Press|language=en|archive-url=https://web.archive.org/web/20200216145238/https://abcnews.go.com/Politics/wireStory/time-biden-calls-obama-deportations-big-mistake-69010125 |archive-date=February 16, 2020 }}</ref>
[[Human Rights Watch]] (HRW) called Obama's human rights record "mixed", adding that "he has often treated human rights as a secondary interest — nice to support when the cost was not too high, but nothing like a top priority he championed."<ref name=":0" />
Obama left office in January 2017 with a 60 percent approval rating.<ref>{{Cite news|url=https://www.upi.com/Top_News/US/2017/01/18/Obama-leaving-office-at-60-approval-rating/4481484744398/ |first=Allen |last=Cone |date=January 18, 2017 |title=Obama leaving office at 60 percent approval rating|work=United Press International|access-date=February 26, 2017}}</ref><ref>{{cite news |url=https://www.cnn.com/2017/01/18/politics/obama-approval-rating-cnn-orc-poll/index.html|title=Obama approval hits 60 percent as end of term approaches|last=Agiesta |date=January 18, 2017 |first=Jennifer |access-date=February 26, 2017|work=CNN}}</ref> A 2018 survey of historians by the [[American Political Science Association]] ranked Obama the [[Historical rankings of presidents of the United States|8th-greatest American president]].<ref name="How Does Trump Stack Up Against the Best—and Worst—Presidents?">{{cite news|last1=Rottinghaus|first1=Brandon|last2=Vaughn|first2=Justin S.|date=February 19, 2018|title=Opinion {{!}} How Does Trump Stack Up Against the Best—and Worst—Presidents?|work=[[The New York Times]]|url=https://www.nytimes.com/interactive/2018/02/19/opinion/how-does-trump-stack-up-against-the-best-and-worst-presidents.html|access-date=February 8, 2021}}</ref> Obama gained 10 spots from the same survey in 2015 from the [[Brookings Institution]] that ranked him the 18th-greatest American president.<ref>{{cite web|url=https://www.brookings.edu/blog/fixgov/2015/02/13/measuring-obama-against-the-great-presidents/|title=Measuring Obama against the great presidents|last1= Rottinghaus|first1=Brandon|last2=Vaughn|first2=Justin S.|date=February 13, 2015|publisher=[[Brookings Institution]]}}</ref>
===Presidential library===
{{Main|Barack Obama Presidential Center}}
The Barack Obama Presidential Center is Obama's planned [[presidential library]]. It will be hosted by the [[University of Chicago]] and located in [[Jackson Park (Chicago)|Jackson Park]] on the [[South Side, Chicago|South Side of Chicago]].<ref>{{cite web|url=https://www.obama.org/about-the-foundation/|title=Obama Foundation FAQs|publisher=Barack Obama Foundation |access-date=January 16, 2020 }}</ref>
==Bibliography==
{{Main| Bibliography of Barack Obama}}
{{refbegin}}
===Books===
* {{Cite book |last=Obama |first=Barack |date=July 18, 1995 |title=[[Dreams from My Father]] |edition=1st |location=New York |publisher=[[Times Books]] |isbn=0-8129-2343-X}}
* {{Cite book |last=Obama |first=Barack |author-mask=7 |date=October 17, 2006 |title=[[The Audacity of Hope]] |edition=1st |location=New York |publisher=[[Crown Publishing Group]] |isbn=978-0-307-23769-9}}
* {{Cite book |last=Obama |first=Barack |author-mask=7 |date=November 16, 2010 |title=[[Of Thee I Sing (book)|Of Thee I Sing]] |edition=1st |location=New York |publisher=[[Knopf Books for Young Readers|Alfred A. Knopf]] |isbn=978-0-375-83527-8}}
* {{Cite book |last=Obama |first=Barack |author-mask=7 |date=November 17, 2020 |title=[[A Promised Land]] |edition=1st |location=New York |publisher=[[Crown Publishing Group]] |isbn=978-1-5247-6316-9}}<ref>{{Cite web|title=Former President Barack Obama's third book starts shipping today|url=https://www.nbcnews.com/shopping/books/barack-obama-book-promised-land-n1246845|access-date=September 22, 2021|website=NBC News|language=en}}</ref>
===Audiobooks===
* 2006: ''The Audacity of Hope: Thoughts on Reclaiming the American Dream'' (read by the author), [[Random House Audio]], {{ISBN|978-0-7393-6641-7}}
* 2020: ''A Promised Land'' (read by the author)
===Articles===
* {{Cite journal|last=Obama|first=Barack|date=1988|title=Why organize? Problems in the inner city|url=https://www.lib.niu.edu/1988/ii880840.html|journal=Illinois Issues|volume=XIV|issue=8 & 9|pages=40–42|issn=0738-9663}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=1990|title=Tort Law. Prenatal Injuries. Supreme Court of Illinois Refuses to Recognize Cause of Action Brought by Fetus Against Its Mother for Unintentional Infliction of Prenatal Injuries. ''Stallman v. Youngquist'', 125 Ill. 2d 267, 531 N. E.2d 355 (1988)|journal=[[Harvard Law Review]]|volume=103|issue=3|pages=823–828|jstor=1341352|doi=10.2307/1341352}} Uncredited case comment.<ref>{{Cite news|last1=Ressner|first1=Jeffrey|last2=Smith|first2=Ben|date=August 22, 2008|title=Exclusive: Obama's Lost Law Review Article |url=https://www.politico.com/story/2008/08/exclusive-obamas-lost-law-review-article-012705|url-status=live|archive-url=https://web.archive.org/web/20210208150320/https://www.politico.com/story/2008/08/exclusive-obamas-lost-law-review-article-012705|archive-date=February 8, 2021|access-date=February 20, 2021|work=[[Politico]]}}</ref>
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=2005|title=Bound to the Word|url=https://americanlibrariesmagazine.org/bound-to-the-word/|journal=[[American Libraries]]|volume=36|issue=7|pages=48–52|jstor=25649652}}
*{{Cite journal|last1=Obama|first1=Barack|author-mask=7|date=May 25, 2006|title=Making Patient Safety the Centerpiece of Medical Liability Reform|journal=[[The New England Journal of Medicine]]|volume=354|issue=21|pages=2205–2208|doi=10.1056/NEJMp068100|last2=Clinton|first2=Hillary|pmid=16723612|author-link2=Hillary Clinton}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=2007|title=Renewing American Leadership|url=https://www.foreignaffairs.com/articles/2007-07-01/renewing-american-leadership|journal=[[Foreign Affairs]]|volume=86|pages=2–16|jstor=20032411|issue=4}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=2008|title=A More Perfect Union|url=https://www.tandfonline.com/doi/abs/10.1080/00064246.2008.11413431|journal=[[The Black Scholar]]|volume=38|pages=17–23|doi=10.1080/00064246.2008.11413431|jstor=41069296|issue=1|s2cid=219318643}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=2009|title=What Science Can Do|url=https://issues.org/obama/|journal=[[Issues in Science and Technology]]|volume=25|pages=23–30|jstor=43314908|issue=4}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=2009|title=A New Beginning|journal=Zeitschrift für Staats- und Europawissenschaften (ZSE)|volume=7|pages=173–186|jstor=26165626|issue=2|doi=10.5771/1610-7780-2009-2-173}}
* {{Cite magazine|last=Obama|first=Barack|author-mask=7|date=January 8, 2016|title=Our Shared Responsibility|url=https://www.nytimes.com/2016/01/08/opinion/president-barack-obama-guns-are-our-shared-responsibility.html|magazine=[[The New York Times]]|page=23 (Section A)}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=August 2, 2016|title=United States Health Care Reform: Progress to Date and Next Steps |journal=[[Journal of the American Medical Association]]|volume=130|issue=5|pages=811–866|doi=10.1001/jama.2016.9797 |doi-access=free |pmid=27400401|pmc=5069435}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=January 5, 2017|title=The President's Role in Advancing Criminal Justice Reform|url=https://harvardlawreview.org/wp-content/uploads/2017/01/811-866-Online-Rev-vf.pdf|journal=[[Harvard Law Review]]|volume=130|issue=3|pages=811–866|jstor=44865604}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=January 13, 2017|title=The Irreversible Momentum of Clean Energy|journal=[[Science (journal)|Science]]|volume=355|issue=6321|pages=126–129|doi=10.1126/science.aam6284|pmid=28069665|bibcode=2017Sci...355..126O|s2cid=30991274|doi-access=free}}
* {{Cite journal|last=Obama|first=Barack|author-mask=7|date=May 2017|title=Repealing the ACA Without a Replacement—the Risks to American Health Care|journal=[[Obstetrical & Gynecological Survey]]|volume=72|issue=5|pages=263–264|doi=10.1097/OGX.0000000000000447|s2cid=80088566|url=https://digitalcommons.unl.edu/cgi/viewcontent.cgi?article=1493&context=publichealthresources}}
{{refend}}
==See also==
{{Portal|Biography|United States|Chicago|Illinois|Hawaii|Politics|Law}}
===Politics===
* [[DREAM Act]]
* [[Fraud Enforcement and Recovery Act of 2009]]
* [[Immigration Reform and Control Act of 1986]]
* [[IRS targeting controversy]]
* [[Middle Class Tax Relief and Job Creation Act of 2012]]
* [[National Broadband Plan (United States)]]
* [[Office of Energy Efficiency and Renewable Energy]]
* [[Social policy of the Barack Obama administration]]
* [[SPEECH Act]]
* [[Stay with It]]
* [[White House Office of Energy and Climate Change Policy]]
===Other===
* [[Roberts Court]]
* [[Speeches of Barack Obama]]
===Lists===
* [[Assassination threats against Barack Obama]]
* [[List of African-American United States senators]]
* [[List of Barack Obama 2008 presidential campaign endorsements]]
* [[List of Barack Obama 2012 presidential campaign endorsements]]
* [[List of federal political scandals in the United States#Barack Obama administrations (2009–2017)|List of federal political scandals, 2009–17]]
* [[List of people granted executive clemency by Barack Obama]]
* [[List of things named after Barack Obama]]
==References==
<references>
<ref name="birth-certificate">{{cite web |date = April 27, 2011 |title = Certificate of Live Birth: Barack Hussein Obama II, August 4, 1961, 7:24 pm, Honolulu |url=https://obamawhitehouse.archives.gov/sites/default/files/rss_viewer/birth-certificate-long-form.pdf |access-date = March 11, 2017 |archive-url=https://web.archive.org/web/20170303062746/https://obamawhitehouse.archives.gov/sites/default/files/rss_viewer/birth-certificate-long-form.pdf |via = [[NARA|National Archives]] |work = [[whitehouse.gov]] |archive-date = March 3, 2017 }}</ref>
<ref name="Christian">* {{cite web |year=2009 |title=American President: Barack Obama |publisher=Miller Center of Public Affairs, University of Virginia |url=http://millercenter.org/academic/americanpresident/obama |access-date=January 23, 2009 |quote=Religion: Christian |archive-url=https://web.archive.org/web/20090123091100/http://millercenter.org/academic/americanpresident/obama |archive-date=January 23, 2009 |url-status=dead }}
* {{cite web |title=The Truth about Barack's Faith |publisher=Obama for America |url=http://www.fightthesmears.com/file_download/2/baracksfaith.pdf |access-date=July 1, 2012 |archive-date=January 5, 2011 |archive-url=https://web.archive.org/web/20110105040018/http://www.fightthesmears.com/file_download/2/baracksfaith.pdf }}
* {{cite news |last=Miller |first=Lisa |date=July 18, 2008 |title=Finding his faith |work=Newsweek |url=http://www.newsweek.com/id/145971 |access-date=February 4, 2010 |quote=He is now a Christian, having been baptized in the early 1990s at Trinity United Church of Christ in Chicago. |archive-url=https://web.archive.org/web/20100206163704/http://www.newsweek.com/id/145971 |archive-date=February 6, 2010 |url-status=live }}
* {{cite news |last=Barakat |first=Matthew |agency=Associated Press |date=November 17, 2008 |title=Obama's church choice likely to be scrutinized; D.C. churches have started extending invitations to Obama and his family |work=NBC News |url=https://www.nbcnews.com/id/27775757 |access-date=January 20, 2009 |quote=The United Church of Christ, the denomination from which Obama resigned when he left Wright's church, issued a written invitation to join a UCC denomination in Washington and resume his connections to the church. }}
* {{cite web |date=January 20, 2009 |title=Barack Obama, long time UCC member, inaugurated forty-fourth U.S. President |publisher=United Church of Christ |url=http://www.ucc.org/news/obama-inauguration.html |access-date=January 21, 2009 |quote=Barack Obama, who spent more than 20 years as a UCC member, is the forty-fourth President of the United States. |archive-url=https://web.archive.org/web/20090125002304/http://www.ucc.org/news/obama-inauguration.html |archive-date=January 25, 2009 |url-status=live }}
* {{cite news |last=Sullivan |first=Amy |date=June 29, 2009 |title=The Obama's find a church home—away from home |magazine=Time |url=http://www.time.com/time/nation/article/0,8599,1907610,00.html |access-date=February 5, 2010 |quote=instead of joining a congregation in Washington, D.C., he will follow in George W. Bush's footsteps and make his primary place of worship Evergreen Chapel, the nondenominational church at Camp David. |archive-date=April 4, 2010 |archive-url=https://web.archive.org/web/20100404153523/http://www.time.com/time/nation/article/0,8599,1907610,00.html |url-status=dead }}
* {{cite news |last=Kornblut |first=Anne E. |date=February 4, 2010 |title=Obama's spirituality is largely private, but it's influential, advisers say |newspaper=The Washington Post |page=A6 |url=https://www.washingtonpost.com/wp-dyn/content/article/2010/02/03/AR2010020303619.html |access-date=February 5, 2010 |quote=Obama prays privately{{nbs}}... And when he takes his family to Camp David on the weekends, a Navy chaplain ministers to them, with the daughters attending a form of Sunday school there. }}</ref>
<ref name="Occidental">{{cite news|last=Gordon |first=Larry |date=January 29, 2007 |title=Occidental recalls 'Barry' Obama |newspaper=Los Angeles Times |page=B1 |url=https://articles.latimes.com/2007/jan/29/local/me-oxy29 |access-date=May 12, 2010 |archive-url=https://web.archive.org/web/20100524102944/http://articles.latimes.com/2007/jan/29/local/me-oxy29 |archive-date=May 24, 2010 }}
* {{cite news|last=Possley |first=Maurice |date=March 30, 2007 |title=Activism blossomed in college |newspaper=Chicago Tribune |page=20 |url=https://www.chicagotribune.com/news/nationworld/chi-0703291042mar30-archive,0,1533921.story |access-date=May 12, 2010 |archive-url=https://web.archive.org/web/20101009204342/http://www.chicagotribune.com/news/nationworld/chi-0703291042mar30-archive%2C0%2C1533921.story |archive-date=October 9, 2010 |url-status=live }}
* {{cite news|last=Kovaleski |first=Serge F. |date=February 9, 2008 |title=Old friends say drugs played bit part in Obama's young life |newspaper=The New York Times |page=A1 |url=https://www.nytimes.com/2008/02/09/us/politics/09obama.html |archive-url=https://web.archive.org/web/20080211095352/http://www.nytimes.com/2008/02/09/us/politics/09obama.html |archive-date=February 11, 2008 |url-access=subscription |url-status=live |access-date=May 12, 2010 }}
* {{cite news|last=Rohter |first=Larry |date=April 10, 2008 |title=Obama says real-life experience trumps rivals' foreign policy credits |newspaper=The New York Times |page=A18 |url=https://www.nytimes.com/2008/04/10/us/politics/10obama.html |archive-url=https://web.archive.org/web/20080411041927/http://www.nytimes.com/2008/04/10/us/politics/10obama.html |archive-date=April 11, 2008 |url-access=subscription |url-status=live |access-date=May 12, 2010 }}
* {{cite news|author= Goldman, Adam |first2=Robert |last2=Tanner |agency=Associated Press |date=May 15, 2008 |title=Old friends recall Obama's years in LA, NYC |work=USA Today |url=https://www.usatoday.com/news/politics/2008-05-15-3144401415_x.htm |access-date=May 12, 2010 }}
* {{cite news|last=Helman |first=Scott |date=August 25, 2008 |title=Small college awakened future senator to service (subscription archive) |newspaper=The Boston Globe |page=1A |url=https://www.boston.com/news/politics/2008/articles/2008/08/25/small_college_awakened_future_senator_to_service/?page=full |access-date=May 12, 2010 }}
* {{cite news|last=Jackson |first=Brooks |date=June 5, 2009 |title=More 'birther' nonsense: Obama's 1981 Pakistan trip |publisher=FactCheck.org |url=http://www.factcheck.org/2009/06/more-birther-nonsense-obamas-1981-pakistan-trip |access-date=May 12, 2010 }}
* {{cite book |last = Remnick |first = David |year = 2010 |title = The Bridge: The Life and Rise of Barack Obama |place = New York |publisher = Alfred A. Knopf |pages = [https://archive.org/details/bridgelifeand00remn/page/98 98–112] |isbn = 978-1-4000-4360-6 |title-link = The Bridge: The Life and Rise of Barack Obama }}
* Obama (1995, 2004), pp. 92–112.
* Mendell (2007), pp. 55–62.</ref>
<ref name="Juris Doctor">{{cite web |url=https://news.harvard.edu/gazette/story/2008/11/obama-joins-list-of-seven-presidents-with-harvard-degrees/ |title=Obama joins list of seven presidents with Harvard degrees |date=November 6, 2008 |website=news.harvard.edu |access-date=October 23, 2017}} {{cite news |last = Adams |first = Richard |date = May 9, 2007 |title = Barack Obama |newspaper = The Guardian |place = London |url=https://www.theguardian.com/world/2007/may/09/barackobama.uselections20081 |access-date = October 26, 2008 |archive-url=https://web.archive.org/web/20081013083027/http://www.guardian.co.uk/world/2007/may/09/barackobama.uselections20081 |archive-date = October 13, 2008 |url-status=live }}</ref>
<ref name="Fellow">{{cite magazine |last = Merriner |first = James L. |date = June 2008 |title = The friends of O |magazine = Chicago |volume = 57 |issue = 6 |pages = 74–79, 97–99 |issn = 0362-4595 |url = http://www.chicagomag.com/Chicago-Magazine/June-2008/Obamas-Chicago-Posse/The-Friends-of-O/index.php?cp=2&si=1 |access-date = January 30, 2010 }}
* {{cite news |last = Zengerle |first = Jason |date = July 30, 2008 |title = Con law; What the University of Chicago right thinks of Obama |magazine = The New Republic |volume = 239 |issue = 1 |pages = 7–8 |url = http://www.tnr.com/article/con-law?id=86dd0277-c6ee-4e3c-83e9-0bb468c5c40d&p=1 |access-date = January 30, 2010 }}
* {{cite news |last = Kantor |first = Jodi |date = July 30, 2008 |title = Teaching law, testing ideas, Obama stood slightly apart |newspaper = The New York Times |page = A1 |url = https://www.nytimes.com/2008/07/30/us/politics/30law.html |access-date = January 30, 2010 }}
* {{cite news |last = Gray |first = Steven |date = September 10, 2008 |title = Taking professor Obama's class |magazine = Time |url = http://www.time.com/time/politics/article/0,8599,1835238-2,00.html |access-date = January 30, 2010 |archive-date = May 12, 2009 |archive-url = https://web.archive.org/web/20090512195322/http://www.time.com/time/politics/article/0,8599,1835238-2,00.html |url-status = dead }}
* {{cite news |last = Starr |first = Alexandra |date = September 21, 2008 |title = Case study |magazine = The New York Times Magazine |page = 76 |url = https://www.nytimes.com/2008/09/21/magazine/21obama-t.html |access-date = January 30, 2010 }}
* {{cite news |last = Hundley |first = Tom |date = March 22, 2009 |title = Ivory tower of power |magazine = Chicago Tribune Magazine |page = 6 |url = http://articles.chicagotribune.com/2009-03-22/features/0903200725_1_barack-obama-story-chicago-school-harvard-law |access-date = January 30, 2010 }}</ref>
<ref name="Forty">{{cite book |editor = White, Jesse |year = 2000 |title = Illinois Blue Book, 2000, Millennium ed |page = 83 |place = Springfield, IL |publisher = Illinois Secretary of State |url=http://www.sos.state.il.us/bb/toc.html |archive-date = April 16, 2004 |archive-url=https://web.archive.org/web/20040416120057/http://www.sos.state.il.us/bb/sec4_71_132.pdf |oclc = 43923973 |access-date = June 6, 2008 }}
* {{cite news |last = Jarrett |first = Vernon |date = August 11, 1992 |title = 'Project Vote' brings power to the people |work = Chicago Sun-Times |page = 23 |format = paid archive |url=http://nl.newsbank.com/nl-search/we/Archives?p_product=CSTB&p_theme=cstb&p_action=search&p_maxdocs=200&s_dispstring=(Vernon%20Jarrett)%20AND%20date(8/11/1992%20to%208/11/1992)&p_field_date-0=YMD_date&p_params_date-0=date:B,E&p_text_date-0=8/11/1992%20to%208/11/1992)&p_field_advanced-0=&p_text_advanced-0=(Vernon%20Jarrett)Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date = June 6, 2008 }}
* {{cite news |last = Reynolds |first = Gretchen |date = January 1993 |title = Vote of confidence |work = Chicago Magazine |volume = 42 |issue = 1 |pages = 53–54 |issn = 0362-4595 |url=http://www.chicagomag.com/Chicago-Magazine/January-1993/Vote-of-Confidence |access-date = June 6, 2008 |archive-url=https://web.archive.org/web/20080514183643/http://www.chicagomag.com/Chicago-Magazine/January-1993/Vote-of-Confidence |archive-date = May 14, 2008 |url-status=live }}
* {{cite news |last = Anderson |first = Veronica |date = October 3, 1993 |title = 40 under Forty: Barack Obama, Director, Illinois Project Vote |newspaper = Crain's Chicago Business |volume = 16 |issue = 39 |page = 43 |issn = 0149-6956 }}</ref>
<ref name="DavisMiner">{{cite news |last=Robinson |first=Mike |agency=Associated Press |date=February 20, 2007 |title=Obama got start in civil rights practice |newspaper=The Boston Globe |url=https://www.boston.com/news/education/higher/articles/2007/02/20/obama_got_start_in_civil_rights_practice |access-date=June 15, 2008 }}
* {{cite news |last=Pallasch |first=Abdon M. |date=December 17, 2007 |title=As lawyer, Obama was strong, silent type; He was 'smart, innovative, relentless,' and he mostly let other lawyers do the talking |newspaper=Chicago Sun-Times |page=4 |url=http://nl.newsbank.com/nl-search/we/Archives?p_product=CSTB&p_theme=cstb&p_action=search&p_maxdocs=200&s_dispstring=(Pallasch)_AND_date(12/17/2007_to_12/17/2007)&p_field_date-0=YMD_date&p_params_date-0=date:B,E&p_text_date-0=December_17,_2007_to_12/17/2007)&p_field_advanced-0=&p_text_advanced-0=(Pallasch)Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date=June 15, 2008 }}{{subscription required}}
* {{cite news |last=Morain |first=Dan |date=April 6, 2008 |title=Obama's law days effective but brief |newspaper=Los Angeles Times |page=A14 |url=https://articles.latimes.com/2008/apr/06/nation/na-obamalegal6 |access-date=February 14, 2010 }}
* {{cite news |date=June 27, 1993 |title=Document |newspaper=Chicago Tribune |page=9 (Business) |url=https://pqasb.pqarchiver.com/chicagotribune/access/24302659.html?dids=24302659:24302659&FMT=ABS&FMTS=ABS:FT |access-date=June 15, 2008 |archive-url=https://web.archive.org/web/20131204190346/https://pqasb.pqarchiver.com/chicagotribune/doc/283584889.html?FMT=ABS&FMTS=ABS%3AFT&type=current&date=&author=&pub=&edition=&startpage=&desc= |archive-date=December 4, 2013 |url-status=dead }}{{subscription required}}
* {{cite news |date=July 5, 1993 |title=Business appointments |newspaper=Chicago-Sun-Times |page=40 |url=http://nl.newsbank.com/nl-search/we/Archives?p_product=CSTB&p_theme=cstb&p_action=search&p_maxdocs=200&s_dispstring=(Business%20appointments)%20AND%20date(7/5/1993%20to%207/5/1993)&p_field_date-0=YMD_date&p_params_date-0=date:B,E&p_text_date-0=7/5/1993%20to%207/5/1993)&p_field_advanced-0=&p_text_advanced-0=(Business%20appointments)Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date=June 15, 2008 }}{{subscription required}}
* {{cite news |last=Ripley |first=Amanda |date=November 3, 2004 |title=Obama's ascent |magazine=Time |url=http://www.time.com/time/magazine/article/0,9171,750742,00.html |access-date=February 13, 2010 |archive-date=August 11, 2010 |archive-url=https://web.archive.org/web/20100811203732/http://www.time.com/time/magazine/article/0,9171,750742,00.html |url-status=dead }}
* {{cite web |year=2008 |title=About us |url=http://www.lawmbg.com/index.cfm/PageID/2711 |publisher=Miner, Barnhill & Galland—Chicago, Illinois |access-date=June 15, 2008 |archive-url=https://web.archive.org/web/20080720182856/http://www.lawmbg.com/index.cfm/PageID/2711 |archive-date=July 20, 2008 |url-status=dead }}
* {{cite news |last=Reardon |first=Patrick T. |date=June 25, 2008 |title=Obama's Chicago |newspaper=Chicago Tribune |page=1 (Tempo) |url=https://www.chicagotribune.com/travel/chi-obama-chicago-htmlstory,0,506256.htmlstory |access-date=February 13, 2010 }}
* Obama (1995, 2004), pp. 438–439.
* Mendell (2007), pp. 104–106.</ref>
<ref name="Democratic primary">{{cite web|url=http://www.fec.gov/pubrec/fe2000/ilh.htm |title=Federal Elections 2000: U.S. House Results—Illinois |publisher=[[Federal Election Commission]] |access-date=April 24, 2008 |archive-url=https://web.archive.org/web/20080328011936/http://www.fec.gov/pubrec/fe2000/ilh.htm |archive-date=March 28, 2008 |url-status=live }}
* {{cite news|url=https://www.npr.org/templates/story/story.php?storyId=14502364 |title=Obama's Loss May Have Aided White House Bid |last=Gonyea |first=Dan |date=September 19, 2007 |publisher=NPR |archive-url=https://web.archive.org/web/20110218211819/http://www.npr.org/templates/story/story.php?storyId=14502364 |archive-date=February 18, 2011 }}
* {{cite news|first=Janny |last=Scott |title=A Streetwise Veteran Schooled Young Obama |date=September 9, 2007 |url=https://www.nytimes.com/2007/09/09/us/politics/09obama.html |work=The New York Times |access-date=April 20, 2008 |archive-url=https://web.archive.org/web/20080321122541/http://www.nytimes.com/2007/09/09/us/politics/09obama.html |archive-date=March 21, 2008 |url-status=live }}
* {{cite news|first=Edward |last=McClelland |title=How Obama Learned to Be a Natural |date=February 12, 2007 |url=http://www.salon.com/news/feature/2007/02/12/obama_natural/ |work=Salon |access-date=April 20, 2008 |archive-url=https://web.archive.org/web/20080308133402/http://www.salon.com/news/feature/2007/02/12/obama_natural/ |archive-date=March 8, 2008 |url-status=live }}
* {{cite news|first1=Richard |last1=Wolffe |last2=Briscoe |first2=Daren |title=Across the Divide |date=July 16, 2007 |work=Newsweek |url=http://www.newsweek.com/id/33156 |access-date=April 20, 2008 |archive-url=https://web.archive.org/web/20080418014600/http://www.newsweek.com/id/33156 |archive-date=April 18, 2008 |url-status=live }}
* {{cite news|first=Scott |last=Helman |title=Early Defeat Launched a Rapid Political Climb |date=October 12, 2007 |url=https://www.boston.com/news/nation/articles/2007/10/12/early_defeat_launched_a_rapid_political_climb/ |work=The Boston Globe |access-date=April 20, 2008 }}
* {{cite news|url=https://www.usatoday.com/news/politics/2007-10-24-3157940059_x.htm |title=Obama learned from failed Congress run |work=USA Today |last=Wills |first=Christopher |date=October 24, 2007 |access-date=November 15, 2010 }}</ref>
<ref name="Rose Garden">{{cite web |author = Office of the Press Secretary |date = October 2, 2002 |title = President, House leadership agree on Iraq resolution |url=https://georgewbush-whitehouse.archives.gov/news/releases/2002/10/20021002-7.html |via = [[NARA|National Archives]] |work = [[whitehouse.gov]] |access-date = February 18, 2008 }}
* {{cite news |last = Tackett |first = Michael |date = October 3, 2002 |title = Bush, House OK Iraq deal; Congress marches with Bush |newspaper = Chicago Tribune |page = 1 |url=https://pqasb.pqarchiver.com/chicagotribune/access/203569641.html?dids=203569641:203569641&FMT=ABS&FMTS=ABS:FT |access-date = February 3, 2008 }}{{subscription required}}</ref>
<ref name="Federal Plaza">{{cite news |last = Glauber |first = Bill |date = October 3, 2003 |title = War protesters gentler, but passion still burns |newspaper = Chicago Tribune |page = 1 |url = https://pqasb.pqarchiver.com/chicagotribune/access/203569621.html?dids=203569621:203569621&FMT=ABS&FMTS=ABS:FT |access-date = February 3, 2008 |archive-date = June 17, 2008 |archive-url = https://web.archive.org/web/20080617150444/http://pqasb.pqarchiver.com/chicagotribune/access/203569621.html?dids=203569621:203569621&FMT=ABS&FMTS=ABS:FT |url-status = dead }}{{subscription required}}
* {{cite news |last = Strausberg |first = Chinta |date = October 3, 2002 |title = War with Iraq undermines U.N |newspaper = Chicago Defender |page = 1 |url = http://www.highbeam.com/doc/1P3-220379051.html |quote = Photo caption: Left Photo: Sen. Barack Obama along with Rev. Jesse Jackson spoke to nearly 3,000 anti-war protestors (below) during a rally at Federal Plaza Wednesday. |access-date = October 28, 2008 |archive-url = https://web.archive.org/web/20091014211715/http://www.highbeam.com/doc/1P3-220379051.html |archive-date = October 14, 2009 |url-status = dead }}
* {{cite web |last = Katz |first = Marilyn |date = October 2, 2007 |title = Five years since our first action |publisher = Chicagoans Against War & Injustice |url = http://www.noiraqwar-chicago.org/?p=127 |access-date = February 18, 2008 |archive-url = https://web.archive.org/web/20110721192331/http://www.noiraqwar-chicago.org/?p=127 |archive-date = July 21, 2011 }}
* {{cite news |last1 = Bryant |first1 = Greg |last2 = Vaughn |first2 = Jane B. |date = October 3, 2002 |title = 300 attend rally against Iraq war |newspaper = Daily Herald |page = 8 |url = http://nl.newsbank.com/nl-search/we/Archives?p_product=ADHB&p_theme=adhb&p_action=search&p_maxdocs=200&p_text_search-0=300%20AND%20attend%20AND%20rally%20AND%20against%20AND%20Iraq%20AND%20war&s_dispstring=300%20attend%20rally%20against%20Iraq%20war%20AND%20date(10/3/2002%20to%2010/3/2002)&p_field_date-0=YMD_date&p_params_date-0=date:B,E&p_text_date-0=10/3/2002%20to%2010/3/2002)Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date = October 28, 2008 }}{{subscription required}}
* Mendell (2007), pp. 172–177.</ref>
<ref name="spoke out">{{cite web |last = Obama |first = Barack |date = October 2, 2002 |title = Remarks of Illinois State Sen. Barack Obama against going to war with Iraq |url = http://www.barackobama.com/2002/10/02/remarks_of_illinois_state_sen.php |archive-url = https://web.archive.org/web/20080130204029/http://www.barackobama.com/2002/10/02/remarks_of_illinois_state_sen.php |archive-date = January 30, 2008 |publisher = Barack Obama |access-date = February 3, 2008 }}
* {{cite news |last = McCormick |first = John |date = October 3, 2007 |title = Obama marks '02 war speech; Contender highlights his early opposition in an effort to distinguish him from his rivals |newspaper = Chicago Tribune |page = 7 |url = https://pqasb.pqarchiver.com/chicagotribune/access/1351610621.html?dids=1351610621:1351610621&FMT=ABS&FMTS=ABS:FT |quote = The top strategist for Sen. Barack Obama has just 14 seconds of video of what is one of the most pivotal moments of the presidential candidate's political career. The video, obtained from a Chicago TV station, is of Obama's 2002 speech in opposition to the impending Iraq invasion. |access-date = October 28, 2008 |archive-date = December 18, 2008 |archive-url = https://web.archive.org/web/20081218011609/http://pqasb.pqarchiver.com/chicagotribune/access/1351610621.html?dids=1351610621:1351610621&FMT=ABS&FMTS=ABS:FT |url-status = dead }}{{Subscription required}}
* {{cite news |last = Pallasch |first = Abdon M. |date = October 3, 2007 |title = Obama touts anti-war cred; Kicks off tour 5 years after speech critical of going to Iraq |newspaper = Chicago Sun-Times |page = 26 |url = http://nl.newsbank.com/nl-search/we/Archives?p_product=CSTB&p_theme=cstb&p_action=search&p_maxdocs=200&s_dispstring=headline(Obama%20touts%20anti-war%20cred)%20AND%20date(all)&p_field_advanced-0=title&p_text_advanced-0=(Obama%20touts%20anti-war%20cred)Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date = October 28, 2008 }}{{subscription required}}</ref>
<ref name="stop the war">{{cite news |last = Ritter |first = Jim |date = March 17, 2003 |newspaper = Chicago Sun-Times |page = 3 |title = Anti-war rally here draws thousands |url=http://nl.newsbank.com/nl-search/we/Archives?p_product=CSTB&p_theme=cstb&p_action=search&p_maxdocs=200&s_dispstring=headline(Anti-war%20rally%20here%20draws%20thousands)%20AND%20date(all)&p_field_advanced-0=title&p_text_advanced-0=(Anti-war%20rally%20here%20draws%20thousands)Êl_numdocs=20&p_perpage=10&p_sort=YMD_date:DÊl_useweights=no |access-date = February 3, 2008 }} {{subscription required}}
* {{cite press release |author = Office of the Press Secretary |date = March 16, 2003 |title = President Bush: Monday 'moment of truth' for world on Iraq |url=https://georgewbush-whitehouse.archives.gov/news/releases/2003/03/20030316-3.html |via = [[NARA|National Archives]] |work = [[whitehouse.gov]] |access-date = February 18, 2008 }}</ref>
<ref name="future">{{cite news |last = Mendell |first = David |date = March 17, 2004 |title = Obama routs Democratic foes; Ryan tops crowded GOP field; Hynes, Hull fall far short across state |newspaper = Chicago Tribune |page = 1 |url=http://articles.chicagotribune.com/2004-03-17/news/0403170332_1_blair-hull-gery-chico-blacks-and-liberal-whites |access-date = March 1, 2009 }}
* {{cite news |last = Davey |first = Monica |date = March 18, 2004 |title = As quickly as overnight, a Democratic star is born |newspaper = The New York Times |page = A20 |url=https://www.nytimes.com/2004/03/18/us/as-quickly-as-overnight-a-democratic-star-is-born.html |archive-url=https://web.archive.org/web/20090506195833/http://www.nytimes.com/2004/03/18/us/as-quickly-as-overnight-a-democratic-star-is-born.html |archive-date=May 6, 2009 |url-access=subscription |url-status=live |access-date = March 1, 2009 }}
* {{cite news |last = Howlett |first = Debbie |date = March 19, 2004 |title = Dems see a rising star in Illinois Senate candidate |newspaper = USA Today |page = A04 |url=https://www.usatoday.com/news/politicselections/nation/2004-03-18-obama-usat_x.htm |access-date = March 1, 2009 }}
* {{cite news |last = Scheiber |first = Noam |date = May 31, 2004 |title = Race against history. Barack Obama's miraculous campaign |magazine = The New Republic |volume = 230 |issue = 20 |pages = 21–22, 24–26 (cover story) |url=http://www.tnr.com/article/race-against-history-0 |access-date = March 24, 2009 }}
* {{cite news |last = Finnegan |first = William |date = May 31, 2004 |title = The Candidate. How far can Barack Obama go? |magazine = The New Yorker |volume = 20 |issue = 14 |pages = 32–38 |url=https://www.newyorker.com/archive/2004/05/31/040531fa_fact1?currentPage=all |access-date = March 24, 2009 }}
* {{cite news |last = Dionne |first = E.J. Jr. |date = June 25, 2004 |title = In Illinois, a star prepares |newspaper = The Washington Post |page = A29 |url=https://www.washingtonpost.com/wp-dyn/articles/A4062-2004Jun24.html |access-date = March 24, 2009 }}
* {{cite news |last = Scott |first = Janny |date = May 18, 2008 |title = The story of Obama, written by Obama |newspaper = The New York Times |page = A1 |url=https://www.nytimes.com/2008/05/18/us/politics/18memoirs.html |access-date = January 9, 2010 }}
* Mendell (2007), pp. 235–259.</ref>
<ref name="status">{{cite news |date=August 2, 2004 |title=Star Power. Showtime: Some are on the rise; others have long been fixtures in the firmament. A galaxy of bright Democratic lights |work=Newsweek |pages=48–51 |url=http://www.newsweek.com/id/54728/output/print |access-date=November 15, 2008 |archive-url=https://web.archive.org/web/20081218014146/http://www.newsweek.com/id/54728/output/print |archive-date=December 18, 2008 |url-status=live }}
* {{cite news |last=Samuel |first=Terence |date=August 2, 2004 |title=A shining star named Obama. How a most unlikely politician became a darling of the Democrats |work=U.S. News & World Report |page=25 |url=https://www.usnews.com/usnews/news/articles/040802/2obama.htm |access-date=November 15, 2008 |archive-url=https://web.archive.org/web/20081206100640/http://www.usnews.com/usnews/news/articles/040802/2obama.htm |archive-date=December 6, 2008 |url-status=dead}}
* {{cite news |last=Lizza |first=Ryan |date=September 2004 |title=Why is Barack Obama generating more excitement among Democrats than John Kerry? |work=The Atlantic Monthly |pages=30, 33 |url=https://www.theatlantic.com/doc/200409/lizza |access-date=November 15, 2008 }}
* {{cite news |last=Davey |first=Monica |date=July 26, 2004 |title=A surprise Senate contender reaches his biggest stage yet |newspaper=The New York Times |page=A1 |url=https://www.nytimes.com/2004/07/26/us/the-speaker-a-surprise-senate-contender-reaches-his-biggest-stage-yet.html |archive-url=https://web.archive.org/web/20090507095649/http://www.nytimes.com/2004/07/26/us/the-speaker-a-surprise-senate-contender-reaches-his-biggest-stage-yet.html |archive-date=May 7, 2009 |url-access=subscription |url-status=live |access-date=November 25, 2010 }}
* {{cite news |last=Leibovich |first=Mark |date=July 27, 2004 |title=The other man of the hour |newspaper=The Washington Post |page=C1 |url=https://www.washingtonpost.com/wp-dyn/articles/A16606-2004Jul26.html |access-date=November 15, 2008 }}
* {{cite news |last=Milligan |first=Susan |date=July 27, 2004 |title=In Obama, Democrats see their future |work=The Boston Globe |page=B8 |url=https://www.boston.com/news/local/articles/2004/07/27/in_obama_democrats_see_their_future/ |access-date=November 15, 2008 |archive-url=https://web.archive.org/web/20081218181835/http://www.boston.com/news/local/articles/2004/07/27/in_obama_democrats_see_their_future/ |archive-date=December 18, 2008 |url-status=live }}
* {{cite news |last=Seelye |first=Katharine Q. |date=July 28, 2004 |title=Illinois Senate nominee speaks of encompassing unity |newspaper=The New York Times |page=A1 |url=https://www.nytimes.com/2004/07/28/politics/campaign/28blacks.html |archive-url=https://web.archive.org/web/20060624052131/http://www.nytimes.com/2004/07/28/politics/campaign/28blacks.html |archive-date=June 24, 2006}}
* {{cite news |last=Broder |first=David S. |date=July 28, 2004 |title=Democrats focus on healing divisions; Addressing convention, newcomers set themes |newspaper=The Washington Post |page=A1 |url=https://www.washingtonpost.com/wp-dyn/articles/A17865-2004Jul27.html |access-date=November 15, 2008}}
* {{cite news |last1=Bing |first1=Jonathan |last2=McClintock |first2=Pamela |date=July 29, 2004 |title=Auds resist charms of Dem stars |work=Variety |page=1 |url=https://www.variety.com/article/VR1117908388.html |access-date=November 15, 2008}}
* Mendell (2007), pp. 272–285.</ref>
<ref name="margin">{{cite news |year = 2005 |title = America Votes 2004: U.S. Senate / Illinois |publisher = CNN |url=http://www.cnn.com/ELECTION/2004/pages/results/states/IL/S/01/index.html |access-date = April 13, 2008 |archive-url=https://web.archive.org/web/20080416061340/http://www.cnn.com/ELECTION/2004//pages/results/states/IL/S/01/index.html |archive-date = April 16, 2008 |url-status=live }}
* {{cite news |last = Slevin |first = Peter |date = November 13, 2007 |title = For Obama, a handsome payoff in political gambles |newspaper = The Washington Post |page = A3 |url=https://www.washingtonpost.com/wp-dyn/content/article/2007/11/12/AR2007111201945.html |access-date = April 13, 2008 }}
* {{cite news |last1 = Chase |first1 = John |last2 = Mendell |first2 = David |date = November 3, 2004 |title = Obama scores a record landslide |newspaper = Chicago Tribune |page = 1 |url=http://www.noticiasdot.com/publicaciones/2004/1104/0311/noticias031104/presidenciales-usa/images/usa/chicago_tribune/chicago_tribune_031104.pdf |access-date = April 3, 2009 |url-status=dead |archive-url=https://web.archive.org/web/20110513095857/http://www.noticiasdot.com/publicaciones/2004/1104/0311/noticias031104/presidenciales-usa/images/usa/chicago_tribune/chicago_tribune_031104.pdf |archive-date = May 13, 2011 }}
* {{cite news |last = Fornek |first = Scott |date = November 3, 2004 |title = Obama takes Senate seat in a landslide |newspaper = Chicago Sun-Times |page = 6 |url=http://www.highbeam.com/doc/1P2-1553596.html |access-date = April 3, 2009 |archive-url=https://web.archive.org/web/20130510061848/http://www.highbeam.com/doc/1P2-1553596.html |archive-date = May 10, 2013 |url-status=dead }}</ref>
* {{cite news |first = Tom |last = Curry |title = What Obama's Senate Votes Reveal |date = February 21, 2008 |url=https://www.nbcnews.com/id/23276453 |work = NBC News |access-date = June 25, 2008 }}
* {{cite news|url=http://nj.nationaljournal.com/voteratings/ |title=Obama: Most Liberal Senator In 2007 |work=National Journal |date=January 31, 2008 |access-date=June 25, 2008 |archive-url=https://web.archive.org/web/20080627040734/http://nj.nationaljournal.com/voteratings/ |archive-date=June 27, 2008 |url-status=dead }}
<ref name="transition period">{{cite news |url=https://www.reuters.com/article/politicsNews/idUSTRE4AF1MJ20081116 |title = Obama resigns Senate seat, thanks Illinois |access-date = March 10, 2009 |date = November 16, 2008 |work = [[Reuters]] |last = Mason |first = Jeff }}</ref>
* {{cite news |url=http://www.time.com/time/nation/article/0,8599,1859020,00.html |title=Obama to Resign Senate Seat on Sunday |access-date=November 22, 2008 |date=November 13, 2008 |magazine=Time |last=Sidoti |first=Liz |archive-url=https://web.archive.org/web/20081122143031/http://www.time.com/time/nation/article/0%2C8599%2C1859020%2C00.html |archive-date=November 22, 2008 |url-status=dead}}
<ref name="nuclear terrorism">{{cite press release |title = Obama, Schiff Provision to Create Nuclear Threat Reduction Plan Approved |date = December 20, 2007 |url=http://obama.senate.gov/press/071220-obama_schiff_pr/ |publisher = Barack Obama U.S. Senate Office |archive-url=https://web.archive.org/web/20081218154751/http://obama.senate.gov/press/071220-obama_schiff_pr/ |archive-date = December 18, 2008 }}</ref>
<ref name="Kenyan">{{cite news |first=Christina |last=Larson |title=Hoosier Daddy: What Rising Democratic Star Barack Obama Can Learn from an Old Lion of the GOP |date=September 2006 |url=http://www.washingtonmonthly.com/features/2006/0609.larson.html |work=Washington Monthly |access-date=April 27, 2008 |archive-url=https://web.archive.org/web/20080430232404/http://www.washingtonmonthly.com/features/2006/0609.larson.html |archive-date=April 30, 2008 |url-status=dead }}
* {{cite news |first=Chuck |last=Goudie |title=Obama Meets with Arafat's Successor |date=January 12, 2006 |url=http://a.abclocal.go.com/wls/story?section=news/local&id=3806933 |publisher=[[WLS-TV]] |location=Chicago |access-date=April 27, 2008 |archive-url=https://web.archive.org/web/20141103231711/http://a.abclocal.go.com/wls/story?section=news%2Flocal&id=3806933 |archive-date=November 3, 2014 |url-status=dead }}
* {{cite news |title=Obama Slates Kenya for Fraud |date=August 28, 2006 |url=http://www.news24.com/News24/Africa/News/0,,2-11-1447_1989646,00.html |archive-url=https://web.archive.org/web/20080605213213/http://www.news24.com/News24/Africa/News/0%2C%2C2-11-1447_1989646%2C00.html |archive-date=June 5, 2008 |publisher=News24 |location=Cape Town |access-date=April 27, 2008 |url-status=dead }}
* {{cite news |first=Chris |last=Wamalwa |title=Envoy Hits at Obama Over Graft Remark |date=September 2, 2006 |url=http://www.eastandard.net/archives/cl/hm_news/news.php?articleid=1143957666 |archive-url=https://web.archive.org/web/20071010050740/http://www.eastandard.net/archives/cl/hm_news/news.php?articleid=1143957666 |archive-date=October 10, 2007 |work=The Standard (Nairobi) |access-date=April 27, 2008 }}
* {{cite news |first1=Vincent |last1=Moracha |first2=Mangoa |last2=Mosota |title=Leaders Support Obama on Graft Claims |date=September 4, 2006 |url=http://www.eastandard.net/archives/cl/hm_news/news.php?articleid=1143957752 |archive-url=https://web.archive.org/web/20071007115436/http://www.eastandard.net/archives/cl/hm_news/news.php?articleid=1143957752 |archive-date=October 7, 2007 |work=The Standard |location=Nairobi }}</ref>
<ref name="allocation">{{cite news|url=http://www.time.com/time/politics/article/0,8599,1738331,00.html |title=The Five Mistakes Clinton Made |author=Tumulty, Karen |author-link=Karen Tumulty |magazine=Time |date=May 8, 2008 |access-date=November 11, 2008 |archive-url=https://web.archive.org/web/20081211125310/http://www.time.com/time/politics/article/0%2C8599%2C1738331%2C00.html |archive-date=December 11, 2008 |url-status=dead }}
* {{cite news|url=https://www.nytimes.com/2008/06/08/us/politics/08recon.html |title=The Long Road to a Clinton Exit |first1=Peter |last1=Baker |first2=Jim |last2=Rutenberg |work=The New York Times |date=June 8, 2008 |access-date=November 29, 2008 |archive-url=https://web.archive.org/web/20081209030041/http://www.nytimes.com/2008/06/08/us/politics/08recon.html |archive-date=December 9, 2008 |url-status=live }}</ref>
<ref name="acceptance">{{cite news |title = Obama accepts Democrat nomination |url=http://news.bbc.co.uk/2/hi/americas/7586375.stm |work = BBC News |date = August 29, 2008 |access-date = August 29, 2008 |archive-url=https://web.archive.org/web/20080828234350/http://news.bbc.co.uk/2/hi/americas/7586375.stm |archive-date = August 28, 2008 |url-status=live }}
* {{cite news |url=http://www.csmonitor.com/USA/Politics/2008/0829/soaring-speech-from-obama-plus-some-specifics |title = Soaring speech from Obama, plus some specifics |work = The Christian Science Monitor |author = Marks, Alexandra |date = August 29, 2008 |archive-url=https://web.archive.org/web/20100314121702/http://www.csmonitor.com/USA/Politics/2008/0829/soaring-speech-from-obama-plus-some-specifics |archive-date = March 14, 2010 }}</ref>
<ref name="small donations">{{cite news|first=Jim |last=Malone |title=Obama Fundraising Suggests Close Race for Party Nomination |date=July 2, 2007 |url=http://www.voanews.com/english/archive/2007-07/2007-07-02-voa52.cfm |archive-url=https://web.archive.org/web/20070914032004/http://voanews.com/english/archive/2007-07/2007-07-02-voa52.cfm |archive-date=September 14, 2007 |publisher=Voice of America }}
* {{cite news|first=Jeanne |last=Cummings |title=Small Donors Rewrite Fundraising Handbook |date=September 26, 2007 |url=http://dyn.politico.com/printstory.cfm?uuid=3ECB3515-3048-5C12-004D622CB6F4E214 |work=Politico |access-date=January 14, 2008 |archive-url=https://web.archive.org/web/20080201140941/http://dyn.politico.com/printstory.cfm?uuid=3ECB3515-3048-5C12-004D622CB6F4E214 |archive-date=February 1, 2008 |url-status=dead }}
* {{cite news|first=Emily |last=Cadei |title=Obama Outshines Other Candidates in January Fundraising |date=February 21, 2008 |url=http://www.cqpolitics.com/wmspage.cfm?docID=news-000002674309 |publisher=CQ Politics |archive-url=https://web.archive.org/web/20080613213513/http://www.cqpolitics.com/wmspage.cfm?docID=news-000002674309 |archive-date=June 13, 2008 }}</ref>
<ref name="presidential debates">{{cite press release |url=http://www.debates.org/pages/news_111907.html |archive-url=https://web.archive.org/web/20080706070658/http://www.debates.org/pages/news_111907.html |archive-date = July 6, 2008 |title = Commission on Presidential Debates Announces Sites, Dates, Formats and Candidate Selection Criteria for 2008 General Election |publisher = [[Commission on Presidential Debates]] |date = November 19, 2007 }}
* {{cite news |access-date = July 6, 2008 |url=http://www.courant.com/topic/ |title = Gun Ruling Reverberates |work = [[Hartford Courant]] |date = June 27, 2008 |archive-url=https://web.archive.org/web/20080705225819/http://www.courant.com/topic/ |archive-date = July 5, 2008 |url-status=live }}</ref>
<ref name="electoral votes">{{cite news |work = NBC News |access-date = February 20, 2009 |date = November 4, 2008 |url=https://www.nbcnews.com/id/27531033 |title = Barack Obama elected 44th president |author = Johnson, Alex }}
* {{cite news |url=http://www.cnn.com/ELECTION/2008/results/president/ |title = CNN Electoral Map Calculator—Election Center 2008 |publisher = CNN |year = 2008 |access-date = December 14, 2008 |archive-url=https://web.archive.org/web/20081212014309/http://www.cnn.com/ELECTION/2008/results/president/ |archive-date = December 12, 2008 |url-status=live }}</ref>
<ref name="direct assistance">{{cite news |url=http://stimulus.org/ |title = Committee for a Responsible Federal Budget, Stimulus Watch |access-date = April 9, 2011 }}
* {{cite news |url=http://www.cnn.com/2009/POLITICS/02/17/obama.stimulus.remarks/ |title = Obama's remarks on signing the stimulus plan |access-date = February 17, 2009 |publisher = CNN |date = February 17, 2009 |archive-url=https://web.archive.org/web/20090220074825/http://www.cnn.com/2009/POLITICS/02/17/obama.stimulus.remarks/ |archive-date = February 20, 2009 |url-status=live }}</ref>
<ref name="markets opened">{{cite news |title = U.S. Expands Plan to Buy Banks' Troubled Assets |date = March 23, 2009 |work = The New York Times |url=https://www.nytimes.com/2009/03/24/business/economy/24bailout.html |archive-url=https://web.archive.org/web/20090325043723/http://www.nytimes.com/2009/03/24/business/economy/24bailout.html |archive-date=March 25, 2009 |url-access=subscription |url-status=live |first1 = Edmund L. |last1 = Andrews |first2 = Eric |last2 = Dash |access-date = April 12, 2010 }}
* {{cite news |title = Wall Street soars 7% on bank plan debut |date = March 23, 2009 |work = Reuters |url=https://www.reuters.com/article/businessNews/idUSTRE52H2FA20090323 }}</ref>
<ref name="preceding administration">{{cite news|title=Biden vows break with Bush era foreign policy |url=http://www.canada.com/news/unveils+changes+foreign+policy/1265065/story.html |access-date=January 31, 2013 |first1=Ross |last1=Colvin |first2=Noah |last2=Barkin |publisher=Canada.com |location=Toronto |date=February 7, 2009 |archive-url=https://web.archive.org/web/20121106164443/http://www.canada.com/news/unveils%2Bchanges%2Bforeign%2Bpolicy/1265065/story.html |archive-date=November 6, 2012 |url-status=dead }}
* {{cite news|first=Kim |last=Ghattas |title=Clinton's gaffes and gains on tour |url=http://news.bbc.co.uk/2/hi/americas/7931699.stm |access-date=June 15, 2009 |work=BBC News |date=March 8, 2009 }}</ref>
<ref name="middleeast">{{cite news |url=http://www.cnn.com/2009/POLITICS/06/04/egypt.obama.speech |title = Obama in Egypt reaches out to Muslim world |date = June 4, 2009 |publisher = CNN |access-date = January 30, 2011 }}</ref>
* {{cite news |first1 = Jeff |last1 = Zeleny |first2 = Alan |last2 = Cowell |url=https://www.nytimes.com/2009/06/05/world/middleeast/05prexy.html |title = Addressing Muslims, Obama Pushes Mideast Peace |work = The New York Times |date = June 4, 2009 |archive-url=https://web.archive.org/web/20110331161401/http://www.nytimes.com/2009/06/05/world/middleeast/05prexy.html|archive-date=March 31, 2011 }}
* {{cite web |url=https://obamawhitehouse.archives.gov/blog/The-President-in-the-Middle-East/ |title = The President in the Middle East |date = June 3, 2009 |first = Jesse |last = Lee |via=[[NARA|National Archives]] |work=[[whitehouse.gov]] |access-date = June 4, 2009 }}
<ref name="counterinsurgency tactics">{{cite news |url=https://www.washingtonpost.com/wp-dyn/content/article/2009/05/11/AR2009051101864.html |title = Top U.S. Commander in Afghanistan Is Fired |date = May 12, 2009 |newspaper = The Washington Post }}
* {{cite news |url=http://www.foxnews.com/politics/2009/05/13/new-commander-brings-counterinsurgency-experience-afghanistan/ |title = New U.S. Commander Brings Counterinsurgency Experience to Afghanistan |date = May 13, 2009 |publisher = Fox News |access-date = May 30, 2012 |archive-url=https://web.archive.org/web/20120216024227/http://www.foxnews.com/politics/2009/05/13/new-commander-brings-counterinsurgency-experience-afghanistan/ |archive-date = February 16, 2012 |url-status=dead }}</ref>
<ref name="exceptional orator">{{cite news |url=http://www.theage.com.au/world/a-classic-orator-obama-learnt-from-the-masters-20081129-6nf1.html |title = Obama: Oratory and originality |last = Holmes |first = Stephanie |date = November 30, 2008 |access-date = December 11, 2008 |work = The Age |location = Melbourne |archive-url=https://web.archive.org/web/20081218154747/http://www.theage.com.au/world/a-classic-orator-obama-learnt-from-the-masters-20081129-6nf1.html |archive-date = December 18, 2008 |url-status=live }}
* {{cite news |url=http://www.businessweek.com/smallbiz/content/mar2008/sb2008033_156351.htm |title = How to Inspire People Like Obama Does |last = Gallo |first = Carmine |date = March 3, 2008 |access-date = February 21, 2009 |work = Bloomberg BusinessWeek |archive-url=https://web.archive.org/web/20090226003326/http://www.businessweek.com/smallbiz/content/mar2008/sb2008033_156351.htm |archive-date = February 26, 2009 |url-status=live }}
* {{cite news |url=https://www.thestar.com/living/article/551538 |title = New emotion dubbed 'elevation' |date = December 11, 2008 |work = Toronto Star |access-date = December 11, 2008 |first = Diana |last = Zlomislic |archive-url=https://web.archive.org/web/20081212193736/http://www.thestar.com/living/article/551538 |archive-date = December 12, 2008 |url-status=live }}
* {{cite news |title = Obama Is America's Third Greatest Presidential Orator in Modern Era |url=https://www.huffingtonpost.com/richard-greene/obama-is-americas-3rd-gre_b_813868.html |date = January 25, 2011 |first = Richard |last = Greene |work = [[The Huffington Post]] |access-date = July 2, 2011 }}</ref>
<ref name="in Jakarta">{{cite web |title = Obama's Indonesian Redux |url=http://languagelog.ldc.upenn.edu/nll/?p=1025 |author = Zimmer, Benjamin |year = 2009 |access-date = March 12, 2009 |publisher = Language Log |archive-url=https://web.archive.org/web/20090303094040/http://languagelog.ldc.upenn.edu/nll/?p=1025 |archive-date = March 3, 2009 |url-status=live }}
* {{cite news |url=http://cetak.kompas.com/read/xml/2008/11/26/00223862/obama.saya.kangen.nasi.goreng.bakso.dan.rambutan |title = Obama: Saya Kangen Nasi Goreng, Bakso, dan Rambutan |work = [[Kompas]] |date = November 26, 2008 |archive-url=https://web.archive.org/web/20081203010718/http://cetak.kompas.com/read/xml/2008/11/26/00223862/obama.saya.kangen.nasi.goreng.bakso.dan.rambutan |archive-date = December 3, 2008 |language = id }}</ref>
<ref name="corruption charges">{{cite news |url=https://www.washingtonpost.com/wp-dyn/content/article/2006/12/16/AR2006121600729.html |title = Obama says he regrets land deal with fundraiser |newspaper = The Washington Post |date = December 17, 2006 |access-date = June 10, 2008 |last = Slevin |first = Peter }}
* {{cite news |url=https://www.nbcnews.com/id/24973282 |title = Rezko found guilty in corruption case |access-date = June 24, 2008 |date = June 4, 2008 |agency = Associated Press |work = NBC News |last = Robinson |first = Mike }}</ref>
<ref name="social change">Obama (2006), pp. 202–208. Portions excerpted in: {{cite news|first=Barack |last=Obama |title=My Spiritual Journey |date=October 16, 2006 |url=http://www.time.com/time/magazine/article/0,9171,1546579,00.html |magazine=Time |access-date=April 28, 2008 |archive-url=https://web.archive.org/web/20080430051154/http://www.time.com/time/magazine/article/0%2C9171%2C1546579%2C00.html |archive-date=April 30, 2008 |url-status=dead }}
* {{cite web|url=http://obama.senate.gov/speech/060628-call_to_renewal/ |title='Call to Renewal' Keynote Address |access-date=June 16, 2008 |last=Obama |first=Barack |date=June 28, 2006 |publisher=Barack Obama: U.S. Senator for Illinois |archive-url=https://web.archive.org/web/20090104231501/http://obama.senate.gov/speech/060628-call_to_renewal/ |archive-date=January 4, 2009 }}</ref>
<ref name="Trinity">{{cite news |last1 = Garrett |first1 = Major |last2 = Obama |first2 = Barack |date = March 14, 2008 |title = Obama talks to Major Garrett on 'Hannity & Colmes' |publisher = RealClearPolitics |url=http://www.realclearpolitics.com/articles/2008/03/obama_talks_to_major_garrett_o.html |access-date = November 10, 2012 |quote = Major Garrett, Fox News correspondent: So the first question, how long have you been a member in good standing of that church? Sen. Barack Obama (D-IL), presidential candidate: You know, I've been a member since 1991 or '92. And—but I have known Trinity even before then when I was a community organizer on the South Side, helping steel workers find jobs{{nbs}}... Garrett: As a member in good standing, were you a regular attendee of Sunday services? Obama: You know, I won't say that I was a perfect attendee. I was regular in spurts, because there was times when, for example, our child had just been born, our first child. And so we didn't go as regularly then. }}
* {{cite news |agency = Associated Press |date = April 29, 2008 |title = Obama strongly denounces former pastor |work = NBC News |url=https://www.nbcnews.com/id/24371827 |access-date = November 10, 2012 |quote = I have been a member of Trinity United Church of Christ since 1992, and have known Reverend Wright for 20 years. The person I saw yesterday was not the person [whom] I met 20 years ago. }}
* {{cite news |last = Miller |first = Lisa |date = July 11, 2008 |title = Finding his faith |work = Newsweek |url=http://www.thedailybeast.com/newsweek/2008/07/11/finding-his-faith.html |access-date = November 10, 2012 |quote = He is now a Christian, having been baptized in the early 1990s at Trinity United Church of Christ in Chicago. |archive-url=https://web.archive.org/web/20130720055213/http://www.thedailybeast.com/newsweek/2008/07/11/finding-his-faith.html |archive-date = July 20, 2013 |url-status=dead }}
* {{cite book |last = Remnick |first = David |year = 2010 |title = The Bridge: The Life and Rise of Barack Obama |location = New York |publisher = Alfred A. Knopf |page = [https://archive.org/details/bridgelifeand00remn/page/177 177] |isbn = 978-1-4000-4360-6 |quote = In late October 1987, his third year as an organizer, Obama went with Kellman to a conference on the black church and social justice at the Harvard Divinity School. |title-link = The Bridge: The Life and Rise of Barack Obama }}
* Maraniss (2012), <span class="plainlinks">[https://books.google.com/books?id=Wnna9CLtblAC&pg=PT887 p. 557]</span>: It would take time for Obama to join and become fully engaged in Wright's church, a place where he would be baptized and married; that would not happen until later, during his second time around in Chicago, but the process started then, in October 1987{{nbs}}... Jerry Kellman: "He wasn't a member of the church during those first three years, but he was drawn to Jeremiah."
* {{Cite book |first=Baker |last=Peter |author-link=Peter Baker (author) |year=2017 |title=Obama: The Call of History |location=New York |publisher=[[The New York Times Company]]/Callaway |isbn=978-0-935112-90-0 |oclc=1002264033}}</ref>
</references>
===Works cited===
{{Refbegin|30em|indent=yes}}
* {{cite book |last = Jacobs |first = Sally H. |year = 2011 |title = The Other Barack: The Bold and Reckless Life of President Obama's Father |location = New York |publisher = [[PublicAffairs]] |isbn = 978-1-58648-793-5 |title-link = The Other Barack: The Bold and Reckless Life of President Obama's Father }}
* {{cite book |author = Maraniss, David |year = 2012 |title = Barack Obama: The Story |location = New York |publisher = [[Simon & Schuster]] |isbn = 978-1-4391-6040-4 |title-link = Barack Obama: The Story |author-link = David Maraniss }}
* {{cite book |author = Mendell, David |year = 2007 |title = Obama: From Promise to Power |location = New York |publisher = Amistad/[[HarperCollins]] |isbn = 978-0-06-085820-9 |title-link = Obama: From Promise to Power |author-link = David Mendell }}
* {{cite book |last = Obama |first = Barack |orig-date = 1st pub. 1995 |year = 2004 |title = Dreams from My Father: A Story of Race and Inheritance |location = New York |publisher = [[Three Rivers Press]] |isbn = 978-1-4000-8277-3 |title-link = Dreams from My Father }}
* {{cite book |last = Obama |first = Barack |year = 2006 |title = The Audacity of Hope: Thoughts on Reclaiming the American Dream |location = New York |publisher = [[Crown Publishing Group]] |isbn = 978-0-307-23769-9 |title-link = The Audacity of Hope }}
* {{cite book |last = Scott |first = Janny |year = 2011 |title = A Singular Woman: The Untold Story of Barack Obama's Mother |location = New York |publisher = [[Riverhead Books]] |isbn = 978-1-59448-797-2 |title-link = A Singular Woman: The Untold Story of Barack Obama's Mother }}
{{Refend}}
==Further reading==
{{Refbegin|30em|indent=yes}}
* {{cite news |last = De Zutter |first = Hank |date = December 8, 1995 |title = What Makes Obama Run? |url=http://www.chicagoreader.com/chicago/what-makes-obama-run/Content?oid=889221 |newspaper = Chicago Reader |access-date = April 25, 2015 }}
* {{cite magazine|last=Graff |first=Garrett M. |date=November 1, 2006 |title=The Legend of Barack Obama |url=http://www.washingtonian.com/articles/mediapolitics/1836.html |magazine=Washingtonian |access-date=January 14, 2008 |url-status=dead |archive-url=https://web.archive.org/web/20080214141924/http://www.washingtonian.com/articles/mediapolitics/1836.html |archive-date=February 14, 2008 }}
* Kenny, Mary. "Obama shaped more by his WASP heritage than the passion of Martin Luther King," [https://www.independent.ie/opinion/columnists/obama-shaped-more-by-his-wasp-heritage-than-the-passion-of-martin-luther-king-30568999.html ''Independent.ie'' (September 7, 2014)]
* {{cite book |last = Koltun |first = Dave |editor-last1 = Ahuja |editor-first1 = Sunil |editor-last2 = Dewhirst |editor-first2 = Robert |year = 2005 |title = The Road to Congress 2004 |chapter = The 2004 Illinois Senate Race: Obama Wins Open Seat and Becomes National Political "Star" |location = Hauppauge, New York |publisher = Nova Science Publishers |isbn = 978-1-59454-360-9 }}
* {{cite magazine |last = Lizza |first = Ryan |date = September 2007 |title = Above the Fray |url=https://www.gq.com/news-politics/newsmakers/200708/obama-barack-election-president |magazine = GQ |access-date = October 27, 2010 }}
* {{cite magazine |first = Larissa |last = MacFarquhar |date = May 7, 2007 |title = The Conciliator: Where is Barack Obama Coming From? |url=https://www.newyorker.com/reporting/2007/05/07/070507fa_fact_macfarquhar |magazine = The New Yorker |access-date = January 14, 2008 |author-link = Larissa MacFarquhar }}
* {{cite book |last = McClelland |first = Edward |year = 2010 |title = Young Mr. Obama: Chicago and the Making of a Black President |location = New York |publisher = Bloomsbury Press |isbn = 978-1-60819-060-7 |url-access = registration |url=https://archive.org/details/youngmrobamachic0000mccl }}
* Parmar, Inderjeet and Mark Ledwidge. "...'a foundation-hatched black': Obama, the US establishment, and foreign policy." ''International Politics'' 54.3 (2017): 373-388 [https://openaccess.city.ac.uk/id/eprint/12563/1/ online]
{{Refend}}
==External links==
{{Library resources box|by=yes|onlinebooks=yes|viaf=52010985}}
<!--
Please keep this section brief and simple to navigate. Specific pages already referenced within the article should not be repeated here.
-->
===Official===
* {{Official website|https://www.obama.org/}} of The Obama Foundation
* {{Official website|https://www.obamalibrary.gov/}} of the Barack Obama Presidential Library
* {{Official website|https://www.ofa.us/}} of [[Organizing for Action]]
* [https://www.whitehouse.gov/about-the-white-house/presidents/barack-obama/ White House biography]
<!--
Do not add YouTube, MySpace, Twitter et al. There are MANY and all are linked from the campaign site.
-->
===Other===
* [https://www.huffingtonpost.com/author/barack-obama Column archive] at ''[[HuffPost|The Huffington Post]]''
* {{Curlie|Regional/North_America/United_States/Government/Executive_Branch/President/POTUS_Barack_Obama}}
* {{CongBio|O000167}}
* {{C-SPAN|55625}}
* {{NYT topic|people/o/barack_obama}}
* {{ChicagoTribuneKeyword}}
* {{Gutenberg author | id=Obama,+Barack | name=Barack Obama}}
* {{Internet Archive author | name=Barack Obama}}
* {{Librivox author |id=11252}}
* {{Nobelprize}}
* [https://www.politifact.com/personalities/barack-obama/ Barack Obama] at [[Politifact]]
{{Barack Obama}}
{{US presidents}}
{{Navboxes top
|title = Offices and distinctions
}}
{{s-start}}
{{s-par|us-il-sen}}
{{s-bef|before=[[Alice Palmer (politician)|Alice Palmer]]}}
{{s-ttl|title=Member of the [[Illinois Senate]]{{break}}from the 13th district|years=1997–2004}}
{{s-aft|after=[[Kwame Raoul]]}}
{{s-ppo}}
{{s-bef|before=[[Carol Moseley Braun]]}}
{{s-ttl|title=[[Democratic Party (United States)|Democratic]] nominee for [[U.S. Senator from Illinois]]{{break}}([[Classes of United States senators|Class 3]])|years=[[2004 United States Senate election in Illinois|2004]]}}
{{s-aft|after=[[Alexi Giannoulias]]}}
{{s-bef|before=[[Harold Ford Jr.]]}}
{{s-ttl|title=Keynote Speaker of the [[Democratic National Convention]]|years=[[2004 Democratic National Convention|2004]]}}
{{s-aft|after=[[Mark Warner]]}}
{{s-bef|before=[[John Kerry]]}}
{{s-ttl|title=[[Democratic Party (United States)|Democratic]] [[List of United States Democratic Party presidential tickets|nominee]] for President of the United States|years=[[2008 United States presidential election|2008]], [[2012 United States presidential election|2012]]}}
{{s-aft|after=[[Hillary Clinton]]}}
{{s-par|us-sen}}
{{s-bef|before=[[Peter Fitzgerald (politician)|Peter Fitzgerald]]}}
{{s-ttl|title=[[List of United States senators from Illinois|United States Senator (Class 3) from Illinois]]|years=2005–2008|alongside=[[Dick Durbin]]}}
{{s-aft|after=[[Roland Burris]]}}
{{s-off|usa}}
{{s-bef|before=[[George W. Bush]]}}
{{s-ttl|title=[[President of the United States]]|years=2009–2017}}
{{s-aft|after=[[Donald Trump]]}}
{{s-ach}}
{{s-bef|before=[[Martti Ahtisaari]]}}
{{s-ttl|title=[[Nobel Peace Prize]] Laureate|years=2009}}
{{s-aft|after=[[Liu Xiaobo]]}}
{{s-prec|usa}}
{{s-bef|before=[[George W. Bush]]|as=former president}}
{{s-ttl|title=[[United States order of precedence|Order of precedence of the United States]]{{break}}''former president''|years=}}
{{s-aft|after=[[Donald Trump]]|as=former president}}
{{s-dip}}
{{s-bef|before=[[Gordon Brown]]}}
{{s-ttl|title=Chairperson of the [[G20|Group of 20]]|years=2009}}
{{s-aft|after=[[Stephen Harper]]}}
{{s-end}}
{{navboxes bottom}}
{{Navboxes top
|title = Articles related to Barack Obama
}}
{{2008 United States presidential election}}
{{2012 United States presidential election}}
{{Democratic Party (United States)}}
{{United States senators from Illinois}}
{{USCongRep-start|congresses= 109th–110th [[United States Congress]]es |state=[[Illinois]]}}
{{USCongRep/IL/109}}
{{USCongRep/IL/110}}
{{USCongRep-end}}
{{Patriot Act}}
{{Time Persons of the Year}}
{{Grammy Award for Best Spoken Word Album}}
{{NAACP Image Award – Chairman's Award}}
{{Nobel Peace Prize laureates}}
{{2009 Nobel Prize winners}}
{{African American topics}}
{{navboxes bottom}}
{{Subject bar
| commons = y
| n = y
| n-search = Category:Barack Obama
| wikt = y
| wikt-search = Category:en:Barack Obama
| d = y
| q = y
| s = y
| s-search = Author:Barack Obama
}}
{{Authority control}}
{{DEFAULTSORT:Obama, Barack}}
[[Category:Barack Obama| ]]
[[Category:1961 births]]
[[Category:20th-century African-American men]]
[[Category:20th-century American male writers]]
[[Category:20th-century American non-fiction writers]]
[[Category:20th-century Protestants]]
[[Category:20th-century African-American academics]]
[[Category:21st-century African-American men]]
[[Category:21st-century American male writers]]
[[Category:21st-century American non-fiction writers]]
[[Category:21st-century American politicians]]
[[Category:21st-century presidents of the United States]]
[[Category:21st-century Protestants]]
[[Category:21st-century scholars]]
[[Category:Activists from Hawaii]]
[[Category:Activists from Illinois]]
[[Category:African-American Christians]]
[[Category:African-American educators]]
[[Category:African-American feminists]]
[[Category:African-American lawyers]]
[[Category:African-American non-fiction writers]]
[[Category:African-American politicians]]
[[Category:African-American state legislators in Illinois]]
[[Category:African-American candidates for President of the United States]]
[[Category:African-American United States senators]]
[[Category:American civil rights lawyers]]
[[Category:American community activists]]
[[Category:American feminist writers]]
[[Category:American gun control activists]]
[[Category:American legal scholars]]
[[Category:American male non-fiction writers]]
[[Category:American memoirists]]
[[Category:American Nobel laureates]]
[[Category:American people of English descent]]
[[Category:American people of French descent]]
[[Category:American people of German descent]]
[[Category:American people of Irish descent]]
[[Category:American people of Kenyan descent]]
[[Category:American people of Luo descent]]
[[Category:American people of Scottish descent]]
[[Category:American people of Swiss descent]]
[[Category:American people of Welsh descent]]
[[Category:American political writers]]
[[Category:American Protestants]]
[[Category:Articles containing video clips]]
[[Category:Candidates in the 2008 United States presidential election]]
[[Category:Candidates in the 2012 United States presidential election]]
[[Category:Columbia College (New York) alumni]]
[[Category:Democratic Party presidents of the United States]]
[[Category:Democratic Party (United States) presidential nominees]]
[[Category:Democratic Party United States senators]]
[[Category:Grammy Award winners]]
[[Category:Harvard Law School alumni]]
[[Category:Illinois Democrats]]
[[Category:Illinois lawyers]]
[[Category:Illinois state senators]]
[[Category:LGBT rights activists from the United States]]
[[Category:Living people]]
[[Category:Male feminists]]
[[Category:Members of the American Philosophical Society]]
[[Category:Netflix people]]
[[Category:Nobel Peace Prize laureates]]
[[Category:Obama family]]
[[Category:Politicians from Chicago]]
[[Category:Politicians from Honolulu]]
[[Category:Presidents of the United States]]
[[Category:Proponents of Christian feminism]]
[[Category:Punahou School alumni]]
[[Category:Scholars of constitutional law]]
[[Category:Time Person of the Year]]
[[Category:United States senators from Illinois]]
[[Category:University of Chicago Law School faculty]]
[[Category:Writers from Chicago]]
[[Category:Writers from Honolulu]]
[[Category:Time 100]]
m4b2nipz2vanmfnx30yr7pacedolqxi
Barack
0
16050878
839952056
778010407
2018-05-06T19:54:19Z
QYYZ
33343951
wikitext
text/x-wiki
#REDIRECT [[Barack Obama]]
{{Redirect category shell|
{{R merge}}
{{R from given name}}
{{R hatnote}}
{{R p}}
}}
7nklzm51z8366b4nt0o63fgpo2ahz3w
Obama
0
12736609
785244701
785244690
2017-06-12T11:56:31Z
Primefac
11508456
wikitext
text/x-wiki
#REDIRECT [[Barack Obama]]
{{rcat shell|{{r hatnote}}{{r from surname|nocat}}{{r from incomplete name}}{{printworthy}}}}
3auaz3spidufuru2criwuwgufq76kqm
Template:'"
10
19021718
902384079
850509183
2019-06-18T13:04:47Z
Paine Ellsworth
9092818
add [[WP:RCAT|rcat]]
wikitext
text/x-wiki
#REDIRECT [[Template:Single+double]]
{{Rcat shell|
{{R from modification}}
{{R from template shortcut}}
}}
exciykx5w3qs51ogi7if8c6cqegnp6c
Template:'-
10
27335291
1082796962
1080673250
2022-04-15T04:57:07Z
Aidan9382
43311764
Protection rating has increased
wikitext
text/x-wiki
#REDIRECT [[Template:Single+space]] {{R extended-protected}}
9mpi90nc82g674ncr9icb1tpxosaweg
Template:,
10
19078310
411523099
260189370
2011-02-02T05:16:50Z
Rich Farmbrough
82835
Minor fixes using [[Project:AWB|AWB]]
wikitext
text/x-wiki
#REDIRECT [[Template:·]]
miz6j5ktcgs5v2y2i7e02wlxiqtlti6
Template:2008 United States presidential election
10
8273003
1089874219
1076465774
2022-05-26T03:30:42Z
Explicit
4842600
Removing link(s) / list item(s) [[Wikipedia:Articles for deletion/International reactions to the 2008 United States presidential election]] closed as delete ([[WP:XFDC#4.0.13|XFDcloser]])
wikitext
text/x-wiki
<!--
* Note to editors:
* Individuals who received the nomination of a notable party (in general, those having Wikipedia articles) or who filed with the Federal Election Commission (exploratory or declared) for the 2008 election are considered candidates (for example: Evan Bayh announced his candidacy and withdrew and did not disavow the FEC filing for the "Friends of Evan Bayh Comittee" see http://www.cnn.com/2006/POLITICS/12/16/bayh.out/index.html)
* Per consensus, only candidates that have articles on Wikipedia they MAY be included on this template. If there is no Wikipedia article, they will be promptly removed.
-->{{#invoke:navbox|navbox
| name = 2008 United States presidential election
| border = {{{border|{{{1|}}}}}}
| title = ([[2004 United States presidential election|← 2004]]) [[2008 United States presidential election]] ([[2012 United States presidential election|2012 →]])
| state = {{{state<includeonly>|autocollapse</includeonly>}}}
| bodyclass = hlist
| above =
*[[Template:2008 United States elections|2008 United States elections]]
*[[List of candidates in the 2008 United States presidential election|Candidates]]
*[[Comparison of the 2008 United States presidential candidates|Comparison]]
*[[2008 United States presidential debates|Debates]]
*[[Congressional endorsements for the 2008 United States presidential election|Congressional endorsements]]
*[[Fundraising for the 2008 United States presidential election|Fundraising]]
*[[Ballot access for the 2008 United States presidential election|Ballot access]]
*[[Timeline of the 2008 United States presidential election|Timeline]]
*[[Super Tuesday, 2008|Super Tuesday]]
*[[Potomac primary]]
*[[2008 Super Tuesday II|Super Tuesday II]]
*Polls
**[[Nationwide opinion polling for the 2008 United States presidential election|national]]
**[[Statewide opinion polling for the 2008 United States presidential election|statewide]]
**[[International opinion polling for the 2008 United States presidential election|international]]
| group1 = [[Democratic Party (United States)|Democratic Party]]<br>{{Party stripe|Working Families Party}}[[Working Families Party|WFP]]
| group1style = {{box-shadow border|r|{{Party color|Democratic Party (US)}}|5px}}
| list1 =
{{#invoke:navbox|navbox|subgroup
|list1=
*[[2008 Democratic National Convention|Convention]]
**[[List of superdelegates at the 2008 Democratic National Convention|superdelegates]]
*Polls
**[[Statewide opinion polling for the 2008 Democratic Party presidential primaries|statewide]]
**[[Nationwide opinion polling for the 2008 Democratic Party presidential primaries|national]]
*[[2008 Democratic Party presidential debates and forums|Debates]]
*[[2008 Democratic Party presidential primaries|Primaries]]
*[[Results of the 2008 Democratic Party presidential primaries|Primary results]]
*[[2008 Democratic Party vice presidential candidate selection|VP candidate selection]]
|group2 = [[2008 Democratic Party presidential candidates|Candidates]]
| list2 =
* '''Nominee: [[Barack Obama]]'''
**[[Barack Obama 2008 presidential campaign|campaign]]
**[[Political positions of Barack Obama|positions]]
**[[List of Barack Obama 2008 presidential campaign endorsements|endorsements]]
***[[Republican and conservative support for Barack Obama in 2008|cross-party]]
*'''VP nominee: [[Joe Biden]]'''
**[[Political positions of Joe Biden|positions]]
*'''Other candidates:''' [[Evan Bayh]]
**[[Evan Bayh 2008 presidential campaign|campaign]]
*[[Joe Biden]]
**[[Joe Biden 2008 presidential campaign|campaign]]
**[[Political positions of Joe Biden|positions]]
*[[Hillary Clinton]]
**[[Hillary Clinton 2008 presidential campaign|campaign]]
**[[Political positions of Hillary Clinton|positions]]
**[[List of Hillary Clinton 2008 presidential campaign endorsements|endorsements]]
*[[Chris Dodd]]
**[[Chris Dodd 2008 presidential campaign|campaign]]
*[[John Edwards]]
**[[John Edwards 2008 presidential campaign|campaign]]
**[[Political positions of John Edwards|positions]]
*[[Mike Gravel]]
**[[Mike Gravel 2008 presidential campaign|campaign]]
*[[Dennis Kucinich]]
**[[Dennis Kucinich 2008 presidential campaign|campaign]]
*[[Bill Richardson]]
**[[Bill Richardson 2008 presidential campaign|campaign]]
*[[Tom Vilsack]]
**[[Tom Vilsack 2008 presidential campaign|campaign]]
}}
| group2 = [[Republican Party (United States)|Republican Party]]<br>{{Party stripe|Conservative Party (US)}}[[Conservative Party of New York State|CPNY]]{{,}}{{Party stripe|Independence Party (US)}}[[Independence Party of New York|IPNY]]
| group2style = {{box-shadow border|r|{{Party color|Republican Party (US)}}|5px}}
| list2 =
{{#invoke:navbox|navbox|subgroup
|list1=
*[[2008 Republican National Convention|Convention]]
*Polls
**[[Statewide opinion polling for the 2008 Republican Party presidential primaries|statewide]]
**[[Nationwide opinion polling for the 2008 Republican Party presidential primaries|national]]
*[[2008 Republican Party presidential debates and forums|Debates]]
*[[Political positions of the 2008 Republican Party presidential primary candidates|Political positions]]
*[[2008 Republican Party presidential primaries|Primaries]]
*[[Results of the 2008 Republican Party presidential primaries|Primary results]]
*[[2008 Republican Party vice presidential candidate selection|VP candidate selection]]
| group2 = Candidates
| list2 =
* '''Nominee: [[John McCain]]'''
**[[John McCain 2008 presidential campaign|campaign]]
**[[Political positions of John McCain|positions]]
**[[List of John McCain 2008 presidential campaign endorsements|endorsements]]
***[[Democratic and liberal support for John McCain in 2008|cross-party]]
*'''VP nominee: [[Sarah Palin]]'''
**[[Vice presidential candidacy of Sarah Palin|candidacy]]
**[[Political positions of Sarah Palin|positions]]
*'''[[2008 Republican Party presidential candidates|Other candidates]]:''' [[Sam Brownback]]
**[[Sam Brownback 2008 presidential campaign|campaign]]
*[[John H. Cox]]
*[[Jim Gilmore]]
**[[Jim Gilmore 2008 presidential campaign|campaign]]
*[[Rudy Giuliani]]
**[[Rudy Giuliani 2008 presidential campaign|campaign]]
**[[Political positions of Rudy Giuliani|positions]]
*[[Mike Huckabee]]
**[[Mike Huckabee 2008 presidential campaign|campaign]]
**[[Political positions of Mike Huckabee|positions]]
*[[Duncan L. Hunter]]
**[[Duncan L. Hunter 2008 presidential campaign|campaign]]
*[[Alan Keyes]]
**[[Alan Keyes 2008 presidential campaign|campaign]]
*[[Ray McKinney]]
*[[Ron Paul]]
**[[Ron Paul 2008 presidential campaign|campaign]]
**[[Political positions of Ron Paul|positions]]
*[[Mitt Romney]]
**[[Mitt Romney 2008 presidential campaign|campaign]]
**[[Political positions of Mitt Romney|positions]]
*[[Tom Tancredo]]
**[[Tom Tancredo 2008 presidential campaign|campaign]]
*[[Fred Thompson]]
**[[Fred Thompson 2008 presidential campaign|campaign]]
*[[Tommy Thompson]]
**[[Tommy Thompson 2008 presidential campaign|campaign]]
}}
| group3 = [[Draft (politics)|Draft movements]]
| list3 =
* '''Democratic:''' [[Al Gore]]
*[[Mark Warner]]
**[[Draft Mark Warner movement|movement]]
* '''Republican:''' [[Newt Gingrich]]
*[[Condoleezza Rice]]
**[[Draft Condi movement|movement]]
*'''[[Independent politician|Independent]]:''' [[Michael Bloomberg]]
**[[Draft Bloomberg movement|movement]]
|group4=
|list4= {{#invoke:navbox|navbox|child
| navbar = plain
| title = [[Third party (United States)|Third party]] and [[Independent politician|independent]] [[Third-party and independent candidates for the 2008 United States presidential election|candidates]]
| group1 = '''[[Constitution Party (United States)|Constitution Party]]'''<br/>([[Constitution Party National Convention|convention]])
| group1style = {{box-shadow border|r|{{Party color|Constitution Party (US)}}|5px}}; font-weight:normal
| list1 =
* '''Nominee: [[Chuck Baldwin]]'''
** [[Chuck Baldwin 2008 presidential campaign|campaign]]
* '''VP nominee: Darrell Castle'''
* '''Other candidates:''' [[Daniel Imperato]]
*[[Alan Keyes]]
**[[Alan Keyes 2008 presidential campaign|campaign]]
| group2 = '''[[Green Party of the United States|Green Party]]'''<br/>([[2008 Green National Convention|convention]])
| group2style = {{box-shadow border|r|{{Party color|Green Party (US)}}|5px}}; font-weight:normal
| list2 =
* '''Nominee: [[Cynthia McKinney]]'''
**[[Cynthia McKinney 2008 presidential campaign|campaign]]
**[[Political positions of Cynthia McKinney|positions]]
* '''VP nominee: [[Rosa Clemente]]'''
*'''Other candidates:''' [[Elaine Brown]]
*[[Jesse Johnson (West Virginia politician)|Jesse Johnson]]
*[[Kent Mesplay]]
*[[Kat Swift]]
| group3 = '''[[Libertarian Party (United States)|Libertarian Party]]'''<br/>([[2008 Libertarian National Convention|convention]])
| group3style = {{box-shadow border|r|{{Party color|Libertarian Party (US)}}|5px}}; font-weight:normal
| list3 =
* '''Nominee: [[Bob Barr]]'''
**[[Bob Barr 2008 presidential campaign|campaign]]
**[[Political positions of Bob Barr|positions]]
* '''VP nominee: [[Wayne Allyn Root]]'''
*'''Other candidates:''' [[Mike Gravel]]
**[[Mike Gravel 2008 presidential campaign|campaign]]
*[[Daniel Imperato]]
*[[Steve Kubby]]
*[[Wayne Allyn Root]]
*[[Mary Ruwart]]
*[[Doug Stanhope]]
|group4= [[American Party (1969)|American Party]]
|list4=
|group5= America's Independent Party
| group5style = {{box-shadow border|r|{{Party color|American Independent Party}}|5px}}
|list5=
* '''Nominee: [[Alan Keyes]]'''
** [[Alan Keyes 2008 presidential campaign|campaign]]
* '''VP nominee: Brian Rohrbough'''
|group6 = [[Boston Tea Party (political party)|Boston Tea Party]]
| group6style = {{box-shadow border|r|yellow|5px}}
|list6 =
* '''Nominee: [[Charles Jay]]'''
|group7= [[New American Independent Party]]
|list7=
|group8= [[Objectivist Party]]
| group8style = {{box-shadow border|r|{{Party color|Objectivist}}|5px}}
|list8=
* '''Nominee: [[Tom Stevens (Objectivist Party politician)|Tom Stevens]]'''
|group9= [[Peace and Freedom Party]]
| group9style = {{box-shadow border|r|{{Party color|Peace and Freedom Party (US)}}|5px}}
|list9=
* '''Nominee: [[Ralph Nader]]'''
**[[Ralph Nader 2008 presidential campaign|campaign]]
* '''VP nominee: [[Matt Gonzalez]]'''
* '''Other candidates:''' [[Gloria La Riva]]
*[[Cynthia McKinney]]
**[[Cynthia McKinney 2008 presidential campaign|campaign]]
*[[Brian Moore (political activist)|Brian Moore]]
**[[Brian Moore 2008 presidential campaign|campaign]]
|group10 = [[Prohibition Party]]
| group10style = {{box-shadow border|r|{{Party color|Prohibition Party}}|5px}}
|list10 =
* '''Nominee: [[Gene Amondson]]'''
|group11= [[Reform Party of the United States of America|Reform Party]]
| group11style = {{box-shadow border|r|{{Party color|Reform Party (US)}}|5px}}
|list11=
* '''Nominee: [[Ted Weill]]'''
* '''VP nominee: Frank McEnulty'''
|group12= [[Party for Socialism and Liberation|Socialism and Liberation Party]]
| group12style = {{box-shadow border|r|{{Party color|Party for Socialism and Liberation}}|5px}}
|list12=
* '''Nominee: [[Gloria La Riva]]'''
* '''VP nominee: [[Eugene Puryear]]'''
|group13= [[Socialist Party USA|Socialist Party]]
| group13style = {{box-shadow border|r|{{Party color|Socialist Party (US)}}|5px}}
|list13=
* '''Nominee: [[Brian Moore (political activist)|Brian Moore]]'''
** [[Brian Moore 2008 presidential campaign|campaign]]
* '''VP nominee: [[Stewart Alexander]]'''
* '''Other candidates:''' [[Eric Chester]]
|group14= [[Socialist Workers Party (United States)|Socialist Workers Party]]
|group14style = {{box-shadow border|r|{{Party color|Socialist Workers Party (US)}}|5px}}
|list14=
* '''Nominee: [[Róger Calero]]'''
* '''Alternate nominee: [[James Harris (Socialist Workers Party politician)|James Harris]]'''
* '''VP nominee: [[Alyson Kennedy]]'''
| group15 = Independent / Other
| group15style = {{box-shadow border|r|{{Party color|Independent (US)}}|5px}}
| list15 =
*[[Jeff Boss]]
*[[Stephen Colbert (character)|Stephen Colbert]]
**[[Stephen Colbert 2008 presidential campaign|campaign]]
*[[Earl Dodge]]
*[[Bradford Lyttle]]
*[[Frank Moore (performance artist)|Frank Moore]]
*[[Joe Schriner]]
*[[Jonathon Sharkey]]
}}
| belowstyle = font-weight: bold; |
| below =
* Other 2008 elections: [[2008 United States House of Representatives elections|House]]
*[[2008 United States Senate elections|Senate]]
*[[2008 United States gubernatorial elections|Gubernatorial]]
}}<noinclude>
{{collapsible option}}
{{Pp-template|small=yes}}
[[Category:2008 United States presidential election templates|*]]
[[Category:United States presidential election navigational boxes|2008]]
[[Category:2008 United States presidential election|τ]]
</noinclude>
1yz9wv1vr6vbnahcosq7z7lk91vfkzo
Template:2009 Nobel Prize winners
10
24633297
1079432497
1011044059
2022-03-26T19:20:55Z
Johnj1995
33582946
wikitext
text/x-wiki
{{Year Nobel Prize winners
|year = 2009
|state = {{{state|}}}
|chemistry =
* [[Venki Ramakrishnan]] (United States/United Kingdom)
* [[Thomas A. Steitz]] (United States)
* [[Ada Yonath]] (Israel)
|literature =
* [[Herta Müller]] (Germany/Romania)
|peace =
* [[Barack Obama]] (United States)
|physics =
* [[Charles K. Kao]] (Hong Kong/United Kingdom/United States)
* [[Willard Boyle]] (Canada/United States)
* [[George E. Smith]] (United States)
|medicine =
* [[Elizabeth Blackburn]] (United States/Australia)
* [[Carol W. Greider]] (United States)
* [[Jack W. Szostak]] (United Kingdom/United States)
|economy =
* [[Elinor Ostrom]] (United States)
* [[Oliver E. Williamson]] (United States)
}}
9a46u47bmxr14j311veeu2pgk38fclu
Template:2012 United States presidential election
10
25001751
1076651685
1069706982
2022-03-12T06:51:04Z
HandsomeFella
12971673
fix redirect
wikitext
text/x-wiki
{{#invoke:navbox|navbox
<!-- Please note that this template is a navigational tool to assist the reader in locating related articles. Therefore, ONLY candidates with WP articles are to be included -->
<!-- Declared candidates are those who have formally announced their candidacy and filed with the Federal Election Commission (FEC) (exploratory or declared), or have received press coverage in multiple reliable and non-trivial media sources for announcing their candidacy. -->
| name = 2012 United States presidential election
| border = {{{border|{{{1|}}}}}}
| state = {{{state<includeonly>|autocollapse</includeonly>}}}
| title = ([[2008 United States presidential election|← 2008]]) [[2012 United States presidential election]] ([[2016 United States presidential election|2016 →]])
| groupstyle = text-align: right;
| bodyclass = hlist
| above =
* [[Fundraising for the 2012 United States presidential election|Fundraising]]
* [[Nationwide opinion polling for the 2012 United States presidential election|National polls]]
* [[Statewide opinion polling for the 2012 United States presidential election|Statewide polls]] ([[Pre-2012 statewide opinion polling for the 2012 United States presidential election|pre-2012]], [[Early/Mid 2012 statewide opinion polling for the 2012 United States presidential election|early 2012]])
* [[Timeline of the 2012 United States presidential election|Timeline]]
* [[2012 United States presidential debates|General election debates]]
* [[Newspaper endorsements in the 2012 United States presidential election|Newspaper endorsements]]
* [[International reactions to the 2012 United States presidential election|International reactions]]
* [[Political impact of Hurricane Sandy|Hurricane Sandy]]
| group1 = Democratic Party
| group1style = {{box-shadow border|r|{{party color|Democratic Party (US)}}|5px}}
| list1 ={{#invoke:navbox|navbox|subgroup
|list1 =
* [[2012 Democratic National Convention|Convention]]
* [[2012 Democratic Party presidential primaries|Primaries]]
|group2 = [[2012 Democratic Party presidential candidates|Candidates]]
| list2 =
* '''Incumbent nominee: [[Barack Obama]]'''
** [[Barack Obama 2012 presidential campaign|campaign]]
** [[List of Barack Obama 2012 presidential campaign endorsements|endorsements]]
** [[Political positions of Barack Obama|positions]]
* '''Incumbent VP nominee: [[Joe Biden]]'''
** [[Political positions of Joe Biden|positions]]
;Challengers
:[[Bob Ely]]
:[[Keith Judd]]
:[[Warren Mosler]]
:[[Vermin Supreme]]
:[[Randall Terry]]
:[[John Wolfe Jr.|John Wolfe]]
}}
| group2 = Republican Party
| group2style = {{box-shadow border|r|{{party color|Republican Party (US)}}|5px}}
| list2 =
{{navbox|subgroup
|list1 =
* [[2012 Republican National Convention|Convention]]
* [[2012 Republican Party presidential primaries|Primaries]]
* [[2012 Republican Party presidential debates and forums|Debates]]
* [[Statewide opinion polling for the 2012 Republican Party presidential primaries|Statewide polls]]
* [[Nationwide opinion polling for the 2012 Republican Party presidential primaries|National polls]]
* [[Straw polls for the 2012 Republican Party presidential primaries|Straw polls]]
|group2 = [[2012 Republican Party presidential candidates|Candidates]]
| list2 =
* '''Nominee: [[Mitt Romney]]'''
** [[Mitt Romney 2012 presidential campaign|campaign]]
** [[List of Mitt Romney 2012 presidential campaign endorsements|endorsements]]
** [[Political positions of Mitt Romney|positions]]
* '''VP nominee: [[Paul Ryan]]'''
** [[Political positions of Paul Ryan|positions]]
;Other candidates
:[[Michele Bachmann]]
::[[Michele Bachmann 2012 presidential campaign|campaign]]
:[[Herman Cain]]
::[[Herman Cain 2012 presidential campaign|campaign]]
::[[Political positions of Herman Cain|positions]]
:[[Mark Callahan]]
:[[Jack Fellure]]
:[[Newt Gingrich]]
::[[Newt Gingrich 2012 presidential campaign|campaign]]
::[[Political positions of Newt Gingrich|positions]]
:[[Stewart Greenleaf]]
:[[Jon Huntsman Jr.|Jon Huntsman]]
::[[Jon Huntsman 2012 presidential campaign|campaign]]
:[[Gary Johnson]]
::[[Gary Johnson 2012 presidential campaign|campaign]]
:[[Fred Karger]]
:[[Andy Martin]]
:[[Thaddeus McCotter]]
::[[Thaddeus McCotter 2012 presidential campaign|campaign]]
:[[Jimmy McMillan]]
:[[Roy Moore]]
:[[Ron Paul]]
::[[Ron Paul 2012 presidential campaign|campaign]]
::[[Political positions of Ron Paul|positions]]
:[[Tim Pawlenty]]
::[[Tim Pawlenty 2012 presidential campaign|campaign]]
:[[Rick Perry]]
::[[Rick Perry 2012 presidential campaign|campaign]]
::[[Political positions of Rick Perry|positions]]
:[[Buddy Roemer]]
::[[Buddy Roemer 2012 presidential campaign|campaign]]
:[[Rick Santorum]]
::[[Rick Santorum 2012 presidential campaign|campaign]]
}}
| group3 = Libertarian Party
| group3style = {{box-shadow border|r|{{party color|Libertarian Party (US)}}|5px}}
| list3 =
{{navbox|subgroup
|list1 =
* [[2012 Libertarian National Convention|Convention]]
<!--* [[2012 Libertarian Party presidential debates|Debates]]-->
|group2 = Candidates
| list2 =
* '''Nominee: [[Gary Johnson]]'''
** [[Gary Johnson 2012 presidential campaign|campaign]]
* '''VP nominee: [[Jim Gray (jurist)|Jim Gray]]'''
;Other candidates
:[[Carl Person]]
:[[Sam Sloan]]
:[[R. Lee Wrights]]
}}
| group4 = Green Party
| group4style = {{box-shadow border|r|{{party color|Green Party (US)}}|5px}}
| list4 =
{{navbox|subgroup
|list1 =
* [[2012 Green National Convention|Convention]]
* [[2012 Green Party presidential primaries|Primaries]]
<!--* [[2012 Green Party presidential debates|Debates]]-->
|group2 = Candidates
| list2 =
* '''Nominee: [[Jill Stein]]'''
** [[Jill Stein 2012 presidential campaign|campaign]]
* '''VP nominee: [[Cheri Honkala]]'''
* '''Other candidates:''' [[Stewart Alexander]]
* [[Roseanne Barr]]
}}
| list5 = {{navbox|child| navbar = plain
| title = Other [[Third-party and independent candidates for the 2012 United States presidential election|third-party and independent candidates]]
| group1 = [[American Independent Party]]
| group1style = {{box-shadow border|r|{{party color|American Independent Party}}|5px}}
| list1 =
* '''Nominee: [[Tom Hoefling]]'''
* Other candidates: [[Wiley Drake]]
*[[Virgil Goode]]
**[[Virgil Goode 2012 presidential campaign|campaign]]
*[[Edward C. Noonan]]
*[[Laurie Roth]]
| group2 = [[American Freedom Party|American Third Position Party]]
| group2style = {{box-shadow border|r|{{party color|American Freedom}}|5px}}
| list2 =
* '''Nominee: [[Merlin Miller]]'''
* '''VP nominee: [[Virginia Abernethy]]'''
| group5 = [[Constitution Party (United States)|Constitution Party]]
| group5style = {{box-shadow border|r|{{party color|Constitution Party (US)}}|5px}}
| list5 =
* [[2012 Constitution Party National Convention|Convention]]
* '''Nominee: [[Virgil Goode]]'''
** [[Virgil Goode 2012 presidential campaign|campaign]]
* '''VP nominee: Jim Clymer'''
* '''Other candidates:''' [[Laurie Roth]]
* [[Robby Wells]]
| group6 = [[Freedom Socialist Party]]
| group6style = {{box-shadow border|r|red|5px}}
| list6 =
* '''Nominee: Stephen Durham'''
| group7 = [[Grassroots-Legalize Cannabis Party|Grassroots Party]]
| group7style = {{box-shadow border|r|{{party color|Grassroots Party (US)}}|5px}}
| list7 =
;Nominee
:'''[[Jim Carlson (businessman)|Jim Carlson]]'''
| group8 = [[Justice Party (United States)|Justice Party]]
| group8style = {{box-shadow border|r|{{party color|Justice Party (US)}}|5px}}
| list8 =
* '''Nominee: [[Rocky Anderson]]'''
* '''VP nominee: [[Luis J. Rodriguez]]'''
| group10 = [[Party for Socialism and Liberation|Socialism and Liberation]]
| group10style = {{box-shadow border|r|{{party color|Party for Socialism and Liberation}}|5px}}
| list10 =
* '''Nominee: [[Peta Lindsay]]'''
| group11 = [[Peace and Freedom Party]]
| group11style = {{box-shadow border|r|{{party color|Peace and Freedom Party (US)}}|5px}}
| list11 =
* '''Nominee: [[Roseanne Barr]]'''
* '''VP nominee: [[Cindy Sheehan]]'''
* '''Other candidates:''' [[Stewart Alexander]]
* [[Rocky Anderson]]
* [[Peta Lindsay]]
| group12 = [[Prohibition Party]]
| group12style = {{box-shadow border|r|{{party color|Prohibition Party}}|5px}}
| list12 =
* '''Nominee: [[Jack Fellure]]'''
* '''Other candidates:''' [[James Hedges]]
| group13 = [[Reform Party of the United States of America|Reform Party]]
| group13style = {{box-shadow border|r|{{party color|Reform Party (US)}}|5px}}
| list13 =
* '''Nominee: [[Andre Barnett]]'''
* '''Other candidates:''' [[Laurence Kotlikoff]]
* [[Buddy Roemer]]
** [[Buddy Roemer 2012 presidential campaign|campaign]]
* [[Robby Wells]]
| group14 = [[Socialist Equality Party (United States)|Socialist Equality Party]]
| group14style = {{box-shadow border|r|{{party color|Socialist Equality Party (US)}}|5px}}
| list14 =
;Nominee
:'''[[Jerry White (socialist)|Jerry White]]'''
| group15 = [[Socialist Workers Party (United States)|Socialist Workers Party]]
| group15style = {{box-shadow border|r|{{party color|Socialist Workers Party (US)}}|5px}}
| list15 =
* '''Nominee: [[James Harris (Socialist Workers Party politician)|James Harris]]'''
| group16 = [[Socialist Party USA|Socialist Party]]
| group16style = {{box-shadow border|r|{{party color|Socialist Party (US)}}|5px}}
| list16 =
* '''Nominee: [[Stewart Alexander]]'''
** [[Stewart Alexander 2012 presidential campaign|campaign]]
* '''VP nominee: [[Alejandro Mendoza]]'''
| group17 = Independents and others
| group17style = {{box-shadow border|r|{{party color|Independent (US)}}|5px}}
| list17 =
;Objectivist Party
:[[Tom Stevens (Objectivist Party politician)|Tom Stevens]]
;Independents
:[[Lee Abramson]]
:[[Randy Blythe]]
:[[Jeff Boss]]
:[[Naked Cowboy|Robert Burck]]
:[[Terry Jones (pastor)|Terry Jones]]
:[[Joe Schriner]]
:[[Michael Bloomberg]]
::[[Draft Bloomberg movement|attempt to draft]]
| }}
| below =
* '''[[2012 United States elections|Other 2012 elections]]:'''
* [[2012 United States House of Representatives elections|House]]
* [[2012 United States Senate elections|Senate]]
* [[2012 United States gubernatorial elections|Gubernatorial]]
}}<noinclude>
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
{{documentation}}
</noinclude>
f8e547dwvj022ui09hzzqx2wami172n
Template:Abbr
10
2557713
976320897
729977787
2020-09-02T09:46:47Z
Primefac
11508456
remove third parameter, as it is causing lint issues (TPER)
wikitext
text/x-wiki
<abbr {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|"}}}}">{{{1|}}}</abbr><noinclude>{{Documentation}}
</noinclude>
b6zvtcrye54kh0akzk3y1jq9lxg4lm6
Template:African American topics
10
12148162
1096752845
1096412626
2022-07-06T12:15:35Z
Randy Kryn
4796325
Notable people, added 'Ketanji Brown Jackson'
wikitext
text/x-wiki
{{#invoke:navbox|navbox
| name = African American topics
| title = [[African Americans]]
| state = {{{state<includeonly>|autocollapse</includeonly>}}}
| bodyclass = hlist
| group1 = [[African-American history|History]]
| list1 =
* [[Timeline of African-American history|Timeline]]
* [[Abolitionism in the United States|Abolitionism]]
* [[Afrocentrism]]
* [[American Civil War]]
* [[Atlantic slave trade]]
* [[Black genocide]]
* [[Black Lives Matter]]
* ''[[Brown v. Board of Education]]''
* [[Children of the plantation]]
* Civil Rights Acts
** [[Civil Rights Act of 1964|1964]]
** [[Voting Rights Act of 1965]]
** [[Civil Rights Act of 1968|1968]]
* Civil rights movement
** [[Civil rights movement (1865–1896)|1865–1896]]
** [[Civil rights movement (1896–1954)|1896–1954]]
** [[Civil rights movement|1954–1968]]
** [[Birmingham campaign|Birmingham movement]]
** [[March on Washington for Jobs and Freedom|March on Washington]]
** [[Selma to Montgomery marches]]
** [[Post–civil rights era in African-American history|Post–civil rights era]]
* [[Cornerstone speech]]
* [[Impact of the COVID-19 pandemic on black people|COVID-19 impact]]
* ''[[Dred Scott v. Sandford]]''
* [[Free Negro]]
* [[Free people of color]]
* [[George Floyd protests]]
* [[Great Migration (African American)|Great Migration]]
**[[Second Great Migration (African American)|Second]]
**[[New Great Migration|New]]
* [[First inauguration of Barack Obama|Inauguration of Barack Obama 2009]] / [[Second inauguration of Barack Obama|Inauguration of Barack Obama 2013]]
* [[Jim Crow laws]]
* [[Lynching in the United States|Lynching]]
* [[Military history of African Americans|Military history]]
* [[Nadir of American race relations]]
* ''[[The Negro Motorist Green Book]]''
* ''[[Partus sequitur ventrem]]''
* [[Plantation complexes in the Southern United States|Plantations]]
* ''[[Plessy v. Ferguson]]''
* [[Reconstruction Amendments]]
* [[Reconstruction era]]
* [[Redlining]]
* [[Separate but equal]]
* [[Slavery in the United States|Slavery]]
** [[Treatment of slaves in the United States|Treatment of slaves]]
* [[Tulsa race massacre]]
* [[Underground Railroad]]
* [[African-American women's suffrage movement|Women's suffrage movement]]
|group2 = [[African-American culture|Culture]]
|list2 = <!--Alphabetical:-->
* [[Afrofuturism]]
* [[African-American art|Art]]
* [[Black mecca]]
* [[African-American businesses|Businesses]]
* [[African-American dance|Dance]]
* [[African-American family structure|Family structure]]
* [[Black film|Film]]
* [[African-American folktales|Folktales]]
* [[African-American hair|Hair]]
* [[Harlem Renaissance]]
** [[New Negro]]
* [[Juneteenth]]
* [[Kwanzaa]]
* [[African-American LGBT community|LGBT community]]
* [[African-American literature|Literature]]
* [[African-American music|Music]]
* [[African-American musical theater|Musical theater]]
* [[African-American names|Names]]
* [[Lift Every Voice and Sing|Negro National Anthem]]
* [[African-American neighborhood|Neighborhoods]]
* [[African-American newspapers|Newspapers]]
* [[Soul food]]
* [[Stereotypes of African Americans|Stereotypes]]
* [[African-American middle class|Middle class]]
* [[African-American upper class|Upper class]]
|group3 = Notable people
|list3=
* [[Ralph Abernathy]]
* [[Maya Angelou]]
* [[Crispus Attucks]]
* [[James Baldwin]]
* [[James Bevel]]
* [[Julian Bond]]
* [[Amelia Boynton Robinson|Amelia Boynton]]
* [[James Bradley (former slave)|James Bradley]]
* [[Carol Moseley Braun]]
* [[Edward Brooke]]
* [[Blanche Bruce]]
* [[Ralph Bunche]]
* [[George Washington Carver]]
* [[Shirley Chisholm]]
* [[Claudette Colvin]]
* [[Frederick Douglass]]
* [[W. E. B. Du Bois]]
* [[Medgar Evers]]
* [[James Farmer]]
* [[Henry Highland Garnet]]
* [[Marcus Garvey]]
* [[Fannie Lou Hamer]]
* [[Kamala Harris]]
* [[Jesse Jackson]]
* [[Ketanji Brown Jackson]]
* [[Michael Jackson]]
* [[Harriet Jacobs]]
* [[Coretta Scott King]]
* [[Martin Luther King Jr.]]
* [[John Lewis]]
* [[Joseph Lowery]]
* [[Malcolm X]]
* [[Thurgood Marshall]]
* [[Toni Morrison]]
* [[Bob Moses (activist)|Bob Moses]]
* [[Diane Nash]]
* [[Barack Obama]]
* [[Rosa Parks]]
* [[Adam Clayton Powell Jr.]]
* [[Colin Powell]]
* [[Gabriel Prosser]]
* [[Joseph Rainey]]
* [[A. Philip Randolph]]
* [[Hiram Rhodes Revels|Hiram Revels]]
* [[Paul Robeson]]
* [[Al Sharpton]]
* [[Fred Shuttlesworth]]
* [[Clarence Thomas]]
* [[Emmett Till]]
* [[Sojourner Truth]]
* [[Harriet Tubman]]
* [[Nat Turner's slave rebellion|Nat Turner]]
* [[Denmark Vesey]]
* [[David Walker (abolitionist)|David Walker]]
* [[Booker T. Washington]]
* [[Ida B. Wells]]
* [[Roy Wilkins]]
* [[Oprah Winfrey]]
* [[Andrew Young]]
* [[Whitney Young]]
|group4 = Education, science<br />and technology
|list4 =
* [[African-American studies]]
* [[Black school]]s
* [[Historically black colleges and universities]]
* [[List of African-American inventors and scientists|Inventors and scientists]]
* [[List of museums focused on African Americans|Museums]]
* Women
** [[African-American women in computer science|in computer science]]
** [[List of African-American women in medicine|in medicine]]
** [[List of African-American women in STEM fields|in STEM fields]]
|group5 = [[Religion of Black Americans|Religion]]
|list5 =
* [[African-American Jews]]
* [[African-American Muslims|Islam]]
** [[American Society of Muslims]]
** [[Nation of Islam]]
* [[Black Church (African American)|Black church]]
** [[Azusa Street Revival]]
* [[Black Hebrew Israelites]]
* [[Black theology]]
* [[Doctrine of Father Divine]]
|group6 = Political movements
|list6 =
* [[Black anarchism|Anarchism]]
* [[Back-to-Africa movement]]
* [[Black Power]]
** [[Black Power movement|Movement]]
* [[Black capitalism|Capitalism]]
* [[Black conservatism|Conservatism]]
* [[African-American leftism|Leftism]]
* [[Pan-Africanism]]
* [[Black populism|Populism]]
* [[Raised fist]]
* [[African-American self-determination|Self-determination]]
** [[Black nationalism|Nationalism]]
* [[African-American socialism|Socialism]]
|group7 = {{longitem|Civic and economic<br />groups}}
|list7 =
* [[Association for the Study of African American Life and History|Association for the Study of African American Life and History (ASALH)]]
* [[Black Panther Party]]
* [[Congress of Racial Equality|Congress of Racial Equality (CORE)]]
* [[NAACP|National Association for the Advancement of Colored People (NAACP)]]
* [[Nashville Student Movement]]
* [[National Black Chamber of Commerce|National Black Chamber of Commerce (NBCC)]]
* [[National Council of Negro Women|National Council of Negro Women (NCNW)]]
* [[National Pan-Hellenic Council|National Pan-Hellenic Council (NPHC)]]
* [[National Urban League|National Urban League (NUL)]]
* [[Southern Christian Leadership Conference|Southern Christian Leadership Conference (SCLC)]]
* [[Student Nonviolent Coordinating Committee|Student Nonviolent Coordinating Committee (SNCC)]]
* [[Thurgood Marshall College Fund]]
* [[UNCF|United Negro College Fund (UNCF)]]
* [[Universal Negro Improvement Association|Universal Negro Improvement Association (UNIA)]]
|group8 = Sports
|list8 =
{{#invoke:navbox|navbox|child
|list1 =
* [[Negro league baseball]]
* [[Baseball color line]]
* [[Black players in professional American football]]
*[[List of starting black NFL quarterbacks|Black NFL quarterbacks]]
* [[Black players in ice hockey]]
* [[Muhammad Ali]]
* [[Arthur Ashe]]
* [[Jack Johnson (boxer)|Jack Johnson]]
* [[Joe Louis]]
* [[Jesse Owens]]
* [[Jackie Robinson]]
* [[Serena Williams]]
|group2 = {{longitem|Athletic associations<br />and conferences}}
|list2 =
* [[Central Intercollegiate Athletic Association|Central (CIAA)]]
* [[Mid-Eastern Athletic Conference|Mid-Eastern (MEAC)]]
* [[Southern Intercollegiate Athletic Conference|Southern (SIAC)]]
* [[Southwestern Athletic Conference|Southwestern (SWAC)]]
}}
|group9 = Ethnic subdivisions
|list9 =
* By African descent
** [[Fula Americans|Fula]]
** [[Gullah]]
** [[Igbo Americans|Igbo]]
** [[Yoruba Americans|Yoruba]]
* [[Black Indians in the United States|Black Indians]]
** [[Black Seminoles]]
** [[Cherokee freedmen controversy]]
** [[Choctaw freedmen]]
** [[Creek Freedmen]]
* [[Black Southerners]]
* [[Blaxican|Blaxicans]]
* [[Louisiana Creole people|Louisiana Creole]]
** [[Creoles of color|of color]]
* [[Melungeon]]
|group10 = Demographics
|list10 =
* [[African-American neighborhood|Neighborhoods]]
** [[List of African-American neighborhoods|list]]
* [[List of U.S. cities with large African-American populations|U.S. cities with large populations]]
** [[List of U.S. communities with African-American majority populations in 2000|2000 majorities]]
** [[List of U.S. communities with African-American majority populations in 2000|2010 majorities]]
* [[List of U.S. metropolitan areas with large African-American populations|Metropolitan areas]]
* [[List of U.S. states and territories by African-American population|States and territories]]
|group11 = Languages
|list11 =
* [[English language|English]]
** [[American English]]
** [[African-American English]]
** [[African-American Vernacular English]]
* [[Gullah language|Gullah]]
* [[Louisiana Creole]]
|group12 = By state/city
|list12 =
* [[African Americans in Alabama|Alabama]]
* [[African Americans in California|California]]
** [[History of African Americans in Los Angeles|Los Angeles]]
** [[African Americans in San Francisco|San Francisco]]
* [[African Americans in Florida|Florida]]
**[[History of African Americans in Jacksonville, Florida|Jacksonville]]
**[[History of Tallahassee, Florida#Black history|Tallahassee]]
* [[African Americans in Georgia (U.S. state)|Georgia]]
** [[African Americans in Atlanta|Atlanta]]
* [[Africans in Hawaii|Hawaii]]
* Illinois
** [[History of African Americans in Chicago|Chicago]]
* Iowa
** [[African Americans in Davenport, Iowa|Davenport]]
* [[History of African Americans in Kansas|Kansas]]
* [[History of African Americans in Kentucky|Kentucky]]
* [[African Americans in Louisiana|Louisiana]]
* [[African Americans in Maryland|Maryland]]
** [[History of African Americans in Baltimore|Baltimore]]
* Massachusetts
** [[History of African Americans in Boston|Boston]]
* Michigan
** [[History of African Americans in Detroit|Detroit]]
* [[African Americans in Mississippi|Mississippi]]
* Nebraska
** [[African Americans in Omaha, Nebraska|Omaha]]
* New York
** [[African Americans in New York City|New York City]]
* [[African Americans in North Carolina|North Carolina]]
* [[African Americans in Oklahoma|Oklahoma]]
* [[African Americans in Oregon|Oregon]]
* Pennsylvania
** [[History of African Americans in Philadelphia|Philadelphia]]
* [[Afro-Puerto Ricans|Puerto Rico]]
* [[African Americans in South Carolina|South Carolina]]
* [[African Americans in Tennessee|Tennessee]]
* [[History of African Americans in Texas|Texas]]
** [[History of African Americans in Austin|Austin]]
** [[History of African Americans in Dallas-Fort Worth|Dallas-Fort Worth]]
** [[History of African Americans in Houston|Houston]]
** [[History of African Americans in San Antonio|San Antonio]]
* [[History of African Americans in Utah|Utah]]
|group13 = [[African-American diaspora|Diaspora]]
|list13 =
* [[African Americans in Africa|Africa]]
** [[Gambian Creole people|Gambia]]
** [[African Americans in Ghana|Ghana]]
** [[Americo-Liberian people|Liberia]]
** [[Sierra Leone Creole people|Sierra Leone]]
* America
** [[Black Nova Scotians|Canada]]
** [[Samaná Americans|Dominican Republic]]
** [[Haitian emigration|Haiti]]
** [[Mascogos|Mexico]]
** [[Merikins|Trinidad and Tobago]]
* [[African Americans in Israel|Israel]]
* Europe
** [[African Americans in France|France]]
|group14 = Lists
|list14 =
* [[Lists of African Americans|African Americans]]
** [[List of African-American activists|Activists]]
** [[List of African-American actors|Actors]]
** [[List of African-American astronauts|Astronauts]]
** [[Black billionaires|Billionaires]]
** [[List of African-American jurists|Jurists]]
** [[List of African-American mathematicians|Mathematicians]]
** [[List of African-American Republicans|Republicans]]
** [[List of African-American singers|Singers]]
** [[Spingarn Medal|Spingarn Medal winners]]
** [[List of African-American United States Cabinet members|US cabinet members]]
** [[List of African-American United States Representatives|US representatives]]
** [[List of African-American United States senators|US senators]]
** [[List of African-American visual artists|Visual artists]]
** [[List of African-American writers|Writers]]
* [[List of African-American firsts|African-American firsts]]
** [[List of first African-American mayors|Mayors]]
** [[List of African-American sports firsts|Sports firsts]]
** [[List of African-American U.S. state firsts|US state firsts]]
* [[List of African-American historic places|Historic places]]
* [[Index of articles related to African Americans|Index of related articles]]
* [[List of landmark African-American legislation|Landmark African-American legislation]]
* [[List of lynching victims in the United States|Lynching victims]]
* [[List of African-American neighborhoods|Neighborhoods]]
* [[List of topics related to the African diaspora|Topics related to the African diaspora]]
|belowstyle = font-weight:bold;
|below =
* [[:Category:African-American society|Category]]
* {{Portal-inline | United States}}
}}
<noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
lih3pbdi44g1qnmfi7nz81ry7cwli2g
Template:Audio
10
1501273
1083488012
1083430471
2022-04-19T02:39:56Z
Graham87
194203
it's better without the alt text in this case; see talk
wikitext
text/x-wiki
<includeonly>{{#if:{{{1|}}}|{{#ifexist:Media:{{{1}}}|<span class="unicode haudio"><span class="fn"><span style="white-space:nowrap;margin-right:.25em;">[[File:Loudspeaker.svg|11px|link=File:{{{1}}}|About this sound|alt=]]</span>[[:Media:{{{1|}}}|{{{2|{{{1|}}}}}}]]</span>{{#ifeq:{{{help|}}}|no|| <small class="metadata audiolinkinfo" style="cursor:help;">([[Wikipedia:Media help|<span style="cursor:help;">help</span>]]·[[:File:{{{1|}}}|<span style="cursor:help;">info</span>]])</small>}}{{main other|[[Category:Articles with hAudio microformats]]}}</span>|{{error{{main other||-small}}|Audio file "{{{1}}}" not found}}<!-- tracking category begin -->{{Category handler|[[Category:Pages linking to missing files]]}}<!-- tracking category end -->}}}}</includeonly><noinclude>
{{documentation}}<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
qcorin8f88efg7r5oufpzcztskyv5gt
Template:Authority control
10
23327809
1056624773
1041946236
2021-11-22T21:18:20Z
MSGJ
42630
add extralist to list of recognised parameters
wikitext
text/x-wiki
{{#invoke:Authority control|authorityControl}}<noinclude>{{Documentation}}</noinclude><includeonly><noinclude>
</noinclude>{{#switch:{{NAMESPACE}}||{{ns:14}}=<noinclude> Only articles and categories.
</noinclude>{{#invoke:Check for unknown parameters|check|arts|state|extralist|ignoreblank=1|showblankpositional=1|unknown=[[Category:Pages using authority control with parameters|_VALUE_]]|preview=Page using [[Template:Authority control]] with "_VALUE_", please move this to Wikidata if possible}}
}}</includeonly>
r7zu90c4kw92cg7qpkt338qlrjs39u2
Template:Barack Obama
10
11920737
1089874224
1084447141
2022-05-26T03:30:44Z
Explicit
4842600
Removing link(s) / list item(s) [[Wikipedia:Articles for deletion/International reactions to the 2008 United States presidential election]] closed as delete ([[WP:XFDC#4.0.13|XFDcloser]])
wikitext
text/x-wiki
{{#invoke:navbox|navbox
| name = Barack Obama
| title = [[Barack Obama]]
| state = {{{state<includeonly>|collapsed</includeonly>}}}
| bodyclass = hlist
| nowrapitems = yes
| above =
* {{nowrap|[[List of presidents of the United States|44th]] [[President of the United States]] (2009–2017)}}
* {{nowrap|[[United States Senate|U.S. Senator]] [[List of United States senators from Illinois|from Illinois]] (2005–2008)}}
* {{nowrap|[[Illinois Senate|Illinois Senator]] from the 13th district (1997–2004)}}
| list1 =
{{#invoke:navbox|navbox|child
| state = uncollapsed
| image = [[File:President Barack Obama, 2012 portrait crop.jpg|100px|link=|alt=]]<br/><br/>[[File:Seal of the President of the United States.svg|100px]]
| group1 = Life and<br />politics
| list1 =
* [[Early life and career of Barack Obama|Early life and career]]
* [[Illinois Senate career of Barack Obama|Illinois Senate career]]
* [[2004 Democratic National Convention]]
* [[United States Senate career of Barack Obama|U.S. Senate career]]
* [[Political positions of Barack Obama|Political positions]]
** [[Foreign policy of the Barack Obama administration|Administration foreign policy]]
** [[Cannabis policy of the Barack Obama administration|Cannabis]]
** [[Economic policy of the Barack Obama administration|Economic]]
** [[Energy policy of the Barack Obama administration|Energy]]
** [[Loggerhead sea turtle policies of the Barack Obama administration (2009–2017)|Loggerhead sea turtles]]
** [[Barack Obama on mass surveillance|Mass surveillance]]
** [[Social policy of the Barack Obama administration|Social]]
** [[Space policy of the Barack Obama administration|Space]]
* [[2009 Nobel Peace Prize|Nobel Peace Prize]]
* [[West Wing Week]]
| group2 = [[Presidency of Barack Obama|Presidency]]
| list2 =
* [[Presidential transition of Barack Obama|Transition]]
* [[First inauguration of Barack Obama|2009 inauguration]]
* [[Second inauguration of Barack Obama|2013 inauguration]]
* [[First 100 days of Barack Obama's presidency|First 100 days]]
* Timeline
** [[Timeline of the Barack Obama presidency (2009)|2009]]
** [[Timeline of the Barack Obama presidency (2010)|2010]]
** [[Timeline of the Barack Obama presidency (2011)|2011]]
** [[Timeline of the Barack Obama presidency (2012)|2012]]
** [[Timeline of the Barack Obama presidency (2013)|2013]]
** [[Timeline of the Barack Obama presidency (2014)|2014]]
** [[Timeline of the Barack Obama presidency (2015)|2015]]
** [[Timeline of the Barack Obama presidency (2016–January 2017)|2016]]
** [[Timeline of the Barack Obama presidency (2016–January 2017)|January 2017]]
* [[Foreign policy of the Barack Obama administration|Foreign policy]]
** [[Middle Eastern foreign policy of the Barack Obama administration|Middle East]]
** [[War in Afghanistan (2001–2021)#Reassessment and renewed commitment from 2008|War in Afghanistan]]
** [[Withdrawal of United States troops from Iraq (2007–2011)|Iraq withdrawal]]
** [[Killing of Osama bin Laden|Death of Osama bin Laden]]
** [[2012 Benghazi attack|Benghazi attack]]
** [[American-led intervention in Iraq (2014–present)|Return to Iraq]]
** [[American-led intervention in the Syrian civil war|War in Syria]]
** [[Joint Comprehensive Plan of Action|Iran nuclear deal]]
** [[East Asian foreign policy of the Barack Obama administration|Pivot to Asia]]
** [[Cuban thaw]]
** [[Obama Doctrine]]
** [[European foreign policy of the Barack Obama administration|Europe]]
* [[Affordable Care Act|Health Care reform]]
* [[Healthy, Hunger-Free Kids Act of 2010|Healthy, Hunger-Free Kids Act]]
* [[New START]]
* [[List of people granted executive clemency by Barack Obama|Pardons]]
* [[List of presidential trips made by Barack Obama|Presidential trips]]
** [[List of international presidential trips made by Barack Obama|international]]
** [[List of presidential trips made by Barack Obama (2009)|2009]]
** [[List of presidential trips made by Barack Obama (2010)|2010]]
** [[List of presidential trips made by Barack Obama (2011)|2011]]
** [[List of presidential trips made by Barack Obama (2012)|2012]]
** [[List of presidential trips made by Barack Obama (2013)|2013]]
** [[List of presidential trips made by Barack Obama (2014)|2014]]
** [[List of presidential trips made by Barack Obama (2015)|2015]]
** [[List of presidential trips made by Barack Obama (2016–2017)|2016–17]]
* [[List of federal judges appointed by Barack Obama|Judicial appointments]]
** [[Barack Obama Supreme Court candidates|Supreme Court]]
** [[Sonia Sotomayor Supreme Court nomination|Sotomayor]]
** [[Elena Kagan Supreme Court nomination|Kagan]]
** [[Merrick Garland Supreme Court nomination|Garland]]
** [[Barack Obama judicial appointment controversies|controversies]]
* [[Cabinet of Barack Obama|Cabinet]]
* [[Barack Obama Presidential Center|Presidential Library and Center]]
* [[wikisource:Author:Barack_Hussein_Obama/Executive_orders|Executive Orders]]
* [[wikisource:Author:Barack_Obama/Presidential_Proclamations|Presidential Proclamations]]
* [[Plantation Estate]]
| group3 = [[:Category:Books by Barack Obama|Books]]
| list3 =
* [[Dreams from My Father|''Dreams from My Father'' (1995)]]
* [[The Audacity of Hope|''The Audacity of Hope'' (2006)]]
* [[Of Thee I Sing (book)|''Of Thee I Sing'' (2010)]]
* [[A Promised Land|''A Promised Land'' (2020)]]
| group4 = [[Speeches of Barack Obama|Speeches]]
| list4 =
* "[[2004 Democratic National Convention keynote address|The Audacity of Hope]]" (2004)
* "[[s:Remarks of Senator Barack Obama on New Hampshire Primary Night|Yes We Can]]" (2008)
* "[[A More Perfect Union (speech)|A More Perfect Union]]" (2008)
* "[[Barack Obama 2008 presidential election victory speech|Change Has Come to America]]" (2008)
* "[[First inauguration of Barack Obama#Ceremony: "A New Birth of Freedom"|A New Birth of Freedom]]" (2009)
* [[February 2009 Barack Obama speech to a joint session of Congress|Joint session of Congress]] (2009)
* "[[A New Beginning (speech)|A New Beginning]]" (2009)
* [[September 2009 Barack Obama speech to a joint session of Congress|Joint session of Congress (health care reform)]] (2009)
* [[State of the Union|State of the Union Address]]
** [[2010 State of the Union Address|2010]]
** [[2011 State of the Union Address|2011]]
** [[2012 State of the Union Address|2012]]
** [[2013 State of the Union Address|2013]]
** [[2014 State of the Union Address|2014]]
** [[2015 State of the Union Address|2015]]
** [[2016 State of the Union Address|2016]]
* [[Barack Obama Tucson memorial speech|Tucson memorial speech]] (2011)
* [[American Jobs Act|Joint session of Congress (jobs)]] (2011)
* "[[You didn't build that]]" (2012)
* [[Barack Obama Selma 50th anniversary speech|Selma 50th anniversary]] (2015)
* [[Barack Obama's farewell address|Farewell address]] (2017)
|group5 = [[Electoral history of Barack Obama|Elections]]
|list5 =
{{#invoke:navbox|navbox|subgroup
| group1 = Illinois
| list1 =
* [[Illinois Senate elections of Barack Obama|State Senate]]
** [[Illinois Senate elections of Barack Obama#First state Senate election, 1996|1996]]
** [[Illinois Senate elections of Barack Obama#Second state Senate election, 1998|1998]]
** [[Illinois Senate elections of Barack Obama#Third state Senate election, 2002|2002]]
* U.S. House of Representatives
** [[2000 Illinois's 1st congressional district election|2000]]
| group2 = U.S. Senate
| list2 =
* [[2004 United States Senate election in Illinois|2004]]
| group3 = Presidential
| list3 =
* [[Barack Obama 2008 presidential campaign|2008 campaign]]
** [[List of Barack Obama 2008 presidential campaign endorsements|endorsements]]
*** [[Republican and conservative support for Barack Obama in 2008|GOP/conservative support]]
**** [[List of Barack Obama 2008 presidential campaign staff members|staff members]]
** [[2008 Democratic Party presidential primaries|primaries]]
*** [[Barack Obama 2008 presidential primary campaign|primary campaign]]
** [[2008 Democratic Party vice presidential candidate selection|running mate selection]]
** [[2008 Democratic National Convention|convention]]
** [[2008 United States presidential debates|debates]]
** [[2008 United States presidential election|election]]
* [[Barack Obama 2012 presidential campaign|2012 campaign]]
** [[List of Barack Obama 2012 presidential campaign endorsements|endorsements]]
** [[2012 Democratic Party presidential primaries|primaries]]
** [[2012 Democratic National Convention|convention]]
** [[2012 United States presidential debates|debates]]
** [[2012 United States presidential election|election]]
** [[International reactions to the 2012 United States presidential election|international reactions]]
}}
| group6 = [[Family of Barack Obama|Family]]
| list6 =
* [[Michelle Obama]] (wife)
* [[Ann Dunham]] (mother)
* [[Barack Obama Sr.]] (father)
* [[Lolo Soetoro]] (stepfather)
* [[Maya Soetoro-Ng]] (maternal half-sister)
* [[Stanley Armour Dunham]] (maternal grandfather)
* [[Madelyn Dunham]] (maternal grandmother)
* [[Auma Obama]] (paternal half-sister)
* [[Malik Obama]] (paternal half-brother)
* [[Marian Shields Robinson]] (mother-in-law)
* [[Craig Robinson (basketball)|Craig Robinson]] (brother-in-law)
* [[Bo (dog)|Bo]] (family dog)
* [[Sunny (dog)|Sunny]] (family dog)
}}
| list2 =
{{#invoke:navbox|navbox|child
| title = [[Public image of Barack Obama|Public image]]
| group1 = News and <br /> political events
| list1 =
* [[Oprah Winfrey's endorsement of Barack Obama|Oprah Winfrey's endorsement]]
* [[Barack Obama citizenship conspiracy theories|Citizenship conspiracy theories]]
** [[Barack Obama presidential eligibility litigation|litigation]]
* [[Barack Obama religion conspiracy theories|Religion conspiracy theories]]
* [[Bill Ayers 2008 presidential election controversy|Bill Ayers controversy]]
* [[Jeremiah Wright controversy]]
* [[Republican and conservative support for Barack Obama in 2008|Republican and conservative support (2008)]]
* [[Security incidents involving Barack Obama|Assassination threats]]
** [[Barack Obama assassination plot in Denver|2008 Denver]]
** [[Barack Obama assassination plot in Tennessee|2008 Tennessee]]
* [[Invitations to the first inauguration of Barack Obama|First inauguration invitations]]
* [[We Are One: The Obama Inaugural Celebration at the Lincoln Memorial|Inaugural Celebration at the Lincoln Memorial]]
* ''[[Citizen's Briefing Book]]''
* [[Tea Party protests]]
* [[New Energy for America]]
* [[Lilly Ledbetter Fair Pay Act of 2009]]
* [[American Recovery and Reinvestment Act of 2009]]
* [[Henry Louis Gates arrest controversy#Presidential involvement|Gates–Crowley Rose Garden meeting]]
* [[Firing of Shirley Sherrod]]
* [[Efforts to impeach Barack Obama|Impeachment efforts]]
| group2 = [[:Category:Books about Barack Obama|Books about]]
| list2 =
* [[Bibliography of Barack Obama|Bibliography]]
* ''[[Obama: From Promise to Power]]''
* ''[[Barack Obama: Der schwarze Kennedy]]''
* ''[[Redemption Song (Stanage book)|Redemption Song]]''
* ''[[The Case Against Barack Obama]]''
* ''[[The Obama Nation]]''
* ''[[Culture of Corruption]]''
* ''[[Catastrophe (Morris and McGann book)|Catastrophe]]''
* ''[[Barack and Michelle]]''
* ''[[The Speech (Sharpley-Whiting book)|The Speech]]''
* ''[[The Obama Story]]''
* ''[[Between Barack and a Hard Place]]''
* ''[[Game Change]]''
* ''[[Obama Zombies]]''
* ''[[Conservative Victory]]''
* ''[[The Bridge: The Life and Rise of Barack Obama|The Bridge]]''
* ''[[The Obama Diaries]]''
* ''[[The Obama Syndrome]]''
* ''[[The Obama Identity]]''
* ''[[O: A Presidential Novel]]''
* ''[[Where's the Birth Certificate?]]''
* ''[[Obama's Last Stand]]''
* ''[[Barack Obama: The Story]]''
* ''[[Double Down: Game Change 2012| Game Change 2012]]''
* ''[[Buyer's Remorse (book)|Buyer's Remorse]]''
* ''[[Rising Star (book)|Rising Star]]''
* ''[[Shade: A Tale of Two Presidents|Shade]]''
* ''[[The World as It Is (book)|The World as It Is]]''
| group3 = Music
| list3 =
* [[Amber Lee Ettinger|Obama Girl]]
** "[[Crush on Obama|I Got a Crush... on Obama]]"
* "[[Magical Negro#Barack Obama|Barack the Magic Negro]]"
* [[will.i.am]]
** "[[Yes We Can (will.i.am song)|Yes We Can]]"
* "[[There's No One as Irish as Barack O'Bama]]"
* "[[Sí Se Puede Cambiar]]"
* "[[My President]]"
* "[[Deadheads for Obama]]"
* "[[Air and Simple Gifts]]"
* ''[[Change Is Now: Renewing America's Promise|Change Is Now]]''
* ''[[Hope! – Das Obama Musical]]''
* "[[Barack Obama vs. Mitt Romney (video)|Barack Obama vs. Mitt Romney]]"
* ''[[Baracksdubs|Barack's Dubs]]''
* "[[Signed, Sealed, Delivered I'm Yours#Political significance|Signed, Sealed, Delivered I'm Yours]]"
| group4 = Film, TV, <br> and stage
| list4 =
* ''[[By the People: The Election of Barack Obama]]'' (2009)
* ''[[Change (film)|Change]]'' (2010)
* ''[[Obama Anak Menteng]]'' (2010)
* ''[[2016: Obama's America]]'' (2012)
* ''[[The Road We've Traveled]]'' (2012)
* ''[[Southside with You]]'' (2016)
* ''[[Hillary and Clinton]]'' (2016)
* ''[[Barry (2016 film)|Barry]]'' (2016)
* ''[[America's Great Divide]]'' (2020)
* ''[[We the People (2021 TV series)|We the People]]'' (2021)
* ''[[Renegades: Born in the USA]]'' (2021)
* ''[[Obama: In Pursuit of a More Perfect Union]]'' (2021)
* ''[[The First Lady (American TV series)|The First Lady]]'' (2022)
| group5 = [[:Category:Images of Barack Obama|Other media]]
| list5 =
* [[Social media use by Barack Obama|Social media use]]
* [[Artists for Obama]]
* [[Barack Obama "Hope" poster|"Hope" poster]]
* [[Barack Obama "Joker" poster|"Joker" poster]]
* [[Hair Like Mine|''Hair Like Mine'']]
* [[Situation Room (photograph)|''Situation Room'']]
* [[Iman Crosson]]
* ''[[President Barack Obama (painting)|President Barack Obama]]'' (2018 portrait)
* [[Obama logo]]
* [[Barack Obama in comics|In comics]]
| group6 = Related
| list6 =
* [[Barack Obama Day|Barack Obama Day (Illinois)]]
* [[Obama Day|Obama Day (Kenya)]]
* [[List of honors and awards received by Barack Obama|Awards and honors]]
* [[List of things named after Barack Obama|Namesakes]]
* [[Higher Ground Productions]]
* "[[One Last Time (Hamilton song)#Remix|One Last Time (44 Remix)]]"
|state=expanded}}
| below =
* '''[[George W. Bush|← George W. Bush]]'''
* '''[[Donald Trump|Donald Trump →]]'''
* '''{{icon|Category}} [[:Category:Barack Obama|Category]]'''
}}<noinclude>
{{documentation}}
[[Category:President of the United States navigational boxes]]
[[Category:United States senator navigational boxes]]
[[Category:American writer navigational boxes]]
</noinclude>
ts1kgz09qcfpwj11bac8pyd5jo0dr03
Template:Barack Obama series
10
16100796
1087263525
1070406562
2022-05-11T11:46:37Z
Turaids
8725456
wikitext
text/x-wiki
{{Sidebar/US President
| template = Barack Obama series
| president = Barack Obama
| portrait = President Barack Obama, 2012 portrait crop.jpg
| signature = Barack Obama signature.svg
| sig-width = 130px
| contents =
* [[Political positions of Barack Obama|Political positions]]
* [[Electoral history of Barack Obama|Electoral history]]
----
* [[Early life and career of Barack Obama|Early life and career]]
* [[Family of Barack Obama|Family]]
* [[Public image of Barack Obama |Public image]]
*[[List of honors and awards received by Barack Obama|Honors]]
----
{{bold div|Pre-presidency}}
* [[Illinois Senate career of Barack Obama|Illinois State Senator]]
* [[2004 Democratic National Convention keynote address|2004 DNC keynote address]]
* [[United States Senate career of Barack Obama|U.S. Senator from Illinois]]
** [[List of bills sponsored by Barack Obama in the United States Senate|sponsored bills]]
----
{{bold div|44th President of the United States}}
* [[Presidency of Barack Obama|Presidency]]
** [[Timeline of the Barack Obama presidency|timeline]]
* [[Presidential transition of Barack Obama|Transition]]
* Inaugurations
** [[First inauguration of Barack Obama|first]]
** [[Second inauguration of Barack Obama|second]]
----
{{bold div|Policies}}
{{Plainlist|
* [[Economic policy of the Barack Obama administration|Economy]]
* [[Energy policy of the Barack Obama administration|Energy]]
* [[Foreign policy of the Barack Obama administration|Foreign policy]]
** [[European foreign policy of the Barack Obama administration|Europe]]
** [[East Asian foreign policy of the Barack Obama administration|East Asia]]
** [[Middle Eastern foreign policy of the Barack Obama administration|Middle East]]
** [[South Asian foreign policy of the Barack Obama administration|South Asia]]
** [[Obama Doctrine]]
** [[List of presidential trips made by Barack Obama|foreign trips]]
* [[List of people granted executive clemency by Barack Obama|Pardons]]
* [[Social policy of the Barack Obama administration|Social]]
* [[Space policy of the Barack Obama administration|Space]]
}}
----
{{bold div|Appointments}}
{{Plainlist|
* [[Cabinet of Barack Obama|Cabinet]]
* [[List of federal judges appointed by Barack Obama|Judiciary]]
** [[Sonia Sotomayor Supreme Court nomination|Sotomayor]]
** [[Elena Kagan Supreme Court nomination|Kagan]]
** [[Merrick Garland Supreme Court nomination|Garland]]
** [[Barack Obama Supreme Court candidates|Supreme Court candidates]]
}}
----
{{bold div|First term}}
* [[First 100 days of Barack Obama's presidency|First 100 days]]
* [[American Recovery and Reinvestment Act of 2009|Recovery Act]]
* [[New START|Russia nuclear treaty]]
* [[Affordable Care Act]]
* [[Dodd–Frank Wall Street Reform and Consumer Protection Act|Dodd–Frank]]
* [[Withdrawal of United States troops from Iraq (2007–2011)|Iraq withdrawal]]
* [[Killing of Osama bin Laden]]
* [[2011 military intervention in Libya|Libya intervention]]
* [[Withdrawal of United States troops from Afghanistan (2011–2016)|Afghanistan withdrawal]]
* [[2012 Benghazi attack|Benghazi attack]]
* Timeline
** [[Timeline of the Barack Obama presidency (2009)|'09]]
** [[Timeline of the Barack Obama presidency (2010)|'10]]
** [[Timeline of the Barack Obama presidency (2011)|'11]]
** [[Timeline of the Barack Obama presidency (2012)|'12]]
----
{{bold div|Second term}}
* [[International military intervention against the Islamic State|Anti-ISIL campaign]]
** [[American-led intervention in Iraq (2014–present)|Iraq]]
** [[American-led intervention in the Syrian civil war|Syria]]
* [[Joint Comprehensive Plan of Action|Iran nuclear deal]]
* [[Cuban thaw]]
* [[International sanctions during the Russo-Ukrainian War|Sanctions against Russia]]
* [[Barack Obama Selma 50th anniversary speech|Selma 50th anniversary speech]]
* ''[[Obergefell v. Hodges]]''
* [[Paris Agreement]]
* [[Kunduz hospital airstrike]]
* Timeline
** [[Timeline of the Barack Obama presidency (2013)|'13]]
** [[Timeline of the Barack Obama presidency (2014)|'14]]
** [[Timeline of the Barack Obama presidency (2015)|'15]]
** [[Timeline of the Barack Obama presidency (2016–January 2017)|'16–'17]]
----
{{hidden|contentstyle=text-align:center;|Presidential campaigns|
* [[Barack Obama 2008 presidential campaign|2008]]
** [[2008 Democratic Party presidential primaries|primaries]]
** [[2008 Democratic National Convention|convention]]
** [[2008 United States presidential debates|debates]]
** [[2008 United States presidential election|election]]
* [[Barack Obama 2012 presidential campaign|2012]]
** [[2012 Democratic Party presidential primaries|primaries]]
** [[2012 Democratic National Convention|convention]]
** [[2012 United States presidential debates|debates]]
** [[2012 United States presidential election|election]]
*** [[International reactions to the 2012 United States presidential election|reactions]]
}}
----
{{bold div|Post-presidency}}
* [[Barack Obama Presidential Center|Planned presidential library]]
* [[Obama Foundation]]
* [[One America Appeal]]
----
* ''[[Dreams from My Father]]''
* ''[[The Audacity of Hope]]''
* ''[[A Promised Land]]''
* [[2009 Nobel Peace Prize|Nobel Peace Prize]]
----
{{bold div|Others}}
* [[Thanks, Obama]]
}}<noinclude>
{{Documentation}}
[[Category:President of the United States sidebar templates]]
</noinclude>
03pljm6g1gbbxtddprrjgyp8h68pvn1
Template:Barack Obama sidebar
10
58568880
861050890
2018-09-24T19:55:36Z
Wow
29534843
Walk Like an Egyptian moved page [[Template:Barack Obama sidebar]] to [[Template:Barack Obama series]]: consistency
wikitext
text/x-wiki
#REDIRECT [[Template:Barack Obama series]]
{{R from move}}
83ox72ehzqvxy4ty9bohjqz6kzgk8mu
Template:Biographical Directory of Congress
10
3897397
1050968648
1004645395
2021-10-20T22:34:44Z
Sdkb
13006032
adding "access-date" alias, following change in CS1 parameter names
wikitext
text/x-wiki
{{#if:{{{inline|}}}||*}}{{cite web
|author={{{author|United States Congress}}}
|url=http://bioguide.congress.gov/scripts/biodisplay.pl?index={{Trim|{{{1|{{{id}}}<!---->}}}<!---->}}
|title={{{2|{{{name<includeonly>|{{PAGENAMEBASE}}</includeonly>}}}<!---->}}} {{#if:{{{noid|}}}||(id: {{Trim|{{{1|{{{id}}}<!---->}}}<!---->}})}}
|work=[[Biographical Directory of the United States Congress]]
|access-date={{{date|{{{access-date|{{{accessdate|}}}}}}<!---->}}}
|ref={{{ref|{{SfnRef|{{{author|United States Congress}}}|{{Trim|{{{1|{{{id}}}<!---->}}}<!---->}}<!---->}} }}}
|mode={{{mode|}}}
}}{{#if:{{{findagrave|}}}|
{{#if:{{{inline|}}}||
*|;}} {{Find a Grave|name={{{2|{{{name|{{PAGENAMEBASE}}}}}}}}|grid={{{findagrave}}}|accessdate={{{date|{{{access-date|{{{accessdate|}}}}}}<!---->}}}<!---->}}
|}}<noinclude>
{{Documentation}}
</noinclude>
0v8snf6r9j9n1szi3cbom8a2dvrofpp
Template:Birth date and age
10
6658694
961179498
941856913
2020-06-07T01:32:39Z
Uzume
51070
update tracking to use [[Module:Wd]] instead of the unmaintained and deprecated [[Module:Wikidata]]
wikitext
text/x-wiki
<includeonly>{{{{{♥|safesubst:}}}#invoke:age|birth_date_and_age}}{{#invoke:Check for unknown parameters|check|ignoreblank=y|preview=Page using [[Template:Birth date and age]] with unknown parameter "_VALUE_"|unknown={{main other|[[Category:Pages using birth date and age template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|1|2|3|day|month|year|df|mf}}{{#ifeq: {{NAMESPACENUMBER}} | 0
| {{#if: {{#invoke:wd|label|raw}}
| {{#if: {{#invoke:String|match|{{#invoke:wd|properties|raw|P31}},|Q5,|1|1|true|}}
| {{#if: {{#invoke:wd|properties|raw|P569}}
|
| [[Category:Date of birth not in Wikidata]]
}}
}}
| [[Category:Articles without Wikidata item]]
}}
}}</includeonly><noinclude>{{documentation}}</noinclude>
a0pyxjpy9sf2d4e6jiwi9hktjdnwilq
Template:Blockquote
10
994397
1031047817
1023888642
2021-06-29T13:56:58Z
Jonesey95
9755426
fix cats post-move (should have been done in December 2020)
wikitext
text/x-wiki
<templatestyles src="Template:Blockquote/styles.css" /><!--
--><blockquote class="templatequote {{{class|}}}" {{#if:{{{style|}}}|style="{{{style}}}"}}>{{{text|{{{content|{{{quotetext|{{{quote|{{{1|<includeonly>{{error|Error: No text given for quotation (or equals sign used in the actual argument to an unnamed parameter)}}{{main other|[[Category:Pages incorrectly using the quote template]]}}</includeonly><noinclude>{{lorem ipsum}}</noinclude>}}}}}}}}}}}}}}}{{#if:{{{sign|}}}{{{cite|}}}{{{author|}}}{{{by|}}}{{{personquoted|}}}{{{source|}}}{{{ts|}}}{{{title|}}}{{{publication|}}}{{{quotesource|}}}{{{char|}}}{{{character|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}}|{{#if:{{{multiline|}}}|<nowiki />}}
<div class="templatequotecite">— <cite>{{#if:{{{char|{{{character|{{{5|}}}}}}}}}|{{{char|{{{character|{{{5|}}}}}}}}}, in }}{{Comma separated entries
| {{if empty|{{{sign|}}}|{{{cite|}}}|{{{author|}}}|{{{by|}}}|{{{personquoted|}}}|{{{2|}}}}}
| {{if empty|{{{title|}}}|{{{publication|}}}|{{{ts|}}}|{{{quotesource|}}}|{{{3|}}}}}
| {{if empty|{{{source|}}}|{{{4|}}}}}
}}</cite></div>
}}</blockquote>{{#if:{{{class|}}}{{{id|}}}{{{diff|}}}{{{4|}}}{{{5|}}}|{{main other|[[Category:Pages incorrectly using the Blockquote template]]}}}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using Blockquote template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Blockquote]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | author | by | char | character | cite | class | content | diff | id | multiline | personquoted | publication | quote | quotesource | quotetext | sign | source | style | text | title | ts }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
tg27x2nft768qonkkbkjnu96fw2fsuo
Template:Blockquote/styles.css
10
58109865
996844942
960796168
2020-12-28T21:59:00Z
JJMC89
24812038
JJMC89 moved page [[Template:Quote/styles.css]] to [[Template:Blockquote/styles.css]] without leaving a redirect: [[Wikipedia:Requested moves|requested move]]; consensus at [[Template talk:Blockquote]]
sanitized-css
text/css
/* {{pp-template}} */
.templatequote {
overflow: hidden;
margin: 1em 0;
padding: 0 40px;
}
.templatequote .templatequotecite {
line-height: 1.5em;
/* @noflip */
text-align: left;
/* @noflip */
padding-left: 1.6em;
margin-top: 0;
}
5iyknyu9w0qaq7phpi470ml3qjlihah
Template:Bold div
10
57969323
1057448147
1057094710
2021-11-27T18:13:23Z
Jonesey95
9755426
Undid revision 1057094710 by [[Special:Contributions/DiegoColle|DiegoColle]] ([[User talk:DiegoColle|talk]]). sockpuppet edit
wikitext
text/x-wiki
<noinclude></noinclude><div style="font-weight: bold;line-height:normal;{{#ifeq:yes|{{yesno|def=|{{{small|}}}}}|font-size:85%;|}}">{{{1}}}</div><noinclude>{{documentation}}</noinclude>
bkaf50r11mc63pq5h6aw3ywbvwjj0sk
Template:Both
10
13984942
752919001
579826991
2016-12-04T04:31:50Z
JJMC89
24812038
make subst'able
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{SAFESUBST:<noinclude />#if:{{{2|}}}|1}}}}<noinclude>
{{documentation}}
</noinclude>
a92g9dgn74wuyygsul02g6cnq29em4t
Template:Box-shadow border
10
54389411
1019583453
998686486
2021-04-24T05:24:06Z
Izno
2927383
you missed one
wikitext
text/x-wiki
{{#switch:{{{1|all}}}
| a | all | #default = box-shadow: inset {{{w|{{{3|1px}}}}}} {{{w|{{{3|1px}}}}}} 0 {{{c1|{{{c|{{{2|#000}}}}}}}}}, inset -{{{w|{{{3|1px}}}}}} -{{{w|{{{3|1px}}}}}} 0 {{{c2|{{{c|{{{2|#000}}}}}}}}};
| t | top = box-shadow: inset 0 {{{w|{{{3|1px}}}}}} 0 0 {{{c|{{{2|#000}}}}}};
| b | bottom = box-shadow: inset 0 -{{{w|{{{3|1px}}}}}} 0 0 {{{c|{{{2|#000}}}}}};
| tb | bt | top bottom | bottom top = box-shadow: inset 0 {{{w|{{{3|1px}}}}}} 0 0 {{{c1|{{{c|{{{2|#000}}}}}}}}}, inset 0 -{{{w|{{{3|1px}}}}}} 0 0 {{{c2|{{{c|{{{2|#000}}}}}}}}};
| lr | rl | left right | right left = box-shadow: inset {{{w|{{{3|1px}}}}}} 0 0 0 {{{c1|{{{c|{{{2|#000}}}}}}}}}, inset -{{{w|{{{3|1px}}}}}} 0 0 0 {{{c2|{{{c|{{{2|#000}}}}}}}}};
| l | left = box-shadow: inset {{{w|{{{3|1px}}}}}} 0 0 0 {{{c|{{{2|#000}}}}}};
| r | right = box-shadow: inset -{{{w|{{{3|1px}}}}}} 0 0 0 {{{c|{{{2|#000}}}}}};
}}<noinclude>
{{Documentation}}
</noinclude>
rurbhtylkzxmynscha2ck5lpu2wervo
Template:Br separated entries
10
27461703
664153181
579827061
2015-05-26T18:06:33Z
Izkala
23051379
Switch to using [[Module:Separated entries]]; leading and trailing whitespace and newlines are now trimmed
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:Separated entries|br}}<noinclude>
{{documentation}}
</noinclude>
3qzqyo0vc2bkjx7dik52fp751jwcnq3
Template:Break
10
15503812
820085761
818623949
2018-01-13T00:13:51Z
Plastikspork
5075409
Add safesubst
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:string|rep|<br/>|{{<includeonly>safesubst:</includeonly>#iferror:{{<includeonly>safesubst:</includeonly>#expr:1*{{{1|1}}}}}|1}}}}<noinclude>
{{Documentation}}
</noinclude>
cq7d25vcc5fumiravxfvnolg1blfyhl
Template:C-SPAN
10
28939092
1079816152
1077444259
2022-03-28T19:30:15Z
Paine Ellsworth
9092818
per edit request on talk page - modify parameter for single-digit values + remove these pages from two maintenance categories
wikitext
text/x-wiki
{{#if:{{{1|}}}|[https://www.c-span.org/person/?{{lc:{{#invoke:String|replace|source={{{1}}}|pattern=%s|replace=|plain=no}}}} Appearances] on [[C-SPAN]]{{Namespace detect|main=[[Category:People appearing on C-SPAN]]}}{{#if:{{#invoke:String|match|s={{{1}}}|pattern=^[0-9][0-9]*$|plain=no|ignore_errors=true}}||{{#ifeq:{{ROOTPAGENAME}}|C-SPAN||[[Category:Pages using non-numeric C-SPAN identifiers]]}}{{preview warning|Invalid or deprecated input format; use a numeric C-SPAN ID with no leading zeros}}}}|{{#if:{{wikidata|property|P2190}}|[https://www.c-span.org/person/?{{wikidata|property|P2190}} Appearances] on [[C-SPAN]] {{EditAtWikidata|pid=P2190}}{{Namespace detect|main=[[Category:People appearing on C-SPAN]]}}|{{#ifeq:{{ROOTPAGENAME}}|C-SPAN||[[Category:C-SPAN template failing to display]]}}{{preview warning|No Wikidata value found as fallback; add a valid C-SPAN ID to this template or this page's Wikidata item}}}}}}<noinclude>
{{Documentation}}
</noinclude>
ou07qigwaf7gdmntjsr126ekvng5mmf
Template:Catalog lookup link
10
50392128
862301591
855471681
2018-10-03T13:51:48Z
Trappist the monk
10289486
Undid revision 855471681 by [[Special:Contributions/Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) restore the change now that the cs1|2 modules have been updated;
wikitext
text/x-wiki
<templatestyles src="Module:Citation/CS1/styles.css" />{{#invoke:Catalog lookup link|main}}<noinclude>
{{documentation}}
</noinclude>
464h1jyus0m20p4x31lf2k2pqgseen5
Template:Category handler
10
25084818
874046584
577959188
2018-12-16T20:13:00Z
Amorymeltzer
141948
Changed protection level for "[[Template:Category handler]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, and interwikis to Wikidata. -->
</noinclude>
og6fhyj2ssd4fmzpqzuodk12q3cms0z
Template:Cbignore
10
47034649
728106388
728096339
2016-07-03T06:47:44Z
Closedmouth
372693
Protected "[[Template:Cbignore]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require template editor access] (indefinite))
wikitext
text/x-wiki
<noinclude>{{documentation}}</noinclude>
56q3glwxua861ekqmxdmx0ovfq3zxj9
Template:ChicagoTribuneKeyword
10
47813537
887191038
883714660
2019-03-11T04:11:22Z
DannyS712
34581532
Reverted to revision 681045374 by [[Special:Contributions/HughD|HughD]] ([[User talk:HughD|talk]]): Revert to pre-vandalism ([[WP:TW|TW]])
wikitext
text/x-wiki
<includeonly>[http://articles.chicagotribune.com/keyword/{{urlencode:{{lc:{{#invoke:String|replace|{{{1|{{BASEPAGENAME}}}}}| |-|plain=true}}}}}} {{{2|{{BASEPAGENAME}}}}}] articles in the archive of the ''[[Chicago Tribune]]''</includeonly><noinclude>
{{documentation}}
</noinclude>
dq8ts30gm8ldm7r46yw3h3x3xo46b3f
Template:Citation needed
10
2048472
1087547841
1087547784
2022-05-13T03:22:19Z
Hyacinth
17171
Reverted edits by [[Special:Contribs/Hyacinth|Hyacinth]] ([[User talk:Hyacinth|talk]]) to last version by Izno
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||date=__DATE__ |$B=
{{Fix
|name={{{name|Citation needed}}}
|link=Wikipedia:Citation needed
|text=citation needed
|class=Template-Fact
|title={{{reason|This claim needs references to reliable sources.}}}
|date={{{date|}}}
|cat=[[Category:All articles with unsourced statements]]
|cat-date=Category:Articles with unsourced statements
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages containing citation needed template with unsupported parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Citation needed]] with unknown parameter "_VALUE_"|ignoreblank=y| date | name | reason }}}}<noinclude>
{{Documentation}}
</noinclude>
1lanyzdl8lz3t31vc8lz268dkp3nq5h
Template:Cite WS
10
31254085
865353306
579832278
2018-10-23T12:02:38Z
Jonesey95
9755426
Fix empty citation, unnamed or unsupported parameter, or invalid parameter value; see [[Help:CS1 errors]] (tested in sandbox)
wikitext
text/x-wiki
{{#if:{{{link|}}}|[[s:{{{link|}}}{{!}}{{{title}}}]] }}{{#if:{{{scan|}}}|<small>[[s:{{{scan|}}}{{!}}''[scan]'']]</small> }}[[Image:wikisource-logo.svg|11px|link=Wikisource|Wikisource has information on "{{{link}}}"]]<noinclude>{{shortcut|Template:Cws}}
{{documentation}}
</noinclude>
h6mip7b2jlxlm9rrv4f5an84yanv7pt
Template:Cite book
10
4086375
810449908
810433573
2017-11-15T09:11:45Z
Salix alba
212526
put TD in a collapse top / bottom section
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=book
}}</includeonly><noinclude>
{{documentation}}
{{collapse top|TemplateData}}
{{Cite book/TemplateData}}
{{collapse bottom}}
</noinclude>
my4yy07itdv4e2t5sc1x4l3pzgpmzo7
Template:Cite journal
10
4740319
690395473
579832342
2015-11-13T02:17:24Z
Fuhghettaboutit
665998
Changed protection level of Template:Cite journal: 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] (in...
wikitext
text/x-wiki
<includeonly>{{#invoke:Citation/CS1|citation
|CitationClass=journal
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
9fcytsszanq7xbwi3p28zsneear9938
Template:Cite magazine
10
7559370
886312468
745413566
2019-03-05T14:21:58Z
Xaosflux
502540
Changed protection level for "[[Template:Cite magazine]]": Pages alread protected from [[Wikipedia:Cascade-protected items/content]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:Citation/CS1|citation
|CitationClass=magazine
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
ihdnkvb90c6voz3z3uc97mmw5bytrkw
Template:Cite news
10
4321630
828626614
828404709
2018-03-03T19:19:37Z
Jo-Jo Eumerus
17449355
Per edit request on [[Help talk:Citation Style 1]]
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=news
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
pbjnspfej5gxihr9izxrzkow3f1uf3i
Template:Cite press release
10
4821205
828626560
828404714
2018-03-03T19:19:13Z
Jo-Jo Eumerus
17449355
Per edit request on [[Help talk:Citation Style 1]]
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=pressrelease
|type={{{type|Press release}}}
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
rrr868rn0dee6pi9d99bhza0kd1bh7s
Template:Cite report
10
17977116
827245175
647289185
2018-02-23T16:29:42Z
Primefac
11508456
Changed protection level for "[[Template:Cite report]]": [[WP:HIGHRISK|high-risk]] template with 4000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=report
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
fs19owa9dz9vn4e3ic0cogi85vev72c
Template:Cite web
10
1252907
753103437
753063659
2016-12-05T05:36:52Z
Anthony Appleyard
119438
Protected "[[Template:Cite web]]": restore old protection ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
rcgmbcxu7hvs583g1f3rzz4c4dkizda
Template:Clear
10
1239772
1092941152
684162145
2022-06-13T15:31:11Z
Xaosflux
502540
Changed protection settings for "[[Template:Clear]]": [[WP:High-risk templates|Highly visible template]]: 3MM+ uses ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};"></div><noinclude>
{{documentation}}
</noinclude>
6mk3e4afot6hzu6tzbljxxk83e14xv6
Template:Color
10
976819
646047453
579833041
2015-02-07T15:43:19Z
Pigsonthewing
26248
allow simple form; will document
wikitext
text/x-wiki
<span style="color:{{{1|}}}">{{{2|{{{1|}}}}}}</span><noinclude>{{Documentation}}<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --></noinclude>
s66u50lzf1g4d955nh4mw43vypr0i16
Template:CongBio
10
31218714
577861047
419448943
2013-10-19T16:32:15Z
WOSlinker
3138265
Changed protection level of Template:CongBio: allow template editors to modify ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))
wikitext
text/x-wiki
#REDIRECT [[Template:Biographical Directory of Congress]]
eyjns99rcjvwzupmosrmpuhhp8pfzeb
Template:Convert
10
8387047
972056284
585529792
2020-08-09T22:52:24Z
Bsherr
4386431
adding comment
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
Template:Curlie
10
2559871
897252023
895724629
2019-05-15T19:58:05Z
Jo-Jo Eumerus
17449355
TFD closed as keep ([[WP:XFDC|XFDcloser]])
wikitext
text/x-wiki
{{#switch: {{{3|}}}|#default=[https://curlie.org/{{{1|<includeonly>{{PAGENAME}}</includeonly>}}} {{{2|{{PAGENAME}}}}}] at [[Curlie]]
|user=[https://curlie.org/public/profile?editor={{{1}}} {{{2|{{PAGENAME}}}}}] at [[Curlie]]}}{{main other|[[Category:Articles with Curlie links]]|}}<noinclude>
{{Documentation}}</noinclude>
3k7z2r5srutmqgcsz3azl16x1a15q5n
Template:Cws
10
31254143
774570886
539215622
2017-04-09T09:55:13Z
Jo-Jo Eumerus
17449355
Changed protection level for "[[Template:Cws]]": Matching redirect target ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
#REDIRECT[[Template:Cite WS]]
oc79euqnxwavvfufj6v8uwfp0gp0zbz
Template:DMCA
10
23226218
774491639
296800547
2017-04-08T20:40:50Z
Jo-Jo Eumerus
17449355
Changed protection level for "[[Template:DMCA]]": [[WP:High-risk templates|Highly visible template]]: Allowing template editors ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{Dated maintenance category
|onlyarticles=yes
|1={{{1|}}}
|2={{{2|}}}
|3={{{3|}}}
|4={{{4|}}}
|5={{{5|}}}
}}<noinclude>
{{documentation|Template:Dated maintenance category/doc}}
</noinclude>
cl1tba6o83bu6hpmnvwvbcse6qwofoo
Template:Dated maintenance category
10
22598546
589732290
584337311
2014-01-08T08:14:55Z
John of Reading
11308236
Second attempt. Those spaces upset inline templates such as {{As of}}. Instead, try an unconditional <nowiki/>
wikitext
text/x-wiki
<nowiki/><!--This nowiki helps to prevent whitespace at the top of articles-->{{#ifeq:{{FULLROOTPAGENAME}}|Wikipedia:Template messages|<!--Do not categorize-->|<!--
-->{{#ifexpr:{{#if:{{NAMESPACE}}|0|1}}+{{#ifeq:{{{onlyarticles|no}}}|yes|0|1}}
|{{#if:{{{3|}}}
|[[Category:{{{1}}} {{{2}}} {{{3}}}]]<!--
-->{{#ifexist:Category:{{{1}}} {{{2}}} {{{3}}}
|<!--
-->|[[Category:Articles with invalid date parameter in template]]<!--
-->}}
|[[Category:{{#if:{{{5|}}}
|{{{5}}}<!--
-->|{{{1}}}<!--
-->}}]]<!--
-->}}{{#if:{{{4|}}}
|[[Category:{{{4}}}]]}}<!--
-->}}<!--
-->}}<noinclude>
{{documentation}}
</noinclude>
7p59j4cq4i8wg65odpv5287yu50sczo
Template:Delink
10
28069338
696877808
695173639
2015-12-26T16:26:10Z
Frietjes
13791031
{{documentation}} does this
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:delink|delink}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
nxxwkb2lon9wgne4irg9ctbsle6zwiy
Template:Delink question hyphen-minus
10
56351685
838229938
837070499
2018-04-25T18:40:36Z
Ahecht
2016996
{{{1|}}}
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:MultiReplace|main|{{{1|}}}|%[%[ *([%?-]) *%]%]|%1|%[%[ *[%?-] *{{{{{|safesubst:}}}!}} *(.-) *%]%]|%1}}<noinclude>
{{documentation}}
</noinclude>
seykcgh5i4z4txiyy39dvgr1hp8kqvi
Template:Democratic Party (US)/meta/shading
10
61400285
1095166021
1095151898
2022-06-26T19:43:55Z
Charlesaaronthompson
11346867
Undid revision 1095151898 by [[Special:Contributions/Charlesaaronthompson|Charlesaaronthompson]] ([[User talk:Charlesaaronthompson|talk]]) Never mind.
wikitext
text/x-wiki
<nowiki />#B0CEFF<noinclude>
{{Documentation}}
</noinclude>
gjjjyt48o527n9tv0n9e3dh1xe7wgt3
Template:Democratic Party (United States)
10
2476313
1095166103
1095153418
2022-06-26T19:44:30Z
Charlesaaronthompson
11346867
Undid revision 1095153418 by [[Special:Contributions/Charlesaaronthompson|Charlesaaronthompson]] ([[User talk:Charlesaaronthompson|talk]]) Never mind.
wikitext
text/x-wiki
{{#invoke:navbox|navbox
| name = Democratic Party (United States)
| title = [[Democratic Party (United States)|<span style="color:#fff;">Democratic Party</span>]]
| titlestyle= background:{{party color|Democratic Party (United States)}}; color:white
| bodyclass = hlist
| basestyle= background:{{Democratic Party (US)/meta/shading}};
| state = {{{state|collapsed}}}
| above = * [[History of the Democratic Party (United States)|History]]
** [[Second Party System]]
** [[Third Party System]]
** [[Fourth Party System]]
** [[Fifth Party System]]
** [[Sixth Party System]]
| group1 = [[Democratic National Convention|National<br>conventions]]<br/>and<br/>[[List of United States Democratic Party presidential tickets|presidential<br>tickets]]
| list1 =
* [[1828 United States presidential election#Democratic Party nomination|1828 (None)]]: [[Andrew Jackson|Jackson]]/[[John C. Calhoun|Calhoun]]
* [[1832 Democratic National Convention|1832 (Baltimore)]]: [[Andrew Jackson|Jackson]]/[[Martin Van Buren|Van Buren]]
* [[1835 Democratic National Convention|1835 (Baltimore)]]: [[Martin Van Buren|Van Buren]]/[[Richard Mentor Johnson|R. Johnson]]
* [[1840 Democratic National Convention|1840 (Baltimore)]]: [[Martin Van Buren|Van Buren]]/''None''
* [[1844 Democratic National Convention|1844 (Baltimore)]]: [[James K. Polk|Polk]]/[[George M. Dallas|Dallas]]
* [[1848 Democratic National Convention|1848 (Baltimore)]]: [[Lewis Cass|Cass]]/[[William Orlando Butler|Butler]]
* [[1852 Democratic National Convention|1852 (Baltimore)]]: [[Franklin Pierce|Pierce]]/[[William R. King|King]]
* [[1856 Democratic National Convention|1856 (Cincinnati)]]: [[James Buchanan|Buchanan]]/[[John C. Breckinridge|Breckinridge]]
* [[1860 Democratic National Conventions|1860 (Charleston/Baltimore)]]: [[Stephen A. Douglas|Douglas]]/[[Herschel Vespasian Johnson|H. Johnson]] ([[John C. Breckinridge|Breckinridge]]/[[Joseph Lane|Lane]], [[Southern Democrats|SD]])
* [[1864 Democratic National Convention|1864 (Chicago)]]: [[George B. McClellan|McClellan]]/[[George H. Pendleton|Pendleton]]
* [[1868 Democratic National Convention|1868 (New York)]]: [[Horatio Seymour|Seymour]]/[[Francis Preston Blair Jr.|Blair]]
* [[1872 Democratic National Convention|1872 (Baltimore)]]: [[Horace Greeley|Greeley]]/[[Benjamin Gratz Brown|Brown]]
* [[1876 Democratic National Convention|1876 (Saint Louis)]]: [[Samuel J. Tilden|Tilden]]/[[Thomas A. Hendricks|Hendricks]]
* [[1880 Democratic National Convention|1880 (Cincinnati)]]: [[Winfield Scott Hancock|Hancock]]/[[William Hayden English|English]]
* [[1884 Democratic National Convention|1884 (Chicago)]]: [[Grover Cleveland|Cleveland]]/[[Thomas A. Hendricks|Hendricks]]
* [[1888 Democratic National Convention|1888 (Saint Louis)]]: [[Grover Cleveland|Cleveland]]/[[Allen G. Thurman|Thurman]]
* [[1892 Democratic National Convention|1892 (Chicago)]]: [[Grover Cleveland|Cleveland]]/[[Adlai Stevenson I|Stevenson I]]
* [[1896 Democratic National Convention|1896 (Chicago)]]: [[William Jennings Bryan|W. Bryan]]/[[Arthur Sewall|Sewall]]
* [[1900 Democratic National Convention|1900 (Kansas City)]]: [[William Jennings Bryan|W. Bryan]]/[[Adlai Stevenson I|Stevenson I]]
* [[1904 Democratic National Convention|1904 (Saint Louis)]]: [[Alton B. Parker|Parker]]/[[Henry Gassaway Davis|H. Davis]]
* [[1908 Democratic National Convention|1908 (Denver)]]: [[William Jennings Bryan|W. Bryan]]/[[John W. Kern|Kern]]
* [[1912 Democratic National Convention|1912 (Baltimore)]]: [[Woodrow Wilson|Wilson]]/[[Thomas R. Marshall|Marshall]]
* [[1916 Democratic National Convention|1916 (Saint Louis)]]: [[Woodrow Wilson|Wilson]]/[[Thomas R. Marshall|Marshall]]
* [[1920 Democratic National Convention|1920 (San Francisco)]]: [[James M. Cox|Cox]]/[[Franklin D. Roosevelt|Roosevelt]]
* [[1924 Democratic National Convention|1924 (New York)]]: [[John W. Davis|J. Davis]]/[[Charles W. Bryan|C. Bryan]]
* [[1928 Democratic National Convention|1928 (Houston)]]: [[Al Smith|Smith]]/[[Joseph Taylor Robinson|Robinson]]
* [[1932 Democratic National Convention|1932 (Chicago)]]: [[Franklin D. Roosevelt|Roosevelt]]/[[John Nance Garner|Garner]]
* [[1936 Democratic National Convention|1936 (Philadelphia)]]: [[Franklin D. Roosevelt|Roosevelt]]/[[John Nance Garner|Garner]]
* [[1940 Democratic National Convention|1940 (Chicago)]]: [[Franklin D. Roosevelt|Roosevelt]]/[[Henry A. Wallace|Wallace]]
* [[1944 Democratic National Convention|1944 (Chicago)]]: [[Franklin D. Roosevelt|Roosevelt]]/[[Harry S. Truman|Truman]]
* [[1948 Democratic National Convention|1948 (Philadelphia)]]: [[Harry S. Truman|Truman]]/[[Alben W. Barkley|Barkley]]
* [[1952 Democratic National Convention|1952 (Chicago)]]: [[Adlai Stevenson II|Stevenson II]]/[[John Sparkman|Sparkman]]
* [[1956 Democratic National Convention|1956 (Chicago)]]: [[Adlai Stevenson II|Stevenson II]]/[[Estes Kefauver|Kefauver]]
* [[1960 Democratic National Convention|1960 (Los Angeles)]]: [[John F. Kennedy|Kennedy]]/[[Lyndon B. Johnson|L. Johnson]]
* [[1964 Democratic National Convention|1964 (Atlantic City)]]: [[Lyndon B. Johnson|L. Johnson]]/[[Hubert Humphrey|Humphrey]]
* [[1968 Democratic National Convention|1968 (Chicago)]]: [[Hubert Humphrey|Humphrey]]/[[Edmund Muskie|Muskie]]
* [[1972 Democratic National Convention|1972 (Miami Beach)]]: [[George McGovern|McGovern]]/([[Thomas Eagleton|Eagleton]], [[Sargent Shriver|Shriver]])
* [[1976 Democratic National Convention|1976 (New York)]]: [[Jimmy Carter|Carter]]/[[Walter Mondale|Mondale]]
* [[1980 Democratic National Convention|1980 (New York)]]: [[Jimmy Carter|Carter]]/[[Walter Mondale|Mondale]]
* [[1984 Democratic National Convention|1984 (San Francisco)]]: [[Walter Mondale|Mondale]]/[[Geraldine Ferraro|Ferraro]]
* [[1988 Democratic National Convention|1988 (Atlanta)]]: [[Michael Dukakis|Dukakis]]/[[Lloyd Bentsen|Bentsen]]
* [[1992 Democratic National Convention|1992 (New York)]]: [[Bill Clinton|B. Clinton]]/[[Al Gore|Gore]]
* [[1996 Democratic National Convention|1996 (Chicago)]]: [[Bill Clinton|B. Clinton]]/[[Al Gore|Gore]]
* [[2000 Democratic National Convention|2000 (Los Angeles)]]: [[Al Gore|Gore]]/[[Joe Lieberman|Lieberman]]
* [[2004 Democratic National Convention|2004 (Boston)]]: [[John Kerry|Kerry]]/[[John Edwards|Edwards]]
* [[2008 Democratic National Convention|2008 (Denver)]]: [[Barack Obama|Obama]]/[[Joe Biden|Biden]]
* [[2012 Democratic National Convention|2012 (Charlotte)]]: [[Barack Obama|Obama]]/[[Joe Biden|Biden]]
* [[2016 Democratic National Convention|2016 (Philadelphia)]]: [[Hillary Clinton|H. Clinton]]/[[Tim Kaine|Kaine]]
* [[2020 Democratic National Convention|2020 (Milwaukee/other locations)]]: [[Joe Biden|Biden]]/[[Kamala Harris|Harris]]
| group2 = [[List of presidents of the United States|Presidential]]<br>[[Administration (government)|administrations]]
| list2 =
* [[Presidency of Andrew Jackson|Jackson]] (1829–1837)
* [[Presidency of Martin Van Buren|Van Buren]] (1837–1841)
* [[Presidency of James K. Polk|Polk]] (1845–1849)
* [[Presidency of Franklin Pierce|Pierce]] (1853–1857)
* [[Presidency of James Buchanan|Buchanan]] (1857–1861)
* [[Presidency of Andrew Johnson|A. Johnson]] (1868–1869)
* [[Presidencies of Grover Cleveland|Cleveland]] (1885–1889; 1893–1897)
* [[Presidency of Woodrow Wilson|Wilson]] (1913–1921)
* Roosevelt ([[Presidency of Franklin D. Roosevelt, first and second terms|1933–1941]]; [[Presidency of Franklin D. Roosevelt, third and fourth terms|1941–1945]])
* [[Presidency of Harry S. Truman|Truman]] (1945–1953)
* [[Presidency of John F. Kennedy|Kennedy]] (1961–1963)
* [[Presidency of Lyndon B. Johnson|L. B. Johnson]] (1963–1969)
* [[Presidency of Jimmy Carter|Carter]] (1977–1981)
* [[Presidency of Bill Clinton|Clinton]] (1993–2001)
* [[Presidency of Barack Obama|Obama]] (2009–2017)
* [[Presidency of Joe Biden|Biden]] (2021–present)
| group3 = [[Party leaders of the United States House of Representatives|U.S. House<br>leaders]]<br>and<br>[[House Democratic Caucus|caucus<br>chairs]]
| list3 =
* [[Andrew Stevenson|A. Stevenson]] (1827–1834)
* [[John Bell (Tennessee politician)|Bell]] (1834–1835)
* [[James K. Polk|Polk]] (1835–1839)
* [[John Winston Jones|J. W. Jones]] (1843–1845)
* [[John Wesley Davis|Davis]] (1845–1847)
* [[Howell Cobb|Cobb]] (1849–1851)
* [[Linn Boyd|Boyd]] (1851–1855)
* [[George Washington Jones (Tennessee politician)|G. W. Jones]] (1855–1857)
* [[James Lawrence Orr|Orr]] (1857–1859)
* [[George S. Houston|Houston]] (1859–1861)
* [[William E. Niblack|Niblack]]/[[Samuel J. Randall|Randall]] (1869–1871)
* [[William E. Niblack|Niblack]] (1873–1875)
* [[Michael C. Kerr|Kerr]] (1875–1876)
* [[Samuel J. Randall|Randall]] (1876–1881)
* [[John G. Carlisle|Carlisle]] (1883–1889)
* [[William S. Holman|Holman]] (1889–1891)
* [[Charles Frederick Crisp|Crisp]] (1891–1895)
* [[David B. Culberson|D. B. Culberson]] (1895–1897)
* [[James D. Richardson|Richardson]] (1897–1903)
* [[John Sharp Williams|Williams]] (1903–1909)
* [[Champ Clark|Clark]] (1909–1921)
* [[Claude Kitchin|Kitchin]] (1921–1923)
* [[Finis J. Garrett|Garrett]] (1923–1929)
* [[John Nance Garner|Garner]] (1929–1933)
* [[Henry Thomas Rainey|Rainey]] (1933–1934)
* [[Jo Byrns|Byrns]] (1935–1936)
* [[William B. Bankhead|Bankhead]] (1936–1940)
* [[Sam Rayburn|Rayburn]] (1940–1961)
* [[John W. McCormack|McCormack]] (1962–1971)
* [[Carl Albert|Albert]] (1971–1977)
* [[Tip O'Neill|O'Neill]] (1977–1987)
* [[Jim Wright|Wright]] (1987–1989)
* [[Tom Foley|Foley]] (1989–1995)
* [[Dick Gephardt|Gephardt]] (1995–2003)
* [[Nancy Pelosi|Pelosi]] (2003–present)
| group4 = [[Party leaders of the United States Senate|U.S. Senate<br>leaders]]<br>and<br>[[Senate Democratic Caucus|caucus<br>chairs]]
| list4 =
* [[John W. Stevenson|J. W. Stevenson]] (1873–1877)
* [[William A. Wallace|Wallace]] (1877–1881)
* [[George H. Pendleton|Pendleton]] (1881–1885)
* [[James B. Beck|Beck]] (1885–1890)
* [[Arthur Pue Gorman|Gorman]] (1890–1898)
* [[David Turpie|Turpie]] (1898–1899)
* [[James Kimbrough Jones|J. K. Jones]] (1899–1903)
* [[Arthur Pue Gorman|Gorman]] (1903–1906)
* [[Joseph Clay Stiles Blackburn|Blackburn]] (1906–1907)
* [[Charles Allen Culberson|C. A. Culberson]] (1907–1909)
* [[Hernando Money|Money]] (1909–1911)
* [[Thomas S. Martin|Martin]] (1911–1913)
* [[John W. Kern|Kern]] (1913–1917)
* [[Thomas S. Martin|Martin]] (1917–1919)
* [[Gilbert Hitchcock|Hitchcock]] (1919–1920)
* [[Oscar Underwood|Underwood]] (1920–1923)
* [[Joseph Taylor Robinson|Robinson]] (1923–1937)
* [[Alben W. Barkley|Barkley]] (1937–1949)
* [[Scott W. Lucas|Lucas]] (1949–1951)
* [[Ernest McFarland|McFarland]] (1951–1953)
* [[Lyndon B. Johnson|Johnson]] (1953–1961)
* [[Mike Mansfield|Mansfield]] (1961–1977)
* [[Robert Byrd|Byrd]] (1977–1989)
* [[George J. Mitchell|Mitchell]] (1989–1995)
* [[Tom Daschle|Daschle]] (1995–2005)
* [[Harry Reid|Reid]] (2005–2017)
* [[Chuck Schumer|Schumer]] (2017–present)
| group5 = Chairs of<br>the [[Democratic National Committee|DNC]]
| list5 =
* [[Benjamin F. Hallett|Hallett]]
* [[Robert Milligan McLane|McLane]]
* [[David Allen Smalley|Smalley]]
* [[August Belmont|Belmont]]
* [[Augustus Schell|Schell]]
* [[Abram Hewitt|Hewitt]]
* [[William Henry Barnum|Barnum]]
* [[Calvin S. Brice|Brice]]
* [[William F. Harrity|Harrity]]
* [[James Kimbrough Jones|Jones]]
* [[Thomas Taggart|Taggart]]
* [[Norman E. Mack|Mack]]
* [[William F. McCombs|McCombs]]
* [[Vance C. McCormick|McCormick]]
* [[Homer Stille Cummings|Cummings]]
* [[George White (Ohio politician)|White]]
* [[Cordell Hull|Hull]]
* [[Clem L. Shaver|Shaver]]
* [[John J. Raskob|Raskob]]
* [[James Farley|Farley]]
* [[Edward J. Flynn|Flynn]]
* [[Frank Comerford Walker|Walker]]
* [[Robert E. Hannegan|Hannegan]]
* [[J. Howard McGrath|McGrath]]
* [[William M. Boyle|Boyle]]
* [[Frank E. McKinney|McKinney]]
* [[Stephen A. Mitchell (politician)|Mitchell]]
* [[Paul Butler (lawyer)|Butler]]
* [[Henry M. Jackson|Jackson]]
* [[John Moran Bailey|Bailey]]
* [[Larry O'Brien|O'Brien]]
* [[Fred R. Harris|Harris]]
* [[Larry O'Brien|O'Brien]]
* [[Jean Westwood (politician)|Westwood]]
* [[Robert S. Strauss|Strauss]]
* [[Kenneth M. Curtis|Curtis]]
* [[John Coyle White|White]]
* [[Charles Manatt|Manatt]]
* [[Paul G. Kirk|Kirk]]
* [[Ron Brown|Brown]]
* [[David Wilhelm|Wilhelm]]
* [[Debra DeLee|DeLee]]
* [[Chris Dodd|Dodd]]/[[Donald Fowler|Fowler]]
* [[Roy Romer|Romer]]/[[Steven Grossman (politician)|Grossman]]
* [[Ed Rendell|Rendell]]/[[Joe Andrew|Andrew]]
* [[Terry McAuliffe|McAuliffe]]
* [[Howard Dean|Dean]]
* [[Tim Kaine|Kaine]]
* [[Debbie Wasserman Schultz|Wasserman Schultz]]
* [[Tom Perez|Perez]]
* [[Jaime Harrison|Harrison]]
| group6 = [[List of state parties of the Democratic Party (United States)|State and<br>territorial<br>parties]]
| list6 =
* [[Alabama Democratic Party|Alabama]]
* [[Alaska Democratic Party|Alaska]]
* [[Arizona Democratic Party|Arizona]]
* [[Democratic Party of Arkansas|Arkansas]]
* [[California Democratic Party|California]]
* [[Colorado Democratic Party|Colorado]]
* [[Democratic Party of Connecticut|Connecticut]]
* [[Delaware Democratic Party|Delaware]]
* [[Florida Democratic Party|Florida]]
* [[Democratic Party of Georgia|Georgia]]
* [[Democratic Party of Hawaii|Hawaii]]
* [[Idaho Democratic Party|Idaho]]
* [[Democratic Party of Illinois|Illinois]]
* [[Indiana Democratic Party|Indiana]]
* [[Iowa Democratic Party|Iowa]]
* [[Kansas Democratic Party|Kansas]]
* [[Kentucky Democratic Party|Kentucky]]
* [[Louisiana Democratic Party|Louisiana]]
* [[Maine Democratic Party|Maine]]
* [[Maryland Democratic Party|Maryland]]
* [[Massachusetts Democratic Party|Massachusetts]]
* [[Michigan Democratic Party|Michigan]]
* [[Minnesota Democratic–Farmer–Labor Party|Minnesota]]
* [[Mississippi Democratic Party|Mississippi]]
* [[Missouri Democratic Party|Missouri]]
* [[Montana Democratic Party|Montana]]
* [[Nebraska Democratic Party|Nebraska]]
* [[Nevada Democratic Party|Nevada]]
* [[New Hampshire Democratic Party|New Hampshire]]
* [[New Jersey Democratic State Committee|New Jersey]]
* [[Democratic Party of New Mexico|New Mexico]]
* [[New York State Democratic Committee|New York]]
* [[North Carolina Democratic Party|North Carolina]]
* [[North Dakota Democratic–Nonpartisan League Party|North Dakota]]
* [[Ohio Democratic Party|Ohio]]
* [[Oklahoma Democratic Party|Oklahoma]]
* [[Democratic Party of Oregon|Oregon]]
* [[Pennsylvania Democratic Party|Pennsylvania]]
* [[Rhode Island Democratic Party|Rhode Island]]
* [[South Carolina Democratic Party|South Carolina]]
* [[South Dakota Democratic Party|South Dakota]]
* [[Tennessee Democratic Party|Tennessee]]
* [[Texas Democratic Party|Texas]]
* [[Utah Democratic Party|Utah]]
* [[Vermont Democratic Party|Vermont]]
* [[Democratic Party of Virginia|Virginia]]
* [[Washington State Democratic Party|Washington]]
* [[West Virginia Democratic Party|West Virginia]]
* [[Democratic Party of Wisconsin|Wisconsin]]
* [[Wyoming Democratic Party|Wyoming]]
* [[American Samoa Democratic Party|American Samoa]]
* [[District of Columbia Democratic State Committee|District of Columbia]]
* [[Democratic Party of Guam|Guam]]
* [[Democratic Party (Northern Mariana Islands)|Northern Mariana Islands]]
* [[Democratic Party (Puerto Rico)|Puerto Rico]]
* [[Democratic Party of the Virgin Islands|Virgin Islands]]
* [[Democrats Abroad]]
| group7 = [[Democratic Party (United States) organizations|Affiliated<br>groups]]
| list7 = {{#invoke:Navbox|navbox|subgroup
| basestyle= background:{{Democratic Party (US)/meta/shading}};
|group1 = Congress
|list1 =
* [[Senate Democratic Caucus|Senate Caucus]]
** [[United States Senate Democratic Policy Committee|Policy Committee]]
** [[United States Senate Democratic Steering and Outreach Committee|Steering and Outreach Committee]]
** [[United States Senate Democratic Conference Secretary]]
* [[House Democratic Caucus|House Caucus]]
| group2 = Fundraising
| list2 =
* [[Democratic Congressional Campaign Committee]]
* [[Democratic Governors Association]]
* [[Democratic Legislative Campaign Committee]]
* [[Democratic Senatorial Campaign Committee]]
* [[National Conference of Democratic Mayors]]
* [[National Democratic Redistricting Committee]]
| group3 = Sectional
|list3 =
* [[College Democrats of America]]
* [[Democrats Abroad]]
* [[National Federation of Democratic Women]]
* [[Stonewall Democrats]]
** [[Stonewall Young Democrats]]
* [[Young Democrats of America]]
* [[High School Democrats of America]]
}}
| group8 = Related
| list8 =
* [[List of Democratic Party presidential primaries|Primaries]]
* [[List of United States Democratic Party presidential candidates|Presidential candidates]]
* [[Democratic Party presidential debates|Debates]]
* [[Factions in the Democratic Party (United States)|Party factions]]
* [[Superdelegate]]
* [[2005 Democratic National Committee chairmanship election|2005 chairmanship election]]
* [[2017 Democratic National Committee chairmanship election|2017 chairmanship election]]
* [[2006 United States House of Representatives Democratic Caucus leadership election|2006 House Caucus leadership election]]
* [[2018 United States House of Representatives Democratic Caucus leadership election|2018 House Caucus leadership election]]
* [[Weekly Democratic Address]]
}}<noinclude>
{{documentation|Template:United States political parties/doc}}
[[Category:United States Democratic Party templates| ]]
[[Category:Democratic National Conventions|*]]
[[Category:Democratic Party (United States) presidential nominees|τ]]
[[Category:United States government navigational boxes|Democratic]]
</noinclude>
nch39e9hxj4nb0o2a30uoimtnr8n4gg
Template:Div col
10
12679552
1006814038
1006811674
2021-02-14T23:20:57Z
Matt Fitzpatrick
291848
whitelist parameter class
wikitext
text/x-wiki
<includeonly><templatestyles src="Div col/styles.css"/><!--
--><div class="div-col {{#ifeq:{{{small|}}}|yes|div-col-small}} {{#ifeq:{{{rules|}}}|yes|div-col-rules}} {{{class|}}}" <!--
-->{{#if:{{{colwidth|}}}{{{gap|}}}{{{style|}}}|<!--
-->style="{{#if:{{{colwidth|}}}|column-width: {{{colwidth}}};}}{{#if:{{{gap|}}}|column-gap: {{{gap}}};}}{{#if:{{{style|}}}|{{{style}}}}}"<!--
-->}}><!--
-->{{#if:{{{content|}}}|{{{content}}}</div>}}<!-- Inventory how many pages use small=yes
-->{{#ifeq:{{{small|}}}|yes|[[Category:Pages using div col with small parameter]]}}<!--
--></includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using div col with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Div col]] with unknown parameter "_VALUE_"; use colwidth= to specify column size |ignoreblank=y | class | colwidth | content | gap | rules | small | style }}<noinclude>
{{Documentation}}
</noinclude>
cwqp9gtrnaa6hga4rh0s9vzcnfwr54n
Template:Div col/styles.css
10
66114304
998391716
994648498
2021-01-05T04:54:19Z
Izno
2927383
remove the note as not generally necessary
sanitized-css
text/css
/* {{pp|small=yes}} */
.div-col {
margin-top: 0.3em;
column-width: 30em;
}
.div-col-small {
font-size: 90%;
}
.div-col-rules {
column-rule: 1px solid #aaa;
}
/* Reset top margin for lists in div col */
.div-col dl,
.div-col ol,
.div-col ul {
margin-top: 0;
}
/* Avoid elements breaking between columns
See also Template:No col break */
.div-col li,
.div-col dd {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
n7twp689l8hrwuefq6a9a414zrxegfw
Template:Div col end
10
12679680
683947856
627002509
2015-10-03T15:58:07Z
NeilN
409043
Changed protection level of Template:Div col end: per request at [[WP:RFPP]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{Documentation|Template:Div col/doc}}
</noinclude>
e0rj08wj8gm7na2mxp8t9b3l4y8kspb
Template:EditAtWikidata
10
51464314
915182280
907415032
2019-09-11T18:15:13Z
WOSlinker
3138265
add nbsp param
wikitext
text/x-wiki
{{#invoke:EditAtWikidata |showMessage |qid={{{qid|}}} |pid={{{pid|}}} |nbsp={{{nbsp|}}} |{{{1|}}} }}<noinclude>
{{documentation}}
</noinclude>
k3dnbwgfi8ka45sgpcor4r8i5d2lmjb
Template:En dash range
10
67608291
1025040560
1022215271
2021-05-25T11:47:03Z
GKFX
14918984
Use module:plain text directly
wikitext
text/x-wiki
{{{1}}}{{#ifeq:{{#invoke:String|find|source={{#invoke:Plain text|main|{{{1}}}{{{2}}}}}|target=[%s–—-]|plain=false}}|0|–| – }}{{{2}}}<noinclude>
{{Documentation}}
</noinclude>
98em1kvd7xkqe6sagrl2kj31kdmyeiw
Template:Error-small
10
55072963
880607516
799379119
2019-01-28T10:31:16Z
Jonesey95
9755426
Actually make this smaller than a standard error message, not just non-bold.
wikitext
text/x-wiki
{{small|{{#invoke:Error|error|{{{message|{{{1}}}}}}|tag=span}}}}<noinclude>{{documentation}}</noinclude>
flg30hlgo3wckkfxn23ryl9hsmfet48
Template:Executive Order
10
9093111
1032891424
766042729
2021-07-10T08:29:51Z
139.192.226.208
wikitext
text/x-wiki
[[Executive order|Executive Order]] [[s:Executive Order {{{1}}}|{{{1}}}]]<noinclude>
{{documentation}}
</noinclude>
l37fui2lw2angqifdfi0jqxjdt8ifys
Template:External media
10
8212008
981094379
973409825
2020-09-30T07:33:11Z
Paine Ellsworth
9092818
per edit request on talk page - add alt= descriptions for image files
wikitext
text/x-wiki
{{ infobox
| decat = yes <!-- track empty rows through a separate process -->
| bodystyle = {{#if:{{{width|}}}|width: {{{width}}};}} float: {{{float|right}}}; clear: {{#switch:{{{float|}}}|none=both|#default={{{float|right}}} }}; {{#switch:{{{float|}}}|left=margin:0 1.5em 1.5em 0;|none|right|#default=margin:0 0 1.5em 1.5em}}
| above = {{{title|{{#if:{{{image1|}}}{{{images|}}}|{{#if:{{{audio1|}}}{{{video1|}}}{{{model1|}}}|External media|External {{#if:{{{image2|}}}{{{images|}}}|images|image}} }}|{{#if:{{{audio1|}}}|{{#if:{{{video1|}}}{{{model1|}}}|External media|External audio}}|{{#if:{{{video1|}}}|{{#if:{{{model1|}}}|External media|External video}}|{{#if:{{{model1|}}}|External 3D {{#if:{{{model2|}}}|models|model}} }} }} }} }} }}}
| abovestyle = font-size:115%
| subheader = {{{topic|}}}
| subheaderstyle = font-style: italic
| datastyle = text-align: left
| image = {{{headerimage|}}}
| caption = {{{caption|}}}
| header1 = {{#if:{{{image1|}}}{{{images|}}}|{{#if:{{{audio1|}}}{{{video1|}}}{{{model1|}}}|Images}} }}
| data2 = {{#if:{{{image1|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image1}}} }}
| data3 = {{#if:{{{image2|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image2}}} }}
| data4 = {{#if:{{{image3|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image3}}} }}
| data5 = {{#if:{{{image4|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image4}}} }}
| data6 = {{#if:{{{image5|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image5}}} }}
| data7 = {{#if:{{{image6|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image6}}} }}
| data8 = {{#if:{{{image7|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image7}}} }}
| data9 = {{#if:{{{image8|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image8}}} }}
| data10 = {{#if:{{{image9|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image9}}} }}
| data11 = {{#if:{{{image10|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image10}}} }}
| data12 = {{#if:{{{image11|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image11}}} }}
| data13 = {{#if:{{{image12|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image12}}} }}
| data14 = {{#if:{{{image13|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image13}}} }}
| data15 = {{#if:{{{image14|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image14}}} }}
| data16 = {{#if:{{{image15|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image15}}} }}
| data17 = {{#if:{{{image16|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image16}}} }}
| data18 = {{#if:{{{image17|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image17}}} }}
| data19 = {{#if:{{{image18|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image18}}} }}
| data20 = {{#if:{{{image19|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image19}}} }}
| data21 = {{#if:{{{image20|}}}|[[file:Searchtool.svg|16px|alt=image icon|link=]] {{{image20}}} }}
| data22 = {{{images|}}}
| header31 = {{#if:{{{audio1|}}}|{{#if:{{{image1|}}}{{{images|}}}{{{video1|}}}{{{model1|}}}|Audio}} }}
| data32 = {{#if:{{{audio1|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio1}}} }}
| data33 = {{#if:{{{audio2|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio2}}} }}
| data34 = {{#if:{{{audio3|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio3}}} }}
| data35 = {{#if:{{{audio4|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio4}}} }}
| data36 = {{#if:{{{audio5|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio5}}} }}
| data37 = {{#if:{{{audio6|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio6}}} }}
| data38 = {{#if:{{{audio7|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio7}}} }}
| data39 = {{#if:{{{audio8|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio8}}} }}
| data40 = {{#if:{{{audio9|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio9}}} }}
| data41 = {{#if:{{{audio10|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio10}}} }}
| data42 = {{#if:{{{audio11|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio11}}} }}
| data43 = {{#if:{{{audio12|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio12}}} }}
| data44 = {{#if:{{{audio13|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio13}}} }}
| data45 = {{#if:{{{audio14|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio14}}} }}
| data46 = {{#if:{{{audio15|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio15}}} }}
| data47 = {{#if:{{{audio16|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio16}}} }}
| data48 = {{#if:{{{audio17|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio17}}} }}
| data49 = {{#if:{{{audio18|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio18}}} }}
| data50 = {{#if:{{{audio19|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio19}}} }}
| data51 = {{#if:{{{audio20|}}}|[[file:Nuvola apps arts.svg|16px|alt=audio icon|link=]] {{{audio20}}} }}
| header61 = {{#if:{{{video1|}}}|{{#if:{{{audio1|}}}{{{model1|}}}{{{image1|}}}{{{images|}}}|Video}} }}
| data62 = {{#if:{{{video1|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video1}}} }}
| data63 = {{#if:{{{video2|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video2}}} }}
| data64 = {{#if:{{{video3|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video3}}} }}
| data65 = {{#if:{{{video4|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video4}}} }}
| data66 = {{#if:{{{video5|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video5}}} }}
| data67 = {{#if:{{{video6|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video6}}} }}
| data68 = {{#if:{{{video7|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video7}}} }}
| data69 = {{#if:{{{video8|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video8}}} }}
| data70 = {{#if:{{{video9|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video9}}} }}
| data71 = {{#if:{{{video10|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video10}}} }}
| data72 = {{#if:{{{video11|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video11}}} }}
| data73 = {{#if:{{{video12|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video12}}} }}
| data74 = {{#if:{{{video13|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video13}}} }}
| data75 = {{#if:{{{video14|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video14}}} }}
| data76 = {{#if:{{{video15|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video15}}} }}
| data77 = {{#if:{{{video16|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video16}}} }}
| data78 = {{#if:{{{video17|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video17}}} }}
| data79 = {{#if:{{{video18|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video18}}} }}
| data80 = {{#if:{{{video19|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video19}}} }}
| data81 = {{#if:{{{video20|}}}|[[file:Nuvola apps kaboodle.svg|16px|alt=video icon|link=]] {{{video20}}} }}
| header91 = {{#if:{{{model1|}}}|{{#if:{{{audio1|}}}{{{video1|}}}{{{image1|}}}{{{images|}}}|3D Models}} }}
| data92 = {{#if:{{{model1|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model1}}} }}
| data93 = {{#if:{{{model2|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model2}}} }}
| data94 = {{#if:{{{model3|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model3}}} }}
| data95 = {{#if:{{{model4|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model4}}} }}
| data96 = {{#if:{{{model5|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model5}}} }}
| data97 = {{#if:{{{model6|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model6}}} }}
| data98 = {{#if:{{{model7|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model7}}} }}
| data99 = {{#if:{{{model8|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model8}}} }}
| data100 = {{#if:{{{model9|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model9}}} }}
| data101 = {{#if:{{{model10|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model10}}} }}
| data102 = {{#if:{{{model11|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model11}}} }}
| data103 = {{#if:{{{model12|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model12}}} }}
| data104 = {{#if:{{{model13|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model13}}} }}
| data105 = {{#if:{{{model14|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model14}}} }}
| data106 = {{#if:{{{model15|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model15}}} }}
| data107 = {{#if:{{{model16|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model16}}} }}
| data108 = {{#if:{{{model17|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model17}}} }}
| data109 = {{#if:{{{model18|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model18}}} }}
| data110 = {{#if:{{{model19|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model19}}} }}
| data111 = {{#if:{{{model20|}}}|[[file:Cube NoEdges RGBfaces 64px.png|16px|alt=3D model icon|link=]] {{{model20}}} }}
}}{{main other|{{#if:{{{image1|}}}{{{images|}}}{{{audio1|}}}{{{video1|}}}{{{model1|}}}||[[Category:Pages using the external media template with no first item]]}}}}<noinclude>{{documentation}}</noinclude>
cadzjd58tb7g9hn7xviwn2x6iyddgo6
Template:FULLROOTPAGENAME
10
34701984
1063308743
774489771
2022-01-02T08:54:02Z
Dinoguy1000
2412089
fix "|=foo" bug
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
Template:Failed verification
10
5923516
1063310510
972113019
2022-01-02T09:17:34Z
Dinoguy1000
2412089
fix "|=foo" bug
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#invoke:Unsubst||date=__DATE__ |$B=
<!--{{Failed verification}} begin-->{{Fix
| subst = <includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly>
| link = Wikipedia:Verifiability
| text = failed verification
| title = {{{reason|The material near this tag failed verification of its source citation(s).}}}
| date = {{{date|}}}
| cat = [[Category:All articles with failed verification]]
| cat-date = Category:Articles with failed verification
| post-text = {{#if:{{{talk|}}}|– [[{{TALKPAGENAME}}#{{{talk}}}|see discussion]]|{{#if:{{{talkpage|{{{talk page|}}}}}}|– [[{{{talkpage|{{{talk page}}}}}}|see discussion]]}}}}
}}<!--{{Failed verification}} end-->
}}<noinclude>
{{Documentation}}
</noinclude>
jqb7wamdj8726roe2wyjhp33ktbnvpc
Template:Fix
10
5632010
1024430416
1024383868
2021-05-22T02:15:55Z
JJMC89
24812038
shouldn't be here
wikitext
text/x-wiki
{{#switch:{{{subst|¬}}}
|¬={{category handler
|template=[[Category:Templates needing substitution checking]]
|nocat={{{nocat|<noinclude>true</noinclude>}}}
}}
|SUBST=[[Category:Pages with incorrectly substituted templates]]
}}{{Category handler
|main={{Fix/category
|cat-date={{{cat-date|}}}
|cat={{{cat|}}}
|cat-date2={{{cat-date2|}}}
|cat2={{{cat2|}}}
|cat-date3={{{cat-date3|}}}
|cat3={{{cat3|}}}
|date={{{date|}}}
}}
|template={{#if:{{{name|}}}|{{#ifeq:{{{name}}}|{{ROOTPAGENAME}}||{{#if:{{{date|}}}||[[Category:Templates including undated clean-up tags]]}}}}}}
|subpage=no
}}{{#if:{{{text|}}}
|<sup class="noprint Inline-Template {{{class|}}}" style="white-space:nowrap;">[<i>{{#if:{{{pre-text|}}}
|{{{pre-text}}} 
}}[[{{{link|Wikipedia:Cleanup}}}|<span title="{{#invoke:string|replace|source={{delink|1={{{title|{{{link|Wikipedia:Cleanup}}}}}}{{#if:{{{date|}}}| ({{{date}}})}}}}|pattern=" |replace=' |plain=true}}">{{{text|}}}</span>]]{{#if:{{{post-text|}}}
| {{{post-text}}}
}}</i>]</sup>|{{{special|}}}
}}<noinclude>
{{Documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
1r71gb56no3991um3t95p5y9x80ldkz
Template:Fix/category
10
34017846
774489703
471928517
2017-04-08T20:24:09Z
Jo-Jo Eumerus
17449355
Changed protection level for "[[Template:Fix/category]]": [[WP:High-risk templates|Highly visible template]]: Allowing template editors ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<noinclude>{{pp-template|small=yes}}</noinclude>{{{cat|[[Category:All pages needing cleanup]]}}}{{#if:{{{cat-date|}}}
|[[{{{cat-date}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}{{#if:{{{cat2|}}}|{{{cat2}}}}}{{#if:{{{cat-date2|}}}
|[[{{{cat-date2}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date2}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}{{#if:{{{cat3|}}}|{{{cat3}}}}}{{#if:{{{cat-date3|}}}
|[[{{{cat-date3}}} {{#if:{{{date|}}}
|from {{{date}}}
}}]]{{#if:{{{date|}}}
|{{#ifexist:{{{cat-date3}}} from {{{date}}}|
|[[Category:Articles with invalid date parameter in template]]
}}
}}
}}
gpikm5p2yggfosi6w5maxtx5my3u9im
Template:Flatlist
10
44066567
1073570105
958598899
2022-02-23T10:58:00Z
Xaosflux
502540
Changed protection settings for "[[Template:Flatlist]]": used in the mediawiki interface ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
<div class="hlist hlist-separated {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}<noinclude></div>
{{documentation}}
</noinclude>
c8c9hiesbmhy95sd0yiemh58351exwt
Template:For timeline
10
44441868
1097068647
1095466750
2022-07-08T12:34:11Z
Plastikspork
5075409
Updating TFD template: discussion was relisted ([[WP:XFDC#4.0.13|XFDcloser]])
wikitext
text/x-wiki
{{Tfm/dated|page=For timeline|otherpage=For outline|link=Wikipedia:Templates for discussion/Log/2022 July 8#Template:For timeline|help=off|bigbox={{#invoke:Noinclude|noinclude|text=yes}}}}
{{#invoke:For related page|forFoo|Timeline of %s|Timeline of %ss|Timeline of the %s|Timeline of %s history|what=a chronological guide}}<noinclude>{{documentation}}</noinclude>
nb5ff20m03rxq017ksp6s6n9vfb0o7a
Template:Grammy Award for Best Spoken Word Album
10
38168374
1080901077
1080859850
2022-04-04T04:17:22Z
Shortride
3046099
wikitext
text/x-wiki
{{Navbox
| name = Grammy Award for Best Spoken Word Album
| title = [[Grammy Award for Best Spoken Word Album]]
| basestyle = background:#cedff2;
| bodyclass = hlist
| state = {{{state<includeonly>|collapsed</includeonly>}}}
| nowrapitems= yes
| group1 = 1959−1980
| list1 =
* ''The Best of the Stan Freberg Shows'' – [[Stan Freberg]] (1959)
* ''[[Lincoln Portrait]]'' – [[Carl Sandburg]] (1960)
* ''FDR Speaks'' – Robert Bialek (producer) (1961)
* ''[[Leonard Bernstein Discusses Humor in Music and Conducts Till Eulenspiegel's Merry Pranks|Humor in Music]]'' – [[Leonard Bernstein]] (1962)
* ''The Story-Teller: A Session with Charles Laughton'' – [[Charles Laughton]] (1963)
* ''[[Who's Afraid of Virginia Woolf?]]'' – [[Edward Albee]] (playwright) (1964)
* ''BBC Tribute to John F. Kennedy'' – ''[[That Was the Week That Was]]'' (1965)
* ''John F. Kennedy: As We Remember Him'' – [[Goddard Lieberson]] (producer) (1966)
* ''Edward R. Murrow - A Reporter Remembers, Vol. I: The War Years'' – [[Edward R. Murrow]] (1967)
* ''Gallant Men'' – [[Everett Dirksen]] (1968)
* ''Lonesome Cities'' – [[Rod McKuen]] (1969)
* ''We Love You Call Collect'' – [[Art Linkletter]] & [[Diane Linkletter]] (1970)
* ''Why I Oppose the War in Vietnam'' – [[Martin Luther King Jr.]] (1971)
* ''[[Desiderata (Les Crane album)|Desiderata]]'' – [[Les Crane]] (1972)
* ''Lenny'' – [[Bruce Botnick]] (producer) & the Original Broadway Cast (1973)
* ''[[Jonathan Livingston Seagull]]'' – [[Richard Harris]] (1974)
* ''Good Evening'' – [[Peter Cook]] and [[Dudley Moore]] (1975)
* ''[[Give 'em Hell, Harry!]]'' – [[James Whitmore]] (1976)
* ''Great American Documents'' – [[Henry Fonda]], [[Helen Hayes]], [[James Earl Jones]] and [[Orson Welles]] (1977)
* ''[[The Belle of Amherst]]'' – [[Julie Harris]] (1978)
* ''[[Citizen Kane|Citizen Kane (Original Motion Picture Soundtrack)]]'' – [[Orson Welles]] (1979)
* ''Ages of Man: Readings from Shakespeare'' – [[John Gielgud]] (1980)
| group2 = 1981−2000
| list2 =
* ''[[Gertrude Stein|Gertrude Stein, Gertrude Stein, Gertrude Stein]]'' – [[Pat Carroll]] (1981)
* ''[[Donovan's Brain]]'' – [[Orson Welles]] (1982)
* ''[[Raiders of the Lost Ark|Raiders of the Lost Ark: The Movie on Record]]'' – Tom Voegeli (producer) and Various Artists (1983)
* ''[[Lincoln Portrait]]'' – [[William Warfield]] (1984)
* ''The Words of Gandhi'' – [[Ben Kingsley]] (1985)
* ''[[Ma Rainey's Black Bottom]]'' – [[Mike Berniker]] (producer) & the Original Broadway Cast (1986)
* ''Interviews from the Class of '55 Recording Sessions'' – [[Johnny Cash]], [[Jerry Lee Lewis]], [[Chips Moman]], [[Ricky Nelson]], [[Roy Orbison]], [[Carl Perkins]] and [[Sam Phillips]] (1987)
* ''[[Lake Wobegon Days]]'' – [[Garrison Keillor]] (1988)
* ''Speech by Rev. Jesse Jackson'' – [[Jesse Jackson]] (1989)
* ''It's Always Something'' – [[Gilda Radner]] (1990)
* ''[[Gracie: A Love Story]]'' – [[George Burns]] (1991)
* ''[[The Civil War (miniseries)|The Civil War]]'' – [[Ken Burns]] (1992)
* ''What You Can Do to Avoid AIDS'' – [[Magic Johnson|Earvin "Magic" Johnson]] and Robert O'Keefe (1993)
* ''[[On the Pulse of Morning]]'' – [[Maya Angelou]] (1994)
* ''[[Get in the Van]]'' – [[Henry Rollins]] (1995)
* ''[[Phenomenal Woman: Four Poems Celebrating Women|Phenomenal Woman]]'' – [[Maya Angelou]] (1996)
* ''[[It Takes a Village]]'' – [[Hillary Clinton]] (1997)
* ''Charles Kuralt's Spring'' – [[Charles Kuralt]] (1998)
* ''[[Still Me]]'' – [[Christopher Reeve]] (1999)
* ''The Autobiography of Martin Luther King Jr.'' – [[LeVar Burton]] (2000)
| group3 = 2001−2020
| list3 =
* ''[[The Measure of a Man: A Spiritual Autobiography]]'' – [[Sidney Poitier]], Rick Harris & John Runnette (producers) (2001)
* ''Q: The Autobiography of Quincy Jones'' – [[Quincy Jones]], Jeffrey S. Thomas, Steven Strassman (engineers) and Elisa Shokoff (producer) (2002)
* ''[[A Song Flung Up to Heaven]]'' – [[Maya Angelou]] and Charles B. Potter (producer) (2003)
* ''[[Lies and the Lying Liars Who Tell Them]]'' – [[Al Franken]] and Paul Ruben (producer) (2004)
* ''[[My Life (Clinton autobiography)|My Life]]'' – [[Bill Clinton]] (2005)
* ''[[Dreams from My Father]]'' – [[Barack Obama]] (2006)
* ''[[Our Endangered Values|Our Endangered Values: America's Moral Crisis]]'' – [[Jimmy Carter]] / ''With Ossie and Ruby'' – [[Ossie Davis]] and [[Ruby Dee]] (2007)
* ''[[The Audacity of Hope]]'' – [[Barack Obama]] and Jacob Bronstein (producer) (2008)
* ''[[An Inconvenient Truth (book)|An Inconvenient Truth]]'' by [[Al Gore]] – [[Beau Bridges]], [[Cynthia Nixon]] and [[Blair Underwood]] (2009)
* ''Always Looking Up'' – [[Michael J. Fox]] (2010)
* ''[[Earth (The Book)|The Daily Show with Jon Stewart Presents Earth (The Audiobook)]]'' – [[Jon Stewart]] (2011)
* ''If You Ask Me (And of Course You Won't)'' – [[Betty White]] (2012)
* ''Society's Child'' – [[Janis Ian]] (2013)
* ''[[America Again|America Again: Re-becoming the Greatness We Never Weren't]]'' – [[Stephen Colbert]] (2014)
* ''Diary of a Mad Diva'' – [[Joan Rivers]] (2015)
* ''[[A Full Life: Reflections at 90]]'' – [[Jimmy Carter]] (2016)
* ''In Such Good Company: Eleven Years of Laughter, Mayhem, and Fun in the Sandbox'' – [[Carol Burnett]] (2017)
* ''[[The Princess Diarist]]'' – [[Carrie Fisher]] (2018)
* ''Faith: A Journey for All'' – [[Jimmy Carter]] (2019)
* ''[[Becoming (book)|Becoming]]'' – [[Michelle Obama]] (2020)
| group4 = 2021−present
| list4 =
* ''[[Blowout (book)|Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth]]'' – [[Rachel Maddow]] (2021)
* ''Carry On: Reflections for a New Generation from John Lewis'' − [[Don Cheadle]] (2022)
}}<noinclude>
{{collapsible option}}
[[Category:Grammy Award navigational boxes|Spoken Word Album]]
</noinclude>
45jghueizre6hhva7ev38yw8m1zy69g
Template:Gutenberg author
10
1795069
730582959
684204428
2016-07-19T23:26:14Z
Koavf
205121
{{#ifeq:{{NAMESPACENUMBER}}|0|[[Category:Articles with Project Gutenberg links]]|}}
wikitext
text/x-wiki
<includeonly>{{#invoke:Gutenberg|author}}{{#ifeq:{{NAMESPACENUMBER}}|0|[[Category:Articles with Project Gutenberg links]]|}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
iye0ver26r9zv0brvhkuexdpk0zfo09
Template:Hanging indent
10
8196403
1044523947
1042971734
2021-09-15T17:59:47Z
MusikBot II
29539620
Changed protection settings for "[[Template:Hanging indent]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 5359 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<div style="text-indent: -{{{indent|1.6em}}}; margin-left: {{{indent|1.6em}}};">{{{text|{{{content|{{{1}}}}}}}}}</div><noinclude>
{{Documentation}}
</noinclude>
bv7og4vtft43pl6636v1u8z2gcgdxdg
Template:Hidden
10
3882272
1010866155
779753464
2021-03-07T19:30:19Z
Plastikspork
5075409
Add alternative syntax per [[Wikipedia:Templates_for_discussion/Log/2021_March_6#Template:Collapsible_section|this discussion]]
wikitext
text/x-wiki
{{hidden begin|toggle={{{showhide|}}}{{{toggle|}}}|expanded={{{expand|{{{expanded|}}}}}}|class={{{class|}}}|border={{{border|none}}}|style={{{framestyle|{{{style|{{{css|}}}}}}}}}
|bg1={{{background|{{{bg1|transparent}}}}}}|ta1={{{titlealign|{{{ta1|center}}}}}}|titlestyle={{#if:{{{multiline|{{{multi-line|}}}}}}|height:auto;}}{{#ifeq:{{{fw1|bold}}}|bold||font-weight:{{{fw1|bold}}};}}{{{headercss|{{{headerstyle|{{{titlestyle|}}}}}}}}}
|title={{#if:{{{multiline|{{{multi-line|}}}}}}|<div style="margin-right:4em;line-height:125%;height:auto;">{{{title|{{{header|{{{1}}}}}}}}}</div>|{{{title|{{{header|{{{1}}}}}}}}}}}
|bg2={{{bg2|transparent}}}|ta2={{{ta2|left}}}|contentstyle={{#ifeq:{{{fw2|normal}}}|normal||font-weight:{{{fw2|normal}}};}}{{{contentcss|{{{contentstyle|}}}}}} }}
{{{content|{{{contents|{{{text|{{{2}}}}}}}}}}}}{{hidden end}}{{#if:{{{background|}}}{{{bg1|}}}{{{bg2|}}}{{{titlealign|}}}{{{ta1|}}}{{{ta2|}}}{{{fw1|}}}{{{fw2|}}}|[[Category:Hidden templates using styles|{{NAMESPACE}}{{PAGENAME}}]]}}<noinclude>
{{documentation}}
</noinclude>
k90z6knza5a7ivod9cbnibcv6d2s3iw
Template:Hidden begin
10
3883451
1037206634
1015284786
2021-08-05T04:32:46Z
Izno
2927383
people who put hatnotes in template pages smh
wikitext
text/x-wiki
<includeonly><div class="mw-collapsible {{#ifeq:{{{showhide|}}}{{{toggle|}}}|left|mw-collapsible-leftside-toggle}} {{#if:{{{expanded|}}} | |mw-collapsed}} {{{class|}}}" style="box-sizing:border-box;width:{{{width|100%}}};font-size:95%;padding:4px;border:{{{border|none}}};{{{style|}}}"><!--
--><div style="font-size:100%;line-height:1.6;font-weight:bold;background:{{{bg1|transparent}}};text-align:{{{ta1|left}}};{{{extra1|}}};{{{titlestyle|{{{headercss|}}}}}}">{{{header|}}}{{{title|}}}</div><!--
--><div class="mw-collapsible-content" style="background:{{{bg2|transparent}}};text-align:{{{ta2|left}}};{{{extra2|}}};{{{bodystyle|{{{contentstyle|{{{contentcss|}}}}}}}}}"></includeonly><noinclude>
{{Documentation}}
</noinclude>
sd2d8bipo17b18xs3wxzhxfl4egjrr4
Template:Hidden end
10
3883454
864511696
637090096
2018-10-17T18:18:59Z
Jonesey95
9755426
Fix [[Special:LintErrors|Linter]] errors
wikitext
text/x-wiki
<noinclude>{{hatnote|Templates {{noredirect|Template:End hidden|End hidden}} and {{noredirect|Template:End hidden section|End hidden section}} redirect here.}}<div><div></noinclude><!--
--></div></div><!--
--><noinclude>{{Documentation|Template:Hidden begin/doc}}</noinclude>
5ints39qzwahmsnt9u65co79fkg2eet
Template:Hlist
10
38143620
669926987
669921219
2015-07-04T15:13:14Z
Penwhale
125125
Changed protection level of Template:Hlist: [[WP:High-risk templates|Highly visible template]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:list|horizontal}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
ihcdy525o8nnmq114czc48dpk6pnojd
Template:Hover title
10
3235839
999486943
995065020
2021-01-10T12:31:45Z
Primefac
11508456
Per [[Wikipedia:Templates for discussion/Log/2020 December 19#Template:Hover title and Template:Tooltip]], added {{being deleted}} ([[WP:XFDC|XFDcloser]])
wikitext
text/x-wiki
<noinclude>{{Being deleted|2020 December 19|Template:Hover_title_and_Template:Tooltip|merge=Template:Tooltip}}</noinclude>{{#ifeq:{{yesno-no|{{{link}}}}}|yes
|[[{{{2}}}|<span title="{{{1}}}" class="rt-commentedText" {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no|
|style="border-bottom:1px dotted"
}}>{{{2}}}</span>]]
|<span title="{{{1}}}" class="rt-commentedText" {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no|
|style="border-bottom:1px dotted"
}}>{{{2}}}</span>
}}<noinclude>
{{documentation}}
</noinclude>
3m2lvnw65vx2j5obm0hj81ay4z3bk6b
Template:IPA audio link
10
31974873
986112960
986067490
2020-10-29T21:33:33Z
Kaldari
59944
No need for extra whitespace after icon by itself, nor extra span
wikitext
text/x-wiki
 <span class="nowrap" style="font-size:85%">{{#ifeq:{{{attribution|}}}|no|<includeonly>{{#if:{{{1|}}}|{{#ifexist:Media:{{{1}}}|<span class="unicode haudio"><span class="fn">[[File:Loudspeaker.svg|11px|link=Special:Filepath/{{{1}}}|Listen]]</span>{{main other|[[Category:Articles with hAudio microformats]]}}</span>|{{error{{main other||-small}}|Audio file "{{{1}}}" not found}}<!-- tracking category begin -->{{Category handler|[[Category:Pages linking to missing files]]}}<!-- tracking category end -->}}}}</includeonly>|({{Audio|{{{1|}}}|listen|help=no}})}}</span><noinclude>
{{documentation}}
</noinclude>
qqkr4qi7no4fvrvf5wk26pbeji87wlk
Template:IPAc-en
10
24747137
787004202
667573065
2017-06-22T21:12:36Z
Nardog
5908908
<includeonly>
wikitext
text/x-wiki
<includeonly>{{#invoke:IPAc-en|main}}</includeonly><noinclude>
{{documentation}}
</noinclude>
szcbk6ow194d0m1qh49i8w22cdi4kis
Template:ISBN
10
51604275
1062463277
1062434525
2021-12-28T16:26:32Z
Jonesey95
9755426
Undid revision 1062434525 by [[Special:Contributions/SilkTork|SilkTork]] ([[User talk:SilkTork|talk]]). see talk page
wikitext
text/x-wiki
{{#if:{{{1|<noinclude>$</noinclude>}}}|{{Catalog lookup link|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}|article-link={{#ifeq:{{yesno-no|{{{plainlink|}}}}}|yes||{{#ifeq:{{yesno-yes|{{{link|}}}}}|no||ISBN (identifier)}}}}|article-name={{#ifeq:{{yesno-no|{{{plainlink|}}}}}|yes||ISBN}}|link-prefix=[Special:BookSources/|item-prefix={{!}}|item-postfix=]|list-leadout={{{leadout|}}}}}{{#if:{{trim|{{{1|}}}}}|{{#ifeq:{{yesno-no|{{{invalid1|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{1|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{2|}}}}}|{{#ifeq:{{yesno-no|{{{invalid2|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{2|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{3|}}}}}|{{#ifeq:{{yesno-no|{{{invalid3|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{3|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{4|}}}}}|{{#ifeq:{{yesno-no|{{{invalid4|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{4|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{5|}}}}}|{{#ifeq:{{yesno-no|{{{invalid5|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{5|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{6|}}}}}|{{#ifeq:{{yesno-no|{{{invalid6|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{6|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{7|}}}}}|{{#ifeq:{{yesno-no|{{{invalid7|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{7|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{8|}}}}}|{{#ifeq:{{yesno-no|{{{invalid8|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{8|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}{{#if:{{trim|{{{9|}}}}}|{{#ifeq:{{yesno-no|{{{invalid9|}}}}}|yes|{{main other|[[Category:Pages with listed invalid ISBNs]]}}|{{#invoke:check isxn|check_isbn|{{{9|}}}|error={{error-small| Parameter error in {{tl|ISBN}}: Invalid [[ISBN]].}}{{main other|[[Category:Pages with ISBN errors]]}}}}}}}}}}}}}}}}}}}}}}}}|{{error-small|Parameter error in {{tl|ISBN}}: Missing [[ISBN]].}}}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using ISBN template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:ISBN]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | invalid1 | invalid2 | invalid3 | invalid4 | invalid5 | invalid6 | invalid7 | invalid8 | invalid9 | leadout | link | plainlink }}<noinclude>{{documentation}}<!-- Add categories and interwiki lines to the /doc subpage, not here! --></noinclude>
0ev67mne6uts13hevpx9fa8b6336x6t
Template:Icon
10
10964158
643803499
623318300
2015-01-23T10:29:55Z
Mr. Stradivarius
4708675
switch this to use [[Module:Icon]]
wikitext
text/x-wiki
{{#invoke:Icon|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
m4ab9noabl8v4ki5cx6t5ksjcjh5u8o
Template:If both
10
26135564
1035819119
827245322
2021-07-27T21:26:23Z
Trialpears
35786750
substitutable
wikitext
text/x-wiki
{{{{{|safesubst:}}}#if:{{{1|}}}| {{{{{|safesubst:}}}#if:{{{2|}}}|{{{3|}}}|{{{4|}}}}} |{{{4|}}} }}<noinclude>
{{Documentation}}
<!--
PLEASE ADD CATEGORIES AND INTERWIKIS
TO THE /doc SUBPAGE, THANKS
-->
</noinclude>
p67t59wed0qw6netk8dpcseo94xiak2
Template:In string
10
59775012
1076583574
1076582851
2022-03-11T21:09:13Z
Neveselbert
25820411
Reverted [[WP:AGF|good faith]] edits by [[Special:Contributions/Neveselbert|Neveselbert]] ([[User talk:Neveselbert|talk]])
wikitext
text/x-wiki
{{#invoke:String|replace
|source={{#invoke:String|find|source={{{source|{{{1|}}}}}}|target={{{target|{{{2|}}}}}}|start={{{start|{{{3|}}}}}}|plain={{{plain|{{{4|}}}}}}}}
|pattern=^0$
|replace={{#if:{{{nomatch|}}}|{{{nomatch|}}}|{{#if:{{{nomatch}}}|0<!-- no replacement -->|<!--return blank-->}}}}
|plain=false}}<!--
--><noinclude>{{documentation}}</noinclude>
lo2s5l4hfmr5g93rjf8ky5ra1g8jbvz
Template:Inflation
10
17599654
1030584477
922552064
2021-06-26T21:24:10Z
Thumperward
545027
add "orig=yes" to display the original automatically
wikitext
text/x-wiki
<includeonly>{{<!--
1: if a mandatory field is unspecified, return error, else next test
-->#ifexpr:
{{#if:{{{value|{{{2|}}}}}}|0|1}}
or {{#if:{{{start_year|{{{3|}}}}}}|0|1}}
|<span class="error">Error when using {{tl|Inflation}}:<!--
--> {{Separated entries|separator=, |conjunction= and 
|{{#if:{{{index|{{{1|}}}}}}||{{para|index}} (parameter 1)}}
|{{#if:{{{value|{{{2|}}}}}}||{{para|value}} (parameter 2)}}
|{{#if:{{{start_year|{{{3|}}}}}}||{{para|start_year}} (parameter 3)}}
}} must be specified.</span><!--
-->{{#if:{{{nocat|}}}||{{main other|[[Category:Pages with errors in inflation template]]}}}}<!--
-->|{{<!--
2: if index code is unrecognized, return error, else next test
-->#ifexpr:
not(
{{#ifexist:Template:Inflation/{{{index|{{{1}}}}}}|1|0}}
and {{Isnumeric|{{Inflation/year|{{{index|{{{1}}}}}}}}|boolean=true}}
)
|<span class="error">Error when using {{tl|Inflation}}:<!--
--> {{para|index|'''{{{index|{{{1}}}}}}'''}} (parameter 1) not a recognized index.</span><!--
-->{{#if:{{{nocat|}}}||{{main other|[[Category:Pages with errors in inflation template]]}}}}<!--
-->|{{<!--
3: if a numeric parameter contain invalid data, return error, else next test
-->#ifexpr:
not(
{{Isnumeric|{{{value|{{{2}}}}}}|boolean=true}}
and {{Isnumeric|{{{start_year|{{{3}}}}}}|boolean=true}}
and {{#if: {{{end_year|{{{4|}}}}}} | {{Isnumeric|{{{end_year|{{{4}}}}}}|boolean=true}} | 1 }}
and {{#if: {{{r|}}} | {{Isnumeric|{{{r}}}|boolean=true}} | 1 }}
)
|<span class="error">Error when using {{tl|Inflation}}:<!--
--> [[NaN]], check parameters for non-numeric data:<!--
--> {{Separated entries|separator=, |conjunction= and 
|{{Ifnumber|{{formatnum:{{{value|{{{2}}}}}}|R}}||{{para|value|'''{{{value|{{{2}}}}}}'''}} (parameter 2)}}
|{{Ifnumber|{{formatnum:{{{start_year|{{{3}}}}}}|R}}||{{para|start_year|'''{{{start_year|{{{3}}}}}}'''}} (parameter 3)}}
|{{#if: {{{end_year|{{{4|}}}}}} | {{Ifnumber|{{formatnum:{{{end_year|{{{4}}}}}}|R}}||{{para|end_year|'''{{{end_year|{{{4}}}}}}'''}} (parameter 4)}} }}
|{{#if: {{{r|}}} | {{Ifnumber|{{formatnum:{{{r}}}|R}}||{{para|r|'''{{{r}}}'''}}}} }}
}}.</span><!--
-->{{#if:{{{nocat|}}}||{{main other|[[Category:Pages with errors in inflation template]]}}}}<!--
-->|{{<!--
4: if a parameter is out of calculable bounds, return error, else proceed
-->#ifexpr:
not(
( {{{start_year|{{{3}}}}}} >= {{Inflation/{{{index|{{{1}}}}}}/startyear}} )
and(
( {{{start_year|{{{3}}}}}} <= {{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}} )
or ( {{{start_year|{{{3}}}}}} = {{{end_year|{{{4|{{CURRENTYEAR}}}}}}}} )
)
and ( {{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}} <= {{Inflation/year|{{{index|{{{1}}}}}}}} )
)
|<span class="error">Error when using {{tl|Inflation}}:<!--
--> {{Separated entries|separator=, |conjunction= and 
|{{<!-- 4a: [parameter 3/start_year] too low -->
#ifexpr: {{{start_year|{{{3}}}}}} < {{Inflation/{{{index|{{{1}}}}}}/startyear}}
|{{para|start_year|'''{{{start_year|{{{3}}}}}}'''}} (parameter 3)<!--
--> is lower than the earliest available year ('''{{Inflation/{{{index|{{{1}}}}}}/startyear}}''')<!--
--> in index "'''{{{index|{{{1}}}}}}'''"<!--
-->}}
|{{<!-- 4b: [parameter 3/start_year] greater than [parameter 4/end_year]
...and not equal to {{CURRENTYEAR}} if [parameter 4/end_year] is unspecified -->
#ifexpr:
( {{{start_year|{{{3}}}}}} > {{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}} )
and ( {{{start_year|{{{3}}}}}} != {{{end_year|{{{4|{{CURRENTYEAR}}}}}}}} )
|{{para|start_year|'''{{{start_year|{{{3}}}}}}'''}} (parameter 3)<!--
--> is greater than<!--
--> {{<!--
-->#if:{{{end_year|{{{4|}}}}}}<!--
-->|{{para|end_year|'''{{{end_year|{{{4}}}}}}'''}} (parameter 4)<!--
-->|the latest available year ('''{{Inflation/year|{{{index|{{{1}}}}}}}}''')<!--
--> in index "'''{{{index|{{{1}}}}}}'''"<!--
-->}}<!--
-->}}
|{{<!-- 4c: [parameter 4/end_year] greater than [parameter 1/index] highest year -->
#ifexpr: {{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}} > {{Inflation/year|{{{index|{{{1}}}}}}}}
|{{para|end_year|'''{{{end_year|{{{4}}}}}}'''}} (parameter 4)<!--
--> is greater than the latest available year ('''{{Inflation/year|{{{index|{{{1}}}}}}}}''')<!--
--> in index "'''{{{index|{{{1}}}}}}'''"<!--
-->}}<!--
-->}}.</span><!--
-->{{#if:{{{nocat|}}}||{{main other|[[Category:Pages with errors in inflation template]]}}}}<!--
-->|<!--
begin template proper
-->{{#ifeq:{{{orig|}}}|yes|{{{cursign|$}}}{{{2}}} (}}{{#ifeq:{{{fmt|raw}}}|eq|equivalent to {{{cursign|$}}}}}<!--
-->{{formatnum:
{{
#iferror:
{{#invoke:Math|round|1={{
#expr:
{{formatnum:{{{value|{{{2}}}}}}|R}}
{{#ifeq:{{{start_year|{{{3}}}}}}|{{CURRENTYEAR}}
| * 1
| {{Inflation/{{{index|{{{1}}}}}}|{{{start_year|{{{3}}}}}}|{{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}}}}
}}
round {{{r|0}}}
}}|2={{{r|0}}}}}
|<span class="error">Error when using {{tl|Inflation}}:<!--
--> [[NaN]]/calculation error, please notify [[Template talk:Inflation]].</span><!--
-->{{main other|[[Category:Pages with errors in inflation template]]}}<!--
this error indicates template bug, always categorize
-->}}
|{{#ifeq:{{{fmt|raw}}}|raw|R|}}
}}<!--
-->{{#ifeq:{{{fmt|raw}}}|eq| in<!--
--> {{<!--
-->#ifeq:{{{start_year|{{{3}}}}}}|{{CURRENTYEAR}}<!--
-->|{{CURRENTYEAR}}<!--
-->|{{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}}<!--
-->}}<!--
-->}}<!--
end template proper
-->}}<!-- 4
-->}}<!-- 3
-->}}<!-- 2
-->}}<!-- 1 -->{{#ifeq:{{{orig|}}}|yes|)}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
sb91ymbktm76xdg35twqa8l6uarri1z
Template:Inflation-year
10
57117773
836231570
2018-04-13T13:51:55Z
MSGJ
42630
MSGJ moved page [[Template:Inflation-year]] to [[Template:Inflation/year]]: convert to subtemplate of [[Template:Inlfation]]
wikitext
text/x-wiki
#REDIRECT [[Template:Inflation/year]]
{{R from move}}
idtriocenxbjfxr1yfw4l20tb49qnia
Template:Inflation/US
10
17637321
827245347
488791953
2018-02-23T16:29:59Z
Primefac
11508456
Changed protection level for "[[Template:Inflation/US]]": [[WP:HIGHRISK|high-risk]] template with 4000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>* {{#expr:{{Inflation/US/dataset|{{{2}}}}}/{{Inflation/US/dataset|{{{1}}}}}}}</includeonly><noinclude>{{documentation|Template:Inflation/doc/table}}</noinclude>
pf6z8s2rbglmxy7wq0yff49e94ngize
Template:Inflation/US/dataset
10
17908721
1083053768
1034933294
2022-04-16T18:39:08Z
Imzadi1979
488581
add 2021
wikitext
text/x-wiki
{{#switch:{{{1}}}
| 1634 = 89.84088
| 1635 = 0
| 1636 = 160.4301
| 1637 = 138.1388
| 1638 = 72.61575
| 1639 = 118.8871
| 1640 = 103.0130
| 1641 = 69.23827
| 1642 = 104.0262
| 1643 = 150.2977
| 1644 = 108.0792
| 1645 = 95.24484
| 1646 = 58.76809
| 1647 = 44.58269
| 1648 = 78.69521
| 1649 = 115.5097
| 1650 = 61.13233
| 1651 = 81.73494
| 1652 = 64.50980
| 1653 = 83.76142
| 1654 = 84.09917
| 1655 = 81.39719
| 1656 = 79.37070
| 1657 = 64.84755
| 1658 = 41.54296
| 1659 = 46.94692
| 1660 = 54.03963
| 1661 = 45.25819
| 1662 = 48.97341
| 1663 = 48.97341
| 1664 = 48.97341
| 1665 = 42.21846
| 1666 = 42.21846
| 1667 = 45.25819
| 1668 = 46.94692
| 1669 = 43.56945
| 1670 = 42.89395
| 1671 = 43.56945
| 1672 = 43.23170
| 1673 = 41.20521
| 1674 = 44.58269
| 1675 = 41.20521
| 1676 = 41.54296
| 1677 = 41.54296
| 1678 = 40.86747
| 1679 = 40.52972
| 1680 = 46.60918
| 1681 = 47.62242
| 1682 = 38.84098
| 1683 = 38.84098
| 1684 = 38.84098
| 1685 = 42.21846
| 1686 = 39.51648
| 1687 = 39.17873
| 1688 = 35.80125
| 1689 = 37.15224
| 1690 = 37.48999
| 1691 = 38.50323
| 1692 = 37.48999
| 1693 = 35.12576
| 1694 = 37.15224
| 1695 = 34.45026
| 1696 = 40.52972
| 1697 = 39.17873
| 1698 = 37.48999
| 1699 = 40.86747
| 1700 = 43.9072
| 1701 = 47.6225
| 1702 = 45.9337
| 1703 = 39.8543
| 1704 = 36.476
| 1705 = 35.1258
| 1706 = 37.4900
| 1707 = 40.1920
| 1708 = 42.5562
| 1709 = 39.1788
| 1710 = 33.7748
| 1711 = 35.4635
| 1712 = 40.1920
| 1713 = 43.2317
| 1714 = 43.2317
| 1715 = 29.7218
| 1716 = 24.317
| 1717 = 25.6688
| 1718 = 29.7218
| 1719 = 31.0728
| 1720 = 25.6688
| 1721 = 23.9801
| 1722 = 25.3311
| 1723 = 25.6688
| 1724 = 27.0198
| 1725 = 32.0860
| 1726 = 31.0728
| 1727 = 29.0463
| 1728 = 27.3576
| 1729 = 27.0198
| 1730 = 27.0198
| 1731 = 23.9801
| 1732 = 22.6291
| 1733 = 22.2913
| 1734 = 22.6291
| 1735 = 22.9668
| 1736 = 21.953
| 1737 = 22.2913
| 1738 = 23.9801
| 1739 = 21.2781
| 1740 = 22.2913
| 1741 = 30.7350
| 1742 = 27.3576
| 1743 = 23.9801
| 1744 = 22.2913
| 1745 = 21.6158
| 1746 = 21.953
| 1747 = 23.9801
| 1748 = 27.6953
| 1749 = 28.3708
| 1750 = 28.3708
| 1751 = 28.7086
| 1752 = 29.3841
| 1753 = 28.3708
| 1754 = 27.3576
| 1755 = 26.682
| 1756 = 26.0066
| 1757 = 27.3576
| 1758 = 29.3841
| 1759 = 33.4370
| 1760 = 32.4238
| 1761 = 30.3973
| 1762 = 32.0860
| 1763 = 32.0860
| 1764 = 29.7218
| 1765 = 30.0596
| 1766 = 33.0993
| 1767 = 32.0860
| 1768 = 30.3973
| 1769 = 31.4105
| 1770 = 33.7748
| 1771 = 32.4238
| 1772 = 36.8145
| 1773 = 34.1125
| 1774 = 32.7615
| 1775 = 31.0728
| 1776 = 35.4635
| 1777 = 43.2317
| 1778 = 56.0662
| 1779 = 49.6490
| 1780 = 55.728
| 1781 = 44.9205
| 1782 = 49.3112
| 1783 = 43.2317
| 1784 = 41.5430
| 1785 = 39.5165
| 1786 = 38.5033
| 1787 = 37.8278
| 1788 = 36.1390
| 1789 = 35.8013
| 1790 = 37.1523
| 1791 = 38.1655
| 1792 = 38.841
| 1793 = 40.1920
| 1794 = 44.5827
| 1795 = 51
| 1796 = 53.7019
| 1797 = 51.6754
| 1798 = 49.9867
| 1799 = 49.9867
| 1800 = 51
| 1801 = 50
| 1802 = 43
| 1803 = 45
| 1804 = 45
| 1805 = 45
| 1806 = 47
| 1807 = 44
| 1808 = 48
| 1809 = 47
| 1810 = 47
| 1811 = 50
| 1812 = 51
| 1813 = 58
| 1814 = 63
| 1815 = 55
| 1816 = 51
| 1817 = 48
| 1818 = 46
| 1819 = 46
| 1820 = 42
| 1821 = 40
| 1822 = 40
| 1823 = 36
| 1824 = 33
| 1825 = 34
| 1826 = 34
| 1827 = 34
| 1828 = 33
| 1829 = 32
| 1830 = 32
| 1831 = 32
| 1832 = 30
| 1833 = 29
| 1834 = 30
| 1835 = 31
| 1836 = 33
| 1837 = 34
| 1838 = 32
| 1839 = 32
| 1840 = 30
| 1841 = 31
| 1842 = 29
| 1843 = 28
| 1844 = 28
| 1845 = 28
| 1846 = 27
| 1847 = 28
| 1848 = 26
| 1849 = 25
| 1850 = 25
| 1851 = 25
| 1852 = 25
| 1853 = 25
| 1854 = 27
| 1855 = 28
| 1856 = 27
| 1857 = 28
| 1858 = 26
| 1859 = 27
| 1860 = 27
| 1861 = 27
| 1862 = 30
| 1863 = 37
| 1864 = 47
| 1865 = 46
| 1866 = 44
| 1867 = 42
| 1868 = 40
| 1869 = 40
| 1870 = 38
| 1871 = 36
| 1872 = 36
| 1873 = 36
| 1874 = 34
| 1875 = 33
| 1876 = 32
| 1877 = 32
| 1878 = 29
| 1879 = 28
| 1880 = 29
| 1881 = 29
| 1882 = 29
| 1883 = 28
| 1884 = 27
| 1885 = 27
| 1886 = 27
| 1887 = 27
| 1888 = 27
| 1889 = 27
| 1890 = 27
| 1891 = 27
| 1892 = 27
| 1893 = 27
| 1894 = 26
| 1895 = 25
| 1896 = 25
| 1897 = 25
| 1898 = 25
| 1899 = 25
| 1900 = 25
| 1901 = 25
| 1902 = 26
| 1903 = 27
| 1904 = 27
| 1905 = 27
| 1906 = 27
| 1907 = 28
| 1908 = 27
| 1909 = 27
| 1910 = 28
| 1911 = 28
| 1912 = 29
| 1913 = 29.7
| 1914 = 30.1
| 1915 = 30.4
| 1916 = 32.7
| 1917 = 38.5
| 1918 = 45.2
| 1919 = 52.1
| 1920 = 60.2
| 1921 = 53.6
| 1922 = 50.3
| 1923 = 51.2
| 1924 = 51.5
| 1925 = 52.7
| 1926 = 53.2
| 1927 = 52.2
| 1928 = 51.6
| 1929 = 51.6
| 1930 = 50.2
| 1931 = 45.7
| 1932 = 41.0
| 1933 = 38.9
| 1934 = 40.2
| 1935 = 41.2
| 1936 = 41.7
| 1937 = 43.2
| 1938 = 42.3
| 1939 = 41.8
| 1940 = 42.1
| 1941 = 44.2
| 1942 = 49.1
| 1943 = 52.0
| 1944 = 52.9
| 1945 = 54.1
| 1946 = 58.6
| 1947 = 67.1
| 1948 = 72.2
| 1949 = 71.5
| 1950 = 72.3
| 1951 = 78.0
| 1952 = 79.8
| 1953 = 80.4
| 1954 = 80.7
| 1955 = 80.5
| 1956 = 81.7
| 1957 = 84.4
| 1958 = 86.7
| 1959 = 87.6
| 1960 = 88.9
| 1961 = 89.8
| 1962 = 90.9
| 1963 = 92.0
| 1964 = 93.2
| 1965 = 94.7
| 1966 = 97.5
| 1967 = 100.2
| 1968 = 104.5
| 1969 = 110.2
| 1970 = 116.7
| 1971 = 121.7
| 1972 = 125.7
| 1973 = 133.4
| 1974 = 148.2
| 1975 = 161.7
| 1976 = 171.0
| 1977 = 182.1
| 1978 = 196.0
| 1979 = 218.1
| 1980 = 247.6
| 1981 = 273.2
| 1982 = 290.0
| 1983 = 299.3
| 1984 = 312.2
| 1985 = 323.2
| 1986 = 329.4
| 1987 = 341.4
| 1988 = 355.4
| 1989 = 372.5
| 1990 = 392.6
| 1991 = 409.3
| 1992 = 421.7
| 1993 = 434.1
| 1994 = 445.4
| 1995 = 457.9
| 1996 = 471.3
| 1997 = 482.4
| 1998 = 489.8
| 1999 = 500.6
| 2000 = 517.5
| 2001 = 532.1
| 2002 = 540.5
| 2003 = 552.8
| 2004 = 567.6
| 2005 = 586.9
| 2006 = 605.8
| 2007 = 623.1
| 2008 = 647.0
| 2009 = 644.7
| 2010 = 655.3
| 2011 = 676.0
| 2012 = 689.9
| 2013 = 700.0
| 2014 = 711.4
| 2015 = 712.3
| 2016 = 721.2
| 2017 = 736.6
| 2018 = 754.6
| 2019 = 768.3
| 2020 = 777.7
| 2021 |#default = 814.3 <!-- *** When changing this, also update the reference in [[Template:Inflation-fn]] and the latest year in [[Template:Inflation-year]]! *** -->
}}<noinclude>{{documentation|Template:Inflation/doc/cpi}}[[Category:United States data templates|United States Inflation]]</noinclude>
15qne945p2xv9x02d7igaaa8ab1266w
Template:Inflation/US/startyear
10
17638643
1023907023
827245342
2021-05-19T01:01:18Z
Pppery
28032115
Per edit request
wikitext
text/x-wiki
1634<noinclude>{{documentation|Template:Inflation/doc/startyear}}</noinclude>
5e6i05bq2k6eoj5a14gftnmm9xtdopw
Template:Inflation/year
10
40731380
1092706308
1089208462
2022-06-12T01:13:58Z
Paine Ellsworth
9092818
per edit request at [[Template talk:Inflation#Template-protected edit request on 2 December 2021]] - update
wikitext
text/x-wiki
<includeonly>{{#switch:{{{index|{{{1|ERR}}}}}}
<!-- *** When changing this, also update the reference in [[Template:Inflation/fn]] and the datasets for [[Template:Inflation]]! *** -->
| AR = 2020
| AT = 2018
| AU = 2018
| AU-road = 2018
| AU = 2010
| AU-road = 2013
| BD = 2014
| BE = 2020
| BR = 2020
| CA = 2020
| CH = 2021
| CL = 2020
| CN = 2019
| DE = 2017
| DK = 2007
| EG = 2018
| ES = 2019
| FI = 2007
| FR = 2020
| GR = 2007
| HK = 2020
| ID = 2007
| IL = 2021
| IN = 2020
| IR = 1398
| IS = 2020
| IT = 2020
| JP = 2019
| KRW = 2017
| MX = 2007
| NL = 2016
| NO = 2017
| NZ = 2021
| PE = 2017
| PH = 2019
| PK = 2019
| PL = 2021
| PT = 2007
| RU = 2007
| SE = 2009
| SG = 2020
| TEST = 2012
| TH = 2020
| TR = 2021
| TW = 2021
| UK|GBP = 2021
| UKGDP
| UK-GDP
| UK-CAP = 2019
| US|USD = 2021
| USGDP
| US-GDP
| US-CAP = 2020
| ZAR = 2018
| ERR = <span class="error">Error: no index specified when using {{tl|Inflation/year}}.{{main other|[[Category:Pages with errors in inflation template]]}}</span>
|#default = <span class="error">Error: undefined index "{{{index|{{{1}}}}}}" when using {{tl|Inflation/year}}.{{main other|[[Category:Pages with errors in inflation template]]}}</span>
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
4osemy0gumyeommdx7xrmoj5qsfv3p8
Template:Infobox
10
891845
855069164
855063393
2018-08-15T18:33:36Z
Primefac
11508456
Undid revision 855063393 by [[Special:Contributions/Jdlrobson|Jdlrobson]] ([[User talk:Jdlrobson|talk]]) rather problematic change mentioned [[Template_talk:Infobox#Using_template_styles_to_reduce_technical_debt_inside_mobile_skin|on talk page]], reverting until it can be sorted
wikitext
text/x-wiki
{{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go in the /doc subpage, and interwikis go in Wikidata. -->
</noinclude>
f4hgwrnr11ahhwyo266vcd10dpi92pe
Template:Infobox officeholder
10
1432586
1093909450
1093908134
2022-06-19T15:57:37Z
Number 57
327289
Try again then
wikitext
text/x-wiki
{{#invoke:infobox|infoboxTemplate
| bodyclass = vcard {{{bodyclass|}}}
| bodystyle = {{#if:{{{mainwidth|}}}|width: {{{mainwidth}}}}}
| child = {{lc:{{{embed}}}}}
| abovestyle = font-size: 100%;
| above = {{#if:{{{honorific prefix|{{{honorific_prefix|{{{honorific-prefix|}}}}}}}}}|<div class="honorific-prefix" style="font-weight: normal;">{{{honorific prefix|{{{honorific_prefix|{{{honorific-prefix}}}}}}}}}</div>}}<!--
--><div class="fn" style="font-size:125%;">{{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}}</div><!--
-->{{#if:{{{honorific suffix|{{{honorific_suffix|{{{honorific-suffix|}}}}}}}}}|<div class="honorific-suffix" style="font-weight: normal;">{{{honorific suffix|{{{honorific_suffix|{{{honorific-suffix}}}}}}}}}</div>}}
| subheaderstyle = font-size:125%; font-weight:bold;
| subheader = {{#ifeq:{{lc:{{{embed}}}}}|yes||{{#if:{{{native_name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{{native_name}}}{{#if:{{{native_name_lang|}}}|</div>}}}}}}
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{width|{{{imagesize|{{{image_size|}}}}}}}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{alt|}}}|suppressplaceholder=yes}}
| image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image name|}}}|size={{{width|{{{imagesize|{{{image_size|}}}}}}}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{image_name_alt|}}}|suppressplaceholder=yes}}
| image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{smallimage|}}}|sizedefault=frameless|upright={{{image_upright|1}}}|alt={{{smallimage_alt|}}}|suppressplaceholder=yes}}
| captionstyle = line-height:normal;padding-top:0.2em;
| caption{{#if:{{{smallimage|}}}|3|{{#if:{{{image name|}}}|2}}}} = {{{caption|}}}
| headerstyle = {{#ifeq:{{lc:{{{embed}}}}}|yes|background:#eee|background:lavender}}
| data1 =
{{#if:{{{speaker|}}}|
{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname2|}}}
| 1namedata = {{{1namedata2|}}}
| 2blankname = {{{2blankname2|}}}
| 2namedata = {{{2namedata2|}}}
| 3blankname = {{{3blankname2|}}}
| 3namedata = {{{3namedata2|}}}
| 4blankname = {{{4blankname2|}}}
| 4namedata = {{{4namedata2|}}}
| 5blankname = {{{5blankname2|}}}
| 5namedata = {{{5namedata2|}}}
| alongside = {{{alongside2|}}}
| ambassador_from = {{{ambassador_from2|}}}
| appointer = {{#if: {{{appointer2|}}} | {{{appointer2}}} | {{{appointed2|}}} }}
| assembly = {{{assembly2|}}}
| assuming = {{{assuming2|}}}
| chancellor = {{{chancellor2|}}}
| co-leader = {{{co-leader2|}}}
| constituency_{{#if:{{{constituency_AM2|}}}|AM|MP}} = {{#if: {{{constituency_AM2|}}} | {{{constituency_AM2}}} | {{{constituency_MP2|}}} }}
| constituency = {{{constituency2|}}}
| convocation = {{{convocation2|}}}
| country = {{{country2|}}}
| deputy = {{{deputy2|}}}
| district = {{{district2|}}}
| firstminister = {{{firstminister2|}}}
| governor-general = {{{governor-general2|}}}
| governor_general = {{{governor_general2|}}}
| governor = {{{governor2|}}}
| jr/sr = {{{jr/sr2|}}}
| jr/sr and state = {{{jr/sr and state2|}}}
| leader = {{{leader2|}}}
| legislature = {{{legislature2|}}}
| lieutenant_governor = {{{lieutenant_governor2|}}}
| lieutenant = {{{lieutenant2|}}}
| majority_leader = {{#if: {{{majorityleader2|}}} | {{{majorityleader2}}} | {{{majority_leader2|}}} }}
| minister_from = {{{minister_from2|}}}
| minority_floor_leader = {{{minority_floor_leader2|}}}
| majority_floor_leader = {{{majority_floor_leader2|}}}
| majority = {{{majority2|}}}
| minister = {{{minister2|}}}
| minority_leader = {{#if: {{{minorityleader2|}}} | {{{minorityleader2}}} | {{{minority_leader2|}}} }}
| monarch = {{{monarch2|}}}
| nominator = {{{nominator2|}}}
| office = {{{office2|}}}
| order = {{{order2|}}}
| parliament = {{{parliament2|}}}
| parliamentarygroup = {{{parliamentarygroup2|}}}
| predecessor = {{{predecessor2|}}}
| preceding = {{{preceding2|}}}
| preceded = {{{preceded2|}}}
| premier = {{{premier2|}}}
| president = {{{president2|}}}
| primeminister = {{{primeminister2|}}}
| riding = {{{riding2|}}}
| speaker = {{{speaker|}}}
| speaker_office = {{{speaker_office|}}}
| state_assembly = {{{state_assembly|}}}
| state_delegate = {{{state_delegate|}}}
| state_house = {{{state_house|}}}
| state_legislature = {{{state_legislature|}}}
| state_senate = {{{state_senate|}}}
| state = {{{state|}}}
| subterm = {{nobold|{{{subterm|}}}}}
| suboffice = {{{suboffice|}}}
| succeeded = {{{succeeded2|}}}
| succeeding = {{{succeeding2|}}}
| successor = {{{successor2|}}}
| taoiseach = {{{taoiseach2|}}}
| termlabel = {{{term_label2|{{{termlabel2|In office}}}}}}
| termend = {{#if:{{{termend2|}}}|{{{termend2}}}|{{{term_end2|}}}}}
| termstart = {{#if:{{{termstart2|}}}|{{{termstart2}}}|{{{term_start2|}}}}}
| term = {{{term2|}}}
| title = {{{title2|}}}
| vicegovernor = {{{vicegovernor2|}}}
| vicepresident = {{{vicepresident2|}}}
| vicepremier = {{{vicepremier2|}}}
| viceprimeminister = {{{viceprimeminister2|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term|}}}
}}}}}}<!--
-->{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname|}}}
| 1namedata = {{{1namedata|}}}
| 2blankname = {{{2blankname|}}}
| 2namedata = {{{2namedata|}}}
| 3blankname = {{{3blankname|}}}
| 3namedata = {{{3namedata|}}}
| 4blankname = {{{4blankname|}}}
| 4namedata = {{{4namedata|}}}
| 5blankname = {{{5blankname|}}}
| 5namedata = {{{5namedata|}}}
| alongside = {{{alongside|}}}
| ambassador_from = {{{ambassador_from|}}}
| appointer = {{#if: {{{appointer|}}} | {{{appointer}}} | {{{appointed|}}} }}
| assembly = {{{assembly|}}}
| assuming = {{{assuming|}}}
| candidate = {{{candidate|}}}
| chancellor = {{{chancellor|}}}
| co-leader = {{{co-leader|}}}
| constituency_{{#if:{{{constituency_AM|}}}|AM|MP}} = {{#if: {{{constituency_AM|}}} | {{{constituency_AM}}} | {{{constituency_MP|}}} }}
| constituency = {{{constituency|}}}
| convocation = {{{convocation|}}}
| country = {{{country|}}}
| deputy = {{{deputy|}}}
| district = {{{district|}}}
| election_date = {{{election_date|}}}
| firstminister = {{{firstminister|}}}
| governor-general = {{{governor-general|}}}
| governor_general = {{{governor_general|}}}
| governor = {{{governor|}}}
| incumbent = {{{incumbent|}}}
| jr/sr = {{{jr/sr|}}}
| jr/sr and state = {{{jr/sr and state|}}}
| leader = {{{leader|}}}
| legislature = {{{legislature|}}}
| lieutenant_governor = {{{lieutenant_governor|}}}
| lieutenant = {{{lieutenant|}}}
| majority_leader = {{#if: {{{majorityleader|}}} | {{{majorityleader}}} | {{{majority_leader|}}} }}
| majority = {{{majority|}}}
| minister = {{{minister|}}}
| minister_from = {{{minister_from|}}}
| minority_floor_leader = {{{minority_floor_leader|}}}
| majority_floor_leader = {{{majority_floor_leader|}}}
| minority_leader = {{#if: {{{minorityleader|}}} | {{{minorityleader}}} | {{{minority_leader|}}} }}
| monarch = {{{monarch|}}}
| nominator = {{{nominator|}}}
| nominee = {{{nominee|}}}
| office = {{{office|}}}
| opponent = {{{opponent|}}}
| order = {{{order|}}}
| parliament = {{{parliament|}}}
| parliamentarygroup = {{{parliamentarygroup|}}}
| party_election = {{{party_election|}}}
| predecessor = {{{predecessor|}}}
| preceding = {{{preceding|}}}
| preceded = {{{preceded|}}}
| premier = {{{premier|}}}
| president = {{{president|}}}
| primeminister = {{{primeminister|}}}
| riding = {{{riding|}}}
| runningmate = {{{runningmate|}}}
| state_assembly = {{{state_assembly|}}}
| state_delegate = {{{state_delegate|}}}
| state_house = {{{state_house|}}}
| state_legislature = {{{state_legislature|}}}
| state_senate = {{{state_senate|}}}
| state = {{{state|}}}
| status = {{{status|}}}
| suboffice = {{{suboffice|}}}
| subterm = {{nobold|{{{subterm|}}}}}
| succeeded = {{{succeeded|}}}
| succeeding = {{{succeeding|}}}
| successor = {{{successor|}}}
| taoiseach = {{{taoiseach|}}}
| termlabel = {{{term_label|{{{termlabel|In office}}}}}}
| termend = {{#if: {{{termend|}}} | {{{termend}}} | {{{term_end|}}} }}
| termstart = {{#if: {{{termstart|}}} | {{{termstart}}} | {{{term_start|}}} }}
| term = {{{term|}}}
| title = {{{title|}}}
| vicegovernor = {{{vicegovernor|}}}
| vicepresident = {{{vicepresident|}}}
| vicepremier = {{{vicepremier|}}}
| viceprimeminister = {{{viceprimeminister|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term|}}}
}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname1|}}}
| 1namedata = {{{1namedata1|}}}
| 2blankname = {{{2blankname1|}}}
| 2namedata = {{{2namedata1|}}}
| 3blankname = {{{3blankname1|}}}
| 3namedata = {{{3namedata1|}}}
| 4blankname = {{{4blankname1|}}}
| 4namedata = {{{4namedata1|}}}
| 5blankname = {{{5blankname1|}}}
| 5namedata = {{{5namedata1|}}}
| alongside = {{{alongside1|}}}
| ambassador_from = {{{ambassador_from1|}}}
| appointer = {{#if: {{{appointer1|}}} | {{{appointer1}}} | {{{appointed1|}}} }}
| assembly = {{{assembly1|}}}
| assuming = {{{assuming1|}}}
| chancellor = {{{chancellor1|}}}
| co-leader = {{{co-leader1|}}}
| constituency_{{#if:{{{constituency_AM1|}}}|AM|MP}} = {{#if: {{{constituency_AM1|}}} | {{{constituency_AM1}}} | {{{constituency_MP1|}}} }}
| constituency = {{{constituency1|}}}
| convocation = {{{convocation1|}}}
| country = {{{country1|}}}
| deputy = {{{deputy1|}}}
| district = {{{district1|}}}
| firstminister = {{{firstminister1|}}}
| governor-general = {{{governor-general1|}}}
| governor_general = {{{governor_general1|}}}
| governor = {{{governor1|}}}
| jr/sr = {{{jr/sr1|}}}
| jr/sr and state = {{{jr/sr and state1|}}}
| leader = {{{leader1|}}}
| legislature = {{{legislature1|}}}
| lieutenant_governor = {{{lieutenant_governor1|}}}
| lieutenant = {{{lieutenant1|}}}
| minority_floor_leader = {{{minority_floor_leader1|}}}
| minister_from = {{{minister_from1|}}}
| majority_floor_leader = {{{majority_floor_leader1|}}}
| majority_leader = {{#if: {{{majorityleader1|}}} | {{{majorityleader1}}} | {{{majority_leader1|}}} }}
| majority = {{{majority1|}}}
| minister = {{{minister1|}}}
| minority_leader = {{#if: {{{minorityleader1|}}} | {{{minorityleader1}}} | {{{minority_leader1|}}} }}
| monarch = {{{monarch1|}}}
| nominator = {{{nominator1|}}}
| office = {{{office1|}}}
| order = {{{order1|}}}
| parliament = {{{parliament1|}}}
| parliamentarygroup = {{{parliamentarygroup1|}}}
| predecessor = {{{predecessor1|}}}
| preceding = {{{preceding1|}}}
| preceded = {{{preceded1|}}}
| premier = {{{premier1|}}}
| president = {{{president1|}}}
| primeminister = {{{primeminister1|}}}
| riding = {{{riding1|}}}
| state_assembly = {{{state_assembly1|}}}
| state_delegate = {{{state_delegate1|}}}
| state_house = {{{state_house1|}}}
| state_legislature = {{{state_legislature1|}}}
| state_senate = {{{state_senate1|}}}
| state = {{{state1|}}}
| status = {{{status1|}}}
| subterm = {{nobold|{{{subterm1|}}}}}
| suboffice = {{{suboffice1|}}}
| succeeded = {{{succeeded1|}}}
| succeeding = {{{succeeding1|}}}
| successor = {{{successor1|}}}
| taoiseach = {{{taoiseach1|}}}
| termlabel = {{{term_label1|{{{termlabel1|In office}}}}}}
| termend = {{#if:{{{termend1|}}}|{{{termend1}}}|{{{term_end1|}}}}}
| termstart = {{#if:{{{termstart1|}}}|{{{termstart1}}}|{{{term_start1|}}}}}
| term = {{{term1|}}}
| title = {{{title1|}}}
| vicegovernor = {{{vicegovernor1|}}}
| vicepresident = {{{vicepresident1|}}}
| vicepremier = {{{vicepremier1|}}}
| viceprimeminister = {{{viceprimeminister1|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term1|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{speaker|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname2|}}}
| 1namedata = {{{1namedata2|}}}
| 2blankname = {{{2blankname2|}}}
| 2namedata = {{{2namedata2|}}}
| 3blankname = {{{3blankname2|}}}
| 3namedata = {{{3namedata2|}}}
| 4blankname = {{{4blankname2|}}}
| 4namedata = {{{4namedata2|}}}
| 5blankname = {{{5blankname2|}}}
| 5namedata = {{{5namedata2|}}}
| alongside = {{{alongside2|}}}
| ambassador_from = {{{ambassador_from2|}}}
| appointer = {{#if: {{{appointer2|}}} | {{{appointer2}}} | {{{appointed2|}}} }}
| assembly = {{{assembly2|}}}
| assuming = {{{assuming2|}}}
| chancellor = {{{chancellor2|}}}
| co-leader = {{{co-leader2|}}}
| constituency_{{#if:{{{constituency_AM2|}}}|AM|MP}} = {{#if: {{{constituency_AM2|}}} | {{{constituency_AM2}}} | {{{constituency_MP2|}}} }}
| constituency = {{{constituency2|}}}
| convocation = {{{convocation2|}}}
| country = {{{country2|}}}
| deputy = {{{deputy2|}}}
| district = {{{district2|}}}
| firstminister = {{{firstminister2|}}}
| governor-general = {{{governor-general2|}}}
| governor_general = {{{governor_general2|}}}
| governor = {{{governor2|}}}
| jr/sr = {{{jr/sr2|}}}
| jr/sr and state = {{{jr/sr and state2|}}}
| leader = {{{leader2|}}}
| legislature = {{{legislature2|}}}
| lieutenant_governor = {{{lieutenant_governor2|}}}
| lieutenant = {{{lieutenant2|}}}
| majority_leader = {{#if: {{{majorityleader2|}}} | {{{majorityleader2}}} | {{{majority_leader2|}}} }}
| minister_from = {{{minister_from2|}}}
| minority_floor_leader = {{{minority_floor_leader2|}}}
| majority_floor_leader = {{{majority_floor_leader2|}}}
| majority = {{{majority2|}}}
| minister = {{{minister2|}}}
| minority_leader = {{#if: {{{minorityleader2|}}} | {{{minorityleader2}}} | {{{minority_leader2|}}} }}
| monarch = {{{monarch2|}}}
| nominator = {{{nominator2|}}}
| office = {{{office2|}}}
| order = {{{order2|}}}
| parliament = {{{parliament2|}}}
| parliamentarygroup = {{{parliamentarygroup2|}}}
| predecessor = {{{predecessor2|}}}
| preceding = {{{preceding2|}}}
| preceded = {{{preceded2|}}}
| premier = {{{premier2|}}}
| president = {{{president2|}}}
| primeminister = {{{primeminister2|}}}
| riding = {{{riding2|}}}
| state_assembly = {{{state_assembly2|}}}
| state_delegate = {{{state_delegate2|}}}
| state_house = {{{state_house2|}}}
| state_legislature = {{{state_legislature2|}}}
| state_senate = {{{state_senate2|}}}
| state = {{{state2|}}}
| status = {{{status2|}}}
| subterm = {{nobold|{{{subterm2|}}}}}
| suboffice = {{{suboffice2|}}}
| succeeded = {{{succeeded2|}}}
| succeeding = {{{succeeding2|}}}
| successor = {{{successor2|}}}
| taoiseach = {{{taoiseach2|}}}
| termlabel = {{{term_label2|{{{termlabel2|In office}}}}}}
| termend = {{#if:{{{termend2|}}}|{{{termend2}}}|{{{term_end2|}}}}}
| termstart = {{#if:{{{termstart2|}}}|{{{termstart2}}}|{{{term_start2|}}}}}
| term = {{{term2|}}}
| title = {{{title2|}}}
| vicegovernor = {{{vicegovernor2|}}}
| vicepresident = {{{vicepresident2|}}}
| vicepremier = {{{vicepremier2|}}}
| viceprimeminister = {{{viceprimeminister2|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term2|}}}
}}}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname3|}}}
| 1namedata = {{{1namedata3|}}}
| 2blankname = {{{2blankname3|}}}
| 2namedata = {{{2namedata3|}}}
| 3blankname = {{{3blankname3|}}}
| 3namedata = {{{3namedata3|}}}
| 4blankname = {{{4blankname3|}}}
| 4namedata = {{{4namedata3|}}}
| 5blankname = {{{5blankname3|}}}
| 5namedata = {{{5namedata3|}}}
| alongside = {{{alongside3|}}}
| ambassador_from = {{{ambassador_from3|}}}
| appointer = {{#if: {{{appointer3|}}} | {{{appointer3}}} | {{{appointed3|}}} }}
| assembly = {{{assembly3|}}}
| assuming = {{{assuming3|}}}
| chancellor = {{{chancellor3|}}}
| co-leader = {{{co-leader3|}}}
| constituency_{{#if:{{{constituency_AM3|}}}|AM|MP}} = {{#if: {{{constituency_AM3|}}} | {{{constituency_AM3}}} | {{{constituency_MP3|}}} }}
| constituency = {{{constituency3|}}}
| convocation = {{{convocation3|}}}
| country = {{{country3|}}}
| deputy = {{{deputy3|}}}
| district = {{{district3|}}}
| firstminister = {{{firstminister3|}}}
| governor-general = {{{governor-general3|}}}
| governor_general = {{{governor_general3|}}}
| governor = {{{governor3|}}}
| jr/sr = {{{jr/sr3|}}}
| jr/sr and state = {{{jr/sr and state3|}}}
| leader = {{{leader3|}}}
| legislature = {{{legislature3|}}}
| lieutenant_governor = {{{lieutenant_governor3|}}}
| lieutenant = {{{lieutenant3|}}}
| minority_floor_leader = {{{minority_floor_leader3|}}}
| minister_from = {{{minister_from3|}}}
| majority_floor_leader = {{{majority_floor_leader3|}}}
| majority_leader = {{#if: {{{majorityleader3|}}} | {{{majorityleader3}}} | {{{majority_leader3|}}} }}
| majority = {{{majority3|}}}
| minister = {{{minister3|}}}
| minority_leader = {{#if: {{{minorityleader3|}}} | {{{minorityleader3}}} | {{{minority_leader3|}}} }}
| monarch = {{{monarch3|}}}
| nominator = {{{nominator3|}}}
| office = {{{office3|}}}
| order = {{{order3|}}}
| parliament = {{{parliament3|}}}
| parliamentarygroup = {{{parliamentarygroup3|}}}
| predecessor = {{{predecessor3|}}}
| preceding = {{{preceding3|}}}
| preceded = {{{preceded3|}}}
| premier = {{{premier3|}}}
| president = {{{president3|}}}
| primeminister = {{{primeminister3|}}}
| riding = {{{riding3|}}}
| state_assembly = {{{state_assembly3|}}}
| state_delegate = {{{state_delegate3|}}}
| state_house = {{{state_house3|}}}
| state_legislature = {{{state_legislature3|}}}
| state_senate = {{{state_senate3|}}}
| state = {{{state3|}}}
| status = {{{status3|}}}
| subterm = {{nobold|{{{subterm3|}}}}}
| suboffice = {{{suboffice3|}}}
| succeeded = {{{succeeded3|}}}
| succeeding = {{{succeeding3|}}}
| successor = {{{successor3|}}}
| taoiseach = {{{taoiseach3|}}}
| termlabel = {{{term_label3|{{{termlabel3|In office}}}}}}
| termend = {{#if:{{{termend3|}}}|{{{termend3}}}|{{{term_end3|}}}}}
| termstart = {{#if:{{{termstart3|}}}|{{{termstart3}}}|{{{term_start3|}}}}}
| term = {{{term3|}}}
| title = {{{title3|}}}
| vicegovernor = {{{vicegovernor3|}}}
| vicepresident = {{{vicepresident3|}}}
| vicepremier = {{{vicepremier3|}}}
| viceprimeminister = {{{viceprimeminister3|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term3|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname4|}}}
| 1namedata = {{{1namedata4|}}}
| 2blankname = {{{2blankname4|}}}
| 2namedata = {{{2namedata4|}}}
| 3blankname = {{{3blankname4|}}}
| 3namedata = {{{3namedata4|}}}
| 4blankname = {{{4blankname4|}}}
| 4namedata = {{{4namedata4|}}}
| 5blankname = {{{5blankname4|}}}
| 5namedata = {{{5namedata4|}}}
| alongside = {{{alongside4|}}}
| ambassador_from = {{{ambassador_from4|}}}
| appointer = {{#if: {{{appointer4|}}} | {{{appointer4}}} | {{{appointed4|}}} }}
| assembly = {{{assembly4|}}}
| assuming = {{{assuming4|}}}
| chancellor = {{{chancellor4|}}}
| co-leader = {{{co-leader4|}}}
| constituency_{{#if:{{{constituency_AM4|}}}|AM|MP}} = {{#if: {{{constituency_AM4|}}} | {{{constituency_AM4}}} | {{{constituency_MP4|}}} }}
| constituency = {{{constituency4|}}}
| convocation = {{{convocation4|}}}
| country = {{{country4|}}}
| deputy = {{{deputy4|}}}
| district = {{{district4|}}}
| firstminister = {{{firstminister4|}}}
| governor-general = {{{governor-general4|}}}
| governor_general = {{{governor_general4|}}}
| governor = {{{governor4|}}}
| jr/sr = {{{jr/sr4|}}}
| jr/sr and state = {{{jr/sr and state4|}}}
| leader = {{{leader4|}}}
| legislature = {{{legislature4|}}}
| lieutenant_governor = {{{lieutenant_governor4|}}}
| lieutenant = {{{lieutenant4|}}}
| minister_from = {{{minister_from4|}}}
| minority_floor_leader = {{{minority_floor_leader4|}}}
| majority_floor_leader = {{{majority_floor_leader4|}}}
| majority_leader = {{#if: {{{majorityleader4|}}} | {{{majorityleader4}}} | {{{majority_leader4|}}} }}
| majority = {{{majority4|}}}
| minister = {{{minister4|}}}
| minority_leader = {{#if: {{{minorityleader4|}}} | {{{minorityleader4}}} | {{{minority_leader4|}}} }}
| monarch = {{{monarch4|}}}
| nominator = {{{nominator4|}}}
| office = {{{office4|}}}
| order = {{{order4|}}}
| parliament = {{{parliament4|}}}
| parliamentarygroup = {{{parliamentarygroup4|}}}
| predecessor = {{{predecessor4|}}}
| preceding = {{{preceding4|}}}
| preceded = {{{preceded4|}}}
| premier = {{{premier4|}}}
| president = {{{president4|}}}
| primeminister = {{{primeminister4|}}}
| riding = {{{riding4|}}}
| state_assembly = {{{state_assembly4|}}}
| state_delegate = {{{state_delegate4|}}}
| state_house = {{{state_house4|}}}
| state_legislature = {{{state_legislature4|}}}
| state_senate = {{{state_senate4|}}}
| state = {{{state4|}}}
| status = {{{status4|}}}
| subterm = {{nobold|{{{subterm4|}}}}}
| suboffice = {{{suboffice4|}}}
| succeeded = {{{succeeded4|}}}
| succeeding = {{{succeeding4|}}}
| successor = {{{successor4|}}}
| taoiseach = {{{taoiseach4|}}}
| termlabel = {{{term_label4|{{{termlabel4|In office}}}}}}
| termend = {{#if:{{{termend4|}}}|{{{termend4}}}|{{{term_end4|}}}}}
| termstart = {{#if:{{{termstart4|}}}|{{{termstart4}}}|{{{term_start4|}}}}}
| term = {{{term4|}}}
| title = {{{title4|}}}
| vicegovernor = {{{vicegovernor4|}}}
| vicepresident = {{{vicepresident4|}}}
| vicepremier = {{{vicepremier4|}}}
| viceprimeminister = {{{viceprimeminister4|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term4|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname5|}}}
| 1namedata = {{{1namedata5|}}}
| 2blankname = {{{2blankname5|}}}
| 2namedata = {{{2namedata5|}}}
| 3blankname = {{{3blankname5|}}}
| 3namedata = {{{3namedata5|}}}
| 4blankname = {{{4blankname5|}}}
| 4namedata = {{{4namedata5|}}}
| 5blankname = {{{5blankname5|}}}
| 5namedata = {{{5namedata5|}}}
| alongside = {{{alongside5|}}}
| ambassador_from = {{{ambassador_from5|}}}
| appointer = {{#if: {{{appointer5|}}} | {{{appointer5}}} | {{{appointed5|}}} }}
| assembly = {{{assembly5|}}}
| assuming = {{{assuming5|}}}
| chancellor = {{{chancellor5|}}}
| co-leader = {{{co-leader5|}}}
| constituency_{{#if:{{{constituency_AM5|}}}|AM|MP}} = {{#if: {{{constituency_AM5|}}} | {{{constituency_AM5}}} | {{{constituency_MP5|}}} }}
| constituency = {{{constituency5|}}}
| convocation = {{{convocation5|}}}
| country = {{{country5|}}}
| deputy = {{{deputy5|}}}
| district = {{{district5|}}}
| firstminister = {{{firstminister5|}}}
| governor-general = {{{governor-general5|}}}
| governor_general = {{{governor_general5|}}}
| governor = {{{governor5|}}}
| jr/sr = {{{jr/sr5|}}}
| jr/sr and state = {{{jr/sr and state5|}}}
| leader = {{{leader5|}}}
| legislature = {{{legislature5|}}}
| lieutenant_governor = {{{lieutenant_governor5|}}}
| lieutenant = {{{lieutenant5|}}}
| minister_from = {{{minister_from5|}}}
| minority_floor_leader = {{{minority_floor_leader5|}}}
| majority_floor_leader = {{{majority_floor_leader5|}}}
| majority_leader = {{#if: {{{majorityleader5|}}} | {{{majorityleader5}}} | {{{majority_leader5|}}} }}
| majority = {{{majority5|}}}
| minister = {{{minister5|}}}
| minority_leader = {{#if: {{{minorityleader5|}}} | {{{minorityleader5}}} | {{{minority_leader5|}}} }}
| monarch = {{{monarch5|}}}
| nominator = {{{nominator5|}}}
| office = {{{office5|}}}
| order = {{{order5|}}}
| parliament = {{{parliament5|}}}
| parliamentarygroup = {{{parliamentarygroup5|}}}
| predecessor = {{{predecessor5|}}}
| preceding = {{{preceding5|}}}
| preceded = {{{preceded5|}}}
| premier = {{{premier5|}}}
| president = {{{president5|}}}
| primeminister = {{{primeminister5|}}}
| riding = {{{riding5|}}}
| state_assembly = {{{state_assembly5|}}}
| state_delegate = {{{state_delegate5|}}}
| state_house = {{{state_house5|}}}
| state_legislature = {{{state_legislature5|}}}
| state_senate = {{{state_senate5|}}}
| state = {{{state5|}}}
| status = {{{status5|}}}
| subterm = {{nobold|{{{subterm5|}}}}}
| suboffice = {{{suboffice5|}}}
| succeeded = {{{succeeded5|}}}
| succeeding = {{{succeeding5|}}}
| successor = {{{successor5|}}}
| taoiseach = {{{taoiseach5|}}}
| termlabel = {{{term_label5|{{{termlabel5|In office}}}}}}
| termend = {{#if:{{{termend5|}}}|{{{termend5}}}|{{{term_end5|}}}}}
| termstart = {{#if:{{{termstart5|}}}|{{{termstart5}}}|{{{term_start5|}}}}}
| term = {{{term5|}}}
| title = {{{title5|}}}
| vicegovernor = {{{vicegovernor5|}}}
| vicepresident = {{{vicepresident5|}}}
| vicepremier = {{{vicepremier5|}}}
| viceprimeminister = {{{viceprimeminister5|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term5|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname6|}}}
| 1namedata = {{{1namedata6|}}}
| 2blankname = {{{2blankname6|}}}
| 2namedata = {{{2namedata6|}}}
| 3blankname = {{{3blankname6|}}}
| 3namedata = {{{3namedata6|}}}
| 4blankname = {{{4blankname6|}}}
| 4namedata = {{{4namedata6|}}}
| 5blankname = {{{5blankname6|}}}
| 5namedata = {{{5namedata6|}}}
| alongside = {{{alongside6|}}}
| ambassador_from = {{{ambassador_from6|}}}
| appointer = {{#if: {{{appointer6|}}} | {{{appointer6}}} | {{{appointed6|}}} }}
| assembly = {{{assembly6|}}}
| assuming = {{{assuming6|}}}
| chancellor = {{{chancellor6|}}}
| co-leader = {{{co-leader6|}}}
| constituency_{{#if:{{{constituency_AM6|}}}|AM|MP}} = {{#if: {{{constituency_AM6|}}} | {{{constituency_AM6}}} | {{{constituency_MP6|}}} }}
| constituency = {{{constituency6|}}}
| convocation = {{{convocation6|}}}
| country = {{{country6|}}}
| deputy = {{{deputy6|}}}
| district = {{{district6|}}}
| firstminister = {{{firstminister6|}}}
| governor-general = {{{governor-general6|}}}
| governor_general = {{{governor_general6|}}}
| governor = {{{governor6|}}}
| jr/sr = {{{jr/sr6|}}}
| jr/sr and state = {{{jr/sr and state6|}}}
| leader = {{{leader6|}}}
| legislature = {{{legislature6|}}}
| lieutenant_governor = {{{lieutenant_governor6|}}}
| lieutenant = {{{lieutenant6|}}}
| minority_floor_leader = {{{minority_floor_leader6|}}}
| minister_from = {{{minister_from6|}}}
| majority_floor_leader = {{{majority_floor_leader6|}}}
| majority_leader = {{#if: {{{majorityleader6|}}} | {{{majorityleader6}}} | {{{majority_leader6|}}} }}
| majority = {{{majority6|}}}
| minister = {{{minister6|}}}
| minority_leader = {{#if: {{{minorityleader6|}}} | {{{minorityleader6}}} | {{{minority_leader6|}}} }}
| monarch = {{{monarch6|}}}
| nominator = {{{nominator6|}}}
| office = {{{office6|}}}
| order = {{{order6|}}}
| parliament = {{{parliament6|}}}
| parliamentarygroup = {{{parliamentarygroup6|}}}
| predecessor = {{{predecessor6|}}}
| preceding = {{{preceding6|}}}
| preceded = {{{preceded6|}}}
| premier = {{{premier6|}}}
| president = {{{president6|}}}
| primeminister = {{{primeminister6|}}}
| riding = {{{riding6|}}}
| state_assembly = {{{state_assembly6|}}}
| state_delegate = {{{state_delegate6|}}}
| state_house = {{{state_house6|}}}
| state_legislature = {{{state_legislature6|}}}
| state_senate = {{{state_senate6|}}}
| state = {{{state6|}}}
| status = {{{status6|}}}
| subterm = {{nobold|{{{subterm6|}}}}}
| suboffice = {{{suboffice6|}}}
| succeeded = {{{succeeded6|}}}
| succeeding = {{{succeeding6|}}}
| successor = {{{successor6|}}}
| taoiseach = {{{taoiseach6|}}}
| termlabel = {{{term_label6|{{{termlabel6|In office}}}}}}
| termend = {{#if:{{{termend6|}}}|{{{termend6}}}|{{{term_end6|}}}}}
| termstart = {{#if:{{{termstart6|}}}|{{{termstart6}}}|{{{term_start6|}}}}}
| term = {{{term6|}}}
| title = {{{title6|}}}
| vicegovernor = {{{vicegovernor6|}}}
| vicepresident = {{{vicepresident6|}}}
| vicepremier = {{{vicepremier6|}}}
| viceprimeminister = {{{viceprimeminister6|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term6|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname7|}}}
| 1namedata = {{{1namedata7|}}}
| 2blankname = {{{2blankname7|}}}
| 2namedata = {{{2namedata7|}}}
| 3blankname = {{{3blankname7|}}}
| 3namedata = {{{3namedata7|}}}
| 4blankname = {{{4blankname7|}}}
| 4namedata = {{{4namedata7|}}}
| 5blankname = {{{5blankname7|}}}
| 5namedata = {{{5namedata7|}}}
| alongside = {{{alongside7|}}}
| ambassador_from = {{{ambassador_from7|}}}
| appointer = {{#if: {{{appointer7|}}} | {{{appointer7}}} | {{{appointed7|}}} }}
| assembly = {{{assembly7|}}}
| assuming = {{{assuming7|}}}
| chancellor = {{{chancellor7|}}}
| co-leader = {{{co-leader7|}}}
| constituency_{{#if:{{{constituency_AM7|}}}|AM|MP}} = {{#if: {{{constituency_AM7|}}} | {{{constituency_AM7}}} | {{{constituency_MP7|}}} }}
| constituency = {{{constituency7|}}}
| convocation = {{{convocation7|}}}
| country = {{{country7|}}}
| deputy = {{{deputy7|}}}
| district = {{{district7|}}}
| firstminister = {{{firstminister7|}}}
| governor-general = {{{governor-general7|}}}
| governor_general = {{{governor_general7|}}}
| governor = {{{governor7|}}}
| jr/sr = {{{jr/sr7|}}}
| jr/sr and state = {{{jr/sr and state7|}}}
| leader = {{{leader7|}}}
| legislature = {{{legislature7|}}}
| lieutenant_governor = {{{lieutenant_governor7|}}}
| lieutenant = {{{lieutenant7|}}}
| minister_from = {{{minister_from7|}}}
| minority_floor_leader = {{{minority_floor_leader7|}}}
| majority_floor_leader = {{{majority_floor_leader7|}}}
| majority_leader = {{#if: {{{majorityleader7|}}} | {{{majorityleader7}}} | {{{majority_leader7|}}} }}
| majority = {{{majority7|}}}
| minister = {{{minister7|}}}
| minority_leader = {{#if: {{{minorityleader7|}}} | {{{minorityleader7}}} | {{{minority_leader7|}}} }}
| monarch = {{{monarch7|}}}
| nominator = {{{nominator7|}}}
| office = {{{office7|}}}
| order = {{{order7|}}}
| parliament = {{{parliament7|}}}
| parliamentarygroup = {{{parliamentarygroup7|}}}
| predecessor = {{{predecessor7|}}}
| preceding = {{{preceding7|}}}
| preceded = {{{preceded7|}}}
| premier = {{{premier7|}}}
| president = {{{president7|}}}
| primeminister = {{{primeminister7|}}}
| riding = {{{riding7|}}}
| state_assembly = {{{state_assembly7|}}}
| state_delegate = {{{state_delegate7|}}}
| state_house = {{{state_house7|}}}
| state_legislature = {{{state_legislature7|}}}
| state_senate = {{{state_senate7|}}}
| state = {{{state7|}}}
| status = {{{status7|}}}
| subterm = {{nobold|{{{subterm7|}}}}}
| suboffice = {{{suboffice7|}}}
| succeeded = {{{succeeded7|}}}
| succeeding = {{{succeeding7|}}}
| successor = {{{successor7|}}}
| taoiseach = {{{taoiseach7|}}}
| termlabel = {{{term_label7|{{{termlabel7|In office}}}}}}
| termend = {{#if:{{{termend7|}}}|{{{termend7}}}|{{{term_end7|}}}}}
| termstart = {{#if:{{{termstart7|}}}|{{{termstart7}}}|{{{term_start7|}}}}}
| term = {{{term7|}}}
| title = {{{title7|}}}
| vicegovernor = {{{vicegovernor7|}}}
| vicepresident = {{{vicepresident7|}}}
| vicepremier = {{{vicepremier7|}}}
| viceprimeminister = {{{viceprimeminister7|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term7|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname8|}}}
| 1namedata = {{{1namedata8|}}}
| 2blankname = {{{2blankname8|}}}
| 2namedata = {{{2namedata8|}}}
| 3blankname = {{{3blankname8|}}}
| 3namedata = {{{3namedata8|}}}
| 4blankname = {{{4blankname8|}}}
| 4namedata = {{{4namedata8|}}}
| 5blankname = {{{5blankname8|}}}
| 5namedata = {{{5namedata8|}}}
| alongside = {{{alongside8|}}}
| ambassador_from = {{{ambassador_from8|}}}
| appointer = {{#if: {{{appointer8|}}} | {{{appointer8}}} | {{{appointed8|}}} }}
| assembly = {{{assembly8|}}}
| assuming = {{{assuming8|}}}
| chancellor = {{{chancellor8|}}}
| co-leader = {{{co-leader8|}}}
| constituency_{{#if:{{{constituency_AM8|}}}|AM|MP}} = {{#if: {{{constituency_AM8|}}} | {{{constituency_AM8}}} | {{{constituency_MP8|}}} }}
| constituency = {{{constituency8|}}}
| convocation = {{{convocation8|}}}
| country = {{{country8|}}}
| deputy = {{{deputy8|}}}
| district = {{{district8|}}}
| firstminister = {{{firstminister8|}}}
| governor-general = {{{governor-general8|}}}
| governor_general = {{{governor_general8|}}}
| governor = {{{governor8|}}}
| jr/sr = {{{jr/sr8|}}}
| jr/sr and state = {{{jr/sr and state8|}}}
| leader = {{{leader8|}}}
| legislature = {{{legislature8|}}}
| lieutenant_governor = {{{lieutenant_governor8|}}}
| lieutenant = {{{lieutenant8|}}}
| minister_from = {{{minister_from8|}}}
| minority_floor_leader = {{{minority_floor_leader8|}}}
| majority_floor_leader = {{{majority_floor_leader8|}}}
| majority_leader = {{#if: {{{majorityleader8|}}} | {{{majorityleader8}}} | {{{majority_leader8|}}} }}
| majority = {{{majority8|}}}
| minister = {{{minister8|}}}
| minority_leader = {{#if: {{{minorityleader8|}}} | {{{minorityleader8}}} | {{{minority_leader8|}}} }}
| monarch = {{{monarch8|}}}
| nominator = {{{nominator8|}}}
| office = {{{office8|}}}
| order = {{{order8|}}}
| parliament = {{{parliament8|}}}
| parliamentarygroup = {{{parliamentarygroup8|}}}
| predecessor = {{{predecessor8|}}}
| preceding = {{{preceding8|}}}
| preceded = {{{preceded8|}}}
| premier = {{{premier8|}}}
| president = {{{president8|}}}
| primeminister = {{{primeminister8|}}}
| riding = {{{riding8|}}}
| state_assembly = {{{state_assembly8|}}}
| state_delegate = {{{state_delegate8|}}}
| state_house = {{{state_house8|}}}
| state_legislature = {{{state_legislature8|}}}
| state_senate = {{{state_senate8|}}}
| state = {{{state8|}}}
| status = {{{status8|}}}
| subterm = {{nobold|{{{subterm8|}}}}}
| suboffice = {{{suboffice8|}}}
| succeeded = {{{succeeded8|}}}
| succeeding = {{{succeeding8|}}}
| successor = {{{successor8|}}}
| taoiseach = {{{taoiseach8|}}}
| termlabel = {{{term_label8|{{{termlabel8|In office}}}}}}
| termend = {{#if:{{{termend8|}}}|{{{termend8}}}|{{{term_end8|}}}}}
| termstart = {{#if:{{{termstart8|}}}|{{{termstart8}}}|{{{term_start8|}}}}}
| term = {{{term8|}}}
| title = {{{title8|}}}
| vicegovernor = {{{vicegovernor8|}}}
| vicepresident = {{{vicepresident8|}}}
| vicepremier = {{{vicepremier8|}}}
| viceprimeminister = {{{viceprimeminister8|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term8|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname9|}}}
| 1namedata = {{{1namedata9|}}}
| 2blankname = {{{2blankname9|}}}
| 2namedata = {{{2namedata9|}}}
| 3blankname = {{{3blankname9|}}}
| 3namedata = {{{3namedata9|}}}
| 4blankname = {{{4blankname9|}}}
| 4namedata = {{{4namedata9|}}}
| 5blankname = {{{5blankname9|}}}
| 5namedata = {{{5namedata9|}}}
| alongside = {{{alongside9|}}}
| ambassador_from = {{{ambassador_from9|}}}
| appointer = {{#if: {{{appointer9|}}} | {{{appointer9}}} | {{{appointed9|}}} }}
| assembly = {{{assembly9|}}}
| assuming = {{{assuming9|}}}
| chancellor = {{{chancellor9|}}}
| co-leader = {{{co-leader9|}}}
| constituency_{{#if:{{{constituency_AM9|}}}|AM|MP}} = {{#if: {{{constituency_AM9|}}} | {{{constituency_AM9}}} | {{{constituency_MP9|}}} }}
| constituency = {{{constituency9|}}}
| convocation = {{{convocation9|}}}
| country = {{{country9|}}}
| deputy = {{{deputy9|}}}
| district = {{{district9|}}}
| firstminister = {{{firstminister9|}}}
| governor-general = {{{governor-general9|}}}
| governor_general = {{{governor_general9|}}}
| governor = {{{governor9|}}}
| jr/sr = {{{jr/sr9|}}}
| jr/sr and state = {{{jr/sr and state9|}}}
| leader = {{{leader9|}}}
| legislature = {{{legislature9|}}}
| lieutenant_governor = {{{lieutenant_governor9|}}}
| lieutenant = {{{lieutenant9|}}}
| minister_from = {{{minister_from9|}}}
| minority_floor_leader = {{{minority_floor_leader9|}}}
| majority_floor_leader = {{{majority_floor_leader9|}}}
| majority_leader = {{#if: {{{majorityleader9|}}} | {{{majorityleader9}}} | {{{majority_leader9|}}} }}
| majority = {{{majority9|}}}
| minister = {{{minister9|}}}
| minority_leader = {{#if: {{{minorityleader9|}}} | {{{minorityleader9}}} | {{{minority_leader9|}}} }}
| monarch = {{{monarch9|}}}
| nominator = {{{nominator9|}}}
| office = {{{office9|}}}
| order = {{{order9|}}}
| parliament = {{{parliament9|}}}
| parliamentarygroup = {{{parliamentarygroup9|}}}
| predecessor = {{{predecessor9|}}}
| preceding = {{{preceding9|}}}
| preceded = {{{preceded9|}}}
| premier = {{{premier9|}}}
| president = {{{president9|}}}
| primeminister = {{{primeminister9|}}}
| riding = {{{riding9|}}}
| state_assembly = {{{state_assembly9|}}}
| state_delegate = {{{state_delegate9|}}}
| state_house = {{{state_house9|}}}
| state_legislature = {{{state_legislature9|}}}
| state_senate = {{{state_senate9|}}}
| state = {{{state9|}}}
| status = {{{status9|}}}
| subterm = {{nobold|{{{subterm9|}}}}}
| suboffice = {{{suboffice9|}}}
| succeeded = {{{succeeded9|}}}
| succeeding = {{{succeeding9|}}}
| successor = {{{successor9|}}}
| taoiseach = {{{taoiseach9|}}}
| termlabel = {{{term_label9|{{{termlabel9|In office}}}}}}
| termend = {{#if:{{{termend9|}}}|{{{termend9}}}|{{{term_end9|}}}}}
| termstart = {{#if:{{{termstart9|}}}|{{{termstart9}}}|{{{term_start9|}}}}}
| term = {{{term9|}}}
| title = {{{title9|}}}
| vicegovernor = {{{vicegovernor9|}}}
| vicepresident = {{{vicepresident9|}}}
| vicepremier = {{{vicepremier9|}}}
| viceprimeminister = {{{viceprimeminister9|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term9|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname10|}}}
| 1namedata = {{{1namedata10|}}}
| 2blankname = {{{2blankname10|}}}
| 2namedata = {{{2namedata10|}}}
| 3blankname = {{{3blankname10|}}}
| 3namedata = {{{3namedata10|}}}
| 4blankname = {{{4blankname10|}}}
| 4namedata = {{{4namedata10|}}}
| 5blankname = {{{5blankname10|}}}
| 5namedata = {{{5namedata10|}}}
| alongside = {{{alongside10|}}}
| ambassador_from = {{{ambassador_from10|}}}
| appointer = {{#if: {{{appointer10|}}} | {{{appointer10}}} | {{{appointed10|}}} }}
| assembly = {{{assembly10|}}}
| assuming = {{{assuming10|}}}
| chancellor = {{{chancellor10|}}}
| co-leader = {{{co-leader10|}}}
| constituency_{{#if:{{{constituency_AM10|}}}|AM|MP}} = {{#if: {{{constituency_AM10|}}} | {{{constituency_AM10}}} | {{{constituency_MP10|}}} }}
| constituency = {{{constituency10|}}}
| convocation = {{{convocation10|}}}
| country = {{{country10|}}}
| deputy = {{{deputy10|}}}
| district = {{{district10|}}}
| firstminister = {{{firstminister10|}}}
| governor-general = {{{governor-general10|}}}
| governor_general = {{{governor_general10|}}}
| governor = {{{governor10|}}}
| jr/sr = {{{jr/sr10|}}}
| jr/sr and state = {{{jr/sr and state10|}}}
| leader = {{{leader10|}}}
| legislature = {{{legislature10|}}}
| lieutenant_governor = {{{lieutenant_governor10|}}}
| lieutenant = {{{lieutenant10|}}}
| minister_from = {{{minister_from10|}}}
| minority_floor_leader = {{{minority_floor_leader10|}}}
| majority_floor_leader = {{{majority_floor_leader10|}}}
| majority_leader = {{#if: {{{majorityleader10|}}} | {{{majorityleader10}}} | {{{majority_leader10|}}} }}
| majority = {{{majority10|}}}
| minister = {{{minister10|}}}
| minority_leader = {{#if: {{{minorityleader10|}}} | {{{minorityleader10}}} | {{{minority_leader10|}}} }}
| monarch = {{{monarch10|}}}
| nominator = {{{nominator10|}}}
| office = {{{office10|}}}
| order = {{{order10|}}}
| parliament = {{{parliament10|}}}
| parliamentarygroup = {{{parliamentarygroup10|}}}
| predecessor = {{{predecessor10|}}}
| preceding = {{{preceding10|}}}
| preceded = {{{preceded10|}}}
| premier = {{{premier10|}}}
| president = {{{president10|}}}
| primeminister = {{{primeminister10|}}}
| riding = {{{riding10|}}}
| state_assembly = {{{state_assembly10|}}}
| state_delegate = {{{state_delegate10|}}}
| state_house = {{{state_house10|}}}
| state_legislature = {{{state_legislature10|}}}
| state_senate = {{{state_senate10|}}}
| state = {{{state10|}}}
| status = {{{status10|}}}
| subterm = {{nobold|{{{subterm10|}}}}}
| suboffice = {{{suboffice10|}}}
| succeeded = {{{succeeded10|}}}
| succeeding = {{{succeeding10|}}}
| successor = {{{successor10|}}}
| taoiseach = {{{taoiseach10|}}}
| termlabel = {{{term_label10|{{{termlabel10|In office}}}}}}
| termend = {{#if:{{{termend10|}}}|{{{termend10}}}|{{{term_end10|}}}}}
| termstart = {{#if:{{{termstart10|}}}|{{{termstart10}}}|{{{term_start10|}}}}}
| term = {{{term10|}}}
| title = {{{title10|}}}
| vicegovernor = {{{vicegovernor10|}}}
| vicepresident = {{{vicepresident10|}}}
| vicepremier = {{{vicepremier10|}}}
| viceprimeminister = {{{viceprimeminister10|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term10|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname11|}}}
| 1namedata = {{{1namedata11|}}}
| 2blankname = {{{2blankname11|}}}
| 2namedata = {{{2namedata11|}}}
| 3blankname = {{{3blankname11|}}}
| 3namedata = {{{3namedata11|}}}
| 4blankname = {{{4blankname11|}}}
| 4namedata = {{{4namedata11|}}}
| 5blankname = {{{5blankname11|}}}
| 5namedata = {{{5namedata11|}}}
| alongside = {{{alongside11|}}}
| ambassador_from = {{{ambassador_from11|}}}
| appointer = {{#if: {{{appointer11|}}} | {{{appointer11}}} | {{{appointed11|}}} }}
| assembly = {{{assembly11|}}}
| assuming = {{{assuming11|}}}
| chancellor = {{{chancellor11|}}}
| co-leader = {{{co-leader11|}}}
| constituency_{{#if:{{{constituency_AM11|}}}|AM|MP}} = {{#if: {{{constituency_AM11|}}} | {{{constituency_AM11}}} | {{{constituency_MP11|}}} }}
| constituency = {{{constituency11|}}}
| convocation = {{{convocation11|}}}
| country = {{{country11|}}}
| deputy = {{{deputy11|}}}
| district = {{{district11|}}}
| firstminister = {{{firstminister11|}}}
| governor-general = {{{governor-general11|}}}
| governor_general = {{{governor_general11|}}}
| governor = {{{governor11|}}}
| jr/sr = {{{jr/sr11|}}}
| jr/sr and state = {{{jr/sr and state11|}}}
| leader = {{{leader11|}}}
| legislature = {{{legislature11|}}}
| lieutenant_governor = {{{lieutenant_governor11|}}}
| lieutenant = {{{lieutenant11|}}}
| minister_from = {{{minister_from11|}}}
| minority_floor_leader = {{{minority_floor_leader11|}}}
| majority_floor_leader = {{{majority_floor_leader11|}}}
| majority_leader = {{#if: {{{majorityleader11|}}} | {{{majorityleader11}}} | {{{majority_leader11|}}} }}
| majority = {{{majority11|}}}
| minister = {{{minister11|}}}
| minority_leader = {{#if: {{{minorityleader11|}}} | {{{minorityleader11}}} | {{{minority_leader11|}}} }}
| monarch = {{{monarch11|}}}
| nominator = {{{nominator11|}}}
| office = {{{office11|}}}
| order = {{{order11|}}}
| parliament = {{{parliament11|}}}
| parliamentarygroup = {{{parliamentarygroup11|}}}
| predecessor = {{{predecessor11|}}}
| preceding = {{{preceding11|}}}
| preceded = {{{preceded11|}}}
| premier = {{{premier11|}}}
| president = {{{president11|}}}
| primeminister = {{{primeminister11|}}}
| riding = {{{riding11|}}}
| state_assembly = {{{state_assembly11|}}}
| state_delegate = {{{state_delegate11|}}}
| state_house = {{{state_house11|}}}
| state_legislature = {{{state_legislature11|}}}
| state_senate = {{{state_senate11|}}}
| state = {{{state11|}}}
| status = {{{status11|}}}
| subterm = {{nobold|{{{subterm11|}}}}}
| suboffice = {{{suboffice11|}}}
| succeeded = {{{succeeded11|}}}
| succeeding = {{{succeeding11|}}}
| successor = {{{successor11|}}}
| taoiseach = {{{taoiseach11|}}}
| termlabel = {{{term_label11|{{{termlabel11|In office}}}}}}
| termend = {{#if:{{{termend11|}}}|{{{termend11}}}|{{{term_end11|}}}}}
| termstart = {{#if:{{{termstart11|}}}|{{{termstart11}}}|{{{term_start11|}}}}}
| term = {{{term11|}}}
| title = {{{title11|}}}
| vicegovernor = {{{vicegovernor11|}}}
| vicepresident = {{{vicepresident11|}}}
| vicepremier = {{{vicepremier11|}}}
| viceprimeminister = {{{viceprimeminister11|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term11|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname12|}}}
| 1namedata = {{{1namedata12|}}}
| 2blankname = {{{2blankname12|}}}
| 2namedata = {{{2namedata12|}}}
| 3blankname = {{{3blankname12|}}}
| 3namedata = {{{3namedata12|}}}
| 4blankname = {{{4blankname12|}}}
| 4namedata = {{{4namedata12|}}}
| 5blankname = {{{5blankname12|}}}
| 5namedata = {{{5namedata12|}}}
| alongside = {{{alongside12|}}}
| ambassador_from = {{{ambassador_from12|}}}
| appointer = {{#if: {{{appointer12|}}} | {{{appointer12}}} | {{{appointed12|}}} }}
| assembly = {{{assembly12|}}}
| assuming = {{{assuming12|}}}
| chancellor = {{{chancellor12|}}}
| co-leader = {{{co-leader12|}}}
| constituency_{{#if:{{{constituency_AM12|}}}|AM|MP}} = {{#if: {{{constituency_AM12|}}} | {{{constituency_AM12}}} | {{{constituency_MP12|}}} }}
| constituency = {{{constituency12|}}}
| convocation = {{{convocation12|}}}
| country = {{{country12|}}}
| deputy = {{{deputy12|}}}
| district = {{{district12|}}}
| firstminister = {{{firstminister12|}}}
| governor-general = {{{governor-general12|}}}
| governor_general = {{{governor_general12|}}}
| governor = {{{governor12|}}}
| jr/sr = {{{jr/sr12|}}}
| jr/sr and state = {{{jr/sr and state12|}}}
| leader = {{{leader12|}}}
| legislature = {{{legislature12|}}}
| lieutenant_governor = {{{lieutenant_governor12|}}}
| lieutenant = {{{lieutenant12|}}}
| minister_from = {{{minister_from12|}}}
| minority_floor_leader = {{{minority_floor_leader12|}}}
| majority_floor_leader = {{{majority_floor_leader12|}}}
| majority_leader = {{#if: {{{majorityleader12|}}} | {{{majorityleader12}}} | {{{majority_leader12|}}} }}
| majority = {{{majority12|}}}
| minister = {{{minister12|}}}
| minority_leader = {{#if: {{{minorityleader12|}}} | {{{minorityleader12}}} | {{{minority_leader12|}}} }}
| monarch = {{{monarch12|}}}
| nominator = {{{nominator12|}}}
| office = {{{office12|}}}
| order = {{{order12|}}}
| parliament = {{{parliament12|}}}
| parliamentarygroup = {{{parliamentarygroup12|}}}
| predecessor = {{{predecessor12|}}}
| preceding = {{{preceding12|}}}
| preceded = {{{preceded12|}}}
| premier = {{{premier12|}}}
| president = {{{president12|}}}
| primeminister = {{{primeminister12|}}}
| riding = {{{riding12|}}}
| state_assembly = {{{state_assembly12|}}}
| state_delegate = {{{state_delegate12|}}}
| state_house = {{{state_house12|}}}
| state_legislature = {{{state_legislature12|}}}
| state_senate = {{{state_senate12|}}}
| state = {{{state12|}}}
| status = {{{status12|}}}
| subterm = {{nobold|{{{subterm12|}}}}}
| suboffice = {{{suboffice12|}}}
| succeeded = {{{succeeded12|}}}
| succeeding = {{{succeeding12|}}}
| successor = {{{successor12|}}}
| taoiseach = {{{taoiseach12|}}}
| termlabel = {{{term_label12|{{{termlabel12|In office}}}}}}
| termend = {{#if:{{{termend12|}}}|{{{termend12}}}|{{{term_end12|}}}}}
| termstart = {{#if:{{{termstart12|}}}|{{{termstart12}}}|{{{term_start12|}}}}}
| term = {{{term12|}}}
| title = {{{title12|}}}
| vicegovernor = {{{vicegovernor12|}}}
| vicepresident = {{{vicepresident12|}}}
| vicepremier = {{{vicepremier12|}}}
| viceprimeminister = {{{viceprimeminister12|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term12|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname13|}}}
| 1namedata = {{{1namedata13|}}}
| 2blankname = {{{2blankname13|}}}
| 2namedata = {{{2namedata13|}}}
| 3blankname = {{{3blankname13|}}}
| 3namedata = {{{3namedata13|}}}
| 4blankname = {{{4blankname13|}}}
| 4namedata = {{{4namedata13|}}}
| 5blankname = {{{5blankname13|}}}
| 5namedata = {{{5namedata13|}}}
| alongside = {{{alongside13|}}}
| ambassador_from = {{{ambassador_from13|}}}
| appointer = {{#if: {{{appointer13|}}} | {{{appointer13}}} | {{{appointed13|}}} }}
| assembly = {{{assembly13|}}}
| assuming = {{{assuming13|}}}
| chancellor = {{{chancellor13|}}}
| co-leader = {{{co-leader13|}}}
| constituency_{{#if:{{{constituency_AM13|}}}|AM|MP}} = {{#if: {{{constituency_AM13|}}} | {{{constituency_AM13}}} | {{{constituency_MP13|}}} }}
| constituency = {{{constituency13|}}}
| convocation = {{{convocation13|}}}
| country = {{{country13|}}}
| deputy = {{{deputy13|}}}
| district = {{{district13|}}}
| firstminister = {{{firstminister13|}}}
| governor-general = {{{governor-general13|}}}
| governor_general = {{{governor_general13|}}}
| governor = {{{governor13|}}}
| jr/sr = {{{jr/sr13|}}}
| jr/sr and state = {{{jr/sr and state13|}}}
| leader = {{{leader13|}}}
| legislature = {{{legislature13|}}}
| lieutenant_governor = {{{lieutenant_governor13|}}}
| lieutenant = {{{lieutenant13|}}}
| minister_from = {{{minister_from13|}}}
| minority_floor_leader = {{{minority_floor_leader13|}}}
| majority_floor_leader = {{{majority_floor_leader13|}}}
| majority_leader = {{#if: {{{majorityleader13|}}} | {{{majorityleader13}}} | {{{majority_leader13|}}} }}
| majority = {{{majority13|}}}
| minister = {{{minister13|}}}
| minority_leader = {{#if: {{{minorityleader13|}}} | {{{minorityleader13}}} | {{{minority_leader13|}}} }}
| monarch = {{{monarch13|}}}
| nominator = {{{nominator13|}}}
| office = {{{office13|}}}
| order = {{{order13|}}}
| parliament = {{{parliament13|}}}
| parliamentarygroup = {{{parliamentarygroup13|}}}
| predecessor = {{{predecessor13|}}}
| preceding = {{{preceding13|}}}
| preceded = {{{preceded13|}}}
| premier = {{{premier13|}}}
| president = {{{president13|}}}
| primeminister = {{{primeminister13|}}}
| riding = {{{riding13|}}}
| state_assembly = {{{state_assembly13|}}}
| state_delegate = {{{state_delegate13|}}}
| state_house = {{{state_house13|}}}
| state_legislature = {{{state_legislature13|}}}
| state_senate = {{{state_senate13|}}}
| state = {{{state13|}}}
| status = {{{status13|}}}
| subterm = {{nobold|{{{subterm13|}}}}}
| suboffice = {{{suboffice13|}}}
| succeeded = {{{succeeded13|}}}
| succeeding = {{{succeeding13|}}}
| successor = {{{successor13|}}}
| taoiseach = {{{taoiseach13|}}}
| termlabel = {{{term_label13|{{{termlabel13|In office}}}}}}
| termend = {{#if:{{{termend13|}}}|{{{termend13}}}|{{{term_end13|}}}}}
| termstart = {{#if:{{{termstart13|}}}|{{{termstart13}}}|{{{term_start13|}}}}}
| term = {{{term13|}}}
| title = {{{title13|}}}
| vicegovernor = {{{vicegovernor13|}}}
| vicepresident = {{{vicepresident13|}}}
| vicepremier = {{{vicepremier13|}}}
| viceprimeminister = {{{viceprimeminister13|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term13|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname14|}}}
| 1namedata = {{{1namedata14|}}}
| 2blankname = {{{2blankname14|}}}
| 2namedata = {{{2namedata14|}}}
| 3blankname = {{{3blankname14|}}}
| 3namedata = {{{3namedata14|}}}
| 4blankname = {{{4blankname14|}}}
| 4namedata = {{{4namedata14|}}}
| 5blankname = {{{5blankname14|}}}
| 5namedata = {{{5namedata14|}}}
| alongside = {{{alongside14|}}}
| ambassador_from = {{{ambassador_from14|}}}
| appointer = {{#if: {{{appointer14|}}} | {{{appointer14}}} | {{{appointed14|}}} }}
| assembly = {{{assembly14|}}}
| assuming = {{{assuming14|}}}
| chancellor = {{{chancellor14|}}}
| co-leader = {{{co-leader14|}}}
| constituency_{{#if:{{{constituency_AM14|}}}|AM|MP}} = {{#if: {{{constituency_AM14|}}} | {{{constituency_AM14}}} | {{{constituency_MP14|}}} }}
| constituency = {{{constituency14|}}}
| convocation = {{{convocation14|}}}
| country = {{{country14|}}}
| deputy = {{{deputy14|}}}
| district = {{{district14|}}}
| firstminister = {{{firstminister14|}}}
| governor-general = {{{governor-general14|}}}
| governor_general = {{{governor_general14|}}}
| governor = {{{governor14|}}}
| jr/sr = {{{jr/sr14|}}}
| jr/sr and state = {{{jr/sr and state14|}}}
| leader = {{{leader14|}}}
| legislature = {{{legislature14|}}}
| lieutenant_governor = {{{lieutenant_governor14|}}}
| lieutenant = {{{lieutenant14|}}}
| minister_from = {{{minister_from14|}}}
| minority_floor_leader = {{{minority_floor_leader14|}}}
| majority_floor_leader = {{{majority_floor_leader14|}}}
| majority_leader = {{#if: {{{majorityleader14|}}} | {{{majorityleader14}}} | {{{majority_leader14|}}} }}
| majority = {{{majority14|}}}
| minister = {{{minister14|}}}
| minority_leader = {{#if: {{{minorityleader14|}}} | {{{minorityleader14}}} | {{{minority_leader14|}}} }}
| monarch = {{{monarch14|}}}
| nominator = {{{nominator14|}}}
| office = {{{office14|}}}
| order = {{{order14|}}}
| parliament = {{{parliament14|}}}
| parliamentarygroup = {{{parliamentarygroup14|}}}
| predecessor = {{{predecessor14|}}}
| preceding = {{{preceding14|}}}
| preceded = {{{preceded14|}}}
| premier = {{{premier14|}}}
| president = {{{president14|}}}
| primeminister = {{{primeminister14|}}}
| riding = {{{riding14|}}}
| state_assembly = {{{state_assembly14|}}}
| state_delegate = {{{state_delegate14|}}}
| state_house = {{{state_house14|}}}
| state_legislature = {{{state_legislature14|}}}
| state_senate = {{{state_senate14|}}}
| state = {{{state14|}}}
| status = {{{status14|}}}
| subterm = {{nobold|{{{subterm14|}}}}}
| suboffice = {{{suboffice14|}}}
| succeeded = {{{succeeded14|}}}
| succeeding = {{{succeeding14|}}}
| successor = {{{successor14|}}}
| taoiseach = {{{taoiseach14|}}}
| termlabel = {{{term_label14|{{{termlabel14|In office}}}}}}
| termend = {{#if:{{{termend14|}}}|{{{termend14}}}|{{{term_end14|}}}}}
| termstart = {{#if:{{{termstart14|}}}|{{{termstart14}}}|{{{term_start14|}}}}}
| term = {{{term14|}}}
| title = {{{title14|}}}
| vicegovernor = {{{vicegovernor14|}}}
| vicepresident = {{{vicepresident14|}}}
| vicepremier = {{{vicepremier14|}}}
| viceprimeminister = {{{viceprimeminister14|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term14|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname15|}}}
| 1namedata = {{{1namedata15|}}}
| 2blankname = {{{2blankname15|}}}
| 2namedata = {{{2namedata15|}}}
| 3blankname = {{{3blankname15|}}}
| 3namedata = {{{3namedata15|}}}
| 4blankname = {{{4blankname15|}}}
| 4namedata = {{{4namedata15|}}}
| 5blankname = {{{5blankname15|}}}
| 5namedata = {{{5namedata15|}}}
| alongside = {{{alongside15|}}}
| ambassador_from = {{{ambassador_from15|}}}
| appointer = {{#if: {{{appointer15|}}} | {{{appointer15}}} | {{{appointed15|}}} }}
| assembly = {{{assembly15|}}}
| assuming = {{{assuming15|}}}
| chancellor = {{{chancellor15|}}}
| co-leader = {{{co-leader15|}}}
| constituency_{{#if:{{{constituency_AM15|}}}|AM|MP}} = {{#if: {{{constituency_AM15|}}} | {{{constituency_AM15}}} | {{{constituency_MP15|}}} }}
| constituency = {{{constituency15|}}}
| convocation = {{{convocation15|}}}
| country = {{{country15|}}}
| deputy = {{{deputy15|}}}
| district = {{{district15|}}}
| firstminister = {{{firstminister15|}}}
| governor-general = {{{governor-general15|}}}
| governor_general = {{{governor_general15|}}}
| governor = {{{governor15|}}}
| jr/sr = {{{jr/sr15|}}}
| jr/sr and state = {{{jr/sr and state15|}}}
| leader = {{{leader15|}}}
| legislature = {{{legislature15|}}}
| lieutenant_governor = {{{lieutenant_governor15|}}}
| lieutenant = {{{lieutenant15|}}}
| minister_from = {{{minister_from15|}}}
| minority_floor_leader = {{{minority_floor_leader15|}}}
| majority_floor_leader = {{{majority_floor_leader15|}}}
| majority_leader = {{#if: {{{majorityleader15|}}} | {{{majorityleader15}}} | {{{majority_leader15|}}} }}
| majority = {{{majority15|}}}
| minister = {{{minister15|}}}
| minority_leader = {{#if: {{{minorityleader15|}}} | {{{minorityleader15}}} | {{{minority_leader15|}}} }}
| monarch = {{{monarch15|}}}
| nominator = {{{nominator15|}}}
| office = {{{office15|}}}
| order = {{{order15|}}}
| parliament = {{{parliament15|}}}
| parliamentarygroup = {{{parliamentarygroup15|}}}
| predecessor = {{{predecessor15|}}}
| preceding = {{{preceding15|}}}
| preceded = {{{preceded15|}}}
| premier = {{{premier15|}}}
| president = {{{president15|}}}
| primeminister = {{{primeminister15|}}}
| riding = {{{riding15|}}}
| state_assembly = {{{state_assembly15|}}}
| state_delegate = {{{state_delegate15|}}}
| state_house = {{{state_house15|}}}
| state_legislature = {{{state_legislature15|}}}
| state_senate = {{{state_senate15|}}}
| state = {{{state15|}}}
| status = {{{status15|}}}
| subterm = {{nobold|{{{subterm15|}}}}}
| suboffice = {{{suboffice15|}}}
| succeeded = {{{succeeded15|}}}
| succeeding = {{{succeeding15|}}}
| successor = {{{successor15|}}}
| taoiseach = {{{taoiseach15|}}}
| termlabel = {{{term_label15|{{{termlabel15|In office}}}}}}
| termend = {{#if:{{{termend15|}}}|{{{termend15}}}|{{{term_end15|}}}}}
| termstart = {{#if:{{{termstart15|}}}|{{{termstart15}}}|{{{term_start15|}}}}}
| term = {{{term15|}}}
| title = {{{title15|}}}
| vicegovernor = {{{vicegovernor15|}}}
| vicepresident = {{{vicepresident15|}}}
| vicepremier = {{{vicepremier15|}}}
| viceprimeminister = {{{viceprimeminister15|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term15|}}}
}}}}<!--
-->{{#if:{{{nominee|}}}{{{candidate|}}}||
{{Infobox officeholder/office |color={{#ifeq:{{lc:{{{embed}}}}}|yes|#eee|lavender}}
| 1blankname = {{{1blankname16|}}}
| 1namedata = {{{1namedata16|}}}
| 2blankname = {{{2blankname16|}}}
| 2namedata = {{{2namedata16|}}}
| 3blankname = {{{3blankname16|}}}
| 3namedata = {{{3namedata16|}}}
| 4blankname = {{{4blankname16|}}}
| 4namedata = {{{4namedata16|}}}
| 5blankname = {{{5blankname16|}}}
| 5namedata = {{{5namedata16|}}}
| alongside = {{{alongside16|}}}
| ambassador_from = {{{ambassador_from16|}}}
| appointer = {{#if: {{{appointer16|}}} | {{{appointer16}}} | {{{appointed16|}}} }}
| assembly = {{{assembly16|}}}
| assuming = {{{assuming16|}}}
| chancellor = {{{chancellor16|}}}
| co-leader = {{{co-leader16|}}}
| constituency_{{#if:{{{constituency_AM16|}}}|AM|MP}} = {{#if: {{{constituency_AM16|}}} | {{{constituency_AM16}}} | {{{constituency_MP16|}}} }}
| constituency = {{{constituency16|}}}
| convocation = {{{convocation16|}}}
| country = {{{country16|}}}
| deputy = {{{deputy16|}}}
| district = {{{district16|}}}
| firstminister = {{{firstminister16|}}}
| governor-general = {{{governor-general16|}}}
| governor_general = {{{governor_general16|}}}
| governor = {{{governor16|}}}
| jr/sr = {{{jr/sr16|}}}
| jr/sr and state = {{{jr/sr and state16|}}}
| leader = {{{leader16|}}}
| legislature = {{{legislature16|}}}
| lieutenant_governor = {{{lieutenant_governor16|}}}
| lieutenant = {{{lieutenant16|}}}
| minister_from = {{{minister_from16|}}}
| minority_floor_leader = {{{minority_floor_leader16|}}}
| majority_floor_leader = {{{majority_floor_leader16|}}}
| majority_leader = {{#if: {{{majorityleader16|}}} | {{{majorityleader16}}} | {{{majority_leader16|}}} }}
| majority = {{{majority16|}}}
| minister = {{{minister16|}}}
| minority_leader = {{#if: {{{minorityleader16|}}} | {{{minorityleader16}}} | {{{minority_leader16|}}} }}
| monarch = {{{monarch16|}}}
| nominator = {{{nominator16|}}}
| office = {{{office16|}}}
| order = {{{order16|}}}
| parliament = {{{parliament16|}}}
| parliamentarygroup = {{{parliamentarygroup16|}}}
| predecessor = {{{predecessor16|}}}
| preceding = {{{preceding16|}}}
| preceded = {{{preceded16|}}}
| premier = {{{premier16|}}}
| president = {{{president16|}}}
| primeminister = {{{primeminister16|}}}
| riding = {{{riding16|}}}
| state_assembly = {{{state_assembly16|}}}
| state_delegate = {{{state_delegate16|}}}
| state_house = {{{state_house16|}}}
| state_legislature = {{{state_legislature16|}}}
| state_senate = {{{state_senate16|}}}
| state = {{{state16|}}}
| status = {{{status16|}}}
| subterm = {{nobold|{{{subterm16|}}}}}
| suboffice = {{{suboffice16|}}}
| succeeded = {{{succeeded16|}}}
| succeeding = {{{succeeding16|}}}
| successor = {{{successor16|}}}
| taoiseach = {{{taoiseach16|}}}
| termlabel = {{{term_label16|{{{termlabel16|In office}}}}}}
| termend = {{#if:{{{termend16|}}}|{{{termend16}}}|{{{term_end16|}}}}}
| termstart = {{#if:{{{termstart16|}}}|{{{termstart16}}}|{{{term_start16|}}}}}
| term = {{{term16|}}}
| title = {{{title16|}}}
| vicegovernor = {{{vicegovernor16|}}}
| vicepresident = {{{vicepresident16|}}}
| vicepremier = {{{vicepremier16|}}}
| viceprimeminister = {{{viceprimeminister16|}}}
| party = {{{party|}}}
| prior_term = {{{prior_term16|}}}
}}}}
| data2 = {{{module0|}}}
<!----------Personal data---------->
| header3 = {{#if:{{{pronunciation|}}}{{{birth_name|{{{birthname|}}}}}}{{{birth_date|}}}{{{birth_place|}}}{{{death_date|}}}{{{death_place|}}}{{{resting_place|{{{restingplace|}}}}}}{{{resting_place_coordinates|{{{restingplacecoordinates|}}}}}}{{{citizenship|}}}{{{nationality|}}}{{{party|}}}{{{otherparty|}}}{{{spouse|}}}{{{partner|}}}{{{relations|}}}{{{children|}}}{{{parents|}}}{{{mother|}}}{{{father|}}}{{{relatives|}}}{{{residence|}}}{{{education|}}}{{{alma_mater|}}}{{{occupation|}}}{{{profession|}}}{{{known_for|}}}{{{salary|}}}{{{cabinet|}}}{{{committees|}}}{{{portfolio|}}}{{{awards|}}}{{{data1|}}}{{{data2|}}}{{{data3|}}}{{{data4|}}}{{{data5|}}}|Personal details}}
| label4 = Pronunciation
| data4 = {{{pronunciation|}}}
| label5 = Born
| data5 = {{br separated entries
|1 = {{#if:{{{birth_name|{{{birthname|}}}}}}|<div style="display:inline" class="nickname">{{{birth_name|{{{birthname}}}}}}</div>}}
|2 = {{{birth_date|}}}
|3 = {{{birth_place|}}}
}}
| label6 = Died
| data6 = {{br separated entries|{{{death_date|}}}|{{{death_place|}}}}}
| label7 = Cause of death
| data7 = {{{death_cause|}}}
| label8 = Resting place
| class8 = label
| data8 = {{br separated entries|{{{resting_place|{{{restingplace|}}}}}}|{{{resting_place_coordinates|{{{restingplacecoordinates|}}}}}}}}
| label9 = Citizenship
| data9 = {{{citizenship|}}}
| label10 = Nationality
| data10 = {{{nationality|}}}
| label11 = Political party
| data11 = {{#switch:{{{party|}}}
| =
| [[United States Democratic Party|Democrat]]
| [[Democratic Party (United States)|Democratic]]
| [[Democratic Party (United States)|Democrat]] = [[Democratic Party (United States)|Democratic]]
| [[Republican Party (United States)|Republican]]
| [[United States Republican Party]]
| [[United States Republican Party|Republican]]
| [[Republican Party (United States)|Republican Party]] = [[Republican Party (United States)|Republican]]
| [[Conservative Party (UK)|Conservative Party]]
| [[Conservative Party (UK)|Conservative]] = [[Conservative Party (UK)|Conservative]]
| [[Labour Party (UK)|Labour Party]]
| [[Labour Party (UK)|Labour]] = [[Labour Party (UK)|Labour]]
| [[Conservative Party of Canada|Conservative Party]]
| [[Conservative Party of Canada|Conservative]] = [[Conservative Party of Canada|Conservative]]
| [[Liberal Party of Canada|Liberal Party]]
| [[Liberal Party of Canada|Liberal]] = [[Liberal Party of Canada|Liberal]]
| KMT
| Kuomintang
| [[KMT]]
| [[Kuomintang|KMT]]
| [[Kuomintang]]
| Kuomintang (KMT)
| [[Kuomintang]] (KMT)
| {{KMT}} (KMT)
| {{KMT}} = [[Kuomintang]]
| DPP
| [[Democratic Progressive Party|DPP]]
| [[Democratic Progressive Party]]
| {{DPP}} = [[Democratic Progressive Party]]
| #default = {{{party|}}} }}
| label12 = Other political<br />affiliations
| data12 = {{{otherparty|}}}
| label13 = Height
| data13 = {{#if:{{{height|}}}|{{infobox person/height|{{{height|}}}}}}}
| label14 = Spouse(s)
| data14 = {{{spouse|}}}
| label15 = Domestic partner
| data15 = {{{partner|}}}
| label16 = Relations
| data16 = {{{relations|}}}
| label17 = Children
| data17 = {{{children|}}}
| label18 = Parent{{#if:{{{parents|}}}|(s)|{{#if:{{{father|}}}|{{#if:{{{mother|}}}|s|(s)}}|(s)}}}}
| data18 = {{#if:{{{parents|}}}|{{{parents}}}|{{Unbulleted list|{{#if:{{{father|}}}|{{{father}}} (father)}}|{{#if:{{{mother|}}}|{{{mother}}} (mother)}}}}}}
| label19 = Relatives
| data19 = {{{relatives|}}}
| label20 = Residence(s)
| class20 = {{#if:{{{death_date|}}}{{{death_place|}}}||label}}
| data20 = {{{residence|}}}
| label21 = Education
| data21 = {{{education|}}}
| label22 = [[Alma mater]]
| data22 = {{{alma_mater|}}}
| label23 = Occupation
| data23 = {{{occupation|}}}
| label24 = Profession
| data24 = {{{profession|}}}
| label25 = Known for
| data25 = {{{known_for|}}}
| label26 = Salary
| data26 = {{{salary|}}}
| label27 = Cabinet
| data27 = {{{cabinet|}}}
| label28 = Committees
| data28 = {{{committees|}}}
| label29 = Portfolio
| data29 = {{{portfolio|}}}
| label30 = {{#if:{{{mawards|}}}|Civilian awards|Awards}}
| data30 = {{{awards|}}}
| label31 = {{{blank1}}}
| data31 = {{{data1|}}}
| label32 = {{{blank2}}}
| data32 = {{{data2|}}}
| label33 = {{{blank3}}}
| data33 = {{{data3|}}}
| label34 = {{{blank4}}}
| data34 = {{{data4|}}}
| label35 = {{{blank5}}}
| data35 = {{{data5|}}}
| label36 = Signature
| data36 = {{#if:{{{signature|}}}|[[File:{{{signature}}}|{{#if:{{{signature_size|}}}|{{{signature_size}}}|128x80px}}|alt={{{signature_alt|}}}|{{PAGENAME}}'s signature]]}}
| label37 = Website
| data37 = {{{website|}}}
| label38 = Nickname(s)
| data38 = {{{nickname|}}}
| header39 = {{#if:{{{allegiance|}}}{{{branch|}}}{{{serviceyears|}}}{{{rank|}}}{{{unit|}}}{{{commands|}}}{{{battles|}}}{{{military_blank1|}}}|Military service}}
| label40 = Allegiance
| data40 = {{{allegiance|}}}
| label41 = {{#if:{{{branch_label|}}}|{{{branch_label|}}}|Branch/service}}
| data41 = {{{branch|}}}
| label42 = {{#if:{{{serviceyears_label|}}}|{{{serviceyears_label|}}}|Years of service}}
| data42 = {{{serviceyears|}}}
| label43 = {{#if:{{{rank_label|}}}|{{{rank_label|}}}|Rank}}
| data43 = {{{rank|}}}
| label44 = {{#if:{{{unit_label|}}}|{{{unit_label|}}}|Unit}}
| data44 = {{{unit|}}}
| label45 = Commands
| data45 = {{{commands|}}}
| label46 = {{#if:{{{battles_label|}}}|{{{battles_label|}}}|Battles/wars}}
| data46 = {{{battles|}}}
| label47 = {{#if:{{{awards|}}}|Military awards|Awards}}
| data47 = {{{mawards|}}}
| label48 = {{{military_blank1}}}
| data48 = {{{military_data1|}}}
| label49 = {{{military_blank2}}}
| data49 = {{{military_data2|}}}
| label50 = {{{military_blank3}}}
| data50 = {{{military_data3|}}}
| label51 = {{{military_blank4}}}
| data51 = {{{military_data4|}}}
| label52 = {{{military_blank5}}}
| data52 = {{{military_data5|}}}
| data53 = {{{module|}}}
| data54 = {{{module2|}}}
| data55 = {{{module3|}}}
| data56 = {{{module4|}}}
| data57 = {{{module5|}}}
| data58 = {{{footnotes|}}}
| belowstyle = border-top: 1px solid right; font-size: 95%
| below = <div>{{#if:{{{date|}}}| As of {{{date}}}{{#if:{{{year|}}}|, {{{year}}}}}}}</div>{{#if:{{{source|}}}|Source: [{{{source}}}]}}
}}{{#if:{{{pronunciation|}}}|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Biography template using pronunciation]]}}
}}{{#if:{{{1blankname0|}}}{{{1namedata0|}}}{{{2blankname0|}}}{{{2namedata0|}}}{{{3blankname0|}}}{{{3namedata0|}}}{{{4blankname0|}}}{{{4namedata0|}}}{{{5blankname0|}}}{{{5namedata0|}}}{{{alongside0|}}}{{{ambassador_from0|}}}{{{appointer0|}}}{{{assembly0|}}}{{{assuming0|}}}{{{chancellor0|}}}{{{co-leader0|}}}{{{constituency_AM0|}}}{{{constituency0|}}}{{{country0|}}}{{{deputy0|}}}{{{district0|}}}{{{firstminister0|}}}{{{governor-general0|}}}{{{governor0|}}}{{{jr/sr0|}}}{{{jr/sr and state0|}}}{{{leader0|}}}{{{legislature0|}}}{{{lieutenant_governor0|}}}{{{lieutenant0|}}}{{{minister_from0|}}}{{{minority_floor_leader0|}}}{{{majority_floor_leader0|}}}{{{majorityleader0|}}}{{{majority0|}}}{{{minister0|}}}{{{minorityleader0|}}}{{{monarch0|}}}{{{nominator0|}}}{{{office0|}}}{{{order0|}}}{{{parliament0|}}}{{{predecessor0|}}}{{{preceding0|}}}{{{preceded0|}}}{{{premier0|}}}{{{president0|}}}{{{primeminister0|}}}{{{riding0|}}}{{{state_assembly0|}}}{{{state_delegate0|}}}{{{state_house0|}}}{{{state_legislature0|}}}{{{state_senate0|}}}{{{state0|}}}{{{suboffice0|}}}{{{subterm0|}}}{{{succeeded0|}}}{{{succeeding0|}}}{{{successor0|}}}{{{taoiseach0|}}}{{{termend0|}}}{{{termstart0|}}}{{{term0|}}}{{{title0|}}}{{{vicegovernor0|}}}{{{vicepresident0|}}}{{{vicepremier0|}}}{{{viceprimeminister0|}}}{{{prior_term0|}}}{{{appointe0|}}}{{{constituency_0|}}}|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with office0]]}}
}}{{#if:{{{speaker|}}}|{{#if:{{{nominee|}}}{{{candidate|}}}||{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with speaker]]}}}}
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|{{#ifeq:{{{nocat|{{{demo|{{#ifeq:{{{categories|}}}|no|yes}}}}}}}}|yes||[[Category:Pages using infobox officeholder with unknown parameters|_VALUE_{{PAGENAME}}]]}}}}|preview=Page using [[Template:Infobox officeholder]] with unknown parameter "_VALUE_"|ignoreblank=y| regexp1 = 1blankname[%d]* | regexp2 = 1namedata[%d]* | regexp3 = 2blankname[%d]* | regexp4 = 2namedata[%d]* | regexp5 = 3blankname[%d]* | regexp6 = 3namedata[%d]* | regexp7 = 4blankname[%d]* | regexp8 = 4namedata[%d]* | regexp9 = 5blankname[%d]* | regexp10 = 5namedata[%d]* | allegiance | alma_mater | regexp11 = alongside[%d]* | alt | regexp12 = ambassador_from[%d]* | regexp13 = appointed[%d]* | regexp14 = appointer[%d]* | regexp15 = assembly[%d]* | awards | battles | battles_label | birth_date | birth_name | birth_place | birthname | regexp16 = blank[%d]* | bodyclass | branch | branch_label | cabinet | candidate | caption | categories | regexp17 = chancellor[%d]* | children | citizenship | regexp18 = co%-leader[%d]* | commands | committees | regexp19 = constituency[%d]* | regexp20 = constituency_AM[%d]* | regexp21 = constituency_MP[%d]* | regexp22 = convocation[%d]* | regexp23 = country[%d]* | regexp24 = data[%d]* | date | death_cause | death_date | death_place | demo | regexp25 = deputy[%d]* | regexp26 = district[%d]* | education | election_date | embed | father | regexp28 = firstminister[%d]* | footnotes | regexp29 = governor[%d]* | regexp30 = governor_general[%d]* | regexp31 = governor%-general[%d]* | height | honorific_prefix | honorific-prefix | honorific_suffix | honorific-suffix | image | image name | image_name_alt | image_size | imagesize | image_upright | incumbent | regexp32 = jr/sr[%d]* | regexp33 = jr/sr and state[%d]* | known_for | regexp34 = leader[%d]* | regexp35 = legislature[%d]* | regexp36 = lieutenant[%d]* | regexp37 = lieutenant_governor[%d]* | mainwidth | regexp38 = majority[%d]* | regexp39 = majority_floor_leader[%d]* | regexp40 = majority_leader[%d]* | regexp41 = majorityleader[%d]* | mawards | regexp42 = military_blank[%d]* | regexp43 = military_data[%d]* | regexp44 = minister[%d]* | regexp45 = minister_from[%d]* | regexp46 = minority_floor_leader[%d]* | regexp47 = minority_leader[%d]* | regexp48 = minorityleader[%d]* | regexp49 = module[%d]* | regexp50 = monarch[%d]* | mother | name | nationality | native_name | native_name_lang | nickname | nocat | regexp51 = nominator[%d]* | nominee | occupation | regexp52 = office[%d]* | opponent | regexp53 = order[%d]* | otherparty | parents | regexp54 = parliament[%d]* | regexp55 = parliamentarygroup[%d]* | partner | party | party_election | portfolio | regexp56 = preceded[%d]* | regexp57 = preceding[%d]* | regexp58 = predecessor[%d]* | regexp59 = premier[%d]* | regexp60 = president[%d]* | regexp61 = primeminister[%d]* | regexp62 = prior_term[%d]* | profession | pronunciation | rank | rank_label | relations | relatives | residence | resting_place | resting_place_coordinates | restingplace | restingplacecoordinates | regexp63 = riding[%d]* | runningmate | salary | serviceyears | serviceyears_label | signature | signature_alt | signature_size | smallimage | smallimage_alt | source | speaker | speaker_office | spouse | regexp64 = state[%d]* | regexp65 = state_assembly[%d]* | regexp66 = state_delegate[%d]* | regexp67 = state_house[%d]* | regexp68 = state_legislature[%d]* | regexp69 = state_senate[%d]* | regexp70 = status[%d]* | regexp71 = suboffice[%d]* | regexp72 = subterm[%d]* | regexp73 = succeeded[%d]* | regexp74 = succeeding[%d]* | regexp75 = successor[%d]* | regexp76 = taoiseach[%d]* | regexp77 = term[%d]* | regexp78 = term_end[%d]* | regexp79 = term_label[%d]* | regexp80 = term_start[%d]* | regexp81 = termend[%d]* | regexp82 = termlabel[%d]* | regexp83 = termstart[%d]* | regexp84 = title[%d]* | unit | unit_label | regexp85 = vicegovernor[%d]* | regexp86 = vicepremier[%d]* | regexp87 = vicepresident[%d]* | regexp88 = viceprimeminister[%d]* | regexp89 = assuming[%d]* | website | width | year }}<noinclude>
{{Documentation}}
</noinclude>
8jpjxc0h6fyab3nw25xvotjifxsqg7x
Template:Infobox officeholder/office
10
32357517
1093907121
1065980635
2022-06-19T15:35:23Z
Number 57
327289
From sandbox
wikitext
text/x-wiki
{{#if:{{{speaker|}}}{{{state_legislature|}}}{{{state_assembly|}}}{{{speaker_office|}}}{{{state_delegate|}}}{{{state_house|}}}{{{prior_term|}}}{{{nominee|}}}{{{candidate|}}}{{{termstart|}}}{{{election_date|}}}{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}{{{jr/sr|}}}{{{succeeding|}}}{{{assuming|}}}{{{state|}}}{{{jr/sr and state|}}}{{{state_senate|}}}{{{district|}}}{{{ambassador_from|}}}{{{minister_from|}}}{{{order|}}}{{{office|}}}{{{title|}}}{{{country|}}}{{{constituency_AM|}}}{{{constituency_MP|}}}{{{parliament|}}}{{{assembly|}}}{{{constituency_|}}}{{{riding|}}}{{{term|}}}{{{termend|}}}{{{alongside|}}}{{{co-leader|}}}
|{{#invoke:infobox|infoboxTemplate|child=yes|decat=yes
| headerstyle = background:{{{color|lavender}}};line-height:normal;padding:0.2em;
| datastyle = border-bottom:none
<!--------Speaker of the House--------->
| header1 = {{#if:{{{speaker|}}}|
{{{speaker}}} {{#if:{{{state_legislature|}}}
|[[Speaker of the {{{state_legislature}}} Legislature]]
|{{#if:{{{state_assembly|}}}
|[[Speaker of the {{{state_assembly|}}} {{#ifeq:{{{state_assembly|}}}|Nevada||{{#ifeq:{{{state_assembly|}}}|New Jersey|General|State}}}} Assembly]]
|{{#if:{{{speaker_office|}}}|{{{speaker_office}}}|[[Speaker of the {{#if:{{{state_delegate|}}} |{{{state_delegate}}}|{{#if:{{{state_house|}}} |{{{state_house}}}|United States}}}} House of {{#if:{{{state_delegate|}}}|Delegates|Representatives}}|Speaker of the {{#if:{{{state_delegate|}}} |{{{state_delegate}}}|{{#if:{{{state_house|}}} |{{{state_house}}}|U.S.}}}} House of {{#if:{{{state_delegate|}}}|Delegates|Representatives}}]]}}
}}
}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}}
<!--------Office--------->
| header2 = {{#if:{{{nominee|}}}{{{candidate|}}}|
{{#if:{{{party_election|}}}{{{party|}}}
|{{#if:{{{party_election|}}}|{{{party_election}}}|{{{party}}}}} {{#if:{{{nominee|}}}|nominee for<br>{{{nominee}}}|candidate for<br>{{{candidate}}}}}
|{{#if:{{{nominee|}}}|Nominee for<br>{{{nominee}}}|Candidate for<br>{{{candidate}}}}}
}} }}
| data3 = {{#if:{{{nominee|}}}{{{candidate|}}}|
{{#if:{{{termstart|}}}{{{election_date|}}} | <span class="nowrap">'''Election date'''</span><br />{{#if:{{{election_date|}}}|{{{election_date}}}|{{{termstart}}}}}
}} }}
| header4 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{jr/sr|}}}|[[United States Senate|<!--Changed code to eliminate "Junior/Senior" distinction for U.S. Senators per [[Template talk:Infobox Officeholder/Archive 9#Senior/Junior U.S. Senators]]{{{jr/sr}}}-->United States Senator{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}}]]<br />from {{{state}}}
}} }}
| header5 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{{jr/sr and state|}}}
}}
| header6 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{state_senate|}}}|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_senate}}} Senate]]</span><br />from the {{{district}}} district{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}} }}
| header7 = {{#if:{{{majority_leader|}}}{{{minority_floor_leader|}}}{{{minority_leader|}}}{{{majority_floor_leader|}}}||
{{#if:{{{state_legislature|}}}|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_legislature}}} Legislature]]</span><br />from the {{{district}}} district
}} }}
| header8 = {{#if:{{{ambassador_from|}}}{{{minister_from|}}}||
{{#if:{{{order|}}}
|{{{order}}}{{#if:{{{office|}}} | [[{{{office}}}]]}}{{#if:{{{state|}}} | [[{{{state}}}]]}}{{#if:{{{title|}}} | {{{title}}}}}
|{{{office|}}}
}} }}
| header9 = {{#if:{{{ambassador_from|}}}{{{minister_from|}}}||
{{#if:{{{order|}}}
||{{{title|}}}
}} }}
<!--------Ambassador--------->
| header10 = {{#if:{{both|{{{ambassador_from|}}}{{{minister_from|}}}|{{{country|}}}}}
|{{#if:{{{order|}}}|{{{order}}}}} {{#if:{{{minister_from|}}}
|[[{{{minister_from}}} Ambassador to {{CountryPrefixThe|{{{country}}}}}|{{{minister_from}}} Minister to {{CountryPrefixThe|{{{country}}}}}]]
|[[{{{ambassador_from}}} Ambassador to {{CountryPrefixThe|{{{country}}}}}]]
}} [[Category:Pages using infobox officeholder with ambassador from or minister from]]
}}
<!--------MP--------->
| header11 = {{#if:{{{constituency_AM|}}}{{{constituency_MP|}}}|
{{#switch:{{{parliament|}}}
|Australian = Member of the <span style="display: inline-block;">[[Australian House of Representatives|Australian Parliament]]</span>
|European = [[Member of the European Parliament|Member of the <span style="display: inline-block;">European Parliament</span>]]
|Sri Lanka|Sri Lankan = [[Member of Parliament (Sri Lanka)|Member of Parliament]]
|United Kingdom|UK = [[Member of Parliament (United Kingdom)|Member of Parliament]]
|#default = {{#if:{{{constituency_AM|}}}|{{#if:{{{assembly|}}}|Member of the <span style="display: inline-block;">[[{{{assembly}}} Assembly]]</span>|Assembly Member}}|Member of {{#if:{{{parliament|}}}|the <span style="display: inline-block;">[[{{{parliament}}} Parliament]]</span>|Parliament}}}}}}<br />for {{#ifeq:{{Title disambig text|{{{constituency_MP|}}}}}|UK Parliament constituency
|{{{constituency_MP|}}}
|{{#if:{{#switch:{{{parliament|}}} |United Kingdom|UK| = {{Linkless exists|{{delink|{{{constituency_MP|}}}}} (UK Parliament constituency)}} }}
|{{#if:{{Constlk|{{delink|{{{constituency_MP|}}}}}}}
|{{Constlk|{{delink|{{{constituency_MP|}}}}}}}
|{{{constituency_{{#if:{{{constituency_AM|}}}|AM|MP}}}}}}}
|{{{constituency_{{#if:{{{constituency_AM|}}}|AM|MP}}}}}}}}}
}}
| header12 = {{#if:{{{riding|}}}|{{#if:{{{constituency_AM|}}}|{{#if:{{{assembly|}}}|Member of the <span style="display: inline-block;">[[{{{assembly}}} Assembly]]</span>|Assembly Member}}|
{{#switch:{{{parliament|}}}
|Canadian = [[Member of Parliament (Canada)|Member of Parliament]]
|#default = Member of {{#if:{{{parliament|}}}|the <span style="display: inline-block;">[[{{{parliament}}} Parliament]]</span>|Parliament}}}}}}<br />for {{{riding}}}
}}
<!--------Majority Leader (State Senate)--------->
| header13 = {{#if:{{{majority_leader|}}}|{{{majority_leader}}} {{#if:{{{state_senate|}}}|[[Majority Leader of the {{{state_senate}}} Senate]]|[[United States Senate Majority Leader]]}}
}}
<!--------Majority Floor Leader (State Senate)--------->
| header14 = {{#if:{{{majority_floor_leader|}}}|{{{majority_floor_leader}}} [[Majority Floor Leader of the {{{state_senate}}} Senate]]
}}
<!--------Minority Leader (State Senate)--------->
| header15 = {{#if:{{{minority_leader|}}}|{{{minority_leader}}} [[Minority Leader of the {{{state_senate}}} Senate]]
}}
<!--------Minority Floor Leader (State Senate)--------->
| header16 = {{#if:{{{minority_floor_leader|}}}|{{{minority_floor_leader}}} [[Minority Floor Leader of the {{{state_senate}}} Senate]]
}}
<!--------Congressman--------->
| header17 = {{#if:{{{state_legislature|}}}{{{state_senate|}}}{{{jr/sr|}}}{{{jr/sr and state|}}}||
{{#if:{{#if:{{{state|}}}|{{{constituency|}}}}}{{{district|}}}|{{#if:{{{state_assembly|}}}
|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{{state_assembly|}}} {{#ifeq:{{{state_assembly|}}}|Nevada||{{#ifeq:{{{state_assembly|}}}|New Jersey|General|State}}}} Assembly]]</span><br />from the
|Member{{#if:{{{succeeding|}}}{{{assuming|}}}|-elect}} of the <span style="display: inline-block;">[[{{#if:{{{state_house|}}} |{{{state_house}}}|{{#if:{{{state_delegate|}}}|{{{state_delegate}}}|United States }}}} {{#if:{{{state_delegate|}}}|House of Delegates|House of Representatives}}|{{#if:{{{state_house|}}} |{{{state_house}}}|{{#if:{{{state_delegate|}}}|{{{state_delegate}}}|U.S.}}}} {{#if:{{{state_delegate|}}}|House of Delegates|{{#if:{{{state_house|}}}| }}House of Representatives}}]]</span><br />from {{#if:{{{state_delegate|}}}|the |{{#if:{{{state_house|}}}|the |{{{state}}}{{#if:{{{district|}}}|'s}}}}}}
}} {{#if:{{{district|}}}|{{{district}}} district}}{{#if:{{{prior_term|}}}|
<br />{{{prior_term}}}}}
}}
}}
<!--------Convocation--------->
| header18 = {{#if:{{{convocation|}}}|{{{convocation}}}}}
<!--------Term--------->
| data19 = {{#if:{{{termend|}}}{{{succeeding|}}}{{{assuming|}}}|
{{#if:{{{status|}}}
| <div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''{{{status}}}'''</div>|}}|
}}
| data20 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
| <span class="nowrap">'''Assuming office'''</span><br />{{{termstart}}}{{#if:{{{term|}}}{{{termend|}}}|[[Category:Pages using infobox officeholder with succeeding and term or termend]]}}
| {{#if: {{{term|}}} | <span class="nowrap">'''{{{termlabel|In office}}}'''</span><br />{{{term}}} }}
}} }}
| data21 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
|
|{{#if:{{{termstart|}}}
| {{#if:{{{termend|}}}
|<!--then: term has start and end:--><span class="nowrap">'''{{{termlabel|In office}}}'''</span><br />{{en dash range|{{{termstart}}}|{{{termend}}}}}{{#if:{{{alongside|}}}{{{co-leader|}}}|<div style="line-height:normal; padding-top:0.2em; padding-bottom:0.1em">{{#if:{{{alongside|}}}|Serving|Co-leading}} with {{#if:{{{alongside|}}}|{{{alongside}}}|{{{co-leader}}}}}</div>}}
|{{#if:{{{status|}}}|<div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''{{{status}}}'''</div>|<!--else: term is ongoing--><div style="width:100%; margin:0; background-color: {{{color|lavender}}}">'''[[Incumbent]]'''</div>}}
}}
}}
}} }}
| data22 = {{#if:{{{nominee|}}}{{{candidate|}}}||
{{#if:{{{succeeding|}}}{{{assuming|}}}
|
|{{#if:{{{termstart|}}}
|{{#if:{{{termend|}}}
|<!--then nothing else; term has ended-->
|<!--else term is ongoing:--><span class="nowrap">'''{{#if:{{{termlabel|}}}|{{str rep|1={{{termlabel}}}|2=In office|3=Assumed office}}|Assumed office}}'''</span> <br />{{{termstart}}}{{#if:{{{alongside|}}}{{{co-leader|}}}|<div style="line-height:normal; padding-top:0.2em; padding-bottom:0.1em">{{#if:{{{alongside|}}}|Serving|Co-leader}} with {{#if:{{{alongside|}}}|{{{alongside}}}|{{{co-leader}}}}}</div>}}
}}
}}
}} }}
}} }}<!--
end infobox1 / start infobox2
-->{{#if:{{{monarch|}}}{{{president|}}}{{{governor-general|}}}{{{governor_general|}}}{{{primeminister|}}}{{{chancellor|}}}{{{minister|}}}{{{taoiseach|}}}{{{firstminister|}}}{{{chiefminister|}}}{{{premier|}}}{{{governor|}}}{{{lieutenant_governor|}}}{{{vicepresident|}}}{{{vicegovernor|}}}{{{viceprimeminister|}}}{{{vicepremier|}}}{{{deputy|}}}{{{leader|}}}{{{lieutenant|}}}{{{nominator|}}}{{{appointer|}}}{{{opponent|}}}{{{incumbent|}}}{{{succeeding|}}}{{{assuming|}}}{{{preceding|}}}{{{predecessor|}}}{{{preceded|}}}{{{successor|}}}{{{succeeded|}}}{{{parliamentarygroup|}}}{{{constituency|}}}{{{majority|}}}{{{suboffice|}}}{{{1namedata|}}}{{{2namedata|}}}{{{3namedata|}}}{{{4namedata|}}}{{{5namedata|}}}{{{runningmate|}}}|
{{#invoke:infobox|infoboxTemplate|child=yes
| labelstyle = text-align:left
| label1 = <span class="nowrap">Nominated by</span>
| data1 = {{{nominator|}}}
| label2 = <span class="nowrap">Appointed by</span>
| data2 = {{{appointer|}}}
<!--------President, Prime Minister, Governor--------->
| label3 = Monarch
| data3 = {{{monarch|}}}
| label4 = President
| data4 = {{{president|}}}
| label5 = {{#if:{{{governor_general|}}}|Governor General|Governor-General}}
| data5 = {{#if:{{{governor_general|}}}|{{{governor_general}}}|{{{governor-general|}}}}}
| label6 = <span class="nowrap">Prime Minister</span>
| data6 = {{{primeminister|}}}
| label7 = Chancellor
| data7 = {{{chancellor|}}}
| label8 = Minister
| data8 = {{{minister|}}}
| label9 = Taoiseach
| data9 = {{{taoiseach|}}}
| label10 = <span class="nowrap">First Minister</span>
| data10 = {{{firstminister|}}}
| label11 = <span class="nowrap">Chief Minister</span>
| data11 = {{{chiefminister|}}}
| label12 = Premier
| data12 = {{{premier|}}}
| label13 = Governor
| data13 = {{{governor|}}}
| label14 = Lieutenant Governor
| data14 = {{{lieutenant_governor|}}}
<!--------Vice president/s, Vice Prime Minister/s, Deputy/ies, Lieutenant/s--------->
| label15 = <span class="nowrap">{{#if:{{{office|}}}|{{#ifeq:{{isValidPageName|Vice {{{office}}}}}|valid|[[Vice {{{office}}}|Vice President]]|Vice President}}|Vice President}}</span>
| data15 = {{{vicepresident|}}}
| label16 = <span class="nowrap">{{#if:{{{office|}}}|{{#ifeq:{{isValidPageName|Vice {{{office}}}}}|valid|[[Vice {{{office}}}|Vice Governor]]|Vice Governor}}|Vice Governor}}</span>
| data16 = {{{vicegovernor|}}}
| label17 = <span class="nowrap">{{#if:{{{office|}}}|[[Vice {{{office}}}|Vice PM]]|Vice [[Prime Minister|PM]]}}</span>
| data17 = {{{viceprimeminister|}}}
| label18 = <span class="nowrap">{{#if:{{{office|}}}|{{#ifeq:{{isValidPageName|Vice {{{office}}}}}|valid|[[Vice {{{office}}}|Vice Premier]]|Vice Premier}}|Vice Premier}}</span>
| data18 = {{{vicepremier|}}}
| label19 = {{#if:{{{office|}}}|{{#ifeq:{{isValidPageName|Deputy {{{office}}}}}|valid|[[Deputy {{{office}}}|Deputy]]|Deputy}}|Deputy}}
| data19 = {{{deputy|}}}
| label20 = Leader
| data20 = {{{leader|}}}
| label21 = {{#if:{{{office|}}}|[[Lieutenant {{{office}}}|Lieutenant]]|Lieutenant}}
| data21 = {{{lieutenant|}}}
| label22 = {{nowrap|{{{subterm|}}}}}
| data22 = {{{suboffice|}}}
<!--------Blank fields--------->
| label23 = {{{1blankname|}}}
| data23 = {{{1namedata|}}}
| label24 = {{{2blankname|}}}
| data24 = {{{2namedata|}}}
| label25 = {{{3blankname|}}}
| data25 = {{{3namedata|}}}
| label26 = {{{4blankname|}}}
| data26 = {{{4namedata|}}}
| label27 = {{{5blankname|}}}
| data27 = {{{5namedata|}}}
<!--------Predecessor/successor--------->
| label28 = <span class="nowrap">Running mate</span>
| data28 = {{{runningmate|}}}
| label29 = Opponent(s)
| data29 = {{{opponent|}}}
| label30 = Incumbent
| data30 = {{{incumbent|}}}
| label31 = {{#if:{{{succeeding|}}}|Succeeding|Preceding}}
| data31 = {{#if:{{{succeeding|}}}|{{{succeeding|}}}|{{{preceding|}}}}}
| label32 = <span class="nowrap">Preceded by</span>
| data32 = {{#if:{{{succeeding|}}}||{{#if:{{{predecessor|}}}|{{{predecessor}}}|{{{preceded|}}}}}}}
| label33 = <span class="nowrap">Succeeded by</span>
| data33 = {{#if:{{{succeeding|}}}||{{#switch:{{#if:{{{successor|}}}|{{{successor}}}|{{{succeeded|}}}}}
| Incumbent
| '''Incumbent'''
| ''Incumbent''
| [[Incumbent]]
| incumbent
| '''incumbent'''
| ''incumbent''
| [[incumbent]] =
| #default = {{#if:{{{successor|}}}|{{{successor}}}|{{{succeeded|}}}}}
}}}}
<!--------Constituency/Majority--------->
| label34 = [[Parliamentary group]]
| data34 = {{{parliamentarygroup|}}}
| label35 = Constituency
| data35 = {{{constituency|}}}
| label36 = Majority
| data36 = {{{majority|}}}
}} }}<noinclude>{{documentation}}</noinclude>
7vyklecxjzsbvv2wsqhey9fxpeuwmp1
Template:Internet Archive author
10
44041812
825509521
730581640
2018-02-13T20:22:48Z
WOSlinker
3138265
separate pp-template not needed
wikitext
text/x-wiki
<includeonly>{{#invoke:Internet Archive|author}}{{#ifeq:{{NAMESPACENUMBER}}|0|[[Category:Articles with Internet Archive links]]|}}</includeonly><noinclude>{{Documentation}}</noinclude>
mtqol7akyvkr9mpee5elqnj27vbmp2e
Template:IsValidPageName
10
13887241
977769953
602408525
2020-09-10T21:37:46Z
Pppery
28032115
Module being deleted
wikitext
text/x-wiki
{{#ifeq:{{{1}}}|-||{{#iferror:{{#invoke:Page|invalid|{{{1}}}}}||valid}}}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
q43r371r64z8ekdma6ljffbo4qkbq6m
Template:Isnumeric
10
26528820
1075867843
1075867733
2022-03-08T03:30:17Z
Neveselbert
25820411
safesubst
wikitext
text/x-wiki
{{safesubst<noinclude/>:#iferror:{{safesubst<noinclude/>:#expr:{{safesubst<noinclude/>:formatnum:{{{1|error}}}|R}}*0}}|{{safesubst<noinclude/>:#ifeq:{{{boolean|false}}}|true|0|}}|{{safesubst<noinclude/>:#ifeq:{{{boolean|false}}}|true|1|{{{1}}}}}}}<noinclude>{{documentation}}</noinclude>
sjoy502mkl7mcl9x9svmivtrs529iqi
Template:Library link about
10
38618375
969022836
827250930
2020-07-22T23:00:09Z
Reedy
449918
Update link as per toolforge url change
wikitext
text/x-wiki
[https://ftl.toolforge.org/cgi-bin/ftl?st={{#if:{{{lcheading|}}}||{{#if:{{{viaf|}}}|viaf|{{#if:{{{lccn|}}}|lccn|wp}} }} }}&su={{urlencode:{{#if:{{{lcheading|}}}|{{{lcheading}}}|{{#if:{{{viaf|}}}|{{{viaf}}}|{{#if:{{{lccn|}}}|{{{lccn}}}|{{#if:{{{wikititle|}}}|{{{wikititle}}}|{{PAGENAME}} }} }} }} }} }}{{#if:{{{library|}}}|&library={{urlencode:{{{library}}}}}|}} {{{label|Resources about this subject at your library}}}]<noinclude>
{{Documentation}}
</noinclude>
pe6srcqtuqrk2cwwjg3dv64q932ino2
Template:Library link by
10
38617920
969022227
825510182
2020-07-22T22:54:23Z
JohnMarkOckerbloom
18396895
Changed URL to point to new tools server
wikitext
text/x-wiki
[//ftl.toolforge.org/cgi-bin/ftl?at={{#if:{{{lcheading|}}}||{{#if:{{{viaf|}}}|viaf|{{#if:{{{lccn|}}}|lccn|wp}} }} }}&au={{urlencode:{{#if:{{{lcheading|}}}|{{{lcheading}}}|{{#if:{{{viaf|}}}|{{{viaf}}}|{{#if:{{{lccn|}}}|{{{lccn}}}|{{#if:{{{wikititle|}}}|{{{wikititle}}}|{{PAGENAME}} }} }} }} }} }}{{#if:{{{library|}}}|&library={{urlencode:{{{library}}}}}|}} {{{label|Resources by this author at your library}}}]<noinclude>
{{Documentation}}
</noinclude>
0sq65kby3c56q9yfm62nn647onhqhmp
Template:Library resources box
10
38630468
933417953
880114477
2019-12-31T20:38:03Z
Jonesey95
9755426
better handling of empty label
wikitext
text/x-wiki
{{#invoke:sidebar|sidebar
|navbar = none
|width = auto
|pretitle = [[Wikipedia:The Wikipedia Library|Library resources]] {{#ifeq: {{{about}}}|no||about <br /> '''{{#if:{{{label|}}}|{{{label|}}}|{{PAGENAME}} }}''' }} <hr />
|contentclass = plainlist
|bodystyle = text-align:left;
|heading1 =
|content1 =
{{#ifeq: {{{about}}}|no||{{#ifeq: {{{onlinebooks}}}|yes|* {{Library link about|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|library=OLBP|label=Online books}}|{{#ifeq: {{{onlinebooksabout}}}|yes|* {{Library link about|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|library=OLBP|label=Online books}}}}}}
* {{Library link about|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|label=Resources in your library}}
{{#ifeq: {{{others}}}|no||* {{Library link about|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|library=0CHOOSE0|label=Resources in other libraries}} }} }}
|heading2={{#ifeq: {{{by}}}|yes|By {{{label|{{PAGENAME}}}}}|}}
|content2={{#ifeq: {{{by}}}|yes|
{{#ifeq: {{{onlinebooks}}}|yes|* {{Library link by|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|library=OLBP|label=Online books}}|{{#ifeq: {{{onlinebooksby}}}|yes|* {{Library link by|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|library=OLBP|label=Online books}}}}}}
* {{Library link by|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|label=Resources in your library}}
{{#ifeq: {{{others}}}|no||* {{Library link by|lcheading={{{lcheading|}}}|viaf={{{viaf|}}}|lccn={{{lccn|}}}|wikititle={{{wikititle|}}}|library=0CHOOSE0|label=Resources in other libraries}} }} |}}
}}<noinclude>
{{documentation}}
</noinclude>
5g91qhvw3wil8ufwciac9aocgxxh6mj
Template:Librivox author
10
28310139
983731081
983713109
2020-10-15T22:30:47Z
Zyxw
473593
Add fix for Wikidata property with multiple values, such as for [[Wilhelm Röntgen]]. Tested first with [[/sandbox]].
wikitext
text/x-wiki
{{#if: {{{1<includeonly>|</includeonly>}}} {{{id|}}} {{#property:P1899}}
| [https://librivox.org/{{#if: {{{id|}}}
| author/{{{id}}}
| {{#if: {{{1|}}}
| search?q={{{1}}}&search_form=advanced
| {{#if: {{#property:P1899}}
| author/{{First word|1={{#property:P1899}}|sep=,}}
}}
}}
}} Works by {{{2|{{{title|{{PAGENAMEBASE}}}}}}}}] at [[LibriVox]] (public domain audiobooks) [[File:Speaker Icon.svg|15px|link=|alt=]]{{#ifeq:{{NAMESPACENUMBER}}|0|[[Category:Articles with LibriVox links]]|}}<includeonly>{{EditAtWikidata|pid=P1899|{{{1|{{{id|}}}}}}}}</includeonly>
| <span class="error">{{[[Template:Librivox author|Librivox author]]}} template missing ID and not present in Wikidata.</span>
}}<noinclude>
{{documentation}}
<!--Please add this template's categories to the /doc subpage, not here - thanks!-->
</noinclude>
3t5212nsr2foer1674ysxela738nguq
Template:Link note
10
35168072
825510446
756212913
2018-02-13T20:29:11Z
WOSlinker
3138265
separate pp-template not needed
wikitext
text/x-wiki
<span style="font-size:0.95em; font-size:90%; color:#555">({{{note|}}})</span><includeonly>{{#if:{{{cat|}}}|{{DMCA|{{{cat|}}}|from|{{{date|}}}}}}}</includeonly><noinclude>{{documentation}}</noinclude>
bwyu2tjw5755ttqsibbg470pjnd65x7
Template:Longitem
10
38040101
1079667151
973039638
2022-03-28T00:47:59Z
Neveselbert
25820411
+conditional to allow transclusion of default style in other templates
wikitext
text/x-wiki
{{#if:{{{1|}}}|<div style="}} display:inline-block; line-height:1.2em; padding:0.1em 0;{{#if:{{{1|}}}|{{{style|}}}">{{{1}}}</div><includeonly>{{#if:{{{2|}}}|[[Category:Pages using Template:Longitem with unnamed style parameter]]}}</includeonly>}}<noinclude>
{{documentation}}
</noinclude>
cet3kroz7oo8gvc5s0b3jackg4lgltn
Template:Main
10
1208356
1054074732
1050142713
2021-11-07T22:34:09Z
Nihiltres
236191
Includeonly the template to avoid errors on the template pages
wikitext
text/x-wiki
<includeonly>{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
hz9saa715ercns6m73a0a1ud2ptzt26
Template:Main other
10
17220251
1059626360
388689011
2021-12-10T16:08:06Z
Xaosflux
502540
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:0}}
| main
| other
}}
}}
| main = {{{1|}}}
| other
| #default = {{{2|}}}
}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
fqcj40f1ojeitvtz4m2eefrp1ymhi6o
Template:Marriage
10
22011862
1079101693
1074021595
2022-03-25T01:09:37Z
Neveselbert
25820411
For compatibility with both parameter names
wikitext
text/x-wiki
{{#if:{{{1|}}}||{{#if:{{{2|}}}{{{3|}}}{{{end|{{{reason|}}}}}}
|{{#ifeq:{{{1|+}}}|{{{1|-}}}|<div style="line-height:0;margin-bottom:-3px;">​</div>|{{main other|[[Category:Marriage template anomalies|N{{PAGENAME}}]]}}}}}}}}
<div style="display:inline;white-space:nowrap;">{{#if:{{{1|}}}
|{{trim|{{#if:{{{end|{{{reason|}}}}}}
|<div style="display:inline-block;line-height:normal;{{#if:{{{2|}}}{{in string|source={{{1}}}|target=<br|plain=true|nomatch=}}|margin-top:1px;white-space:normal;|{{str ≥ len|1={{delink|{{{1}}}}}|2=20|3=margin-top:1px;white-space:normal;}}}}">{{{1|}}}</div>
{{#if:{{{2|}}}
|{{#if:{{{end|{{{reason|}}}}}}|<div style="line-height:0;margin-bottom:-2px;">​</div>}}
|{{#if:{{in string|source={{{1}}}|target=<br|plain=true|nomatch=}}
|<div style="line-height:0;margin-bottom:-2px;">​</div>
|{{str ≥ len|1={{delink|{{{1}}}}}|2=20
|3=<div style="line-height:0;margin-bottom:-2px;">​</div>}}
}}}}
|<div style="display:inline-block;line-height:normal;{{#if:{{in string|source={{{1}}}|target=<br|plain=true|nomatch=}}|margin-top:1px;white-space:normal;|{{str ≥ len|1={{delink|{{{1}}}}}|2={{if both|{{{2|}}}|{{{3|}}}|15|20}}|3=margin-top:1px;white-space:normal;}}}}">{{{1|}}}</div>
{{#if:{{in string|source={{{1}}}|target=<br|plain=true|nomatch=}}
|<div style="line-height:0;margin-bottom:-2px;">​</div>
|{{str ≥ len|1={{delink|{{{1}}}}}|2={{if both|{{{2|}}}|{{{3|}}}|15|20}}
|3=<div style="line-height:0;margin-bottom:-2px;">​</div>}}}}
}}}}}} <div style="display:inline-block;{{#if:{{in string|source={{{1}}}|target=<br|plain=true|nomatch=}}|margin-bottom:1px;|{{str ≥ len|1={{delink|{{{1}}}}}|2={{if both|{{{2|}}}|{{{3|}}}|15|20}}|3=margin-bottom:1px;|4={{#if:{{{end|{{{reason|}}}}}}|{{#if:{{{2|}}}|margin-bottom:1px;}}}}}}}}">​</div>(<!--
-->{{#if:{{{2|}}}
|{{#ifeq:{{{end|{{{reason|+}}}}}}|
|{{#switch:{{{3|}}} | = after }}
|{{abbr|m.|married}} }}{{#ifeq:{{{2|}}}|{{#time:Y|{{{2|}}}}}
|{{{2|}}}
|{{hover title|dotted=no|2={{#iferror: {{#time:Y|{{{2|}}}}} | {{main other|[[Category:Marriage template errors|I{{PAGENAME}}]]}}<span style="color:red;">invalid year</span>|{{#time:Y|{{{2|}}}}}}}|1={{{2|}}}}}
}}
|{{#if:{{{3|}}}{{{end|{{{reason|}}}}}}||{{#if:{{#property:P570}}||{{main other|[[Category:Marriage template errors|N{{PAGENAME}}]]}}}}<!--
-->{{#if:{{{end|{{{reason|}}}}}}||{{#if:{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=y}} | {{main other|[[Category:Marriage template anomalies|B{{PAGENAME}}]]}}before {{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=y}} |<span style="color:red;">no value</span>}}}}<!--
-->{{#if:{{{end|{{{reason|}}}}}}|{{#if:{{{2|}}}{{{3|}}}|, }}}}}}
}}{{#if:{{{3|}}}
|{{#ifeq:{{{end|{{{reason|}}}}}}|
|{{#if:{{{2|}}}|⁠–⁠|{{#ifeq:{{{end|+}}}|{{{end|-}}}
|{{#ifeq:{{{end|+}}}|{{{end|-}}} | until | before }}
|{{#ifeq:{{{reason|+}}}|{{{reason|-}}} | until | before }}}} }}
|{{#if:{{{2|}}}
|; 
}}{{#switch:{{lc:{{{end|{{{reason|}}}}}}}}
| d | d. | died = died <!-- this used to be {{abbr|d.|died}} but caused confusion with "divorced" -->
| div | div. | divorce | divorced = {{abbr|div.|divorced}}
| her death = {{#ifeq:{{#property:P21}}|male|died |{{main other|[[Category:Marriage template deprecations]]}}{{dc|her death }}}}
| his death = {{#ifeq:{{#property:P21}}|female|died |{{main other|[[Category:Marriage template deprecations]]}}{{dc|his death }}}}
| w | w. | wid | wid. | widow | widowed = {{main other|[[Category:Marriage template errors|W{{PAGENAME}}]]}}<span style="color:red;">invalid reason</span>
| = <!--(reason marriage ended not supplied)-->
| #default = {{{end|{{{reason|}}}}}}
}}
}}{{#ifeq:{{{3|}}}
|{{Str ≠ len|{{{3}}}|4
|{{#ifexpr:{{#time:Ymd|{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=ymd}} }} >= {{#time:Ymd|{{{3|}}}}}
|{{#ifexpr:{{#time:Ymd|{{if empty|{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=ymd}}|{{tomorrow}} }}}} = {{#time:Ymd|{{{3|}}}}}
|{{#if:{{{end|{{{reason|}}}}}}
|{{#time:Y|{{{3|}}}}}
|{{main other|[[Category:Marriage template anomalies|D{{PAGENAME}}]]}}{{if preview|<var>{{colored link|red|Category:Marriage template anomalies|{{First word|{{PAGENAMEBASE}}|sep=,}}'s date of death}}</var>|{{#time:Y|{{{3|}}}}} }}}}
|{{#time:Y|{{{3|}}}}}
}}
|{{main other|[[Category:Marriage template anomalies|P{{PAGENAME}}]]}}{{if preview|<var>{{colored link|red|Category:Marriage template anomalies|{{#ifexpr:{{#time:Ymd}} >= {{#time:Ymd|{{{3|}}}}}|posthumous|future}} date}}</var>|{{#time:Y|{{{3|}}}}}
}}}}
|{{#ifexpr:{{#time:Y|{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=y}} }} >= {{#time:Y|{{{3|}}}}}
|{{#time:Y|{{{3|}}}}}
|{{main other|[[Category:Marriage template anomalies|P{{PAGENAME}}]]}}{{if preview|<var>{{colored link|red|Category:Marriage template anomalies|{{#ifexpr:{{#time:Y}} >= {{{3|}}}|posthumous|future}} year}}</var>|{{#time:Y|{{{3|}}}}}
}}}}
}}
|{{{3|}}}
|{{hover title|dotted=no|2={{#iferror: {{#time:Y|{{{3|}}}}} | {{main other|[[Category:Marriage template errors|I{{PAGENAME}}]]}}<span style="color:red;">invalid year</span>
|{{Str ≠ len|{{{3}}}|4
|{{#ifexpr:{{#time:Ymd|{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=ymd}} }} >= {{#time:Ymd|{{{3|}}}}}
|{{#ifexpr:{{#time:Ymd|{{if empty|{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=ymd}}|{{tomorrow}} }}}} = {{#time:Ymd|{{{3|}}}}}
|{{#if:{{{end|{{{reason|}}}}}}
|{{#time:Y|{{{3|}}}}}
|{{main other|[[Category:Marriage template anomalies|D{{PAGENAME}}]]}}{{if preview|<var>{{colored link|red|Category:Marriage template anomalies|{{First word|{{PAGENAMEBASE}}|sep=,}}'s date of death}}</var>|{{#time:Y|{{{3|}}}}} }}}}
|{{#time:Y|{{{3|}}}}}
}}
|{{main other|[[Category:Marriage template anomalies|P{{PAGENAME}}]]}}{{if preview|<var>{{colored link|red|Category:Marriage template anomalies|{{#ifexpr:{{#time:Ymd}} >= {{#time:Ymd|{{{3|}}}}}|posthumous|future}} date}}</var>|{{#time:Y|{{{3|}}}}}
}}}}
|{{#ifexpr:{{#time:Y|{{Wdib |P570|fwd=ALL|maxvals=1|noicon=true|pd=yes|df=y}} }} >= {{#time:Y|{{{3|}}}}}
|{{#time:Y|{{{3|}}}}}
|{{main other|[[Category:Marriage template anomalies|P{{PAGENAME}}]]}}{{if preview|<var>{{colored link|red|Category:Marriage template anomalies|{{#ifexpr:{{#time:Y}} >= {{{3|}}}|posthumous|future}} year}}</var>|{{#time:Y|{{{3|}}}}}
}}}}
}}}}|1={{{3|}}}}}
}}
|{{#if:{{{2|}}}
|{{#if:{{{end|{{{reason|}}}}}}|, |}}
}}{{#switch:{{lc:{{{end|{{{reason|}}}}}}}}
| d | d. | died = died
| div | div. | divorce | divorced = divorced
| her death = {{#ifeq:{{#property:P21}}|male|died|{{main other|[[Category:Marriage template deprecations]]}}{{dc|her death}}}}
| his death = {{#ifeq:{{#property:P21}}|female|died|{{main other|[[Category:Marriage template deprecations]]}}{{dc|his death}}}}
| w | w. | wid | wid. | widow | widowed = {{main other|[[Category:Marriage template errors|W{{PAGENAME}}]]}}<span style="color:red;">invalid reason</span>
| = <!--(reason marriage ended not supplied)-->
| #default = {{{end|{{{reason|}}}}}}
}}
}})<wbr />​</div><!--
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Marriage template errors|U{{PAGENAME}}]]}}|preview=Page using [[Template:Marriage]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | end | reason }}<noinclude>{{documentation}}</noinclude>
cj7gf3uh7gsi9tjm2012zkoxor31dhy
Template:NAACP Image Award – Chairman's Award
10
66205566
1073864551
1021638895
2022-02-25T02:55:59Z
Keivan.f
14604687
wikitext
text/x-wiki
{{Navbox
| name = NAACP Image Award – Chairman's Award
| title = [[NAACP Image Award – Chairman's Award]]
| basestyle =
| groupstyle =
| state = {{{state|autocollapse}}}
| bodyclass = hlist
|list1 =
* [[Janet Jackson]] (1992)
* [[Ron Brown (U.S. Secretary of Commerce)|Ron Brown]] (1993)
* [[Maxine Waters]] and Joseph Madison (1997)
* [[Harry Belafonte]] (1999)
* [[Aaron McGruder]] (2002)
* [[Danny Glover]] (2003)
* [[Dave Matthews Band|The Dave Matthews Band]] (2004)
* [[Barack Obama]] (2005)
* [[The Neville Brothers]] (2006)
* [[Bono]] (2007)
* [[Ruby Dee]] (2008)
* [[Al Gore]] & [[Wangari Maathai]] (2009)
* [[Tyler Perry]] (2010)
* [[Cathy Hughes]] (2012)
* [[Michelle Howard]] (2013)
* [[Forest Whitaker]] (2014)
* [[Eric Holder]] (2015)
* [[Bree Newsome|Brittany "Bree" Newsome]], Justice League NYC, Concerned Student 1950 Collective at the University of Missouri, The University of Mississippi NAACP College Chapter, Rev. Dr. [[Otis Moss III]], Rev. Dr. Howard-John Wesley, Rev. Dr. [[Jamal Harrison Bryant]] and [[Jussie Smollett]] (2016)
* [[Charles Ogletree]] (2017)
* [[William Lucy (labor leader)|William Lucy]] (2018)
* [[Maxine Waters]] (2019)
* [[John Lewis]] (2020)
* [[James Lawson (activist)|Rev. James Lawson]] (2021)
* [[Samuel L. Jackson]] (2022)
}}<noinclude>
{{collapsible option}}
[[Category:NAACP Image Award templates|Chairman's]]
</noinclude>
454e3phn9fuyc8xee1k3lsuhazum34u
Template:NYT topic
10
44031288
753309564
744186801
2016-12-06T11:48:54Z
MSGJ
42630
update after move
wikitext
text/x-wiki
#REDIRECT [[Template:New York Times topic]]
kx19cxflyutga015y3afdfhkunjw6r7
Template:Namespace detect
10
17433896
822697538
772147338
2018-01-27T23:54:39Z
JJMC89
24812038
clean subst
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#invoke:Namespace detect|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
l3ti6zjxip68spdlt018btofjtao8um
Template:Navbox
10
995954
1030560841
1030560775
2021-06-26T18:05:09Z
Trialpears
35786750
Remove TfD notice as it wouldn't involve any changes to this template.
wikitext
text/x-wiki
<includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
tqodcaa2vvhehqaod229udlla0wimek
Template:Navbox bottom
10
69183328
1053571098
1053372806
2021-11-04T17:59:51Z
MusikBot II
29539620
Protected "[[Template:Navbox bottom]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3929 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:navbox top and bottom|bottom}}</includeonly><noinclude>
{{documentation|Template:Navbox top/doc}}</noinclude>
bwhjfft0rnpktg14lfnmvcypl0jjozg
Template:Navbox top
10
69183320
1053571101
1053372642
2021-11-04T17:59:52Z
MusikBot II
29539620
Protected "[[Template:Navbox top]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3930 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:navbox top and bottom|top}}</includeonly><noinclude>
{{documentation}}
</noinclude>
pd6fsn315beqq337u11zsa9nhtokeo9
Template:Navboxes bottom
10
58724083
1059138755
863575548
2021-12-07T17:59:53Z
MusikBot II
29539620
Protected "[[Template:Navboxes bottom]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 262 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
<noinclude>{{navboxes top}}</noinclude>{{#invoke:navboxes|bottom}}<noinclude>
{{documentation|content=
{{Uses Lua|Module:Navboxes}}
This template may be used in conjunction with {{tl|navboxes top}} to create a collapsible container for a group of navboxes. When used together, the function is similar to {{tl|navboxes}} but without passing the list of navboxes through the module, which may help circumvent template include size limits.}}
</noinclude>
s2wkx2dkl50itywjqlm8dirseuhny0a
Template:Navboxes top
10
58724076
1059138757
863572689
2021-12-07T17:59:54Z
MusikBot II
29539620
Protected "[[Template:Navboxes top]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 269 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
{{#invoke:navboxes|top}}<noinclude>{{navboxes bottom}}
{{documentation|content=
{{Uses Lua|Module:Navboxes}}
This template may be used in conjunction with {{tl|navboxes bottom}} to create a collapsible container for a group of navboxes. When used together, the function is similar to {{tl|navboxes}} but without passing the list of navboxes through the module, which may help circumvent template include size limits.}}
</noinclude>
4qtbecqlrg58b0t07tgtrkp0yhfs8qe
Template:Nbs
10
40672418
1014909650
712346738
2021-03-29T18:23:54Z
MusikBot II
29539620
Protected "[[Template:Nbs]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
#REDIRECT [[Template:Spaces]]{{R from template shortcut}}
hrn4pmf8i4ouufv9luluafcsa6i5auo
Template:Nbsp
10
9539256
869606862
869569085
2018-11-19T18:04:40Z
Amorymeltzer
141948
{{R from template shortcut}}
wikitext
text/x-wiki
#REDIRECT [[Template:Spaces]]
{{Redirect category shell|
{{R from move}}
{{R from alternative name}}
{{R from template shortcut}}
}}
2axdy32whej7ce74avad8qnsbuwaoxi
Template:New York Times topic
10
30079103
1089024531
1082795893
2022-05-21T13:30:04Z
Zyxw
473593
Update to handle new URL and ID format used by Wikidata. Tested with [[/sandbox]] and [[/testcases]] and preview in articles.
wikitext
text/x-wiki
{{#if: {{{1|{{{id<includeonly>|</includeonly>}}}}}}
| [http://topics.nytimes.com/top/reference/timestopics/{{#if:1 | {{{1|{{{id}}}}}} }}/index.html {{#if: {{{2|{{{name<includeonly>|</includeonly>}}}}}} | {{{2|{{{name}}}}}} | {{PAGENAMEBASE}} }}] collected news and commentary at ''[[The New York Times]]''
| {{#if: {{{new_id|}}} {{#property:P3221}}
| [https://www.nytimes.com/topic/{{#if: {{{new_id|}}} | {{{new_id}}} | {{First word|1={{#property:P3221}}|sep=,}} }} {{#if: {{{name|}}} | {{{name}}} | {{PAGENAMEBASE}} }}] collected news and commentary at ''[[The New York Times]]''{{EditAtWikidata|pid=P3221|{{{new_id|}}}}}{{#ifeq:{{NAMESPACENUMBER}}|0|{{#if:{{{new_id|}}}||[[Category:New York Times topic template using Wikidata]]}}}}
| <span class="error">{{[[Template:New York Times topic|New York Times topic]]}} template missing ID and not present in Wikidata.</span>{{#ifeq:{{NAMESPACENUMBER}}|0|[[Category:New York Times topic template missing ID and not in Wikidata]]}}
}}
}}<noinclude>
{{Documentation}}<!-- Add categories to the /doc subpage and interwikis to Wikidata -->
</noinclude>
07olobvkkun6ekcynwske4txi2vegq9
Template:Nobel Peace Prize laureates
10
5029782
1094728757
1094681696
2022-06-24T05:57:45Z
DrKay
2387872
block evasion
wikitext
text/x-wiki
{{#invoke:Navbox|navbox
| name = Nobel Peace Prize laureates
| state = {{{state|autocollapse}}}
| bodyclass = hlist
| title = [[List of Nobel Peace Prize laureates|Laureates]] of the [[Nobel Peace Prize]]
| nowrapitems = yes
| group1 = 1901–1925
| list1 =
* 1901: [[Henry Dunant]]{{\}}[[Frédéric Passy]]
* 1902: [[Élie Ducommun]]{{\}}[[Charles Albert Gobat|Charles Gobat]]
* 1903: [[Randal Cremer]]
* 1904: [[Institut de Droit International]]
* 1905: [[Bertha von Suttner]]
* 1906: [[Theodore Roosevelt]]
* 1907: [[Ernesto Teodoro Moneta|Ernesto Moneta]]{{\}}[[Louis Renault (jurist)|Louis Renault]]
* 1908: [[Klas Pontus Arnoldson|Klas Arnoldson]]{{\}}[[Fredrik Bajer]]
* 1909: [[Auguste Beernaert|A. M. F. Beernaert]]{{\}}[[Paul Henri Balluet d'Estournelles de Constant|Paul Estournelles de Constant]]
* 1910: [[International Peace Bureau]]
* 1911: [[Tobias Asser]]{{\}}[[Alfred Hermann Fried|Alfred Fried]]
* 1912: [[Elihu Root]]
* 1913: [[Henri La Fontaine]]
* {{color|#757575|1914}}
* {{color|#757575|1915}}
* {{color|#757575|1916}}
* 1917: [[International Committee of the Red Cross]]
* {{color|#757575|1918}}
* 1919: [[Woodrow Wilson]]
* 1920: [[Léon Bourgeois]]
* 1921: [[Hjalmar Branting]]{{\}}[[Christian Lous Lange|Christian Lange]]
* 1922: [[Fridtjof Nansen]]
* {{color|#757575|1923}}
* {{color|#757575|1924}}
* 1925: [[Austen Chamberlain]]{{\}}[[Charles G. Dawes|Charles Dawes]]
| group2 = 1926–1950
| list2 =
* 1926: [[Aristide Briand]]{{\}}[[Gustav Stresemann]]
* 1927: [[Ferdinand Buisson]]{{\}}[[Ludwig Quidde]]
* {{color|#757575|1928}}
* 1929: [[Frank B. Kellogg]]
* 1930: [[Nathan Söderblom]]
* 1931: [[Jane Addams]]{{\}}[[Nicholas Murray Butler|Nicholas Butler]]
* {{color|#757575|1932}}
* 1933: [[Norman Angell]]
* 1934: [[Arthur Henderson]]
* 1935: [[Carl von Ossietzky]]
* 1936: [[Carlos Saavedra Lamas]]
* 1937: [[Robert Cecil, 1st Viscount Cecil of Chelwood|Robert Cecil]]
* 1938: [[Nansen International Office for Refugees]]
* {{color|#757575|1939}}
* {{color|#757575|1940}}
* {{color|#757575|1941}}
* {{color|#757575|1942}}
* {{color|#757575|1943}}
* 1944: [[International Committee of the Red Cross]]
* 1945: [[Cordell Hull]]
* 1946: [[Emily Greene Balch|Emily Balch]]{{\}}[[John Mott]]
* 1947: [[Quaker Peace and Social Witness|Friends Service Council]]{{\}}[[American Friends Service Committee]]
* {{color|#757575|1948}}
* 1949: [[John Boyd Orr]]
* 1950: [[Ralph Bunche]]
| group3 = 1951–1975
| list3 =
* 1951: [[Léon Jouhaux]]
* 1952: [[Albert Schweitzer]]
* 1953: [[George C. Marshall]]
* 1954: [[United Nations High Commissioner for Refugees]]
* {{color|#757575|1955}}
* {{color|#757575|1956}}
* 1957: [[Lester B. Pearson]]
* 1958: [[Dominique Pire|Georges Pire]]
* 1959: [[Philip Noel-Baker]]
* 1960: [[Albert Luthuli]]
* 1961: [[Dag Hammarskjöld]]
* 1962: [[Linus Pauling]]
* 1963: [[International Committee of the Red Cross]]{{\}}[[International Federation of Red Cross and Red Crescent Societies|League of Red Cross Societies]]
* 1964: [[Martin Luther King Jr.]]
* 1965: [[UNICEF]]
* {{color|#757575|1966}}
* {{color|#757575|1967}}
* 1968: [[René Cassin]]
* 1969: [[International Labour Organization]]
* 1970: [[Norman Borlaug]]
* 1971: [[Willy Brandt]]
* {{color|#757575|1972}}
* 1973: ''[[Lê Đức Thọ]] (declined award)''{{\}}[[Henry Kissinger]]
* 1974: [[Seán MacBride]]{{\}}[[Eisaku Satō]]
* 1975: [[Andrei Sakharov]]
| group4 = 1976–2000
| list4 =
* 1976: [[Betty Williams (peace activist)|Betty Williams]]{{\}}[[Mairead Maguire|Mairead Corrigan]]
* 1977: [[Amnesty International]]
* 1978: [[Anwar Sadat]]{{\}}[[Menachem Begin]]
* 1979: [[Mother Teresa]]
* 1980: [[Adolfo Pérez Esquivel]]
* 1981: [[United Nations High Commissioner for Refugees]]
* 1982: [[Alva Myrdal]]{{\}}[[Alfonso García Robles]]
* 1983: [[Lech Wałęsa]]
* 1984: [[Desmond Tutu]]
* 1985: [[International Physicians for the Prevention of Nuclear War]]
* 1986: [[Elie Wiesel]]
* 1987: [[Óscar Arias]]
* 1988: [[United Nations peacekeeping|UN Peacekeeping Forces]]
* 1989: [[14th Dalai Lama|Tenzin Gyatso (14th Dalai Lama)]]
* 1990: [[Mikhail Gorbachev]]
* 1991: [[Aung San Suu Kyi]]
* 1992: [[Rigoberta Menchú]]
* 1993: [[Nelson Mandela]]{{\}}[[F. W. de Klerk]]
* 1994: [[Shimon Peres]]{{\}}[[Yitzhak Rabin]]{{\}}[[Yasser Arafat]]
* 1995: [[Pugwash Conferences on Science and World Affairs|Pugwash Conferences]]{{\}}[[Joseph Rotblat]]
* 1996: [[Carlos Filipe Ximenes Belo|Carlos Belo]]{{\}}[[José Ramos-Horta]]
* 1997: [[International Campaign to Ban Landmines]]{{\}}[[Jody Williams]]
* 1998: [[John Hume]]{{\}}[[David Trimble]]
* 1999: [[Médecins Sans Frontières]]
* 2000: [[Kim Dae-jung]]
| group5 = 2001–present
| list5 =
*[[2001 Nobel Peace Prize|2001]]: [[United Nations]]{{\}}[[Kofi Annan]]
*[[2002 Nobel Peace Prize|2002]]: [[Jimmy Carter]]
*[[2003 Nobel Peace Prize|2003]]: [[Shirin Ebadi]]
*[[2004 Nobel Peace Prize|2004]]: [[Wangari Maathai]]
*[[2005 Nobel Peace Prize|2005]]: [[International Atomic Energy Agency]]{{\}}[[Mohamed ElBaradei]]
*[[2006 Nobel Peace Prize|2006]]: [[Grameen Bank]]{{\}}[[Muhammad Yunus]]
*[[2007 Nobel Peace Prize|2007]]: [[Al Gore]]{{\}}[[Intergovernmental Panel on Climate Change]]
*[[2008 Nobel Peace Prize|2008]]: [[Martti Ahtisaari]]
*[[2009 Nobel Peace Prize|2009]]: [[Barack Obama]]
*[[2010 Nobel Peace Prize|2010]]: [[Liu Xiaobo]]
*[[2011 Nobel Peace Prize|2011]]: [[Ellen Johnson Sirleaf]]{{\}}[[Leymah Gbowee]]{{\}}[[Tawakkol Karman]]
*[[2012 Nobel Peace Prize|2012]]: [[European Union]]
*[[2013 Nobel Peace Prize|2013]]: [[Organisation for the Prohibition of Chemical Weapons]]
*[[2014 Nobel Peace Prize|2014]]: [[Kailash Satyarthi]]{{\}}[[Malala Yousafzai]]
*[[2015 Nobel Peace Prize|2015]]: [[Tunisian National Dialogue Quartet]]
*[[2016 Nobel Peace Prize|2016]]: [[Juan Manuel Santos]]
*[[2017 Nobel Peace Prize|2017]]: [[International Campaign to Abolish Nuclear Weapons]]
*[[2018 Nobel Peace Prize|2018]]: [[Denis Mukwege]]{{\}}[[Nadia Murad]]
*[[2019 Nobel Peace Prize|2019]]: [[Abiy Ahmed]]
*[[2020 Nobel Peace Prize|2020]]: [[World Food Programme]]
*[[2021 Nobel Peace Prize|2021]]: [[Maria Ressa]]{{\}}[[Dmitry Muratov]]
}}<noinclude>
{{collapsible option}}
[[Category:Nobel Prize templates|Peace laureates]]
[[Category:Peace award templates]]
</noinclude>
qoo2nw69m568ebsc8yvn44r8r92gyqc
Template:Nobel Prize winners footer
10
33381635
1073481091
1011088372
2022-02-22T23:09:48Z
WOSlinker
3138265
use flatlist
wikitext
text/x-wiki
<noinclude>{{flatlist|style=font-style:italic|1=</noinclude>
; {{nobold|[[List of Nobel laureates|Nobel Prize recipients]]}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|-5}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|-4}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|-3}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|-2}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|-1}}
:'''{{{1|{{CURRENTYEAR}}}}} '''<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|+1}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|+2}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|+3}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|+4}}<!--
-->{{Nobel Prize winners footer/year|{{{1|{{CURRENTYEAR}}}}}|+5}}
<noinclude>}}
{{Footer documentation|parameters=''year''}}
[[Category:Nobel Prize templates|Winners footer]]
[[Category:Awards footer templates]]
</noinclude>
bx6yl0roordhuihhvro98v8nl2j17lw
Template:Nobel Prize winners footer/year
10
67040748
1014909652
1011044717
2021-03-29T18:23:55Z
MusikBot II
29539620
Protected "[[Template:Nobel Prize winners footer/year]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
{{#ifexpr:{{{1|{{CURRENTYEAR}}}}}+{{{2|0}}}>1900 and {{{1|{{CURRENTYEAR}}}}}+{{{2|0}}}<={{CURRENTYEAR}}|:[[Template:{{#expr:{{{1|{{CURRENTYEAR}}}}}+{{{2|0}}}}} Nobel Prize winners|{{#expr:{{{1|{{CURRENTYEAR}}}}}+{{{2|0}}}}}]]}}
7jqak93q7vez4u0q95wsoecpxhsfxow
Template:Nobelprize
10
63763706
1057693170
983747779
2021-11-29T02:52:42Z
MJL
29291527
{{{access-date|}}
wikitext
text/x-wiki
<includeonly>{{#if: {{{1|}}}
| [https://www.nobelprize.org/laureate/{{{1}}} {{{name|{{PAGENAMEBASE}}}}}] on Nobelprize.org
| {{#if: {{#property:P8024}}
| [https://www.nobelprize.org/laureate/{{#property:P8024}} {{{name|{{PAGENAMEBASE}}}}}] on Nobelprize.org{{EditAtWikidata|pid=P8024}}[[Category:Nobelprize template using Wikidata property P8024]]
| <span class="error">{{[[Template:Nobelprize|Nobelprize]]}} template missing ID and not present in Wikidata.</span>
}}
}}{{#if: {{{access-date|{{{accessdate|}}}}}}
|, accessed {{Date|{{{access-date|{{{accessdate}}}}}}}}
}}</includeonly><noinclude>{{documentation}}</noinclude>
davj5zifv03pjbxagtmvngjvotn3x0e
Template:Nobold
10
10981056
865390504
865336863
2018-10-23T17:15:13Z
Frietjes
13791031
wikitext
text/x-wiki
<templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>
{{documentation}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
iaf63qvx3m2zxytvj4dw3wwalq5wusd
Template:Nobold/styles.css
10
58856178
886047488
885218100
2019-03-03T23:43:41Z
Pppery
28032115
Adding protection template
sanitized-css
text/css
/* {{pp-template}} */
/* Styling for Template:Nobold */
.nobold {
font-weight: normal;
}
fenpgkszzubv5v79v09z2871g8mgdmr
Template:Nowrap
10
1627975
692794261
462345338
2015-11-28T10:13:53Z
Edokter
1624037
Adapt comment; edits inside noinclude blocks should not affect job queue, but won't kill parser either way.
wikitext
text/x-wiki
<span class="nowrap">{{{1}}}</span><noinclude>
{{documentation}}
<!-- Categories go on the /doc page; interwikis go to Wikidata. -->
</noinclude>
avb5tcymgupik1ikutqclidkj9tnitx
Template:Ns has subpages
10
22589696
1074822270
637438114
2022-03-02T10:43:18Z
Trialpears
35786750
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))
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
Template:Official website
10
7233408
902535586
902535560
2019-06-19T14:01:14Z
Xaosflux
502540
<!--Forceupdate-->
wikitext
text/x-wiki
<includeonly>{{#invoke:Official website|main}}{{#invoke:Check for unknown parameters|check|showblankpositional=1|unknown={{main other|1=[[Category:Pages using Official website with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Official website]] with unknown parameter "_VALUE_"|1|2|URL|url|mobile|name|format}}</includeonly><!--
--><noinclude>{{documentation}}</noinclude>
aekbcyqrxstb5s7tfcs53jvav61stmt
Template:Ordinal
10
7409348
827462155
816471852
2018-02-24T21:30:49Z
JJMC89
24812038
allow subst
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#invoke:Ordinal|ordinal}}<noinclude>
{{documentation}}
</noinclude>
658r10ag7rv4b2nxz38rgs2wn4gljqn
Template:PAGENAMEBASE
10
29780699
708575225
636280634
2016-03-06T09:37:56Z
Cabayi
6561336
per edit request & discussion
wikitext
text/x-wiki
{{{{{|safesubst:}}}#Invoke:String|replace|{{{1|{{{{{|safesubst:}}}PAGENAME}}}}}|%s+%b()$||1|false}}<noinclude>
{{documentation}}
</noinclude>
sam8aetb68ekom4findu6pp900ngldr
Template:Pagetype
10
23143954
616197024
580855388
2014-07-09T08:29:38Z
Callanecc
10440891
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=
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
Template:Party color
10
68808913
1092682214
1058971863
2022-06-11T21:27:11Z
El C
92203
Changed protection settings for "[[Template:Party color]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:Political party|fetch|{{{1|}}}|color|error{{#if:{{{error|}}}||_NULL}}={{{error|}}}}}</includeonly><noinclude>
{{documentation}}
</noinclude>
tqx1s71z76iem75n1woeejbqi0hkd9s
Template:Party stripe
10
68408402
1068909358
1068905555
2022-01-30T18:55:38Z
Gonnym
14984434
also not needed anymore
wikitext
text/x-wiki
<includeonly><span style="color: {{Party color|{{{1|}}}}};">▌</span></includeonly><noinclude>{{Documentation}}
</noinclude>
ghm7ll8m8ssot0dg1nwx0htvi2r7cgf
Template:Patriot Act
10
12204241
1074721002
1024553854
2022-03-01T20:19:11Z
HandsomeFella
12971673
wikitext
text/x-wiki
{{#invoke:navbox|navbox
| name = Patriot Act
| title = [[Patriot Act]]
| listclass = hlist
| state = {{{state|autocollapse}}}
| above = '''Titles'''
[[Patriot Act, Title I|I]] · [[Patriot Act, Title II|II]] · [[Patriot Act, Title III|III]] · [[Patriot Act, Title IV|IV]] · [[Patriot Act, Title V|V]] · [[Patriot Act, Title VI|VI]] · [[Patriot Act, Title VII|VII]] · [[Patriot Act, Title VIII|VIII]] · [[Patriot Act, Title IX|IX]] · [[Patriot Act, Title X|X]] · [[History of the Patriot Act|History]]
| group2 = Acts modified
| list2 =
* ''[[Omnibus Crime Control and Safe Streets Act of 1968]]''
* ''[[Electronic Communications Privacy Act]]''
* ''[[Computer Fraud and Abuse Act]]''
* ''[[Foreign Intelligence Surveillance Act]]''
* ''[[Family Educational Rights and Privacy Act]]''
* ''[[Money Laundering Control Act]]''
* ''[[Bank Secrecy Act]]''
* ''[[Right to Financial Privacy Act]]''
* ''[[Fair Credit Reporting Act]]''
* ''[[Immigration and Nationality Act of 1952]]''
* ''[[Victims of Crime Act of 1984]]''
* ''[[Telemarketing and Consumer Fraud and Abuse Prevention Act]]''
| group3 = People
| list3 =
* [[George W. Bush]]
* [[John Ashcroft]]
* [[Alberto Gonzales]]
* [[Patrick Leahy]]
* [[Orrin Hatch]]
* [[Jon Kyl]]
* [[Dianne Feinstein]]
* [[Viet D. Dinh]]
* [[Joe Biden]]
* [[Michael Chertoff]]
* [[Barack Obama]]
* [[Eric Holder]]
* [[Chuck Schumer]]
* [[Lamar Smith]]
* [[Bob Graham]]
* [[Jay Rockefeller]]
* [[Arlen Specter]]
* [[Mike Oxley]]
* [[Dick Armey]]
* [[Paul Sarbanes]]
* [[Trent Lott]]
* [[Tom Daschle]]
* [[Russ Feingold]]
* [[Ellen Segal Huvelle|Ellen Huvelle]]
* [[Ron Paul]]
* [[Lisa Murkowski]]
* [[Ron Wyden]]
* [[Dennis Kucinich]]
* [[Larry Craig]]
* [[John E. Sununu]]
* [[Dick Durbin|Richard Durbin]]
* [[Bernie Sanders]]
* [[Jerry Nadler]]
* [[John Conyers|John Conyers Jr.]]
* [[Butch Otter]]
| group4 = Government<br />organizations
| list4 =
* [[Federal Bureau of Investigation]]
* [[United States Department of Justice|Department of Justice]]
* [[United States House Permanent Select Committee on Intelligence|Select Committee on Intelligence]]
* [[United States Department of the Treasury|Department of the Treasury]]
* [[Financial Crimes Enforcement Network|FinCEN]]
* [[United States Department of State|Department of State]]
* [[National Institute of Standards and Technology]]
* [[United States Customs Service|Customs Service]]
* [[U.S. Immigration and Customs Enforcement]]
| group5 = Non-government<br />organizations
| list5 =
* [[American Civil Liberties Union]]
* [[American Library Association]]
* [[Center for Democracy and Technology]]
* [[Center for Public Integrity]]
* [[Electronic Frontier Foundation]]
* [[Electronic Privacy Information Center]]
* [[Humanitarian Law Project]]
}}<noinclude>
{{collapsible option}}
[[Category:United States government navigational boxes]]
</noinclude>
9bqi3pus5jcqfvm6mpufjbjxhesvq1k
Template:Plainlist
10
33825240
818156083
818155363
2018-01-01T22:56:03Z
JJMC89
24812038
actually correct, needed when |1= not present ({{Endplainlist}})
wikitext
text/x-wiki
<div class="plainlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}<noinclude></div>
{{documentation}}
</noinclude>
nztwpfg54h3oaq8h3bzhtwuqxochv0z
Template:Portal
10
1780010
1073012423
1071452869
2022-02-20T15:46:07Z
Plastikspork
5075409
[[Wikipedia:Templates for discussion/Log/2022 February 12#Template:Portal-mobile]] closed as merge ([[WP:XFDC#4.0.13|XFDcloser]])
wikitext
text/x-wiki
<includeonly>{{#invoke:Portal|portal}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata -->
</noinclude>
eu0a2ons0y70cfblniy3kcxuib58bvt
Template:Portal-inline
10
29721761
1073025848
877251078
2022-02-20T17:10:52Z
Plastikspork
5075409
Reduce [[WP:PEIS]]
wikitext
text/x-wiki
<includeonly>{{#invoke:portal-inline|main}}</includeonly><noinclude>
{{documentation}}
</noinclude>
59pmb09lnoedkobsacr61f1g7uauw8u
Template:Pp
10
43132240
761735106
695624743
2017-01-24T15:07:04Z
Xaosflux
502540
Changed protection level for "[[Template:Pp]]": is linked from cascaded main page, moving would be very disruptive ([Edit=Require template editor access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#invoke:Protection banner|main}}<noinclude>
{{documentation}}
</noinclude>
8rt1snyv5yit3jnuzrbl00negaj27e5
Template:Pp-move
10
10225964
987098958
985280164
2020-11-04T22:21:55Z
Primefac
11508456
TFD closed as remove the icon ([[WP:XFDC|XFDcloser]])
wikitext
text/x-wiki
<includeonly>{{#invoke:Protection banner|main}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
5t6lal9n9hcpwsso2obr7pcyjbg26xc
Template:Pp-move-indef
10
20814756
1035904595
1035430686
2021-07-28T10:06:30Z
ProcrastinatingReader
32939139
this *should* work
wikitext
text/x-wiki
#REDIRECT [[Template:Pp-move]]
i8ohwc8imrq21g4f1h3q96drkvop00u
Template:Pp-semi
10
10596961
774346835
667569400
2017-04-07T20:34:19Z
Jo-Jo Eumerus
17449355
Changed protection level for "[[Template:Pp-semi]]": Matching redirect target ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite))
wikitext
text/x-wiki
#REDIRECT [[Template:Pp]]
[[Category:Top icon protection templates|{{PAGENAME}}]]
dmjz94i05ph4b95q6wjtqxnd2h9bph5
Template:Redirect2
10
3327170
1039341517
712707491
2021-08-18T04:34:24Z
Oshwah
3174456
Changed protection settings for "[[Template:Redirect2]]": High risk template. ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:Redirect hatnote|redirect|2}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
3mvdee4shv6bu0fmlmv1z9yiape37ci
Template:Refbegin
10
9391283
1054258436
999372035
2021-11-09T00:30:45Z
Izno
2927383
-refbegin-100, see styles page history for rationale
wikitext
text/x-wiki
<includeonly><templatestyles src="Refbegin/styles.css" /><!--
--><div class="refbegin <!--
-->{{#if: {{{indent|}}} | refbegin-hanging-indents }} <!--
-->{{#if: {{{1|}}}
| refbegin-columns {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }}
| references-column-width
| references-column-count references-column-count-{{#if:1|{{{1}}}}} }}
| {{#if: {{{colwidth|}}}
| references-column-width }} }}" style="<!--
-->{{#if: {{{1|}}}
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }}
| column-width: {{#if:1|{{{1|30em}}}}}
| column-count: {{#if:1|{{{1}}}}}; }}
| {{#if: {{{colwidth|}}}
| column-width: {{{colwidth|30em}}} }} }}"></includeonly><noinclude>
{{Documentation}}
</noinclude>
phti1gd1af94q1ec12mn1uqky2cbl6p
Template:Refbegin/styles.css
10
58037900
1054258005
1011217839
2021-11-09T00:27:00Z
Izno
2927383
-.refbegin-100, used in just 100 of 200k articles. suitable alternative at [[template:Div col]]
sanitized-css
text/css
/* {{pp-template}} */
.refbegin {
font-size: 90%;
margin-bottom: 0.5em;
}
.refbegin-hanging-indents > ul {
margin-left: 0;
}
.refbegin-hanging-indents > ul > li {
margin-left: 0;
padding-left: 3.2em;
text-indent: -3.2em;
}
.refbegin-hanging-indents ul,
.refbegin-hanging-indents ul li {
list-style: none;
}
@media (max-width: 720px) {
.refbegin-hanging-indents > ul > li {
padding-left: 1.6em;
text-indent: -1.6em;
}
}
.refbegin-columns {
margin-top: 0.3em;
}
/* Reset top margin for lists embedded in columns */
.refbegin-columns ul {
margin-top: 0;
}
/* Avoid elements breaking between columns */
.refbegin-columns li {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}
4q8lm27loa8oa0mutzhmgc4bt8d7qlg
Template:Refend
10
10023179
792167400
772120878
2017-07-24T21:40:56Z
WOSlinker
3138265
remove </dl> since no <dl> in Template:Refbegin
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{template doc|Template:refbegin/doc}}
{{TemplateDataHeader}}
<templatedata>
{
"description": "Ends a reference lists started by {{refbegin}}.",
"params": {
}
}
</templatedata>
</noinclude>
kcrxzrf6v4rvbl0yhnfcb5labufpnsp
Template:Replace
10
38650247
1073507451
1054379252
2022-02-23T02:25:08Z
Xaosflux
502540
Changed protection settings for "[[Template:Replace]]": 1MM+ uses ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|plain={{{plain|true}}}|count={{{count|}}}}}<noinclude>
{{documentation}}
</noinclude>
7nqxv5kwvok0dz443yff5lxmdev97ci
Template:Respell
10
18424549
787004057
781138680
2017-06-22T21:11:34Z
Nardog
5908908
<includeonly>
wikitext
text/x-wiki
<includeonly>{{#invoke:Respell|main}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
10gg5a0ckpnnxl2bu05fvyimn0kc69u
Template:S-ach
10
8312509
897725147
789634574
2019-05-18T23:16:18Z
DannyS712
34581532
combine duplicate cases
wikitext
text/x-wiki
<includeonly>|-
! colspan="3" style="border-top: 5px solid #FFF179;" |{{#if:{{{1}}}||Awards and achievements titles}}{{#switch:{{{1}}}
|#default={{#if:{{{1}}}|Awards and achievements}}
|rec
|records=Records
|aw
|awards=Awards
|ach
|achievements=Achievements
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
68fmx19d1poom362paxatxgcd15boyd
Template:S-aft
10
3049127
1054797508
1054797045
2021-11-12T04:32:16Z
Neveselbert
25820411
rm, see [[Special:Diff/1054385466]]
wikitext
text/x-wiki
<includeonly>| style="width: 30%; text-align: center;" rowspan="{{{rows|1}}}"| Succeeded by<div style="font-weight: bold">{{Delink question hyphen-minus|{{{after}}}}}{{S-aft/filter|{{{after2|}}}}}{{S-aft/filter|{{{after3|}}}}}{{S-aft/filter|{{{after4|}}}}}{{S-aft/filter|{{{after5|}}}}}{{S-aft/filter|{{{after6|}}}}}{{S-aft/filter|{{{after7|}}}}}{{S-aft/filter|{{{after8|}}}}}{{S-aft/filter|{{{after9|}}}}}{{S-aft/filter|{{{after10|}}}}}</div>{{#if:{{{as|}}}|<small>'''''as {{{as}}}'''''</small>}}
|-</includeonly><noinclude>
{{documentation}}
</noinclude>
gi8z26w8e6eyxb08ij184ppneq1xn79
Template:S-aft/filter
10
56336810
894297259
882210283
2019-04-26T23:09:55Z
Cabayi
6561336
doc
wikitext
text/x-wiki
{{#if:{{{1|}}}|<br />{{Delink question hyphen-minus|{{{1}}}}}}}<noinclude>{{documentation}}</noinclude>
9yvgjltqe4ow99syla3b1gl0vms4tzh
Template:S-bef
10
3049117
1054385466
1049439333
2021-11-09T18:45:51Z
Jonesey95
9755426
rm br tags that produce excessive white space; not needed now that we have div tags
wikitext
text/x-wiki
<includeonly>|- style="text-align:center;"
|style="width:30%;" rowspan="{{{rows|1}}}"|Preceded by<div style="font-weight: bold">{{Delink question hyphen-minus|{{{before}}}}}{{S-bef/filter|{{{before2|}}}}}{{S-bef/filter|{{{before3|}}}}}{{S-bef/filter|{{{before4|}}}}}{{S-bef/filter|{{{before5|}}}}}{{S-bef/filter|{{{before6|}}}}}{{S-bef/filter|{{{before7|}}}}}{{S-bef/filter|{{{before8|}}}}}{{S-bef/filter|{{{before9|}}}}}{{S-bef/filter|{{{before10|}}}}}</div>{{#if:{{{as|}}}|<small>'''''as {{{as}}}'''''</small>}}</includeonly><noinclude>
{{documentation}}
</noinclude>
hz6etnkbwqmi1j9k0jqjjnttgri9297
Template:S-bef/filter
10
56336730
894297190
882210238
2019-04-26T23:09:12Z
Cabayi
6561336
doc
wikitext
text/x-wiki
{{#if:{{{1|}}}|<br />{{Delink question hyphen-minus|{{{1}}}}}}}<noinclude>{{documentation}}</noinclude>
9yvgjltqe4ow99syla3b1gl0vms4tzh
Template:S-dip
10
6571309
789634609
784141001
2017-07-08T15:17:58Z
Ahecht
2016996
Reverted 1 edit by [[Special:Contributions/Ahecht|Ahecht]] ([[User talk:Ahecht|talk]]): Site CSS fixed — workaround no longer needed. ([[WP:TW|TW]])
wikitext
text/x-wiki
<includeonly>|-
! colspan="3" style="border-top: 5px solid #FACEFF;" | Diplomatic posts
</includeonly><noinclude>
{{documentation}}
</noinclude>
eoylp9gt6e90rk6ulha4c2375d4i1gk
Template:S-end
10
9538337
874025922
577843591
2018-12-16T17:34:28Z
Amorymeltzer
141948
Changed protection level for "[[Template:S-end]]": [[WP:High-risk templates|Highly visible template]]: 230k transclusions ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
|}<noinclude>{{documentation}}</noinclude>
kw6nijp2wezrl0ixc3g0cobi6i0424g
Template:S-off
10
3345854
841353081
841352852
2018-05-15T09:54:00Z
Cabayi
6561336
Undid revision 841352852 by [[Special:Contributions/Matt Fitzpatrick|Matt Fitzpatrick]] ([[User talk:Matt Fitzpatrick|talk]]) revert breaking change
wikitext
text/x-wiki
<includeonly>|-
! colspan="3" style="border-top: 5px solid #ccccff;" | Political offices
</includeonly><noinclude>
{{documentation}}
</noinclude>
k96asib5e35yu76s06x2ulpzl11ig3k
Template:S-par
10
3462512
789634778
784141948
2017-07-08T15:19:19Z
Ahecht
2016996
Reverted 1 edit by [[Special:Contributions/Ahecht|Ahecht]] ([[User talk:Ahecht|talk]]): Site CSS fixed — workaround no longer needed. ([[WP:TW|TW]])
wikitext
text/x-wiki
<noinclude>{{s-start}}
</noinclude>|-
! colspan="3" style="border-top: 5px solid #cccccc" | {{#ifexist:Template:S-par/{{trim|{{{1}}}}}
|{{S-par/{{trim|{{{1}}}}}}}
|{{#if:{{{raw|}}}
|{{{raw}}}
|{{#if:{{{1|}}}
|{{error|Unrecognised parameter}}
|Assembly seats
}}
}}
}}<noinclude>
{{s-end}}
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here. -->
</noinclude>
hivn0hf6o127ldjw2bx6i16hbdvuz9x
Template:S-par/us-il-sen
10
32083739
893798228
577890238
2019-04-23T16:50:35Z
Cabayi
6561336
doc per req
wikitext
text/x-wiki
[[Illinois Senate]]<noinclude>{{documentation}}</noinclude>
pg5i64ewzoeo6z6ic8xqg5iusf78bu2
Template:S-par/us-sen
10
32083394
893722615
789822279
2019-04-23T05:21:49Z
Cabayi
6561336
per req
wikitext
text/x-wiki
[[United States Senate|U.S. Senate]]<noinclude>{{documentation}}</noinclude>
p1ev97kgv76r7snzcx50j0m6g4yir4o
Template:S-ppo
10
6716318
789634786
784142039
2017-07-08T15:19:22Z
Ahecht
2016996
Reverted 1 edit by [[Special:Contributions/Ahecht|Ahecht]] ([[User talk:Ahecht|talk]]): Site CSS fixed — workaround no longer needed. ([[WP:TW|TW]])
wikitext
text/x-wiki
<includeonly>|-
! colspan="3" style="border-top: 5px solid #FFBF00;" | Party political offices
</includeonly><noinclude>
{{documentation}}
</noinclude>
4kuivtf7ovmvypt292h39gwcenr0dr4
Template:S-prec
10
8238229
876366066
789634866
2019-01-01T22:40:03Z
Muboshgu
602857
[[MOS:CURRENTLY]] / [[WP:PRECISELANG]]
wikitext
text/x-wiki
<includeonly>|-
! colspan="3" style="border-top: 5px solid #cfc;" | {{#switch: {{{1}}}
| ew = [[Order of precedence in England and Wales]]
| sc = [[Order of precedence in Scotland]]
| ni = [[Order of precedence in Northern Ireland]]
| uk = [[Orders of precedence in the United Kingdom]]
| usa = [[United States order of precedence|U.S. order of precedence]] (ceremonial)
| us-pres = [[United States presidential line of succession|U.S. presidential line of succession]]
| #default = Order of precedence
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here. -->
</noinclude>
gey4pkp3mjj7yrgm3l8k1vxpcp5fxxv
Template:S-start
10
3048892
1035421953
789575592
2021-07-25T15:41:35Z
Trialpears
35786750
Add noprint class as [[Category:Exclude in print]] which was used haven't worked for years
wikitext
text/x-wiki
{| class="wikitable succession-box noprint" style="margin:0.5em auto; font-size:95%;{{#if:{{{noclear|}}}||clear:both;}}"<noinclude>
|''Start of centred table''
|}
{{documentation}}
{{/TemplateData}}
<!--NB Add metadata to the /doc page linked above, not here; thanks!-->
</noinclude>
aw6arjv2vjaxgaggp8vs9r36e3rubuq
Template:S-ttl
10
3049121
1049440853
1046715469
2021-10-11T21:05:13Z
Jonesey95
9755426
nowiki tags are no longer needed here to prevent bad formatting. Line breaks in title= still cause Linter errors though.
wikitext
text/x-wiki
<includeonly>| style="width: 40%; text-align: center;" rowspan="{{{rows|1}}}"|'''{{#if:{{{order|}}}|{{{order}}} }} {{{title}}} '''{{#if:{{{district|}}}|<br /><small>'''''Representative for {{{district}}}'''''</small>|}}{{#if:{{{dynasty|}}}|<br />''{{{dynasty}}}''|}}{{#if:{{{creation|}}}|<br />''{{{creation}}}''|}}{{#if:{{{years|}}}|<br />{{{years}}}|}}{{#if:{{{regent1|}}}|<br />''with {{{regent1}}}''|}} {{#if:{{{years1|}}}| <small>'' ({{{years1}}})''</small>|}}{{#if:{{{regent2|}}}|<br />''{{{regent2}}}''|}} {{#if:{{{years2|}}}| <small>'' ({{{years2}}})''</small>|}}{{#if:{{{regent3|}}}|<br />''{{{regent3}}}''|}} {{#if:{{{years3|}}}| <small>'' ({{{years3}}})''</small>|}}{{#if:{{{regent4|}}}|<br />''{{{regent4}}}''|}} {{#if:{{{years4|}}}| <small>'' ({{{years4}}})''</small>|}}{{#if:{{{regent5|}}}|<br />''{{{regent5}}}''|}} {{#if:{{{years5|}}}| <small>'' ({{{years5}}})''</small>|}}{{#if:{{{regent6|}}}|<br />''{{{regent6}}}''|}} {{#if:{{{years6|}}}| <small>'' ({{{years6}}})''</small>|}}{{#if:{{{regent7|}}}|<br />''{{{regent7}}}''|}} {{#if:{{{years7|}}}| <small>'' ({{{years7}}})''</small>|}}{{#if:{{{regent8|}}}|<br />''{{{regent8}}}''|}} {{#if:{{{years8|}}}| <small>'' ({{{years8}}})''</small>|}}{{#if:{{{alongside|}}}|<br /><small>Served alongside: '''{{{alongside}}}'''</small>|}}{{#if:{{{under|}}}|<br /><small>Served under: '''{{{under}}}'''</small>|}}{{#if:{{{with|}}}|<br /><small>With: '''{{{with}}}{{#if:{{{with2|}}}|<br />{{{with2}}}|}}{{#if:{{{with3|}}}|<br />{{{with3}}}|}}{{#if:{{{with4|}}}|<br />{{{with4}}}|}}{{#if:{{{with5|}}}|<br />{{{with5}}}|}}{{#if:{{{with6|}}}|<br />{{{with6}}}|}}{{#if:{{{with7|}}}|<br />{{{with7}}}|}}{{#if:{{{with8|}}}|<br />{{{with8}}}|}}{{#if:{{{with9|}}}|<br />{{{with9}}}|}}{{#if:{{{with10|}}}|<br />{{{with10}}}|}}{{#if:{{{with11|}}}|<br />{{{with11}}}|}}{{#if:{{{with12|}}}|<br />{{{with12}}}|}}{{#if:{{{with13|}}}|<br />{{{with13}}}|}}{{#if:{{{with14|}}}|<br />{{{with14}}}|}}{{#if:{{{with15|}}}|<br />{{{with15}}}|}}{{#if:{{{with16|}}}|<br />{{{with16}}}|}}{{#if:{{{with17|}}}|<br />{{{with17}}}|}}{{#if:{{{with18|}}}|<br />{{{with18}}}|}}{{#if:{{{with19|}}}|<br />{{{with19}}}|}}{{#if:{{{with20|}}}|<br />{{{with20}}}|}}{{#if:{{{with21|}}}|<br />{{{with21}}}|}}{{#if:{{{with22|}}}|<br />{{{with22}}}|}}{{#if:{{{with23|}}}|<br />{{{with23}}}|}}{{#if:{{{with24|}}}|<br />{{{with24}}}|}}{{#if:{{{with25|}}}|<br />{{{with25}}}|}}'''</small>|}}{{#if:{{{lords|}}}|<br /><small>''Member of the [[House of Lords]]''<br />''({{{lords}}})''</small>|}}</includeonly><noinclude>
{{documentation}}
</noinclude>
jhsd2qd9broycdvzkdzv3zcfp9w145u
Template:SDcat
10
64752604
971699885
971165861
2020-08-07T18:02:31Z
MusikBot II
29539620
Protected "[[Template:SDcat]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<includeonly>{{#invoke:SDcat |setCat}}</includeonly><noinclude>
{{documentation}}
</noinclude>
gejktck2ca8vfelabmrprhfecoxzlpi
Template:See also
10
1721254
763260609
725632232
2017-02-02T05:40:25Z
Nihiltres
236191
Updated from sandbox to use [[Module:Labelled list hatnote]]
wikitext
text/x-wiki
<includeonly>{{#invoke:Labelled list hatnote|labelledList|See also}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
dn9i3dv2bt8lqifr6vkbycoya78rnav
Template:SfnRef
10
25072600
965983067
958078171
2020-07-04T15:54:11Z
Ahecht
2016996
safesubst<noinclude />:
wikitext
text/x-wiki
{{safesubst<noinclude />:#invoke:Footnotes|sfnref}}<noinclude>
{{documentation}}
</noinclude>
a5bwsbkzmzfw9xjrhfy0ur5p5priatn
Template:Short description
10
55686718
1071437311
1066790170
2022-02-12T16:33:32Z
ToBeFree
16759563
Changed protection settings for "[[Template:Short description]]": 4 million transclusions ([[WP:HRT]]) ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#ifeq:{{lc:{{{1|}}}}}|none|<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>[[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with short description{{#ifeq:{{{pagetype}}}|Disambiguation pages|s}}]]</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]]}}<!--
-->{{Short description/lowercasecheck|{{{1|}}}}}<!--
-->{{Main other |{{SDcat |sd={{{1|}}} }} }}<noinclude>
{{Documentation}}
</noinclude>
t36h9ek56znujq09ne6dfagkel1cjk9
Template:Short description/lowercasecheck
10
69815941
1071437571
1071316119
2022-02-12T16:35:05Z
ToBeFree
16759563
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))
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
Template:Sidebar
10
1960394
960641546
959179329
2020-06-04T02:43:13Z
Primefac
11508456
TFD closed as keep ([[WP:XFDC|XFDcloser]])
wikitext
text/x-wiki
{{#invoke:Sidebar|sidebar}}<noinclude>
{{documentation}}</noinclude>
jzouzofoaugku1umcgwhk1sk23s7qrm
Template:Sidebar/US President
10
55150062
819689500
799112441
2018-01-10T19:26:02Z
Primefac
11508456
Protected "[[Template:Sidebar/US President]]": [[WP:SEMI|semi-protecting]] highly-visible templates in response to recent template-space vandalism ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed a...
wikitext
text/x-wiki
#REDIRECT [[Template:Sidebar person/US President]]
{{R from move}}
1gf7p7u5jhc60shqzddlo6htz3wtsy4
Template:Sidebar person
10
55149776
993804675
987331612
2020-12-12T16:11:30Z
Jonesey95
9755426
Fix too small font per [[MOS:FONTSIZE]]. Text was at 82% of normal after all adjustments.
wikitext
text/x-wiki
<includeonly>{{Sidebar
| name = {{{template|}}}
| class = vcard hlist
| style = border: 4px double {{#if:{{{border_color|}}}|{{{border_color|}}}|#d69d36}}
| wraplinks = {{{wraplinks|}}}
| titlestyle = font-size: 110%; padding: 0; line-height: 150%;
| title =
<table><tr>
<td style="background:{{#if:{{{background_color|}}}|{{{background_color|}}}|#002466}}; vertical-align:middle; padding:5px;">[[File:{{{portrait|{{Trim|{{{2|No Picture.jpg}}}}}}}}|75px|border]]</td>
<td style="background:{{#if:{{{background_color|}}}|{{{background_color|}}}|#002466}}; vertical-align:middle; padding:6px; width:100%;"><div style="font-size:88%; line-height:normal;">{{color|{{#if:{{{font_color|}}}|{{{font_color|}}}|#FFF}}|This article is part of <br/>a series about}}</div><span class="vcard"><span class="fn">[[{{{person|}}}|{{color|{{#if:{{{font_color|}}}|{{{font_color|}}}|#FFF}}|{{{person|}}}}}]]</span></span></td>
</tr></table>
| contentstyle = padding:0.3em;
| navbarstyle = text-align:center;
| content1 = {{{contents|}}}
----
{{#if:{{{signature|}}}|{{#ifeq:{{PAGENAME}}|{{{person|}}}|<!-- Exclude signature from Person's main biography page, where it is already displayed in the infobox. -->|
[[File:{{{signature|}}}|{{#if:{{{sig_width|}}}|{{{sig_width|}}}|90px}}|link={{{person|}}}|{{{person|}}}'s signature]]<br/>}}}}
{{#if:{{{seal|}}}|[[File:{{{seal|}}}|{{#if:{{{seal_width|}}}|{{{seal_width|}}}|40px}}]]}}
{{{bottom|}}}
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
n5vhrn9tiikhqqgj8hk7nui3bdxvmup
Template:Sidebar person/US President
10
52996727
1090104563
1090104298
2022-05-27T12:04:34Z
MSGJ
42630
use PAGENAME instead of [[Template:Remove file prefix]]
wikitext
text/x-wiki
<includeonly>{{Sidebar person
| template = {{{template|}}}
| wraplinks = true
| person = {{{president|}}}
| portrait = {{PAGENAME:{{{portrait|}}}}}
| signature = {{#if:{{{signature|}}} |
{{#ifeq:{{PAGENAME}}|{{{president|}}} | |<!-- Exclude signature from President's main biography page, where it is already displayed in the infobox. -->
{{PAGENAME:{{{signature|}}}}} }}
}}
| sig_width = {{{sig_width|{{{sig-width|150px}}}}}}
| seal = Seal of the President of the United States.svg{{!}}link={{!}}alt=Seal of the President of the United States
| seal_width = 70px
| background_color = #002466
| border_color = #d69d36
| contents = {{{contents|}}}
| bottom = {{{bottom|}}}
}}</includeonly><noinclude>
{{Documentation}}
[[Category:United States political leader sidebar templates| ]]
</noinclude>
5z9f7y8hfs6uv07t3m4e4yq7w6tf1x4
Template:Single+double
10
19016652
872211753
872211590
2018-12-05T22:04:58Z
SMcCandlish
378390
woops, my finger slipped
wikitext
text/x-wiki
<span style="padding-right:.15em;">'</span>"<noinclude>
{{Documentation}}
<!--Add interwikis and categories to the /doc subpage.-->
</noinclude>
ojmofv511ji52y5zk6s39zf3lu18t0r
Template:Single+space
10
27335020
872211979
850485299
2018-12-05T22:06:40Z
SMcCandlish
378390
Re-kerning to match width of hair-space instead of thin-space.
wikitext
text/x-wiki
<span style="padding-right:0.15em;">'</span><noinclude>
{{Documentation}}
</noinclude>
jjvdjkkd9qghp7zm661m72go25rvz44
Template:Small
10
2385304
1066167302
1064748786
2022-01-17T03:43:07Z
Explicit
4842600
[[Wikipedia:Templates for discussion/Log/2022 January 10#Template:Smaller]] closed as merge ([[WP:XFDC#4.0.12|XFDcloser]])
wikitext
text/x-wiki
<span style="font-size:85%;">{{{1}}}</span><includeonly>{{SAFESUBST:#if:{{{1|}}}||[[Category:Pages using small with an empty input parameter]]}}</includeonly><noinclude>
{{Documentation}}<!--Categories and interwikis go in the /doc sub-page.-->
</noinclude>
dvonxxvea06kvln677gbl2xk9rrnlog
Template:Spaces
10
5660335
687408551
663789983
2015-10-25T11:38:26Z
Edokter
1624037
use class
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
Template:Str ≥ len
10
22119747
1016292165
1016291968
2021-04-06T11:38:38Z
Elli
20842734
Undid revision 1016291968 by [[Special:Contributions/Elli|Elli]] ([[User talk:Elli|talk]]) wrong template, damn it!
wikitext
text/x-wiki
{{{{{|safesubst:}}}#ifexpr: {{{{{|safesubst:}}}#invoke:String|len|s={{{1|}}}}} >= {{{2|0}}} <noinclude><!-- str >= len --></noinclude>
| {{{3|}}}
| {{{4|}}}
}}<noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
5n8ijb7krko6nhwqukd6gap519qlr6k
Template:Subject bar
10
30675556
942385494
890307388
2020-02-24T10:07:56Z
Koavf
205121
Seems to be adding a line break somehow...
wikitext
text/x-wiki
{{#invoke:subject bar|main}}<noinclude>{{documentation}}<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --></noinclude>
sjnj97dy727n2yf1xszs3jmc8kbtny0
Template:Subscription required
10
19379091
827245669
557964233
2018-02-23T16:30:25Z
Primefac
11508456
Changed protection level for "[[Template:Subscription required]]": [[WP:HIGHRISK|high-risk]] template with 4000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
{{#if:{{{via|}}}| – via {{{via}}} {{link note|note={{#switch: {{{1|not-sentence}}}
| s
| sentence = Subscription required.
| subscription required
}}}} [[Category:Subscription required using via]]|{{link note|note={{#switch: {{{1|not-sentence}}}
| s
| sentence = Subscription required.
| subscription required
}}}}
}}<includeonly>[[Category:Pages containing links to subscription-only content]]</includeonly><noinclude>{{documentation}}</noinclude>
ovlbbshxtrywzhvxvfo97bgqa527wsg
Template:TOC limit
10
10794362
872451201
645375001
2018-12-07T07:36:09Z
TheDJ
244887
Use template styles
wikitext
text/x-wiki
<templatestyles src="Template:TOC limit/styles.css" /><div class="toclimit-{{{1|{{{limit|3}}}}}}">__TOC__</div><noinclude>
{{documentation}}
</noinclude>
dwdn99dxyfhkqqw4i3lmafbzsxd31mr
Template:TOC limit/styles.css
10
59293976
886046785
872693506
2019-03-03T23:36:55Z
Pppery
28032115
Adding protection template
sanitized-css
text/css
/* {{pp-template}}
Allow limiting of which header levels are shown in a TOC;
<div class="toclimit-3">, for instance, will limit to
showing ==headings== and ===headings=== but no further
(as long as there are no =headings= on the page, which
there shouldn't be according to the MoS). */
.toclimit-2 .toclevel-1 ul,
.toclimit-3 .toclevel-2 ul,
.toclimit-4 .toclevel-3 ul,
.toclimit-5 .toclevel-4 ul,
.toclimit-6 .toclevel-5 ul,
.toclimit-7 .toclevel-6 ul {
display: none;
}
clkz25e6xu067l6ec31e9unokrhkflm
Template:Template link
10
1487430
1014201710
1012903429
2021-03-25T19:03:22Z
Izno
2927383
[[Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu]] closed as keep ([[WP:XFDC#4.0.11|XFDcloser]])
wikitext
text/x-wiki
{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
rf3qx5cilaxlnjqq9fivevkah92ncil
Template:Template other
10
21418395
874062289
774731050
2018-12-16T22:06:25Z
Amorymeltzer
141948
Changed protection level for "[[Template:Template other]]": [[WP:High-risk templates|Highly visible template]]: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
wikitext
text/x-wiki
{{#switch:
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|{{ns:Template}}
| template
| other
}}
}}
| template = {{{1|}}}
| other
| #default = {{{2|}}}
}}<!--End switch--><noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
0tcssjmltwl7y5v3f5wj2kqciaabqly
Template:Tfm/dated
10
51277497
1010907353
974868320
2021-03-08T00:08:08Z
SMcCandlish
378390
markup cleanup (<br> isn't an outright error in HTML5, but it confuses some syntax highlighters, etc.)
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||type= |page= |link= |help= |$B={{#ifeq:{{{bigbox|<noinclude>yes</noinclude>}}}|yes|{{Ombox
|type = move
|image = none
|class = nomobile mbox-tfd
|small = {{{small|no}}}
|text = This {{#ifeq:{{lc:{{{type}}}}}|module|[[Help:Module|module]]|[[Help:Template|template]]}} is '''being considered for merging with [[{{#ifeq:{{lc:{{{type}}}}}|module|Module|Template}}:{{{otherpage}}}]].''' Please discuss this matter at [[{{{link}}}|'''this {{#ifeq:{{lc:{{{type}}}}}|module|module|template}}'s entry''']] at templates for discussion to help reach a consensus.
{{#ifeq:{{{help}}}|off||----
''<small class="plainlinks" style="line-height:1.3em;">[[Wikipedia:Maintenance|Maintenance]] use only:<br />1. [{{fullurl:{{{link}}}|action=edit&editintro=Wikipedia:Templates_for_discussion/editnotice§ion=1}} Edit the TfD log] to create the discussion entry.<br />2. Please consider notifying the [{{fullurl:{{FULLPAGENAME}}|action=history}} author(s)] by placing <span class="nowrap">{{tlx|Tfmnotice|{{{page}}}|{{{otherpage}}}|subst=yes}} <nowiki>~~~~</nowiki></span> on their talk page(s).</small>''
}}}}{{category handler
| all = [[Category:Templates for merging]]
| nocat = {{{nocat|{{#ifeq:{{Template:FULLBASEPAGENAME|{{FULLBASEPAGENAME}}}}|Template:Tfm|true}}}}}
| category2 = {{{category|¬}}}
}}|{{#switch:{{lc:{{{type}}}}}
|tiny = <span style="padding: 0; font-size: xx-small; font-weight: bold; color: #000000; background-color: #f9f9f9;" class="tfd">[[{{{link}}}|‹See TfM›]]</span>
|inline = <span style="padding: 0; font-size: xx-small; color: #000; border: 1px solid #aaa; background-color: #f9f9f9;" class="tfd">‹The [[Help:Template|template]] ''[[Template:{{{page}}}|{{{page}}}]]'' is being [[{{{link}}}|considered for merging]].›</span>
|infobox|box|sidebar = <div class="boilerplate metadata plainlinks tfd" id="tfd" style="background-color: transparent; padding: 0 0.2em; color: #000; text-align: center; position: relative; float: right; clear: right; width: {{#if:{{{width|}}}|{{{width}}}|20em}}"><span style="font-size: xx-small;">‹ The [[Help:Template|template]] ''[[Template:{{{page}}}|{{{page}}}]]'' is being [[{{{link}}}|considered for merging]]. ›</span></div>
|disabled = <!-- No output -->
|#default = <div class="boilerplate metadata plainlinks tfd" id="tfd" style="background-color: transparent; padding: 0; font-size:xx-small; color:#000000; text-align: center; border-bottom:1px solid #AAAAAA; overflow:hidden;">‹ The [[Help:Template|template]] below (''[[Template:{{{page}}}|{{{page}}}]]'') is being considered for merging. See [[{{{link}}}|templates for discussion]] to help reach a consensus. ›</div>
}}}}}}<noinclude>
{{Documentation}}
</noinclude>
1pqp4ubgkr7yaanfrp3bz0b0ac7yxjp
Template:Time Persons of the Year
10
15715927
1091883386
1065214698
2022-06-06T23:32:12Z
Xaosflux
502540
bypass redirect template
wikitext
text/x-wiki
{{#invoke:Navbox|navbox
| name = Time Persons of the Year
| title = [[Time Person of the Year|''Time'' Persons of the Year]]
| state = {{{state<includeonly>|autocollapse</includeonly>}}}
| selected = {{{1|}}}
| nowrapitems = yes
| bodyclass = hlist
| group1 = 1927–1950
| list1 =
* [[Charles Lindbergh]] (1927)
* [[Walter Chrysler]] (1928)
* [[Owen D. Young]] (1929)
* [[Mahatma Gandhi|Mohandas Gandhi]] (1930)
* [[Pierre Laval]] (1931)
* [[Franklin D. Roosevelt]] (1932)
* [[Hugh S. Johnson]] (1933)
* [[Franklin D. Roosevelt]] (1934)
* [[Haile Selassie]] (1935)
* [[Wallis Simpson]] (1936)
* [[Chiang Kai-shek]] / [[Soong Mei-ling]] (1937)
* [[Adolf Hitler]] (1938)
* [[Joseph Stalin]] (1939)
* [[Winston Churchill]] (1940)
* [[Franklin D. Roosevelt]] (1941)
* [[Joseph Stalin]] (1942)
* [[George C. Marshall|George Marshall]] (1943)
* [[Dwight D. Eisenhower]] (1944)
* [[Harry S. Truman]] (1945)
* [[James F. Byrnes]] (1946)
* [[George C. Marshall|George Marshall]] (1947)
* [[Harry S. Truman]] (1948)
* [[Winston Churchill]] (1949)
* [[Korean War|The American Fighting-Man]] (1950)
| group2 = 1951–1975
| list2 =
* [[Mohammad Mosaddegh|Mohammed Mosaddeq]] (1951)
* [[Elizabeth II ]] (1952)
* [[Konrad Adenauer]] (1953)
* [[John Foster Dulles]] (1954)
* [[Harlow Curtice]] (1955)
* [[Hungarian Revolution of 1956|Hungarian Freedom Fighters]] (1956)
* [[Nikita Khrushchev]] (1957)
* [[Charles de Gaulle]] (1958)
* [[Dwight D. Eisenhower]] (1959)
* {{wrap | U.S. Scientists: [[George Beadle]] / [[Charles Stark Draper|Charles Draper]] / [[John Franklin Enders|John Enders]] / [[Donald A. Glaser]] / [[Joshua Lederberg]] / [[Willard Libby]] / [[Linus Pauling]] / [[Edward Mills Purcell|Edward Purcell]] / [[Isidor Isaac Rabi|Isidor Rabi]] / [[Emilio Segrè]] / [[William Shockley]] / [[Edward Teller]] / [[Charles H. Townes|Charles Townes]] / [[James Van Allen]] / [[Robert Burns Woodward|Robert Woodward]] }} (1960)
* [[John F. Kennedy]] (1961)
* [[Pope John XXIII]] (1962)
* [[Martin Luther King Jr.]] (1963)
* [[Lyndon B. Johnson]] (1964)
* [[William Westmoreland]] (1965)
* [[Baby boomers|The Generation Twenty-Five and Under]] (1966)
* [[Lyndon B. Johnson]] (1967)
* {{wrap | [[Apollo 8|The Apollo 8 Astronauts]]: [[William Anders]] / [[Frank Borman]] / [[Jim Lovell]] }} (1968)
* [[Middle America (United States)|The Middle America]]ns (1969)
* [[Willy Brandt]] (1970)
* [[Richard Nixon]] (1971)
* [[Henry Kissinger]] / [[Richard Nixon]] (1972)
* [[John Sirica]] (1973)
* [[Faisal of Saudi Arabia|King Faisal]] (1974)
* {{wrap | American Women: [[Susan Brownmiller]] / [[Kathleen Byerly]] / [[Alison Cheek]] / [[Jill Ker Conway|Jill Conway]] / [[Betty Ford]] / [[Ella Grasso]] / [[Carla Anderson Hills|Carla Hills]] / [[Barbara Jordan]] / [[Billie Jean King]] / [[Susie Sharp]] / [[Carol Sutton]] / [[Addie L. Wyatt|Addie Wyatt]] }} (1975)
| group3 = 1976–2000
| list3 =
* [[Jimmy Carter]] (1976)
* [[Anwar Sadat]] (1977)
* [[Deng Xiaoping]] (1978)
* [[Ruhollah Khomeini|Ayatollah Khomeini]] (1979)
* [[Ronald Reagan]] (1980)
* [[Lech Wałęsa]] (1981)
* [[Personal computer|The Computer]] (1982)
* [[Ronald Reagan]] / [[Yuri Andropov]] (1983)
* [[Peter Ueberroth]] (1984)
* [[Deng Xiaoping]] (1985)
* [[Corazon Aquino]] (1986)
* [[Mikhail Gorbachev]] (1987)
* [[Environmentalism|The Endangered Earth]] (1988)
* [[Mikhail Gorbachev]] (1989)
* [[George H. W. Bush]] (1990)
* [[Ted Turner]] (1991)
* [[Bill Clinton]] (1992)
* {{wrap | The Peacemakers: [[Yasser Arafat]] / [[F. W. de Klerk]] / [[Nelson Mandela]] / [[Yitzhak Rabin]] }} (1993)
* [[Pope John Paul II]] (1994)
* [[Newt Gingrich]] (1995)
* [[David Ho]] (1996)
* [[Andrew Grove]] (1997)
* [[Bill Clinton]] / [[Ken Starr]] (1998)
* [[Jeff Bezos]] (1999)
* [[George W. Bush]] (2000)
| group4 = 2001–present
| list4 =
* [[Rudy Giuliani|Rudolph Giuliani]] (2001)
* {{wrap | The Whistleblowers: [[Cynthia Cooper (accountant)|Cynthia Cooper]] / [[Coleen Rowley]] / [[Sherron Watkins]] }} (2002)
* [[Iraq War|The American Soldier]] (2003)
* [[George W. Bush]] (2004)
* {{wrap | The Good Samaritans: [[Bono]] / [[Bill Gates]] / [[Melinda French Gates|Melinda Gates]] }} (2005)
* [[You (Time Person of the Year)|You]] (2006)
* [[Vladimir Putin]] (2007)
* [[Barack Obama]] (2008)
* [[Ben Bernanke]] (2009)
* [[Mark Zuckerberg]] (2010)
* [[Protest|The Protester]] (2011)
* [[Barack Obama]] (2012)
* [[Pope Francis]] (2013)
* {{wrap| [[Responses to the West African Ebola virus epidemic|Ebola Fighters]]: Dr. Jerry Brown / Dr. [[Kent Brantly]] / Ella Watson-Stryker / Foday Gollah / [[Salome Karwah]] }} (2014)
* [[Angela Merkel]] (2015)
* [[Donald Trump]] (2016)
* [[MeToo movement|The Silence Breakers]] (2017)
* {{wrap | The Guardians: [[Jamal Khashoggi]] / [[Maria Ressa]] / [[Wa Lone]] / [[Kyaw Soe Oo]] / Staff of ''[[Capital Gazette shooting|The Capital]]'' }} (2018)
* [[Greta Thunberg]] (2019)
* [[Joe Biden]] / [[Kamala Harris]] (2020)
* [[Elon Musk]] (2021)
}}<noinclude>
{{Documentation}}
</noinclude>
8ug224r5jc476u7ej7kie6ytv1dxpxu
Template:Tl
10
66733012
1006436965
2021-02-12T22:03:00Z
Anthony Appleyard
119438
Anthony Appleyard moved page [[Template:Tl]] to [[Template:Template link]]: [[Special:Permalink/1006428669|Requested]] by Buidhe at [[WP:RM/TR]]: RM closed as move
wikitext
text/x-wiki
#REDIRECT [[Template:Template link]]
{{Redirect category shell|
{{R from move}}
}}
p1dn3i2ckb7gtckkrbn0xh6ckx8nei1
Template:Trim
10
21815705
1028359514
668935791
2021-06-13T14:06:25Z
Plastikspork
5075409
Fix for |=foo bug
wikitext
text/x-wiki
<includeonly>{{safesubst:#if:1|{{{x|{{{1|}}}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
14wjdl1oebgpc4d7v8plj06vowkoodf
Template:URL
10
811789
926680896
907988472
2019-11-18T00:50:36Z
Jonesey95
9755426
Adding unknown parameter tracking through [[:Category:Pages using URL template with unknown parameters]] using [[Module:check for unknown parameters]]
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
Template:USCongRep-end
10
9058111
1053735789
1053735184
2021-11-05T18:19:56Z
Jonesey95
9755426
Let's try this instead
wikitext
text/x-wiki
<includeonly>
|}
{{navbox bottom}}</includeonly><noinclude>
{{documentation|Template:USCongRep-start/doc}}
</noinclude>
jnjk00betyneg4vay2jli17w3nkegr6
Template:USCongRep-row
10
9058037
1046076442
1046075691
2021-09-23T21:02:13Z
WMSR
10291250
restore hanging indent
wikitext
text/x-wiki
|- style="vertical-align:top; text-align:left"
|style="text-align:right"|'''{{str ≥ len | {{{congress}}} | 4 | {{{congress}}} | {{USCongressOrdinal|{{{congress}}}}}}}'''
|style="padding-left:4px; white-space:nowrap"|{{Hanging indent|'''{{#if:{{{state|}}}|[[List of United States senators from {{{state}}}|Senate]]|Senate}}:''' {{{senators}}}}}
|style="padding-left:4px" class="nowraplinks"|{{Hanging indent|'''{{#if:{{{state|}}}|[[List of United States representatives from {{{state}}}|House]]|House}}:''' {{{representatives}}}}}<noinclude>
{{documentation|Template:USCongRep-start/doc}}</noinclude>
9ql7r62pe9u7bxd0kwiz2gepr8p28dh
Template:USCongRep-start
10
9058028
1080407363
1053736182
2022-04-01T02:39:50Z
Therequiembellishere
1522828
wikitext
text/x-wiki
{{navbox top
| name = USCongRep-start
| title = {{{state}}}'s delegation(s) to the {{{congresses}}} {{nowrap|(ordered by seniority)}}
| state = collapsed
}}
{| style="width:100%"
<noinclude>
|-
|
{{USCongRep-end}}
{{documentation}}
</noinclude>
417ue3kjmma668bwqaq1tf8rfyon7hl
Template:USCongRep/IL/109
10
63948558
1068892995
1053613626
2022-01-30T17:31:25Z
PrimeBOT
29463730
/* top */[[User:PrimeBOT/24|Task 24]]: parameter updates following [[Wikipedia:Templates_for_discussion/Log/2022_January_7|a TFD]]
wikitext
text/x-wiki
{{USCongRep-row
| state = Illinois
| congress=109
| senators= {{Party stripe|Democratic Party (US)}}[[Dick Durbin|R. Durbin]] (D){{,}}{{Party stripe|Democratic Party (US)}}[[Barack Obama|B. Obama]] (D)
| representatives= {{flatlist|class=inline|
* {{Party stripe|Republican Party (US)}}[[Henry Hyde|H. Hyde]] (R)
* {{Party stripe|Democratic Party (US)}}[[Lane Evans|L. Evans]] (D)
* {{Party stripe|Republican Party (US)}}[[Dennis Hastert|D. Hastert]] (R)
* {{Party stripe|Democratic Party (US)}}[[Jerry Costello|J. Costello]] (D)
* {{Party stripe|Democratic Party (US)}}[[Luis Gutiérrez|L. Gutiérrez]] (D)
* {{Party stripe|Republican Party (US)}}[[Don Manzullo|D. Manzullo]] (R)
* {{Party stripe|Democratic Party (US)}}[[Bobby Rush|B. Rush]] (D)
* {{Party stripe|Republican Party (US)}}[[Ray LaHood|R. LaHood]] (R)
* {{Party stripe|Republican Party (US)}}[[Jerry Weller|J. Weller]] (R)
* {{Party stripe|Democratic Party (US)}}[[Jesse Jackson Jr.|J. Jackson Jr.]] (D)
* {{Party stripe|Democratic Party (US)}}[[Danny K. Davis|D. Davis]] (D)
* {{Party stripe|Republican Party (US)}}[[John Shimkus|J. Shimkus]] (R)
* {{Party stripe|Republican Party (US)}}[[Judy Biggert|J. Biggert]] (R)
* {{Party stripe|Democratic Party (US)}}[[Jan Schakowsky|J. Schakowsky]] (D)
* {{Party stripe|Republican Party (US)}}[[Tim Johnson (Illinois politician)|T. Johnson]] (R)
* {{Party stripe|Republican Party (US)}}[[Mark Kirk|M. Kirk]] (R)
* {{Party stripe|Democratic Party (US)}}[[Rahm Emanuel|R. Emanuel]] (D)
* {{Party stripe|Democratic Party (US)}}[[Melissa Bean|M. Bean]] (D)
* {{Party stripe|Democratic Party (US)}}[[Dan Lipinski|D. Lipinski]] (D)
}} }}<noinclude>
[[Category:Congressional delegations from Illinois navigational boxes|109]]
[[Category:109th United States Congress templates|Illinois]]
</noinclude>
srllt3ibpdui7rzmmoi4ttoeumev5hf
Template:USCongRep/IL/110
10
63936455
1068893004
1053613630
2022-01-30T17:31:27Z
PrimeBOT
29463730
/* top */[[User:PrimeBOT/24|Task 24]]: parameter updates following [[Wikipedia:Templates_for_discussion/Log/2022_January_7|a TFD]]
wikitext
text/x-wiki
{{USCongRep-row
| state = Illinois
| congress=110
| senators= {{Party stripe|Democratic Party (US)}}[[Dick Durbin|R. Durbin]] (D){{,}}{{Party stripe|Democratic Party (US)}}[[Barack Obama|B. Obama]] (D)
| representatives= {{flatlist|class=inline|
* {{Party stripe|Republican Party (US)}}[[Dennis Hastert|''D. Hastert'']] (R)
* {{Party stripe|Democratic Party (US)}}[[Jerry Costello|J. Costello]] (D)
* {{Party stripe|Democratic Party (US)}}[[Luis Gutiérrez|L. Gutiérrez]] (D)
* {{Party stripe|Republican Party (US)}}[[Don Manzullo|D. Manzullo]] (R)
* {{Party stripe|Democratic Party (US)}}[[Bobby Rush|B. Rush]] (D)
* {{Party stripe|Republican Party (US)}}[[Ray LaHood|R. LaHood]] (R)
* {{Party stripe|Republican Party (US)}}[[Jerry Weller|J. Weller]] (R)
* {{Party stripe|Democratic Party (US)}}[[Jesse Jackson Jr.|J. Jackson Jr.]] (D)
* {{Party stripe|Democratic Party (US)}}[[Danny K. Davis|D. Davis]] (D)
* {{Party stripe|Republican Party (US)}}[[John Shimkus|J. Shimkus]] (R)
* {{Party stripe|Republican Party (US)}}[[Judy Biggert|J. Biggert]] (R)
* {{Party stripe|Democratic Party (US)}}[[Jan Schakowsky|J. Schakowsky]] (D)
* {{Party stripe|Republican Party (US)}}[[Tim Johnson (Illinois politician)|T. Johnson]] (R)
* {{Party stripe|Republican Party (US)}}[[Mark Kirk|M. Kirk]] (R)
* {{Party stripe|Democratic Party (US)}}[[Rahm Emanuel|R. Emanuel]] (D)
* {{Party stripe|Democratic Party (US)}}[[Melissa Bean|M. Bean]] (D)
* {{Party stripe|Democratic Party (US)}}[[Dan Lipinski|D. Lipinski]] (D)
* {{Party stripe|Democratic Party (US)}}[[Phil Hare|P. Hare]] (D)
* {{Party stripe|Republican Party (US)}}[[Peter Roskam|P. Roskam]] (R)
* {{Party stripe|Democratic Party (US)}}[[Bill Foster (politician)|''B. Foster'']] (D)
}} }}<noinclude>
[[Category:Congressional delegations from Illinois navigational boxes|110]]
[[Category:110th United States Congress templates|Illinois]]
</noinclude>
0t9p6cezwmeyqku7hinnfkdayslda2s
Template:USCongressOrdinal
10
34116657
1039154262
975683585
2021-08-17T01:17:56Z
MusikBot II
29539620
Changed protection settings for "[[Template:USCongressOrdinal]]": [[Wikipedia:High-risk templates|High-risk template or module]] 5271 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
<noinclude>
== Code only ==
</noinclude><includeonly>{{#if:{{{2|}}}
|{{for loop|{{#if:{{{3|}}}|{{{3}}}|<br/>}}|call=USCongressOrdinal/code|start={{{1|}}}|stop={{#switch:{{{2|}}}
| Present | present | P | p
| Current | current | C | c = {{USCongressOrdinal/current}}
| {{{2|}}}
}}|by=1}}
|{{USCongressOrdinal/code|{{#ifeq:{{lc:{{{1|}}}}}|present|{{USCongressOrdinal/current}}|{{{1|}}}}}}}
}}</includeonly><noinclude>
== Documentation ==
{{Documentation}}
</noinclude>
mwjv0dguzc6t9so5jo2hbs952sjsfrm
Template:USCongressOrdinal/code
10
59138060
1039154266
975898085
2021-08-17T01:17:58Z
MusikBot II
29539620
Changed protection settings for "[[Template:USCongressOrdinal/code]]": [[Wikipedia:High-risk templates|High-risk template or module]] 5271 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
wikitext
text/x-wiki
[[{{Ordinal|{{{1}}}}} United States Congress|{{Ordinal|{{{1}}}}}]]<noinclude>
[[Category:Internal article-link templates]]
[[Category:United States Congress templates|Ordinal]]
</noinclude>
suoi0edwfuafffqpuf6x7og9cplycz7
Template:US presidents
10
535994
1078441561
1076190002
2022-03-21T16:14:15Z
Woko Sapien
32381689
More concise group titles. Better space management
wikitext
text/x-wiki
{{#invoke:Navbox|navbox
|name = US presidents
|title = [[President of the United States|Presidents of the United States]]
|state = {{{state<includeonly>|autocollapse</includeonly>}}}
| group1 = Presidents and<br/>presidencies
|list1 =
<div style="display:flex">{{div col|colwidth=20em|style=flex:1;text-align:left;white-space:nowrap}}
# [[George Washington]] ([[Presidency of George Washington|1789–1797]])
# [[John Adams]] ([[Presidency of John Adams|1797–1801]])
# [[Thomas Jefferson]] ([[Presidency of Thomas Jefferson|1801–1809]])
# [[James Madison]] ([[Presidency of James Madison|1809–1817]])
# [[James Monroe]] ([[Presidency of James Monroe|1817–1825]])
# [[John Quincy Adams]] ([[Presidency of John Quincy Adams|1825–1829]])
# [[Andrew Jackson]] ([[Presidency of Andrew Jackson|1829–1837]])
# [[Martin Van Buren]] ([[Presidency of Martin Van Buren|1837–1841]])
# [[William Henry Harrison]] ([[Presidency of William Henry Harrison|1841]])
# [[John Tyler]] ([[Presidency of John Tyler|1841–1845]])
# [[James K. Polk]] ([[Presidency of James K. Polk|1845–1849]])
# [[Zachary Taylor]] ([[Presidency of Zachary Taylor|1849–1850]])
# [[Millard Fillmore]] ([[Presidency of Millard Fillmore|1850–1853]])
# [[Franklin Pierce]] ([[Presidency of Franklin Pierce|1853–1857]])
# [[James Buchanan]] ([[Presidency of James Buchanan|1857–1861]])
# [[Abraham Lincoln]] ([[Presidency of Abraham Lincoln|1861–1865]])
# [[Andrew Johnson]] ([[Presidency of Andrew Johnson|1865–1869]])
# [[Ulysses S. Grant]] ([[Presidency of Ulysses S. Grant|1869–1877]])
# [[Rutherford B. Hayes]] ([[Presidency of Rutherford B. Hayes|1877–1881]])
# [[James A. Garfield]] ([[Presidency of James A. Garfield|1881]])
# [[Chester A. Arthur]] ([[Presidency of Chester A. Arthur|1881–1885]])
# [[Grover Cleveland]] ([[Presidencies of Grover Cleveland#First presidency (1885–1889)|1885–1889]])
# [[Benjamin Harrison]] ([[Presidency of Benjamin Harrison|1889–1893]])
# [[Grover Cleveland]] ([[Presidencies of Grover Cleveland#Second presidency (1893–1897)|1893–1897]])
# [[William McKinley]] ([[Presidency of William McKinley|1897–1901]])
# [[Theodore Roosevelt]] ([[Presidency of Theodore Roosevelt|1901–1909]])
# [[William Howard Taft]] ([[Presidency of William Howard Taft|1909–1913]])
# [[Woodrow Wilson]] ([[Presidency of Woodrow Wilson|1913–1921]])
# [[Warren G. Harding]] ([[Presidency of Warren G. Harding|1921–1923]])
# [[Calvin Coolidge]] ([[Presidency of Calvin Coolidge|1923–1929]])
# [[Herbert Hoover]] ([[Presidency of Herbert Hoover|1929–1933]])
# [[Franklin D. Roosevelt]] ([[Presidency of Franklin D. Roosevelt|1933–1945]])
# [[Harry S. Truman]] ([[Presidency of Harry S. Truman|1945–1953]])
# [[Dwight D. Eisenhower]] ([[Presidency of Dwight D. Eisenhower|1953–1961]])
# [[John F. Kennedy]] ([[Presidency of John F. Kennedy|1961–1963]])
# [[Lyndon B. Johnson]] ([[Presidency of Lyndon B. Johnson|1963–1969]])
# [[Richard Nixon]] ([[Presidency of Richard Nixon|1969–1974]])
# [[Gerald Ford]] ([[Presidency of Gerald Ford|1974–1977]])
# [[Jimmy Carter]] ([[Presidency of Jimmy Carter|1977–1981]])
# [[Ronald Reagan]] ([[Presidency of Ronald Reagan|1981–1989]])
# [[George H. W. Bush]] ([[Presidency of George H. W. Bush|1989–1993]])
# [[Bill Clinton]] ([[Presidency of Bill Clinton|1993–2001]])
# [[George W. Bush]] ([[Presidency of George W. Bush|2001–2009]])
# [[Barack Obama]] ([[Presidency of Barack Obama|2009–2017]])
# [[Donald Trump]] ([[Presidency of Donald Trump|2017–2021]])
# [[Joe Biden]] ([[Presidency of Joe Biden|2021–present]])
{{div col end}}<div style="align-self:center">[[File:Seal of the President of the United States.svg|85px|right|link=Seal of the President of the United States|alt=]]</div></div>
|group2 = Presidency<br/>timelines
|list2class = hlist
|list2 =
* [[Timeline of the George Washington presidency|Washington]]
* [[Timeline of the William McKinley presidency|McKinley]]
* [[Timeline of the Theodore Roosevelt presidency|T. Roosevelt]]
* [[Timeline of the William Howard Taft presidency|Taft]]
* [[Timeline of the Woodrow Wilson presidency|Wilson]]
* [[Timeline of the Warren G. Harding presidency|Harding]]
* [[Timeline of the Calvin Coolidge presidency|Coolidge]]
* [[Timeline of the Herbert Hoover presidency|Hoover]]
* [[Timeline of the Franklin D. Roosevelt presidency|F. D. Roosevelt]]
* [[Timeline of the Harry S. Truman presidency|Truman]]
* [[Timeline of the Dwight D. Eisenhower presidency|Eisenhower]]
* [[Timeline of the John F. Kennedy presidency|Kennedy]]*
* [[Timeline of the Lyndon B. Johnson presidency|L. B. Johnson]]
* [[Timeline of the Richard Nixon presidency|Nixon]]
* [[Timeline of the Gerald Ford presidency|Ford]]*
* [[Timeline of the Jimmy Carter presidency|Carter]]*
* [[Timeline of the Ronald Reagan presidency|Reagan]]
* [[Timeline of the George H. W. Bush presidency|G. H. W. Bush]]*
* [[Timeline of the Bill Clinton presidency|Clinton]]*
* [[Timeline of the George W. Bush presidency|G. W. Bush]]*
* [[Timeline of the Barack Obama presidency|Obama]]*
* [[Timeline of the Donald Trump presidency|Trump]]*
* [[Timeline of the Joe Biden presidency|Biden]]*
|belowclass = hlist
|below = '''*''' Links to list of related timelines<br>
* '''{{icon|category}} [[:Category:Presidents of the United States|Category]]'''
* '''{{icon|Commons}} [[Commons:President of the United States|Commons]]'''
* '''{{icon|LIST}} [[List of presidents of the United States|List]]'''
}}<noinclude>
{{Documentation}}
</noinclude>
ej0b27o4r1u1xao5zau62l89hrdvpys
Template:Unbulleted list
10
27486458
930012296
929522913
2019-12-09T17:31:16Z
Jonesey95
9755426
Undid revision 929522913 by [[Special:Contributions/MSGJ|MSGJ]] ([[User talk:MSGJ|talk]]). Reverted, as this change has been shown to have bugs. Discussion continues on talk page.
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:list|unbulleted}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
g28jpumica8ycuimxbfi2qlrcbowsb3
Template:United States senators from Illinois
10
13151473
1024553479
997745966
2021-05-22T20:48:49Z
GKFX
14918984
Reduce [[WP:PEIS]] for [[Barack Obama]] article.
wikitext
text/x-wiki
{{#invoke:navbox|navbox
|name = United States senators from Illinois
|title = [[List of United States senators from Illinois|United States senators from Illinois]]
|state = {{{state|collapsed}}}
|image = [[File:Seal of the United States Senate.svg|80px|link=|alt=|United States Senate]]
|listclass = hlist
|group1 = Class 2
|list1 =
* [[Jesse B. Thomas|Thomas]]
* [[John McLean (Illinois politician)|McLean]]
* [[David J. Baker|Baker]]
* [[John McCracken Robinson|Robinson]]
* [[Samuel McRoberts|McRoberts]]
* [[James Semple|Semple]]
* [[Stephen A. Douglas|S. Douglas]]
* [[Orville Hickman Browning|Browning]]
* [[William Alexander Richardson|Richardson]]
* [[Richard Yates (politician, born 1815)|Yates]]
* [[John A. Logan|Logan]]
* [[David Davis (Supreme Court justice)|Davis]]
* [[Shelby Moore Cullom|Cullom]]
* [[J. Hamilton Lewis|Lewis]]
* [[Medill McCormick|McCormick]]
* [[Charles S. Deneen|Deneen]]
* [[J. Hamilton Lewis|Lewis]]
* [[James M. Slattery|Slattery]]
* [[Charles W. Brooks|Brooks]]
* [[Paul Douglas|P. Douglas]]
* [[Charles H. Percy|Percy]]
* [[Paul Simon (politician)|Simon]]
* [[Dick Durbin|Durbin]]
|group2=Class 3
|list2=
* [[Ninian Edwards|Edwards]]
* [[John McLean (Illinois politician)|McLean]]
* [[Elias Kane|Kane]]
* [[William Lee D. Ewing|Ewing]]
* [[Richard M. Young|Young]]
* [[Sidney Breese|Breese]]
* [[James Shields (politician, born 1806)|Shields]]
* [[Lyman Trumbull|Trumbull]]
* [[Richard J. Oglesby|Oglesby]]
* [[John A. Logan|Logan]]
* [[Charles B. Farwell|Farwell]]
* [[John M. Palmer (politician)|Palmer]]
* [[William E. Mason (American politician)|Mason]]
* [[Albert J. Hopkins|Hopkins]]
* [[William Lorimer (politician)|Lorimer]]
* [[Lawrence Yates Sherman|Sherman]]
* [[William B. McKinley|McKinley]]
* [[Otis F. Glenn|Glenn]]
* [[William H. Dieterich|Dieterich]]
* [[Scott W. Lucas|Lucas]]
* [[Everett Dirksen|Dirksen]]
* [[Ralph Tyler Smith|Smith]]
* [[Adlai Stevenson III|Stevenson III]]
* [[Alan J. Dixon|Dixon]]
* [[Carol Moseley Braun|Moseley Braun]]
* [[Peter Fitzgerald (politician)|Fitzgerald]]
* [[Barack Obama|Obama]]
* [[Roland Burris|Burris]]
* [[Mark Kirk|Kirk]]
* [[Tammy Duckworth|Duckworth]]
}}<noinclude>
{{collapsible option}}
[[Category:United States senators from Illinois|τ]]
[[Category:United States senators by state navigational boxes|Illinois]]
[[Category:Illinois government navigational boxes|Senators]]
</noinclude>
ish3qvlx3i3fa4sztxfceul3nb7nzcr
Template:Use American English
10
32028446
896754740
891270110
2019-05-12T17:34:08Z
KrakatoaKatie
1570001
rm TFD
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||date=__DATE__ |$B=
{{DMCA|Use American English|from|{{{date|}}}|All Wikipedia articles written in American English}}
}}<noinclude>{{Documentation}}</noinclude>
2x37o7g1hmclvzsql7ciggmq0v57r0m
Template:Use mdy dates
10
20999385
1063311995
930735292
2022-01-02T09:36:55Z
Dinoguy1000
2412089
fix "|=foo" bug
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#invoke:Unsubst||date=__DATE__ |$B=
{{DMCA|Use mdy dates|from|{{{date|}}}}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Pages using Use mdy dates template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Use mdy dates]] with unknown parameter "_VALUE_"|ignoreblank=y| cs1-dates | date }}}}<noinclude>{{Documentation}}</noinclude>
e6smjfoe25dj9i98ev58glijsor4b2c
Template:Webarchive
10
22577742
769654926
750709028
2017-03-10T21:29:55Z
Rich Farmbrough
82835
wikitext
text/x-wiki
<includeonly>{{#invoke:webarchive|webarchive}}</includeonly><noinclude>
{{documentation}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
af0jh9wqwfjf3uyx3ywwvb039disnpm
Template:Wrap
10
12884987
955111821
954736825
2020-05-06T01:08:38Z
Plastikspork
5075409
Merged
wikitext
text/x-wiki
<includeonly><span class="wrap">{{{1| }}}</span></includeonly><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
jx32097fuqyo6uie238zvhezzt5d0r5
Template:Year Nobel Prize winners
10
47264671
1048725602
1048724760
2021-10-07T16:20:48Z
Shellwood
2366721
Reverted 1 edit by [[Special:Contributions/Bishaldev100|Bishaldev100]] ([[User talk:Bishaldev100|talk]]): ?
wikitext
text/x-wiki
{{#invoke:navbox|navbox
| name = {{{year|Year}}} Nobel Prize winners
| title = {{{year}}} [[Nobel Prize]] laureates
| state = {{{state|autocollapse}}}
| bodyclass = hlist
| group1 = [[Nobel Prize in Chemistry|Chemistry]]
| list1 = {{{chemistry|}}}
| group2 = [[Nobel Prize in Literature|Literature]]
| list2 = {{{literature|}}}
| group3 = [[Nobel Peace Prize|Peace]] {{#ifexist:{{{year}}} Nobel Peace Prize|{{#if:{{#invoke:redirect|isRedirect|{{{year}}} Nobel Peace Prize}}|<!-- If it's a redirect then it probably redirects to an already linked winner so don't use the redirect -->|([[{{{year}}} Nobel Peace Prize|{{{year}}}]])}}}}
| list3 = {{{peace|}}}
| group4 = [[Nobel Prize in Physics|Physics]]
| list4 = {{{physics|}}}
| group5 = [[Nobel Prize in Physiology or Medicine|Physiology or Medicine]]
| list5 = {{{medicine|}}}
| group6 = [[Nobel Memorial Prize in Economic Sciences|Economic Sciences]]
| list6 = {{{economy|}}}
| below = {{{below|}}}{{Nobel Prize winners footer|{{{year|}}}}}
}}{{#ifeq:{{FULLPAGENAME}}|Template:{{{year|}}} Nobel Prize winners|
{{collapsible option}}
[[Category:Nobel Prize templates]]
}}<noinclude>
{{Documentation}}
</noinclude>
r67ffd6kuimt8roz59psrnx8u2hfjlk
Template:Yesno
10
22255088
975364754
821904792
2020-08-28T03:15:17Z
Xaosflux
502540
add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }}
|no
|n
|f
|false
|off
|0 = {{{no|<!-- null -->}}}
| = {{{blank|{{{no|<!-- null -->}}}}}}
|¬ = {{{¬|}}}
|yes
|y
|t
|true
|on
|1 = {{{yes|yes}}}
|#default = {{{def|{{{yes|yes}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
bioaq6x8oitfnx7oqmfhviol4hbp1nd
Template:Yesno-no
10
48375573
825510157
804450734
2018-02-13T20:27:17Z
WOSlinker
3138265
separate pp-template not needed
wikitext
text/x-wiki
{{safesubst:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|no}}}|¬={{{¬|no}}}|def={{{def|no}}}}}<noinclude>
{{Documentation|Template:Yesno/doc}}
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.-->
</noinclude>
34vmtxa9ubuh1vz2ulp78m5ela68riu
Template:Yesno-yes
10
48375564
829824778
827246217
2018-03-11T01:06:35Z
JJMC89
24812038
allow subst
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|yes}}}|¬={{{¬|yes}}}|def={{{def|yes}}}}}<noinclude>
{{Documentation|Template:Yesno/doc}}
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.-->
</noinclude>
2ln5m2kzkd3wxvm1r25pwd6kj6j77we
Template:YouTube
10
5579775
1089176511
997003410
2022-05-22T09:44:43Z
Gonnym
14984434
this should use the same code checking as the others
wikitext
text/x-wiki
[https://www.youtube.com/{{#if:{{{user|{{{u|}}}}}}
|user/{{{user|{{{u|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki/>{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel]
|{{#if:{{{channel|{{{c|}}}}}}
|channel/{{{channel|{{{c|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki/>{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel]
|{{#if:{{{show|{{{s|}}}}}}
|show/{{{show|{{{s|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki/>{{{title|{{{1}}}}}}}}</span>|''{{PAGENAMEBASE}}''}}] show
|{{#if:{{{playlist|{{{p|}}}}}}
|playlist?list={{{playlist|{{{p|}}}}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki/>{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}] playlist
|{{#if:{{{custom|}}}
|c/{{{custom}}} {{#if:{{{title|{{{1|}}}}}}|<span class="plainlinks">{{delink|<nowiki/>{{{title|{{{1}}}}}}}}</span>|{{PAGENAMEBASE}}}}{{{suffix|'s}}} channel]
|{{#if:{{{id|{{{1<includeonly>|</includeonly>}}}}}}
|watch?v={{Trim|{{{id|{{{1|}}}}}}}}{{#if:{{{time|{{{t|}}}}}}|&t={{Trim|{{{time|{{{t|}}}}}}}}|}} {{#if:{{{title|}}}|<span class="plainlinks">{{replace|{{delink|<nowiki/>{{{title}}}}}|]|]}}</span>|{{#if:{{{id|}}}|{{#if:{{{1|}}}|<span class="plainlinks">{{replace|{{delink|<nowiki/>{{{1}}}}}|]|]}}</span>|Video}}|{{#if:{{{2|}}}|<span class="plainlinks">{{replace|{{delink|<nowiki/>{{{2}}}}}|]|]}}</span>|Video}}}}}}]
|{{error|Error:No page id specified}}]{{Namespace detect |talk=|wikipedia=|help=|template=|module= |other=[[Category:Articles using YouTube with invalid parameters]] }}
}}
}}
}}
}}
}}
}} on {{#ifeq:{{{link}}}|no
|YouTube
|[[YouTube]]
}}{{#ifexpr:{{#expr:
{{#if:{{{user|}}}|1|0}}+
{{#if:{{{u|}}}|1|0}}+
{{#if:{{{channel|}}}|1|0}}+
{{#if:{{{c|}}}|1|0}}+
{{#if:{{{custom|}}}|1|0}}+
{{#if:{{{show|}}}|1|0}}+
{{#if:{{{s|}}}|1|0}}+
{{#if:{{{playlist|}}}|1|0}}+
{{#if:{{{p|}}}|1|0}}+
{{#if:{{{id|}}}|1|0}}+
{{#if:{{{2|}}}|1|0}}+
{{#if:{{{title|}}}|{{#if:{{{1|{{{2|}}}}}}|1|0}}|0}}
}}>1
|{{Namespace detect
|talk=|wikipedia=|help=|template=|module=
|other=[[Category:Articles using YouTube with invalid parameters]]
}}
}}{{#if:{{{user|}}}{{{u|}}}{{{channel|}}}{{{c|}}}
||{{#ifeq:{{{suffix|α}}}|α
||{{Namespace detect
|talk=|wikipedia=|help=|template=|module=
|other=[[Category:Articles using YouTube with invalid parameters]]
}}
}}
}}<!--
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using YouTube with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:YouTube]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | c | channel | custom | id | link | p | playlist | s | show | suffix | t | time | title | u | user }}<noinclude>{{documentation}}</noinclude>
2k86y9szoryljvqfpc58fqnddgu2csg
Template:\
10
16258728
695047466
464090629
2015-12-13T11:55:37Z
Graeme Bartlett
38427
Changed protection level of Template:\: [[WP:High-risk templates|Highly visible template]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only administrators] (indefinite))
wikitext
text/x-wiki
/ <noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
gfvlsjgnfxn02vdp58sww0lo44n62ht
Template:·
10
7599646
636441209
612824946
2014-12-03T10:06:52Z
Edokter
1624037
move bold tag
wikitext
text/x-wiki
<b>·</b> <noinclude>
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
m6es8khirlfrhpczjy4j6v6cxs2jadq
Module:Age
828
38970907
1088989932
1019574915
2022-05-21T07:08:39Z
Johnuniq
6036800
update from [[Module:Age/sandbox]]: implement sortable=on + sortable=table for [[Template:Death date and age]]
Scribunto
text/plain
-- Implement various "age of" and other date-related templates.
local mtext = {
-- Message and other text that should be localized.
-- Also need to localize text in table names in function dateDifference.
['mt-bad-param1'] = 'Invalid parameter $1',
['mt-bad-param2'] = 'Parameter $1=$2 is invalid',
['mt-bad-show'] = 'Parameter show=$1 is not supported here',
['mt-cannot-add'] = 'Cannot add "$1"',
['mt-conflicting-show'] = 'Parameter show=$1 conflicts with round=$2',
['mt-date-wrong-order'] = 'The second date must be later in time than the first date',
['mt-dd-future'] = 'Death date (first date) must not be in the future',
['mt-dd-wrong-order'] = 'Death date (first date) must be later in time than the birth date (second date)',
['mt-invalid-bd-age'] = 'Invalid birth date for calculating age',
['mt-invalid-dates-age'] = 'Invalid dates for calculating age',
['mt-invalid-end'] = 'Invalid end date in second parameter',
['mt-invalid-start'] = 'Invalid start date in first parameter',
['mt-need-jdn'] = 'Need valid Julian date number',
['mt-need-valid-bd'] = 'Need valid birth date: year, month, day',
['mt-need-valid-bd2'] = 'Need valid birth date (second date): year, month, day',
['mt-need-valid-date'] = 'Need valid date',
['mt-need-valid-dd'] = 'Need valid death date (first date): year, month, day',
['mt-need-valid-ymd'] = 'Need valid year, month, day',
['mt-need-valid-ymd-current'] = 'Need valid year|month|day or "currentdate"',
['mt-need-valid-ymd2'] = 'Second date should be year, month, day',
['mt-template-bad-name'] = 'The specified template name is not valid',
['mt-template-x'] = 'The template invoking this must have "|template=x" where x is the wanted operation',
['txt-and'] = ' and ',
['txt-or'] = ' or ',
['txt-category'] = 'Category:Age error',
['txt-comma-and'] = ', and ',
['txt-error'] = 'Error: ',
['txt-format-default'] = 'mf', -- 'df' (day first = dmy) or 'mf' (month first = mdy)
['txt-module-convertnumeric'] = 'Module:ConvertNumeric',
['txt-module-date'] = 'Module:Date',
['txt-sandbox'] = 'sandbox',
['txt-bda'] = '<span style="display:none"> (<span class="bday">$1</span>) </span>$2<span class="noprint ForceAgeToShow"> (age $3)</span>',
['txt-dda'] = '$2<span style="display:none">($1)</span> (aged $3)',
['txt-bda-disp'] = 'disp_raw', -- disp_raw → age is a number only; disp_age → age is a number and unit (normally years but months or days if very young)
['txt-dda-disp'] = 'disp_raw',
['txt-dmy'] = '%-d %B %-Y',
['txt-mdy'] = '%B %-d, %-Y',
}
local isWarning = {
['mt-bad-param1'] = true,
}
local translate, from_en, to_en, isZero
if translate then
-- Functions to translate from en to local language and reverse go here.
-- See example at [[:bn:Module:বয়স]].
else
from_en = function (text)
return text
end
isZero = function (text)
return tonumber(text) == 0
end
end
local _Date, _currentDate
local function getExports(frame)
-- Return objects exported from the date module or its sandbox.
if not _Date then
local sandbox = frame:getTitle():find(mtext['txt-sandbox'], 1, true) and ('/' .. mtext['txt-sandbox']) or ''
local datemod = require(mtext['txt-module-date'] .. sandbox)
local realDate = datemod._Date
_currentDate = datemod._current
if to_en then
_Date = function (...)
local args = {}
for i, v in ipairs({...}) do
args[i] = to_en(v)
end
return realDate(unpack(args))
end
else
_Date = realDate
end
end
return _Date, _currentDate
end
local Collection -- a table to hold items
Collection = {
add = function (self, item)
if item ~= nil then
self.n = self.n + 1
self[self.n] = item
end
end,
join = function (self, sep)
return table.concat(self, sep)
end,
remove = function (self, pos)
if self.n > 0 and (pos == nil or (0 < pos and pos <= self.n)) then
self.n = self.n - 1
return table.remove(self, pos)
end
end,
sort = function (self, comp)
table.sort(self, comp)
end,
new = function ()
return setmetatable({n = 0}, Collection)
end
}
Collection.__index = Collection
local function stripToNil(text)
-- If text is a string, return its trimmed content, or nil if empty.
-- Otherwise return text (which may, for example, be nil).
if type(text) == 'string' then
text = text:match('(%S.-)%s*$')
end
return text
end
local function dateFormat(args)
-- Return string for wanted date format.
local default = mtext['txt-format-default']
local other = default == 'df' and 'mf' or 'df'
local wanted = stripToNil(args[other]) and other or default
return wanted == 'df' and mtext['txt-dmy'] or mtext['txt-mdy']
end
local function substituteParameters(text, ...)
-- Return text after substituting any given parameters for $1, $2, etc.
return mw.message.newRawMessage(text, ...):plain()
end
local function yes(parameter)
-- Return true if parameter should be interpreted as "yes".
-- Do not want to accept mixed upper/lowercase unless done by current templates.
-- Need to accept "on" because "round=on" is wanted.
return ({ y = true, yes = true, on = true })[parameter]
end
local function message(msg, ...)
-- Return formatted message text for an error or warning.
local function getText(msg)
return mtext[msg] or error('Bug: message "' .. tostring(msg) .. '" not defined')
end
local categories = {
error = mtext['txt-category'],
warning = mtext['txt-category'],
}
local a, b, k, category
local text = substituteParameters(getText(msg), ...)
if isWarning[msg] then
a = '<sup>[<i>'
b = '</i>]</sup>'
k = 'warning'
else
a = '<strong class="error">' .. getText('txt-error')
b = '</strong>'
k = 'error'
end
if mw.title.getCurrentTitle():inNamespaces(0) then
-- Category only in namespaces: 0=article.
category = '[[' .. categories[k] .. ']]'
end
return
a ..
mw.text.nowiki(text) ..
b ..
(category or '')
end
local function formatNumber(number)
-- Return the given number formatted with commas as group separators,
-- given that the number is an integer.
local numstr = tostring(number)
local length = #numstr
local places = Collection.new()
local pos = 0
repeat
places:add(pos)
pos = pos + 3
until pos >= length
places:add(length)
local groups = Collection.new()
for i = places.n, 2, -1 do
local p1 = length - places[i] + 1
local p2 = length - places[i - 1]
groups:add(numstr:sub(p1, p2))
end
return groups:join(',')
end
local function spellNumber(number, options, i)
-- Return result of spelling number, or
-- return number (as a string) if cannot spell it.
-- i == 1 for the first number which can optionally start with an uppercase letter.
number = tostring(number)
return require(mtext['txt-module-convertnumeric']).spell_number(
number,
nil, -- fraction numerator
nil, -- fraction denominator
i == 1 and options.upper, -- true: 'One' instead of 'one'
not options.us, -- true: use 'and' between tens/ones etc
options.adj, -- true: hyphenated
options.ordinal -- true: 'first' instead of 'one'
) or number
end
local function makeExtra(args, flagCurrent)
-- Return extra text that will be inserted before the visible result
-- but after any sort key.
local extra = args.prefix or ''
if mw.ustring.len(extra) > 1 then
-- Parameter "~" gives "~3" whereas "over" gives "over 3".
if extra:sub(-6, -1) ~= ' ' then
extra = extra .. ' '
end
end
if flagCurrent then
extra = '<span class="currentage"></span>' .. extra
end
return extra
end
local function makeSort(value, sortable)
-- Return a sort key if requested.
-- Assume value is a valid number which has not overflowed.
if sortable == 'sortable_table' or sortable == 'sortable_on' or sortable == 'sortable_debug' then
local sortKey
if value == 0 then
sortKey = '5000000000000000000'
else
local mag = math.floor(math.log10(math.abs(value)) + 1e-14)
if value > 0 then
sortKey = 7000 + mag
else
sortKey = 2999 - mag
value = value + 10^(mag+1)
end
sortKey = string.format('%d', sortKey) .. string.format('%015.0f', math.floor(value * 10^(14-mag)))
end
local result
if sortable == 'sortable_table' then
result = 'data-sort-value="_SORTKEY_"|'
elseif sortable == 'sortable_debug' then
result = '<span data-sort-value="_SORTKEY_♠"><span style="border:1px solid">_SORTKEY_♠</span></span>'
else
result = '<span data-sort-value="_SORTKEY_♠"></span>'
end
return (result:gsub('_SORTKEY_', sortKey))
end
end
local translateParameters = {
abbr = {
off = 'abbr_off',
on = 'abbr_on',
},
disp = {
age = 'disp_age',
raw = 'disp_raw',
},
format = {
raw = 'format_raw',
commas = 'format_commas',
},
round = {
on = 'on',
yes = 'on',
months = 'ym',
weeks = 'ymw',
days = 'ymd',
hours = 'ymdh',
},
sep = {
comma = 'sep_comma',
[','] = 'sep_comma',
serialcomma = 'sep_serialcomma',
space = 'sep_space',
},
show = {
hide = { id = 'hide' },
y = { 'y', id = 'y' },
ym = { 'y', 'm', id = 'ym' },
ymd = { 'y', 'm', 'd', id = 'ymd' },
ymw = { 'y', 'm', 'w', id = 'ymw' },
ymwd = { 'y', 'm', 'w', 'd', id = 'ymwd' },
yd = { 'y', 'd', id = 'yd', keepZero = true },
m = { 'm', id = 'm' },
md = { 'm', 'd', id = 'md' },
w = { 'w', id = 'w' },
wd = { 'w', 'd', id = 'wd' },
h = { 'H', id = 'h' },
hm = { 'H', 'M', id = 'hm' },
hms = { 'H', 'M', 'S', id = 'hms' },
M = { 'M', id = 'M' },
s = { 'S', id = 's' },
d = { 'd', id = 'd' },
dh = { 'd', 'H', id = 'dh' },
dhm = { 'd', 'H', 'M', id = 'dhm' },
dhms = { 'd', 'H', 'M', 'S', id = 'dhms' },
ymdh = { 'y', 'm', 'd', 'H', id = 'ymdh' },
ymdhm = { 'y', 'm', 'd', 'H', 'M', id = 'ymdhm' },
ymwdh = { 'y', 'm', 'w', 'd', 'H', id = 'ymwdh' },
ymwdhm = { 'y', 'm', 'w', 'd', 'H', 'M', id = 'ymwdhm' },
},
sortable = {
off = false,
on = 'sortable_on',
table = 'sortable_table',
debug = 'sortable_debug',
},
}
local spellOptions = {
cardinal = {},
Cardinal = { upper = true },
cardinal_us = { us = true },
Cardinal_us = { us = true, upper = true },
ordinal = { ordinal = true },
Ordinal = { ordinal = true, upper = true },
ordinal_us = { ordinal = true, us = true },
Ordinal_us = { ordinal = true, us = true, upper = true },
}
local function dateExtract(frame)
-- Return part of a date after performing an optional operation.
local Date = getExports(frame)
local args = frame:getParent().args
local parms = {}
for i, v in ipairs(args) do
parms[i] = v
end
if yes(args.fix) then
table.insert(parms, 'fix')
end
if yes(args.partial) then
table.insert(parms, 'partial')
end
local show = stripToNil(args.show) or 'dmy'
local date = Date(unpack(parms))
if not date then
if show == 'format' then
return 'error'
end
return message('mt-need-valid-date')
end
local add = stripToNil(args.add)
if add then
for item in add:gmatch('%S+') do
date = date + item
if not date then
return message('mt-cannot-add', item)
end
end
end
local sortKey, result
local sortable = translateParameters.sortable[args.sortable]
if sortable then
local value = (date.partial and date.partial.first or date).jdz
sortKey = makeSort(value, sortable)
end
if show ~= 'hide' then
result = date[show]
if result == nil then
result = from_en(date:text(show))
elseif type(result) == 'boolean' then
result = result and '1' or '0'
else
result = from_en(tostring(result))
end
end
return (sortKey or '') .. makeExtra(args) .. (result or '')
end
local function rangeJoin(range)
-- Return text to be used between a range of ages.
return range == 'dash' and '–' or mtext['txt-or']
end
local function makeText(values, components, names, options, noUpper)
-- Return wikitext representing an age or duration.
local text = Collection.new()
local count = #values
local sep = names.sep or ''
for i, v in ipairs(values) do
-- v is a number (say 4 for 4 years), or a table ({4,5} for 4 or 5 years).
local islist = type(v) == 'table'
if (islist or v > 0) or (text.n == 0 and i == count) or (text.n > 0 and components.keepZero) then
local fmt, vstr
if options.spell then
fmt = function(number)
return spellNumber(number, options.spell, noUpper or i)
end
elseif i == 1 and options.format == 'format_commas' then
-- Numbers after the first should be small and not need formatting.
fmt = formatNumber
else
fmt = tostring
end
if islist then
vstr = fmt(v[1]) .. rangeJoin(options.range)
noUpper = true
vstr = vstr .. fmt(v[2])
else
vstr = fmt(v)
end
local name = names[components[i]]
if name then
if type(name) == 'table' then
name = mw.getContentLanguage():plural(islist and v[2] or v, name)
end
text:add(vstr .. sep .. name)
else
text:add(vstr)
end
end
end
local first, last
if options.join == 'sep_space' then
first = ' '
last = ' '
elseif options.join == 'sep_comma' then
first = ', '
last = ', '
elseif options.join == 'sep_serialcomma' and text.n > 2 then
first = ', '
last = mtext['txt-comma-and']
else
first = ', '
last = mtext['txt-and']
end
for i, v in ipairs(text) do
if i < text.n then
text[i] = v .. (i + 1 < text.n and first or last)
end
end
local sign = ''
if options.isnegative then
-- Do not display negative zero.
if text.n > 1 or (text.n == 1 and text[1]:sub(1, 1) ~= '0' ) then
if options.format == 'format_raw' then
sign = '-' -- plain hyphen so result can be used in a calculation
else
sign = '−' -- Unicode U+2212 MINUS SIGN
end
end
end
return
(options.sortKey or '') ..
(options.extra or '') ..
sign ..
text:join() ..
(options.suffix or '')
end
local function dateDifference(parms)
-- Return a formatted date difference using the given parameters
-- which have been validated.
local names = {
-- Each name is:
-- * a string if no plural form of the name is used; or
-- * a table of strings, one of which is selected using the rules at
-- https://translatewiki.net/wiki/Plural/Mediawiki_plural_rules
abbr_off = {
sep = ' ',
y = {'year', 'years'},
m = {'month', 'months'},
w = {'week', 'weeks'},
d = {'day', 'days'},
H = {'hour', 'hours'},
M = {'minute', 'minutes'},
S = {'second', 'seconds'},
},
abbr_on = {
y = 'y',
m = 'm',
w = 'w',
d = 'd',
H = 'h',
M = 'm',
S = 's',
},
abbr_infant = { -- for {{age for infant}}
sep = ' ',
y = {'yr', 'yrs'},
m = {'mo', 'mos'},
w = {'wk', 'wks'},
d = {'day', 'days'},
H = {'hr', 'hrs'},
M = {'min', 'mins'},
S = {'sec', 'secs'},
},
abbr_raw = {},
}
local diff = parms.diff -- must be a valid date difference
local show = parms.show -- may be nil; default is set below
local abbr = parms.abbr or 'abbr_off'
local defaultJoin
if abbr ~= 'abbr_off' then
defaultJoin = 'sep_space'
end
if not show then
show = 'ymd'
if parms.disp == 'disp_age' then
if diff.years < 3 then
defaultJoin = 'sep_space'
if diff.years >= 1 then
show = 'ym'
else
show = 'md'
end
else
show = 'y'
end
end
end
if type(show) ~= 'table' then
show = translateParameters.show[show]
end
if parms.disp == 'disp_raw' then
defaultJoin = 'sep_space'
abbr = 'abbr_raw'
elseif parms.wantSc then
defaultJoin = 'sep_serialcomma'
end
local diffOptions = {
round = parms.round,
duration = parms.wantDuration,
range = parms.range and true or nil,
}
local sortKey
if parms.sortable then
local value = diff.age_days + (parms.wantDuration and 1 or 0) -- days and fraction of a day
if diff.isnegative then
value = -value
end
sortKey = makeSort(value, parms.sortable)
end
local textOptions = {
extra = parms.extra,
format = parms.format,
join = parms.sep or defaultJoin,
isnegative = diff.isnegative,
range = parms.range,
sortKey = sortKey,
spell = parms.spell,
suffix = parms.suffix, -- not currently used
}
if show.id == 'hide' then
return sortKey or ''
end
local values = { diff:age(show.id, diffOptions) }
if values[1] then
return makeText(values, show, names[abbr], textOptions)
end
if diff.partial then
-- Handle a more complex range such as
-- {{age_yd|20 Dec 2001|2003|range=yes}} → 1 year, 12 days or 2 years, 11 days
local opt = {
format = textOptions.format,
join = textOptions.join,
isnegative = textOptions.isnegative,
spell = textOptions.spell,
}
return
(textOptions.sortKey or '') ..
makeText({ diff.partial.mindiff:age(show.id, diffOptions) }, show, names[abbr], opt) ..
rangeJoin(textOptions.range) ..
makeText({ diff.partial.maxdiff:age(show.id, diffOptions) }, show, names[abbr], opt, true) ..
(textOptions.suffix or '')
end
return message('mt-bad-show', show.id)
end
local function getDates(frame, getopt)
-- Parse template parameters and return one of:
-- * date (a date table, if single)
-- * date1, date2 (two date tables, if not single)
-- * text (a string error message)
-- A missing date is optionally replaced with the current date.
-- If wantMixture is true, a missing date component is replaced
-- from the current date, so can get a bizarre mixture of
-- specified/current y/m/d as has been done by some "age" templates.
-- Some results may be placed in table getopt.
local Date, currentDate = getExports(frame)
getopt = getopt or {}
local function flagCurrent(text)
-- This allows the calling template to detect if the current date has been used,
-- that is, whether both dates have been entered in a template expecting two.
-- For example, an infobox may want the age when an event occurred, not the current age.
-- Don't bother detecting if wantMixture is used because not needed and it is a poor option.
if not text then
if getopt.noMissing then
return nil -- this gives a nil date which gives an error
end
text = 'currentdate'
if getopt.flag == 'usesCurrent' then
getopt.usesCurrent = true
end
end
return text
end
local args = frame:getParent().args
local fields = {}
local isNamed = args.year or args.year1 or args.year2 or
args.month or args.month1 or args.month2 or
args.day or args.day1 or args.day2
if isNamed then
fields[1] = args.year1 or args.year
fields[2] = args.month1 or args.month
fields[3] = args.day1 or args.day
fields[4] = args.year2
fields[5] = args.month2
fields[6] = args.day2
else
for i = 1, 6 do
fields[i] = args[i]
end
end
local imax = 0
for i = 1, 6 do
fields[i] = stripToNil(fields[i])
if fields[i] then
imax = i
end
if getopt.omitZero and i % 3 ~= 1 then -- omit zero months and days as unknown values but keep year 0 which is 1 BCE
if isZero(fields[i]) then
fields[i] = nil
getopt.partial = true
end
end
end
local fix = getopt.fix and 'fix' or ''
local partialText = getopt.partial and 'partial' or ''
local dates = {}
if isNamed or imax >= 3 then
local nrDates = getopt.single and 1 or 2
if getopt.wantMixture then
-- Cannot be partial since empty fields are set from current.
local components = { 'year', 'month', 'day' }
for i = 1, nrDates * 3 do
fields[i] = fields[i] or currentDate[components[i > 3 and i - 3 or i]]
end
for i = 1, nrDates do
local index = i == 1 and 1 or 4
local y, m, d = fields[index], fields[index+1], fields[index+2]
if (m == 2 or m == '2') and (d == 29 or d == '29') then
-- Workaround error with following which attempt to use invalid date 2001-02-29.
-- {{age_ymwd|year1=2001|year2=2004|month2=2|day2=29}}
-- {{age_ymwd|year1=2001|month1=2|year2=2004|month2=1|day2=29}}
-- TODO Get rid of wantMixture because even this ugly code does not handle
-- 'Feb' or 'February' or 'feb' or 'february'.
if not ((y % 4 == 0 and y % 100 ~= 0) or y % 400 == 0) then
d = 28
end
end
dates[i] = Date(y, m, d)
end
else
-- If partial dates are allowed, accept
-- year only, or
-- year and month only
-- Do not accept year and day without a month because that makes no sense
-- (and because, for example, Date('partial', 2001, nil, 12) sets day = nil, not 12).
for i = 1, nrDates do
local index = i == 1 and 1 or 4
local y, m, d = fields[index], fields[index+1], fields[index+2]
if (getopt.partial and y and (m or not d)) or (y and m and d) then
dates[i] = Date(fix, partialText, y, m, d)
elseif not y and not m and not d then
dates[i] = Date(flagCurrent())
end
end
end
else
getopt.textdates = true -- have parsed each date from a single text field
dates[1] = Date(fix, partialText, flagCurrent(fields[1]))
if not getopt.single then
dates[2] = Date(fix, partialText, flagCurrent(fields[2]))
end
end
if not dates[1] then
return message(getopt.missing1 or 'mt-need-valid-ymd')
end
if getopt.single then
return dates[1]
end
if not dates[2] then
return message(getopt.missing2 or 'mt-need-valid-ymd2')
end
return dates[1], dates[2]
end
local function ageGeneric(frame)
-- Return the result required by the specified template.
-- Can use sortable=x where x = on/table/off/debug in any supported template.
-- Some templates default to sortable=on but can be overridden.
local name = frame.args.template
if not name then
return message('mt-template-x')
end
local args = frame:getParent().args
local specs = {
age_days = { -- {{age in days}}
show = 'd',
disp = 'disp_raw',
},
age_days_nts = { -- {{age in days nts}}
show = 'd',
disp = 'disp_raw',
format = 'format_commas',
sortable = 'on',
},
duration_days = { -- {{duration in days}}
show = 'd',
disp = 'disp_raw',
duration = true,
},
duration_days_nts = { -- {{duration in days nts}}
show = 'd',
disp = 'disp_raw',
format = 'format_commas',
sortable = 'on',
duration = true,
},
age_full_years = { -- {{age}}
show = 'y',
abbr = 'abbr_raw',
flag = 'usesCurrent',
omitZero = true,
range = 'no',
},
age_full_years_nts = { -- {{age nts}}
show = 'y',
abbr = 'abbr_raw',
format = 'format_commas',
sortable = 'on',
},
age_in_years = { -- {{age in years}}
show = 'y',
abbr = 'abbr_raw',
negative = 'error',
range = 'dash',
},
age_in_years_nts = { -- {{age in years nts}}
show = 'y',
abbr = 'abbr_raw',
negative = 'error',
range = 'dash',
format = 'format_commas',
sortable = 'on',
},
age_infant = { -- {{age for infant}}
-- Do not set show because special processing is done later.
abbr = yes(args.abbr) and 'abbr_infant' or 'abbr_off',
disp = 'disp_age',
sep = 'sep_space',
sortable = 'on',
},
age_m = { -- {{age in months}}
show = 'm',
disp = 'disp_raw',
},
age_w = { -- {{age in weeks}}
show = 'w',
disp = 'disp_raw',
},
age_wd = { -- {{age in weeks and days}}
show = 'wd',
},
age_yd = { -- {{age in years and days}}
show = 'yd',
format = 'format_commas',
sep = args.sep ~= 'and' and 'sep_comma' or nil,
},
age_yd_nts = { -- {{age in years and days nts}}
show = 'yd',
format = 'format_commas',
sep = args.sep ~= 'and' and 'sep_comma' or nil,
sortable = 'on',
},
age_ym = { -- {{age in years and months}}
show = 'ym',
sep = 'sep_comma',
},
age_ymd = { -- {{age in years, months and days}}
show = 'ymd',
range = true,
},
age_ymwd = { -- {{age in years, months, weeks and days}}
show = 'ymwd',
wantMixture = true,
},
}
local spec = specs[name]
if not spec then
return message('mt-template-bad-name')
end
if name == 'age_days' then
local su = stripToNil(args['show unit'])
if su then
if su == 'abbr' or su == 'full' then
spec.disp = nil
spec.abbr = su == 'abbr' and 'abbr_on' or nil
end
end
end
local partial, autofill
local range = stripToNil(args.range) or spec.range
if range then
-- Suppose partial dates are used and age could be 11 or 12 years.
-- "|range=" (empty value) has no effect (spec is used).
-- "|range=yes" or spec.range == true sets range = true (gives "11 or 12")
-- "|range=dash" or spec.range == 'dash' sets range = 'dash' (gives "11–12").
-- "|range=no" or spec.range == 'no' sets range = nil and fills each date in the diff (gives "12").
-- ("on" is equivalent to "yes", and "off" is equivalent to "no").
-- "|range=OTHER" sets range = nil and rejects partial dates.
range = ({ dash = 'dash', off = 'no', no = 'no', [true] = true })[range] or yes(range)
if range then
partial = true -- accept partial dates with a possible age range for the result
if range == 'no' then
autofill = true -- missing month/day in first or second date are filled from other date or 1
range = nil
end
end
end
local getopt = {
fix = yes(args.fix),
flag = stripToNil(args.flag) or spec.flag,
omitZero = spec.omitZero,
partial = partial,
wantMixture = spec.wantMixture,
}
local date1, date2 = getDates(frame, getopt)
if type(date1) == 'string' then
return date1
end
local format = stripToNil(args.format)
local spell = spellOptions[format]
if format then
format = 'format_' .. format
elseif name == 'age_days' and getopt.textdates then
format = 'format_commas'
end
local parms = {
diff = date2:subtract(date1, { fill = autofill }),
wantDuration = spec.duration or yes(args.duration),
range = range,
wantSc = yes(args.sc),
show = args.show == 'hide' and 'hide' or spec.show,
abbr = spec.abbr,
disp = spec.disp,
extra = makeExtra(args, getopt.usesCurrent and format ~= 'format_raw'),
format = format or spec.format,
round = yes(args.round),
sep = spec.sep,
sortable = translateParameters.sortable[args.sortable or spec.sortable],
spell = spell,
}
if (spec.negative or frame.args.negative) == 'error' and parms.diff.isnegative then
return message('mt-date-wrong-order')
end
return from_en(dateDifference(parms))
end
local function bda(frame)
-- Implement [[Template:Birth date and age]].
local args = frame:getParent().args
local options = {
missing1 = 'mt-need-valid-bd',
noMissing = true,
single = true,
}
local date = getDates(frame, options)
if type(date) == 'string' then
return date -- error text
end
local Date = getExports(frame)
local diff = Date('currentdate') - date
if diff.isnegative or diff.years > 150 then
return message('mt-invalid-bd-age')
end
local disp = mtext['txt-bda-disp']
local show = 'y'
if diff.years < 2 then
disp = 'disp_age'
if diff.years == 0 and diff.months == 0 then
show = 'd'
else
show = 'm'
end
end
local result = substituteParameters(
mtext['txt-bda'],
date:text('%-Y-%m-%d'),
from_en(date:text(dateFormat(args))),
from_en(dateDifference({
diff = diff,
show = show,
abbr = 'abbr_off',
disp = disp,
sep = 'sep_space',
}))
)
local warnings = tonumber(frame.args.warnings)
if warnings and warnings > 0 then
local good = {
df = true,
mf = true,
day = true,
day1 = true,
month = true,
month1 = true,
year = true,
year1 = true,
}
local invalid
local imax = options.textdates and 1 or 3
for k, _ in pairs(args) do
if type(k) == 'number' then
if k > imax then
invalid = tostring(k)
break
end
else
if not good[k] then
invalid = k
break
end
end
end
if invalid then
result = result .. message('mt-bad-param1', invalid)
end
end
return result
end
local function dda(frame)
-- Implement [[Template:Death date and age]].
local args = frame:getParent().args
local options = {
missing1 = 'mt-need-valid-dd',
missing2 = 'mt-need-valid-bd2',
noMissing = true,
partial = true,
}
local date1, date2 = getDates(frame, options)
if type(date1) == 'string' then
return date1
end
local diff = date1 - date2
if diff.isnegative then
return message('mt-dd-wrong-order')
end
local Date = getExports(frame)
local today = Date('currentdate') + 1 -- one day in future allows for timezones
if date1 > today then
return message('mt-dd-future')
end
local years
if diff.partial then
years = diff.partial.years
years = type(years) == 'table' and years[2] or years
else
years = diff.years
end
if years > 150 then
return message('mt-invalid-dates-age')
end
local fmt_date, fmt_ymd
if date1.day then -- y, m, d known
fmt_date = dateFormat(args)
fmt_ymd = '%-Y-%m-%d'
elseif date1.month then -- y, m known; d unknown
fmt_date = '%B %-Y'
fmt_ymd = '%-Y-%m-00'
else -- y known; m, d unknown
fmt_date = '%-Y'
fmt_ymd = '%-Y-00-00'
end
local sortKey
local sortable = translateParameters.sortable[args.sortable]
if sortable then
local value = (date1.partial and date1.partial.first or date1).jdz
sortKey = makeSort(value, sortable)
end
local result = (sortKey or '') .. substituteParameters(
mtext['txt-dda'],
date1:text(fmt_ymd),
from_en(date1:text(fmt_date)),
from_en(dateDifference({
diff = diff,
show = 'y',
abbr = 'abbr_off',
disp = mtext['txt-dda-disp'],
range = 'dash',
sep = 'sep_space',
}))
)
local warnings = tonumber(frame.args.warnings)
if warnings and warnings > 0 then
local good = {
df = true,
mf = true,
}
local invalid
local imax = options.textdates and 2 or 6
for k, _ in pairs(args) do
if type(k) == 'number' then
if k > imax then
invalid = tostring(k)
break
end
else
if not good[k] then
invalid = k
break
end
end
end
if invalid then
result = result .. message('mt-bad-param1', invalid)
end
end
return result
end
local function dateToGsd(frame)
-- Implement [[Template:Gregorian serial date]].
-- Return Gregorian serial date of the given date, or the current date.
-- The returned value is negative for dates before 1 January 1 AD
-- despite the fact that GSD is not defined for such dates.
local date = getDates(frame, { wantMixture=true, single=true })
if type(date) == 'string' then
return date
end
return tostring(date.gsd)
end
local function jdToDate(frame)
-- Return formatted date from a Julian date.
-- The result includes a time if the input includes a fraction.
-- The word 'Julian' is accepted for the Julian calendar.
local Date = getExports(frame)
local args = frame:getParent().args
local date = Date('juliandate', args[1], args[2])
if date then
return from_en(date:text())
end
return message('mt-need-jdn')
end
local function dateToJd(frame)
-- Return Julian date (a number) from a date which may include a time,
-- or the current date ('currentdate') or current date and time ('currentdatetime').
-- The word 'Julian' is accepted for the Julian calendar.
local Date = getExports(frame)
local args = frame:getParent().args
local date = Date(args[1], args[2], args[3], args[4], args[5], args[6], args[7])
if date then
return tostring(date.jd)
end
return message('mt-need-valid-ymd-current')
end
local function timeInterval(frame)
-- Implement [[Template:Time interval]].
-- There are two positional arguments: date1, date2.
-- The default for each is the current date and time.
-- Result is date2 - date1 formatted.
local Date = getExports(frame)
local args = frame:getParent().args
local parms = {
extra = makeExtra(args),
wantDuration = yes(args.duration),
range = yes(args.range) or (args.range == 'dash' and 'dash' or nil),
wantSc = yes(args.sc),
}
local fix = yes(args.fix) and 'fix' or ''
local date1 = Date(fix, 'partial', stripToNil(args[1]) or 'currentdatetime')
if not date1 then
return message('mt-invalid-start')
end
local date2 = Date(fix, 'partial', stripToNil(args[2]) or 'currentdatetime')
if not date2 then
return message('mt-invalid-end')
end
parms.diff = date2 - date1
for argname, translate in pairs(translateParameters) do
local parm = stripToNil(args[argname])
if parm then
parm = translate[parm]
if parm == nil then -- test for nil because false is a valid setting
return message('mt-bad-param2', argname, args[argname])
end
parms[argname] = parm
end
end
if parms.round then
local round = parms.round
local show = parms.show
if round ~= 'on' then
if show then
if show.id ~= round then
return message('mt-conflicting-show', args.show, args.round)
end
else
parms.show = translateParameters.show[round]
end
end
parms.round = true
end
return from_en(dateDifference(parms))
end
return {
age_generic = ageGeneric, -- can emulate several age templates
birth_date_and_age = bda, -- Template:Birth_date_and_age
death_date_and_age = dda, -- Template:Death_date_and_age
gsd = dateToGsd, -- Template:Gregorian_serial_date
extract = dateExtract, -- Template:Extract
jd_to_date = jdToDate, -- Template:?
JULIANDAY = dateToJd, -- Template:JULIANDAY
time_interval = timeInterval, -- Template:Time_interval
}
jek97xqopwtzsa2wantif4sv4ks21v2
Module:Arguments
828
41298065
948472485
948472482
2020-04-01T06:12:40Z
MusikAnimal
14882394
1 revision imported
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
5qx9tzlul9ser30uxj9nbasjt92cevn
Module:Authority control
828
39028170
1089934163
1089010245
2022-05-26T12:17:45Z
MSGJ
42630
update link to USCG
Scribunto
text/plain
require('Module:No globals')
local p = {}
local title = mw.title.getCurrentTitle()
local namespace = title.namespace
local testcases = (string.sub(title.subpageText,1,9) == 'testcases')
--[[==========================================================================]]
--[[ Category functions ]]
--[[==========================================================================]]
local function addCat( cat )
if cat and cat ~= '' then return '[[Category:'..cat..']]'..p.redCatLink(cat) end
return ''
end
function p.getCatForId( id )
local cat = ''
if namespace == 0 then
cat = 'Articles with '..id..' identifiers'
end
return addCat(cat)
end
function p.redCatLink( cat ) --cat == 'Blah' (not 'Category:Blah', not '[[Category:Blah]]')
if cat and cat ~= '' and testcases == false and mw.title.new(cat, 14).exists == false then
return '[[Category:Pages with red-linked authority control categories]]'
end
return ''
end
function p.createRow( id, rawValues, link, links, withUid, specialCat, prefix)
local faultyCat = 'Articles with faulty '..(specialCat or id)..' identifiers'
if links then -- all links[] use withUid = false; no check needed
local row = ''
if prefix then
row = row..'*'..prefix
end
for i, l in ipairs( links ) do
if i == 1 and not prefix then row = row..'*'
else row = row..'\n**' end
if l then
row = row..'<span class="uid">'..l..'</span>'
else
row = row..'<span class="error">The '..id..' id '..rawValues[i]..' is not valid.</span>'..addCat(faultyCat)
end
end
return row..'\n'
elseif link then -- All IDs that have a prefix support multiple identifiers, so prefix is not needed
if withUid then
return '*<span class="nowrap"><span class="uid">'..link..'</span></span>\n'
end
return '*<span class="nowrap">'..link..'</span>\n'
end
return '* <span class="error">The '..id..' id '..rawValues..' is not valid.</span>'..addCat(faultyCat)..'\n'
end
--[[==========================================================================]]
--[[ Property formatting functions ]]
--[[==========================================================================]]
-- If a link has a suitable entry in the global inter-wiki prefix table at [[:m:Interwiki_map]],
-- please consider routing through this prefix rather than as external link URL.
-- This will ease future maintenance as necessary updates to the link can be centrally carried out there rather than by updating this module.
-- The "external link" icon would disappear for such entries.
function p.aagLink( id, label)
--P3372's format regex: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.aucklandartgallery.com/explore-art-and-ideas/artist/'..id..'/ '..(label or 'Auckland')..']'..p.getCatForId( 'AAG' )
end
function p.acmLink( id, label )
--P864's format regex: \d{11} (e.g. 12345678901)
if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://dl.acm.org/profile/'..id..' '..(label or 'Association for Computing Machinery')..']'..p.getCatForId( 'ACM-DL' )
end
function p.adbLink( id, label )
--P1907's format regex: [a-z][-a-z]+-([1-3]\d|[1-9])\d{0,3} (e.g. barton-sir-edmund-toby-71)
if not id:match( '^[a-z][-a-z]+-[1-3]%d%d?%d?%d?$' ) and
not id:match( '^[a-z][-a-z]+-[1-9]%d?%d?%d?$' ) then
return false
end
return '[http://adb.anu.edu.au/biography/'..id..' '..(label or 'Australia')..']'..p.getCatForId( 'ADB' )
end
function p.admiraltyLink(id,label)
--P3562's format regex: [A-Q]\d{4}(\.\d+)? (e.g. D1204.1)
if not id:match('^[A-Q]%d%d%d%d$') and
not id:match('^[A-Q]%d%d%d%d%.%d+$') then
return false
end
return id..p.getCatForId( 'admiralty' )
end
function p.agsaLink( id, label )
--P6804's format regex: [1-9]\d* (e.g. 3625)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.agsa.sa.gov.au/collection-publications/collection/creators/_/'..id..'/ '..(label or 'South Australia')..']'..p.getCatForId( 'AGSA' )
end
function p.ARLHSLink(id,label)
--P2980's format regex: [A-Z]{3}\d{3,4}[A-Z]?| e.g. LAT023
if not id:match('^[A-Z][A-Z][A-Z]%d%d%d%d?[A-Z]?$') then
return false
end
return '[http://wlol.arlhs.com/lighthouse/'..id..'.html '..(label or 'ARLHS')..']'..p.getCatForId( 'ARLHS' )
end
function p.autoresuyLink( id, label )
--P2558's format regex: [1-9]\d{0,4} (e.g. 12345)
if not id:match( '^[1-9]%d?%d?%d?%d?$' ) then
return false
end
return '[https://autores.uy/autor/'..id..' '..(label or 'Uruguay')..']'..p.getCatForId( 'autores.uy' )
end
function p.awrLink( id, label )
--P4186's format regex: (([A-Z]{3}\d{4})|([A-Z]{2}\d{5}))[a-z] (e.g. PR00768b)
if not id:match( '^[A-Z][A-Z][A-Z]%d%d%d%d[a-z]$' ) and
not id:match( '^[A-Z][A-Z]%d%d%d%d%d[a-z]$' ) then
return false
end
return '[http://www.womenaustralia.info/biogs/'..id..'.htm '..(label or 'Australian Women\'s Register')..']'..p.getCatForId( 'AWR' )
end
function p.bibsysLink( id, label )
--P1015's format regex: [1-9]\d* or [1-9](\d{0,8}|\d{12}) (e.g. 1234567890123)
--TODO: follow up @ [[d:Property talk:P1015#Discrepancy between the 2 regex constraints]] or escalate/investigate
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?$' ) and
not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://authority.bibsys.no/authority/rest/authorities/html/'..id..' '..(label or 'Norway')..']'..p.getCatForId( 'BIBSYS' )
end
function p.bildLink( id, label )
--P2092's format regex: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.bildindex.de/document/obj'..id..' '..(label or 'Bildindex (Germany)')..']'..p.getCatForId( 'Bildindex' )
end
function p.bncLink( id, label )
--P1890's format regex: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://www.bncatalogo.cl/F?func=direct&local_base=red10&doc_number='..id..' '..(label or 'Chile')..']'..p.getCatForId( 'BNC' )
end
function p.bneLink( id, label )
--P950's format regex: (XX|FF|a)\d{4,7}|(bima|bimo|bica|bis[eo]|bivi|Mise|Mimo|Mima)\d{10} (e.g. XX1234567)
if not id:match( '^[XF][XF]%d%d%d%d%d?%d?%d?$' ) and
not id:match( '^a%d%d%d%d%d?%d?%d?$' ) and
not id:match( '^bi[mcsv][aoei]%d%d%d%d%d%d%d%d%d%d$' ) and
not id:match( '^Mi[sm][eoa]%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id='..id..' '..(label or 'Spain')..']'..p.getCatForId( 'BNE' ) --no https as of 9/2019
end
function p.bnfLink( id, label )
--P268's format regex: \d{8}[0-9bcdfghjkmnpqrstvwxz] (e.g. 123456789)
if not id:match( '^c?b?%d%d%d%d%d%d%d%d[0-9bcdfghjkmnpqrstvwxz]$' ) then
return false
end
--Add cb prefix if it has been removed
if not id:match( '^cb.+$' ) then
id = 'cb'..id
end
return '[https://catalogue.bnf.fr/ark:/12148/'..id..' '..(label or 'France')..'] [https://data.bnf.fr/ark:/12148/'..id..' (data)]'..p.getCatForId( 'BNF' )
end
function p.bnmmLink( id, label )
--P3788's format regex: \d{9} (e.g. 000024044)
if id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return '[https://catalogo.bn.gov.ar/F/?func=direct&local_base=BNA10&doc_number='..id..' '..(label or 'Argentina')..']'..p.getCatForId( 'BNMM' )
else
return false
end
end
function p.botanistLink( id, label )
--P428's format regex: ('t )?(d')?(de )?(la )?(van (der )?)?(Ma?c)?(De)?(Di)?\p{Lu}?C?['\p{Ll}]*([-'. ]*(van )?(y )?(d[ae][nr]?[- ])?(Ma?c)?[\p{Lu}bht]?C?['\p{Ll}]*)*\.? ?f?\.? (e.g. L.)
--not easily/meaningfully implementable in Lua's regex since "(this)?" is not allowed...
if not mw.ustring.match( id, "^[%u%l%d%. '-]+$" ) then --better than nothing
return false
end
id = id:gsub(' +', '%%20')
return '[https://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation='..id..' '..(label or 'International Plant Names Index')..']'..p.getCatForId( 'Botanist' )
end
function p.bpnLink( id, label )
--P651's format regex: \d{6,8} (e.g. 00123456)
if not id:match( '^%d%d%d%d%d%d%d%d$' ) and --original format regex, changed 8/2019 to
not id:match( '^0?%d%d%d%d%d%d%d$' ) and --allow 1-2 leading 0s, allowed by the website
not id:match( '^0?0?%d%d%d%d%d%d$' ) then
return false
end
return '[http://www.biografischportaal.nl/en/persoon/'..id..' '..(label or 'Netherlands')..']'..p.getCatForId( 'BPN' ) --no https as of 9/2019
end
function p.canticLink( id, label )
--P1273's format regex: a\d{7}[0-9x] (e.g. a10640745)
if not id:match( '^a%d%d%d%d%d%d%d[%dx]$' ) then
return false
end
return '[http://cantic.bnc.cat/registres/CUCId/'..id..' '..(label or 'Catalonia')..']'..p.getCatForId( 'CANTIC' ) --no https as of 10/2019
end
function p.canticnLink( id, label )
--P9984's format regex: 981(0|1)\d{9}06706 (e.g. 981058515460906706)
if not id:match( '^981[0-1]%d%d%d%d%d%d%d%d%d06706$' ) then
return false
end
return '[https://cantic.bnc.cat/registre/'..id..' '..(label or 'Catalonia')..']'..p.getCatForId( 'CANTICN' )
end
function p.ccgLink( id, label )
--P3920's format regex: ([NAIP])?[1-9]\d*(\.\d+)? (e.g. A1761)
if not id:match( '^[NAIP]?[1-9]%d*$' ) and
not id:match( '^[NAIP]?[1-9]%d*%.%d+$' ) then
return false
end
return id..p.getCatForId( 'CCG' )
end
function p.ciniiLink( id, label )
--P271's format regex: DA\d{7}[\dX] (e.g. DA12345678)
if not id:match( '^DA%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
return '[https://ci.nii.ac.jp/author/'..id..'?l=en '..(label or 'CiNii (Japan)')..']'..p.getCatForId( 'CINII' )
end
function p.cwgcLink( id, label )
--P1908's format regex: [1-9]\d* (e.g. 75228351)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.cwgc.org/find-war-dead/casualty/'..id..'/ '..(label or 'Commonwealth War Graves Commission')..']'..p.getCatForId( 'CWGC' )
end
function p.emuLink( id, label )
--P4613's format regex: \d{1,6} (e.g. 15409 (or 015409))
if not id:match( '^%d%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://esu.com.ua/search_articles.php?id='..id..' '..(label or 'Ukraine')..']'..p.getCatForId( 'EMU' )
end
function p.daaoLink( id, label )
--P1707's format regex: [a-z\-]+\d* (e.g. rolf-harris)
if not id:match( '^[a-z%-]+%d*$' ) then
return false
end
return '[https://www.daao.org.au/bio/'..id..' '..(label or 'Australian Artists')..']'..p.getCatForId( 'DAAO' )
end
function p.dblpLink( id, label )
--P2456's format regex: \d{2,3} /\d+(-\d+)?|[a-z] /[a-zA-Z][0-9A-Za-z]*(-\d+)? (e.g. 123/123)
if not id:match( '^%d%d%d?/%d+$' ) and
not id:match( '^%d%d%d?/%d+%-%d+$' ) and
not id:match( '^[a-z]/[a-zA-Z][0-9A-Za-z]*$' ) and
not id:match( '^[a-z]/[a-zA-Z][0-9A-Za-z]*%-%d+$' ) then
return false
end
return '[https://dblp.org/pid/'..id..' '..(label or 'DBLP (computer science)')..']'..p.getCatForId( 'DBLP' )
end
function p.dibLink( id, label )
--P6829's format regex: 0[01]\d{4}(\.[A-D])? (e.g. 001953)
if not id:match( '^0[01]%d%d%d%d%.?[A-D]?$' ) then
return false
end
return '[https://dib.cambridge.org/viewReadPage.do?articleId='..id..' '..(label or 'Ireland')..']'..p.getCatForId( 'DIB' )
end
function p.dsiLink( id, label )
--P2349's format regex: [1-9]\d* (e.g. 1538)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..(label or 'Scientific illustrators')..']'..p.getCatForId( 'DSI' )
end
function p.dtbioLink( id, label )
--P7902's format regex: 1[0-9]{7,8}[0-9X] (e.g. 118554700)
if not id:match( '^1[0-9]%d%d%d%d%d%d%d?[0-9X]$' ) then
return false
end
return '[https://www.deutsche-biographie.de/pnd'..id..'.html?language=en '..(label or 'Germany')..']'..p.getCatForId( 'DTBIO' )
end
function p.fastLink( id, label )
--P2163's format regex: [1-9]\d{0,7} (e.g. 1916996)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://id.worldcat.org/fast/'..id..'/ '..(label or 'Faceted Application of Subject Terminology')..']'..p.getCatForId( 'FAST' )
end
function p.fnzaLink( id, label )
--P6792's format regex: [1-9]\d* (e.g. 9785)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://findnzartists.org.nz/artist/'..id..'/ '..(label or 'New Zealand Artists')..']'..p.getCatForId( 'FNZA' )
end
function p.gndLink( id, label )
--P227's format regex: 1[012]?\d{7}[0-9X]|[47]\d{6}-\d|[1-9]\d{0,7}-[0-9X]|3\d{7}[0-9X] (e.g. 4079154-3)
if not id:match( '^1[012]?%d%d%d%d%d%d%d[0-9X]$' ) and
not id:match( '^[47]%d%d%d%d%d%d%-%d$' ) and
not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%-[0-9X]$' ) and
not id:match( '^3%d%d%d%d%d%d%d[0-9X]$' ) then
return false
end
return '[https://d-nb.info/gnd/'..id..' '..(label or 'Germany')..']'..p.getCatForId( 'GND' )
end
function p.googleLink( id, label )
--P1960's format regex: [-_0-9A-Za-z]{12} (e.g. CUO0vDcAAAAJ)
if not id:match( '^[%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u]$' ) then
return false
end
return '[https://scholar.google.com/citations?user='..id..' '..(label or 'Google Scholar')..']'..p.getCatForId( 'Google Scholar' )
end
function p.hdsLink( id, label )
--P902's format regex: \d{6} (e.g. 050123)
if not id:match( '^%d%d%d%d%d%d$' ) then
return false
end
return '[https://hls-dhs-dss.ch/fr/articles/'..id..' '..(label or 'Historical Dictionary of Switzerland')..']'..p.getCatForId( 'HDS' )
end
function p.iaafLink( id, label )
--P1146's format regex: [0-9][0-9]* (e.g. 012)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.iaaf.org/athletes/_/'..id..' '..(label or 'World Athletics')..']'..p.getCatForId( 'IAAF' )
end
function p.iccuLink( id, label )
--P396's format regex: \D{2}[A-Z0-3]V\d{6} (e.g. CFIV000163)
if not id:match( '^%u%u[%u0-3]V%d%d%d%d%d%d$' ) then --legacy: %u used here instead of %D (but the faulty ID cat is empty, out of ~12k uses)
return false
end
return '[https://opac.sbn.it/nome/'..id..' '..(label or 'Italy')..']'..p.getCatForId( 'ICCU' )
end
function p.iciaLink( id, label )
--P1736's format regex: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.imj.org.il/artcenter/newsite/en/?artist='..id..' '..(label or 'ICIA (Israel)')..']'..p.getCatForId( 'ICIA' )
end
function p.ieuLink( id, label )
--P9070's format regex: [A-Z]\\[A-Z]\\[A-Za-z0-9]+ (e.g. K\Y\Kyiv)
if not id:match( '^[A-Z]\\[A-Z]\\%w+$' ) then
return false
end
return '[http://www.encyclopediaofukraine.com/display.asp?linkpath=pages\\'..id..' '..(label or 'Internet Encyclopedia of Ukraine')..']'..p.getCatForId( 'IEU' )
end
function p.isniLink( id, label )
id = p.validateIsni( id ) --e.g. 0000-0000-6653-4145
if not id then
return false
end
return '[https://isni.org/isni/'..id..' '..(label or 'ISNI')..']'..p.getCatForId( 'ISNI' )
end
function p.j9uLink( id, label )
--P8189's format regex: 9870(0|1)\d{8}05171 (e.g. 987007305652505171)
if not id:match( '^9870[0-1]%d%d%d%d%d%d%d%d05171$' ) then
return false
end
return '[http://uli.nli.org.il/F/?func=find-b&local_base=NLX10&find_code=UID&request='..id..' '..(label or 'Israel')..']'..p.getCatForId( 'J9U' )
end
function p.jocondeLink( id, label )
--P347's format regex: [\-0-9A-Za-z]{11} (e.g. 12345678901)
local regex = '^'..string.rep('[%-0-9A-Za-z]', 11)..'$'
if not id:match( regex ) then
return false
end
return '[https://www.pop.culture.gouv.fr/notice/joconde/'..id..' '..(label or 'Joconde (France)')..']'..p.getCatForId( 'Joconde' )
end
function p.kulturnavLink( id, label )
--P1248's format regex: [0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
return '[http://kulturnav.org/'..id..' '..(label or 'KulturNav (Norway)')..']'..p.getCatForId( 'KULTURNAV' ) --no https as of 9/2019
end
function p.lccnLink( id, label )
local parts = p.splitLccn( id ) --e.g. n78039510
if not parts then
return false
end
local lccnType = parts[1] ~= 'sh' and 'names' or 'subjects'
id = parts[1] .. parts[2] .. p.append( parts[3], '0', 6 )
return '[https://id.loc.gov/authorities/'..lccnType..'/'..id..' '..(label or 'United States')..']'..p.getCatForId( 'LCCN' )
end
function p.lirLink( id, label )
--P886's format regex: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[http://www.e-lir.ch/e-LIR___Lexicon.'..id..'.450.0.html '..(label or 'Lexicon Istoric Retic (Switzerland)')..']'..p.getCatForId( 'LIR' ) --no https as of 9/2019
end
function p.lnbLink( id, label )
--P1368's format regex: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://kopkatalogs.lv/F?func=direct&local_base=lnc10&doc_number='..id..'&P_CON_LNG=ENG '..(label or 'Latvia')..']'..p.getCatForId( 'LNB' )
end
function p.marinaMilitareLink( id, label )
--P3863's format regex: [1-9]\d* (e.g. 3856)
if id:match( '^[1-9]%d*$' ) then
return '[http://www.marina.difesa.it/cosa-facciamo/per-la-difesa-sicurezza/fari/Pagine/'..id..'.aspx '..(label or 'Italy')..']'..p.getCatForId( 'Marina Militare' )
else
return false
end
end
function p.mathsnLink( id, label )
--P4955's format regex: [1-9]\d{4,6} (e.g. 175270)
if not id:match( '^[1-9]%d%d%d%d%d?%d?$' ) then
return false
end
return '[https://mathscinet.ams.org/mathscinet/MRAuthorID/'..id..' '..(label or 'MathSciNet')..']'..p.getCatForId( 'MATHSN' )
end
function p.mbaLink( id, label )
--P434's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/artist/'..id
local cat = p.getCatForId( 'MusicBrainz' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBA (identifier)|MusicBrainz]] ['..url..' artist]'..cat
end
end
function p.mbareaLink( id, label )
--P982's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/area/'..id
local cat = p.getCatForId( 'MusicBrainz area' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBAREA (identifier)|MusicBrainz]] ['..url..' area]'..cat
end
end
function p.mbiLink( id, label )
--P1330's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/instrument/'..id
local cat = p.getCatForId( 'MusicBrainz instrument' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBI (identifier)|MusicBrainz]] ['..url..' instrument]'..cat
end
end
function p.mblLink( id, label )
--P966's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/label/'..id
local cat = p.getCatForId( 'MusicBrainz label' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBL (identifier)|MusicBrainz]] ['..url..' label]'..cat
end
end
function p.mbpLink( id, label )
--P1004's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/place/'..id
local cat = p.getCatForId( 'MusicBrainz place' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBP (identifier)|MusicBrainz]] ['..url..' place]'..cat
end
end
function p.mbrgLink( id, label )
--P436's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/release-group/'..id
local cat = p.getCatForId( 'MusicBrainz release group' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBRG (identifier)|MusicBrainz]] ['..url..' release group]'..cat
end
end
function p.mbsLink( id, label )
--P1407's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/series/'..id
local cat = p.getCatForId( 'MusicBrainz series' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBS (identifier)|MusicBrainz]] ['..url..' series]'..cat
end
end
function p.mbwLink( id, label )
--P435's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
local url = 'https://musicbrainz.org/work/'..id
local cat = p.getCatForId( 'MusicBrainz work' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBW (identifier)|MusicBrainz]] ['..url..' work]'..cat
end
end
function p.mgpLink( id, label )
--P549's format regex: \d{1,6} (e.g. 123456)
if not id:match( '^%d%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://www.mathgenealogy.org/id.php?id='..id..' '..(label or 'Mathematics Genealogy Project')..']'..p.getCatForId( 'MGP' )
end
function p.mtLink( id, label )
--P3601's format regex: \d{10} (e.g. 1000004707)
if id:match( '^%d%d%d%d%d%d%d%d%d%d$' ) then
return '[https://www.marinetraffic.com/en/ais/details/lights/'..id..' '..(label or 'MarineTraffic')..']'..p.getCatForId( 'MarineTraffic' )
else
return false
end
end
function p.naraLink( id, label )
--P1225's format regex: ^([1-9]\d{0,8})$ (e.g. 123456789)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://catalog.archives.gov/id/'..id..' '..(label or 'National Archives (US)')..']'..p.getCatForId( 'NARA' )
end
function p.nclLink( id, label )
--P1048's format regex: \d+ (e.g. 1081436)
if not id:match( '^%d+$' ) then
return false
end
return '[http://aleweb.ncl.edu.tw/F/?func=accref&acc_sequence='..id..'&CON_LNG=ENG '..(label or 'Taiwan')..']'..p.getCatForId( 'NCL' ) --no https as of 9/2019
end
function p.ndlLink( id, label )
--P349's format regex: 0?\d{8} (e.g. 012345678)
if not id:match( '^0?%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://id.ndl.go.jp/auth/ndlna/'..id..' '..(label or 'Japan')..']'..p.getCatForId( 'NDL' )
end
function p.ngaLink(id,label)
--P3563's format rgex: 11[0-6]-\d+(\.\d+)? (e.g. 114-7721.2)
if not id:match('^11[0-6]%-%d+%.?%d*$') then
return false
end
return '[https://wikidata-externalid-url.toolforge.org/?url=https%3A%2F%2Fmsi.nga.mil%2FqueryResults%3Fpublications%2Fngalol%2Flights-buoys%3Fvolume%3D%251%26featureNumber%3D%252%26includeRemovals%3Dfalse%26output%3Dhtml&exp=(%5Cd%7B3%7D)-(.*)&id='..id..' '..(label or 'NGA')..']'..p.getCatForId( 'NGA' )
end
function p.ngvLink( id, label )
--P2041's format regex: \d+ (e.g. 12354)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.ngv.vic.gov.au/explore/collection/artist/'..id..'/ '..(label or 'Victoria')..']'..p.getCatForId( 'NGV' )
end
function p.nkcLink( id, label )
--P691's format regex: [a-z]{2,4}[0-9]{2,14} (e.g. abcd12345678901234)
if not id:match( '^[a-z][a-z][a-z]?[a-z]?%d%d%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://aleph.nkp.cz/F/?func=find-c&local_base=aut&ccl_term=ica='..id..'&CON_LNG=ENG '..(label or 'Czech Republic')..']'..p.getCatForId( 'NKC' )
end
function p.nlaLink( id, label )
--P409's format regex: [1-9][0-9]{0,11} (e.g. 123456789012)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://nla.gov.au/anbd.aut-an'..id..' '..(label or 'Australia')..']'..p.getCatForId( 'NLA' )
end
function p.nlgLink( id, label )
--P3348's format regex: [1-9]\d* (e.g. 1)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://data.nlg.gr/resource/authority/record'..id..' '..(label or 'Greece')..']'..p.getCatForId( 'NLG' )
end
function p.nlkLink( id, label )
--P5034's format regex: KA.(19|20).{7} (e.g. KAC201501465)
if not id:match( '^KA.19.......$' ) and
not id:match( '^KA.20.......$' ) then
return false
end
return '[https://librarian.nl.go.kr/LI/contents/L20101000000.do?id='..id..' '..(label or 'Korea')..']'..p.getCatForId( 'NLK' )
end
function p.nlpLink( id, label )
--P1695's format regex: 9810[0-9]\d* or A[0-9]{7}[0-9X] (e.g. 9810123456789012345 or A10414836)
if not id:match( '^9810%d+$' ) and
not id:match( '^A%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
return '[https://tools.wmflabs.org/wikidata-externalid-url?p=1695&id='..id..' '..(label or 'Poland')..']'..p.getCatForId( 'NLP' )
end
function p.nlrLink( id, label )
--P1003's format regex: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://aleph.bibnat.ro:8991/F/?func=direct&local_base=NLR10&doc_number='..id..' '..(label or 'Romania')..']'..p.getCatForId( 'NLR' )
end
function p.nskLink( id, label )
--P1375's format regex: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://katalog.nsk.hr/F/?func=direct&doc_number='..id..'&local_base=nsk10 '..(label or 'Croatia')..']'..p.getCatForId( 'NSK' ) --no https as of 9/2019
end
function p.ntaLink( id, label )
--P1006's format regex: \d{8}[\dX] (e.g. 12345678X)
if not id:match( '^%d%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
return '[http://data.bibliotheken.nl/id/thes/p'..id..' '..(label or 'Netherlands')..']'..p.getCatForId( 'NTA' )
end
function p.orcidLink( id, label )
id = p.validateIsni( id ) --e.g. 0000-0002-7398-5483
if not id then
return false
end
id = id:sub( 1, 4 )..'-'..id:sub( 5, 8 )..'-'..id:sub( 9, 12 )..'-'..id:sub( 13, 16 )
return '[https://orcid.org/'..id..' '..(label or 'ORCID')..']'..p.getCatForId( 'ORCID' )
end
function p.picLink( id, label )
--P2750's format regex: [1-9]\d* (e.g. 1)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://pic.nypl.org/constituents/'..id..' '..(label or 'Photographers\' Identities')..']'..p.getCatForId( 'PIC' )
end
function p.plwabnLink( id, label )
--P7293's format regex: 981[0-9]{8}05606 (e.g. 9810696457305606)
if not id:match( '^981%d%d%d%d%d%d%d%d05606*$' ) then
return false
end
return '[http://mak.bn.org.pl/cgi-bin/KHW/makwww.exe?BM=1&NU=1&IM=4&WI='..id..' '..(label or 'Poland')..']'..p.getCatForId( 'PLWABN' )
end
function p.publonsLink( id, label )
--P3829's format regex: \d+ (e.g. 654601)
if not id:match( '^%d+$' ) then
return false
end
return '[https://publons.com/author/'..id..'/ '..(label or 'Publons (researchers)')..']'..p.getCatForId( 'Publons' )
end
function p.ridLink( id, label )
--P1053's format regex: [A-Z]{1,3}-\d{4}-(19|20)\d\d (e.g. AAS-5150-2020)
if not id:match( '^[A-Z][A-Z]?[A-Z]?%-%d%d%d%d%-19%d%d$' ) and
not id:match( '^[A-Z][A-Z]?[A-Z]?%-%d%d%d%d%-20%d%d$' ) then
return false
end
return '[https://www.researcherid.com/rid/'..id..' '..(label or 'ResearcherID')..']'..p.getCatForId( 'RID' )
end
function p.rismLink( id, label )
--P5504's format regex: (pe|ks)?\[1-9]d* (e.g. pe30006410)
if not id:match( '^pe[1-9]%d*$' ) and --99% start with 'pe'
not id:match( '^ks[1-9]%d*$' ) and
not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://opac.rism.info/search?id='..id..' '..(label or 'RISM (France)')..']'..p.getCatForId( 'RISM' )
end
function p.reroLink( id, label )
--P3065's format regex: 0[1-2]-[A-Z0-9]{1,10} (e.g. 02-A012345678)
if not id:match( '^0[1-2]%-[A-Z%d][A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?$' ) then
return false
end
return '[http://data.rero.ch/'..id..' '..(label or 'RERO (Switzerland)')..']'..p.getCatForId( 'RERO' )
end
function p.rkdartistsLink( id, label )
--P650's format regex: [1-9]\d{0,5} (e.g. 123456)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://rkd.nl/en/explore/artists/'..id..' '..(label or 'RKD Artists (Netherlands)')..']'..p.getCatForId( 'RKDartists' )
end
function p.rkdidLink( id, label )
--P350's format regex: [1-9]\d{0,5} (e.g. 123456)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://rkd.nl/nl/explore/images/'..id..' '..(label or 'RKD ID (Netherlands)')..']'..p.getCatForId( 'RKDID' )
end
function p.rslLink( id, label )
--P947's format regex: \d{1,9} (e.g. 123456789)
if not id:match( '^%d%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request='..id..'&CON_LNG=ENG '..(label or 'Russia')..']'..p.getCatForId( 'RSL' ) --no https as of 9/2019
end
function p.scopusLink( id, label )
--P1153's format regex: [1-9]\d{9,10} (e.g. 35247902700)
if not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d?$' ) then
return false
end
return '[https://www.scopus.com/authid/detail.uri?authorId='..id..' '..(label or 'Scopus author')..']'..p.getCatForId( 'Scopus' )
end
function p.selibrLink( id, label )
--P906's format regex: [1-9]\d{4,5} (e.g. 123456)
if not id:match( '^[1-9]%d%d%d%d%d?$' ) then
return false
end
return '[https://libris.kb.se/auth/'..id..' '..(label or 'Sweden')..']'..p.getCatForId( 'SELIBR' )
end
function p.sikartLink( id, label )
--P781's format regex: \d{7,9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d?%d?$' ) then
return false
end
return '[http://www.sikart.ch/KuenstlerInnen.aspx?id='..id..'&lng=en '..(label or 'SIKART (Switzerland)')..']'..p.getCatForId( 'SIKART' ) --no https as of 9/2019
end
function p.snacLink( id, label )
--P3430's format regex: \d*[A-Za-z][0-9A-Za-z]* (e.g. A)
if not id:match( '^%d*[A-Za-z][0-9A-Za-z]*$' ) then
return false
end
return '[https://snaccooperative.org/ark:/99166/'..id..' '..(label or 'Social Networks and Archival Context')..']'..p.getCatForId( 'SNAC-ID' )
end
function p.sudocLink( id, label )
--P269's format regex: (\d{8}[\dX]|) (e.g. 026927608)
if not id:match( '^%d%d%d%d%d%d%d%d[%dxX]$' ) then --legacy: allow lowercase 'x'
return false
end
return '[https://www.idref.fr/'..id..' '..(label or 'SUDOC (France)')..']'..p.getCatForId( 'SUDOC' )
end
function p.ta98Link( id, label )
--P1323's format regex: A\d{2}\.\d\.\d{2}\.\d{3}[FM]? (e.g. A12.3.45.678)
if not id:match( '^A%d%d%.%d%.%d%d%.%d%d%d[FM]?$' ) then
return false
end
local longurl = '[http://tools.wmflabs.org/wikidata-externalid-url/?p=1323&url_prefix=https:%2F%2Fwww.unifr.ch%2Fifaa%2FPublic%2FEntryPage%2FTA98%20Tree%2FEntity%20TA98%20EN%2F&url_suffix=%20Entity%20TA98%20EN.htm&id='
return longurl..id..' '..(label or 'Terminologia Anatomica')..']'..p.getCatForId( 'TA98' )
end
function p.tdviaLink( id, label )
--P7314's format regex: [0-9a-z/-]+] (e.g. barkan-omer-lutfi)
if not id:match( '^[%d%l/-]+$' ) then
return false
end
return '[https://islamansiklopedisi.org.tr/'..id..' '..(label or 'İslâm Ansiklopedisi')..']'..p.getCatForId( 'TDVİA' )
end
function p.tepapaLink( id, label )
--P3544's format regex: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://collections.tepapa.govt.nz/agent/'..id..' '..(label or 'Te Papa (New Zealand)')..']'..p.getCatForId( 'TePapa' )
end
function p.tlsLink( id, label )
id = id:gsub(' +', '_')
--P1362's format regex: \p{Lu}[\p{L}\d_',\.\-\(\)\*\/–&]{3,89} (e.g. Abcd)
--Mediawiki page title partial URL so consider validation with mw.title or "[^#<>%[%] {|}]"
local class = "[%w_',%.%-%(%)%*%/–&]"
local idlen = mw.ustring.len (id)
if idlen < 4 or idlen > 90 then
return false
end
local regex = '^%u'..string.rep(class, idlen - 1)..'$'
if not mw.ustring.match( id, regex ) then
return false
end
return '[http://tls.theaterwissenschaft.ch/wiki/'..id..' '..(label or 'Theaterlexikon (Switzerland)')..']'..p.getCatForId( 'TLS' ) --no https as of 9/2019
end
function p.troveLink( id, label )
--P1315's format regex: [1-9]\d{5,7} (e.g. 12345678)
if not id:match( '^[1-9]%d%d%d%d%d%d?%d?$' ) then
return false
end
return '[https://trove.nla.gov.au/people/'..id..' '..(label or 'Trove (Australia)')..']'..p.getCatForId( 'Trove' )
end
function p.ukparlLink( id, label )
--P6213's format regex: [a-zA-Z\d]{8} (e.g. AQUupyiR)
if not id:match( '^[a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d]$' ) then
return false
end
return '[https://id.parliament.uk/'..id..' '..(label or 'UK Parliament')..']'..p.getCatForId( 'UKPARL' )
end
function p.ulanLink( id, label )
--P245's format regex: 500\d{6} (e.g. 500123456)
if not id:match( '^500%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid='..id..' '..(label or 'Artist Names (Getty)')..']'..p.getCatForId( 'ULAN' )
end
function p.uscgLink( id, label )
--P3723's format regex: [1-7]-\d{1,5}(.[1-9])? (e.g. 6-0695)
if not id:match( '^[1-7]%-%d%d?%d?%d?%d?$' ) and
not id:match( '^[1-7]%-%d%d?%d?%d?%d?%.%d*[1-9]$' ) then
return false
end
return '[[USCG (identifier)|USCG]] ([https://www.navcen.uscg.gov/pdf/lightlists/LightList%20V'..mw.ustring.sub(id,1,1)..'.pdf '..id..'])'..p.getCatForId( 'USCG' )
end
function p.uscongressLink( id, label )
--P1157's format regex: [A-Z]00[01]\d{3} (e.g. A000123)
if not id:match( '^[A-Z]00[01]%d%d%d$' ) then
return false
end
return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index='..id..' '..(label or 'US Congress')..']'..p.getCatForId( 'USCongress' ) --no https as of 9/2019
end
function p.vcbaLink( id, label )
--P8034's format regex: \d{3}\/[1-9]\d{0,5} (e.g. 494/9793)
if not id:match( '^%d%d%d\/[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
id = id:gsub('\/', '_')
return '[https://opac.vatlib.it/auth/detail/'..id..' '..(label or 'Vatican')..']'..p.getCatForId( 'VcBA' )
end
function p.viafLink( id, label )
--P214's format regex: [1-9]\d(\d{0,7}|\d{17,20}) (e.g. 123456789, 1234567890123456789012)
if not id:match( '^[1-9]%d%d?%d?%d?%d?%d?%d?%d?$' ) and
not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d?%d?%d?$' ) then
return false
end
-- If the "VIAF" entry at [[:m:Interwiki map]] would resolve to "https://viaf.org/viaf/$1" (rather than "http://viaf.org/viaf/$1", as it currently still does),
-- then the code below could change from '[https://viaf.org/viaf/'..id..' '..id..']' to '[[:VIAF:'..id..'|'..id..']]'.
return '[https://viaf.org/viaf/'..id..' '..(label or 'VIAF')..']'..p.getCatForId( 'VIAF' )
end
function p.worldcatidLink( id, label )
--P7859's format regex: viaf-\d+|lccn-n[a-z]?[0-9\-]+|n[cps]-.+ (e.g. viaf-100181709, lccn-n78-95332, np-verbeck,%20william$1861)
if not id:match( '^viaf%-%d+$' ) and
not id:match( '^lccn%-n[a-z]?[0-9%-]+$' ) and
not id:match( '^n[cps]%-.+$' ) then
return false
end
return '[https://www.worldcat.org/identities/'..mw.uri.encode(id, 'PATH')..'/ '..(label or 'WorldCat')..']'..p.getCatForId( 'WORLDCATID' )
end
function p.zbmathLink( id, label )
--P1556's format regex: [a-z][a-z\-]*(\.[a-z][a-z\-]*)?(\.[0-9]*)? (e.g. turing.alan-m)
local ps = {'%l[%l%-]*', '%.%l[%l%-]*', '%.%d*'}
if not id:match( '^'..ps[1]..'$' ) and -- prefix with no capture options
not id:match( '^'..ps[1]..ps[2]..'$' ) and -- prefix with first capture option
not id:match( '^'..ps[1]..ps[3]..'$' ) and -- prefix with second capture option
not id:match( '^'..ps[1]..ps[2]..ps[3]..'$' ) then -- prefix and both capture options
return false
end
return '[https://zbmath.org/authors/?q=ai:'..id..' '..(label or 'zbMATH')..']'..p.getCatForId( 'ZBMATH' )
end
--[[=========================== Helper functions =============================]]
function p.append(str, c, length)
while str:len() < length do
str = c..str
end
return str
end
--Returns the ISNI check digit isni must be a string where the 15 first elements are digits, e.g. 0000000066534145
function p.getIsniCheckDigit( isni )
local total = 0
for i = 1, 15 do
local digit = isni:byte( i ) - 48 --Get integer value
total = (total + digit) * 2
end
local remainder = total % 11
local result = (12 - remainder) % 11
if result == 10 then
return 'X'
end
return tostring( result )
end
--Validate ISNI (and ORCID) and retuns it as a 16 characters string or returns false if it's invalid
--See http://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
function p.validateIsni( id )
--P213 (ISNI) format regex: [0-9]{4} [0-9]{4} [0-9]{4} [0-9]{3}[0-9X] (e.g. 0000-0000-6653-4145)
--P496 (ORCID) format regex: 0000-000(1-[5-9]|2-[0-9]|3-[0-4])\d{3}-\d{3}[\dX] (e.g. 0000-0002-7398-5483)
id = id:gsub( '[ %-]', '' ):upper()
if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
if p.getIsniCheckDigit( id ) ~= string.char( id:byte( 16 ) ) then
return false
end
return id
end
function p.splitLccn( id )
--P244's format regex: (n|nb|nr|no|ns|sh)([4-9][0-9]|00|20[0-1][0-9])[0-9]{6} (e.g. n78039510)
if id:match( '^%l%l?%l?%d%d%d%d%d%d%d%d%d?%d?$' ) then
id = id:gsub( '^(%l+)(%d+)(%d%d%d%d%d%d)$', '%1/%2/%3' )
end
if id:match( '^%l%l?%l?/%d%d%d?%d?/%d+$' ) then
return mw.text.split( id, '/' )
end
return false
end
--[[==========================================================================]]
--[[ Wikidata & documentation functions ]]
--[[==========================================================================]]
function p.getIdsFromWikidata( itemId, property )
local ids = {}
if not mw.wikibase then
return ids
end
local statements = mw.wikibase.getBestStatements( itemId, property )
if statements then
for _, statement in ipairs( statements ) do
if statement.mainsnak.datavalue then
table.insert( ids, statement.mainsnak.datavalue.value )
end
end
end
return ids
end
function p.checkcat( category,label )
local ret='[[:Category:'..category..'|'..label..']]'
if mw.title.new(category, 14).exists == false then
ret = ret..' <span class="plainlinks" style="font-size:85%;">[['..tostring(mw.uri.fullUrl('Category:'..category,'action=edit&preload=Template:Authority_control/preload'))..' create]]</span>'
end
return ret
end
-- Creates a human-readable standalone wikitable version of p.conf, and tracking categories with page counts, for use in the documentation
function p.docConfTable( frame )
local wikiTable = '<table class="wikitable sortable">'..
'<tr><th rowspan=2>Parameter</th>'..
'<th rowspan=2>Section</th>'..
'<th rowspan=2>Appears as</th>'..
'<th rowspan=2 data-sort-type=number>Wikidata property</th>'..
'<th colspan=2>Tracking categories and page counts</th></tr>'..
'<tr><th>[[:Category:Articles with authority control information|Articles]]</th>'..
'<th>[[:Category:Articles with faulty authority control information|Faulty IDs]]</th></tr>'
local lang = mw.getContentLanguage()
local a, f, P = 0, 0, 0 --cumulative sums
for _, conf in pairs( p.conf ) do
local param, pid, section = conf[1], conf[2], conf[4]
local appearsAs
if conf.prefix then
appearsAs = conf.prefix
else
appearsAs = conf[3](conf[5])
end
local link = conf.link or param..' (identifier)'
local category = conf.category or param
local args = { id = 'f', pid }
local wpl = frame:expandTemplate{ title = 'Wikidata property link', args = args }
--cats
local articleCat = 'Articles with '..category..' identifiers'
local faultyCat = 'Articles with faulty '..category..' identifiers'
--counts
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local faultyCount = lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'pages') )
--calcs
P = P + 1 --property count
a = a + lang:parseFormattedNumber(articleCount)
f = f + lang:parseFormattedNumber(faultyCount)
--concat
wikiTable = wikiTable..'<tr><td>[['..link..'|'..param..']]</td>'..
'<td>'..section..'</td>'..
'<td>'..appearsAs..'</td>'..
'<td data-sort-value='..pid..'>'..wpl..'</td>'..
'<td style="text-align: right;">'..p.checkcat(articleCat,articleCount)..'</td>'..
'<td style="text-align: right;">'..p.checkcat(faultyCat,faultyCount)..'</td></tr>'
end
--append derivative WorldCat cats
local wcd = { 'WorldCat-LCCN', 'WorldCat-VIAF' }
for _, w in pairs(wcd) do
local articleCat = 'Articles with '..w..' identifiers'
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local appearsAs
if w == 'WorldCat-LCCN' then
appearsAs = '[https://www.worldcat.org/identities/lccn-n79-113947 WorldCat (via Library of Congress)]'
else
appearsAs = '[https://www.worldcat.org/identities/containsVIAFID/12345789 WorldCat (via VIAF)]'
end
a = a + lang:parseFormattedNumber(articleCount)
wikiTable = wikiTable..'<tr><td>-</td>'..
'<td>General</td>'..
'<td>'..appearsAs..'</td>'..
'<td data-sort-value='..w..'>—</td>'..
'<td style="text-align: right;">[[:Category:'..articleCat..'|'..articleCount..']]</td>'..
'<td style="text-align: right;">—</td></tr>'
end
--append sums
wikiTable = wikiTable..'<tr><th style="text-align: right;" colspan=3>Totals</th>'..
'<th style="text-align: right;">'..lang:formatNum(P)..'</th>'..
'<th style="text-align: right;">'..lang:formatNum(a)..'</th>'..
'<th style="text-align: right;">'..lang:formatNum(f)..'</th></tr></table>'
return require('Module:Suppress categories').main(wikiTable)
end
--[[==========================================================================]]
--[[ Configuration ]]
--[[==========================================================================]]
-- Please use "<parameter> (identifier)" redirects rather than linking directly to the target page.
-- This reduces clutter in "What links here" on both the redirect and the target,
-- and improves reverse lookup of articles where a manifestation of each identifier is used.
-- p.conf table basic format: { 'parameter name', propertyId # in Wikidata, formatting/validation function, section, example ID for documentation }
-- p.conf table optional named parameters:
-- link: to override the link in the documentation (defaults to "<parameter> (identifer)")
-- category: to override the ID in category names (defaults to "... with <parameter> identifiers")
-- prefix: to include a prefix (usually a wikilink explaining what the identifier is) before the external link itself
p.conf = {
{ 'AAG', 3372, p.aagLink, 'Art galleries and museums', '1' },
{ 'ACM-DL', 864, p.acmLink, 'Scientific databases', '12345678901', link = 'ACM DL (identifier)' },
{ 'ADB', 1907, p.adbLink,'Biographical dictionaries', 'barton-sir-edmund-toby-71' },
{ 'admiralty', 3562, p.admiraltyLink, 'Lighthouse identifiers', 'D1204.1', prefix='[[Admiralty number|Admiralty]]'},
{ 'AGSA', 6804, p.agsaLink, 'Art galleries and museums', '3625' },
{ 'ARLHS', 2980, p.ARLHSLink, 'Lighthouse identifiers', 'LAT023'},
{ 'autores.uy', 2558, p.autoresuyLink, 'Biographical dictionaries', '12345' },
{ 'AWR', 4186, p.awrLink, 'Biographical dictionaries', 'PR00768b' },
{ 'BIBSYS', 1015, p.bibsysLink, 'National libraries', '1234567890123' },
{ 'Bildindex', 2092, p.bildLink, 'Art research institutes', '1' },
{ 'BNC', 1890, p.bncLink, 'National libraries', '123456789' },
{ 'BNE', 950, p.bneLink, 'National libraries', 'XX1234567' },
{ 'BNF', 268, p.bnfLink, 'National libraries', '123456789' },
{ 'BNMM', 3788, p.bnmmLink, 'National libraries', '000024044' },
{ 'Botanist', 428, p.botanistLink , 'Scientific databases', 'L.' },
{ 'BPN', 651, p.bpnLink , 'Biographical dictionaries', '12345678' },
{ 'CANTIC', 1273, p.canticLink, 'National libraries', 'a12345678' },
{ 'CANTICN', 9984, p.canticnLink, 'National libraries', '981058515460906706' },
{ 'CCG', 3920, p.ccgLink, 'Lighthouse identifiers', 'A1761', prefix='[[CCG (identifier)|CCG]]' },
{ 'CINII', 271, p.ciniiLink, 'Scientific databases', 'DA12345678', link = 'CiNii (identifier)' },
{ 'CWGC', 1908, p.cwgcLink, 'Other', '1234567' },
{ 'DAAO', 1707, p.daaoLink, 'Art research institutes', 'rolf-harris' },
{ 'DBLP', 2456, p.dblpLink, 'Scientific databases', '123/123' },
{ 'DIB', 6829, p.dibLink, 'Biographical dictionaries', '001953' },
{ 'DSI', 2349, p.dsiLink, 'Art research institutes', '1538' },
{ 'DTBIO', 7902, p.dtbioLink, 'Biographical dictionaries', '118554700' },
{ 'EMU', 4613, p.emuLink, 'National libraries', '15409' },
{ 'FAST', 2163, p.fastLink, 'Other', '1' },
{ 'FNZA', 6792, p.fnzaLink, 'Art research institutes', '12' },
{ 'GND', 227, p.gndLink, 'National libraries', '4079154-3' },
{ 'Google Scholar', 1960, p.googleLink, 'Scientific databases', 'QPdLuj8AAAAJ' },
{ 'HDS', 902, p.hdsLink, 'Other', '050123' },
{ 'IAAF', 1146, p.iaafLink, 'Other', '123' },
{ 'ICCU', 396, p.iccuLink, 'National libraries', 'CFIV000163' }, --formerly SBN
{ 'ICIA', 1736, p.iciaLink, 'Art research institutes', '1' },
{ 'IEU', 9070, p.ieuLink, 'Other', 'N\\A\\NationalAcademyofArtandArchitecture' },
{ 'ISNI', 213, p.isniLink, 'General', '0000-0000-6653-4145', prefix = '[[ISNI (identifier)|ISNI]]' },
{ 'J9U', 8189, p.j9uLink, 'National libraries', '987007305652505171' },
{ 'Joconde', 347, p.jocondeLink, 'Art research institutes', '12345678901' },
{ 'KULTURNAV', 1248, p.kulturnavLink, 'Art research institutes', '12345678-1234-1234-1234-1234567890AB', link = 'KulturNav (identifier)' },
{ 'LCCN', 244, p.lccnLink, 'National libraries', 'n78039510' },
{ 'LIR', 886, p.lirLink, 'Other', '1' },
{ 'LNB', 1368, p.lnbLink, 'National libraries', '123456789' },
{ 'Marina Militare', 3863, p.marinaMilitareLink, 'Lighthouse identifiers', '3856' },
{ 'MarineTraffic', 3601, p.mtLink, 'Lighthouse identifiers', '1000004707' },
{ 'MATHSN', 4955, p.mathsnLink, 'Scientific databases', '175270' },
{ 'MBA', 434, p.mbaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBAREA', 982, p.mbareaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz area' }, --special cat name
{ 'MBI', 1330, p.mbiLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz instrument' }, --special cat name
{ 'MBL', 966, p.mblLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz label' }, --special cat name
{ 'MBP', 1004, p.mbpLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz place' }, --special cat name
{ 'MBRG', 436, p.mbrgLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz release group' }, --special cat name
{ 'MBS', 1407, p.mbsLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz series' }, --special cat name
{ 'MBW', 435, p.mbwLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz work' }, --special cat name
{ 'MGP', 549, p.mgpLink, 'Scientific databases', '123456' },
{ 'NARA', 1225, p.naraLink, 'Other', '12345678' },
{ 'NCL', 1048, p.nclLink, 'National libraries', '1081436' },
{ 'NDL', 349, p.ndlLink, 'National libraries', '012345678' },
{ 'NGA', 3563, p.ngaLink, 'Lighthouse identifiers', '114-5592'},
{ 'NGV', 2041, p.ngvLink, 'Art galleries and museums', '12354' },
{ 'NKC', 691, p.nkcLink, 'National libraries', 'abcd12345678901234' },
{ 'NLA', 409, p.nlaLink, 'National libraries', '123456789012' },
{ 'NLG', 3348, p.nlgLink, 'National libraries', '12345678' },
{ 'NLK', 5034, p.nlkLink, 'National libraries', 'KAB197000000' },
{ 'NLP', 1695, p.nlpLink, 'National libraries', '9810123456789012345' },
{ 'NLR', 1003, p.nlrLink, 'National libraries', '123456789' },
{ 'NSK', 1375, p.nskLink, 'National libraries', '123456789' },
{ 'NTA', 1006, p.ntaLink, 'National libraries', '12345678X' },
{ 'ORCID', 496, p.orcidLink, 'General', '0000-0002-7398-5483', prefix = '[[ORCID (identifier)|ORCID]]' },
{ 'PIC', 2750, p.picLink, 'Art research institutes', '1' },
{ 'PLWABN', 7293, p.plwabnLink, 'National libraries', '9812345678905606' },
{ 'Publons', 3829, p.publonsLink, 'Scientific databases', '2776255' },
{ 'RID', 1053, p.ridLink, 'Scientific databases', 'A-1234-1934' },
{ 'RISM', 5504, p.rismLink, 'Other', 'pe1', prefix = '[[RISM (identifier)|RISM (France)]]' },
{ 'RERO', 3065, p.reroLink, 'Other', '02-A012345678', prefix = '[[RERO (identifier)|RERO (Switzerland)]]' },
{ 'RKDartists', 650, p.rkdartistsLink, 'Art research institutes', '123456' },
{ 'RKDID', 350, p.rkdidLink, 'Art research institutes', '123456' },
{ 'RSL', 947, p.rslLink, 'National libraries', '123456789' },
{ 'Scopus', 1153, p.scopusLink, 'Scientific databases', '7005487412' },
{ 'SELIBR', 906, p.selibrLink, 'National libraries', '123456' },
{ 'SIKART', 781, p.sikartLink, 'Art research institutes', '123456789' },
{ 'SNAC-ID', 3430, p.snacLink, 'Other', 'A' },
{ 'SUDOC', 269, p.sudocLink, 'Other', '026927608', prefix = '[[SUDOC (identifier)|SUDOC (France)]]' },
{ 'TA98', 1323, p.ta98Link, 'Scientific databases', 'A12.3.45.678' },
{ 'TDVİA', 7314, p.tdviaLink, 'Other', 'asim-b-behdele' },
{ 'TePapa', 3544, p.tepapaLink, 'Art galleries and museums', '1' },
{ 'TLS', 1362, p.tlsLink, 'Other', 'Abcd' },
{ 'Trove', 1315, p.troveLink, 'Other', '12345678', prefix = '[[Trove (identifier)|Trove (Australia)]]' }, --formerly NLA-person
{ 'UKPARL', 6213, p.ukparlLink, 'Other', 'AQUupyiR' },
{ 'ULAN', 245, p.ulanLink, 'Art research institutes', '500123456' },
{ 'USCG', 3723, p.uscgLink, 'Lighthouse identifiers', '6-0695'},
{ 'USCongress', 1157, p.uscongressLink, 'Other', 'A000123', link = 'US Congress (identifier)' },
{ 'VcBA', 8034, p.vcbaLink, 'National libraries', '494/9793' },
{ 'VIAF', 214, p.viafLink, 'General', '123456789', prefix = '[[VIAF (identifier)|VIAF]]' },
{ 'WORLDCATID', 7859, p.worldcatidLink, 'General', 'lccn-n78-95332', link = 'WorldCat Identities (identifier)' },
{ 'ZBMATH', 1556, p.zbmathLink, 'Scientific databases', 'turing.alan-m' },
}
-- Legitimate aliases to p.conf, for convenience
-- Format: { 'alias', 'parameter name in p.conf' }
p.aliases = {
{ 'DNB', 'GND' }, --Deutsche Nationalbibliothek -> Gemeinsame Normdatei
{ 'MusicBrainz', 'MBA' },
{ 'MusicBrainz artist', 'MBA' },
{ 'MusicBrainz label', 'MBL' },
{ 'MusicBrainz release group', 'MBRG' },
{ 'MusicBrainz work', 'MBW' },
{ 'SBN', 'ICCU' }, --SBN alias to be deprecated at a later stage
{ 'TDVIA', 'TDVİA' }, --alias name without diacritics
{ 'tdvia', 'TDVİA' }, --lowercase variant without diacritics
}
-- Deprecated aliases to p.conf; tracked in [[Category:Articles with deprecated authority control identifiers]]
-- Format: { 'deprecated parameter name', 'replacement parameter name in p.conf' }
p.deprecated = {
{ 'GKD', 'GND' },
{ 'PND', 'GND' },
{ 'RLS', 'RSL' },
{ 'SWD', 'GND' },
{ 'NARA-organization', 'NARA' },
{ 'NARA-person', 'NARA' },
}
--[[==========================================================================]]
--[[ Main ]]
--[[==========================================================================]]
function p.authorityControl( frame )
local resolveEntity = require( 'Module:ResolveEntityId' )
local parentArgs = frame:getParent().args --WD IDs added here later
local iParentArgs = 0 --count original/manual parent args only later
local worldcatCat = ''
local elementsCat = ''
local multipleIdCat = ''
local suppressedIdCat = ''
local suppressedIdCatArts = ''
local deprecatedIdCat = ''
local differentOnWDCat = ''
local sameOnWDCat = ''
local stateCat = ''
--redirect aliases to proper parameter names
for _, a in pairs( p.aliases ) do
local alias, param = a[1], a[2]
if (parentArgs[param] == nil or parentArgs[param] == '') and parentArgs[alias] then
parentArgs[param] = parentArgs[alias]
end
end
--redirect deprecated parameters to proper parameter names, and assign tracking cat
for _, d in pairs( p.deprecated ) do
local dep, param = d[1], d[2]
if (parentArgs[param] == nil or parentArgs[param] == '') and parentArgs[dep] then
parentArgs[param] = parentArgs[dep]
if namespace == 0 then
deprecatedIdCat = '[[Category:Articles with deprecated authority control identifiers|'..dep..']]'
end
end
end
--use QID= parameter for testing/example purposes only
local itemId = nil
if namespace ~= 0 then
local qid = parentArgs['qid'] or parentArgs['QID']
if qid then
itemId = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '')
itemId = resolveEntity._id(itemId) --nil if unresolvable
end
elseif mw.wikibase then
itemId = mw.wikibase.getEntityIdForCurrentPage()
end
--Wikidata fallback if available
if itemId then
local suppressedIdCount = 0
local iMatches = 0
for _, params in ipairs( p.conf ) do
if params[2] > 0 then
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if val == nil or val == '' then
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[2] )
if wikidataIds[1] then
if val == '' and (namespace == 0 or testcases) then
suppressedIdCount = suppressedIdCount + 1
suppressedIdCat = '[[Category:Articles with suppressed authority control identifiers|'..params[1]..']]'
else
parentArgs[params[1]] = wikidataIds[1] --add ID from WD
end
end
else
iParentArgs = iParentArgs + 1
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[2] )
if wikidataIds[1] and differentOnWDCat == '' then
local bMatch = false
for _, wd in pairs( wikidataIds ) do
if val == wd then
iMatches = iMatches + 1
bMatch = true
end
end
if bMatch == false then
differentOnWDCat = '[[Category:Pages using authority control with parameters different on Wikidata|'..params[1]..']]'
end end end end end
if iMatches > 0 and iMatches == iParentArgs then
sameOnWDCat = '[[Category:Pages using authority control with parameters all matching Wikidata]]'
end
if parentArgs['arts'] == 'arts' and suppressedIdCount > 0 then
if namespace == 0 or testcases then
local s = 's'
if suppressedIdCount == 1 then s = '' end
local sCat = 'ACArt with '..suppressedIdCount..' suppressed element'..s
suppressedIdCatArts = addCat(sCat)
end
end
end
--configure rows
local rct = 0
local sectionOrder = {
'General',
'National libraries',
'Art galleries and museums',
'Art research institutes',
'Biographical dictionaries',
'Scientific databases',
'Lighthouse identifiers',
'Other'
}
local sections = {
['General'] = {},
['National libraries'] = {},
['Art galleries and museums'] = {},
['Art research institutes'] = {},
['Biographical dictionaries'] = {},
['Scientific databases'] = {},
['Lighthouse identifiers'] = {},
['Other'] = {}
}
--don't show CANTIC if CANTICN is present, since they both go to the Library of Catalonia
--and the library has deprecated CANTIC IDs in favor of CANTICN IDs
if parentArgs.CANTICN or parentArgs.canticn then
parentArgs.CANTIC = ''
parentArgs.cantic = ''
end
--don't show NLP if PLWABN is present, since they both go to the National Library of Poland
--and the library has deprecated NLP IDs in favor of PLWABN IDs
if parentArgs.PLWABN or parentArgs.plwabn then
parentArgs.NLP = ''
parentArgs.nlp = ''
end
for _, params in ipairs( p.conf ) do
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
local tval, tlinks = {}, {} --init tables
if val and val ~= '' and type(params[3]) == 'function' then
table.insert( tval, val )
if params.prefix then
table.insert( tlinks, params[3]( val, '1' ) )
else
table.insert( tlinks, params[3]( val ) )
end
end
--collect other unique vals (IDs) from WD, if present
if itemId and tval[1] then
local nextIdVal = 2
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[2] )
for _, v in pairs( wikidataIds ) do
local bnew = true
for _, w in pairs( tval ) do
if v == w then bnew = false end
end
if bnew then
table.insert( tval, v )
table.insert( tlinks, params[3]( v, tostring(nextIdVal) ) )
nextIdVal = nextIdVal + 1
end
end
end
--assemble
if tval[1] then
table.insert( sections[params[4]], p.createRow( params[1], tval, nil, tlinks, true, params.category, params.prefix) )
rct = rct + 1
if tval[2] then
multipleIdCat = p.getCatForId( 'multiple' )
end
end
end
--WorldCat-VIAF & WorldCat-LCCN
local worldcatId = parentArgs['worldcatid'] or parentArgs['WORLDCATID']
if worldcatId == nil then --if WORLDCATID absent but unsuppressed
local viafId = parentArgs['viaf'] or parentArgs['VIAF']
local lccnId = parentArgs['lccn'] or parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be present, unsuppressed, & validated
table.insert( sections['General'], p.createRow( 'VIAF', viafId, '[https://www.worldcat.org/identities/containsVIAFID/'..viafId..' WorldCat (via VIAF)]', nil, false ) )
if namespace == 0 then
worldcatCat = '[[Category:Articles with WorldCat-VIAF identifiers]]'
end
rct = rct + 1
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN must be present, unsuppressed, & validated
local lccnParts = p.splitLccn( lccnId )
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1]..lccnParts[2]..'-'..lccnParts[3]
table.insert( sections['General'], p.createRow( 'LCCN', lccnId, '[https://www.worldcat.org/identities/lccn-'..lccnIdFmtd..' WorldCat (via Library of Congress)]', nil, false ) )
if namespace == 0 then
worldcatCat = '[[Category:Articles with WorldCat-LCCN identifiers]]'
end
end
rct = rct + 1
end
end
--configure Navbox
local outString = ''
local extrap = true
local extra = parentArgs.extralist
if extra == nil or extra == '' then
extrap = false
end
if rct > 0 or extrap then
local Navbox = require('Module:Navbox')
local sectionID = 1
local args = { pid = 'identifiers' } -- #target the list of identifiers
if testcases and itemId then args.qid = itemId end --expensive
local pencil = require('Module:EditAtWikidata')._showMessage(args)
local navboxArgs = {
name = 'Authority control',
navboxclass = 'authority-control',
bodyclass = 'hlist',
state = parentArgs.state or 'autocollapse',
navbar = 'off'
}
for _, sectName in ipairs(sectionOrder) do
if #sections[sectName] ~= 0 then
navboxArgs['group'..sectionID] = sectName
navboxArgs['list'..sectionID] = table.concat(sections[sectName])
sectionID = sectionID + 1
end
end
if extrap then
if parentArgs.extragroup then
navboxArgs['group'..sectionID] = parentArgs.extragroup
else
navboxArgs['group'..sectionID] = 'Additional'
end
navboxArgs['list'..sectionID] = extra
sectionID = sectionID + 1
end
if navboxArgs.list2 then
navboxArgs.title = '[[Help:Authority control|Authority control]]'..pencil
else
local sect = navboxArgs.group1
if sect == 'General' or sect == 'Other' or sect == 'Additional' then
-- Just say "Authority control" with no label if only general or only other IDs are present
-- since "general" is redundant and "other" is silly when there's nothing to contrast it with
navboxArgs.group1 = '[[Help:Authority control|Authority control]]'..pencil
else
navboxArgs.group1 = '[[Help:Authority control|Authority control: '..sect..']] '..pencil
end
end
outString = Navbox._navbox(navboxArgs)
end
--auxCats
if rct == 0 or rct >= 25 then
if namespace == 0 or testcases then
local eCat = 'AC with '..rct..' elements'
elementsCat = addCat(eCat)
end
end
if parentArgs.state then
if namespace == 0 or testcases then
local sCat
if parentArgs.state == 'collapsed' then sCat = 'AC using state parameter: collapsed'
elseif parentArgs.state == 'expanded' then sCat = 'AC using state parameter: expanded'
elseif parentArgs.state == 'autocollapse' then sCat = 'AC using state parameter: autocollapse'
else sCat = 'AC using state parameter: other'
end
stateCat = addCat(sCat)
end
end
local auxCats = worldcatCat..elementsCat..multipleIdCat..suppressedIdCat..suppressedIdCatArts..
deprecatedIdCat..differentOnWDCat..sameOnWDCat..stateCat
if testcases then
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
end
--out
outString = outString..auxCats
if namespace ~= 0 then
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Articles)', '%1:%2') --by definition
end
return outString
end
return p
hml9am1fcoeeliry3ls8pq1q9zs9meu
Module:CallAssert
828
58205810
887566074
880025075
2019-03-13T12:54:41Z
Xaosflux
502540
Changed protection level for "[[Module:CallAssert]]": used in interface [[MediaWiki:Protectedinterface]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
local function pack(...)
return {...}, select('#', ...)
end
local function mapArray(func, array, count)
local result = {}
for i = 1, count or #array do
result[i] = func(array[i])
end
return result
end
local function quote(value)
if type(value) == 'string' then
return (string.gsub(string.format('%q', value), '\\\n', '\\n')) -- Outer parentheses remove second value returned by gsub
end
local str = tostring(value)
if type(value) == 'table' and str ~= 'table' then
return '{' .. str .. '}'
end
return str
end
local function callAssert(func, funcName, ...)
local result, resultCount = pack(func(...))
if not result[1] then
local args, argsCount = pack(...)
args = mapArray(quote, args, argsCount)
local message = mw.ustring.format(
'%s(%s) failed',
funcName,
table.concat(args, ', ')
)
error(message, 2)
end
return unpack(result, 1, resultCount)
end
return callAssert
3o4jhhx56ckjnptmrhpx1y5jfvi04ui
Module:Catalog lookup link
828
57923154
968117896
884931331
2020-07-17T10:11:36Z
Trappist the monk
10289486
fix lock icon css class;
Scribunto
text/plain
--[[
|1=, |2=, |3=, |4=, |5=, |6=, |7=, |8=, |9=: Optional unnamed parameters for 0 to 9 items to be listed.
Whitespace is trimmed off both ends and the strings are urlencoded as if they were query strings.
|article-link=: Optional Wikipedia article name to link to.
|article-name=: Optional alternative text to be displayed for |article-link= link in front of catalog link.
If not specified, |article-link= is used for display as well. If both parameters are not specified, the prefix is omitted completely.
|article-suffix=: Optional symbol to be displayed after article name or link (f.e. ":"; omitted, if not defined).
|link-prefix=: Optional prefix portion of url to external catalog item(s).
|link-suffix=: Optional suffix portion of url to external catalog item(s).
|item-prefix=: Optional text displayed in front of each external link (omitted, if not defined)
|item-suffix=: Optional text displayed immediately after each external link (omitted, if not defined)
|list-separator=: Optional alternative separator displayed between list items (default: ", ", if not specified). Whitespace must be encoded.
|list-leadout=: Optional alternative leadout text displayed between the last two list items (f.e. "and", "or", "as well as", etc., default is the |list-separator= or ", ".)
|leadout-suffix=: Optional alternative suffix text of the leadout (see |list-leadout=) displayed between the last two list items.
This gets added in front of the last list item instead of the default whitespace which is added without this parameter.
This may be necessary if |list-separator= is used not only to define the list separator but also parts of the item prefix
(except for the first one). (At present, this is used only to cope with format oddities of the {{MR}} template.)
new parameters that support access icons:
|allowed_icons= – comma-separated list of keywords: free, limited, registration, subscription, none, all (default; 'all' implied when this parameter empty or omitted)
the icons specified in the following parameters are checked agains the list in |allowed-icons=; not in the list? not displayed
|url-access-all= – applies specified icon to all items in the list; accepted keywords: free, limited, registration, subscription;
|url-accessn= – applies specified icon to item n of the list (the nth positional parameter); accepted keywords: free, limited, registration, subscription;
]]
require('Module:No globals');
local getArgs = require ('Module:Arguments').getArgs;
local lock_icons = { --icon classes are defined in Module:Citation/CS1/styles.css
['free'] = {'id-lock-free', 'Freely accessible'},
['registration'] = {'id-lock-registration', 'Free registration required'},
['limited'] = {'id-lock-limited', 'Free access subject to limited trial, subscription normally required'},
['subscription'] = {'id-lock-subscription', 'Paid subscription required'},
}
--[[--------------------------< 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
--[=[-------------------------< M A K E _ L A B E L >----------------------------------------------------------
Makes a wikilinked or plain text label from arguments; when both link and display text is provided, makes a
wikilink in the form [[L|D]]; if only link is provided, makes a wikilinked label in the form [[L]]; if only display
is provided, makes a plain-text label; if neither are provided makes a label from suffix, returns an empty string else.
]=]
local function make_label (link, display, suffix)
local label = '';
if is_set (link) then
if is_set (display) then
label = table.concat ({'[[', link, '|', display, ']]'}); -- make [[L|D]] wikilinked label
else
label = table.concat ({'[[', link, ']]'}); -- make [[L]] wikilinked label
end
elseif is_set (display) then
label = display; -- plain-text label
end
if is_set (label) then
return table.concat ({label, suffix, ' '}); -- assemble the complete label
else
return suffix; -- no space after suffix if no label
end
end
--[[--------------------------< I C O N _ I N D E X _ G E T >--------------------------------------------------
returns index into lock_icons[] if value assigned to |url-access= or |url-access-all= is a valid icon selector
(free, limited, registration, subscription)
icon selection may be limited to a subset of the icons with:
|allow_icons=<comma-separated list of allowed icons>
<comma-separated list of allowed icons> may be any of the keywords: free, limited, registration, subscription, none, all
keyword 'all' is default condition; 'all' is implied when |allowed=icons= is empty or omitted
keyword 'none' for use with identifiers where icons are inappropriate (isbn, issn, oclc)
Templates using this module should set:
|allow_icons=free for most identifiers;
|allow_icons=none for isbn, issn, oclc, etc
|url-access= is alias of |url-access1=
]]
local function icon_index_get (args, k)
local icon;
local param_name = (1 == k and is_set (args['url-access']) and 'url-access') or table.concat ({'url-access', k}); -- make an enumerated parameter name
if is_set (args['url-access-all']) and lock_icons[args['url-access-all']] then -- if set and valid
icon = args['url-access-all']; -- tentatively
elseif is_set (args[param_name]) and lock_icons[args[param_name]] then -- if set and valid
icon = args[param_name]; -- tentatively
else
return nil; -- neither |url-access-all= nor |url-accessn= set so return nil
end
if args['allow_icons'] and args['allow_icons']:find ('none') then -- if 'none' keyword is present
return nil; -- icons display not allowed
end
if not is_set (args['allow_icons']) or args['allow_icons']:find ('all') or args['allow_icons']:find (icon) then --if all allowed or specified icon is allowed
return icon; -- return selected icon as index into icon table
end
end
--[[--------------------------< M A I N >----------------------------------------------------------------------
Template entrypoint to this module; arguments come primarily from the parent frame though in templates that use
this module, |allowed-icons= is typically set, if needed, in the {{#invoke:}}.
]]
local function main (frame)
local args = getArgs (frame);
local out_text = '';
if is_set(args[1]) then
local result = {};
local label;
local article_suffix = args['article-suffix'] or args['article-postfix'] or '';
local link_prefix = args['link-prefix'] or '';
local link_suffix = args['link-suffix'] or args['link-postfix'] or '';
local item_prefix = args['item-prefix'] or '';
local item_suffix = args['item-suffix'] or args['item-postfix'] or '';
local list_separator = args['list-separator'] or ', ';
local leadout_suffix = args['leadout-suffix'] or args['leadout-postfix'] or ' ';
local list_leadout;
local icon_index;
if is_set (args['list-leadout']) then
list_leadout = table.concat ({
mw.ustring.gsub (args['list-leadout'], '^(%a)', ' %1'), -- insert leading space if first character is a letter
leadout_suffix,
});
else
list_leadout = '';
end
label = make_label (args['article-link'], args['article-name'], article_suffix);
for k, item in ipairs (args) do -- for each of the positional parameters
item = mw.text.trim (item); -- remove extraneous whitespace
if is_set (link_prefix) then -- if there is link prefix...
item = table.concat ({ -- create an external link item
'[', -- open ext link markup
link_prefix, -- url prefix
mw.uri.encode (item), -- item is part of url
link_suffix, -- url suffix
' ', -- required space between url and label
item_prefix, -- label prefix
item, -- item as label
item_suffix, -- item suffix
']' -- close ext link markup
});
icon_index = icon_index_get (args, k); -- set if icon specified and allowed for this item; nil else
if icon_index then
item = table.concat ({ -- add access icon markup to this item
'<span class="', -- open the opening span tag; icon classes are defined in Module:Citation/CS1/styles.css
lock_icons[icon_index][1], -- add the appropriate lock icon class
'" title="', -- and the title attribute
lock_icons[icon_index][2], -- for an appropriate tool tip
'">', -- close the opening span tag
item,
'</span>', -- and close the span
});
end
else
item = table.concat ({ -- create an unlinked item
item_prefix, -- label prefix
item, -- item as label
item_suffix, -- item suffix
});
end
table.insert (result, item); -- add the item to the result list
end
if is_set (args['list-leadout']) then
out_text = table.concat ({label, mw.text.listToText (result, list_separator, list_leadout)});
else
out_text = table.concat ({label, table.concat (result, list_separator)});
end
end --is_set (args[1])
return out_text
end
return {main = main};
afhatnamr2i3fuucagrgsakx2kl7zso
Module:Category handler
828
39772274
948472489
948472486
2020-04-01T06:12:40Z
MusikAnimal
14882394
1 revision imported
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
Module:Category handler/blacklist
828
43232926
951673917
948472491
2020-04-18T08:48:05Z
Jo-Jo Eumerus
17449355
Per category talk page
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
Module:Category handler/config
828
42291997
948472494
894414603
2020-04-01T06:12:40Z
MusikAnimal
14882394
1 revision imported
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
Module:Category handler/data
828
43233647
948472496
894414581
2020-04-01T06:12:41Z
MusikAnimal
14882394
1 revision imported
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
Module:Category handler/shared
828
43232937
948472498
894414384
2020-04-01T06:12:41Z
MusikAnimal
14882394
1 revision imported
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
Module:Check for unknown parameters
828
42286729
1073136630
1055951540
2022-02-21T05:24:13Z
BusterD
346148
Changed protection settings for "[[Module:Check for unknown parameters]]": [[WP:High-risk templates|Highly visible template]]; requested at [[WP:RfPP]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
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
-- not on the list
local p = {}
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
local function isnotempty(s)
return s and s:match('%S')
end
local function clean(text)
-- Return text cleaned for display and truncated if too long.
-- Strip markers are replaced with dummy text representing the original wikitext.
local pos, truncated
local function truncate(text)
if truncated then
return ''
end
if mw.ustring.len(text) > 25 then
truncated = true
text = mw.ustring.sub(text, 1, 25) .. '...'
end
return mw.text.nowiki(text)
end
local parts = {}
for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do
pos = remainder
table.insert(parts, truncate(before) .. '<' .. tag .. '>...</' .. tag .. '>')
end
table.insert(parts, truncate(text:sub(pos or 1)))
return table.concat(parts)
end
function p._check(args, pargs)
if type(args) ~= "table" or type(pargs) ~= "table" then
-- TODO: error handling
return
end
-- create the list of known args, regular expressions, and the return string
local knownargs = {}
local regexps = {}
for k, v in pairs(args) do
if type(k) == 'number' then
v = trim(v)
knownargs[v] = 1
elseif k:find('^regexp[1-9][0-9]*$') then
table.insert(regexps, '^' .. v .. '$')
end
end
-- loop over the parent args, and make sure they are on the list
local ignoreblank = isnotempty(args['ignoreblank'])
local showblankpos = isnotempty(args['showblankpositional'])
local values = {}
for k, v in pairs(pargs) do
if type(k) == 'string' and knownargs[k] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(k, regexp) then
knownflag = true
break
end
end
if not knownflag and ( not ignoreblank or isnotempty(v) ) then
table.insert(values, clean(k))
end
elseif type(k) == 'number' and knownargs[tostring(k)] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(tostring(k), regexp) then
knownflag = true
break
end
end
if not knownflag and ( showblankpos or isnotempty(v) ) then
table.insert(values, k .. ' = ' .. clean(v))
end
end
end
-- add results to the output tables
local res = {}
if #values > 0 then
local unknown_text = args['unknown'] or 'Found _VALUE_, '
if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then
local preview_text = args['preview']
if isnotempty(preview_text) then
preview_text = require('Module:If preview')._warning({preview_text})
elseif preview == nil then
preview_text = unknown_text
end
unknown_text = preview_text
end
for _, v in pairs(values) do
-- Fix odd bug for | = which gets stripped to the empty string and
-- breaks category links
if v == '' then v = ' ' end
-- avoid error with v = 'example%2' ("invalid capture index")
local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v})
table.insert(res, r)
end
end
return table.concat(res)
end
function p.check(frame)
local args = frame.args
local pargs = frame:getParent().args
return p._check(args, pargs)
end
return p
h9rooqvu67gk81cpbiswol48lpmwmym
Module:Check isxn
828
47420247
783139241
712698918
2017-05-31T10:38:54Z
The Anome
76
Changed protection level for "[[Module:Check isxn]]": [[WP:High-risk templates|High-risk Lua module]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
-- This template is a copy of the ISXN validation code from [[Module:Citation/CS1]]
-- which allows for validating ISBN, ISMN, and ISSN without invoking a citation template
local p = {}
--[[--------------------------< 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 check_isbn().
If the number is valid the result will be 0. Before calling this function, issbn/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
--[[--------------------------< C H E C K _ I S B N >------------------------------------------------------------
Determines whether an ISBN string is valid
]]
local function check_isbn( isbn_str, error_string )
if nil ~= isbn_str:match("[^%s-0-9X]") then -- fail if isbn_str contains anything but digits, hyphens, or the uppercase X
return error_string;
end
isbn_str = isbn_str:gsub( "-", "" ):gsub( " ", "" ); -- remove hyphens and spaces
local len = isbn_str:len();
if len ~= 10 and len ~= 13 then
return error_string;
end
if len == 10 then
if isbn_str:match( "^%d*X?$" ) == nil then
return error_string;
end
return is_valid_isxn(isbn_str, 10) and '' or error_string;
else
local temp = 0;
if isbn_str:match( "^97[89]%d*$" ) == nil then -- isbn13 begins with 978 or 979; ismn begins with 979
return error_string;
end
return is_valid_isxn_13 (isbn_str) and '' or error_string;
end
end
--[[--------------------------< C H E C K _ I S M N >------------------------------------------------------------
Determines whether an ISMN string is valid. Similar to isbn-13, ismn is 13 digits begining 979-0-... and uses the
same check digit calculations. See http://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf
section 2, pages 9–12.
]]
local function check_ismn (id, error_string)
local text;
local valid_ismn = true;
id=id:gsub( "[%s-–]", "" ); -- strip spaces, hyphens, and endashes from the ismn
if 13 ~= id:len() or id:match( "^9790%d*$" ) == nil then -- ismn must be 13 digits and begin 9790
valid_ismn = false;
else
valid_ismn=is_valid_isxn_13 (id); -- validate ismn
end
return valid_ismn and '' or error_string
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: [http://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.
]]
local function check_issn(id, error_string)
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 = true;
if not id:match ('^%d%d%d%d%-%d%d%d[%dX]$') then
return error_string;
end
id=id:gsub( "[%s-–]", "" ); -- strip spaces, hyphens, and endashes from the issn
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
return valid_issn and '' or error_string
end
------------------------------< E N T R Y P O I N T S >--------------------------------------------------====
function p.check_isbn(frame)
return check_isbn(frame.args[1] or frame:getParent().args[1], frame.args['error'] or frame:getParent().args['error'] or 'error')
end
function p.check_ismn(frame)
return check_ismn(frame.args[1] or frame:getParent().args[1], frame.args['error'] or frame:getParent().args['error'] or 'error')
end
function p.check_issn(frame)
return check_issn(frame.args[1] or frame:getParent().args[1], frame.args['error'] or frame:getParent().args['error'] or 'error')
end
return p
m39a8k5gmtbg6x3k2f7rizj3jk5on20
Module:Citation/CS1
828
38573037
1096003161
1068074133
2022-07-01T17:45:25Z
Trappist the monk
10289486
sync from sandbox;
Scribunto
text/plain
require ('Module:No globals');
--[[--------------------------< 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 Frame; -- holds the module's frame table
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
--[[--------------------------< 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. 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
if not domain:match ('^[%w]') then -- first character must be letter or digit
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
}
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 ({'cash', 'company', 'today', 'org'}) 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+') then -- if protocol-relative bare URL: //yyyyy.zzz; may have leading or trailing plain text
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
--[[-------------------------< 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 err_msg = '';
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"]);
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 cap = '';
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)
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_code_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, chapter_source, 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;
chapter_source = trans_chapter_source:match ('trans%-?(.+)'); -- when no chapter, get matching name from trans-<param>
utilities.set_message ('err_trans_missing_title', {chapter_source});
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[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
else
local err_msg;
if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then
err_msg = capture .. ' ' .. char_name;
else
err_msg = char_name .. ' ' .. 'character';
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.
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local args, list, v = args, 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 );
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
local comp = ''; -- what does 'comp' mean?
local end_chr = '';
local trim;
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
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.?
trim = false;
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%-%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%-%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)
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, names = {}, {}; -- tables to hold name parts and initials
local i = 1; -- counter for number of initials
names = mw.text.split (first, '[%s,]+'); -- split into a table of names and possible suffix
while names[i] do -- loop through the table
if 1 < i and names[i]:match ('[%dJS][%drndth]+%.?$') then -- if not the first name, and looks like a suffix (may have trailing dot)
names[i] = names[i]:gsub ('%.', ''); -- remove terminal dot if present
if is_suffix (names[i]) then -- if a legitimate suffix
table.insert (initials, ' ' .. names[i]); -- add a separator space, insert at end of initials table
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, mw.ustring.sub(names[i], 1, 1)); -- insert the initial at end of initials table
end
i = i + 1; -- bump the counter
end
return table.concat(initials) -- Vancouver format does not include spaces.
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)
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 maint cat when name parameter value does not contain letters. Does not catch
mixed alphanumeric names so |last=A. Green (1922-1987) does not get caught in the
current version of this test but |first=(1888) is caught.
returns nothing
]]
local function name_is_numeric (name, list_name)
if utilities.is_set (name) then
if mw.ustring.match (name, '^[%A]+$') then -- when name does not contain any letters
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
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.
returns nothing
]]
local function name_has_mult_names (name, list_name)
local _, commas, semicolons, nbsps;
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 1 < 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, wiki)
local test_val;
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 (last only)
name_is_numeric (last, list_name); -- check for names that are composed of digits and punctuation
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_is_numeric (first, list_name); -- check for names that are composed of digits and punctuation
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 );
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
local result;
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_code_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_code_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
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_code_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 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
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
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 = 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 the 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 = {}; -- table made from the value assigned to |language=
local this_wiki_name = mw.language.fetchLanguageName (cfg.this_wiki_code, cfg.this_wiki_code); -- get this wiki's language name
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
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, lang_subtag}, lang_subtag); -- categorize it; tag appended to allow for multiple language categorization
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);
name = ''; -- so we can reuse it
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 'citation' == cite_class then
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']; a number or some flavor of etal
count: #a or #e
list_name: 'authors' or 'editors'
etal: author_etal or editor_etal
]]
local function get_display_names (max, count, list_name, etal, param)
if utilities.is_set (max) then
if 'etal' == 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 then -- if |display-xxxxors= value greater than or equal to number of authors/editors
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.
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).
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 patterns = 'v' == selector and cfg.vol_iss_pg_patterns.vpatterns or cfg.vol_iss_pg_patterns.ipatterns;
local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';
val = val:lower(); -- force parameter value to lower case
for _, pattern in ipairs (patterns) do -- spin through the selected 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 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 lastfirstTable = {}
lastfirstTable = mw.text.split(v_name, "%s+")
first = table.remove(lastfirstTable); -- 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(lastfirstTable); -- get what should be the initials from the table
end
last = table.concat(lastfirstTable, ' ') -- 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
local err_name;
if 'AuthorList' == list_name then -- figure out which name should be used in error message
err_name = 'author';
else
err_name = 'editor';
end
utilities.set_message ('err_redundant_parameters', err_name .. '-name-list parameters'); -- 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 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, cite_class, origin, sepc, lower)
if not utilities.is_set (volume) and not utilities.is_set (issue) 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
if utilities.is_set (issue) then
return vol .. utilities.substitute (cfg.messages['j-issue'], issue);
end
return vol;
end
if 'podcast' == cite_class and utilities.is_set (issue) then
return wrap_msg ('issue', {sepc, issue}, lower);
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*/)
]=]
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
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 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; -- return ArchiveURL and ArchiveDate
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; -- preview mode so return ArchiveURL and ArchiveDate
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
--[[--------------------------< 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 );
local i
-- 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 = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');
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, args.vauthors, 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=
elseif 3 == selected then
Authors = A['Authors']; -- use content of |authors=
if 'authors' == A:ORIGIN('Authors') then -- but add a maint cat if the parameter is |authors=
utilities.set_message ('maint_authors'); -- because use of this parameter is discouraged; what to do about the aliases is a TODO:
end
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= aliases
local Chapter_origin = A:ORIGIN ('Chapter');
local Contribution; -- because contribution is required for contributor(s)
if 'contribution' == Chapter_origin then
Contribution = Chapter; -- 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 = '';
if utilities.is_set (Periodical) then
Periodical_origin = A:ORIGIN('Periodical'); -- get the name of the periodical parameter
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) .. ' and ' .. 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
local ScriptPeriodical = A['ScriptPeriodical'];
-- 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;
local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');
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 = utilities.hyphen_to_dash (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 = utilities.hyphen_to_dash (A['Issue']);
end
end
extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');
local Page;
local Pages;
local At;
if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then
Page = A['Page'];
Pages = utilities.hyphen_to_dash (A['Pages']);
At = A['At'];
end
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) then
local i = 0;
PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized
if i then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});
end
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) 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
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 utilities.in_array (this_page.nsText, cfg.uncategorized_namespaces) then
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);
local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);
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=
|encyclopedia= and |article= then map |encyclopedia= to |title=
|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
if utilities.is_set (Encyclopedia) 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
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});
Encyclopedia = nil; -- unset because not supported by this template
end
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 set emit an error TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', A:ORIGIN ('Encyclopedia')) .. ' and ' .. utilities.wrap_style ('parameter', Periodical_origin)});
end
if utilities.is_set (Encyclopedia) then
Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia; allow periodical without encyclopedia
Periodical_origin = A:ORIGIN ('Encyclopedia');
end
if utilities.is_set (Periodical) then -- Periodical is set when |encyclopedia= is set
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= to |article= and |encyclopedia= to |title=
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle')
TransChapter = TransTitle;
ChapterURL = URL;
ChapterURL_origin = URL_origin;
ChapterUrlAccess = UrlAccess;
if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then
Chapter = utilities.make_wikilink (TitleLink, Chapter);
end
Title = Periodical;
ChapterFormat = Format;
Periodical = ''; -- redundant so unset
TransTitle = '';
URL = '';
Format = '';
TitleLink = '';
ScriptTitle = '';
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=
Periodical = ''; -- redundant so unset
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') .. ' and ' .. 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
-- CS1/2 mode
local Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], '');
-- separator character and postscript
local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);
-- controls capitalization of certain static text
local use_lowercase = ( sepc == ',' );
-- 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') .. ' and ' .. utilities.wrap_style ('parameter', Chapter_origin)}); -- add error message
end
Chapter = A['Map'];
Chapter_origin = A:ORIGIN('Map');
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') .. ' and ' .. 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', '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 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'];
ArchiveURL, ArchiveDate = 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 LayDate = A['LayDate'];
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 error_message, date_parameters_list, mismatch
local error_message = '';
-- AirDate has been promoted to Date so not necessary to check it
local date_parameters_list = {
['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')},
['lay-date'] = {val = LayDate, name = A:ORIGIN ('LayDate')},
['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);
-- start temporary Julian / Gregorian calendar uncertainty categorization
if COinS_date.inter_cal_cat then
utilities.add_prop_cat ('jul-greg-uncertainty');
end
-- end temporary Julian / Gregorian calendar uncertainty categorization
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;
LayDate = date_parameters_list['lay-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
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
local ID_list = {}; -- sequence table of rendered identifiers
local ID_list_coins = {}; -- 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, ID_list_coins = identifiers.identifier_lists_get (args, {DoiBroken = DoiBroken, ASINTLD = A['ASINTLD'], Embargo = Embargo, Class = Class}, ID_support);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite ssrn}}, before generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list) then
if not utilities.is_set (ID_list_coins[config.CitationClass:upper()]) then -- |arxiv= or |eprint= required for cite arxiv; |biorxiv= & |citeseerx= required for their templates
utilities.set_message ('err_' .. config.CitationClass .. '_missing'); -- add error message
end
Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['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
-- 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
local QuotePage = A['QuotePage'];
local QuotePages = utilities.hyphen_to_dash (A['QuotePages']);
-- 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 if Date is valid;
['Season'] = COinS_date.rftssn,
['Quarter'] = COinS_date.rftquarter,
['Chron'] = COinS_date.rftchron or (not COinS_date.rftdate and Date) or '', -- chron but if not set and invalid date format use Date; keep this last bit?
['Series'] = Series,
['Volume'] = Volume,
['Issue'] = Issue,
['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,
['RawPage'] = this_page.prefixedText,
}, config.CitationClass);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, and {{cite ssrn}} AFTER generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list) then -- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, 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;
local Translators; -- assembled translators name list
local translator_etal;
local t = {}; -- translators list from |translator-lastn= / translator-firstn= pairs
t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=
local Interviewers;
local interviewers_list = {};
interviewers_list = extract_names (args, 'InterviewerList'); -- process preferred interviewers parameters
local interviewer_etal;
-- 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 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
control.maximum , editor_etal = get_display_names (A['DisplayEditors'], #e, 'editors', editor_etal, A:ORIGIN ('DisplayEditors'));
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
control.maximum, interviewer_etal = get_display_names (A['DisplayInterviewers'], #interviewers_list, 'interviewers', interviewer_etal, A:ORIGIN ('DisplayInterviewers'));
Interviewers = list_people (control, interviewers_list, interviewer_etal);
end
do -- now do translators
control.maximum, translator_etal = get_display_names (A['DisplayTranslators'], #t, 'translators', translator_etal, A:ORIGIN ('DisplayTranslators'));
Translators = list_people (control, t, translator_etal);
end
do -- now do contributors
control.maximum, contributor_etal = get_display_names (A['DisplayContributors'], #c, 'contributors', contributor_etal, A:ORIGIN ('DisplayContributors'));
Contributors = list_people (control, c, contributor_etal);
end
do -- now do authors
control.maximum, author_etal = get_display_names (A['DisplayAuthors'], #a, 'authors', author_etal, A:ORIGIN ('DisplayAuthors'));
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 = 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', '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 mailinglist
('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then -- and required for {{citation}} with |website= or |script-website=
utilities.set_message ('err_cite_web_url');
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', '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 = '';
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, Chapter_origin, 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', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', '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 = "";
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') .. ' and ' .. utilities.wrap_style ('parameter', 'time')});
end
Position = " " .. Minutes .. " " .. cfg.messages['minutes'];
else
if utilities.is_set (Time) then
local TimeCaption = A['TimeCaption']
if not utilities.is_set (TimeCaption) then
TimeCaption = cfg.messages['event'];
if sepc ~= '.' then
TimeCaption = TimeCaption:lower();
end
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'];
Agency = utilities.is_set (Agency) and wrap_msg ('agency', {sepc, Agency}) or "";
Volume = format_volume_issue (Volume, Issue, 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
if (sepc ~= ".") then retrv_text = retrv_text:lower() end -- 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
local Quote = A['Quote'];
local TransQuote = A['TransQuote'];
local ScriptQuote = A['ScriptQuote'];
if utilities.is_set (Quote) or utilities.is_set (TransQuote) or utilities.is_set (ScriptQuote) 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 = utilities.wrap_style ('quoted-text', Quote ); -- wrap in <q>...</q> tags
if utilities.is_set (ScriptQuote) then
Quote = script_concatenate (Quote, ScriptQuote, 'script-quote'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after quote is wrapped
end
if utilities.is_set (TransQuote) then
if TransQuote:sub(1, 1) == '"' and TransQuote:sub(-1, -1) == '"' then -- if first and last characters of |trans-quote are quote marks
TransQuote = TransQuote:sub(2, -2); -- strip them off
end
Quote = Quote .. " " .. utilities.wrap_style ('trans-quoted-title', TransQuote );
end
if utilities.is_set (QuotePage) or utilities.is_set (QuotePages) then -- add page prefix
local quote_prefix = '';
if utilities.is_set (QuotePage) then
extra_text_in_page_check (QuotePage, '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, QuotePage}), '', '', '';
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePage}), '', '', '';
end
elseif utilities.is_set (QuotePages) then
extra_text_in_page_check (QuotePages, 'quote-pages'); -- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.
if tonumber(QuotePages) ~= nil and not NoPP then -- if only digits, assume single page
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePages}), '', '';
elseif not NoPP then
quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, QuotePages}), '', '';
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePages}), '', '';
end
end
Quote = quote_prefix .. ": " .. Quote;
else
Quote = sepc .. " " .. Quote;
end
PostScript = ""; -- cs1|2 does not supply terminal punctuation when |quote= is set
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
local arch_text;
if not utilities.is_set (ArchiveDate) then
utilities.set_message ('err_archive_missing_date');
ArchiveDate = ''; -- empty string for concatenation
end
if "live" == UrlStatus then
arch_text = cfg.messages['archived'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],
{external_link( ArchiveURL, arch_text, 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
arch_text = cfg.messages['archived-unfit'];
if sepc ~= "." then arch_text = arch_text:lower() end
Archived = sepc .. ' ' .. arch_text .. ArchiveDate; -- format already styled
if 'bot: unknown' == UrlStatus then
utilities.set_message ('maint_bot_unknown'); -- and add a category if not already added
else
utilities.set_message ('maint_unfit'); -- and add a category if not already added
end
else -- UrlStatus is empty, 'dead'
arch_text = cfg.messages['archived-dead'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
Archived = sepc .. " " .. utilities.substitute ( arch_text,
{ external_link( OriginalURL, cfg.messages['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } ); -- format already styled
else
Archived = ''; -- unset for concatenation
end
end
else -- OriginalUrl not set
arch_text = cfg.messages['archived-missing'];
if sepc ~= "." then arch_text = arch_text:lower() end
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 Lay = '';
local LaySource = A['LaySource'];
local LayURL = A['LayURL'];
local LayFormat = A['LayFormat'];
LayFormat = style_format (LayFormat, LayURL, 'lay-format', 'lay-url');
if utilities.is_set (LayURL) then
if utilities.is_set (LayDate) then LayDate = " (" .. LayDate .. ")" end
if utilities.is_set (LaySource) then
LaySource = " – ''" .. utilities.safe_for_italics (LaySource) .. "''";
else
LaySource = "";
end
if sepc == '.' then
Lay = sepc .. " " .. external_link( LayURL, cfg.messages['lay summary'], A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate
else
Lay = sepc .. " " .. external_link( LayURL, cfg.messages['lay summary']:lower(), A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate
end
elseif utilities.is_set (LayFormat) then -- Test if |lay-format= is given without giving a |lay-url=
Lay = sepc .. LayFormat; -- if set and LayURL not set, then LayFormat has error message
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
local TransPeriodical = A['TransPeriodical'];
local TransPeriodical_origin = A:ORIGIN ('TransPeriodical');
-- 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
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
if utilities.is_set (Others) then Others = safe_join ({Others, sepc .. " "}, sepc) end -- add terminal punctuation & space; check for dup sepc; TODO why do we need to do this here?
tcommon = safe_join( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume}, sepc );
elseif 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( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );
else
tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, 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, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
elseif utilities.is_set (Periodical) then -- map in a periodical
tcommon = safe_join( {Title, TitleType, Format, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
else -- a sheet or stand-alone map
tcommon = safe_join( {Title, TitleType, Format, 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, Format, TitleType, Series, Language,
Volume, Others, Edition, Publisher, Agency}, sepc );
end
if #ID_list > 0 then
ID_list = safe_join( { sepc .. " ", table.concat( ID_list, sepc .. " " ), ID }, sepc );
else
ID_list = 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, URL, Archived, Transcript, AccessDate, Via, Lay, Quote }, sepc );
else
idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Lay, 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 = in_text .. cfg.messages['in'] .. " "
if (sepc ~= '.') then
in_text = in_text:lower() -- lowercase for cs2
end
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'] .. ' ';
if (sepc ~= '.') then by_text = by_text:lower() end -- 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.messages['editor'];
else
Editors = Editors .. ", " .. 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.
text = text:sub(1, -sepc:len() - 1);
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 utilities.is_set (options_t.id) then -- here we wrap the rendered citation in <cite ...>...</cite> tags
table.insert (render_t, utilities.substitute (cfg.presentation['cite-id'], {mw.uri.anchorEncode(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 = ('citation' == config.CitationClass) and 'citation' or 'cite ' .. (cfg.citation_class_map_t[config.CitationClass] or 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));
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));
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
for _, v in ipairs (z.error_cats_t) do -- append error categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
end
for _, v in ipairs (z.maint_cats_t) do -- append maintenance categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
end
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
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 name = tostring (name);
local enum_name; -- for enumerated parameters, is name with enumerator replaced with '#'
local state;
local function state_test (state, name) -- local function to do testing of state values
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 name:find ('#') then -- # is a cs1|2 reserved character so parameters with # not permitted
return nil;
end
if utilities.in_array (cite_class, whitelist.preprint_template_list ) then -- limited parameter sets allowed for these templates
state = whitelist.limited_basic_arguments[name];
if true == state_test (state, name) then return true; end
state = whitelist.preprint_arguments[cite_class][name]; -- look in the parameter-list for the template identified by cite_class
if true == state_test (state, name) then return true; end
-- limited enumerated parameters list
enum_name = name:gsub("%d+", "#" ); -- replace digit(s) with # (last25 becomes last#) (mw.ustring because non-Western 'local' digits)
state = whitelist.limited_numbered_arguments[enum_name];
if true == state_test (state, name) 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) then -- experiment for template-specific parameters for templates that accept parameters from the basic argument list
state = whitelist.unique_arguments[cite_class][name]; -- look in the template-specific parameter-lists for the template identified by cite_class
if true == state_test (state, name) then return true; end
end -- if here, fall into general validation
state = whitelist.basic_arguments[name]; -- all other templates; all normal parameters allowed
if true == state_test (state, name) then return true; end
-- all enumerated parameters allowed
enum_name = name:gsub("%d+", "#" ); -- replace digit(s) with # (last25 becomes last#) (mw.ustring because non-Western 'local' digits)
state = whitelist.numbered_arguments[enum_name];
if true == state_test (state, name) 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 _ 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 (url_param_t)
local url_error_t = {};
check_for_url (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 >--------------------------------------------------------------
This is used by templates such as {{cite book}} to create the actual citation text.
]]
local function citation(frame)
Frame = frame; -- save a copy in case we need to display an error message in preview mode
local sandbox = '/sandbox' -- i18n: replace this rvalue with the name that your wiki uses to identify sandbox subpages
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
local pframe = frame:getParent()
local styles;
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);
styles = 'Module:Citation/CS1' .. sandbox .. '/styles.css';
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
is_preview_mode = not utilities.is_set (frame:preprocess ('{{REVISIONID}}'));
local args = {}; -- table where we store all of the template's arguments
local suggestions = {}; -- table where we store suggestions if we need to loadData them
local error_text; -- used as a flag
local config = {}; -- table to store parameters from the module {{#invoke:}}
for k, v in pairs( frame.args ) do -- get parameters from the {{#invoke}} frame
config[k] = v;
-- args[k] = v; -- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?
end
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( pframe.args ) 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 ('string' == type (k)) then
k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits); -- for enumerated parameters, translate 'local' digits to Western 0-9
end
if not validate( k, config.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.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
if is_sandbox then -- did the {{#invoke:}} use sandbox version?
suggestions = mw.loadData( 'Module:Citation/CS1/Suggestions/sandbox' ); -- use the sandbox version
else
suggestions = mw.loadData( 'Module:Citation/CS1/Suggestions' ); -- use the live version
end
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.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.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
args[k] = v; -- save this parameter and its value
elseif not utilities.is_set (v) then -- for empty parameters
if not validate (k, config.CitationClass, true) then -- is this empty parameter a valid parameter
k = ('' == k) and '(empty string)' 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
-- crude debug support that allows us to render a citation from module {{#invoke:}} TODO: keep?
-- elseif args[k] ~= nil or (k == 'postscript') then -- when args[k] has a value from {{#invoke}} frame (we don't normally do that)
-- args[k] = v; -- overwrite args[k] with empty string from pframe.args[k] (template frame); v is empty string here
end -- not sure about the postscript bit; that gets handled in parameter validation; historical artifact?
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 url_param_t = {};
for k, v in pairs( args ) 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?
args[k] = inter_wiki_check (k, v); -- when language interwiki-linked parameter missing leading colon replace with wiki-link label
if 'string' == type (k) and not cfg.url_skip[k] then -- when parameter k is not positional and not in url skip table
url_param_t[k] = v; -- make a parameter/value list for extraneous url check
end
end
has_extraneous_url (url_param_t); -- look for url in parameter values where a url does not belong
return table.concat ({
frame:extensionTag ('templatestyles', '', {src=styles}),
citation0( config, args)
});
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {citation = citation};
ap25rq0kh3819w7lon63qbjh3bjokuz
Module:Citation/CS1/COinS
828
48828620
1067248994
1017041361
2022-01-22T14:11:14Z
Trappist the monk
10289486
update per [[Wikipedia:Village_pump_(proposals)#rfc:_shall_we_update_cs1/2?|RfC]];
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?
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', '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', '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 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.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/", mw.site.server:match( "[^/]*$" ), ":", 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,
}
9vyk9pk52t1pp4siilcbluanw9m1ekz
Module:Citation/CS1/Configuration
828
39043527
1096144888
1096003156
2022-07-02T16:25:24Z
Trappist the monk
10289486
bump s2cid;
Scribunto
text/plain
local lang_obj = mw.language.getContentLanguage(); -- make a language object for the local language; used here for languages and dates
--[[--------------------------< 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 that should not be included in citation error categories.
Same as setting notracking = true by default.
Note: Namespace names should use underscores instead of spaces.
]]
local uncategorized_namespaces = { 'User', 'Talk', 'User_talk', 'Wikipedia_talk',
'File_talk', 'Template_talk', 'Help_talk', 'Category_talk', 'Portal_talk',
'Book_talk', 'Draft_talk', 'Education_Program_talk', 'Module_talk', 'MediaWiki_talk' };
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
--[[--------------------------< 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-missing'] = 'Archived from the original$1 on $2',
['archived-unfit'] = 'Archived from the original on ',
['archived'] = 'Archived',
['by'] = 'By', -- contributions to authored works: introduction, foreword, afterword
['cartography'] = 'Cartography by $1',
['editor'] = 'ed.',
['editors'] = 'eds.',
['edition'] = '($1 ed.)',
['episode'] = 'Episode $1',
['et al'] = 'et al.',
['in'] = 'In', -- edited works
['inactive'] = 'inactive',
['inset'] = '$1 inset',
['interview'] = 'Interviewed by $1',
['lay summary'] = 'Lay summary',
['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
['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
['j-vol'] = '$1 $2', -- sepc, volume; bold journal volume is in presentation{}
['j-issue'] = ' ($1)',
['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'] = 'minutes in',
-- 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'] = '[[: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">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code> templates have errors</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
['warning_msg_m'] = '<span style="color:#3a3">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code> templates have maintenance messages</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
}
--[[--------------------------< 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 preivew mode.
Most cs1|2 template |CitationClass= values at en.wiki match their canonical template names so are not listed here.
]]
local citation_class_map_t = { -- TODO: if kept, these and all other config.CitationClass 'names' require some sort of i18n
['audio-visual'] = 'AV media', -- TODO: move to ~/Configuration
['AV-media-notes'] = 'AV media notes',
['encyclopaedia'] = 'encyclopedia',
['mailinglist'] = 'mailing list',
['pressrelease'] = 'press release'
}
--[=[-------------------------< 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.
-- 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='cs1-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['registration'] = {class='cs1-lock-registration', title='Free registration required'},
['limited'] = {class='cs1-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['subscription'] = {class='cs1-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
['ASINTLD'] = 'asin-tld',
['At'] = 'at', -- Used by InternetArchiveBot
['Authors'] = {'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', 'chapterurl'}, -- 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'},
['LayDate'] = 'lay-date',
['LayFormat'] = 'lay-format',
['LaySource'] = 'lay-source',
['LayURL'] = 'lay-url',
['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'},
['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'] = 'department',
['TitleType'] = {'type', 'medium'},
['TransChapter'] = {'trans-article', 'trans-chapter', 'trans-contribution',
'trans-entry', 'trans-section'},
['Transcript'] = 'transcript',
['TranscriptFormat'] = 'transcript-format',
['TranscriptURL'] = {'transcript-url', 'transcripturl'}, -- Used by InternetArchiveBot
['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", "given#",
"author-given#", "author#-given"},
['AuthorList-Last'] = {"last#", "author-last#", "author#-last", "surname#",
"author-surname#", "author#-surname", "author#", "subject#", 'host#'},
['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'},
}
--[[--------------------------< 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', 'LayURL', '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', 'LayURL', '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 = {};
--[[-----------< 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';
local special_case_translation = {
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
['ContributorList'] = 'contributors list', -- translation of these names plus translation of the base mainenance 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.com', 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'] = {'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'] = {'webcite query result', true}, ['local'] = nil},
{['en'] = {'wikiwix\'s cache', 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'] = {'%f[%a][Aa]uthor%f[%A]', false}, ['local'] = nil},
{['en'] = {'collaborator', true}, ['local'] = nil},
{['en'] = {'contributor', true}, ['local'] = nil},
{['en'] = {'contact us', true}, ['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'] = {'home page', true}, ['local'] = nil},
{['en'] = {'instagram', true}, ['local'] = nil},
{['en'] = {'interviewer', true}, ['local'] = nil},
{['en'] = {'linkedIn', true}, ['local'] = nil},
{['en'] = {'^[Nn]ews$', false}, ['local'] = nil},
{['en'] = {'pinterest', true}, ['local'] = nil},
{['en'] = {'policy', true}, ['local'] = nil},
{['en'] = {'privacy', 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'] = {'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']
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']
-- 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
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 function get_date_format ()
local title_object = mw.title.getCurrentTitle();
if title_object.namespace == 10 then -- not in template space so that unused templates appear in unused-template-reports;
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
local 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
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
content = content:match ('%b{}', start); -- get the whole template
if content:match ('| *cs1%-dates *= *[lsy][sy]?') then -- look for |cs1-dates=publication date length access-/archive-date length
return match:lower() .. '-' .. content: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
local global_df;
--[[-----------------< 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.?',
},
vpatterns = { -- patterns for |volume=
'^volumes?',
'^vols?[%.:=]?'
},
ipatterns = { -- patterns for |issue=
'^issues?',
'^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)
}
}
--[[--------------------------< 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=
['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}),
}
--[[---------------------< 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 zwj character (U+200D) to combine with another emoji
local emoji = { -- indexes are decimal forms of the hex values in U+xxxx
[127752] = true, -- U+1F308 🌈 rainbow
[127806] = true, -- U+1F33E 🌾 ear of rice
[127859] = true, -- U+1F373 🍳 cooking
[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
[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
[128187] = true, -- U+1F4BB 💻 personal computer
[128188] = true, -- U+1F4BC 💼 brief case
[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
[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
[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
[9992] = true, -- U+2708 ✈ airplane
[10084] = true, -- U+2764 ❤ heavy black heart
}
--[[----------------------< 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():preprocess('{{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', 'be', 'bg', 'bn', 'bo', 'bs', 'dv', 'dz', 'el', 'fa', 'gu',
'he', 'hi', 'hy', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'lo', 'mk',
'ml', 'mn', 'mr', 'my', 'ne', 'or', 'ota', 'ps', 'ru', 'sd', 'si', 'sr', 'syc',
'ta', 'te', 'tg', 'th', 'ti', 'ug', 'uk', 'ur', 'uz', 'yi', 'yue', 'zh'
};
--[[---------------< 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 ['code'] = 'language name' in lang_code_remap{} there must be a matching ['language name'] = {'language name', 'code'} in lang_name_remap{}
lang_code_remap{}:
key is always lowercase ISO 639-1, -2, -3 language code or a valid lowercase IETF language tag
value is properly spelled and capitalized language name associated with key
only one language name per key;
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 code [2] (code must match a code key in lang_code_remap{})
may have multiple keys referring to a common preferred name and code; For example:
['kolsch'] and ['kölsch'] both refer to 'Kölsch' and 'ksh'
]]
local lang_code_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
['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
}
local lang_name_remap = { -- used for |language=; names require proper capitalization; tags must be lowercase
['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
['ripuarian'] = {'Ripuarian', 'mis-x-ripuar'}, -- group of dialects; no code in MediaWiki or in IANA/ISO 639
['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'}, -- variant of Catalan; categorizes as Catalan
}
--[[---------------< 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
['jul-greg-uncertainty'] = 'CS1: Julian–Gregorian uncertainty', -- probably temporary cat to identify scope of template with dates 1 October 1582 – 1 January 1926
['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 charachters
['script'] = 'CS1 uses $1-language script ($2)', -- |script-title=xx: has matching category; $1 is language name, $2 is ISO639-1 code
['tracked-param'] = 'CS1 tracked parameter: $1', -- $1 is base (enumerators removed) parameter name
['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',
['interview'] = 'Interview',
['mailinglist'] = 'Mailing list',
['map'] = 'Map',
['podcast'] = 'Podcast',
['pressrelease'] = 'Press release',
['report'] = 'Report',
['speech'] = 'Speech',
['techreport'] = 'Technical report',
['thesis'] = 'Thesis',
}
--[[===================<< 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 I 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=
['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_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_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 = true,
},
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_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_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 = true
},
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_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_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_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', -- same as bad arxiv
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_archived_copy = {
message = nil,
anchor = 'archived_copy',
category = 'CS1 maint: archived copy as title',
hidden = true,
},
maint_authors = {
message = nil,
anchor = 'authors',
category = 'CS1 maint: uses authors parameter',
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_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_extra_punct = {
message = nil,
anchor = 'extra_punct',
category = 'CS1 maint: extra punctuation',
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_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_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_ref_duplicates_default = {
message = nil,
anchor = 'ref_default',
category = 'CS1 maint: ref duplicates default',
hidden = true,
},
maint_unfit = {
message = nil,
anchor = 'unfit',
category = 'CS1 maint: unfit 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_zbl = {
message = nil,
anchor = 'zbl',
category = 'CS1 maint: Zbl',
hidden = true,
},
}
--[[--------------------------< 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 preceeding 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 = '//arxiv.org/abs/', -- protocol-relative tested 2013-09-04
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 = '//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 = '//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 = '//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 = '//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 = '//www.worldcat.org/issn/',
COinS = 'rft.eissn',
encode = false,
separator = ' ',
},
['HDL'] = {
parameters = { 'hdl', 'HDL' },
link = 'Handle System',
redirect = 'hdl (identifier)',
q = 'Q3126718',
label = 'hdl',
prefix = '//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 = '//www.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 = '//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 = '//www.jstor.org/stable/', -- protocol-relative tested 2013-09-04
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 = '//lccn.loc.gov/', -- protocol-relative tested 2015-12-28
COinS = 'info:lccn',
encode = false,
separator = ' ',
},
['MR'] = {
parameters = {'mr', 'MR'},
link = 'Mathematical Reviews',
redirect = 'MR (identifier)',
q = 'Q211172',
label = 'MR',
prefix = '//www.ams.org/mathscinet-getitem?mr=', -- protocol-relative tested 2013-09-04
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['OCLC'] = {
parameters = {'oclc', 'OCLC'},
link = 'OCLC',
redirect = 'OCLC (identifier)',
q = 'Q190593',
label = 'OCLC',
prefix = '//www.worldcat.org/oclc/',
COinS = 'info:oclcnum',
encode = true,
separator = ' ',
id_limit = 9999999999, -- 10-digits
},
['OL'] = {
parameters = { 'ol', 'OL' },
link = 'Open Library',
redirect = 'OL (identifier)',
q = 'Q1201876',
label = 'OL',
prefix = '//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 = '//www.osti.gov/biblio/', -- protocol-relative tested 2018-09-12
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 23010000,
custom_access = 'osti-access',
},
['PMC'] = {
parameters = {'pmc', 'PMC'},
link = 'PubMed Central',
redirect = 'PMC (identifier)',
q = 'Q229883',
label = 'PMC',
prefix = '//www.ncbi.nlm.nih.gov/pmc/articles/PMC',
suffix = '',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 9300000,
access = 'free', -- free to read
},
['PMID'] = {
parameters = {'pmid', 'PMID'},
link = 'PubMed Identifier',
redirect = 'PMID (identifier)',
q = 'Q2082879',
label = 'PMID',
prefix = '//pubmed.ncbi.nlm.nih.gov/',
COinS = 'info:pmid',
encode = false,
separator = ' ',
id_limit = 35900000,
},
['RFC'] = {
parameters = {'rfc', 'RFC'},
link = 'Request for Comments',
redirect = 'RFC (identifier)',
q = 'Q212971',
label = 'RFC',
prefix = '//tools.ietf.org/html/rfc',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = 9300,
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 = '//ssrn.com/abstract=', -- protocol-relative tested 2013-09-04
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = 4200000,
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 = 254000000,
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 = '//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 = true, -- when true use redirect name for identifier label links; always true at en.wiki
local_lang_cat_enable = false; -- when true categorizes pages where |language=<local wiki's language>; always false at en.wiki
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
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
global_df = get_date_format (), -- tables and variables created when this module is loaded
punct_skip = build_skip_table (punct_skip, punct_meta_params),
url_skip = build_skip_table (url_skip, url_meta_params),
aliases = aliases,
special_case_translation = special_case_translation,
date_names = date_names,
err_msg_supl = err_msg_supl,
error_conditions = error_conditions,
editor_markup_patterns = editor_markup_patterns,
et_al_patterns = et_al_patterns,
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 = emoji,
maint_cats = maint_cats,
messages = messages,
presentation = presentation,
prop_cats = prop_cats,
script_lang_codes = script_lang_codes,
lang_code_remap = lang_code_remap,
lang_name_remap = lang_name_remap,
this_wiki_code = this_wiki_code,
title_types = title_types,
uncategorized_namespaces = uncategorized_namespaces,
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,
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,
}
thb9i5vwi93a7ji0wet25dua5c4zuel
Module:Citation/CS1/Date validation
828
42164542
1096003150
1067249012
2022-07-01T17:45:21Z
Trappist the monk
10289486
sync from sandbox;
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_object = mw.getContentLanguage(); -- used by is_valid_accessdate(), is_valid_year(), date_name_xlate(); TODO: move to ~/Configuration?
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_object.formatDate, lang_object, 'U', accessdate ); -- convert accessdate 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 which tonumber() may not understand
access_ts = tonumber (access_ts) or lang_object:parseFormattedNumber (access_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 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_object:parseFormattedNumber (year); -- convert to number for the comparison;
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];
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, tCOinS_date)
local date; -- one date or first date in a range
local date2 = ''; -- end of range date
-- start temporary Julian / Gregorian calendar uncertainty detection
local year = tonumber(input.year); -- this temporary code to determine the extent of sources dated to the Julian/Gregorian
local month = tonumber(input.month); -- interstice 1 October 1582 – 1 January 1926
local day = tonumber (input.day);
if (0 ~= day) and -- day must have a value for this to be a whole date
(((1582 == year) and (10 <= month) and (12 >= month)) or -- any whole 1582 date from 1 October to 31 December or
((1926 == year) and (1 == month) and (1 == input.day)) or -- 1 January 1926 or
((1582 < year) and (1925 >= year))) then -- any date 1 January 1583 – 31 December 1925
tCOinS_date.inter_cal_cat = true; -- set category flag true
end
-- end temporary Julian / Gregorian calendar uncertainty detection
if 1582 > tonumber(input.year) or 20 < tonumber(input.month) then -- Julian calendar or season so &rft.date gets year only
date = input.year;
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', tonumber(input.year), tonumber(input.year2)) -- assemble the date range
end
if 20 < tonumber(input.month) then -- if season or proper-name date
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 date
if 40 < tonumber(input.month) then
tCOinS_date.rftchron = season[input.month]; -- proper-name dates
elseif 30 < tonumber(input.month) then
tCOinS_date.rftquarter = season[input.month]; -- quarters
else
tCOinS_date.rftssn = season[input.month]; -- seasons
end
else -- season range with a second season specified
if input.year ~= input.year2 then -- season year – season year range or season year–year
tCOinS_date.rftssn = season[input.month]; -- start of range season; keep this?
if 0~= input.month2 then
tCOinS_date.rftchron = string.format ('%s %s – %s %s', season[input.month], input.year, season[input.month2], input.year2);
end
else -- season–season year range
tCOinS_date.rftssn = season[input.month]; -- start of range season; keep this?
tCOinS_date.rftchron = season[input.month] .. '–' .. season[input.month2]; -- season–season year range
end
end
end
tCOinS_date.rftdate = date;
return; -- done
end
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
tCOinS_date.rftdate = date .. date2; -- date2 has the '/' separator
return;
end
--[[--------------------------< P A T T E R N S >--------------------------------------------------------------
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 = {
-- year-initial numerical year-month-day
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'},
-- month-initial: month day, year
['Mdy'] = {'^(%D-) +([1-9]%d?), +((%d%d%d%d?)%a?)$', '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?), +((%d%d%d%d)%a?)$', 'm', 'd', 'd2', 'a', 'y'},
-- day-initial: day month year
['dMy'] = {'^([1-9]%d?) +(%D-) +((%d%d%d%d?)%a?)$', 'd', 'm', 'a', 'y'},
-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed; not supported at en.wiki
-- ['yMd'] = {'^((%d%d%d%d?)%a?) +(%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-) +((%d%d%d%d)%a?)$', '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-) +((%d%d%d%d)%a?)$', '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?), +((%d%d%d%d)%a?)$','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-) +(%d%d%d%d) +[%-–] +([1-9]%d?) +(%D-) +((%d%d%d%d)%a?)$', '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?), +(%d%d%d%d) +[%-–] +(%D-) +([1-9]%d?), +((%d%d%d%d)%a?)$', '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-) +(%d%d%d%d) +[%-–] +(%D-) +((%d%d%d%d)%a?)$', 'm', 'y', 'm2', 'a', 'y2'},
-- month/season range year; months separated by endash
['M-My'] = {'^(%D-)[%-–](%D-) +((%d%d%d%d)%a?)$', 'm', 'm2', 'a', 'y'},
-- month/season year or proper-name year; quarter year when First Quarter YYYY etc.
['My'] = {'^([^%d–]-) +((%d%d%d%d)%a?)$', '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-) +((%d%d)%d%d)[%-–]((%d%d)%a?)$'}, -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
['Sy-y'] = {'^(%D-) +(%d%d%d%d)[%-–]((%d%d%d%d)%a?)$'}, -- special case Winter/Summer year-year; year separated with unspaced endash
['y-y'] = {'^(%d%d%d%d?)[%-–]((%d%d%d%d?)%a?)$'}, -- year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
['y4-y2'] = {'^((%d%d)%d%d)[%-–]((%d%d)%a?)$'}, -- year range: YYYY–YY; separated by unspaced endash
['y'] = {'^((%d%d%d%d?)%a?)$'}, -- year; here accept either YYY or YYYY
}
--[[--------------------------< 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['ymd'][1]) or -- ymd
v:match (patterns['Mdy'][1]) or -- dmy
v:match (patterns['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, tCOinS_date)
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['ymd'][1]) then -- year-initial numerical year month day format
year, month, day = date_string:match (patterns['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['Mdy'][1]) then -- month-initial: month day, year
month, day, anchor_year, year = mw.ustring.match(date_string, patterns['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['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['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['dMy'][1]) then -- day-initial: day month year
day, month, anchor_year, year = mw.ustring.match(date_string, patterns['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['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['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['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['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['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['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['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['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['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['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['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['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['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['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['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['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['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['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['M-My'][1]) then -- month/season range year; months separated by endash
month, month2, anchor_year, year = mw.ustring.match(date_string, patterns['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['My'][1]) then -- month/season/quarter/proper-name year
month, anchor_year, year = mw.ustring.match(date_string, patterns['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['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['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['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['y4-y2'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if in_array (param, {'date', 'publication-date', 'year'}) then
add_prop_cat ('year-range-abbreviated');
end
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
elseif mw.ustring.match(date_string, patterns['y'][1]) then -- year; here accept either YYY or YYYY
anchor_year, year = mw.ustring.match(date_string, patterns['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 'access-date' == param then -- test accessdate 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; accessdate must not be a range
if not is_valid_accessdate(year .. '-' .. month .. '-' .. day) then
return false; -- return false when accessdate out of bounds
end
else
return false; -- return false when accessdate 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 ~= tCOinS_date 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}, tCOinS_date); -- 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, tCOinS_date, error_list)
local anchor_year; -- will return as nil if the date being tested is not |date=
local COinS_date; -- 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 = false;
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?%a?$") 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?)%a?"); -- get the year portion so it can be tested
if 'date' == k then
anchor_year, COinS_date = v.val:match("((c%. [1-9]%d%d%d?)%a?)"); -- anchor year and COinS_date only from |date= parameter
good_date = is_valid_year(year);
elseif 'year' == k then
good_date = is_valid_year(year);
end
elseif 'date' == k then -- if the parameter is |date=
if v.val:match("^n%.d%.%a?$") then -- ToDo: I18N -- if |date=n.d. with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((n%.d%.)%a?)"); -- ToDo: I18N -- "n.d."; no error when date parameter is set to no date
elseif v.val:match("^nd%a?$") then -- ToDo: I18N -- if |date=nd with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((nd)%a?)"); -- ToDo: I18N -- "nd"; no error when date parameter is set to no date
else
good_date, anchor_year, COinS_date = check_date (v.val, k, tCOinS_date); -- 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?%a?$") then -- if |year = 3 or 4 digits only with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v.val:match("((%d+)%a?)");
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 _ 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') and year_string:match ('%d%d%d%d%a') 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
else
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[pattern_idx][1]
Items in patterns{} have the general form:
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'}, where:
['ymd'] is pattern_idx
patterns['ymd'][1] is the match pattern with captures for mw.ustring.match()
patterns['ymd'][2] is an indicator letter identifying the content of the first capture
patterns['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[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 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[pattern_idx][1]
c1, c2, c3, c4, c5, c6, c7 = mw.ustring.match (date, patterns[pattern_idx][1]); -- get the captures
local t = { -- table that holds k/v pairs of date parts from the captures and patterns[pattern_idx][2..]
[patterns[pattern_idx][2]] = c1; -- at minimum there is always one capture with a matching indicator letter
[patterns[pattern_idx][3] or 'x'] = c2; -- patterns can have a variable number of captures; each capture requires an indicator letter;
[patterns[pattern_idx][4] or 'x'] = c3; -- where there is no capture, there is no indicator letter so n in patterns[pattern_idx][n] will be nil;
[patterns[pattern_idx][5] or 'x'] = c4; -- the 'x' here spoofs an indicator letter to prevent 'table index is nil' error
[patterns[pattern_idx][6] or 'x'] = c5;
[patterns[pattern_idx][7] or 'x'] = c6;
[patterns[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) 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
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.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 mode; -- long or short month names
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 cfg.date_names.en.long[month] then -- long month dates
-- if cfg.date_names.inv_local_long[cfg.date_names.en.long[month]] then
-- xlate = cfg.date_names.inv_local_long[cfg.date_names.en.long[month]];
-- end
---- mode = 'F'; -- English name is long so use long local name
-- elseif cfg.date_names.en.short[month] then -- short month dates
-- if cfg.date_names.inv_local_short[cfg.date_names.en.short[month]] then
-- xlate = cfg.date_names.inv_local_short[cfg.date_names.en.short[month]];
-- end
---- mode = 'M'; -- English name is short so use short local name
-- elseif cfg.date_names.en.quarter[month] then -- quarter dates
-- if cfg.date_names.inv_local_quarter[cfg.date_names.en.quarter[month]] then
-- xlate = cfg.date_names.inv_local_quarter[cfg.date_names.en.quarter[month]];
-- end
-- elseif cfg.date_names.en.season[month] then -- season dates
-- if cfg.date_names.inv_local_season[cfg.date_names.en.season[month]] then
-- xlate = cfg.date_names.inv_local_season[cfg.date_names.en.season[month]];
-- end
-- elseif cfg.date_names.en.named[month] then -- named dates
-- if cfg.date_names.inv_local_named[cfg.date_names.en.named[month]] then
-- xlate = cfg.date_names.inv_local_named[cfg.date_names.en.named[month]];
-- end
-- else
-- xlate=nil; -- not an English month name; could be local language month name
---- mode = nil; -- not an English month name; could be local language month name or an English season name
-- end
if xlate then
-- if mode then -- might be a season
-- xlate = lang_object:formatDate(mode, '1' .. month); -- translate the month name to this local language
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
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return { -- return exported functions
dates = dates,
year_date_check = year_date_check,
reformat_dates = reformat_dates,
date_hyphen_to_dash = date_hyphen_to_dash,
date_name_xlate = date_name_xlate,
set_selected_modules = set_selected_modules
}
obboarlfkmx4zbge5gqjllttddlxljn
Module:Citation/CS1/Identifiers
828
48812124
1067249010
1017041362
2022-01-22T14:11:18Z
Trappist the monk
10289486
update per [[Wikipedia:Village_pump_(proposals)#rfc:_shall_we_update_cs1/2?|RfC]];
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 z; -- table of tables defined in Module:Citation/CS1/Utilities
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 :<lang code>:<article title> when <q> has an <article title> for <lang code>; nil else
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 ({':', this_wiki_code, ':', wd_article}); -- interwiki-style link without brackets if taken from WD; leading colon required
end
return wd_article; -- article title from WD; nil else
end
--[[--------------------------< L I N K _ L A B E L _ M A K E >------------------------------------------------
common function to create identifier link label from handler table or from Wikidata
returns the first available of
1. redirect from local wiki's handler table (if enabled)
2. Wikidata (if there is a Wikidata entry for this identifier in the local wiki's language)
3. label specified in the local wiki's handler table
]]
local function link_label_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;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
local wd_article; -- article title from Wikidata
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 (link_label_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 (link_label_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 _ B I O R X I V _ D A T E >------------------------------------
returns true if:
2019-12-11T00:00Z <= biorxiv_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
biorxiv_date is the date provided in those |biorxiv= parameter values that are dated 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_object.formatDate(). To get
around that call this function with date parts and create a YYYY-MM-DD format date.
]=]
local function is_valid_biorxiv_date (y, m, d)
local biorxiv_date = table.concat ({y, m, d}, '-'); -- make ymd date
local good1, good2;
local biorxiv_ts, tomorrow_ts; -- to hold Unix timestamps representing the dates
local lang_object = mw.getContentLanguage();
good1, biorxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', biorxiv_date); -- convert biorxiv_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
biorxiv_ts = tonumber (biorxiv_ts) or lang_object:parseFormattedNumber (biorxiv_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
return ((1576022400 <= biorxiv_ts) and (biorxiv_ts < tomorrow_ts)) -- 2012-12-11T00:00Z <= biorxiv_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 (http://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: http://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, version;
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
local err_msg_t = {};
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, ' [[//arxiv.org/archive/', class, ' ', class, ']]'}); -- external link within square brackets, not wikilink
else
set_message ('err_class_ignored');
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: http://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 err_type;
local err_msg = '';
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
end
end
if is_set (err_type) then -- if there was an error detected
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.
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[1-9]%d)%.([01]%d)%.([0-3]%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (after 2019-12-11)
'^10.1101/(20[1-9]%d)%.([01]%d)%.([0-3]%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (after 2019-12-11)
}
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_biorxiv_date (y, m, d) then -- validate the encoded date; TODO: don't ignore leap-year and actual month lengths ({{#time:}} is a poor date validator)
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.
]]
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;
local text;
if is_set (inactive) then
local inactive_year = inactive:match("%d%d%d%d") or ''; -- 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
else
inactive_year = nil; -- |doi-broken-date= has something but it isn't a date
end
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 = " (" .. cfg.messages['inactive'] .. ' ' .. inactive .. ')';
end
local registrant = mw.ustring.match (id, '^10%.([^/]+)/[^%s–]-[^%.,]$'); -- registrant set when DOI has the proper basic form
local registrant_err_patterns = { -- these patterns are for code ranges that are not supported
'^[^1-3]%d%d%d%d%.%d%d*$', -- 5 digits with subcode (0xxxx, 40000+); accepts: 10000–39999
'^[^1-5]%d%d%d%d$', -- 5 digits without subcode (0xxxx, 60000+); accepts: 10000–59999
'^[^1-9]%d%d%d%.%d%d*$', -- 4 digits with subcode (0xxx); accepts: 1000–9999
'^[^1-9]%d%d%d$', -- 4 digits without subcode (0xxx); accepts: 1000–9999
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d?%d?$', -- less than 4 digits without subcode (with subcode is legitimate)
'^5555$', -- test registrant will never resolve
'[^%d%.]', -- any character that isn't a digit or a dot
}
if not ignore_invalid then
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
err_flag = set_message ('err_bad_doi'); -- when found, mark this DOI as bad
break; -- and done
end
end
else
err_flag = set_message ('err_bad_doi'); -- invalid directory or malformed
end
else
set_message ('maint_doi_ignore');
end
if err_flag then
options.coins_list_t['DOI'] = 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,
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: http://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 = { -- list of known query parameters from http://www.handle.net/proxy_servlet.html
'noredirect',
'ignore_aliases',
'auth',
'cert',
'index',
'type',
'urlappend',
'locatt',
'action',
}
local hdl, suffix, param = id:match ('(.-)(%?(%a+).+)$'); -- look for query string
local found;
if hdl then -- when there are query strings, this is the handle identifier portion
for _, q in ipairs (query_params) 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 = hdl; -- 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)
local isbn_str = 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 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.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 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;
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'}) then -- Japan, United Kingdom
domain = "co." .. domain;
elseif in_array (domain, {'z.cn'}) then -- China
domain = "cn";
elseif in_array (domain, {'au', 'br', 'mx', 'sg', 'tr'}) then -- Australia, Brazil, Mexico, Singapore, Turkey
domain = "com." .. domain;
elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'es', 'fr', '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, Spain, France, 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 http://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 = true;
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 (link_label_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: [http://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 = true;
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.
http://info-uri.info/registry/OAIHandler?verb=GetRecord&metadataPrefix=reg&identifier=info:lccn/
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 lccn = options.id;
local handler = options.handler;
local err_flag; -- presume that LCCN is valid
local id = lccn; -- local copy of the LCCN
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: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, separator = handler.separator, encode = handler.encode});
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 10 < number:len() then
number = nil; -- constrain to 1 to 10 digits; change this when OCLC issues 11-digit numbers
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 (link_label_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,
['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;
z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities
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;
}
1s53aqur5zcnnjyu0azfrtjq6dyiwg4
Module:Citation/CS1/Utilities
828
48808487
1067249005
999303015
2022-01-22T14:11:16Z
Trappist the monk
10289486
update per [[Wikipedia:Village_pump_(proposals)#rfc:_shall_we_update_cs1/2?|RfC]];
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 to a dash under certain conditions. The hyphen 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
]]
local function hyphen_to_dash (str)
if not is_set (str) then
return str;
end
local accept; -- boolean
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
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 a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2'); -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–'); -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
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
}
kk801mqzkv4xrvmuck62gy23fyu6dl0
Module:Citation/CS1/Whitelist
828
39013723
1067249016
1025068254
2022-01-22T14:11:22Z
Trappist the monk
10289486
update per [[Wikipedia:Village_pump_(proposals)#rfc:_shall_we_update_cs1/2?|RfC]];
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 = {
['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-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,
['authors'] = 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'] = true, -- 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,
['lay-date'] = false,
['lay-format'] = false,
['lay-source'] = false,
['lay-url'] = false,
['lccn'] = true,
['LCCN'] = true,
['location'] = true,
['magazine'] = true,
['medium'] = true,
['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,
['people'] = 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-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-link'] = true,
['subject-mask'] = 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,
['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-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 = {
['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-link#'] = true,
['subject#-link'] = true,
['subject-mask#'] = true,
['subject#-mask'] = 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, 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 = {
arxiv = {
['arxiv'] = true, -- cite arxiv and arxiv identifiers
['class'] = true,
['eprint'] = true, -- cite arxiv and arxiv identifiers
},
biorxiv = {
['biorxiv'] = true,
},
citeseerx = {
['citeseerx'] = 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, 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.
Same conventions for true/false/tracked/nil as above.
]]
local limited_basic_arguments = {
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['author-link'] = true,
['authorlink'] = true,
['author-mask'] = true,
['authors'] = 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 = {
['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 = {
['audio-visual'] = {
['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,
['season'] = true,
['series-link'] = true,
['series-no'] = true,
['series-number'] = true,
['station'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcripturl'] = false,
['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,
['series-link'] = true,
['station'] = true,
},
speech = {
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
thesis = {
['degree'] = true,
['docket'] = true,
},
}
--[[--------------------------< 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 = {}; -- a table for output
for k, _ in pairs (t) do -- spin through the table and collect the keys
table.insert (out, k) -- add each key to the output table
end
return out; -- and done
end
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
basic_arguments = basic_arguments,
numbered_arguments = numbered_arguments,
limited_basic_arguments = limited_basic_arguments,
limited_numbered_arguments = limited_numbered_arguments,
preprint_arguments = preprint_arguments,
preprint_template_list = template_list_get (preprint_arguments), -- make a template list from preprint_arguments{} table
unique_arguments = unique_arguments,
unique_param_template_list = template_list_get (unique_arguments), -- make a template list from unique_arguments{} table
};
c31769ha0b0k636k736zgv3no6leh8l
Module:Citation/CS1/styles.css
828
57940169
1067248974
999302996
2022-01-22T14:11:09Z
Trappist the monk
10289486
update per [[Wikipedia:Village_pump_(proposals)#rfc:_shall_we_update_cs1/2?|RfC]];
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}} which do not have to handle PDF links
*/
.id-lock-free a,
.citation .cs1-lock-free a {
background: linear-gradient(transparent, transparent),
url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-limited a,
.id-lock-registration a,
.citation .cs1-lock-limited a,
.citation .cs1-lock-registration a {
background: linear-gradient(transparent, transparent),
url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-subscription a,
.citation .cs1-lock-subscription a {
background: linear-gradient(transparent, transparent),
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: linear-gradient(transparent, transparent),
url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
right 0.1em center/12px no-repeat;
}
/* 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: #d33;
}
.cs1-visible-error {
color: #d33;
}
.cs1-maint {
display: none;
color: #3a3;
margin-left: 0.3em;
}
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-format {
font-size: 95%;
}
/* kerning */
.cs1-kern-left {
padding-left: 0.2em;
}
.cs1-kern-right {
padding-right: 0.2em;
}
/* selflinks – avoid bold font style when cs1|2 template links to the current page */
.citation .mw-selflink {
font-weight: inherit;
}
05swlrxxaulwkgtbbdmtf5atrgfwmuz
Module:Commons link
828
63132438
1058547450
1041185963
2021-12-04T06:19:59Z
Hike395
11639
fix global variables
Scribunto
text/plain
require('Module:No globals')
-- Module to find commons galleries and categories based on wikidata entries
local getArgs = require('Module:Arguments').getArgs
local yesNo = require('Module:Yesno')
local generateWarning = require('Module:If preview')._warning
local p = {}
-- Check if string is a valid QID
-- Argument: QID to check
-- Returns: valid (bool)
local function _validQID(qid)
return qid and mw.ustring.find(qid,"^[Qq]%d+$")
end
-- Check if string is a valid wikidata property string
-- Argument: property string to check
-- Returns: valid (bool)
local function _validProp(prop)
return prop and mw.ustring.find(prop,"^[Pp]%d+$")
end
local function _lcfirst(s)
return mw.ustring.lower(mw.ustring.sub(s,1,1))..mw.ustring.sub(s,2)
end
-- Format displayed linktext
-- Arguments:
-- s = string to display
-- formatting = formatting table:
-- formatting.linktext = if defined, override s
-- formatting.lcfirst = lower case the first letter in display
-- formatting.bold = whether to bold the display
-- formatting.italic = whether to italicize the display
-- formatting.nowrap = set nowrapping
-- Returns:
-- formatted string
local function _formatResult(s, formatting)
local resultVal = formatting.linktext or s
if formatting.lcfirst then
resultVal = _lcfirst(resultVal)
end
local style = ""
if formatting.italic then style = "font-style:italic; " end
if formatting.bold then style = style.."font-weight:bold; " end
if formatting.nowrap then style = style.."white-space:nowrap; " end
if style ~= "" then
resultVal = '<span style="'..mw.text.trim(style)..'">'..resultVal..'</span>'
end
return resultVal
end
-- Get title, namespace, and QID for current page
-- Arguments:
-- qid = testing only: get title of alternative page with QID=qid
-- nsQid = whether to return the ns of the qid page or current
-- Returns:
-- title, namespace (string), qid of current page (or test page)
local function _getTitleQID(qid,nsQid)
local titleObject = mw.title.getCurrentTitle()
-- look up qid for current page (if not testing)
local nsText = mw.ustring.gsub(titleObject.nsText,"_"," ")
if not _validQID(qid) then
qid = mw.wikibase.getEntityIdForCurrentPage()
return titleObject.text, nsText, qid
end
-- testing-only path: given a qid, determine title
-- always use namespace from current page (to suppress tracking cat)
qid = qid:upper()
local title = mw.wikibase.getSitelink(qid) or ""
-- strip any namespace from sitelink
local firstColon = mw.ustring.find(title,':',1,true)
local qidNsText = ""
if firstColon then
qidNsText = mw.ustring.sub(title,1,firstColon-1)
title = mw.ustring.sub(title,firstColon+1)
end
if nsQid then
return title, qidNsText, qid
end
return title, nsText, qid
end
-- Lookup Commons gallery in Wikidata
-- Arguments:
-- qid = QID of current article
-- fetch = whether to lookup Commons sitelink (bool)
-- commonsSitelink = default value for Commons sitelink
-- Returns:
-- categoryLink = name of Commons category, nil if nothing is found
-- consistent = multiple wikidata fields are examined: are they consistent?
-- commonsSitelink = commons sitelink for current article
local function _lookupGallery(qid,fetch,commonsSitelink)
if not _validQID(qid) then
return nil, true, nil
end
qid = qid:upper()
local galleryLink = nil
local consistent = true
-- look up commons sitelink for article, use if not category
if fetch then
commonsSitelink = mw.wikibase.getSitelink(qid,"commonswiki") or commonsSitelink
end
if commonsSitelink and mw.ustring.sub(commonsSitelink,1,9) ~= "Category:" then
galleryLink = commonsSitelink
end
-- P935 is the "commons gallery" property for this article
local P935 = mw.wikibase.getBestStatements(qid, "P935")[1]
if P935 and P935.mainsnak.datavalue then
local gallery = P935.mainsnak.datavalue.value
if galleryLink and galleryLink ~= gallery then
consistent = false
else
galleryLink = gallery
end
end
return galleryLink, consistent, commonsSitelink
end
-- Find fallback category by looking up Commons sitelink of different page
-- Arguments:
-- qid = QID for current article
-- property = property that refers to other article whose sitelink to return
-- Returns: either category-stripped name of article, or nil
local function _lookupFallback(qid,property)
if not _validQID(qid) or not _validProp(property) then
return nil
end
qid = qid:upper()
property = property:upper()
-- If property exists on current article, get value (other article qid)
local value = mw.wikibase.getBestStatements(qid, property)[1]
if value and value.mainsnak.datavalue and value.mainsnak.datavalue.value.id then
-- Look up Commons sitelink of other article
local sitelink = mw.wikibase.getSitelink(value.mainsnak.datavalue.value.id,"commonswiki")
-- Check to see if it starts with "Category:". If so, strip it and return
if sitelink and mw.ustring.sub(sitelink,1,9) == "Category:" then
return mw.ustring.sub(sitelink,10)
end
end
return nil
end
-- Find Commons category by looking in wikidata
-- Arguments:
-- qid = QID of current article
-- fetch = whether to lookup Commons sitelink (bool)
-- commonsSitelink = default value for Commons sitelink
-- Returns:
-- categoryLink = name of Commons category, nil if nothing is found
-- consistent = multiple wikidata fields are examined: are they consistent?
-- commonsSitelink = commons sitelink for current article
local function _lookupCategory(qid, fetch, commonsSitelink)
if not _validQID(qid) then
return nil, true, nil
end
qid = qid:upper()
local categoryLink = nil
local consistent = true
-- look up commons sitelink for article, use if starts with "Category:"
if fetch then
commonsSitelink = mw.wikibase.getSitelink(qid,"commonswiki") or commonsSitelink
end
if commonsSitelink and mw.ustring.sub(commonsSitelink,1,9) == "Category:" then
categoryLink = mw.ustring.sub(commonsSitelink,10)
end
-- P910 is the "topic's main category". Look for commons sitelink there
local fallback = _lookupFallback(qid,"P910")
if fallback then
if categoryLink and categoryLink ~= fallback then
consistent = false
qid = nil
else
categoryLink = fallback
end
end
-- P1754 is the "list's main category". Look for commons sitelink there
fallback = _lookupFallback(qid,"P1754")
if fallback then
if categoryLink and categoryLink ~= fallback then
consistent = false
qid = nil
else
categoryLink = fallback
end
end
-- P373 is the "commons category" property for this article. This is
-- a low-quality field, so should only be used as a last resort.
if categoryLink == nil and _validQID(qid) then
local P373 = mw.wikibase.getBestStatements(qid, "P373")[1]
if P373 and P373.mainsnak.datavalue then
categoryLink = P373.mainsnak.datavalue.value
consistent = true -- P373 is never used if anything else is available
end
end
return categoryLink, consistent, commonsSitelink
end
-- Does the article have a Commons gallery, and is it consistent?
-- Arguments:
-- qid = QID to lookup in wikidata (for testing only)
-- Returns:
-- filename at Commons, bool: is wikidata consistent for this article?
function p._hasGalleryConsistent(qid)
local wp_title, wp_ns
wp_title, wp_ns, qid = _getTitleQID(qid)
return _lookupGallery(qid,true)
end
-- Does the article have a corresponding Commons gallery?
-- Arguments:
-- qid = QID to lookup in wikidata (for testing only)
-- Returns:
-- filename at Commons if so, false if not
function p._hasGallery(qid)
local galleryLink, consistent = p._hasGalleryConsistent(qid)
return consistent and galleryLink
end
-- Does the article have a Commons category? Is wikidata consistent for that?
-- Arguments:
-- qid = QID to lookup in wikidata (for testing only)
-- prefix = whether to add "Category:" to return string (default true)
-- Returns:
-- filename at Commons, bool: consistent
function p._hasCategoryConsistent(qid,prefix)
if prefix == nil then
prefix = true
end
local wp_title, wp_ns
wp_title, wp_ns, qid = _getTitleQID(qid)
local categoryLink, consistent = _lookupCategory(qid,true)
if categoryLink and prefix then
categoryLink = "Category:"..categoryLink
end
return categoryLink, consistent
end
-- Does the article have a corresponding Commons category?
-- Arguments:
-- qid = QID to lookup in wikidata (for testing only)
-- prefix = whether to add "Category:" to return string (default true)
-- Returns:
-- filename at Commons if so, blank if not
function p._hasCategory(qid,prefix)
local categoryLink, consistent = p._hasCategoryConsistent(qid,prefix)
return consistent and categoryLink
end
-- Create Commons link corresponding to current article
-- Arguments:
-- namespace = namespace in Commons ("" for galleries)
-- default = use as Commons link, don't access wikidata
-- search = string to search for
-- fallback = string to search for if wikidata fails
-- formatting = formatting parameters
-- qid = QID to lookup in wikidata (for testing only)
-- Returns:
-- formatted wikilink to Commons in specified namespace
function p._getCommons(namespace,default,search,fallback,formatting,qid)
local nsColon
if not namespace or namespace == "" then
nsColon = ""
else
nsColon = namespace..":"
end
if default then
return "[[Commons:"..nsColon..default.."|".._formatResult(default,formatting).."]]"
end
if search then
return "[[Commons:Special:Search/"..nsColon..search.."|".._formatResult(search,formatting).."]]"
end
local wp_title, wp_ns
wp_title, wp_ns, qid = _getTitleQID(qid)
local commonsLink = nil
local consistent = true
if nsColon == "" then
commonsLink, consistent = _lookupGallery(qid,true)
elseif namespace:lower() == "category" then
commonsLink, consistent = _lookupCategory(qid,true)
end
-- use wikidata if consistent
if commonsLink and consistent then
return "[[Commons:"..nsColon..commonsLink.."|".._formatResult(commonsLink,formatting).."]]"
end
-- if not consistent, fall back to search and add to tracking cat
-- construct default result (which searches for title)
local searchResult = "[[Commons:Special:Search/"..nsColon..(fallback or wp_title)
.."|".._formatResult(fallback or wp_title,formatting).."]]"
if not consistent and wp_ns == "" then
local friendlyNS
if nsColon == "" then
friendlyNS = "gallery"
else
friendlyNS = namespace:lower()
end
searchResult = searchResult.."[[Category:Inconsistent wikidata for Commons "..friendlyNS.."]]"
end
return searchResult
end
-- Returns "best" Commons link: first look for gallery, then try category
-- Arguments:
-- default = use as Commons link, don't access wikidata
-- search = string to search for
-- fallback = string to search for if wikidata lookup fails
-- formatting = formatting parameters
-- qid = QID to lookup in wikidata (for testing only)
-- Returns:
-- formatted wikilink to Commons "best" landing page
function p._getGalleryOrCategory(default, search, fallback, formatting, qid)
if default then
return "[[Commons:"..default.."|".._formatResult(default,formatting).."]]"
end
if search then
return "[[Commons:Special:Search/"..search.."|".._formatResult(search,formatting).."]]"
end
local wp_title, wp_ns
wp_title, wp_ns, qid = _getTitleQID(qid)
local trackingCats = ""
local galleryLink, consistent, commonsSitelink = _lookupGallery(qid,true)
-- use wikidata if either sitelink or P935 exist, and they both agree
if galleryLink and consistent then
return "[[Commons:"..galleryLink.."|".._formatResult(galleryLink,formatting).."]]"
end
if not consistent and wp_ns == "" then
trackingCats = "[[Category:Inconsistent wikidata for Commons gallery]]"
end
-- if gallery is not good, fall back looking for category
local categoryLink
categoryLink, consistent = _lookupCategory(qid,false,commonsSitelink)
if categoryLink and consistent then
return "[[Commons:Category:"..categoryLink.."|".._formatResult(categoryLink,formatting).."]]"..trackingCats
end
if not consistent and wp_ns == "" then
trackingCats = trackingCats.."[[Category:Inconsistent wikidata for Commons category]]"
end
-- return search result looking for title as last attempt
return "[[Commons:Special:Search/" .. (fallback or wp_title) ..
"|" .. _formatResult(fallback or wp_title,formatting) .. "]]" .. trackingCats
end
-- Return link(s) Commons gallery, or category, or both from wikidata
-- Arguments:
-- defaultGallery = default gallery link to use, instead of wikidata
-- defaultCategory = default category link to use, instead of wikidata
-- categoryText = if both gallery and category, text to use in category link ("category" by default)
-- oneSearch = only emit one search result
-- formatting = formatting parameters
-- qid = qid of page to lookup in wikidata (testing only)
function p._getGalleryAndCategory(defaultGallery, defaultCategory,
categoryText, oneSearch, formatting, qid
)
local wp_title, wp_ns
wp_title, wp_ns, qid = _getTitleQID(qid)
categoryText = categoryText or "category"
local trackingCats = ""
local galleryLink, galleryConsistent
local commonsSitelink = nil
if defaultGallery then
galleryLink = defaultGallery
galleryConsistent = true
else
galleryLink, galleryConsistent, commonsSitelink = _lookupGallery(qid,true)
end
local galleryGood = galleryLink and galleryConsistent
if not galleryConsistent and wp_ns == "" then
trackingCats = "[[Category:Inconsistent wikidata for Commons gallery]]"
end
local categoryLink, categoryConsistent
if defaultCategory then
categoryLink = defaultCategory
categoryConsistent = true
else
categoryLink, categoryConsistent = _lookupCategory(qid,defaultGallery,commonsSitelink)
end
local categoryGood = categoryLink and categoryConsistent
if not categoryConsistent and wp_ns == "" then
trackingCats = trackingCats.."[[Category:Inconsistent wikidata for Commons category]]"
end
local firstLink
-- construct default result (which searches for title)
local searchResult = "[[Commons:Special:Search/"..wp_title.."|".._formatResult(wp_title,formatting).."]]"
if not oneSearch then
searchResult = searchResult.." ([[Commons:Special:Search/Category:"..wp_title.."|"..categoryText.."]])"
end
local linkText = nil
if galleryGood then
firstLink = galleryLink
linkText = galleryLink
elseif categoryGood then
firstLink = "Category:"..categoryLink
linkText = categoryLink
else
return searchResult..trackingCats
end
local resultVal = "[[Commons:"..firstLink.."|".._formatResult(linkText,formatting).."]]"
if galleryGood and categoryGood then
resultVal = resultVal.." ([[Commons:Category:"..categoryLink.."|"..categoryText.."]])"
end
return resultVal..trackingCats
end
-- Compare two titles with their namespaces stripped
local function titleMatch(s1,s2)
s1 = s1 or ""
s2 = s2 or ""
s1 = mw.ustring.gsub(s1,"^[^:]+:","")
s2 = mw.ustring.gsub(s2,"^[^:]+:","")
return s1 == s2
end
local galleryTrackingCats = {
commons_link_on_wikidata = '[[Category:Commons link is on Wikidata]]',
commons_link_defined_as_pagename = '[[Category:Commons link is defined as the pagename]]',
commons_link_locally_defined = '[[Category:Commons link is locally defined]]',
commons_link_from_wikidata = '[[Category:Commons link from Wikidata]]',
commons_link_is_pagename = '[[Category:Commons link is the pagename]]',
inconsistent = '[[Category:Inconsistent wikidata for Commons gallery]]'
}
local categoryTrackingCats = {
commons_link_on_wikidata = '[[Category:Commons category link is on Wikidata]]',
commons_link_defined_as_pagename = '[[Category:Commons category link is defined as the pagename]]',
commons_link_locally_defined = '[[Category:Commons category link is locally defined]]',
commons_link_from_wikidata = '[[Category:Commons category link from Wikidata]]',
commons_link_is_pagename = '[[Category:Commons category link is the pagename]]',
inconsistent = '[[Category:Inconsistent wikidata for Commons category]]'
}
local function selectTrackingCat(trackingCats,wikidata,consistent,default,title)
if not consistent then
return trackingCats.inconsistent
end
if default then
-- construct warning message
if default == wikidata then
return trackingCats.commons_link_on_wikidata
end
local warning = ""
if wikidata then
warning = generateWarning({
"Commons link does not match Wikidata – [[Template:Commons_category#Resolving_discrepancies|please check]]"
})
end
if titleMatch(default,title) then
return trackingCats.commons_link_defined_as_pagename .. warning
end
return trackingCats.commons_link_locally_defined .. warning
end
if wikidata then
return trackingCats.commons_link_from_wikidata
end
return trackingCats.commons_link_is_pagename
end
-- Figure out tracking categories and editor warnings
-- Arguments:
-- default = Commons link argument passed to template
-- fetchGallery = whether to fetch a gallery from Wikidata
-- fetchCategory = whether to fetch a category from Wikidata
-- qid = force a qid for testing
-- Returns:
-- tracking category and possible user warning
--
-- Note: the logic for the tracking is quite different than the logic
-- for generating Commons links (above). Thus, it is separated into another
-- function for code clarity and maintainability. This should not seriously
-- affect performance: server time is dominated by fetching wikidata entities,
-- and those entities should be cached and shared between the Commons generating
-- code and this tracking code.
function p._tracking(default, fetchGallery, fetchCategory, qid)
local title, wp_ns, wp_qid = _getTitleQID(qid,true)
if wp_ns ~= "" then
title = wp_ns..":"..title
end
-- only track if test or namespace=article or namespace=category
if not (qid or wp_ns == "" or wp_ns == "Category") then
return ""
end
-- determine title and namespace of wikidata and wp article
local wikidata = nil
local consistent = nil
-- Tracking code works for all 4 cases of states of fetchGallery/Category
-- fetchGallery takes precedence
if fetchGallery then
wikidata, consistent = p._hasGalleryConsistent(qid)
if default or not fetchCategory or (consistent and wikidata) then
return selectTrackingCat(galleryTrackingCats,wikidata,consistent,
default,title)
end
end
if fetchCategory then
local cat_wikidata, cat_consistent = p._hasCategoryConsistent(qid,true)
if not fetchGallery or (cat_consistent and cat_wikidata) then
return selectTrackingCat(categoryTrackingCats,cat_wikidata,
cat_consistent,default,title)
end
return selectTrackingCat(galleryTrackingCats,wikidata,consistent,
default,title)
end
return "" -- nothing fetched, nothing tracked
end
local function _createFormatting(args)
local formatting = {}
formatting.linktext = args.linktext
formatting.lcfirst = yesNo(args.lcfirst)
formatting.bold = yesNo(args.bold)
formatting.italic = yesNo(args.italic)
formatting.nowrap = yesNo(args.nowrap)
return formatting
end
-- Testing-only entry point for _getTitleQID
function p.getTitleQID(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
local text, ns, qid = _getTitleQID(args[1],args[2])
return text..","..ns..","..(qid or "nil")
end
-- Testing-only entry point for _lookupFallback
function p.lookupFallback(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
local fallback = _lookupFallback(args[1],args[2])
return fallback or "nil"
end
-- Find the Commons gallery page associated with article
function p.getGallery(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
return p._getCommons("",args[1],args.search,args.fallback,_createFormatting(args),args.qid)
end
-- Find the Commons category page associated with article
function p.getCategory(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
local retval = p._getCommons("Category", args[1],
args.search, args.fallback, _createFormatting(args), args.qid
)
if args.tracking then
local default = nil
if args[1] then
default = "Category:"..args[1]
end
retval = retval..p._tracking(default, false, true, args.qid)
end
return retval
end
function p.getGalleryOrCategory(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
local retval = p._getGalleryOrCategory(
args[1], args.search, args.fallback, _createFormatting(args), args.qid
)
if args.tracking then
retval = retval..p._tracking(args[1],true,true,args.qid)
end
return retval
end
function p.hasGallery(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
return p._hasGallery(args.qid) or ""
end
function p.hasCategory(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
return p._hasCategory(args.qid) or ""
end
function p.hasGalleryOrCategory(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
return p._hasGallery(args.qid) or p._hasCategory(args.qid) or ""
end
function p.getGalleryAndCategory(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
return p._getGalleryAndCategory(args[1], args[2],
args.categoryText, args.oneSearch, _createFormatting(args), args.qid)
end
function p.tracking(frame)
local args = getArgs(frame,{frameOnly=true,parentOnly=false,parentFirst=false})
return p._tracking(args[1], args.fetchGallery, args.fetchCategory, args.qid)
end
return p
tiwwt5d4q8wb5gx6nh70z4fiqb3bkp6
Module:Convert
828
38570716
1071532809
1021696375
2022-02-13T04:01:13Z
Johnuniq
6036800
update from sandbox per [[Template talk:Convert#Module version 27]]
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
-- LATER: Should calculate result from an interpolation between the next
-- lower and higher altitudes in table, rather than rounding to nearest.
-- 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
}
altitude = altitude or 0
local a = (altitude < 0) and -altitude or altitude
a = floor(a / 5000 + 0.5)
if altitude < 0 then
a = -a
end
if a < -3 then
a = -3
elseif a > 80 then
a = 80
end
return mach_table[a + 4] * 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
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' })
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 exponent, baseunit = unitcode:match('^e(%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
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_ignore_error 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 if invoked from {{val}}
-- 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" role="math">{SIGN}<span class="num">{NUM}</span>⁄<span class="den">{DEN}</span></span>', -- 1/2
'<span class="frac" role="math">{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" role="math">{SIGN}<span class="num">{NUM}</span><span class="sr-only">/</span><span class="den">{DEN}</span></span>', -- 1//2
'<span class="sfrac" role="math">{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 == '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 input 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)
-- For slwiki, a unit name depends on the value.
-- Parameter clean is the unsigned rounded value in en digits, as a string.
-- Value Source Example for "m"
-- integer 1: name1 meter (also is the name of the unit)
-- integer 2: var{1} metra
-- integer 3 and 4: var{2} metri
-- integer else: var{3} metrov (0 and 5 or more)
-- real/fraction: var{4} metra
-- var{i} means the i'th field in unit_table.varname if it exists and has
-- an i'th field, otherwise name2.
-- 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.
local vname
if clean == '1' then
vname = unit_table.name1
elseif unit_table.varname then
local i
if clean == '2' then
i = 1
elseif clean == '3' or clean == '4' then
i = 2
elseif clean:find('.', 1, true) then
i = 4
else
i = 3
end
if i > 1 and varname == 'pl' then
i = i - 1
end
vname = split(unit_table.varname, '!')[i]
end
if vname then
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
return vname
end
return unit_table.name2
end
local function linked_id(parms, unit_table, key_id, want_link, clean)
-- 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'.
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
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 abbr_on or not varname then
result = (unit1 and linked_id(parms, unit1, key_id, false, clean) or '') .. result .. linked_id(parms, unit2, key_id2, false, '1')
else
result = (unit1 and variable_name(clean, unit1) or '') .. result .. variable_name('1', unit2)
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) 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 abbr_org = parms.abbr_org
local adjectival = parms.opt_adjectival
local lk = parms.lk
local want_link = (lk == 'on' or lk == inout)
local usename = unit_table.usename
local singular = info.singular
local want_name
if usename then
want_name = true
else
if 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
end
key = (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), want_name
end
local function decorate_value(parms, unit_table, which, 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".
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
local inout = unit_table.inout
local abbr = parms.abbr
if (abbr == 'on' or abbr == inout) and not 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 number_word then
local number_id
local lk = parms.lk
if lk == 'on' or lk == inout then
number_id = make_link(engscale.link, engscale[1])
else
number_id = engscale[1]
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 number_word
if i == range.n then
add_unit = false
number_word = true
end
decorate_value(parms, first_unit, i+1, 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 number_word
if i == range.n then
add_unit = false
number_word = true
end
decorate_value(parms, out_current, i+1, 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
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(frame)
-- Do convert, and if needed, do it again with higher default precision.
local parms = { frame = frame } -- will hold template arguments, after translation
set_config(frame.args)
local success, result = get_parms(parms, frame:getParent().args)
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
return success and result or message(parms, result)
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, -- 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, _unit = _unit }
phqn9ijbn4kmg5gbkm7884drd1aevj5
Module:Convert/data
828
38570725
1071532820
1027101649
2022-02-13T04:01:16Z
Johnuniq
6036800
update from sandbox per [[Template talk:Convert#Module version 27]]
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",
},
["in2"] = {
target = "sqin",
symbol = "in<sup>2</sup>",
},
["km²"] = {
target = "km2",
},
["mi2"] = {
target = "sqmi",
},
["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",
},
["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.602176487e-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", "l" },
utype = "density",
default = "oz/cuin",
},
["μg/dL"] = {
per = { "μg", "dL" },
utype = "density",
default = "lb/cuin",
},
["μg/l"] = {
per = { "μg", "l" },
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.602176487e-19,
default = "aJ",
},
["feV"] = {
name1 = "femtoelectronvolt",
symbol = "feV",
utype = "energy",
scale = 1.602176487e-34,
default = "yJ",
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",
},
["GeV"] = {
name1 = "gigaelectronvolt",
symbol = "GeV",
utype = "energy",
scale = 1.602176487e-10,
default = "nJ",
link = "Electronvolt",
},
["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",
},
["keV"] = {
name1 = "kiloelectronvolt",
symbol = "keV",
utype = "energy",
scale = 1.602176487e-16,
default = "fJ",
link = "Electronvolt",
},
["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",
},
["MeV"] = {
name1 = "megaelectronvolt",
symbol = "MeV",
utype = "energy",
scale = 1.602176487e-13,
default = "pJ",
link = "Electronvolt",
},
["meV"] = {
name1 = "millielectronvolt",
symbol = "meV",
utype = "energy",
scale = 1.602176487e-22,
default = "zJ",
link = "Electronvolt",
},
["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",
},
["neV"] = {
name1 = "nanoelectronvolt",
symbol = "neV",
utype = "energy",
scale = 1.602176487e-28,
default = "yJ",
link = "Electronvolt",
},
["PeV"] = {
name1 = "petaelectronvolt",
symbol = "PeV",
utype = "energy",
scale = 0.0001602176487,
default = "mJ",
link = "Electronvolt",
},
["peV"] = {
name1 = "picoelectronvolt",
symbol = "peV",
utype = "energy",
scale = 1.602176487e-31,
default = "yJ",
link = "Electronvolt",
},
["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",
},
["TeV"] = {
name1 = "teraelectronvolt",
symbol = "TeV",
utype = "energy",
scale = 1.602176487e-7,
default = "μJ",
link = "Electronvolt",
},
["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",
},
["μeV"] = {
name1 = "microelectronvolt",
symbol = "μeV",
utype = "energy",
scale = 1.602176487e-25,
default = "yJ",
link = "Electronvolt",
},
["μ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",
},
["ueV"] = {
target = "μeV",
},
["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.329522144166,
prefixes = 1,
default = "kcal/mol",
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 = 13e-6,
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 = 429.92261414790346,
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", "l" },
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", "l" },
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 = { "l", "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 = { "l", "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",
},
["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",
},
["miles"] = {
target = "mi",
},
["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)",
},
["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"] = {
symbol = "deadweight tonne",
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",
},
["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",
},
["/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 = 11.604505e6,
offset = 0,
iscomplex= true,
default = "MK",
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 = "min",
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",
},
["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",
},
["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",
},
["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,
default = "L impgal",
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",
},
["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>",
},
["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",
},
["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,
default = "L impgal",
link = "U.S. gallon",
},
["u.s.gal"] = {
target = "USgal",
sp_us = true,
default = "L impgal",
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",
},
["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",
["fJ"] = "keV",
["GJ"] = "kWh",
["MJ"] = "kWh",
["PJ"] = "kWh",
["pJ"] = "MeV",
["TJ"] = "kWh",
["YJ"] = "kWh",
["yJ"] = "μeV",
["ZJ"] = "kWh",
["zJ"] = "meV",
["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,
}
q4cyl1vehwilu3nh1tc3rjimkhuuu45
Module:Convert/text
828
39508461
1071532826
1021696360
2022-02-13T04:01:17Z
Johnuniq
6036800
update from sandbox per [[Template talk:Convert#Module version 27]]
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.
['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', },
}
-- 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"] = { ", " , "" , ", " },
["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",
["frac"] = "frac",
["input"] = "input",
["lang"] = "lang",
["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.
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
},
["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
["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)
},
["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
},
["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,
}
0mpgw5kd5zb2ftkgaks2dzosb6kfvhb
Module:Date
828
49576933
970908888
943180194
2020-08-03T02:55:18Z
Johnuniq
6036800
update from sandbox: implement show=M (minutes) and show=s (seconds); better method to fill a partial date
Scribunto
text/plain
-- Date functions for use by other modules.
-- I18N and time zones are not supported.
local MINUS = '−' -- Unicode U+2212 MINUS SIGN
local floor = math.floor
local Date, DateDiff, diffmt -- forward declarations
local uniq = { 'unique identifier' }
local function is_date(t)
-- The system used to make a date read-only means there is no unique
-- metatable that is conveniently accessible to check.
return type(t) == 'table' and t._id == uniq
end
local function is_diff(t)
return type(t) == 'table' and getmetatable(t) == diffmt
end
local function _list_join(list, sep)
return table.concat(list, sep)
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,
join = _list_join,
}
end
local function strip_to_nil(text)
-- If text is a string, return its trimmed content, or nil if empty.
-- Otherwise return text (convenient when Date fields are provided from
-- another module which may pass a string, a number, or another type).
if type(text) == 'string' then
text = text:match('(%S.-)%s*$')
end
return text
end
local function is_leap_year(year, calname)
-- Return true if year is a leap year.
if calname == 'Julian' then
return year % 4 == 0
end
return (year % 4 == 0 and year % 100 ~= 0) or year % 400 == 0
end
local function days_in_month(year, month, calname)
-- Return number of days (1..31) in given month (1..12).
if month == 2 and is_leap_year(year, calname) then
return 29
end
return ({ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 })[month]
end
local function h_m_s(time)
-- Return hour, minute, second extracted from fraction of a day.
time = floor(time * 24 * 3600 + 0.5) -- number of seconds
local second = time % 60
time = floor(time / 60)
return floor(time / 60), time % 60, second
end
local function hms(date)
-- Return fraction of a day from date's time, where (0 <= fraction < 1)
-- if the values are valid, but could be anything if outside range.
return (date.hour + (date.minute + date.second / 60) / 60) / 24
end
local function julian_date(date)
-- Return jd, jdz from a Julian or Gregorian calendar date where
-- jd = Julian date and its fractional part is zero at noon
-- jdz = same, but assume time is 00:00:00 if no time given
-- http://www.tondering.dk/claus/cal/julperiod.php#formula
-- Testing shows this works for all dates from year -9999 to 9999!
-- JDN 0 is the 24-hour period starting at noon UTC on Monday
-- 1 January 4713 BC = (-4712, 1, 1) Julian calendar
-- 24 November 4714 BC = (-4713, 11, 24) Gregorian calendar
local offset
local a = floor((14 - date.month)/12)
local y = date.year + 4800 - a
if date.calendar == 'Julian' then
offset = floor(y/4) - 32083
else
offset = floor(y/4) - floor(y/100) + floor(y/400) - 32045
end
local m = date.month + 12*a - 3
local jd = date.day + floor((153*m + 2)/5) + 365*y + offset
if date.hastime then
jd = jd + hms(date) - 0.5
return jd, jd
end
return jd, jd - 0.5
end
local function set_date_from_jd(date)
-- Set the fields of table date from its Julian date field.
-- Return true if date is valid.
-- http://www.tondering.dk/claus/cal/julperiod.php#formula
-- This handles the proleptic Julian and Gregorian calendars.
-- Negative Julian dates are not defined but they work.
local calname = date.calendar
local low, high -- min/max limits for date ranges −9999-01-01 to 9999-12-31
if calname == 'Gregorian' then
low, high = -1930999.5, 5373484.49999
elseif calname == 'Julian' then
low, high = -1931076.5, 5373557.49999
else
return
end
local jd = date.jd
if not (type(jd) == 'number' and low <= jd and jd <= high) then
return
end
local jdn = floor(jd)
if date.hastime then
local time = jd - jdn -- 0 <= time < 1
if time >= 0.5 then -- if at or after midnight of next day
jdn = jdn + 1
time = time - 0.5
else
time = time + 0.5
end
date.hour, date.minute, date.second = h_m_s(time)
else
date.second = 0
date.minute = 0
date.hour = 0
end
local b, c
if calname == 'Julian' then
b = 0
c = jdn + 32082
else -- Gregorian
local a = jdn + 32044
b = floor((4*a + 3)/146097)
c = a - floor(146097*b/4)
end
local d = floor((4*c + 3)/1461)
local e = c - floor(1461*d/4)
local m = floor((5*e + 2)/153)
date.day = e - floor((153*m + 2)/5) + 1
date.month = m + 3 - 12*floor(m/10)
date.year = 100*b + d - 4800 + floor(m/10)
return true
end
local function fix_numbers(numbers, y, m, d, H, M, S, partial, hastime, calendar)
-- Put the result of normalizing the given values in table numbers.
-- The result will have valid m, d values if y is valid; caller checks y.
-- The logic of PHP mktime is followed where m or d can be zero to mean
-- the previous unit, and -1 is the one before that, etc.
-- Positive values carry forward.
local date
if not (1 <= m and m <= 12) then
date = Date(y, 1, 1)
if not date then return end
date = date + ((m - 1) .. 'm')
y, m = date.year, date.month
end
local days_hms
if not partial then
if hastime and H and M and S then
if not (0 <= H and H <= 23 and
0 <= M and M <= 59 and
0 <= S and S <= 59) then
days_hms = hms({ hour = H, minute = M, second = S })
end
end
if days_hms or not (1 <= d and d <= days_in_month(y, m, calendar)) then
date = date or Date(y, m, 1)
if not date then return end
date = date + (d - 1 + (days_hms or 0))
y, m, d = date.year, date.month, date.day
if days_hms then
H, M, S = date.hour, date.minute, date.second
end
end
end
numbers.year = y
numbers.month = m
numbers.day = d
if days_hms then
-- Don't set H unless it was valid because a valid H will set hastime.
numbers.hour = H
numbers.minute = M
numbers.second = S
end
end
local function set_date_from_numbers(date, numbers, options)
-- Set the fields of table date from numeric values.
-- Return true if date is valid.
if type(numbers) ~= 'table' then
return
end
local y = numbers.year or date.year
local m = numbers.month or date.month
local d = numbers.day or date.day
local H = numbers.hour
local M = numbers.minute or date.minute or 0
local S = numbers.second or date.second or 0
local need_fix
if y and m and d then
date.partial = nil
if not (-9999 <= y and y <= 9999 and
1 <= m and m <= 12 and
1 <= d and d <= days_in_month(y, m, date.calendar)) then
if not date.want_fix then
return
end
need_fix = true
end
elseif y and date.partial then
if d or not (-9999 <= y and y <= 9999) then
return
end
if m and not (1 <= m and m <= 12) then
if not date.want_fix then
return
end
need_fix = true
end
else
return
end
if date.partial then
H = nil -- ignore any time
M = nil
S = nil
else
if H then
-- It is not possible to set M or S without also setting H.
date.hastime = true
else
H = 0
end
if not (0 <= H and H <= 23 and
0 <= M and M <= 59 and
0 <= S and S <= 59) then
if date.want_fix then
need_fix = true
else
return
end
end
end
date.want_fix = nil
if need_fix then
fix_numbers(numbers, y, m, d, H, M, S, date.partial, date.hastime, date.calendar)
return set_date_from_numbers(date, numbers, options)
end
date.year = y -- -9999 to 9999 ('n BC' → year = 1 - n)
date.month = m -- 1 to 12 (may be nil if partial)
date.day = d -- 1 to 31 (* = nil if partial)
date.hour = H -- 0 to 59 (*)
date.minute = M -- 0 to 59 (*)
date.second = S -- 0 to 59 (*)
if type(options) == 'table' then
for _, k in ipairs({ 'am', 'era', 'format' }) do
if options[k] then
date.options[k] = options[k]
end
end
end
return true
end
local function make_option_table(options1, options2)
-- If options1 is a string, return a table with its settings, or
-- if it is a table, use its settings.
-- Missing options are set from table options2 or defaults.
-- If a default is used, a flag is set so caller knows the value was not intentionally set.
-- Valid option settings are:
-- am: 'am', 'a.m.', 'AM', 'A.M.'
-- 'pm', 'p.m.', 'PM', 'P.M.' (each has same meaning as corresponding item above)
-- era: 'BCMINUS', 'BCNEGATIVE', 'BC', 'B.C.', 'BCE', 'B.C.E.', 'AD', 'A.D.', 'CE', 'C.E.'
-- Option am = 'am' does not mean the hour is AM; it means 'am' or 'pm' is used, depending on the hour,
-- and am = 'pm' has the same meaning.
-- Similarly, era = 'BC' means 'BC' is used if year <= 0.
-- BCMINUS displays a MINUS if year < 0 and the display format does not include %{era}.
-- BCNEGATIVE is similar but displays a hyphen.
local result = { bydefault = {} }
if type(options1) == 'table' then
result.am = options1.am
result.era = options1.era
elseif type(options1) == 'string' then
-- Example: 'am:AM era:BC' or 'am=AM era=BC'.
for item in options1:gmatch('%S+') do
local lhs, rhs = item:match('^(%w+)[:=](.+)$')
if lhs then
result[lhs] = rhs
end
end
end
options2 = type(options2) == 'table' and options2 or {}
local defaults = { am = 'am', era = 'BC' }
for k, v in pairs(defaults) do
if not result[k] then
if options2[k] then
result[k] = options2[k]
else
result[k] = v
result.bydefault[k] = true
end
end
end
return result
end
local ampm_options = {
-- lhs = input text accepted as an am/pm option
-- rhs = code used internally
['am'] = 'am',
['AM'] = 'AM',
['a.m.'] = 'a.m.',
['A.M.'] = 'A.M.',
['pm'] = 'am', -- same as am
['PM'] = 'AM',
['p.m.'] = 'a.m.',
['P.M.'] = 'A.M.',
}
local era_text = {
-- Text for displaying an era with a positive year (after adjusting
-- by replacing year with 1 - year if date.year <= 0).
-- options.era = { year<=0 , year>0 }
['BCMINUS'] = { 'BC' , '' , isbc = true, sign = MINUS },
['BCNEGATIVE'] = { 'BC' , '' , isbc = true, sign = '-' },
['BC'] = { 'BC' , '' , isbc = true },
['B.C.'] = { 'B.C.' , '' , isbc = true },
['BCE'] = { 'BCE' , '' , isbc = true },
['B.C.E.'] = { 'B.C.E.', '' , isbc = true },
['AD'] = { 'BC' , 'AD' },
['A.D.'] = { 'B.C.' , 'A.D.' },
['CE'] = { 'BCE' , 'CE' },
['C.E.'] = { 'B.C.E.', 'C.E.' },
}
local function get_era_for_year(era, year)
return (era_text[era] or era_text['BC'])[year > 0 and 2 or 1] or ''
end
local function strftime(date, format, options)
-- Return date formatted as a string using codes similar to those
-- in the C strftime library function.
local sformat = string.format
local shortcuts = {
['%c'] = '%-I:%M %p %-d %B %-Y %{era}', -- date and time: 2:30 pm 1 April 2016
['%x'] = '%-d %B %-Y %{era}', -- date: 1 April 2016
['%X'] = '%-I:%M %p', -- time: 2:30 pm
}
if shortcuts[format] then
format = shortcuts[format]
end
local codes = {
a = { field = 'dayabbr' },
A = { field = 'dayname' },
b = { field = 'monthabbr' },
B = { field = 'monthname' },
u = { fmt = '%d' , field = 'dowiso' },
w = { fmt = '%d' , field = 'dow' },
d = { fmt = '%02d', fmt2 = '%d', field = 'day' },
m = { fmt = '%02d', fmt2 = '%d', field = 'month' },
Y = { fmt = '%04d', fmt2 = '%d', field = 'year' },
H = { fmt = '%02d', fmt2 = '%d', field = 'hour' },
M = { fmt = '%02d', fmt2 = '%d', field = 'minute' },
S = { fmt = '%02d', fmt2 = '%d', field = 'second' },
j = { fmt = '%03d', fmt2 = '%d', field = 'dayofyear' },
I = { fmt = '%02d', fmt2 = '%d', field = 'hour', special = 'hour12' },
p = { field = 'hour', special = 'am' },
}
options = make_option_table(options, date.options)
local amopt = options.am
local eraopt = options.era
local function replace_code(spaces, modifier, id)
local code = codes[id]
if code then
local fmt = code.fmt
if modifier == '-' and code.fmt2 then
fmt = code.fmt2
end
local value = date[code.field]
if not value then
return nil -- an undefined field in a partial date
end
local special = code.special
if special then
if special == 'hour12' then
value = value % 12
value = value == 0 and 12 or value
elseif special == 'am' then
local ap = ({
['a.m.'] = { 'a.m.', 'p.m.' },
['AM'] = { 'AM', 'PM' },
['A.M.'] = { 'A.M.', 'P.M.' },
})[ampm_options[amopt]] or { 'am', 'pm' }
return (spaces == '' and '' or ' ') .. (value < 12 and ap[1] or ap[2])
end
end
if code.field == 'year' then
local sign = (era_text[eraopt] or {}).sign
if not sign or format:find('%{era}', 1, true) then
sign = ''
if value <= 0 then
value = 1 - value
end
else
if value >= 0 then
sign = ''
else
value = -value
end
end
return spaces .. sign .. sformat(fmt, value)
end
return spaces .. (fmt and sformat(fmt, value) or value)
end
end
local function replace_property(spaces, id)
if id == 'era' then
-- Special case so can use local era option.
local result = get_era_for_year(eraopt, date.year)
if result == '' then
return ''
end
return (spaces == '' and '' or ' ') .. result
end
local result = date[id]
if type(result) == 'string' then
return spaces .. result
end
if type(result) == 'number' then
return spaces .. tostring(result)
end
if type(result) == 'boolean' then
return spaces .. (result and '1' or '0')
end
-- This occurs if id is an undefined field in a partial date, or is the name of a function.
return nil
end
local PERCENT = '\127PERCENT\127'
return (format
:gsub('%%%%', PERCENT)
:gsub('(%s*)%%{(%w+)}', replace_property)
:gsub('(%s*)%%(%-?)(%a)', replace_code)
:gsub(PERCENT, '%%')
)
end
local function _date_text(date, fmt, options)
-- Return a formatted string representing the given date.
if not is_date(date) then
error('date:text: need a date (use "date:text()" with a colon)', 2)
end
if type(fmt) == 'string' and fmt:match('%S') then
if fmt:find('%', 1, true) then
return strftime(date, fmt, options)
end
elseif date.partial then
fmt = date.month and 'my' or 'y'
else
fmt = 'dmy'
if date.hastime then
fmt = (date.second > 0 and 'hms ' or 'hm ') .. fmt
end
end
local function bad_format()
-- For consistency with other format processing, return given format
-- (or cleaned format if original was not a string) if invalid.
return mw.text.nowiki(fmt)
end
if date.partial then
-- Ignore days in standard formats like 'ymd'.
if fmt == 'ym' or fmt == 'ymd' then
fmt = date.month and '%Y-%m %{era}' or '%Y %{era}'
elseif fmt == 'my' or fmt == 'dmy' or fmt == 'mdy' then
fmt = date.month and '%B %-Y %{era}' or '%-Y %{era}'
elseif fmt == 'y' then
fmt = date.month and '%-Y %{era}' or '%-Y %{era}'
else
return bad_format()
end
return strftime(date, fmt, options)
end
local function hm_fmt()
local plain = make_option_table(options, date.options).bydefault.am
return plain and '%H:%M' or '%-I:%M %p'
end
local need_time = date.hastime
local t = collection()
for item in fmt:gmatch('%S+') do
local f
if item == 'hm' then
f = hm_fmt()
need_time = false
elseif item == 'hms' then
f = '%H:%M:%S'
need_time = false
elseif item == 'ymd' then
f = '%Y-%m-%d %{era}'
elseif item == 'mdy' then
f = '%B %-d, %-Y %{era}'
elseif item == 'dmy' then
f = '%-d %B %-Y %{era}'
else
return bad_format()
end
t:add(f)
end
fmt = t:join(' ')
if need_time then
fmt = hm_fmt() .. ' ' .. fmt
end
return strftime(date, fmt, options)
end
local day_info = {
-- 0=Sun to 6=Sat
[0] = { 'Sun', 'Sunday' },
{ 'Mon', 'Monday' },
{ 'Tue', 'Tuesday' },
{ 'Wed', 'Wednesday' },
{ 'Thu', 'Thursday' },
{ 'Fri', 'Friday' },
{ 'Sat', 'Saturday' },
}
local month_info = {
-- 1=Jan to 12=Dec
{ 'Jan', 'January' },
{ 'Feb', 'February' },
{ 'Mar', 'March' },
{ 'Apr', 'April' },
{ 'May', 'May' },
{ 'Jun', 'June' },
{ 'Jul', 'July' },
{ 'Aug', 'August' },
{ 'Sep', 'September' },
{ 'Oct', 'October' },
{ 'Nov', 'November' },
{ 'Dec', 'December' },
}
local function name_to_number(text, translate)
if type(text) == 'string' then
return translate[text:lower()]
end
end
local function day_number(text)
return name_to_number(text, {
sun = 0, sunday = 0,
mon = 1, monday = 1,
tue = 2, tuesday = 2,
wed = 3, wednesday = 3,
thu = 4, thursday = 4,
fri = 5, friday = 5,
sat = 6, saturday = 6,
})
end
local function month_number(text)
return name_to_number(text, {
jan = 1, january = 1,
feb = 2, february = 2,
mar = 3, march = 3,
apr = 4, april = 4,
may = 5,
jun = 6, june = 6,
jul = 7, july = 7,
aug = 8, august = 8,
sep = 9, september = 9, sept = 9,
oct = 10, october = 10,
nov = 11, november = 11,
dec = 12, december = 12,
})
end
local function _list_text(list, fmt)
-- Return a list of formatted strings from a list of dates.
if not type(list) == 'table' then
error('date:list:text: need "list:text()" with a colon', 2)
end
local result = { join = _list_join }
for i, date in ipairs(list) do
result[i] = date:text(fmt)
end
return result
end
local function _date_list(date, spec)
-- Return a possibly empty numbered table of dates meeting the specification.
-- Dates in the list are in ascending order (oldest date first).
-- The spec should be a string of form "<count> <day> <op>"
-- where each item is optional and
-- count = number of items wanted in list
-- day = abbreviation or name such as Mon or Monday
-- op = >, >=, <, <= (default is > meaning after date)
-- If no count is given, the list is for the specified days in date's month.
-- The default day is date's day.
-- The spec can also be a positive or negative number:
-- -5 is equivalent to '5 <'
-- 5 is equivalent to '5' which is '5 >'
if not is_date(date) then
error('date:list: need a date (use "date:list()" with a colon)', 2)
end
local list = { text = _list_text }
if date.partial then
return list
end
local count, offset, operation
local ops = {
['>='] = { before = false, include = true },
['>'] = { before = false, include = false },
['<='] = { before = true , include = true },
['<'] = { before = true , include = false },
}
if spec then
if type(spec) == 'number' then
count = floor(spec + 0.5)
if count < 0 then
count = -count
operation = ops['<']
end
elseif type(spec) == 'string' then
local num, day, op = spec:match('^%s*(%d*)%s*(%a*)%s*([<>=]*)%s*$')
if not num then
return list
end
if num ~= '' then
count = tonumber(num)
end
if day ~= '' then
local dow = day_number(day:gsub('[sS]$', '')) -- accept plural days
if not dow then
return list
end
offset = dow - date.dow
end
operation = ops[op]
else
return list
end
end
offset = offset or 0
operation = operation or ops['>']
local datefrom, dayfirst, daylast
if operation.before then
if offset > 0 or (offset == 0 and not operation.include) then
offset = offset - 7
end
if count then
if count > 1 then
offset = offset - 7*(count - 1)
end
datefrom = date + offset
else
daylast = date.day + offset
dayfirst = daylast % 7
if dayfirst == 0 then
dayfirst = 7
end
end
else
if offset < 0 or (offset == 0 and not operation.include) then
offset = offset + 7
end
if count then
datefrom = date + offset
else
dayfirst = date.day + offset
daylast = date.monthdays
end
end
if not count then
if daylast < dayfirst then
return list
end
count = floor((daylast - dayfirst)/7) + 1
datefrom = Date(date, {day = dayfirst})
end
for i = 1, count do
if not datefrom then break end -- exceeds date limits
list[i] = datefrom
datefrom = datefrom + 7
end
return list
end
-- A table to get the current date/time (UTC), but only if needed.
local current = setmetatable({}, {
__index = function (self, key)
local d = os.date('!*t')
self.year = d.year
self.month = d.month
self.day = d.day
self.hour = d.hour
self.minute = d.min
self.second = d.sec
return rawget(self, key)
end })
local function extract_date(newdate, text)
-- Parse the date/time in text and return n, o where
-- n = table of numbers with date/time fields
-- o = table of options for AM/PM or AD/BC or format, if any
-- or return nothing if date is known to be invalid.
-- Caller determines if the values in n are valid.
-- A year must be positive ('1' to '9999'); use 'BC' for BC.
-- In a y-m-d string, the year must be four digits to avoid ambiguity
-- ('0001' to '9999'). The only way to enter year <= 0 is by specifying
-- the date as three numeric parameters like ymd Date(-1, 1, 1).
-- Dates of form d/m/y, m/d/y, y/m/d are rejected as potentially ambiguous.
local date, options = {}, {}
if text:sub(-1) == 'Z' then
-- Extract date/time from a Wikidata timestamp.
-- The year can be 1 to 16 digits but this module handles 1 to 4 digits only.
-- Examples: '+2016-06-21T14:30:00Z', '-0000000180-00-00T00:00:00Z'.
local sign, y, m, d, H, M, S = text:match('^([+%-])(%d+)%-(%d%d)%-(%d%d)T(%d%d):(%d%d):(%d%d)Z$')
if sign then
y = tonumber(y)
if sign == '-' and y > 0 then
y = -y
end
if y <= 0 then
options.era = 'BCE'
end
date.year = y
m = tonumber(m)
d = tonumber(d)
H = tonumber(H)
M = tonumber(M)
S = tonumber(S)
if m == 0 then
newdate.partial = true
return date, options
end
date.month = m
if d == 0 then
newdate.partial = true
return date, options
end
date.day = d
if H > 0 or M > 0 or S > 0 then
date.hour = H
date.minute = M
date.second = S
end
return date, options
end
return
end
local function extract_ymd(item)
-- Called when no day or month has been set.
local y, m, d = item:match('^(%d%d%d%d)%-(%w+)%-(%d%d?)$')
if y then
if date.year then
return
end
if m:match('^%d%d?$') then
m = tonumber(m)
else
m = month_number(m)
end
if m then
date.year = tonumber(y)
date.month = m
date.day = tonumber(d)
return true
end
end
end
local function extract_day_or_year(item)
-- Called when a day would be valid, or
-- when a year would be valid if no year has been set and partial is set.
local number, suffix = item:match('^(%d%d?%d?%d?)(.*)$')
if number then
local n = tonumber(number)
if #number <= 2 and n <= 31 then
suffix = suffix:lower()
if suffix == '' or suffix == 'st' or suffix == 'nd' or suffix == 'rd' or suffix == 'th' then
date.day = n
return true
end
elseif suffix == '' and newdate.partial and not date.year then
date.year = n
return true
end
end
end
local function extract_month(item)
-- A month must be given as a name or abbreviation; a number could be ambiguous.
local m = month_number(item)
if m then
date.month = m
return true
end
end
local function extract_time(item)
local h, m, s = item:match('^(%d%d?):(%d%d)(:?%d*)$')
if date.hour or not h then
return
end
if s ~= '' then
s = s:match('^:(%d%d)$')
if not s then
return
end
end
date.hour = tonumber(h)
date.minute = tonumber(m)
date.second = tonumber(s) -- nil if empty string
return true
end
local item_count = 0
local index_time
local function set_ampm(item)
local H = date.hour
if H and not options.am and index_time + 1 == item_count then
options.am = ampm_options[item] -- caller checked this is not nil
if item:match('^[Aa]') then
if not (1 <= H and H <= 12) then
return
end
if H == 12 then
date.hour = 0
end
else
if not (1 <= H and H <= 23) then
return
end
if H <= 11 then
date.hour = H + 12
end
end
return true
end
end
for item in text:gsub(',', ' '):gsub(' ', ' '):gmatch('%S+') do
item_count = item_count + 1
if era_text[item] then
-- Era is accepted in peculiar places.
if options.era then
return
end
options.era = item
elseif ampm_options[item] then
if not set_ampm(item) then
return
end
elseif item:find(':', 1, true) then
if not extract_time(item) then
return
end
index_time = item_count
elseif date.day and date.month then
if date.year then
return -- should be nothing more so item is invalid
end
if not item:match('^(%d%d?%d?%d?)$') then
return
end
date.year = tonumber(item)
elseif date.day then
if not extract_month(item) then
return
end
elseif date.month then
if not extract_day_or_year(item) then
return
end
elseif extract_month(item) then
options.format = 'mdy'
elseif extract_ymd(item) then
options.format = 'ymd'
elseif extract_day_or_year(item) then
if date.day then
options.format = 'dmy'
end
else
return
end
end
if not date.year or date.year == 0 then
return
end
local era = era_text[options.era]
if era and era.isbc then
date.year = 1 - date.year
end
return date, options
end
local function autofill(date1, date2)
-- Fill any missing month or day in each date using the
-- corresponding component from the other date, if present,
-- or with 1 if both dates are missing the month or day.
-- This gives a good result for calculating the difference
-- between two partial dates when no range is wanted.
-- Return filled date1, date2 (two full dates).
local function filled(a, b)
-- Return date a filled, if necessary, with month and/or day from date b.
-- The filled day is truncated to fit the number of days in the month.
local fillmonth, fillday
if not a.month then
fillmonth = b.month or 1
end
if not a.day then
fillday = b.day or 1
end
if fillmonth or fillday then -- need to create a new date
a = Date(a, {
month = fillmonth,
day = math.min(fillday or a.day, days_in_month(a.year, fillmonth or a.month, a.calendar))
})
end
return a
end
return filled(date1, date2), filled(date2, date1)
end
local function date_add_sub(lhs, rhs, is_sub)
-- Return a new date from calculating (lhs + rhs) or (lhs - rhs),
-- or return nothing if invalid.
-- The result is nil if the calculated date exceeds allowable limits.
-- Caller ensures that lhs is a date; its properties are copied for the new date.
if lhs.partial then
-- Adding to a partial is not supported.
-- Can subtract a date or partial from a partial, but this is not called for that.
return
end
local function is_prefix(text, word, minlen)
local n = #text
return (minlen or 1) <= n and n <= #word and text == word:sub(1, n)
end
local function do_days(n)
local forcetime, jd
if floor(n) == n then
jd = lhs.jd
else
forcetime = not lhs.hastime
jd = lhs.jdz
end
jd = jd + (is_sub and -n or n)
if forcetime then
jd = tostring(jd)
if not jd:find('.', 1, true) then
jd = jd .. '.0'
end
end
return Date(lhs, 'juliandate', jd)
end
if type(rhs) == 'number' then
-- Add/subtract days, including fractional days.
return do_days(rhs)
end
if type(rhs) == 'string' then
-- rhs is a single component like '26m' or '26 months' (with optional sign).
-- Fractions like '3.25d' are accepted for the units which are handled as days.
local sign, numstr, id = rhs:match('^%s*([+-]?)([%d%.]+)%s*(%a+)$')
if sign then
if sign == '-' then
is_sub = not (is_sub and true or false)
end
local y, m, days
local num = tonumber(numstr)
if not num then
return
end
id = id:lower()
if is_prefix(id, 'years') then
y = num
m = 0
elseif is_prefix(id, 'months') then
y = floor(num / 12)
m = num % 12
elseif is_prefix(id, 'weeks') then
days = num * 7
elseif is_prefix(id, 'days') then
days = num
elseif is_prefix(id, 'hours') then
days = num / 24
elseif is_prefix(id, 'minutes', 3) then
days = num / (24 * 60)
elseif is_prefix(id, 'seconds') then
days = num / (24 * 3600)
else
return
end
if days then
return do_days(days)
end
if numstr:find('.', 1, true) then
return
end
if is_sub then
y = -y
m = -m
end
assert(-11 <= m and m <= 11)
y = lhs.year + y
m = lhs.month + m
if m > 12 then
y = y + 1
m = m - 12
elseif m < 1 then
y = y - 1
m = m + 12
end
local d = math.min(lhs.day, days_in_month(y, m, lhs.calendar))
return Date(lhs, y, m, d)
end
end
if is_diff(rhs) then
local days = rhs.age_days
if (is_sub or false) ~= (rhs.isnegative or false) then
days = -days
end
return lhs + days
end
end
local full_date_only = {
dayabbr = true,
dayname = true,
dow = true,
dayofweek = true,
dowiso = true,
dayofweekiso = true,
dayofyear = true,
gsd = true,
juliandate = true,
jd = true,
jdz = true,
jdnoon = true,
}
-- Metatable for a date's calculated fields.
local datemt = {
__index = function (self, key)
if rawget(self, 'partial') then
if full_date_only[key] then return end
if key == 'monthabbr' or key == 'monthdays' or key == 'monthname' then
if not self.month then return end
end
end
local value
if key == 'dayabbr' then
value = day_info[self.dow][1]
elseif key == 'dayname' then
value = day_info[self.dow][2]
elseif key == 'dow' then
value = (self.jdnoon + 1) % 7 -- day-of-week 0=Sun to 6=Sat
elseif key == 'dayofweek' then
value = self.dow
elseif key == 'dowiso' then
value = (self.jdnoon % 7) + 1 -- ISO day-of-week 1=Mon to 7=Sun
elseif key == 'dayofweekiso' then
value = self.dowiso
elseif key == 'dayofyear' then
local first = Date(self.year, 1, 1, self.calendar).jdnoon
value = self.jdnoon - first + 1 -- day-of-year 1 to 366
elseif key == 'era' then
-- Era text (never a negative sign) from year and options.
value = get_era_for_year(self.options.era, self.year)
elseif key == 'format' then
value = self.options.format or 'dmy'
elseif key == 'gsd' then
-- GSD = 1 from 00:00:00 to 23:59:59 on 1 January 1 AD Gregorian calendar,
-- which is from jd 1721425.5 to 1721426.49999.
value = floor(self.jd - 1721424.5)
elseif key == 'juliandate' or key == 'jd' or key == 'jdz' then
local jd, jdz = julian_date(self)
rawset(self, 'juliandate', jd)
rawset(self, 'jd', jd)
rawset(self, 'jdz', jdz)
return key == 'jdz' and jdz or jd
elseif key == 'jdnoon' then
-- Julian date at noon (an integer) on the calendar day when jd occurs.
value = floor(self.jd + 0.5)
elseif key == 'isleapyear' then
value = is_leap_year(self.year, self.calendar)
elseif key == 'monthabbr' then
value = month_info[self.month][1]
elseif key == 'monthdays' then
value = days_in_month(self.year, self.month, self.calendar)
elseif key == 'monthname' then
value = month_info[self.month][2]
end
if value ~= nil then
rawset(self, key, value)
return value
end
end,
}
-- Date operators.
local function mt_date_add(lhs, rhs)
if not is_date(lhs) then
lhs, rhs = rhs, lhs -- put date on left (it must be a date for this to have been called)
end
return date_add_sub(lhs, rhs)
end
local function mt_date_sub(lhs, rhs)
if is_date(lhs) then
if is_date(rhs) then
return DateDiff(lhs, rhs)
end
return date_add_sub(lhs, rhs, true)
end
end
local function mt_date_concat(lhs, rhs)
return tostring(lhs) .. tostring(rhs)
end
local function mt_date_tostring(self)
return self:text()
end
local function mt_date_eq(lhs, rhs)
-- Return true if dates identify same date/time where, for example,
-- Date(-4712, 1, 1, 'Julian') == Date(-4713, 11, 24, 'Gregorian') is true.
-- This is called only if lhs and rhs have the same type and the same metamethod.
if lhs.partial or rhs.partial then
-- One date is partial; the other is a partial or a full date.
-- The months may both be nil, but must be the same.
return lhs.year == rhs.year and lhs.month == rhs.month and lhs.calendar == rhs.calendar
end
return lhs.jdz == rhs.jdz
end
local function mt_date_lt(lhs, rhs)
-- Return true if lhs < rhs, for example,
-- Date('1 Jan 2016') < Date('06:00 1 Jan 2016') is true.
-- This is called only if lhs and rhs have the same type and the same metamethod.
if lhs.partial or rhs.partial then
-- One date is partial; the other is a partial or a full date.
if lhs.calendar ~= rhs.calendar then
return lhs.calendar == 'Julian'
end
if lhs.partial then
lhs = lhs.partial.first
end
if rhs.partial then
rhs = rhs.partial.first
end
end
return lhs.jdz < rhs.jdz
end
--[[ Examples of syntax to construct a date:
Date(y, m, d, 'julian') default calendar is 'gregorian'
Date(y, m, d, H, M, S, 'julian')
Date('juliandate', jd, 'julian') if jd contains "." text output includes H:M:S
Date('currentdate')
Date('currentdatetime')
Date('1 April 1995', 'julian') parse date from text
Date('1 April 1995 AD', 'julian') using an era sets a flag to do the same for output
Date('04:30:59 1 April 1995', 'julian')
Date(date) copy of an existing date
Date(date, t) same, updated with y,m,d,H,M,S fields from table t
Date(t) date with y,m,d,H,M,S fields from table t
]]
function Date(...) -- for forward declaration above
-- Return a table holding a date assuming a uniform calendar always applies
-- (proleptic Gregorian calendar or proleptic Julian calendar), or
-- return nothing if date is invalid.
-- A partial date has a valid year, however its month may be nil, and
-- its day and time fields are nil.
-- Field partial is set to false (if a full date) or a table (if a partial date).
local calendars = { julian = 'Julian', gregorian = 'Gregorian' }
local newdate = {
_id = uniq,
calendar = 'Gregorian', -- default is Gregorian calendar
hastime = false, -- true if input sets a time
hour = 0, -- always set hour/minute/second so don't have to handle nil
minute = 0,
second = 0,
options = {},
list = _date_list,
subtract = function (self, rhs, options)
return DateDiff(self, rhs, options)
end,
text = _date_text,
}
local argtype, datetext, is_copy, jd_number, tnums
local numindex = 0
local numfields = { 'year', 'month', 'day', 'hour', 'minute', 'second' }
local numbers = {}
for _, v in ipairs({...}) do
v = strip_to_nil(v)
local vlower = type(v) == 'string' and v:lower() or nil
if v == nil then
-- Ignore empty arguments after stripping so modules can directly pass template parameters.
elseif calendars[vlower] then
newdate.calendar = calendars[vlower]
elseif vlower == 'partial' then
newdate.partial = true
elseif vlower == 'fix' then
newdate.want_fix = true
elseif is_date(v) then
-- Copy existing date (items can be overridden by other arguments).
if is_copy or tnums then
return
end
is_copy = true
newdate.calendar = v.calendar
newdate.partial = v.partial
newdate.hastime = v.hastime
newdate.options = v.options
newdate.year = v.year
newdate.month = v.month
newdate.day = v.day
newdate.hour = v.hour
newdate.minute = v.minute
newdate.second = v.second
elseif type(v) == 'table' then
if tnums then
return
end
tnums = {}
local tfields = { year=1, month=1, day=1, hour=2, minute=2, second=2 }
for tk, tv in pairs(v) do
if tfields[tk] then
tnums[tk] = tonumber(tv)
end
if tfields[tk] == 2 then
newdate.hastime = true
end
end
else
local num = tonumber(v)
if not num and argtype == 'setdate' and numindex == 1 then
num = month_number(v)
end
if num then
if not argtype then
argtype = 'setdate'
end
if argtype == 'setdate' and numindex < 6 then
numindex = numindex + 1
numbers[numfields[numindex]] = num
elseif argtype == 'juliandate' and not jd_number then
jd_number = num
if type(v) == 'string' then
if v:find('.', 1, true) then
newdate.hastime = true
end
elseif num ~= floor(num) then
-- The given value was a number. The time will be used
-- if the fractional part is nonzero.
newdate.hastime = true
end
else
return
end
elseif argtype then
return
elseif type(v) == 'string' then
if v == 'currentdate' or v == 'currentdatetime' or v == 'juliandate' then
argtype = v
else
argtype = 'datetext'
datetext = v
end
else
return
end
end
end
if argtype == 'datetext' then
if tnums or not set_date_from_numbers(newdate, extract_date(newdate, datetext)) then
return
end
elseif argtype == 'juliandate' then
newdate.partial = nil
newdate.jd = jd_number
if not set_date_from_jd(newdate) then
return
end
elseif argtype == 'currentdate' or argtype == 'currentdatetime' then
newdate.partial = nil
newdate.year = current.year
newdate.month = current.month
newdate.day = current.day
if argtype == 'currentdatetime' then
newdate.hour = current.hour
newdate.minute = current.minute
newdate.second = current.second
newdate.hastime = true
end
newdate.calendar = 'Gregorian' -- ignore any given calendar name
elseif argtype == 'setdate' then
if tnums or not set_date_from_numbers(newdate, numbers) then
return
end
elseif not (is_copy or tnums) then
return
end
if tnums then
newdate.jd = nil -- force recalculation in case jd was set before changes from tnums
if not set_date_from_numbers(newdate, tnums) then
return
end
end
if newdate.partial then
local year = newdate.year
local month = newdate.month
local first = Date(year, month or 1, 1, newdate.calendar)
month = month or 12
local last = Date(year, month, days_in_month(year, month), newdate.calendar)
newdate.partial = { first = first, last = last }
else
newdate.partial = false -- avoid index lookup
end
setmetatable(newdate, datemt)
local readonly = {}
local mt = {
__index = newdate,
__newindex = function(t, k, v) error('date.' .. tostring(k) .. ' is read-only', 2) end,
__add = mt_date_add,
__sub = mt_date_sub,
__concat = mt_date_concat,
__tostring = mt_date_tostring,
__eq = mt_date_eq,
__lt = mt_date_lt,
}
return setmetatable(readonly, mt)
end
local function _diff_age(diff, code, options)
-- Return a tuple of integer values from diff as specified by code, except that
-- each integer may be a list of two integers for a diff with a partial date, or
-- return nil if the code is not supported.
-- If want round, the least significant unit is rounded to nearest whole unit.
-- For a duration, an extra day is added.
local wantround, wantduration, wantrange
if type(options) == 'table' then
wantround = options.round
wantduration = options.duration
wantrange = options.range
else
wantround = options
end
if not is_diff(diff) then
local f = wantduration and 'duration' or 'age'
error(f .. ': need a date difference (use "diff:' .. f .. '()" with a colon)', 2)
end
if diff.partial then
-- Ignore wantround, wantduration.
local function choose(v)
if type(v) == 'table' then
if not wantrange or v[1] == v[2] then
-- Example: Date('partial', 2005) - Date('partial', 2001) gives
-- diff.years = { 3, 4 } to show the range of possible results.
-- If do not want a range, choose the second value as more expected.
return v[2]
end
end
return v
end
if code == 'ym' or code == 'ymd' then
if not wantrange and diff.iszero then
-- This avoids an unexpected result such as
-- Date('partial', 2001) - Date('partial', 2001)
-- giving diff = { years = 0, months = { 0, 11 } }
-- which would be reported as 0 years and 11 months.
return 0, 0
end
return choose(diff.partial.years), choose(diff.partial.months)
end
if code == 'y' then
return choose(diff.partial.years)
end
if code == 'm' or code == 'w' or code == 'd' then
return choose({ diff.partial.mindiff:age(code), diff.partial.maxdiff:age(code) })
end
return nil
end
local extra_days = wantduration and 1 or 0
if code == 'wd' or code == 'w' or code == 'd' then
local offset = wantround and 0.5 or 0
local days = diff.age_days + extra_days
if code == 'wd' or code == 'd' then
days = floor(days + offset)
if code == 'd' then
return days
end
return floor(days/7), days % 7
end
return floor(days/7 + offset)
end
local H, M, S = diff.hours, diff.minutes, diff.seconds
if code == 'dh' or code == 'dhm' or code == 'dhms' or code == 'h' or code == 'hm' or code == 'hms' or code == 'M' or code == 's' then
local days = floor(diff.age_days + extra_days)
local inc_hour
if wantround then
if code == 'dh' or code == 'h' then
if M >= 30 then
inc_hour = true
end
elseif code == 'dhm' or code == 'hm' then
if S >= 30 then
M = M + 1
if M >= 60 then
M = 0
inc_hour = true
end
end
elseif code == 'M' then
if S >= 30 then
M = M + 1
end
else
-- Nothing needed because S is an integer.
end
if inc_hour then
H = H + 1
if H >= 24 then
H = 0
days = days + 1
end
end
end
if code == 'dh' or code == 'dhm' or code == 'dhms' then
if code == 'dh' then
return days, H
elseif code == 'dhm' then
return days, H, M
else
return days, H, M, S
end
end
local hours = days * 24 + H
if code == 'h' then
return hours
elseif code == 'hm' then
return hours, M
elseif code == 'M' or code == 's' then
M = hours * 60 + M
if code == 'M' then
return M
end
return M * 60 + S
end
return hours, M, S
end
if wantround then
local inc_hour
if code == 'ymdh' or code == 'ymwdh' then
if M >= 30 then
inc_hour = true
end
elseif code == 'ymdhm' or code == 'ymwdhm' then
if S >= 30 then
M = M + 1
if M >= 60 then
M = 0
inc_hour = true
end
end
elseif code == 'ymd' or code == 'ymwd' or code == 'yd' or code == 'md' then
if H >= 12 then
extra_days = extra_days + 1
end
end
if inc_hour then
H = H + 1
if H >= 24 then
H = 0
extra_days = extra_days + 1
end
end
end
local y, m, d = diff.years, diff.months, diff.days
if extra_days > 0 then
d = d + extra_days
if d > 28 or code == 'yd' then
-- Recalculate in case have passed a month.
diff = diff.date1 + extra_days - diff.date2
y, m, d = diff.years, diff.months, diff.days
end
end
if code == 'ymd' then
return y, m, d
elseif code == 'yd' then
if y > 0 then
-- It is known that diff.date1 > diff.date2.
diff = diff.date1 - (diff.date2 + (y .. 'y'))
end
return y, floor(diff.age_days)
elseif code == 'md' then
return y * 12 + m, d
elseif code == 'ym' or code == 'm' then
if wantround then
if d >= 16 then
m = m + 1
if m >= 12 then
m = 0
y = y + 1
end
end
end
if code == 'ym' then
return y, m
end
return y * 12 + m
elseif code == 'ymw' then
local weeks = floor(d/7)
if wantround then
local days = d % 7
if days > 3 or (days == 3 and H >= 12) then
weeks = weeks + 1
end
end
return y, m, weeks
elseif code == 'ymwd' then
return y, m, floor(d/7), d % 7
elseif code == 'ymdh' then
return y, m, d, H
elseif code == 'ymwdh' then
return y, m, floor(d/7), d % 7, H
elseif code == 'ymdhm' then
return y, m, d, H, M
elseif code == 'ymwdhm' then
return y, m, floor(d/7), d % 7, H, M
end
if code == 'y' then
if wantround and m >= 6 then
y = y + 1
end
return y
end
return nil
end
local function _diff_duration(diff, code, options)
if type(options) ~= 'table' then
options = { round = options }
end
options.duration = true
return _diff_age(diff, code, options)
end
-- Metatable for some operations on date differences.
diffmt = { -- for forward declaration above
__concat = function (lhs, rhs)
return tostring(lhs) .. tostring(rhs)
end,
__tostring = function (self)
return tostring(self.age_days)
end,
__index = function (self, key)
local value
if key == 'age_days' then
if rawget(self, 'partial') then
local function jdz(date)
return (date.partial and date.partial.first or date).jdz
end
value = jdz(self.date1) - jdz(self.date2)
else
value = self.date1.jdz - self.date2.jdz
end
end
if value ~= nil then
rawset(self, key, value)
return value
end
end,
}
function DateDiff(date1, date2, options) -- for forward declaration above
-- Return a table with the difference between two dates (date1 - date2).
-- The difference is negative if date1 is older than date2.
-- Return nothing if invalid.
-- If d = date1 - date2 then
-- date1 = date2 + d
-- If date1 >= date2 and the dates have no H:M:S time specified then
-- date1 = date2 + (d.years..'y') + (d.months..'m') + d.days
-- where the larger time units are added first.
-- The result of Date(2015,1,x) + '1m' is Date(2015,2,28) for
-- x = 28, 29, 30, 31. That means, for example,
-- d = Date(2015,3,3) - Date(2015,1,31)
-- gives d.years, d.months, d.days = 0, 1, 3 (excluding date1).
if not (is_date(date1) and is_date(date2) and date1.calendar == date2.calendar) then
return
end
local wantfill
if type(options) == 'table' then
wantfill = options.fill
end
local isnegative = false
local iszero = false
if date1 < date2 then
isnegative = true
date1, date2 = date2, date1
elseif date1 == date2 then
iszero = true
end
-- It is known that date1 >= date2 (period is from date2 to date1).
if date1.partial or date2.partial then
-- Two partial dates might have timelines:
---------------------A=================B--- date1 is from A to B inclusive
--------C=======D-------------------------- date2 is from C to D inclusive
-- date1 > date2 iff A > C (date1.partial.first > date2.partial.first)
-- The periods can overlap ('April 2001' - '2001'):
-------------A===B------------------------- A=2001-04-01 B=2001-04-30
--------C=====================D------------ C=2001-01-01 D=2001-12-31
if wantfill then
date1, date2 = autofill(date1, date2)
else
local function zdiff(date1, date2)
local diff = date1 - date2
if diff.isnegative then
return date1 - date1 -- a valid diff in case we call its methods
end
return diff
end
local function getdate(date, which)
return date.partial and date.partial[which] or date
end
local maxdiff = zdiff(getdate(date1, 'last'), getdate(date2, 'first'))
local mindiff = zdiff(getdate(date1, 'first'), getdate(date2, 'last'))
local years, months
if maxdiff.years == mindiff.years then
years = maxdiff.years
if maxdiff.months == mindiff.months then
months = maxdiff.months
else
months = { mindiff.months, maxdiff.months }
end
else
years = { mindiff.years, maxdiff.years }
end
return setmetatable({
date1 = date1,
date2 = date2,
partial = {
years = years,
months = months,
maxdiff = maxdiff,
mindiff = mindiff,
},
isnegative = isnegative,
iszero = iszero,
age = _diff_age,
duration = _diff_duration,
}, diffmt)
end
end
local y1, m1 = date1.year, date1.month
local y2, m2 = date2.year, date2.month
local years = y1 - y2
local months = m1 - m2
local d1 = date1.day + hms(date1)
local d2 = date2.day + hms(date2)
local days, time
if d1 >= d2 then
days = d1 - d2
else
months = months - 1
-- Get days in previous month (before the "to" date) given December has 31 days.
local dpm = m1 > 1 and days_in_month(y1, m1 - 1, date1.calendar) or 31
if d2 >= dpm then
days = d1 - hms(date2)
else
days = dpm - d2 + d1
end
end
if months < 0 then
years = years - 1
months = months + 12
end
days, time = math.modf(days)
local H, M, S = h_m_s(time)
return setmetatable({
date1 = date1,
date2 = date2,
partial = false, -- avoid index lookup
years = years,
months = months,
days = days,
hours = H,
minutes = M,
seconds = S,
isnegative = isnegative,
iszero = iszero,
age = _diff_age,
duration = _diff_duration,
}, diffmt)
end
return {
_current = current,
_Date = Date,
_days_in_month = days_in_month,
}
8htfjg7cmqlbgysia559pe52c5tetp5
Module:Delink
828
38999128
1047355927
1045115757
2021-09-30T12:36:18Z
Gonnym
14984434
synced from sandbox: consistent spacing; cleaner code - if not (x == y) -> if x ~= y, etc; fix for question mark - can now delink [[What If...?]] style titles.
Scribunto
text/plain
-- This module de-links most wikitext.
require("Module:No globals")
local p = {}
local getArgs
local function delinkReversePipeTrick(s)
if s:match("^%[%[|.*[|\n]") then -- Check for newlines or multiple pipes.
return s
end
return s:match("%[%[|(.*)%]%]")
end
local function delinkPipeTrick(s)
-- We need to deal with colons, brackets, and commas, per [[Help:Pipe trick]].
-- First, remove the text before the first colon, if any.
if s:match(":") then
s = s:match("%[%[.-:(.*)|%]%]")
-- If there are no colons, grab all of the text apart from the square brackets and the pipe.
else
s = s:match("%[%[(.*)|%]%]")
end
-- Next up, brackets and commas.
if s:match("%(.-%)$") then -- Brackets trump commas.
s = s:match("(.-) ?%(.-%)$")
elseif s:match(",") then -- If there are no brackets, display only the text before the first comma.
s = s:match("(.-),.*$")
end
return s
end
-- Return wikilink target |wikilinks=target
local function getDelinkedTarget(s)
local result = s
-- Deal with the reverse pipe trick.
if result:match("%[%[|") then
return delinkReversePipeTrick(result)
end
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local target_area
if result:match("|") then -- Find if we're dealing with a piped link.
target_area = result:match("^%[%[(.-)|.*%]%]")
else
target_area = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") and mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") ~= "?" then
return s
end
return target_area
end
local function getDelinkedLabel(s)
local result = s
-- Deal with the reverse pipe trick.
if result:match("%[%[|") then
return delinkReversePipeTrick(result)
end
result = mw.uri.decode(result, "PATH") -- decode percent-encoded entities. Leave underscores and plus signs.
result = mw.text.decode(result, true) -- decode HTML entities.
-- Check for bad titles. To do this we need to find the
-- title area of the link, i.e. the part before any pipes.
local target_area
if result:match("|") then -- Find if we're dealing with a piped link.
target_area = result:match("^%[%[(.-)|.*%]%]")
else
target_area = result:match("^%[%[(.-)%]%]")
end
-- Check for bad characters.
if mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") and mw.ustring.match(target_area, "[%[%]<>{}%%%c\n]") ~= "?" then
return s
end
-- Check for categories, interwikis, and files.
local colon_prefix = result:match("%[%[(.-):.*%]%]") or "" -- Get the text before the first colon.
local ns = mw.site.namespaces[colon_prefix] -- see if this is a known namespace
if mw.language.isKnownLanguageTag(colon_prefix) or (ns and (ns.canonicalName == "File" or ns.canonicalName == "Category")) then
return ""
end
-- Remove the colon if the link is using the [[Help:Colon trick]].
if result:match("%[%[:") then
result = "[[" .. result:match("%[%[:(.*%]%])")
end
-- Deal with links using the [[Help:Pipe trick]].
if mw.ustring.match(result, "^%[%[[^|]*|%]%]") then
return delinkPipeTrick(result)
end
-- Find the display area of the wikilink
if result:match("|") then -- Find if we're dealing with a piped link.
result = result:match("^%[%[.-|(.+)%]%]")
-- Remove new lines from the display of multiline piped links,
-- where the pipe is before the first new line.
result = result:gsub("\n", "")
else
result = result:match("^%[%[(.-)%]%]")
end
return result
end
local function delinkURL(s)
-- Assume we have already delinked internal wikilinks, and that
-- we have been passed some text between two square brackets [foo].
-- If the text contains a line break it is not formatted as a URL, regardless of other content.
if s:match("\n") then
return s
end
-- Check if the text has a valid URL prefix and at least one valid URL character.
local valid_url_prefixes = {"//", "http://", "https://", "ftp://", "gopher://", "mailto:", "news:", "irc://"}
local url_prefix
for _ ,v in ipairs(valid_url_prefixes) do
if mw.ustring.match(s, '^%[' .. v ..'[^"%s].*%]' ) then
url_prefix = v
break
end
end
-- Get display text
if not url_prefix then
return s
end
s = s:match("^%[" .. url_prefix .. "(.*)%]") -- Grab all of the text after the URL prefix and before the final square bracket.
s = s:match('^.-(["<> ].*)') or "" -- Grab all of the text after the first URL separator character ("<> ).
s = mw.ustring.match(s, "^%s*(%S.*)$") or "" -- If the separating character was a space, trim it off.
local s_decoded = mw.text.decode(s, true)
if mw.ustring.match(s_decoded, "%c") then
return s
end
return s_decoded
end
local function delinkLinkClass(text, pattern, delinkFunction)
if type(text) ~= "string" then
error("Attempt to de-link non-string input.", 2)
end
if type(pattern) ~= "string" or mw.ustring.sub(pattern, 1, 1) ~= "^" then
error('Invalid pattern detected. Patterns must begin with "^".', 2)
end
-- Iterate over the text string, and replace any matched text. using the
-- delink function. We need to iterate character by character rather
-- than just use gsub, otherwise nested links aren't detected properly.
local result = ""
while text ~= "" do
-- Replace text using one iteration of gsub.
text = mw.ustring.gsub(text, pattern, delinkFunction, 1)
-- Append the left-most character to the result string.
result = result .. mw.ustring.sub(text, 1, 1)
text = mw.ustring.sub(text, 2, -1)
end
return result
end
function p._delink(args)
local text = args[1] or ""
if args.refs == "yes" then
-- Remove any [[Help:Strip markers]] representing ref tags. In most situations
-- this is not a good idea - only use it if you know what you are doing!
text = mw.ustring.gsub(text, "UNIQ%w*%-ref%-%d*%-QINU", "")
end
if args.comments ~= "no" then
text = text:gsub("<!%-%-.-%-%->", "") -- Remove html comments.
end
if args.wikilinks ~= "no" and args.wikilinks ~= "target" then
-- De-link wikilinks and return the label portion of the wikilink.
text = delinkLinkClass(text, "^%[%[.-%]%]", getDelinkedLabel)
elseif args.wikilinks == "target" then
-- De-link wikilinks and return the target portions of the wikilink.
text = delinkLinkClass(text, "^%[%[.-%]%]", getDelinkedTarget)
end
if args.urls ~= "no" then
text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
end
if args.whitespace ~= "no" then
-- Replace single new lines with a single space, but leave double new lines
-- and new lines only containing spaces or tabs before a second new line.
text = mw.ustring.gsub(text, "([^\n \t][ \t]*)\n([ \t]*[^\n \t])", "%1 %2")
text = text:gsub("[ \t]+", " ") -- Remove extra tabs and spaces.
end
return text
end
function p.delink(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return p._delink(getArgs(frame, {wrappers = 'Template:Delink'}))
end
return p
951n1j8ju9158tl4ivrmhzgbja8loo1
Module:EditAtWikidata
828
51464265
1076968612
915181788
2022-03-13T22:49:52Z
Johnuniq
6036800
update from [[Module:EditAtWikidata/sandbox]] per talk: tweaks + greatly reduce memory usage + class=noprint
Scribunto
text/plain
-- Module to display an icon with a tooltip such as "Edit this at Wikidata".
-- Icon is linked to the Wikidata entry for the article where this is placed.
-- This message is only displayed if a local_parameter is not supplied
-- i.e. when called from a template, it can be coded not to display the message.
-- The qid of a Wikidata entry can optionally be supplied for testing outside the article.
-- Usage:
-- {{#invoke:EditAtWikidata|showMessage|local_parameter}}
-- {{#invoke:EditAtWikidata|showMessage|qid=<ArticleID>|local_parameter}}
local p = {}
local i18n =
{
["message"] = "Edit this at Wikidata"
}
local function trimToNil(text)
-- Return trimmed non-empty text, or nil.
if type(text) == 'string' then
return text:match('(%S.-)%s*$')
end
end
function p._showMessage(args)
local local_parm = trimToNil(args[1])
if local_parm then return "" end
-- Parameter qid=x specifies the Wikidata ID for the article.
-- This is not normally used except for testing outside the article.
local qid = trimToNil(args.qid) or mw.wikibase.getEntityIdForCurrentPage()
if qid and mw.wikibase.entityExists(qid) then
-- Parameter pid=x uses x as an anchor in the link to the Wikidata entry.
local anchor = trimToNil(args.pid)
-- Parameter nbsp replaces the leading space with
local space = trimToNil(args.nbsp) and " " or " "
return
space ..
"[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px" ..
"|alt=" .. i18n.message ..
"|link=https://www.wikidata.org/wiki/" .. qid ..
(anchor and ("#" .. anchor) or "") ..
"|class=noprint" ..
"|" .. i18n.message ..
"]]"
end
return ""
end
function p.showMessage(frame)
return p._showMessage(frame.args)
end
return p
hod1hfo0n331jsuhscew67pebepcmju
Module:Effective protection expiry
828
48785459
1073570341
948472505
2022-02-23T10:59:29Z
Xaosflux
502540
Changed protection settings for "[[Module:Effective protection expiry]]": used in the mediawiki interface / match [[Module:Effective protection level]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
i1wms02y1w048cq6uttka18a5pjzp63
Module:Effective protection level
828
41617327
980896975
948472507
2020-09-29T03:38:47Z
Jackmcbarn
19285809
bring in changes from sandbox
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then
error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
d3lhy0comfcfe9lnnj8klmrfqm1oxw7
Module:Error
828
38948927
750709040
636708920
2016-11-21T11:11:11Z
Materialscientist
7852030
Changed protection level for "[[Module:Error]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
-- This module implements {{error}}.
local p = {}
local function _error(args)
local tag = mw.ustring.lower(tostring(args.tag))
-- Work out what html tag we should use.
if not (tag == 'p' or tag == 'span' or tag == 'div') then
tag = 'strong'
end
-- Generate the html.
return tostring(mw.html.create(tag)
:addClass('error')
:wikitext(tostring(args.message or args[1] or error('no message specified', 2)))
)
end
function p.error(frame)
local args
if type(frame.args) == 'table' then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
args = frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
args = frame
end
-- if the message parameter is present but blank, change it to nil so that Lua will
-- consider it false.
if args.message == "" then
args.message = nil
end
return _error(args)
end
return p
swpvwjcdmj2mkkmx9f7rbsdrfsnmirh
Module:File link
828
42903140
948474149
948472509
2020-04-01T06:31:54Z
MusikAnimal
14882394
Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"type error in '%s' parameter of '_main' (expected string, got %s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("'file' parameter missing from [[Template:File link]]", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
bzc22v133v9z5yc4aisazripn6l94p8
Module:Footnotes
828
38969239
1044276984
1044096092
2021-09-14T12:03:42Z
Trappist the monk
10289486
Scribunto
text/plain
require('Module:No globals');
local getArgs = require ('Module:Arguments').getArgs;
--[[--------------------------< A R G S _ D E F A U L T >------------------------------------------------------
a table to specify initial values.
]]
local args_default = {
bracket_left = '',
bracket_right = '',
bracket_year_left = '',
bracket_year_right = '',
postscript = '',
page = '',
pages = '',
location = '',
page_sep = ", p. ",
pages_sep = ", pp. ",
ref = '',
template = 'harv', -- if template name not provided in {{#invoke:}} use this
};
--[[--------------------------< T A R G E T _ C H E C K >------------------------------------------------------
look for anchor_id (CITEREF name-list and year or text from |ref=) in anchor_id_list
the 'no target' error may be suppressed with |ignore-err=yes when target cannot be found because target is inside
a template that wraps another template; 'multiple targets' error may not be suppressed
]]
local function target_check (anchor_id, args)
local namespace = mw.title.getCurrentTitle().namespace;
local anchor_id_list_module = mw.loadData ('Module:Footnotes/anchor_id_list');
local anchor_id_list = anchor_id_list_module.anchor_id_list;
local article_whitelist = anchor_id_list_module.article_whitelist;
local template_list = anchor_id_list_module.template_list;
local whitelist_module = mw.loadData ('Module:Footnotes/whitelist');
local whitelist = whitelist_module.whitelist;
local special_patterns = whitelist_module.special_patterns;
local DNB_special_patterns = whitelist_module.DNB_special_patterns;
local DNB_template_names = whitelist_module.DNB_template_names;
if 10 == namespace then
return ''; -- automatic form of |no-tracking=yes; TODO: is this too broad?
end
local tally = anchor_id_list[anchor_id]; -- nil when anchor_id not in list; else a tally
local msg;
local category;
if not tally then
if args.ignore then
return ''; -- if ignore is true then no message, no category
end
if article_whitelist and article_whitelist[anchor_id] then -- if an article-local whitelist and anchor ID is in it
return ''; -- done
end
local wl_anchor_id = anchor_id; -- copy to be modified to index into the whitelist
if args.year then -- for anchor IDs created by this template (not in |ref=) that have a date
if args.year:match ('%d%l$') or -- use the date value to determine if we should remove the disambiguator
args.year:match ('n%.d%.%l$') or
args.year:match ('nd%l$') then
wl_anchor_id = wl_anchor_id:gsub ('%l$', ''); -- remove the disambiguator
end
end
local t_tbl = whitelist[wl_anchor_id]; -- get list of templates associated with this anchor ID
if t_tbl then -- when anchor ID not whitelisted t_tbl is nil
for _, t in ipairs (t_tbl) do -- spin through the list of templates associated with this anchor ID
if template_list[t] then -- if associated template is found in the list of templates in the article
return ''; -- anchor ID is whitlisted and article has matching template so no error
end
end
end
for _, pattern in ipairs (special_patterns) do -- spin through the spcial patterns and try to match
if anchor_id:match (pattern) then
return '';
end
end
for _, dnb_t in ipairs (DNB_template_names or {}) do -- getting desparate now, are there any DNB templates? DNB_template_names may be nil; empty table prevents script error
if template_list[dnb_t] then -- if the article has this DNB template
for _, pattern in ipairs (DNB_special_patterns) do -- spin through the DNB-specifiec wildcard patterns
if anchor_id:match (pattern) then -- and attempt a match
return ''; -- found a match
end
end
end
end
msg = 'no target: ' .. anchor_id; -- anchor_id not found
category = '[[Category:Harv and Sfn no-target errors]]';
elseif 1 < tally then
msg = 'multiple targets (' .. tally .. '×): ' .. anchor_id; -- more than one anchor_id in this article
category = 0 == namespace and '[[Category:Harv and Sfn multiple-target errors]]' or ''; -- only categorize in article space
return '<span class="error harv-error" style="display: inline; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category;
end
-- category = 0 == namespace and '[[Category:Harv and Sfn template errors]]' or ''; -- only categorize in article space
category = 0 == namespace and category or ''; -- only categorize in article space
--use this version to show error messages
-- return msg and '<span class="error harv-error" style="display: inline; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category or '';
--use this version to hide error messages
return msg and '<span class="error harv-error" style="display: none; font-size:100%"> ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])</span>' .. category or '';
end
--[[--------------------------< I S _ Y E A R >----------------------------------------------------------------
evaluates param to see if it is one of these forms with or without lowercase letter disambiguator:
YYYY
n.d.
nd
c. YYYY
YYYY–YYYY (separator is endash)
YYYY–YY (separator is endash)
return true when param has a recognized form; false else
]]
local patterns_date= {
'^%d%d%d%d?%l?$',
'^n%.d%.%l?$',
'^nd%l?$',
'^c%. %d%d%d%d?%l?$',
'^%d%d%d%d–%d%d%d%d%l?$',
'^%d%d%d%d–%d%d%l?$',
}
local function is_year (param, args)
args.year = ''; -- used for harv error;
for _, pattern in ipairs (patterns_date) do
if mw.ustring.match (param, pattern) then
args.year = param; -- used for harv error;
return true;
end
end
end
--[[--------------------------< C O R E >----------------------------------------------------------------------
returns an anchor link (CITEREF) formed from one to four author names, year, and insource location (|p=, |pp=, loc=)
]]
local function core( args )
local result;
local err_msg = ''
if args.P5 ~= '' then
if is_year (args.P5, args) then
result = table.concat ({args.P1, ' et al. ', args.bracket_year_left, args.P5, args.bracket_year_right});
else
args.P5 = ''; -- when P5 not a year don't include in anchor
result = table.concat ({args.P1, ' et al.'}); -- and don't render it
end
elseif args.P4 ~= '' then
if is_year (args.P4, args) then
result = table.concat ({args.P1, ', ', args.P2, ' & ', args.P3, ' ', args.bracket_year_left, args.P4, args.bracket_year_right}); -- three names and a year
else
result = table.concat ({args.P1, ' et al.'}); -- four names
end
elseif args.P3 ~= '' then
if is_year (args.P3, args) then
result = table.concat ({args.P1, ' & ', args.P2, ' ', args.bracket_year_left, args.P3, args.bracket_year_right}); -- two names and a year
else
result = table.concat ({args.P1, ', ', args.P2, ' ', ' & ', args.P3}); -- three names
end
elseif args.P2 ~= '' then
if is_year (args.P2, args) then
result = table.concat ({args.P1, ' ', args.bracket_year_left, args.P2, args.bracket_year_right}); -- one name and year
else
result = table.concat ({args.P1, ' & ', args.P2}); -- two names
end
else
result = args.P1; -- one name
end
-- when author-date result ends with a dot (typically when the last positional parameter holds 'n.d.')
-- and when no in-source location (no |p=, |pp=, or |loc=)
-- and when the first or only character in args.postscript is a dot
-- remove the author-date result trailing dot
-- the author-date result trailing dot will be replaced later with the content of args.postscript (usually a dot)
if ('.' == result:sub(-1)) and ('.' == args.postscript:sub(1)) and ('' == args.page) and ('' == args.pages) and ('' == args.location) then
result = result:gsub ('%.$', '');
end
if args.ref ~= 'none' then
local anchor_id;
if args.ref ~= '' then
anchor_id = mw.uri.anchorEncode (args.ref);
err_msg = target_check (anchor_id, args);
result = table.concat ({'[[#', anchor_id, '|', result, ']]'});
else
anchor_id = mw.uri.anchorEncode (table.concat ({'CITEREF', args.P1, args.P2, args.P3, args.P4, args.P5}));
err_msg = target_check (anchor_id, args);
result = table.concat ({'[[#', anchor_id, '|', result, ']]'});
end
end
if args.page ~= '' then
result = table.concat ({result, args.page_sep, args.page});
elseif args.pages ~= ''then
result = table.concat ({result, args.pages_sep, args.pages});
end
if args.location ~= '' then
result = table.concat ({result, ', ', args.location});
end
result = table.concat ({args.bracket_left, result, args.bracket_right, args.postscript}):gsub ('%s+', ' '); -- strip redundant spaces
return result .. err_msg;
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen to a dash under certain conditions. The hyphen 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
This code copied from Module:Citation/CS1. The only modification is to require Module:Citation/CS1/Utilities
so that it has access to the functions is_set() and has_accept_as_written()
]]
local function hyphen_to_dash( str )
local utilities = require ('Module:Citation/CS1/Utilities'); -- only modification so that this function has access to is_set() and has_accept_as_written()
if not utilities.is_set (str) then
return str;
end
local accept; -- Boolean
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
for _, item in ipairs (list) do -- for each item in the list
item, accept = utilities.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 a hyphenated range or has endash or emdash separators
if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or -- letterdigit hyphen letterdigit (optional separator between letter and digit)
item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or -- digitletter hyphen digitletter (optional separator between digit and letter)
item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or -- digit separator digit hyphen digit separator digit
item:match ('^%d+%s*%-%s*%d+$') or -- digit hyphen digit
item:match ('^%a+%s*%-%s*%a+$') then -- letter hyphen letter
item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2'); -- replace hyphen, remove extraneous space characters
else
item = mw.ustring.gsub (item, '%s*[–—]%s*', '–'); -- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
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 = utilities.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 = utilities.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;
else
return temp_str; -- else, return assembled temp_str
end
end
--[[--------------------------< A R G S _ F E T C H >---------------------------------------------------------
Because all of the templates share a common set of parameters, a single common function to fetch those parameters
from frame and parent frame.
]]
local function args_fetch (frame, ps)
local args = args_default; -- create a copy of the default table
local pframe = frame:getParent(); -- point to the template's parameter table
for k, v in pairs (frame.args) do -- override defaults with values provided in the #invoke: if any
args[k] = v;
end
args.postscript = pframe.args.postscript or pframe.args.ps or ps;
if 'none' == args.postscript then
args.postscript = '';
end
args.page = pframe.args.p or pframe.args.page or '';
args.pages = pframe.args.pp or pframe.args.pages or '';
args.pages = ('' ~= args.pages) and hyphen_to_dash (args.pages) or '';
args.location = pframe.args.loc or '';
args.ref = pframe.args.ref or pframe.args.Ref or '';
args.ignore = ('yes' == pframe.args['ignore-false-positive']) or ('yes' == pframe.args['ignore-err']);
for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- loop through the five positional parameters and trim if set else empty string
args[v] = (pframe.args[i] and mw.text.trim (pframe.args[i])) or '';
end
if args.P5 and not is_year (args.P5, args) then
local i = 6; -- initialize the indexer to the sixth positional parameter
while pframe.args[i] do -- in case there are too many authors loop through the authors looking for a year
local v = mw.text.trim (pframe.args[i]); -- trim
if is_year (v, args) then -- if a year
args.P5 = v; -- overwrite whatever was in args.P5 with year
break; -- and abandon the search
end
i = i + 1; -- bump the indexer
end
end
return args;
end
--[[--------------------------< H A R V A R D _ C I T A T I O N >----------------------------------------------
common entry point for:
{{harvard citation}} aka {{harv}}
{{Harvard citation no brackets}} aka {{harvnb}}
{{harvcol}}
{{harvcolnb}}
{{harvcoltxt}}
{{Harvard citation text}} aka {{harvtxt}}
{{Harvp}}
Distinguishing features (brackets and page separators) are specified in this module's {{#invoke}} in the respective templates.
]]
local function harvard_citation (frame)
local args = args_fetch (frame, ''); -- get the template and invoke parameters; default postscript is empty string
return core (args);
end
--[[--------------------------< S T R I P _ U R L >------------------------------------------------------------
used by sfn() and sfnm(). This function fixes an issue with reference tooltip gadget where the tooltip is not displayed
when an insource locator (|p=, |pp=, |loc=) has an external wikilink that contains a # character
strip uri-reserved characters from urls in |p=, |pp-, and |loc= parameters The researved characters are:
!#$&'()*+,/:;=?@[]
]]
local function strip_url (pages)
local escaped_uri;
if not pages or ('' == pages) then
return pages;
end
for uri in pages:gmatch ('%[(%a[%w%+%.%-]*://%S+)') do -- for each external link get the uri
escaped_uri = uri:gsub ("([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" ); -- save a copy with lua pattern characters escaped
uri = uri:gsub ("[!#%$&'%(%)%*%+,/:;=%?@%[%]%.%%]", ''); -- remove reserved characters and '%' because '%20' (space character) is a lua 'invalid capture index'
pages = pages:gsub (escaped_uri, uri, 1); -- replace original uri with the stripped version
end
return pages;
end
--[[--------------------------< S F N >------------------------------------------------------------------------
entry point for {{sfn}} and {{sfnp}}
]]
local function sfn (frame)
local args = args_fetch (frame, '.'); -- get the template and invoke parameters; default postscript is a dot
local result = core (args); -- go make a CITEREF anchor
-- put it all together and then strip redundant spaces
local name = table.concat ({'FOOTNOTE', args.P1, args.P2, args.P3, args.P4, args.P5, strip_url (args.page), strip_url (args.pages), strip_url (args.location)}):gsub ('%s+', ' ');
return frame:extensionTag ({name='ref', args={name=name}, content=result});
end
--[[--------------------------< S F N M >----------------------------------------------------------------------
common entry point for {{sfnm}} and {{sfnmp}}
Distinguishing features (brackets) are specified in this module's {{#invoke}} in the respective templates.
]]
local function sfnm (frame)
local args = args_default; -- create a copy of the default table
local pframe = frame:getParent(); -- point to the template's parameter table
local n = 1; -- index of source; this is the 'n' in na1, ny, etc
local first_pnum = 1; -- first of a pair of positional parameters
local second_pnum = 2; -- second of a pair of positional parameters
local last_ps = 0; -- index of the last source with |nps= set
local last_index = 0; -- index of the last source; these used to determine which of |ps= or |nps= will terminate the whole rendering
local out = {}; -- table to hold rendered sources
local footnote = {'FOOTNOTE'}; -- all author, date, insource location stuff becomes part of the reference's footnote id; added as we go
for k, v in pairs (frame.args) do -- override defaults with values provided in the #invoke: if any
args[k] = v;
end
while true do
if not pframe.args[table.concat ({n, 'a1'})] and not pframe.args[first_pnum] then
break; -- no na1 or matching positional parameter so done
end
if pframe.args[table.concat ({n, 'a1'})] then -- does this source use named parameters?
for _, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- initialize for this source
args[v] = '';
end
for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- extract author and year parameters for this source
args[v] = pframe.args[table.concat ({n, 'a', i})] or ''; -- attempt to assign author name
if '' == args[v] then -- when there wasn't an author name
args[v] = pframe.args[table.concat ({n, 'y'})] or ''; -- attempt to assign year
break; -- done with author/date for this source
end
end
else -- this source uses positional parameters
args.P1 = mw.text.trim (pframe.args[first_pnum]); -- yes, only one author supported
args.P2 = (pframe.args[second_pnum] and mw.text.trim (pframe.args[second_pnum])) or ''; -- when positional author, year must also be positional
for _, v in ipairs ({'P3', 'P4', 'P5'}) do -- blank the rest of these for this source
args[v] = '';
end
first_pnum = first_pnum + 2; -- source must use positional author and positional year
second_pnum = first_pnum + 1; -- bump these for possible next positional source
end
args.postscript = pframe.args[table.concat ({n, 'ps'})] or '';
if 'none' == args.postscript then -- this for compatibility with other footnote templates; does nothing
args.postscript = '';
end
args.ref = pframe.args[table.concat ({n, 'ref'})] or ''; -- alternate reference for this source
args.page = pframe.args[table.concat ({n, 'p'})] or ''; -- insource locations for this source
args.pages = pframe.args[table.concat ({n, 'pp'})] or '';
args.pages = ('' ~= args.pages) and hyphen_to_dash (args.pages) or '';
args.location = pframe.args[table.concat ({n, 'loc'})] or '';
args.ignore = ('yes' == pframe.args[table.concat ({n, 'ignore-false-positive'})]) or ('yes' == pframe.args[table.concat ({n, 'ignore-err'})]);
table.insert (out, core (args)); -- save the rendering of this source
for k, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do -- create the FOOTNOTE id
if '' ~= args[v] then
table.insert (footnote, args[v]);
end
end
for k, v in ipairs ({'page', 'pages', 'location'}) do -- these done separately so that we can strip uri-reserved characters from extlinked page numbers
if '' ~= args[v] then
table.insert (footnote, strip_url (args[v]))
end
end
last_index = n; -- flags used to select terminal postscript from nps or from end_ps
if '' ~= args.postscript then
last_ps = n;
end
n = n+1; -- bump for the next one
end
local name = table.concat (footnote):gsub ('%s+', ' '); -- put the footnote together and strip redundant space
args.end_ps = pframe.args.postscript or pframe.args.ps or '.'; -- this is the postscript for the whole not for the individual sources
if 'none' == args.end_ps then -- not an original sfnm parameter value; added for compatibility with other footnote templates
args.end_ps = '';
end
local result = table.concat ({table.concat (out, '; '), (last_index == last_ps) and '' or args.end_ps});
return frame:extensionTag ({name='ref', args={name=name}, content=result});
end
--[[--------------------------< S F N R E F >------------------------------------------------------------------
implements {{sfnref}}
]]
local function sfnref (frame)
local args = getArgs (frame);
local out = {};
for i=1, 5 do -- get the first five args if there are five args
if args[i] then
out[i] = args[i];
else
break; -- less than 5 args break out
end
end
if 5 == #out then -- when we have seen five args there may bemore
local i = 6; -- initialize the indexer to the sixth positional parameter
while args[i] do -- in case there are too many authors loop through the authors looking for a year
if is_year (args[i], args) then -- if a year
out[5] = args[i]; -- overwrite whatever was in args[5] with year
break; -- and abandon the search
end
i = i + 1; -- bump the indexer
end
end
return mw.uri.anchorEncode ('CITEREF' .. table.concat (out));
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
harvard_citation = harvard_citation,
sfn = sfn,
sfnm = sfnm,
sfnref = sfnref,
};
2x57eg4kn4kd2u38h6p4rteov6l4211
Module:For
828
50413050
986771546
963584211
2020-11-02T22:29:56Z
Andrybak
23735172
don't add talk pages and pages in the user namespace to [[:Category:Hatnote templates with errors]] – this is similar to [[Special:Diff/953627233/986768317|Module:Other uses of]] and [[Special:Diff/967664662|Module:Hatnote]]
Scribunto
text/plain
local mArguments --initialize lazily
local mHatlist = require('Module:Hatnote list')
local mHatnote = require('Module:Hatnote')
local yesNo = require('Module:Yesno')
local p = {}
--Implements {{For}} from the frame
--uses capitalized "For" to avoid collision with Lua reserved word "for"
function p.For (frame)
mArguments = require('Module:Arguments')
return p._For(mArguments.getArgs(frame))
end
--Implements {{For}} but takes a manual arguments table
function p._For (args)
local use = args[1]
if (not use) then
return mHatnote.makeWikitextError(
'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
'Template:For#Errors',
args.category
)
end
local pages = {}
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
for k, v in two(ipairs(args)) do table.insert(pages, v) end
local title = mw.title.getCurrentTitle()
local skipCat = title.isTalkPage or title.namespace == 2 --don't categorise talk pages and userspace
local oddCat = skipCat and '' or '[[Category:Hatnote templates using unusual parameters]]'
local category = yesNo(args.category)
return mHatnote._hatnote(
mHatlist.forSeeTableToString({{use = use, pages = pages}}),
{selfref = args.selfref}
) .. (
(use == 'other uses') and ((category == true) or (category == nil)) and
oddCat or ''
)
end
return p
5kir3llbyjasubdg18thlz8rxsxfwtw
Module:For related page
828
50931992
885097948
851201436
2019-02-25T23:17:07Z
MusikAnimal
14882394
Protected "[[Module:For related page]]": [[Wikipedia:High-risk templates|High-risk template or module]]; match protection with associated template ([Edit=Require autoconfirmed or confirmed access] (indefinite))
Scribunto
text/plain
local mFor = require('Module:For')
local mArguments = require('Module:Arguments')
local p = {}
function p.forFoo (frame)
local args = mArguments.getArgs(frame,
{parentOnly = true}
)
local target
if args[1] then
target = args[1]
else
local title = mw.title.getCurrentTitle().text
local titles = {
mw.ustring.lower(mw.ustring.sub(title, 1, 1)) .. mw.ustring.sub(title, 2),
title
}
local forms = frame.args
for k, v in ipairs(forms) do
for i, j in pairs(titles) do
local lookup = string.format(v, j)
if mw.title.new(lookup, 0).exists then
target = lookup
break
end
end
if target then break end
end
target = target or string.format(forms[1], title)
end
return mFor._For({frame.args.what, target})
end
return p
bvfjh9mafvpzcnc6fqdnpesdil5esbp
Module:Format link
828
69546539
1064575531
1064019022
2022-01-09T02:48:07Z
Hike395
11639
incorrect entry point
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Format link
--
-- Makes a wikilink from the given link and display values. Links are escaped
-- with colons if necessary, and links to sections are detected and displayed
-- with " § " as a separator rather than the standard MediaWiki "#". Used in
-- the {{format link}} template.
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local mError -- lazily initialise [[Module:Error]]
local yesno -- lazily initialise [[Module:Yesno]]
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
local function maybeItalicize(s, shouldItalicize)
-- Italicize s if s is a string and the shouldItalicize parameter is true.
if s and shouldItalicize then
return '<i>' .. s .. '</i>'
else
return s
end
end
local function parseLink(link)
-- Parse a link and return a table with the link's components.
-- These components are:
-- - link: the link, stripped of any initial colon (always present)
-- - page: the page name (always present)
-- - section: the page name (may be nil)
-- - display: the display text, if manually entered after a pipe (may be nil)
link = removeInitialColon(link)
-- Find whether a faux display value has been added with the {{!}} magic
-- word.
local prePipe, display = link:match('^(.-)|(.*)$')
link = prePipe or link
-- Find the page, if it exists.
-- For links like [[#Bar]], the page will be nil.
local preHash, postHash = link:match('^(.-)#(.*)$')
local page
if not preHash then
-- We have a link like [[Foo]].
page = link
elseif preHash ~= '' then
-- We have a link like [[Foo#Bar]].
page = preHash
end
-- Find the section, if it exists.
local section
if postHash and postHash ~= '' then
section = postHash
end
return {
link = link,
page = page,
section = section,
display = display,
}
end
local function formatDisplay(parsed, options)
-- Formats a display string based on a parsed link table (matching the
-- output of parseLink) and an options table (matching the input options for
-- _formatLink).
local page = maybeItalicize(parsed.page, options.italicizePage)
local section = maybeItalicize(parsed.section, options.italicizeSection)
if (not section) then
return page
elseif (not page) then
return mw.ustring.format('§ %s', section)
else
return mw.ustring.format('%s § %s', page, section)
end
end
local function missingArgError(target)
mError = require('Module:Error')
return mError.error{message =
'Error: no link or target specified! ([[' .. target .. '#Errors|help]])'
}
end
--------------------------------------------------------------------------------
-- Main functions
--------------------------------------------------------------------------------
function p.formatLink(frame)
-- The formatLink export function, for use in templates.
yesno = require('Module:Yesno')
local args = getArgs(frame)
local link = args[1] or args.link
local target = args[3] or args.target
if not (link or target) then
return missingArgError('Template:Format link')
end
return p._formatLink{
link = link,
display = args[2] or args.display,
target = target,
italicizePage = yesno(args.italicizepage),
italicizeSection = yesno(args.italicizesection),
categorizeMissing = args.categorizemissing
}
end
function p._formatLink(options)
-- The formatLink export function, for use in modules.
checkType('_formatLink', 1, options, 'table')
local function check(key, expectedType) --for brevity
checkTypeForNamedArg(
'_formatLink', key, options[key], expectedType or 'string', true
)
end
check('link')
check('display')
check('target')
check('italicizePage', 'boolean')
check('italicizeSection', 'boolean')
check('categorizeMissing')
-- Normalize link and target and check that at least one is present
if options.link == '' then options.link = nil end
if options.target == '' then options.target = nil end
if not (options.link or options.target) then
return missingArgError('Module:Format link')
end
local parsed = parseLink(options.link)
local display = options.display or parsed.display
local catMissing = options.categorizeMissing
local category = ''
-- Find the display text
if not display then display = formatDisplay(parsed, options) end
-- Handle the target option if present
if options.target then
local parsedTarget = parseLink(options.target)
parsed.link = parsedTarget.link
parsed.page = parsedTarget.page
end
-- Test if page exists if a diagnostic category is specified
if catMissing and (mw.ustring.len(catMissing) > 0) then
local title = nil
if parsed.page then title = mw.title.new(parsed.page) end
if title and (not title.isExternal) and (not title.exists) then
category = mw.ustring.format('[[Category:%s]]', catMissing)
end
end
-- Format the result as a link
if parsed.link == display then
return mw.ustring.format('[[:%s]]%s', parsed.link, category)
else
return mw.ustring.format('[[:%s|%s]]%s', parsed.link, display, category)
end
end
--------------------------------------------------------------------------------
-- Derived convenience functions
--------------------------------------------------------------------------------
function p.formatPages(options, pages)
-- Formats an array of pages using formatLink and the given options table,
-- and returns it as an array. Nil values are not allowed.
local ret = {}
for i, page in ipairs(pages) do
ret[i] = p._formatLink{
link = page,
categorizeMissing = options.categorizeMissing,
italicizePage = options.italicizePage,
italicizeSection = options.italicizeSection
}
end
return ret
end
return p
kqzzmt53imtxeq4z2wtd8gb4aoahnkl
Module:Gutenberg
828
48032606
1080438970
1038321822
2022-04-01T08:43:54Z
Zyxw
473593
Add "Edit At Wikidata" link if using ID from Wikidata. Tested first with /sandbox and preview in article.
Scribunto
text/plain
local p = {}
function p.author(frame)
local pframe = frame:getParent()
local args = pframe.args
local tname = "Gutenberg author" -- name of calling template. Change if template is renamed.
local id = nil -- author name, or number. Name goes to search page, number goes direct to author page
local name = nil -- display name on Wikipedia (default: article title)
local url = nil
local tagline = "at [[Project Gutenberg]]"
local urlheadname = "https://www.gutenberg.org/author/"
local urlheadnumb = "https://www.gutenberg.org/ebooks/author/"
local urlhead = nil
-- Argument |id=
id = trimArg(args[1]) or trimArg(args.id)
if not id then
local bestP1938 = mw.wikibase.getBestStatements(mw.wikibase.getEntityIdForCurrentPage(), 'P1938')[1]
if bestP1938 and bestP1938.mainsnak.snaktype == 'value' then
id = bestP1938.mainsnak.datavalue.value
local entity = mw.wikibase.getEntityObject() or {}
tagline = tagline .. " [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/" .. entity.id .. "#P1938|Edit this at Wikidata]]"
else
error("Parameter id is missing. See [[Template:" .. tname .. "]] documentation")
end
end
if tonumber(id) then -- it's a number
urlhead = urlheadnumb
else
urlhead = urlheadname
id = mw.ustring.gsub(id," ", "+")
end
-- Argument |name=
name = trimArg(args[2]) or trimArg(args.name)
if not name then
name = mw.title.getCurrentTitle().text:gsub('%s+%([^%(]-%)$', '') -- Current page name without the final parentheses
end
-- Argument |coda=
if trimArg(args.coda) then
tagline = tagline .. " " .. trimArg(args.coda)
end
url = "[" .. urlhead .. id .. " Works by " .. name .. "] " .. tagline
return url
end
function p.Australia(frame)
local pframe = frame:getParent()
local args = pframe.args
local tname = "Gutenberg Australia" -- name of calling template. Change if template is renamed.
local id = nil -- ID. eg. http://gutenberg.net.au/plusfifty-n-z.html#shanks .. the ID = plusfifty-n-z.html#shanks
-- ID is the same for linking an individual book title, or all books by the author.
local name = nil -- display name on Wikipedia (default: article title)
local author = nil -- flag if an author (default: no)
local url = nil
local urlhead = "http://gutenberg.net.au/"
local prefix = ""
local tagline = "at [[Project Gutenberg Australia]]"
local italic = "''"
-- Argument |id=
id = trimArg(args[1]) or trimArg(args.id)
if not id then
error("Parameter id is missing. See [[Template:" .. tname .. "]] documentation")
end
-- Argument |name=
name = trimArg(args[2]) or trimArg(args.name)
if not name then
name = mw.title.getCurrentTitle().text:gsub('%s+%([^%(]-%)$', '') -- Current page name without the final parentheses
end
-- Argument |author=
author = trimArg(args.author)
if author then
if mw.ustring.lower(author) == "yes" then
prefix = "Works by "
italic = ""
end
end
-- Argument |coda=
if trimArg(args.coda) then
tagline = tagline .. " " .. trimArg(args.coda)
end
url = "[" .. urlhead .. id .. " " .. prefix .. italic .. name .. italic .. "] " .. tagline
return url
end
function p.Canada(frame)
local pframe = frame:getParent()
local args = pframe.args
local tname = "FadedPage" -- name of calling template. Change if template is renamed.
local id = nil -- ID for author, eg. http://fadedpage.com/csearch.php?author=Shortt%2C%20Adam .. the id = Shortt, Adam
-- ID for book titles, eg. http://fadedpage.com/showbook.php?pid=20160704 .. the id = 20160704
local name = nil -- display name on Wikipedia (default: article title)
local author = nil -- flag if an author (default: no)
local url = nil
local urlhead = "https://fadedpage.com/"
local urlbook = "showbook.php?pid="
local urlauth = "csearch.php?author="
local prefix = ""
local tagline = "at [[Distributed Proofreaders Canada|Faded Page]] (Canada)"
local italic = "''"
-- Argument |id=
id = trimArg(args[1]) or trimArg(args.id)
if not id then
error("Parameter id is missing. See [[Template:" .. tname .. "]] documentation")
end
-- Argument |name=
name = trimArg(args[2]) or trimArg(args.name)
if not name then
name = mw.title.getCurrentTitle().text:gsub('%s+%([^%(]-%)$', '') -- Current page name without the final parentheses
end
-- Argument |author=
author = trimArg(args.author)
if author then
if mw.ustring.lower(author) == "yes" then
id = mw.uri.encode( id, "PATH" ) -- handle spaces within id argument string
prefix = "Works by "
italic = ""
url = "[" .. urlhead .. urlauth .. id .. " " .. prefix .. italic .. name .. italic .. "] " .. tagline
return url
end
end
url = "[" .. urlhead .. urlbook .. id .. " " .. prefix .. italic .. name .. italic .. "] " .. tagline
return url
end
function trimArg(arg)
if arg == "" or arg == nil then
return nil
else
return mw.text.trim(arg)
end
end
return p
ppgpfaaq9g3ybtjy3co2n1ldmzthdhf
Module:Hatnote
828
42498502
1091749839
1063743122
2022-06-06T04:14:36Z
Nihiltres
236191
Fix for fragile conditional
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 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
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.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
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
--------------------------------------------------------------------------------
-- 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(
'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(inline == 1 and 'hatnote-inline' or 'hatnote')
:addClass('navigation-not-searchable')
: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
3lp0p77brxpfdg1fgn1qvov8zvyjqlw
Module:Hatnote/styles.css
828
61325919
1033289096
1033184688
2021-07-12T19:22:27Z
Izno
2927383
per my talk page
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;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.hatnote + link + .hatnote {
margin-top: -0.5em;
}
7znvdfdw9mn3ta8a2ioyp35gizwnv4c
Module:Hatnote list
828
50085079
1062173192
1062166786
2021-12-26T20:05:24Z
Nihiltres
236191
Undid revision 1062166786 by [[Special:Contributions/Matthiaspaul|Matthiaspaul]] ([[User talk:Matthiaspaul|talk]]); should be fixed now, and if not, please ping me with examples as I couldn't reproduce the original error
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote list --
-- --
-- This module produces and formats lists for use in hatnotes. In particular, --
-- it implements the for-see list, i.e. lists of "For X, see Y" statements, --
-- as used in {{about}}, {{redirect}}, and their variants. Also introduced --
-- are andList & orList helpers for formatting lists with those conjunctions. --
--------------------------------------------------------------------------------
local mArguments --initialize lazily
local mFormatLink = require('Module:Format link')
local mHatnote = require('Module:Hatnote')
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
--------------------------------------------------------------------------------
-- List stringification helper functions
--
-- These functions are used for stringifying lists, usually page lists inside
-- the "Y" portion of "For X, see Y" for-see items.
--------------------------------------------------------------------------------
--default options table used across the list stringification functions
local stringifyListDefaultOptions = {
conjunction = "and",
separator = ",",
altSeparator = ";",
space = " ",
formatted = false
}
--Searches display text only
local function searchDisp(haystack, needle)
return string.find(
string.sub(haystack, (string.find(haystack, '|') or 0) + 1), needle
)
end
-- Stringifies a list generically; probably shouldn't be used directly
local function stringifyList(list, options)
-- Type-checks, defaults, and a shortcut
checkType("stringifyList", 1, list, "table")
if #list == 0 then return nil end
checkType("stringifyList", 2, options, "table", true)
options = options or {}
for k, v in pairs(stringifyListDefaultOptions) do
if options[k] == nil then options[k] = v end
end
local s = options.space
-- Format the list if requested
if options.formatted then
list = mFormatLink.formatPages(
{categorizeMissing = mHatnote.missingTargetCat}, list
)
end
-- Set the separator; if any item contains it, use the alternate separator
local separator = options.separator
for k, v in pairs(list) do
if searchDisp(v, separator) then
separator = options.altSeparator
break
end
end
-- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§"
local conjunction = s .. options.conjunction .. s
if #list == 2 and searchDisp(list[1], "§") or #list > 2 then
conjunction = separator .. conjunction
end
-- Return the formatted string
return mw.text.listToText(list, separator .. s, conjunction)
end
--DRY function
function p.conjList (conj, list, fmt)
return stringifyList(list, {conjunction = conj, formatted = fmt})
end
-- Stringifies lists with "and" or "or"
function p.andList (...) return p.conjList("and", ...) end
function p.orList (...) return p.conjList("or", ...) end
--------------------------------------------------------------------------------
-- For see
--
-- Makes a "For X, see [[Y]]." list from raw parameters. Intended for the
-- {{about}} and {{redirect}} templates and their variants.
--------------------------------------------------------------------------------
--default options table used across the forSee family of functions
local forSeeDefaultOptions = {
andKeyword = 'and',
title = mw.title.getCurrentTitle().text,
otherText = 'other uses',
forSeeForm = 'For %s, see %s.',
}
--Collapses duplicate punctuation
local function punctuationCollapse (text)
local replacements = {
["%.%.$"] = ".",
["%?%.$"] = "?",
["%!%.$"] = "!",
["%.%]%]%.$"] = ".]]",
["%?%]%]%.$"] = "?]]",
["%!%]%]%.$"] = "!]]"
}
for k, v in pairs(replacements) do text = string.gsub(text, k, v) end
return text
end
-- Structures arguments into a table for stringification, & options
function p.forSeeArgsToTable (args, from, options)
-- Type-checks and defaults
checkType("forSeeArgsToTable", 1, args, 'table')
checkType("forSeeArgsToTable", 2, from, 'number', true)
from = from or 1
checkType("forSeeArgsToTable", 3, options, 'table', true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- maxArg's gotten manually because getArgs() and table.maxn aren't friends
local maxArg = 0
for k, v in pairs(args) do
if type(k) == 'number' and k > maxArg then maxArg = k end
end
-- Structure the data out from the parameter list:
-- * forTable is the wrapper table, with forRow rows
-- * Rows are tables of a "use" string & a "pages" table of pagename strings
-- * Blanks are left empty for defaulting elsewhere, but can terminate list
local forTable = {}
local i = from
local terminated = false
-- If there is extra text, and no arguments are given, give nil value
-- to not produce default of "For other uses, see foo (disambiguation)"
if options.extratext and i > maxArg then return nil end
-- Loop to generate rows
repeat
-- New empty row
local forRow = {}
-- On blank use, assume list's ended & break at end of this loop
forRow.use = args[i]
if not args[i] then terminated = true end
-- New empty list of pages
forRow.pages = {}
-- Insert first pages item if present
table.insert(forRow.pages, args[i + 1])
-- If the param after next is "and", do inner loop to collect params
-- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3}
while args[i + 2] == options.andKeyword do
if args[i + 3] then
table.insert(forRow.pages, args[i + 3])
end
-- Increment to next "and"
i = i + 2
end
-- Increment to next use
i = i + 2
-- Append the row
table.insert(forTable, forRow)
until terminated or i > maxArg
return forTable
end
-- Stringifies a table as formatted by forSeeArgsToTable
function p.forSeeTableToString (forSeeTable, options)
-- Type-checks and defaults
checkType("forSeeTableToString", 1, forSeeTable, "table", true)
checkType("forSeeTableToString", 2, options, "table", true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- Stringify each for-see item into a list
local strList = {}
if forSeeTable then
for k, v in pairs(forSeeTable) do
local useStr = v.use or options.otherText
local pagesStr =
p.andList(v.pages, true) or
mFormatLink._formatLink{
categorizeMissing = mHatnote.missingTargetCat,
link = mHatnote.disambiguate(options.title)
}
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr)
forSeeStr = punctuationCollapse(forSeeStr)
table.insert(strList, forSeeStr)
end
end
if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end
-- Return the concatenated list
return table.concat(strList, ' ')
end
-- Produces a "For X, see [[Y]]" string from arguments. Expects index gaps
-- but not blank/whitespace values. Ignores named args and args < "from".
function p._forSee (args, from, options)
local forSeeTable = p.forSeeArgsToTable(args, from, options)
return p.forSeeTableToString(forSeeTable, options)
end
-- As _forSee, but uses the frame.
function p.forSee (frame, from, options)
mArguments = require('Module:Arguments')
return p._forSee(mArguments.getArgs(frame), from, options)
end
return p
octqbcvqrobtndgnn8u78tg2tsemf14
Module:IPAc-en
828
47001391
1093575038
990143931
2022-06-17T13:57:25Z
Nardog
5908908
lang
Scribunto
text/plain
-- This module implements [[Template:IPAc-en]].
local data = mw.loadData('Module:IPAc-en/data')
local p = {}
-- Global container for tracking categories
local categoryHandler = require('Module:Category handler').main
local categories = {}
-- Trims whitespace from a string
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
-- This implements [[Template:Nowrap]].
local function makeNowrapSpan(s)
local span = mw.html.create('span')
:addClass('rt-commentedText') -- Works with [[MediaWiki:Gadget-ReferenceTooltips.js]]
:addClass('nowrap')
:wikitext(s)
return tostring(span)
end
local function makePronunciationText(id)
id = id and string.lower(trim(id))
if id and id ~= '' and data.pronunciation[id] then
return data.pronunciation[id].text
end
end
-- This adds a tooltip icon to a label. It implements [[Template:H:title]].
local function makeTooltip(label, tooltip)
local span = mw.html.create('span')
:attr('title', tooltip)
:wikitext(label)
return tostring(span)
end
local function formatPhonemeGroup(phonemes)
if #phonemes > 0 then
local span = mw.html.create('span')
:css('border-bottom', '1px dotted')
:wikitext(table.concat(phonemes))
return tostring(span)
else
return ''
end
end
local function renderCategories()
local ret = ''
if categoryHandler{ true } then
ret = {}
for cat in pairs(categories) do
table.insert(ret, string.format('[[Category:%s]]', cat))
end
table.sort(ret)
ret = table.concat(ret)
else
ret = ''
end
return ret
end
function p._main(args)
local ret = {}
local i = 0 -- Keeps track of numbered args
-- Pronunciation
do
local pron = {}
while true do
i = i + 1
local pronItem = makePronunciationText(args[i])
if pronItem then
pron[#pron + 1] = pronItem
pron[#pron + 1] = ' '
else
break
end
end
if #pron > 0 then
ret[#ret + 1] = string.format(
'<small>%s</small>',
table.concat(pron)
)
end
end
-- Phonemes
do
-- Loop through the numbered args, separating them into phoneme groups
-- and separator strings (both called "words" for convenience). We only
-- underline the phoneme groups, not the separators.
local words = {}
words[#words + 1] = '/' -- Opening slash
i = i - 1 -- Set up i again as it was changed in the pronunciation loop
local id
repeat
local phonemes = {}
local isWordEnd = false
while not isWordEnd do
i = i + 1
id = args[i]
id = id and trim(id)
if not id then
isWordEnd = true
words[#words + 1] = formatPhonemeGroup(phonemes)
elseif id ~= '' then
local t = data.phonemes[id]
if not t then
-- We were passed an invalid id.
isWordEnd = true
categories["Ill-formatted IPAc-en transclusions"] = true
words[#words + 1] = formatPhonemeGroup(phonemes)
words[#words + 1] = makeTooltip(
string.format(
"<strong class=\"error\">[invalid input: '%s']</strong>",
id
),
'Unrecognized symbol'
)
elseif not t.label then
-- The data module contains bad data, so throw an error.
error(string.format(
"no label was found for id '%s'",
tostring(id)
))
elseif t.tooltip then
-- We are dealing with a regular phoneme.
phonemes[#phonemes + 1] = makeTooltip(
t.label,
t.tooltip
)
else
-- We are dealing with a separator.
isWordEnd = true
words[#words + 1] = formatPhonemeGroup(phonemes)
words[#words + 1] = t.label
end
end
end
until not id
words[#words + 1] = '/' -- Closing slash
-- Wrap the words in a link to IPA help.
local span = mw.html.create('span')
-- Suppress Navigation popups and Page Previews (aka Hovercards)
:addClass('IPA nopopups noexcerpt')
:attr('lang', 'en-fonipa')
:wikitext(string.format(
'[[Help:IPA/English|%s]]',
table.concat(words)
))
ret[#ret + 1] = tostring(span)
end
-- Audio link
do
local file = args.audio and trim(args.audio)
if file and file ~= '' then
categories["Pages including recorded pronunciations"] = true
ret[#ret + 1] = mw.getCurrentFrame():expandTemplate{
title = 'Template:IPA audio link', args = { file, attribution = args.attribution } }
end
end
-- Nowrap and categories
ret = makeNowrapSpan(table.concat(ret)) .. renderCategories()
-- Reset the categories table in case we are run again.
categories = {}
return ret
end
function p.main(frame)
return p._main(frame:getParent().args)
end
return p
bjcljaos0u5burhhpml5n3ey0oquc1w
Module:IPAc-en/data
828
47002254
667617239
667617118
2015-06-19T11:38:13Z
Mr. Stradivarius
4708675
switch to main data modules
Scribunto
text/plain
-- This module processes data for [[Module:IPAc-en]]. It is intended to be
-- loaded with mw.loadData.
local PRONUNCIATION_MODULE = 'Module:IPAc-en/pronunciation'
local PHONEME_MODULE = 'Module:IPAc-en/phonemes'
local function makeData(oldData)
local newData = {}
for i, old in ipairs(oldData) do
local new = {}
for k, v in pairs(old) do
if k ~= 'aliases' and k ~= 'code' then
new[k] = v
end
end
newData[old.code] = new
if old.aliases then
for i, alias in ipairs(old.aliases) do
newData[alias] = new
end
end
end
return newData
end
local function main()
local pronunciation = makeData(require(PRONUNCIATION_MODULE))
local phonemes = makeData(require(PHONEME_MODULE))
-- Check that no pronunciation keys are also contained in the phonemes
-- data. This would cause silent, hard-to-debug errors if it went
-- unchecked, so make it cause a big red error message instead.
for id in pairs(pronunciation) do
if phonemes[id] then
error(string.format(
"duplicate ID '%s' found in %s and %s",
id,
PRONUNCIATION_MODULE,
PHONEME_MODULE
))
end
end
return {
pronunciation = pronunciation,
phonemes = phonemes,
}
end
return main()
63ca8m7vp9oj803ii5e38i1pq69wf9e
Module:IPAc-en/phonemes
828
47001902
1056735968
1056715274
2021-11-23T07:28:18Z
Nardog
5908908
Reverted 1 edit by [[Special:Contributions/Kwamikagami|Kwamikagami]] ([[User talk:Kwamikagami|talk]]): Please seek consensus first
Scribunto
text/plain
-- This module contains phoneme data for [[Module:IPAc-en]].
return {
-- CONSONANTS
{
code = "b",
label = "b",
tooltip = "'b' in 'buy'",
},
{
code = "d",
label = "d",
tooltip = "'d' in 'dye'",
},
{
code = "dj",
aliases = {"dy", "dʲ"},
label = "dj",
tooltip = "/dj/: 'd' in 'dew'",
},
{
code = "dʒ",
aliases = {"dZ", "ʤ"},
label = "dʒ",
tooltip = "/dʒ/: 'j' in 'jam'",
},
{
code = "ð",
aliases = {"D"},
label = "ð",
tooltip = "/ð/: 'th' in 'this'",
},
{
code = "f",
label = "f",
tooltip = "'f' in 'find'",
},
{
code = "ɡ",
aliases = {"g"},
label = "ɡ",
tooltip = "/ɡ/: 'g' in 'guy'",
},
{
code = "h",
label = "h",
tooltip = "'h' in 'hi'",
},
{
code = "hw",
aliases = {"ʍ"},
label = "hw",
tooltip = "/hw/: 'wh' in 'why'",
},
{
code = "j",
aliases = {"y"},
label = "j",
tooltip = "/j/: 'y' in 'yes'",
},
{
code = "k",
label = "k",
tooltip = "'k' in 'kind'",
},
{
code = "l",
label = "l",
tooltip = "'l' in 'lie'",
},
{
code = "lj",
aliases = {"ly", "lʲ"},
label = "lj",
tooltip = "/lj/: 'l' in 'lute'",
},
{
code = "m",
label = "m",
tooltip = "'m' in 'my'",
},
{
code = "n",
label = "n",
tooltip = "'n' in 'nigh'",
},
{
code = "nj",
aliases = {"ny", "nʲ"},
label = "nj",
tooltip = "/nj/: 'n' in 'new'",
},
{
code = "ŋ",
aliases = {"N", "ng"},
label = "ŋ",
tooltip = "/ŋ/: 'ng' in 'sing'",
},
{
code = "p",
label = "p",
tooltip = "'p' in 'pie'",
},
{
code = "r",
aliases = {"ɹ", "ɻ"},
label = "r",
tooltip = "'r' in 'rye'",
},
{
code = "s",
label = "s",
tooltip = "'s' in 'sigh'",
},
{
code = "sj",
aliases = {"sy", "sʲ"},
label = "sj",
tooltip = "/sj/: 's' in 'consume'",
},
{
code = "ʃ",
aliases = {"S", "sh"},
label = "ʃ",
tooltip = "/ʃ/: 'sh' in 'shy'",
},
{
code = "t",
label = "t",
tooltip = "'t' in 'tie'",
},
{
code = "tj",
aliases = {"ty", "tʲ"},
label = "tj",
tooltip = "/tj/: 't' in 'tune'",
},
{
code = "tʃ",
aliases = {"tS", "ʧ", "ch"},
label = "tʃ",
tooltip = "/tʃ/: 'ch' in 'China'",
},
{
code = "θ",
aliases = {"T"},
label = "θ",
tooltip = "/θ/: 'th' in 'thigh'",
},
{
code = "θj",
aliases = {"θy", "θʲ"},
label = "θj",
tooltip = "/θj/: 'th' in 'enthuse'",
},
{
code = "v",
label = "v",
tooltip = "'v' in 'vie'",
},
{
code = "w",
label = "w",
tooltip = "'w' in 'wind'",
},
{
code = "z",
label = "z",
tooltip = "'z' in 'zoom'",
},
{
code = "zj",
aliases = {"zy", "zʲ"},
label = "zj",
tooltip = "/zj/: 'Z' in 'Zeus'",
},
{
code = "ʒ",
aliases = {"Z", "zh"},
label = "ʒ",
tooltip = "/ʒ/: 's' in 'pleasure'",
},
-- VOWELS
{
code = "ɑː",
aliases = {"A:", "ɑ:", "aː", "a:"},
label = "ɑː",
tooltip = "/ɑː/: 'a' in 'father'",
},
{
code = "ɑːr",
aliases = {"ɑɹ", "aːr", "a:r", "ɑ:r", "ɑr"},
label = "ɑːr",
tooltip = "/ɑːr/: 'ar' in 'far'",
},
{
code = "ɒ",
aliases = {"Q"},
label = "ɒ",
tooltip = "/ɒ/: 'o' in 'body'",
},
{
code = "ɒr",
aliases = {"Qr"},
label = "ɒr",
tooltip = "/ɒr/: 'or' in 'moral'",
},
{
code = "æ",
aliases = {"ae", "{"},
label = "æ",
tooltip = "/æ/: 'a' in 'bad'",
},
{
code = "ær",
aliases = {"aer", "&r", "æɹ"},
label = "ær",
tooltip = "/ær/: 'arr' in 'marry'",
},
{
code = "aɪ",
aliases = {"ai", "aI"},
label = "aɪ",
tooltip = "/aɪ/: 'i' in 'tide'",
},
{
code = "aɪər",
aliases = {"aɪr", "aIr", "aɪə"},
label = "aɪər",
tooltip = "/aɪər/: 'ire' in 'fire'",
},
{
code = "aʊ",
aliases = {"au", "aU"},
label = "aʊ",
tooltip = "/aʊ/: 'ou' in 'mouth'",
},
{
code = "aʊər",
aliases = {"aʊr", "aUr", "aʊə", "aur"},
label = "aʊər",
tooltip = "/aʊər/: 'our' in 'hour'",
},
{
code = "ɛ",
aliases = {"E"},
label = "ɛ",
tooltip = "/ɛ/: 'e' in 'dress'",
},
{
code = "ɛr",
aliases = {"Er"},
label = "ɛr",
tooltip = "/ɛr/: 'err' in 'merry'",
},
{
code = "eɪ",
aliases = {"ei", "eI", "eː", "e:"},
label = "eɪ",
tooltip = "/eɪ/: 'a' in 'face'",
},
{
code = "ɛər",
aliases = {"eir", "eIr", "e@r", "E@r", "ɛɪɹ", "eɪr", "eːr", "e:r", "ɛəɹ", "ɛə", "ɛːr", "ɛ:r", "ɛː", "ɛ:", "E:", "E:r"},
label = "ɛər",
tooltip = "/ɛər/: 'are' in 'bare'",
},
{
code = "ɛəˈr",
aliases = {"ɛə'r", "eəˈr", "eə'r", "e@'r", "E@'r", "ɛːˈr", "E:'r"},
label = "ɛəˈr",
tooltip = "/ɛəˈr/: 'ere' in 'thereof'",
},
{
code = "ɛəˌr",
aliases = {"ɛə,r", "eəˌr", "eə,r", "E@,r", "E@%r", "e@,r", "e@%r", "ɛːˌr", "E:,r", "E:%r"},
label = "ɛəˌr",
tooltip = "/ɛəˌr/: 'ere' in 'thereof'",
},
{
code = "ɪ",
aliases = {"I", "ᵻ"},
label = "ɪ",
tooltip = "/ɪ/: 'i' in 'kit'",
},
{
code = "ɪr",
label = "ɪr",
tooltip = "/ɪr/: 'irr' in 'mirror'",
},
{
code = "iː",
aliases = {"i:"},
label = "iː",
tooltip = "/iː/: 'ee' in 'fleece'",
},
{
code = "ɪər",
aliases = {"i:r", "iːr", "I@r", "i@r", "ɪəɹ", "iːɹ", "ɪə"},
label = "ɪər",
tooltip = "/ɪər/: 'ear' in 'near'",
},
{
code = "ɪəˈr",
aliases = {"ɪə'r", "I@'r"},
label = "ɪəˈr",
tooltip = "/ɪəˈr/: 'er' in 'spheroidal'",
},
{
code = "ɪəˌr",
aliases = {"ɪə,r", "I@,r", "I@%r"},
label = "ɪəˌr",
tooltip = "/ɪəˌr/: 'er' in 'spheroidal'",
},
{
code = "oʊ",
aliases = {"o:", "oː", "ou", "oU", "@u", "@U", "əʊ", "əu", "oʊ-"},
label = "oʊ",
tooltip = "/oʊ/: 'o' in 'code'",
},
{
code = "ɔː",
aliases = {"O", "O:", "ɔ:", "ɒː", "Q:"},
label = "ɔː",
tooltip = "/ɔː/: 'au' in 'fraud'",
},
{
code = "ɔːr",
aliases = {"Or", "ɔɹ", "ɔ(r)", "ɔr", "ɔər", "oUr", "ɔəɹ", "ɔʊɹ", "oʊɹ", "oʊr", "oːr", "o:r", "ɔə", "ɔə(r)"},
label = "ɔːr",
tooltip = "/ɔːr/: 'ar' in 'war'",
},
{
code = "ɔɪ",
aliases = {"oj", "ɔj", "oi", "oɪ", "ɔi", "OI", "oy"},
label = "ɔɪ",
tooltip = "/ɔɪ/: 'oi' in 'choice'",
},
{
code = "ɔɪər",
aliases = {"ɔɪr", "oyr", "ɔɪə"},
label = "ɔɪər",
tooltip = "/ɔɪər/: 'oir' in 'coir'",
},
{
code = "ʊ",
aliases = {"U", "ᵿ"},
label = "ʊ",
tooltip = "/ʊ/: 'u' in 'push'",
},
{
code = "ʊr",
aliases = {"Ur"},
label = "ʊr",
tooltip = "/ʊr/: 'our' in 'courier'",
},
{
code = "uː",
aliases = {"u:"},
label = "uː",
tooltip = "/uː/: 'oo' in 'goose'",
},
{
code = "ʊər",
aliases = {"u:r", "uːr", "u@r", "U@r", "ʊəɹ", "ʊə"},
label = "ʊər",
tooltip = "/ʊər/: 'our' in 'tour'",
},
{
code = "ʊəˈr",
aliases = {"ʊə'r", "U@'r"},
label = "ʊəˈr",
tooltip = "/ʊəˈr/: 'ur' in 'plurality'",
},
{
code = "ʊəˌr",
aliases = {"ʊə,r", "U@,r", "U@%r"},
label = "ʊəˌr",
tooltip = "/ʊəˌr/: 'ur' in 'plurality'",
},
{
code = "ʌ",
aliases = {"V"},
label = "ʌ",
tooltip = "/ʌ/: 'u' in 'cut'",
},
{
code = "ʌr",
aliases = {"Vr", "ʌɹ"},
label = "ʌr",
tooltip = "/ʌr/: 'urr' in 'hurry'",
},
{
code = "ɜːr",
aliases = {"ɝː", "ɝ", "3r", "3:r", "əːr", "@:r", "ɜɹ", "ɜ(r)", "ɜr"},
label = "ɜːr",
tooltip = "/ɜːr/: 'ur' in 'fur'",
},
{
code = "ə",
aliases = {"@"},
label = "ə",
tooltip = "/ə/: 'a' in 'about'",
},
-- SYLLABIC CONSONANTS
{
code = "ər",
aliases = {"ɚ", "@r", "əɹ", "ə(r)"},
label = "ər",
tooltip = "/ər/: 'er' in 'letter'",
},
{
code = "əl",
aliases = {"@l", "ᵊl", "l̩"},
label = "əl",
tooltip = "/əl/: 'le' in 'bottle'",
},
{
code = "ən",
aliases = {"@n", "ᵊn", "n̩"},
label = "ən",
tooltip = "/ən/: 'on' in 'button'",
},
{
code = "əm",
aliases = {"@m", "ᵊm", "m̩"},
label = "əm",
tooltip = "/əm/: 'm' in 'rhythm'",
},
-- ARCHIPHONEMES
{
code = "i",
label = "i",
tooltip = "/i/: 'y' in 'happy'",
},
{
code = "u",
label = "u",
tooltip = "/u/: 'u' in 'influence'",
},
-- MARGINAL SEGMENTS
{
code = "x",
label = "x",
aliases = {"kh"},
tooltip = "/x/: 'ch' in 'loch'",
},
{
code = "ʔ",
aliases = {"?"},
label = "ʔ",
tooltip = "/ʔ/: the catch in 'uh-oh'",
},
{
code = "ɒ̃",
aliases = {"ɑ̃", "ɒ~", "ɑ~", "Q~"},
label = "ɒ̃",
tooltip = "/ɒ̃/: nasal 'an' in 'vin blanc'",
},
{
code = "æ̃",
aliases = {"ae~", "{~", "ã", "a~"},
label = "æ̃",
tooltip = "/æ̃/: nasal 'in' in 'vin blanc'",
},
{
code = "ɜː",
aliases = {"3", "3:", "ɜ:", "ɜ", "əː", "@:"},
label = "ɜː",
tooltip = "/ɜː/: r-less 'ur' in 'nurse'",
},
-- SUPRASEGMENTALS
{
code = "ˈ",
aliases = {"'", '"'},
label = "ˈ",
tooltip = "/ˈ/: primary stress follows",
},
{
code = "ˌ",
aliases = {",", "%"},
label = "ˌ",
tooltip = "/ˌ/: secondary stress follows",
},
{
code = ".",
aliases = {"·"},
label = ".",
tooltip = "/./: syllable break",
},
{
code = "#",
label = "#",
tooltip = "/#/: morpheme break",
},
{
code = "!",
label = "|",
tooltip = "/|/: prosodic break (minor)",
},
{
code = "!!",
aliases = {"‖"},
label = "‖",
tooltip = "/‖/: prosodic break (major)",
},
-- SEPARATORS
-- Tables without tooltip text are used as word separators. In addition to
-- not having any tooltip text in the template output, they are not
-- underlined.
{
code = "_",
label = "<span class=\"wrap\"> </span>",
},
{
code = "nbsp",
aliases = {" "},
label = " ",
},
{
code = ",_",
label = ",<span class=\"wrap\"> </span>",
},
{
code = "-",
aliases = {"–"},
label = "-",
},
{
code = "(",
label = "(",
},
{
code = ")",
label = ")",
},
-- This is useful for highly variable words in place names, which are not
-- important to transcribe.
{
code = "...",
label = " ...<span class=\"wrap\"> </span>",
},
-- Obsolete combinations, kept for compatibility
{
code = "juː",
label = "juː",
tooltip = "/juː/: 'u' in 'cute'",
},
{
code = "jʊər",
label = "jʊər",
tooltip = "/jʊər/: 'ure' in 'cure'",
},
}
rrm0atjuiucipgueuaoozhqg94awcpv
Module:IPAc-en/pronunciation
828
47002555
917958518
789271277
2019-09-26T09:16:18Z
Nardog
5908908
add "also" etc.
Scribunto
text/plain
-- This module contains pronunciation-key data for [[Module:IPAc-en]].
return {
{
code = 'lang',
text = 'English:'
},
{
code = 'pron',
text = ''
},
{
code = 'local',
text = 'locally'
},
{
code = 'ipa',
text = '[[International Phonetic Alphabet|IPA]]:'
},
{
code = 'also',
text = 'also'
},
{
code = 'uk',
text = '[[British English|UK]]:'
},
{
code = 'us',
text = '[[American English|US]]:'
},
{
code = 'uklang',
text = '[[British English]]:'
},
{
code = 'uslang',
text = '[[American English]]:'
},
{
code = 'ukalso',
text = '[[British English|UK]] also'
},
{
code = 'usalso',
text = '[[American English|US]] also'
},
{
code = 'alsouk',
text = 'also [[British English|UK]]:'
},
{
code = 'alsous',
text = 'also [[American English|US]]:'
},
}
skyneclm3gt9868iop1vpqel8zboas5
Module:Icon
828
45181164
1071452463
1065849124
2022-02-12T18:06:28Z
Hike395
11639
auto detect calls from sandbox
Scribunto
text/plain
-- This module implements [[Template:Icon]].
require("Module:No globals")
local yesNo = require("Module:Yesno")
local getArgs = require("Module:Arguments").getArgs
local getPlain = nil
local p = {}
-- Determine whether we're being called from a sandbox
local sandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true) and '/sandbox' or ''
-- Implements [[Template:Icon]]
-- Returns the icon image corresponding to a string (like 'B')
function p._main(args, data)
local data_module = 'Module:Icon/data'..sandbox
data = data or mw.loadData(data_module)
local code = args.class or args[1]
local iconData
if code then
code = code:match('^%s*(.-)%s*$'):lower() -- trim whitespace and put in lower case
iconData = data[code]
end
if not iconData then
iconData = data._DEFAULT
end
return string.format(
'[[File:%s%s%s|%s|class=noviewer|alt=%s]]',
iconData.image,
iconData.tooltip and '|' .. iconData.tooltip or '',
iconData.link == false and '|link=' or '',
args.size or '16x16px',
iconData.alt or ''
)
end
-- Implements [[Template:Icon link]], a superset of [[Template:Icon]]
-- Returns an icon, plus a suitably formatted wikilink
function p._link(args, data)
args.size = args.size or args.iconsize
local icon = p._main(args, data)
-- If no link given in args[2], default back to [[Template:Icon]]
if not args[2] then
return icon
end
-- Strip wiki markup out of link
getPlain = getPlain or require("Module:Text").Text().getPlain
local link = getPlain(args[2])
local display = args[3] or args[2]
-- italicize display string, if requested
if yesNo(args.i) or yesNo(args.italic) or yesNo(args.italics) then
display = '<i>'..display..'</i>'
end
-- if display is link, just use standard wlink
if link == display then
return icon..' [['..link..']]'
end
return icon..' [['..link..'|'..display..']]'
end
function p.main(frame)
local args = getArgs(frame,{parentFirst=true})
return p._main(args)
end
function p.link(frame)
local args = getArgs(frame,{parentFirst=true})
return p._link(args)
end
return p
oedy9ta9fav8cqa69xr16gkuaqylbz1
Module:Icon/data
828
45181103
1093143076
1059465581
2022-06-14T20:47:26Z
Paine Ellsworth
9092818
per edit request on talk page - include image for Picture of the Day
Scribunto
text/plain
-- This module stores icon data for [[Module:Icon]].
--------------------------------------------------------------------------------
-- Icon data
--------------------------------------------------------------------------------
local data = {
fa = {
image = "Featured article star.svg",
tooltip = "Featured article",
link = true,
},
far = {
image = "Cscr-star piece.png",
tooltip = "Featured article review",
link = true,
},
farc = {
image = "Cscr-star piece.png",
tooltip = "Featured article removal candidate",
link = true,
},
ffa = {
aliases = {"dfa"},
image = "Featured article star - cross.svg",
tooltip = "Former featured article",
link = true,
},
fac = {
aliases = {"fan"},
image = "Cscr-candidate.svg",
tooltip = "Featured article candidate",
link = true,
},
ffac = {
aliases = {"nofa"},
image = "Featured article star - cross.svg",
tooltip = "Failed featured article candidate",
link = true,
},
fl = {
image = "Featured article star.svg",
tooltip = "Featured list",
link = true,
},
flrc = {
aliases = {"flr"},
image = "Cscr-star piece.png",
tooltip = "Featured list removal candidate",
link = true,
},
ffl = {
aliases = {"dfl"},
image = "Cscr-featured-strike.svg",
tooltip = "Former featured list",
link = true,
},
flc = {
aliases = {"fln"},
image = "Cscr-candidate.svg",
tooltip = "Featured list candidate",
link = true,
},
fflc = {
aliases = {"nofl"},
image = "Cscr-former.svg",
tooltip = "Failed featured list candidate",
link = true,
},
a = {
image = "Symbol a class.svg",
tooltip = "A-Class article",
link = true,
},
dac = {
aliases = {"daa"},
image = "Symbol unsupport A vote.svg",
tooltip = "Demoted A-Class article",
link = true,
},
acc = {
aliases = {"acn", "aac"},
image = "A candidate.svg",
tooltip = "A-Class article candidate",
link = true,
},
noac = {
aliases = {"faac"},
image = "Symbol unsupport A vote.svg",
tooltip = "Failed A-Class article candidate",
link = true,
},
ga = {
image = "Symbol support vote.svg",
tooltip = "Good article",
link = false,
},
gar = {
image = "GA Candidate Neutral vote(ChaosNil).svg",
tooltip = "Good article reassessment",
link = false,
},
dga = {
image = "Symbol unsupport vote.svg",
tooltip = "Delisted good article",
link = false,
},
gan = {
aliases = {"gac"},
image = "GA candidate.svg",
tooltip = "Good article nominee",
link = false,
},
ga2 = {
image = "Symbol neutral vote.svg",
tooltip = "Good article, 2nd opinion",
link = false,
},
gah = {
image = "Symbol wait.svg",
tooltip = "Good article on hold",
link = false,
},
fgan = {
aliases = {"noga", "gaf", "gf"},
image = "Symbol oppose vote.svg",
tooltip = "Failed good article nominee",
link = false,
},
fp = {
image = "Cscr-featured.svg",
tooltip = "Featured picture",
link = true,
},
fpc = {
aliases = {"fpn"},
image = "Cscr-candidate.svg",
tooltip = "Featured picture candidate",
link = true,
},
ffp = {
image = "Cscr-former.svg",
tooltip = "Former featured picture",
link = true,
},
vp = {
image = "ENWP VP Logo.svg",
tooltip = "Valued picture",
link = true,
},
vpc = {
image = "Valued pics 1.svg",
tooltip = "Valued picture candidate",
link = true,
},
fs = {
image = "Cscr-featured.svg",
tooltip = "Featured sound",
link = true,
},
ffs = {
image = "Cscr-former.svg",
tooltip = "Former featured sound",
link = true,
},
fsc = {
image = "Cscr-candidate.svg",
tooltip = "Featured sound candidate",
link = true,
},
fpo = {
image = "Linecons big-star.svg",
tooltip = "Before the featured portal process ceased in 2017, this had been designated as a featured portal.",
link = true,
},
fpor = {
image = "Cscr-star piece.png",
tooltip = "Featured portal review",
link = true,
},
ffpo = {
image = "Featured article star - cross.svg",
tooltip = "Former featured portal",
link = true,
},
fpoc = {
image = "Cscr-candidate.svg",
tooltip = "Featured portal candidate",
link = true,
},
ft = {
image = "Cscr-featuredtopic.svg",
tooltip = "Featured topic",
link = true,
},
ftrc = {
image = "Cscr-star piece.png",
tooltip = "Featured topic removal candidate",
link = true,
},
fft = {
aliases = {"dft"},
image = "DFT candidate_cluster.svg",
tooltip = "Former featured topic",
link = true,
},
ftc = {
aliases = {"ftn"},
image = "FT candidate cluster.svg",
tooltip = "Featured topic candidate",
link = false,
},
gt = {
image = "Support cluster.svg",
tooltip = "Good topic",
link = false,
},
gtrc = {
image = "Symbol unsupport vote.svg",
tooltip = "Good topic removal candidate",
link = false,
},
gtc = {
aliases = {"gtn"},
image = "GA candidate cluster.svg",
tooltip = "Good topic candidate",
link = false,
},
bplus = {
aliases = {"b+"},
image = "Symbol bplus class.svg",
tooltip = "Bplus-Class article",
link = true,
},
b = {
image = "Symbol b class.svg",
tooltip = "B-Class article",
link = true,
},
br = {
aliases = {"bcr"},
image = "Bclass-checklist.svg",
tooltip = "B-Class review",
link = true,
},
c = {
image = "Symbol c class.svg",
tooltip = "C-Class article",
link = true,
},
start = {
image = "Symbol start class.svg",
tooltip = "Start-Class article",
link = true,
},
stub = {
image = "Symbol stub class.svg",
tooltip = "Stub-Class article",
link = true,
},
list = {
aliases = {"comparison"},
image = "Symbol list class.svg",
tooltip = "List-Class article",
link = false,
},
no = {
image = "Crystal button cancel.svg",
tooltip = "Unknown-Class article",
link = true,
},
book = {
image = "Symbol book class2.svg",
tooltip = "Wikipedia book",
link = true,
},
category = {
aliases = {"cat", "categ"},
image = "Symbol category class.svg",
tooltip = "Category",
link = false,
},
disambiguation = {
aliases = {"dab", "disamb", "disambig"},
image = "Symbol dab class.svg",
tooltip = "Disambiguation page",
link = true,
},
image = {
aliases = {"file"},
image = "Symbol file class.svg",
tooltip = "File",
link = true,
},
needed = {
image = "Symbol needed class.svg",
tooltip = "Needed article",
link = false,
},
outline = {
image = "Global thinking.svg",
tooltip = "Outline",
link = false,
},
portal = {
image = "Symbol portal class.svg",
tooltip = "Portal",
link = true,
},
project = {
image = "Symbol project class.svg",
tooltip = "Project page",
link = false,
},
redirect = {
aliases = {"red", "redir"},
image = "Symbol redirect vote2.svg",
tooltip = "Redirect",
link = true,
},
template = {
aliases = {"temp", "templ"},
image = "Symbol template class.svg",
tooltip = "Template",
link = false,
},
essay = {
image = "Essay.svg",
tooltip = "Essay",
link = false,
},
na = {
image = "Symbol na class.svg",
tooltip = "Non-article page",
link = true,
},
aa = {
image = "Yes check.svg",
tooltip = "Audited article of limited subject matter",
link = false,
},
da = {
image = "Symbol oppose vote.svg",
tooltip = "Demoted article",
link = false,
},
dyk = {
image = "Symbol question.svg",
tooltip = "Did You Know?",
link = false,
},
dyk2 = {
image = "DYK questionmark icon.svg",
tooltip = "Did You Know?",
link = false,
},
pr = {
image = "Nuvola apps kedit.png",
tooltip = "Peer review",
link = true,
},
ppr = {
image = "Nuvola apps kedit.png",
tooltip = "Portal peer review",
link = true,
},
q = {
aliases = {"question"},
image = "Symbol question.svg",
tooltip = "Question",
link = false,
},
cleanup = {
image = "Edit-clear.svg",
tooltip = "Cleanup work",
link = false,
},
qi = {
image = "Quality images logo.svg",
tooltip = "Quality image on Wikimedia Commons",
link = false,
},
vi = {
image = "Valued image seal.svg",
tooltip = "Valued image on Wikimedia Commons",
link = false,
},
tfa = {
image = "Wikipedia-logo.svg",
tooltip = "Today's Featured Article",
link = true,
},
tfl = {
image = "Wikipedia-logo.svg",
tooltip = "Today's Featured List",
link = true,
},
itn = {
image = "Globe current.svg",
tooltip = "In The News",
link = true,
},
otd = {
image = "Nuvola apps date.svg",
tooltip = "On This Day",
link = true,
},
wikiproject = {
image = "People icon.svg",
tooltip = "WikiProject",
link = false,
},
goce = {
image = "Writing Magnifying.PNG",
tooltip = "Guild of Copy Editors",
link = true,
},
wikipedia = {
image = "Wikipedia-logo.svg",
tooltip = "Wikipedia page",
link = true,
},
commons = {
image = "Commons-logo.svg",
tooltip = "Commons page",
link = false,
},
wikiquote = {
image = "Wikiquote-logo.svg",
tooltip = "Wikiquote page",
link = false,
},
wikiversity = {
image = "Wikiversity logo 2017.svg",
tooltip = "Wikiversity page",
link = true,
},
wikibooks = {
image = "Wikibooks-logo.svg",
tooltip = "Wikibooks page",
link = true,
},
wikisource = {
image = "Wikisource-logo.svg",
tooltip = "Wikisource page",
link = true,
},
wiktionary = {
image = "Wiktionary-logo.svg",
tooltip = "Wiktionary page",
link = true,
},
wikinews = {
image = "Wikinews-logo.svg",
tooltip = "Wikinews page",
link = true,
},
wikispecies = {
image = "Wikispecies-logo.svg",
tooltip = "Wikispecies page",
link = true,
},
wikidata = {
image = "Wikidata-logo.svg",
tooltip = "Wikidata page",
link = false,
},
wikivoyage = {
image = "Wikivoyage-logo.svg",
tooltip = "Wikivoyage page",
link = true,
},
meta = {
image = "Wikimedia Community Logo.svg",
tooltip = "Meta-wiki page",
link = false,
},
four = {
image = "Four Award.svg",
tooltip = "Four Award",
link = false,
},
million = {
image = "Million award logo.svg",
tooltip = "Million Award",
link = true,
},
module = {
image = "Lua-logo-nolabel.svg",
tooltip = "Module",
link = false,
},
vital = {
image = "Círculos_Concéntricos.svg",
tooltip = "Vital article",
link = false,
},
potd = {
image = "Wikipedia-logo.svg",
tooltip = "Picture of the Day",
link = true,
},
_DEFAULT = {
image = "Symbol question.svg",
link = false,
}
}
--------------------------------------------------------------------------------
-- End icon data
--------------------------------------------------------------------------------
-- Make aliases work the same as normal keys, and remove the "aliases" subtables.
local ret= {}
for code, iconData in pairs(data) do
iconData.canonicalCode = code
if iconData.aliases then
for _, alias in ipairs(iconData.aliases) do
ret[alias] = iconData
end
iconData.aliases = nil
end
ret[code] = iconData
end
return ret
9ov9rtyq71ttl18igrgngo1btnp2h1o
Module:If preview
828
50528450
1021623961
921781789
2021-05-05T19:01:42Z
Izno
2927383
merge in functionality from [[Module:Preview warning]] and add TemplateStyles, remove p.boolean as not necessary, move some stuff into a cfg page, and don't return temporaries in p.main, remove use
Scribunto
text/plain
local p = {}
local cfg = mw.loadData('Module:If preview/configuration')
--[[
main
This function returns either the first argument or second argument passed to
this module, depending on whether the page is being previewed.
]]
function p.main(frame)
if cfg.preview then
return frame.args[1] or ''
else
return frame.args[2] or ''
end
end
--[[
pmain
This function returns either the first argument or second argument passed to
this module's parent (i.e. template using this module), depending on whether it
is being previewed.
]]
function p.pmain(frame)
return p.main(frame:getParent())
end
local function warning_text(warning)
return mw.ustring.format(
cfg.warning_infrastructure,
cfg.templatestyles,
warning
)
end
function p._warning(args)
local warning = args[1] and args[1]:match('^%s*(.-)%s*$') or ''
if warning == '' then
return warning_text(cfg.missing_warning)
end
if not cfg.preview then return '' end
return warning_text(warning)
end
--[[
warning
This function returns a "preview warning", which is the first argument marked
up with HTML and some supporting text, depending on whether the page is being previewed.
disabled since we'll implement the template version in general
]]
--function p.warning(frame)
-- return p._warning(frame.args)
--end
--[[
warning, but for pass-through templates like {{preview warning}}
]]
function p.pwarning(frame)
return p._warning(frame:getParent().args)
end
return p
i2018hg2i8x3uajzdhhh7yzkknltvcf
Module:If preview/configuration
828
67576715
1021623080
1021485513
2021-05-05T18:56:00Z
Izno
2927383
Protected "[[Module:If preview/configuration]]": match parent ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
--[[
We perform the actual check for whether this is a preview here since
preprocessing is relatively expensive.
]]
local frame = mw.getCurrentFrame()
local function is_preview()
local revision_id = frame:preprocess('{{REVISIONID}}')
-- {{REVISIONID}} is usually the empty string when previewed.
-- I don't know why we're checking for nil but hey, maybe someday things
-- would have broken
return revision_id == nil or revision_id == ''
end
local function templatestyles()
return frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:If preview/styles.css' }
}
end
return {
preview = is_preview(),
templatestyles = templatestyles(),
warning_infrastructure = '%s<div class="preview-warning"><strong>Preview warning:</strong> %s</div>',
missing_warning = 'The template has no warning text. Please add a warning.'
}
7ccf9c7e3yxw9p4ke6iw4ndcfniweno
Module:If preview/styles.css
828
67114415
1021623196
1021623144
2021-05-05T18:56:47Z
Izno
2927383
pp
sanitized-css
text/css
/* {{pp|small=yes}} */
.preview-warning {
font-style: italic;
/* @noflip */
padding-left: 1.6em;
margin-bottom: 0.5em;
color: red;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.preview-warning + link + .preview-warning {
margin-top: -0.5em;
}
gaiz1uhqgmf5elgq82yqqfll7kgcbwe
Module:Infobox
828
38808424
1055523885
1055523835
2021-11-16T10:29:48Z
Fayenatic london
1639942
spacing
Scribunto
text/plain
local p = {}
local args = {}
local origArgs = {}
local root
local empty_row_categories = {}
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'
local has_rows = false
local function fixChildBoxes(sval, tt)
local function notempty( s ) return s and s:match( '%S' ) end
if notempty(sval) then
local marker = '<span class=special_infobox_marker>'
local s = sval
-- start moving templatestyles and categories inside of table rows
local slast = ''
while slast ~= s do
slast = s
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
end
-- end moving templatestyles and categories inside of table rows
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)
if s:match(marker) then
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1')
s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1')
s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1')
end
if s:match(marker) then
local subcells = mw.text.split(s, marker)
s = ''
for k = 1, #subcells do
if k == 1 then
s = s .. subcells[k] .. '</' .. tt .. '></tr>'
elseif k == #subcells then
local rowstyle = ' style="display:none"'
if notempty(subcells[k]) then rowstyle = '' end
s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' ..
subcells[k]
elseif notempty(subcells[k]) then
if (k % 2) == 0 then
s = s .. subcells[k]
else
s = s .. '<tr><' .. tt .. ' colspan=2>\n' ..
subcells[k] .. '</' .. tt .. '></tr>'
end
end
end
end
-- the next two lines add a newline at the end of lists for the PHP parser
-- [[Special:Diff/849054481]]
-- remove when [[:phab:T191516]] is fixed or OBE
s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1')
s = mw.ustring.gsub(s, '^(%{%|)', '\n%1')
return s
else
return sval
end
end
-- Cleans empty tables
local function cleanInfobox()
root = tostring(root)
if has_rows == false then
root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '')
end
end
-- Returns the union of the values of two tables, as a sequence.
local function union(t1, t2)
local vals = {}
for k, v in pairs(t1) do
vals[v] = true
end
for k, v in pairs(t2) do
vals[v] = true
end
local ret = {}
for k, v in pairs(vals) do
table.insert(ret, k)
end
return ret
end
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix. For example, if the prefix was 'data', and
-- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.
local function getArgNums(prefix)
local nums = {}
for k, v in pairs(args) do
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
if num then table.insert(nums, tonumber(num)) end
end
table.sort(nums)
return nums
end
-- Adds a row to the infobox, with either a header cell
-- or a label/data cell combination.
local function addRow(rowArgs)
if rowArgs.header and rowArgs.header ~= '_BLANK_' then
has_rows = true
root
:tag('tr')
:addClass(rowArgs.rowclass)
:cssText(rowArgs.rowstyle)
:tag('th')
:attr('colspan', '2')
:addClass('infobox-header')
:addClass(rowArgs.class)
:addClass(args.headerclass)
-- @deprecated next; target .infobox-<name> .infobox-header
:cssText(args.headerstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.header, 'th'))
if rowArgs.data then
root:wikitext(
'[[Category:Pages using infobox templates with ignored data cells]]'
)
end
elseif rowArgs.data and rowArgs.data:gsub(
category_in_empty_row_pattern, ''
):match('^%S') then
has_rows = true
local row = root:tag('tr')
row:addClass(rowArgs.rowclass)
row:cssText(rowArgs.rowstyle)
if rowArgs.label then
row
:tag('th')
:attr('scope', 'row')
:addClass('infobox-label')
-- @deprecated next; target .infobox-<name> .infobox-label
:cssText(args.labelstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(rowArgs.label)
:done()
end
local dataCell = row:tag('td')
dataCell
:attr('colspan', not rowArgs.label and '2' or nil)
:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')
:addClass(rowArgs.class)
-- @deprecated next; target .infobox-<name> .infobox(-full)-data
:cssText(rowArgs.datastyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.data, 'td'))
else
table.insert(empty_row_categories, rowArgs.data or '')
end
end
local function renderTitle()
if not args.title then return end
has_rows = true
root
:tag('caption')
:addClass('infobox-title')
:addClass(args.titleclass)
-- @deprecated next; target .infobox-<name> .infobox-title
:cssText(args.titlestyle)
:wikitext(args.title)
end
local function renderAboveRow()
if not args.above then return end
has_rows = true
root
:tag('tr')
:tag('th')
:attr('colspan', '2')
:addClass('infobox-above')
:addClass(args.aboveclass)
-- @deprecated next; target .infobox-<name> .infobox-above
:cssText(args.abovestyle)
:wikitext(fixChildBoxes(args.above,'th'))
end
local function renderBelowRow()
if not args.below then return end
has_rows = true
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-below')
:addClass(args.belowclass)
-- @deprecated next; target .infobox-<name> .infobox-below
:cssText(args.belowstyle)
:wikitext(fixChildBoxes(args.below,'td'))
end
local function addSubheaderRow(subheaderArgs)
if subheaderArgs.data and
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
local row = root:tag('tr')
row:addClass(subheaderArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-subheader')
:addClass(subheaderArgs.class)
:cssText(subheaderArgs.datastyle)
:cssText(subheaderArgs.rowcellstyle)
:wikitext(fixChildBoxes(subheaderArgs.data, 'td'))
else
table.insert(empty_row_categories, subheaderArgs.data or '')
end
end
local function renderSubheaders()
if args.subheader then
args.subheader1 = args.subheader
end
if args.subheaderrowclass then
args.subheaderrowclass1 = args.subheaderrowclass
end
local subheadernums = getArgNums('subheader')
for k, num in ipairs(subheadernums) do
addSubheaderRow({
data = args['subheader' .. tostring(num)],
-- @deprecated next; target .infobox-<name> .infobox-subheader
datastyle = args.subheaderstyle,
rowcellstyle = args['subheaderstyle' .. tostring(num)],
class = args.subheaderclass,
rowclass = args['subheaderrowclass' .. tostring(num)]
})
end
end
local function addImageRow(imageArgs)
if imageArgs.data and
imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
local row = root:tag('tr')
row:addClass(imageArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-image')
:addClass(imageArgs.class)
:cssText(imageArgs.datastyle)
:wikitext(fixChildBoxes(imageArgs.data, 'td'))
else
table.insert(empty_row_categories, imageArgs.data or '')
end
end
local function renderImages()
if args.image then
args.image1 = args.image
end
if args.caption then
args.caption1 = args.caption
end
local imagenums = getArgNums('image')
for k, num in ipairs(imagenums) do
local caption = args['caption' .. tostring(num)]
local data = mw.html.create():wikitext(args['image' .. tostring(num)])
if caption then
data
:tag('div')
:addClass('infobox-caption')
-- @deprecated next; target .infobox-<name> .infobox-caption
:cssText(args.captionstyle)
:wikitext(caption)
end
addImageRow({
data = tostring(data),
-- @deprecated next; target .infobox-<name> .infobox-image
datastyle = args.imagestyle,
class = args.imageclass,
rowclass = args['imagerowclass' .. tostring(num)]
})
end
end
-- When autoheaders are turned on, preprocesses the rows
local function preprocessRows()
if not args.autoheaders then return end
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
local lastheader
for k, num in ipairs(rownums) do
if args['header' .. tostring(num)] then
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
lastheader = num
elseif args['data' .. tostring(num)] and
args['data' .. tostring(num)]:gsub(
category_in_empty_row_pattern, ''
):match('^%S') then
local data = args['data' .. tostring(num)]
if data:gsub(category_in_empty_row_pattern, ''):match('%S') then
lastheader = nil
end
end
end
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
end
-- Gets the union of the header and data argument numbers,
-- and renders them all in order
local function renderRows()
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
for k, num in ipairs(rownums) do
addRow({
header = args['header' .. tostring(num)],
label = args['label' .. tostring(num)],
data = args['data' .. tostring(num)],
datastyle = args.datastyle,
class = args['class' .. tostring(num)],
rowclass = args['rowclass' .. tostring(num)],
-- @deprecated next; target .infobox-<name> rowclass
rowstyle = args['rowstyle' .. tostring(num)],
rowcellstyle = args['rowcellstyle' .. tostring(num)]
})
end
end
local function renderNavBar()
if not args.name then return end
has_rows = true
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-navbar')
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
})
end
local function renderItalicTitle()
local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title'])
if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then
root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'}))
end
end
-- Categories in otherwise empty rows are collected in empty_row_categories.
-- This function adds them to the module output. It is not affected by
-- args.decat because this module should not prevent module-external categories
-- from rendering.
local function renderEmptyRowCategories()
for _, s in ipairs(empty_row_categories) do
root:wikitext(s)
end
end
-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
if args.decat == 'yes' then return end
if args.child == 'yes' then
if args.title then
root:wikitext(
'[[Category:Pages using embedded infobox templates with the title parameter]]'
)
end
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
root:wikitext('[[Category:Articles using infobox templates with no data rows]]')
end
end
--[=[
Loads the templatestyles for the infobox.
TODO: FINISH loading base templatestyles here rather than in
MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables.
See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :).
When we do this we should clean up the inline CSS below too.
Will have to do some bizarre conversion category like with sidebar.
]=]
local function loadTemplateStyles()
local frame = mw.getCurrentFrame()
-- See function description
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }
}
local templatestyles = ''
if args['templatestyles'] then templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] then child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
base_templatestyles, -- see function description
templatestyles,
child_templatestyles,
grandchild_templatestyles
})
end
-- common functions between the child and non child cases
local function structure_infobox_common()
renderSubheaders()
renderImages()
preprocessRows()
renderRows()
renderBelowRow()
renderNavBar()
renderItalicTitle()
renderEmptyRowCategories()
renderTrackingCategories()
cleanInfobox()
end
-- Specify the overall layout of the infobox, with special settings if the
-- infobox is used as a 'child' inside another infobox.
local function _infobox()
if args.child ~= 'yes' then
root = mw.html.create('table')
root
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
:addClass(args.bodyclass)
-- @deprecated next; target .infobox-<name>
:cssText(args.bodystyle)
renderTitle()
renderAboveRow()
else
root = mw.html.create()
root
:wikitext(args.title)
end
structure_infobox_common()
return loadTemplateStyles() .. root
end
-- If the argument exists and isn't blank, add it to the argument table.
-- Blank arguments are treated as nil to match the behaviour of ParserFunctions.
local function preprocessSingleArg(argName)
if origArgs[argName] and origArgs[argName] ~= '' then
args[argName] = origArgs[argName]
end
end
-- Assign the parameters with the given prefixes to the args table, in order, in
-- batches of the step size specified. This is to prevent references etc. from
-- appearing in the wrong order. The prefixTable should be an array containing
-- tables, each of which has two possible fields, a "prefix" string and a
-- "depend" table. The function always parses parameters containing the "prefix"
-- string, but only parses parameters in the "depend" table if the prefix
-- parameter is present and non-blank.
local function preprocessArgs(prefixTable, step)
if type(prefixTable) ~= 'table' then
error("Non-table value detected for the prefix table", 2)
end
if type(step) ~= 'number' then
error("Invalid step value detected", 2)
end
-- Get arguments without a number suffix, and check for bad input.
for i,v in ipairs(prefixTable) do
if type(v) ~= 'table' or type(v.prefix) ~= "string" or
(v.depend and type(v.depend) ~= 'table') then
error('Invalid input detected to preprocessArgs prefix table', 2)
end
preprocessSingleArg(v.prefix)
-- Only parse the depend parameter if the prefix parameter is present
-- and not blank.
if args[v.prefix] and v.depend then
for j, dependValue in ipairs(v.depend) do
if type(dependValue) ~= 'string' then
error('Invalid "depend" parameter value detected in preprocessArgs')
end
preprocessSingleArg(dependValue)
end
end
end
-- Get arguments with number suffixes.
local a = 1 -- Counter variable.
local moreArgumentsExist = true
while moreArgumentsExist == true do
moreArgumentsExist = false
for i = a, a + step - 1 do
for j,v in ipairs(prefixTable) do
local prefixArgName = v.prefix .. tostring(i)
if origArgs[prefixArgName] then
-- Do another loop if any arguments are found, even blank ones.
moreArgumentsExist = true
preprocessSingleArg(prefixArgName)
end
-- Process the depend table if the prefix argument is present
-- and not blank, or we are processing "prefix1" and "prefix" is
-- present and not blank, and if the depend table is present.
if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then
for j,dependValue in ipairs(v.depend) do
local dependArgName = dependValue .. tostring(i)
preprocessSingleArg(dependArgName)
end
end
end
end
a = a + step
end
end
-- Parse the data parameters in the same order that the old {{infobox}} did, so
-- that references etc. will display in the expected places. Parameters that
-- depend on another parameter are only processed if that parameter is present,
-- to avoid phantom references appearing in article reference lists.
local function parseDataParameters()
preprocessSingleArg('autoheaders')
preprocessSingleArg('child')
preprocessSingleArg('bodyclass')
preprocessSingleArg('subbox')
preprocessSingleArg('bodystyle')
preprocessSingleArg('title')
preprocessSingleArg('titleclass')
preprocessSingleArg('titlestyle')
preprocessSingleArg('above')
preprocessSingleArg('aboveclass')
preprocessSingleArg('abovestyle')
preprocessArgs({
{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}
}, 10)
preprocessSingleArg('subheaderstyle')
preprocessSingleArg('subheaderclass')
preprocessArgs({
{prefix = 'image', depend = {'caption', 'imagerowclass'}}
}, 10)
preprocessSingleArg('captionstyle')
preprocessSingleArg('imagestyle')
preprocessSingleArg('imageclass')
preprocessArgs({
{prefix = 'header'},
{prefix = 'data', depend = {'label'}},
{prefix = 'rowclass'},
{prefix = 'rowstyle'},
{prefix = 'rowcellstyle'},
{prefix = 'class'}
}, 50)
preprocessSingleArg('headerclass')
preprocessSingleArg('headerstyle')
preprocessSingleArg('labelstyle')
preprocessSingleArg('datastyle')
preprocessSingleArg('below')
preprocessSingleArg('belowclass')
preprocessSingleArg('belowstyle')
preprocessSingleArg('name')
-- different behaviour for italics if blank or absent
args['italic title'] = origArgs['italic title']
preprocessSingleArg('decat')
preprocessSingleArg('templatestyles')
preprocessSingleArg('child templatestyles')
preprocessSingleArg('grandchild templatestyles')
end
-- If called via #invoke, use the args passed into the invoking template.
-- Otherwise, for testing purposes, assume args are being passed directly in.
function p.infobox(frame)
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame
end
parseDataParameters()
return _infobox()
end
-- For calling via #invoke within a template
function p.infoboxTemplate(frame)
origArgs = {}
for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end
parseDataParameters()
return _infobox()
end
return p
0nrwbmsjupox6pg5hh6nvlk9r7dcw81
Module:Infobox/styles.css
828
68912159
1066479718
1063604326
2022-01-18T15:18:00Z
Jdlrobson
15999850
Fix [[phab:T281642]], a pet peeve of mine. This copies across styles from [[MediaWiki:Minerva.css]]
sanitized-css
text/css
/* {{pp|small=y}} */
/*
* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]]
* DO NOT ADD THEM HERE
*/
/*
* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/
.infobox-subbox {
padding: 0;
border: none;
margin: -3px;
width: auto;
min-width: 100%;
font-size: 100%;
clear: none;
float: none;
background-color: transparent;
}
.infobox-3cols-child {
margin: auto;
}
.infobox .navbar {
font-size: 100%;
}
/* T281642 */
body.skin-minerva .infobox-header,
body.skin-minerva .infobox-subheader,
body.skin-minerva .infobox-above,
body.skin-minerva .infobox-title,
body.skin-minerva .infobox-image,
body.skin-minerva .infobox-full-data,
body.skin-minerva .infobox-below {
text-align: center;
}
r79dlpm7l4hm8tdp6d2jr4blcsyis2v
Module:InfoboxImage
828
38581924
1076941680
1053736536
2022-03-13T19:18:18Z
WOSlinker
3138265
add class param from sandbox as per edit request
Scribunto
text/plain
-- Inputs:
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link
-- page - page to display for multipage images (DjVu)
-- size - size to display the image
-- maxsize - maximum size for image
-- sizedefault - default size to display the image if size param is blank
-- alt - alt text for image
-- title - title text for image
-- border - set to yes if border
-- center - set to yes, if the image has to be centered
-- upright - upright image param
-- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it
-- link - page to visit when clicking on image
-- class - HTML classes to add to the image
-- Outputs:
-- Formatted image.
-- More details available at the "Module:InfoboxImage/doc" page
local i = {};
local placeholder_image = {
"Blue - Replace this image female.svg",
"Blue - Replace this image male.svg",
"Female no free image yet.png",
"Flag of None (square).svg",
"Flag of None.svg",
"Flag of.svg",
"Green - Replace this image female.svg",
"Green - Replace this image male.svg",
"Image is needed female.svg",
"Image is needed male.svg",
"Location map of None.svg",
"Male no free image yet.png",
"Missing flag.png",
"No flag.svg",
"No free portrait.svg",
"No portrait (female).svg",
"No portrait (male).svg",
"Red - Replace this image female.svg",
"Red - Replace this image male.svg",
"Replace this image female (blue).svg",
"Replace this image female.svg",
"Replace this image male (blue).svg",
"Replace this image male.svg",
"Silver - Replace this image female.svg",
"Silver - Replace this image male.svg",
"Replace this image.svg",
"Cricket no pic.png",
"CarersLogo.gif",
"Diagram Needed.svg",
"Example.jpg",
"Image placeholder.png",
"No male portrait.svg",
"Nocover-upload.png",
"NoDVDcover copy.png",
"Noribbon.svg",
"No portrait-BFD-test.svg",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Sin bandera.svg",
"Sin escudo.svg",
"Replace this image - temple.png",
"Replace this image butterfly.png",
"Replace this image.svg",
"Replace this image1.svg",
"Resolution angle.png",
"Image-No portrait-text-BFD-test.svg",
"Insert image here.svg",
"No image available.png",
"NO IMAGE YET square.png",
"NO IMAGE YET.png",
"No Photo Available.svg",
"No Screenshot.svg",
"No-image-available.jpg",
"Null.png",
"PictureNeeded.gif",
"Place holder.jpg",
"Unbenannt.JPG",
"UploadACopyrightFreeImage.svg",
"UploadAnImage.gif",
"UploadAnImage.svg",
"UploadAnImageShort.svg",
"CarersLogo.gif",
"Diagram Needed.svg",
"No male portrait.svg",
"NoDVDcover copy.png",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Noimage.gif",
}
function i.IsPlaceholder(image)
-- change underscores to spaces
image = mw.ustring.gsub(image, "_", " ");
assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil')
-- if image starts with [[ then remove that and anything after |
if mw.ustring.sub(image,1,2) == "[[" then
image = mw.ustring.sub(image,3);
image = mw.ustring.gsub(image, "([^|]*)|.*", "%1");
assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil')
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil")
-- remove prefix if exists
local allNames = mw.site.namespaces[6].aliases
allNames[#allNames + 1] = mw.site.namespaces[6].name
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
for i, name in ipairs(allNames) do
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
break
end
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
-- capitalise first letter
image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2);
for i,j in pairs(placeholder_image) do
if image == j then
return true
end
end
return false
end
function i.InfoboxImage(frame)
local image = frame.args["image"];
if image == "" or image == nil then
return "";
end
if image == " " then
return image;
end
if frame.args["suppressplaceholder"] ~= "no" then
if i.IsPlaceholder(image) == true then
return "";
end
end
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then
return "";
end
if mw.ustring.sub(image,1,2) == "[[" then
-- search for thumbnail images and add to tracking cat if found
local cat = "";
if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then
cat = "[[Category:Pages using infoboxes with thumbnail images]]";
end
return image .. cat;
elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then
return image;
elseif mw.ustring.sub(image,1,1) == "<" then
return image;
elseif mw.ustring.sub(image,1,5) == mw.ustring.char(127).."UNIQ" then
-- Found strip marker at begining, so pass don't process at all
return image;
elseif mw.ustring.sub(image,4,9) == "`UNIQ-" then
-- Found strip marker at begining, so pass don't process at all
return image;
else
local result = "";
local page = frame.args["page"];
local size = frame.args["size"];
local maxsize = frame.args["maxsize"];
local sizedefault = frame.args["sizedefault"];
local alt = frame.args["alt"];
local link = frame.args["link"];
local title = frame.args["title"];
local border = frame.args["border"];
local upright = frame.args["upright"] or "";
local thumbtime = frame.args["thumbtime"] or "";
local center = frame.args["center"];
local class = frame.args["class"];
-- remove prefix if exists
local allNames = mw.site.namespaces[6].aliases
allNames[#allNames + 1] = mw.site.namespaces[6].name
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
for i, name in ipairs(allNames) do
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
break
end
end
if maxsize ~= "" and maxsize ~= nil then
-- if no sizedefault then set to maxsize
if sizedefault == "" or sizedefault == nil then
sizedefault = maxsize
end
-- check to see if size bigger than maxsize
if size ~= "" and size ~= nil then
local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0;
local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0;
if sizenumber>maxsizenumber and maxsizenumber>0 then
size = maxsize;
end
end
end
-- add px to size if just a number
if (tonumber(size) or 0) > 0 then
size = size .. "px";
end
-- add px to sizedefault if just a number
if (tonumber(sizedefault) or 0) > 0 then
sizedefault = sizedefault .. "px";
end
result = "[[File:" .. image;
if page ~= "" and page ~= nil then
result = result .. "|page=" .. page;
end
if size ~= "" and size ~= nil then
result = result .. "|" .. size;
elseif sizedefault ~= "" and sizedefault ~= nil then
result = result .. "|" .. sizedefault;
else
result = result .. "|frameless";
end
if center == "yes" then
result = result .. "|center"
end
if alt ~= "" and alt ~= nil then
result = result .. "|alt=" .. alt;
end
if link ~= "" and link ~= nil then
result = result .. "|link=" .. link;
end
if border == "yes" then
result = result .. "|border";
end
if upright == "yes" then
result = result .. "|upright";
elseif upright ~= "" then
result = result .. "|upright=" .. upright;
end
if thumbtime ~= "" then
result = result .. "|thumbtime=" .. thumbtime;
end
if class ~= nil and class ~= "" then
result = result .. "|class=" .. class;
end
-- if alt value is a keyword then do not use as a description
if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then
alt = nil;
end
if title ~= "" and title ~= nil then
-- does title param contain any templatestyles? If yes then set to blank.
if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then
title = nil;
end
end
if title ~= "" and title ~= nil then
result = result .. "|" .. title;
end
result = result .. "]]";
return result;
end
end
return i;
1qnfhbaitrn7lf4l4ypjcfzdf5a9lxe
Module:Internet Archive
828
44041774
866315086
833191559
2018-10-29T16:35:53Z
Amorymeltzer
141948
Changed protection level for "[[Module:Internet Archive]]": [[WP:High-risk templates|High-risk Lua module]]: Bump to TE-protection to match [[Template:Internet Archive author]], which has ~ 17k transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
--[[
For functions related to Internet Archive
Notes:
1. Internet Archive runs Elasticsearch search engine as of 4 Nov 2015
2. Program flowchart:
Break name down into number of words
Build a base URL based on number of words (1,2,3,4,5+), use of sopt=t switch, and availability of birth-death dates
If any words contain extended-ascii characters
append extra code for wildcards based on sopt=t or w
return finished URL
3. URL length should not exceed 2000 characters or it will break certain popular browsers
4. Wildcard (*) replacements should be avoided in the first letter of the first word, and with any single-letter words
5. Changing search formulations will have impacts on existing uses of the template and off-line tools which are optimized for these search recipes.
]]
local p = {}
--[[
For Template:Internet Archive author
]]
function p.author(frame)
local pframe = frame:getParent()
local args = pframe.args
local tname = "Internet Archive author" -- name of calling template. Change if template rename.
local name = nil -- article name (default: current page name)
dname = nil -- display name (default: current page name)
local sname = nil -- search name (default: current page name)
local sopt = nil -- search options (default: nil)
byabout = "Works by or about"
tagline = "at [[Internet Archive]]"
urlhead = "https://archive.org/search.php?query="
mydate = "" -- birth-death date
--- Determine name
name = trimArg(args.name) -- When using template outside main article space, the 'name' parameter is required (not optional)
if not name then
name = mw.title.getCurrentTitle().text
end
dname = mw.ustring.gsub(name,'%s+%([^%(]-%)$', '') -- Remove the final disambig parentheses
sname = dname
if trimArg(args.sname) then
sname = trimArg(args.sname)
end
if trimArg(args.dname) then
dname = trimArg(args.dname)
end
--- Determine search option
sopt = trimArg(args.sopt)
if sopt then
sopt = mw.ustring.lower(sopt)
if sopt == "tight" then sopt = "t" end
if sopt == "tightx" then sopt = "tx" end
if sopt == "wild" then sopt = "w" end
if sopt ~= "t" and sopt ~= "tx" and sopt ~= "w" then sopt = "unknown" end
end
--- Determine tagline
if trimArg(args.coda) then
tagline = tagline .. " " .. trimArg(args.coda)
end
--- Custom search. Do early to avoid unnecessary processing.
if trimArg(args.search) then
local search = p.ia_url_encode(trimArg(args.search))
return "[" .. urlhead .. search .. " " .. byabout .. " " .. dname .. "] " .. tagline
end
-- Determine media string
media = p.mediaTypes(args.media)
if media == "" then
mediaopen = "%28" -- added a default mediatype Dec 2015 see p.mediaTypes()
else
mediaopen = "%28"
end
-- Determine date of birth and death
local temp = mw.text.split(p.bdDate(args.birth, args.death, name), " ")
local birth = temp[1]
local death = temp[2]
if birth == "Error" or death == "Error" then
return "Error in [[:Template:"..tname.."]]: [[" ..name.. "]] doesn't exist."
end
--- Split sname into words and count words
local N = mw.text.split(sname, " ")
local l, count = mw.ustring.gsub(sname, "%S+", "")
if count == 0 then
return "Error in [[:Template:"..tname.."]]: Zero-word name."
end
--- Date string
if birth ~= "none" and death ~= "none" then
if p.ia_extendedascii(N[count]) == 1 then
mydate = "%20OR%20%28%22"..birth.."-"..death.."%22%20AND%20%28%22"..p.urlX(N[count]).."%22%20OR%20"..p.urlX(p.ia_deaccent(N[count])).."%29%29"
else
mydate = "%20OR%20%28%22"..birth.."-"..death.."%22%20AND%20"..p.urlX(N[count]).."%29"
end
end
--- wild string
wild = "%29"
if sopt == "w" and p.ia_extendedascii(sname) == 1 then
if p.wildcheck(N, count) == 1 then
myurl = p.wildfix(N, count)
return p.IArender()
end
if count < 3 or count > 3 then
-- (first last)
wild = "%20OR%20%28" .. p.ia_url_encode(p.ia_extendedascii2wildcard(sname)) .. "%29%29"
end
if count == 3 then
-- (first last)
wild = "%20OR%20%28" .. p.ia_url_encode(p.ia_extendedascii2wildcard(N[1])) .. "%20" .. p.ia_url_encode(p.ia_extendedascii2wildcard(N[3])) .. "%29%29"
end
end
--[[
Format URL
]]
if count == 1 then
myurl = p.oneWord(sname)
if sopt == "t" and p.ia_extendedascii(sname) == 1 then
local plainname = p.ia_deaccent(sname)
local A1 = "%20OR%20%22"..p.urlX(plainname)
myurl = myurl .. A1 .. "%22"
return p.IArender()
end
return p.IArender()
end
if count == 2 then
myurl = p.twoWords(N, sopt)
if sopt == "t" and p.ia_extendedascii(sname) == 1 then
local plainname = p.ia_deaccent(sname)
local PN = mw.text.split(plainname, " ")
-- Last, First
local A1 = "%20OR%20%22"..p.urlX(PN[2]).."%2C%20"..p.urlX(PN[1])
-- First Last
local A2 = "%22%20OR%20%22"..p.urlX(PN[1]).."%20"..p.urlX(PN[2])
myurl = myurl .. A1 .. A2 .. "%22"
return p.IArender()
end
return p.IArender()
end
if count == 3 then
myurl = p.threeWords(N, sopt)
if sopt == "t" and p.ia_extendedascii(sname) == 1 then
local plainname = p.ia_deaccent(sname)
local PN = mw.text.split(plainname, " ")
local FIRST = p.urlX(PN[1])
local MIDDLE = p.urlX(PN[2])
local LAST = p.urlX(PN[3])
local firstinitialp = p.urlX( p.firstLetter(PN[1]) )
local middleinitialp = p.urlX( p.firstLetter(PN[2]) )
-- First Middle Last
local A1 = "%20OR%20%22"..FIRST.."%20"..MIDDLE.."%20"..LAST
-- Last, First Middle
local A2 = "%22%20OR%20%22"..LAST.."%2C%20"..FIRST.."%20"..MIDDLE
-- Last, First M.
local A3 = "%22%20OR%20%22"..LAST.."%2C%20"..FIRST.."%20"..middleinitialp.."%2E"
-- Last, F. M.
local A4 = "%22%20OR%20%22"..LAST.."%2C%20"..firstinitialp..".%20"..middleinitialp.."%2E"
local ALL = A1 .. A2 .. A3 .. A4 .. "%22"
myurl = myurl .. ALL
return p.IArender()
end
return p.IArender()
end
if count == 4 then
myurl = p.fourWords(N, sopt)
if sopt == "t" and p.ia_extendedascii(sname) == 1 then
local plainname = p.ia_deaccent(sname)
local PN = mw.text.split(plainname, " ")
local FIRST = p.urlX(PN[1])
local SECOND = p.urlX(PN[2])
local THIRD = p.urlX(PN[3])
local LAST = p.urlX(PN[4])
local firstinitialp = p.urlX( p.firstLetter(PN[1]) )
local secondinitialp = p.urlX( p.firstLetter(PN[2]) )
local thirdinitialp = p.urlX( p.firstLetter(PN[3]) )
-- Last, First Second Third
local A1 = "%20OR%20%22"..LAST.."%2C%20"..FIRST.."%20"..SECOND.."%20"..THIRD
-- First Second Third Last
local A2 = "%22%20OR%20%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- Last, F. S. T.
local A3 = "%22%20OR%20%22"..LAST.."%2C%20"..firstinitialp.."%2E%20"..secondinitialp.."%2E%20"..thirdinitialp.."%2E"
local ALL = A1 .. A2 .. A3 .. "%22"
myurl = myurl .. ALL
return p.IArender()
end
return p.IArender()
end
if count > 4 then
myurl = ""
if sopt == "w" and p.ia_extendedascii(sname) == 1 then
myurl = "%28"
end
myurl = myurl .. "%28" .. p.ia_url_encode(sname)
if sopt == "w" and p.ia_extendedascii(sname) == 1 then
myurl = myurl .. "%29"
end
if sopt == "t" and p.ia_extendedascii(sname) == 1 then
local plainname = p.ia_deaccent(sname)
local A1 = "%29%20OR%20%28"..p.ia_url_encode(plainname)
myurl = myurl .. A1
return p.IArender()
end
return p.IArender()
end
return "Unknown error (1). Please check documentation for [[Template:"..tname.."]]"
end
-- Build final output and render
function p.IArender()
return "[" .. urlhead .. mediaopen .. myurl .. wild .. mydate .. media .. " " .. byabout .. " " .. dname .. "] " .. tagline
end
function p.oneWord(sname)
local nameurl = p.ia_url_encode(sname)
local A1 = "%28subject%3A%22"..nameurl
local A2 = "%22%20OR%20creator%3A%22"..nameurl
local A3 = "%22%20OR%20description%3A%22"..nameurl
local A4 = "%22%20OR%20title%3A%22"..nameurl
return A1 .. A2 .. A3 .. A4 .. "%22"
end
function p.twoWords(N, sopt)
local FIRST = p.urlX(N[1])
local LAST = p.urlX(N[2])
local firstinitial = p.urlX( p.firstLetter(N[1]) )
-- Last, First
local S1 = "%28subject%3A%22"..LAST.."%2C%20"..FIRST
-- First Last
local S2 = "%22%20OR%20subject%3A%22"..FIRST.."%20"..LAST
local SALL = S1..S2
-- Last, First
local C1 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..FIRST
-- First Last
local C2 = "%22%20OR%20creator%3A%22"..FIRST.."%20"..LAST
local CALL = C1..C2
-- First Last
local T1 = "%22%20OR%20title%3A%22"..FIRST.."%20"..LAST
local TALL = T1
-- Last, First
local D1 = "%22%20OR%20description%3A%22"..LAST.."%2C%20"..FIRST
-- First Last
local D2 = "%22%20OR%20description%3A%22"..FIRST.."%20"..LAST
local DALL = D1..D2
if sopt == "t" or sopt == "tx" then
return SALL .. CALL .. TALL .. DALL .. "%22"
else
-- Last, F.
local C3 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..firstinitial.."%2E"
local CALL = CALL..C3
return SALL .. CALL .. TALL .. DALL .. "%22"
end
end
function p.threeWords(N, sopt)
-- CAUTION: The following is near the max 2000 character URL limit for most browsers when using long names
-- such as "René-Nicolas Dufriche Desgenettes".
local FIRST = p.urlX(N[1])
local MIDDLE = p.urlX(N[2])
local LAST = p.urlX(N[3])
local firstinitial = p.urlX( p.firstLetter(N[1]) )
local middleinitial = p.urlX( p.firstLetter(N[2]) )
-- Last, First Middle
local S1 = "%28subject%3A%22"..LAST.."%2C%20"..FIRST.."%20"..MIDDLE
-- Last, First M.
local S2 = "%22%20OR%20subject%3A%22"..LAST.."%2C%20"..FIRST.."%20"..middleinitial.."%2E"
-- Last, F. M.
local S3 = "%22%20OR%20subject%3A%22"..LAST.."%2C%20"..firstinitial.."%2E%20"..middleinitial.."%2E"
-- First Middle Last
local S4 = "%22%20OR%20subject%3A%22"..FIRST.."%20"..MIDDLE.."%20"..LAST
-- First M. Last
local S5 = "%22%20OR%20subject%3A%22"..FIRST.."%20"..middleinitial.."%2E%20"..LAST
-- F. M. Last
local S6 = "%22%20OR%20subject%3A%22"..firstinitial.."%2E%20"..middleinitial.."%2E%20"..LAST
local SALL = S1..S2..S3..S4..S5..S6
-- First Middle Last
local C1 = "%22%20OR%20creator%3A%22"..FIRST.."%20"..MIDDLE.."%20"..LAST
-- First M. Last
local C2 = "%22%20OR%20creator%3A%22"..FIRST.."%20"..middleinitial.."%2E%20"..LAST
-- F. M. Last
local C3 = "%22%20OR%20creator%3A%22"..firstinitial.."%2E%20"..middleinitial.."%2E%20"..LAST
-- F. Middle Last
local C4 = "%22%20OR%20creator%3A%22"..firstinitial.."%2E%20"..MIDDLE.."%20"..LAST
-- Last, First Middle
local C5 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..FIRST.."%20"..MIDDLE
-- Last, First M.
local C6 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..FIRST.."%20"..middleinitial.."%2E"
-- Last, F. M.
local C7 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..firstinitial.."%2E%20"..middleinitial.."%2E"
-- Last, F. M.
local C8 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..firstinitial.."%2E%20"..MIDDLE
local CALL = C1..C2..C3..C4..C5..C6..C7..C8
-- First Middle Last
local T1 = "%22%20OR%20title%3A%22"..FIRST.."%20"..MIDDLE.."%20"..LAST
-- First M. Last
local T2 = "%22%20OR%20title%3A%22"..FIRST.."%20"..middleinitial.."%2E%20"..LAST
-- F. M. Last
local T3 = "%22%20OR%20title%3A%22"..firstinitial.."%2E%20"..middleinitial.."%2E%20"..LAST
local TALL = T1..T2..T3
-- First Middle Last
local D1 = "%22%20OR%20description%3A%22"..FIRST.."%20"..MIDDLE.."%20"..LAST
-- First M. Last
local D2 = "%22%20OR%20description%3A%22"..FIRST.."%20"..middleinitial.."%2E%20"..LAST
-- F. M. Last
local D3 = "%22%20OR%20description%3A%22"..firstinitial.."%2E%20"..middleinitial.."%2E%20"..LAST
-- Last, First Middle
local D4 = "%22%20OR%20description%3A%22"..LAST.."%2C%20"..FIRST.."%20"..MIDDLE
-- Last, First M.
local D5 = "%22%20OR%20description%3A%22"..LAST.."%2C%20"..FIRST.."%20"..middleinitial.."%2E"
local DALL = D1..D2..D3..D4..D5
if sopt == "t" or sopt == "tx" then
return SALL .. CALL .. TALL .. DALL .. "%22"
else
-- Last, First
local S7 = "%22%20OR%20subject%3A%22"..LAST.."%2C%20"..FIRST
-- First Last
local S8 = "%22%20OR%20subject%3A%22"..FIRST.."%20"..LAST
local SALL = SALL..S7..S8
-- First Last
local C9 = "%22%20OR%20creator%3A%22"..FIRST.."%20"..LAST
-- Last, First
local C10 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..FIRST
local CALL = CALL..C9..C10
-- First Last
local T4 = "%22%20OR%20title%3A%22"..FIRST.."%20"..LAST
local TALL = TALL..T4
-- First Last
local D6 = "%22%20OR%20description%3A%22"..FIRST.."%20"..LAST
-- Last, First
local D7 = "%22%20OR%20description%3A%22"..LAST.."%2C%20"..FIRST
local DALL = DALL..D6..D7
return SALL .. CALL .. TALL .. DALL .. "%22"
end
end
function p.fourWords(N, sopt)
local FIRST = p.urlX(N[1])
local SECOND = p.urlX(N[2])
local THIRD = p.urlX(N[3])
local LAST = p.urlX(N[4])
local firstinitial = p.firstLetter(N[1])
local secondinitial = p.firstLetter(N[2])
local thirdinitial = p.firstLetter(N[3])
if sopt == "t" or sopt == "tx" then
-- Last, First Second Third
local S1 = "%28subject%3A%22"..LAST.."%2C%20"..FIRST.."%20"..SECOND.."%20"..THIRD
-- First Second Third Last
local S2 = "%22%20OR%20subject%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- Last, First Second Third
local C1 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..FIRST.."%20"..SECOND.."%20"..THIRD
-- First Second Third Last
local C2 = "%22%20OR%20creator%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- First Second Third Last
local T1 = "%22%20OR%20title%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- First Second Third Last
local D1 = "%22%20OR%20description%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
return S1..S2..C1..C2..T1..D1.."%22"
end
-- Last, First Second Third
local S1 = "%28subject%3A%22"..LAST.."%2C%20"..FIRST.."%20"..SECOND.."%20"..THIRD
-- First Second Third Last
local S2 = "%22%20OR%20subject%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- Last, First Second Third
local C1 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..FIRST.."%20"..SECOND.."%20"..THIRD
-- First Second Third Last
local C2 = "%22%20OR%20creator%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- Last, F. S. T.
local C3 = "%22%20OR%20creator%3A%22"..LAST.."%2C%20"..firstinitial.."%2E%20"..secondinitial.."%2E%20"..thirdinitial.."%2E"
-- First Second Third Last
local T1 = "%22%20OR%20title%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
-- First Second Third Last
local D1 = "%22%20OR%20description%3A%22"..FIRST.."%20"..SECOND.."%20"..THIRD.."%20"..LAST
return S1..S2..C1..C2..C3..T1..D1.."%22"
end
-- ElasticSearch speed/resource problems if first letter of first word is "*" wildcard ie. accented letter
-- Build special search in these cases.
-- https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_wildcards
function p.wildfix(N, count)
--- Split along "-" and use only first word ie. John-Taylor-Smith becomes John
local NF = mw.text.split(N[1], "-")
local NL = mw.text.split(N[count], "-")
-- ..but use full name for 1-word names
if count == 1 then
NF[1] = N[1]
NL[1] = N[1]
end
-- ((Fïrst OR First) AND (Lást OR Last))
return "%28%28%22" .. NF[1] .. "%22%20OR%20" .. p.ia_deaccent(NF[1]) .. "%29%20AND%20%28%22" .. NL[1] .. "%22%20OR%20" .. p.ia_deaccent(NL[1]) .. "%29"
end
-- Return 1 if the first letter of first word, or any single-letter word, is extended ascii
function p.wildcheck(N, count)
local i = 0
-- first letter of first word is extended ascii
if N[1]:byte(1) < 32 or N[1]:byte(1) > 126 then return 1 end
-- any single-letter word that is composed of only extended ascii
while i < count do
i = i + 1
if N[i]:len() == 1 then
if N[i]:byte(1) < 32 or N[i]:byte(1) > 126 then return 1 end
end
end
return 0
end
function trimArg(arg)
if arg == "" or arg == nil then
return nil
else
return mw.text.trim(arg)
end
end
function p.mediaTypes(argsmedia)
-- Added a default mediatype Dec 2015 due to too many false positives in the software mediatype, caused by birth-death dates catching numbers in source codes
local media = "-mediatype:software"
if argsmedia ~="" and argsmedia ~=nil then
local medialist = mw.text.split(mw.text.trim(argsmedia), " ")
local al, acount = mw.ustring.gsub(mw.text.trim(argsmedia), "%S+", "")
local i = 0
repeat -- the following could be condensed but repetitive for clarity
i = i + 1
if(mw.ustring.lower(medialist[i]) == "text" or mw.ustring.lower(medialist[i]) == "texts") then
media = media .. p.ia_url_encode(" OR mediatype:texts")
end
if(mw.ustring.lower(medialist[i]) == "audio") then
media = media .. p.ia_url_encode(" OR mediatype:audio")
end
if(mw.ustring.lower(medialist[i]) == "video") then
media = media .. p.ia_url_encode(" OR mediatype:video")
end
until i == acount
end
media = "%29%20AND%20%28" .. media .. "%29"
return media
end
-- Alt way to get b/d dates via getContent()
function p.bdDateAlt(argsbirth, argsdeath, name)
local pagetext = nil
local birth = "none"
local death = "none"
-- Load the page
local t = mw.title.new(name)
if(t.exists) then
pagetext = t:getContent()
end
if pagetext == nil then
return "Error"
end
-- Remove false positives
pagetext = mw.ustring.gsub( mw.ustring.gsub(pagetext, "<!--.--->", ""), "<nowiki>.-</nowiki>", "")
-- "Category:1900 births"
if argsbirth == "" or argsbirth == nil then
local birthcheck = mw.ustring.match(pagetext, "%[%[%s-[Cc]ategory:%s-%d+%.?%d*%s-births%s-%]%]" )
if birthcheck ~= nil then
birth = mw.ustring.match(birthcheck, "%d+%.?%d*")
else
birth = "none"
end
else
birth = mw.text.trim(argsbirth)
end
-- "Category:2000 deaths"
if argsdeath == "" or argsdeath == nil then
local deathcheck = mw.ustring.match(pagetext, "%[%[%s-[Cc]ategory:%s-%d+%.?%d*%s-deaths%s-%]%]" )
if deathcheck ~= nil then
death = mw.ustring.match(deathcheck, "%d+%.?%d*")
else
death = "none"
end
else
death = mw.text.trim(argsdeath)
end
return birth .. " " .. death
end
-- Get b/d dates via Wikidata.
--
function p.bdDate(argsbirth, argsdeath, name)
local pagetext = nil
local birth = "none"
local death = "none"
entity = mw.wikibase.getEntityObject()
if not entity or not entity.claims then
-- Alternative if template not on a page in mainspace. This is needed since Wikidata can only be retrieved
-- for the article where the template is located.
return p.bdDateAlt(argsbirth, argsdeath, name)
end
-- Note: The below uses formatPropertyValues() to get and format the date from Wikidata.
-- For an alternative method, see sandbox revision dated 5:58 am, 15 October 2014
if argsbirth == "" or argsbirth == nil then
local birthtable = entity:formatPropertyValues( 'P569' )
local birthsplit = mw.text.split(birthtable["value"], " ")
local l, count = mw.ustring.gsub(birthtable["value"], "%S+", "")
if count > 0 then
if string.find(birthsplit[count], "^%d") then
birth = birthsplit[count]
elseif string.find(birthsplit[count], "BCE") then
birth = birthsplit[count - 1]
elseif string.find(birthsplit[count], "BC") then
birth = birthsplit[count - 1]
elseif string.find(birthsplit[count], "AD") then
birth = birthsplit[count - 1]
end
end
else
birth = mw.text.trim(argsbirth)
end
if argsdeath == "" or argsdeath == nil then
local deathtable = entity:formatPropertyValues( 'P570' )
local deathsplit = mw.text.split(deathtable["value"], " ")
local l, count = mw.ustring.gsub(deathtable["value"], "%S+", "")
if count > 0 then
if string.find(deathsplit[count], "^%d") then
death = deathsplit[count]
elseif string.find(deathsplit[count], "BCE") then
death = deathsplit[count - 1]
elseif string.find(deathsplit[count], "BC") then
death = deathsplit[count - 1]
elseif string.find(deathsplit[count], "AD") then
death = deathsplit[count - 1]
end
end
else
death = mw.text.trim(argsdeath)
end
if birth == "none" and death == "none" then
-- Alternative if Wikidata is missing data
-- return p.bdDateAlt(name)
return birth .. " " .. death
else
return birth .. " " .. death
end
end
--- URL-encode special characters
--- Note: this function was added later to deal with "&" characters instead of using p.ia_url_encode since
--- that may break existing instances of the template.
function p.urlX(str)
if (str) then
str = mw.ustring.gsub (str, "&", "%%26")
end
return str
end
--- URL-encode a string
--- http://lua-users.org/wiki/StringRecipes
---
function p.ia_url_encode(str)
if (str) then
str = mw.ustring.gsub (str, "\n", "\r\n")
str = mw.ustring.gsub (str, "([^%w %-%_%.%~])",
function (c) return mw.ustring.format ("%%%02X", string.byte(c)) end)
str = mw.ustring.gsub (str, " ", "+")
end
return str
end
-- Does str contain extended ascii? 1 = yes
function p.ia_extendedascii(str)
for i = 1, str:len() do
if (str:byte(i) >= 32 and str:byte(i) <= 126) and str:byte(i) ~= 39 then -- 39 = "'"
--do nothing
else
return 1
end
end
return 0
end
-- UTF-8 aware replacement for string.sub() which doesn't support UTF-8.
-- Note: Using instead of mw.ustring.sub() which I suspect(?) might be cause of intermittent error, and faster here for first-letter job.
-- Source: prapin @ Stack Overflow http://stackoverflow.com/questions/13235091/extract-the-first-letter-of-a-utf-8-string-with-lua
function p.firstLetter(str)
return str:match("[%z\1-\127\194-\244][\128-\191]*")
end
-- Replace all extended ascii characters with wildcard '*'
-- Replace "-" with <space> eg. Pierre-Jean -> Pierre Jean
function p.ia_extendedascii2wildcard(str)
local s = ""
local j = 0
local k = 0
for i = 1, str:len() do
k = str:byte(i)
if k >= 32 and k <= 126 then
-- For list of Lucene special characters needing to be escaped:
-- http://lucene.apache.org/core/4_10_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters
-- We only worry about - (45) and " (34) since the others are unlikely to appear in a proper name.
-- Also ' (39) since it is sometimes the extended character ’
if k == 34 or k == 39 then
s = s .. "*"
elseif k == 45 then
s = s .. " "
else
s = s .. str:sub(i,i)
end
else
if j == 1 then
s = s .. "*"
j = 2
end
if j == 0 then j = 1 end
if j == 2 then j = 0 end
end
end
return s
end
-- Replace accented letters with non-accented equivalent letters
-- Note: this is not a complete list of all possible accented letters. It is
-- all of the accented letters found in the first 10,000 names using
-- the Internet Archive author template.
function p.ia_deaccent(str)
local s = str
s = mw.ustring.gsub(s, "á", "a")
s = mw.ustring.gsub(s, "a︡", "a")
s = mw.ustring.gsub(s, "Á", "A")
s = mw.ustring.gsub(s, "ă", "a")
s = mw.ustring.gsub(s, "â", "a")
s = mw.ustring.gsub(s, "æ", "ae")
s = mw.ustring.gsub(s, "Æ", "AE")
s = mw.ustring.gsub(s, "à", "a")
s = mw.ustring.gsub(s, "ā", "a")
s = mw.ustring.gsub(s, "Ā", "A")
s = mw.ustring.gsub(s, "ą", "a")
s = mw.ustring.gsub(s, "å", "a")
s = mw.ustring.gsub(s, "Å", "A")
s = mw.ustring.gsub(s, "ã", "a")
s = mw.ustring.gsub(s, "ä", "a")
s = mw.ustring.gsub(s, "Ä", "A")
s = mw.ustring.gsub(s, "β", "B")
s = mw.ustring.gsub(s, "ć", "c")
s = mw.ustring.gsub(s, "č", "c")
s = mw.ustring.gsub(s, "Č", "C")
s = mw.ustring.gsub(s, "ç", "c")
s = mw.ustring.gsub(s, "Ç", "C")
s = mw.ustring.gsub(s, "ĉ", "c")
s = mw.ustring.gsub(s, "ď", "d")
s = mw.ustring.gsub(s, "đ", "d")
s = mw.ustring.gsub(s, "é", "e")
s = mw.ustring.gsub(s, "É", "E")
s = mw.ustring.gsub(s, "ě", "e")
s = mw.ustring.gsub(s, "ê", "e")
s = mw.ustring.gsub(s, "è", "e")
s = mw.ustring.gsub(s, "È", "E")
s = mw.ustring.gsub(s, "ε", "e")
s = mw.ustring.gsub(s, "ē", "e")
s = mw.ustring.gsub(s, "Ē", "E")
s = mw.ustring.gsub(s, "ę", "e")
s = mw.ustring.gsub(s, "ð", "e")
s = mw.ustring.gsub(s, "ë", "e")
s = mw.ustring.gsub(s, "Ë", "E")
s = mw.ustring.gsub(s, "γ", "Y")
s = mw.ustring.gsub(s, "ħ", "h")
s = mw.ustring.gsub(s, "i︠a︡", "ia")
s = mw.ustring.gsub(s, "í", "i")
s = mw.ustring.gsub(s, "i︠", "i")
s = mw.ustring.gsub(s, "ĭ", "i")
s = mw.ustring.gsub(s, "Í", "I")
s = mw.ustring.gsub(s, "î", "i")
s = mw.ustring.gsub(s, "Î", "I")
s = mw.ustring.gsub(s, "ì", "i")
s = mw.ustring.gsub(s, "ī", "i")
s = mw.ustring.gsub(s, "ł", "i")
s = mw.ustring.gsub(s, "ï", "i")
s = mw.ustring.gsub(s, "Ï", "I")
s = mw.ustring.gsub(s, "ĺ", "I")
s = mw.ustring.gsub(s, "Ĺ", "L")
s = mw.ustring.gsub(s, "μ", "u")
s = mw.ustring.gsub(s, "µ", "u")
s = mw.ustring.gsub(s, "ń", "n")
s = mw.ustring.gsub(s, "ň", "n")
s = mw.ustring.gsub(s, "ņ", "n")
s = mw.ustring.gsub(s, "ñ", "n")
s = mw.ustring.gsub(s, "Ñ", "N")
s = mw.ustring.gsub(s, "ó", "o")
s = mw.ustring.gsub(s, "Ó", "O")
s = mw.ustring.gsub(s, "ô", "o")
s = mw.ustring.gsub(s, "œ", "oe")
s = mw.ustring.gsub(s, "ò", "o")
s = mw.ustring.gsub(s, "ō", "o")
s = mw.ustring.gsub(s, "ø", "o")
s = mw.ustring.gsub(s, "Ø", "o")
s = mw.ustring.gsub(s, "õ", "o")
s = mw.ustring.gsub(s, "ö", "o")
s = mw.ustring.gsub(s, "ő", "o")
s = mw.ustring.gsub(s, "Ö", "O")
s = mw.ustring.gsub(s, "φ", "o")
s = mw.ustring.gsub(s, "ŕ", "r")
s = mw.ustring.gsub(s, "ř", "r")
s = mw.ustring.gsub(s, "Ř", "R")
s = mw.ustring.gsub(s, "ß", "ss")
s = mw.ustring.gsub(s, "ś", "s")
s = mw.ustring.gsub(s, "Ś", "S")
s = mw.ustring.gsub(s, "š", "s")
s = mw.ustring.gsub(s, "ṣ", "s")
s = mw.ustring.gsub(s, "Š", "S")
s = mw.ustring.gsub(s, "ş", "s")
s = mw.ustring.gsub(s, "Ş", "S")
s = mw.ustring.gsub(s, "ŝ", "s")
s = mw.ustring.gsub(s, "σ", "s")
s = mw.ustring.gsub(s, "ť", "t")
s = mw.ustring.gsub(s, "ţ", "t")
s = mw.ustring.gsub(s, "τ", "t")
s = mw.ustring.gsub(s, "þ", "p")
s = mw.ustring.gsub(s, "Þ", "p")
s = mw.ustring.gsub(s, "ú", "u")
s = mw.ustring.gsub(s, "Ú", "U")
s = mw.ustring.gsub(s, "û", "u")
s = mw.ustring.gsub(s, "ù", "u")
s = mw.ustring.gsub(s, "ū", "u")
s = mw.ustring.gsub(s, "ů", "u")
s = mw.ustring.gsub(s, "ü", "u")
s = mw.ustring.gsub(s, "Ü", "U")
s = mw.ustring.gsub(s, "ŵ", "w")
s = mw.ustring.gsub(s, "ý", "y")
s = mw.ustring.gsub(s, "ŷ", "y")
s = mw.ustring.gsub(s, "¥", "y")
s = mw.ustring.gsub(s, "ÿ", "y")
s = mw.ustring.gsub(s, "Ÿ", "Y")
s = mw.ustring.gsub(s, "ź", "z")
s = mw.ustring.gsub(s, "Ž", "Z")
s = mw.ustring.gsub(s, "ž", "z")
s = mw.ustring.gsub(s, "ż", "z")
s = mw.ustring.gsub(s, "Ż", "Z")
return s
end
return p
ilco3zs6as3ayxy1nh2rgnpn12egxm2
Module:Labelled list hatnote
828
50971703
1092226360
1091675163
2022-06-08T23:33:35Z
Nihiltres
236191
Fixed iteration-and-removal bug
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Labelled list --
-- --
-- This module does the core work of creating a hatnote composed of a list --
-- prefixed by a colon-terminated label, i.e. "LABEL: [andList of pages]", --
-- for {{see also}} and similar templates. --
--------------------------------------------------------------------------------
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local yesno --initialize lazily
local p = {}
-- Defaults global to this module
local defaults = {
label = 'See also', --Final fallback for label argument
labelForm = '%s: %s',
prefixes = {'label', 'label ', 'l'},
template = 'Module:Labelled list hatnote'
}
-- Localizable message strings
local msg = {
errorSuffix = '#Errors',
noInputWarning = 'no page names specified',
noOutputWarning =
"'''[[%s]] — no output: none of the target pages exist.'''"
}
-- Helper function that pre-combines display parameters into page arguments.
-- Also compresses sparse arrays, as a desirable side-effect.
function p.preprocessDisplays (args, prefixes)
-- Prefixes specify which parameters, in order, to check for display options
-- They each have numbers auto-appended, e.g. 'label1', 'label 1', & 'l1'
prefixes = prefixes or defaults.prefixes
local indices = {}
local sparsePages = {}
for k, v in pairs(args) do
if type(k) == 'number' then
indices[#indices + 1] = k
local display
for i = 1, #prefixes do
display = args[prefixes[i] .. k]
if display then break end
end
sparsePages[k] = display and
string.format('%s|%s', string.gsub(v, '|.*$', ''), display) or v
end
end
table.sort(indices)
local pages = {}
for k, v in ipairs(indices) do pages[#pages + 1] = sparsePages[v] end
return pages
end
--Helper function to get a page target from a processed page string
--e.g. "Page|Label" → "Page" or "Target" → "Target"
local function getTarget(pagename)
local pipe = string.find(pagename, '|')
return string.sub(pagename, 0, pipe and pipe - 1 or nil)
end
-- Produces a labelled pages-list hatnote.
-- The main frame (template definition) takes 1 or 2 arguments, for a singular
-- and (optionally) plural label respectively:
-- * {{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}
-- The resulting template takes pagename & label parameters normally.
function p.labelledList (frame)
mArguments = require('Module:Arguments')
yesno = require('Module:Yesno')
local labels = {frame.args[1] or defaults.label}
labels[2] = frame.args[2] or labels[1]
labels[3] = frame.args[3] --no defaulting
labels[4] = frame.args[4] --no defaulting
local template = frame:getParent():getTitle()
local args = mArguments.getArgs(frame, {parentOnly = true})
local pages = p.preprocessDisplays(args)
local options = {
category = yesno(args.category),
extraclasses = frame.args.extraclasses,
ifexists = yesno(frame.args.ifexists),
namespace = frame.args.namespace or args.namespace,
selfref = yesno(frame.args.selfref or args.selfref),
template = template
}
return p._labelledList(pages, labels, options)
end
function p._labelledList (pages, labels, options)
if options.ifexists then
for k = #pages, 1, -1 do --iterate backwards to allow smooth removals
local v = pages[k]
local title = mw.title.new(getTarget(v), namespace)
if (v == '') or title == nil or not title.exists then
table.remove(pages, k)
end
end
end
labels = labels or {}
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label
for k, v in pairs(pages) do
if mHatnote.findNamespaceId(v) ~= 0 then
label =
(
#pages == 1 and
(labels[3] or labels[1] or defaults.label) or
(labels[4] or labels[2] or defaults.label)
) or defaults.label
end
end
if #pages == 0 then
if options.ifexists then
mw.addWarning(
string.format(
msg.noOutputWarning, options.template or defaults.template
)
)
return ''
else
return mHatnote.makeWikitextError(
msg.noInputWarning,
(options.template or defaults.template) .. msg.errorSuffix,
options.category
)
end
end
local text = string.format(
options.labelForm or defaults.labelForm,
label,
mHatlist.andList(pages, true)
)
local hnOptions = {
extraclasses = options.extraclasses,
selfref = options.selfref
}
return mHatnote._hatnote(text, hnOptions)
end
return p
lgbn92zoszcjkbsmuwkrn9f0fvft89t
Module:List
828
41068627
1080850237
915206629
2022-04-03T20:52:25Z
Wugapodes
24484530
Changed protection settings for "[[Module:List]]": [[WP:High-risk templates|High-risk Lua module]]: Used in MediaWiki interface ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
-- This module outputs different kinds of lists. At the moment, bulleted,
-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.
local libUtil = require('libraryUtil')
local checkType = libUtil.checkType
local mTableTools = require('Module:TableTools')
local p = {}
local listTypes = {
['bulleted'] = true,
['unbulleted'] = true,
['horizontal'] = true,
['ordered'] = true,
['horizontal_ordered'] = true
}
function p.makeListData(listType, args)
-- Constructs a data table to be passed to p.renderList.
local data = {}
-- Classes
data.classes = {}
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist hlist-separated')
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
end
table.insert(data.classes, args.class)
-- Main div style
data.style = args.style
-- Indent for horizontal lists
if listType == 'horizontal' or listType == 'horizontal_ordered' then
local indent = tonumber(args.indent)
indent = indent and indent * 1.6 or 0
if indent > 0 then
data.marginLeft = indent .. 'em'
end
end
-- List style types for ordered lists
-- This could be "1, 2, 3", "a, b, c", or a number of others. The list style
-- type is either set by the "type" attribute or the "list-style-type" CSS
-- property.
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listStyleType = args.list_style_type or args['list-style-type']
data.type = args['type']
-- Detect invalid type attributes and attempt to convert them to
-- list-style-type CSS properties.
if data.type
and not data.listStyleType
and not tostring(data.type):find('^%s*[1AaIi]%s*$')
then
data.listStyleType = data.type
data.type = nil
end
end
-- List tag type
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listTag = 'ol'
else
data.listTag = 'ul'
end
-- Start number for ordered lists
data.start = args.start
if listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
end
end
-- List style
-- ul_style and ol_style are included for backwards compatibility. No
-- distinction is made for ordered or unordered lists.
data.listStyle = args.list_style
-- List items
-- li_style is included for backwards compatibility. item_style was included
-- to be easier to understand for non-coders.
data.itemStyle = args.item_style or args.li_style
data.items = {}
for i, num in ipairs(mTableTools.numKeys(args)) do
local item = {}
item.content = args[num]
item.style = args['item' .. tostring(num) .. '_style']
or args['item_style' .. tostring(num)]
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
table.insert(data.items, item)
end
return data
end
function p.renderList(data)
-- Renders the list HTML.
-- Return the blank string if there are no list items.
if type(data.items) ~= 'table' or #data.items < 1 then
return ''
end
-- Render the main div tag.
local root = mw.html.create('div')
for i, class in ipairs(data.classes or {}) do
root:addClass(class)
end
root:css{['margin-left'] = data.marginLeft}
if data.style then
root:cssText(data.style)
end
-- Render the list tag.
local list = root:tag(data.listTag or 'ul')
list
:attr{start = data.start, type = data.type}
:css{
['counter-reset'] = data.counterReset,
['list-style-type'] = data.listStyleType
}
if data.listStyle then
list:cssText(data.listStyle)
end
-- Render the list items
for i, t in ipairs(data.items or {}) do
local item = list:tag('li')
if data.itemStyle then
item:cssText(data.itemStyle)
end
if t.style then
item:cssText(t.style)
end
item
:attr{value = t.value}
:wikitext(t.content)
end
return tostring(root)
end
function p.renderTrackingCategories(args)
local isDeprecated = false -- Tracks deprecated parameters.
for k, v in pairs(args) do
k = tostring(k)
if k:find('^item_style%d+$') or k:find('^item_value%d+$') then
isDeprecated = true
break
end
end
local ret = ''
if isDeprecated then
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
return ret
end
function p.makeList(listType, args)
if not listType or not listTypes[listType] then
error(string.format(
"bad argument #1 to 'makeList' ('%s' is not a valid list type)",
tostring(listType)
), 2)
end
checkType('makeList', 2, args, 'table')
local data = p.makeListData(listType, args)
local list = p.renderList(data)
local trackingCategories = p.renderTrackingCategories(args)
return list .. trackingCategories
end
for listType in pairs(listTypes) do
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.makeList(listType, args)
end
end
return p
1kfxv6e8upfdko23gc41ky0lax25kzs
Module:Math
828
38591527
1011620827
1011584018
2021-03-11T22:23:48Z
Primefac
11508456
typo fix
Scribunto
text/plain
--[[
This module provides a number of basic mathematical operations.
]]
local yesno, getArgs -- lazily initialized
local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules.
local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua.
--[[
Helper functions used to avoid redundant code.
]]
local function err(msg)
-- Generates wikitext error messages.
return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg)
end
local function unpackNumberArgs(args)
-- Returns an unpacked list of arguments specified with numerical keys.
local ret = {}
for k, v in pairs(args) do
if type(k) == 'number' then
table.insert(ret, v)
end
end
return unpack(ret)
end
local function makeArgArray(...)
-- Makes an array of arguments from a list of arguments that might include nils.
local args = {...} -- Table of arguments. It might contain nils or non-number values, so we can't use ipairs.
local nums = {} -- Stores the numbers of valid numerical arguments.
local ret = {}
for k, v in pairs(args) do
v = p._cleanNumber(v)
if v then
nums[#nums + 1] = k
args[k] = v
end
end
table.sort(nums)
for i, num in ipairs(nums) do
ret[#ret + 1] = args[num]
end
return ret
end
local function fold(func, ...)
-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,
-- and must return a number as an output. This number is then supplied as input to the next function call.
local vals = makeArgArray(...)
local count = #vals -- The number of valid arguments
if count == 0 then return
-- Exit if we have no valid args, otherwise removing the first arg would cause an error.
nil, 0
end
local ret = table.remove(vals, 1)
for _, val in ipairs(vals) do
ret = func(ret, val)
end
return ret, count
end
--[[
Fold arguments by selectively choosing values (func should return when to choose the current "dominant" value).
]]
local function binary_fold(func, ...)
local value = fold((function(a, b) if func(a, b) then return a else return b end end), ...)
return value
end
--[[
random
Generate a random number
Usage:
{{#invoke: Math | random }}
{{#invoke: Math | random | maximum value }}
{{#invoke: Math | random | minimum value | maximum value }}
]]
function wrap.random(args)
local first = p._cleanNumber(args[1])
local second = p._cleanNumber(args[2])
return p._random(first, second)
end
function p._random(first, second)
math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000))
-- math.random will throw an error if given an explicit nil parameter, so we need to use if statements to check the params.
if first and second then
if first <= second then -- math.random doesn't allow the first number to be greater than the second.
return math.random(first, second)
end
elseif first then
return math.random(first)
else
return math.random()
end
end
--[[
order
Determine order of magnitude of a number
Usage:
{{#invoke: Math | order | value }}
]]
function wrap.order(args)
local input_string = (args[1] or args.x or '0');
local input_number = p._cleanNumber(input_string);
if input_number == nil then
return err('order of magnitude input appears non-numeric')
else
return p._order(input_number)
end
end
function p._order(x)
if x == 0 then return 0 end
return math.floor(math.log10(math.abs(x)))
end
--[[
precision
Detemines the precision of a number using the string representation
Usage:
{{ #invoke: Math | precision | value }}
]]
function wrap.precision(args)
local input_string = (args[1] or args.x or '0');
local trap_fraction = args.check_fraction;
local input_number;
if not yesno then
yesno = require('Module:Yesno')
end
if yesno(trap_fraction, true) then -- Returns true for all input except nil, false, "no", "n", "0" and a few others. See [[Module:Yesno]].
local pos = string.find(input_string, '/', 1, true);
if pos ~= nil then
if string.find(input_string, '/', pos + 1, true) == nil then
local denominator = string.sub(input_string, pos+1, -1);
local denom_value = tonumber(denominator);
if denom_value ~= nil then
return math.log10(denom_value);
end
end
end
end
input_number, input_string = p._cleanNumber(input_string);
if input_string == nil then
return err('precision input appears non-numeric')
else
return p._precision(input_string)
end
end
function p._precision(x)
if type(x) == 'number' then
x = tostring(x)
end
x = string.upper(x)
local decimal = x:find('%.')
local exponent_pos = x:find('E')
local result = 0;
if exponent_pos ~= nil then
local exponent = string.sub(x, exponent_pos + 1)
x = string.sub(x, 1, exponent_pos - 1)
result = result - tonumber(exponent)
end
if decimal ~= nil then
result = result + string.len(x) - decimal
return result
end
local pos = string.len(x);
while x:byte(pos) == string.byte('0') do
pos = pos - 1
result = result - 1
if pos <= 0 then
return 0
end
end
return result
end
--[[
max
Finds the maximum argument
Usage:
{{#invoke:Math| max | value1 | value2 | ... }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.max(args)
return p._max(unpackNumberArgs(args))
end
function p._max(...)
local max_value = binary_fold((function(a, b) return a > b end), ...)
if max_value then
return max_value
end
end
--[[
median
Find the median of set of numbers
Usage:
{{#invoke:Math | median | number1 | number2 | ...}}
OR
{{#invoke:Math | median }}
]]
function wrap.median(args)
return p._median(unpackNumberArgs(args))
end
function p._median(...)
local vals = makeArgArray(...)
local count = #vals
table.sort(vals)
if count == 0 then
return 0
end
if p._mod(count, 2) == 0 then
return (vals[count/2] + vals[count/2+1])/2
else
return vals[math.ceil(count/2)]
end
end
--[[
min
Finds the minimum argument
Usage:
{{#invoke:Math| min | value1 | value2 | ... }}
OR
{{#invoke:Math| min }}
When used with no arguments, it takes its input from the parent
frame. Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.min(args)
return p._min(unpackNumberArgs(args))
end
function p._min(...)
local min_value = binary_fold((function(a, b) return a < b end), ...)
if min_value then
return min_value
end
end
--[[
sum
Finds the sum
Usage:
{{#invoke:Math| sum | value1 | value2 | ... }}
OR
{{#invoke:Math| sum }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.sum(args)
return p._sum(unpackNumberArgs(args))
end
function p._sum(...)
local sums, count = fold((function(a, b) return a + b end), ...)
if not sums then
return 0
else
return sums
end
end
--[[
average
Finds the average
Usage:
{{#invoke:Math| average | value1 | value2 | ... }}
OR
{{#invoke:Math| average }}
Note, any values that do not evaluate to numbers are ignored.
]]
function wrap.average(args)
return p._average(unpackNumberArgs(args))
end
function p._average(...)
local sum, count = fold((function(a, b) return a + b end), ...)
if not sum then
return 0
else
return sum / count
end
end
--[[
round
Rounds a number to specified precision
Usage:
{{#invoke:Math | round | value | precision }}
--]]
function wrap.round(args)
local value = p._cleanNumber(args[1] or args.value or 0)
local precision = p._cleanNumber(args[2] or args.precision or 0)
if value == nil or precision == nil then
return err('round input appears non-numeric')
else
return p._round(value, precision)
end
end
function p._round(value, precision)
local rescale = math.pow(10, precision or 0);
return math.floor(value * rescale + 0.5) / rescale;
end
--[[
log10
returns the log (base 10) of a number
Usage:
{{#invoke:Math | log10 | x }}
]]
function wrap.log10(args)
return math.log10(args[1])
end
--[[
mod
Implements the modulo operator
Usage:
{{#invoke:Math | mod | x | y }}
--]]
function wrap.mod(args)
local x = p._cleanNumber(args[1])
local y = p._cleanNumber(args[2])
if not x then
return err('first argument to mod appears non-numeric')
elseif not y then
return err('second argument to mod appears non-numeric')
else
return p._mod(x, y)
end
end
function p._mod(x, y)
local ret = x % y
if not (0 <= ret and ret < y) then
ret = 0
end
return ret
end
--[[
gcd
Calculates the greatest common divisor of multiple numbers
Usage:
{{#invoke:Math | gcd | value 1 | value 2 | value 3 | ... }}
--]]
function wrap.gcd(args)
return p._gcd(unpackNumberArgs(args))
end
function p._gcd(...)
local function findGcd(a, b)
local r = b
local oldr = a
while r ~= 0 do
local quotient = math.floor(oldr / r)
oldr, r = r, oldr - quotient * r
end
if oldr < 0 then
oldr = oldr * -1
end
return oldr
end
local result, count = fold(findGcd, ...)
return result
end
--[[
precision_format
Rounds a number to the specified precision and formats according to rules
originally used for {{template:Rnd}}. Output is a string.
Usage:
{{#invoke: Math | precision_format | number | precision }}
]]
function wrap.precision_format(args)
local value_string = args[1] or 0
local precision = args[2] or 0
return p._precision_format(value_string, precision)
end
function p._precision_format(value_string, precision)
-- For access to Mediawiki built-in formatter.
local lang = mw.getContentLanguage();
local value
value, value_string = p._cleanNumber(value_string)
precision = p._cleanNumber(precision)
-- Check for non-numeric input
if value == nil or precision == nil then
return err('invalid input when rounding')
end
local current_precision = p._precision(value)
local order = p._order(value)
-- Due to round-off effects it is neccesary to limit the returned precision under
-- some circumstances because the terminal digits will be inaccurately reported.
if order + precision >= 14 then
if order + p._precision(value_string) >= 14 then
precision = 13 - order;
end
end
-- If rounding off, truncate extra digits
if precision < current_precision then
value = p._round(value, precision)
current_precision = p._precision(value)
end
local formatted_num = lang:formatNum(math.abs(value))
local sign
-- Use proper unary minus sign rather than ASCII default
if value < 0 then
sign = '−'
else
sign = ''
end
-- Handle cases requiring scientific notation
if string.find(formatted_num, 'E', 1, true) ~= nil or math.abs(order) >= 9 then
value = value * math.pow(10, -order)
current_precision = current_precision + order
precision = precision + order
formatted_num = lang:formatNum(math.abs(value))
else
order = 0;
end
formatted_num = sign .. formatted_num
-- Pad with zeros, if needed
if current_precision < precision then
local padding
if current_precision <= 0 then
if precision > 0 then
local zero_sep = lang:formatNum(1.1)
formatted_num = formatted_num .. zero_sep:sub(2,2)
padding = precision
if padding > 20 then
padding = 20
end
formatted_num = formatted_num .. string.rep('0', padding)
end
else
padding = precision - current_precision
if padding > 20 then
padding = 20
end
formatted_num = formatted_num .. string.rep('0', padding)
end
end
-- Add exponential notation, if necessary.
if order ~= 0 then
-- Use proper unary minus sign rather than ASCII default
if order < 0 then
order = '−' .. lang:formatNum(math.abs(order))
else
order = lang:formatNum(order)
end
formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
end
return formatted_num
end
--[[
divide
Implements the division operator
Usage:
{{#invoke:Math | divide | x | y | round= | precision= }}
--]]
function wrap.divide(args)
local x = args[1]
local y = args[2]
local round = args.round
local precision = args.precision
if not yesno then
yesno = require('Module:Yesno')
end
return p._divide(x, y, yesno(round), precision)
end
function p._divide(x, y, round, precision)
if y == nil or y == "" then
return err("Empty divisor")
elseif not tonumber(y) then
if type(y) == 'string' and string.sub(y, 1, 1) == '<' then
return y
else
return err("Not a number: " .. y)
end
elseif x == nil or x == "" then
return err("Empty dividend")
elseif not tonumber(x) then
if type(x) == 'string' and string.sub(x, 1, 1) == '<' then
return x
else
return err("Not a number: " .. x)
end
else
local z = x / y
if round then
return p._round(z, 0)
elseif precision then
return p._round(z, precision)
else
return z
end
end
end
--[[
Helper function that interprets the input numerically. If the
input does not appear to be a number, attempts evaluating it as
a parser functions expression.
]]
function p._cleanNumber(number_string)
if type(number_string) == 'number' then
-- We were passed a number, so we don't need to do any processing.
return number_string, tostring(number_string)
elseif type(number_string) ~= 'string' or not number_string:find('%S') then
-- We were passed a non-string or a blank string, so exit.
return nil, nil;
end
-- Attempt basic conversion
local number = tonumber(number_string)
-- If failed, attempt to evaluate input as an expression
if number == nil then
local success, result = pcall(mw.ext.ParserFunctions.expr, number_string)
if success then
number = tonumber(result)
number_string = tostring(number)
else
number = nil
number_string = nil
end
else
number_string = number_string:match("^%s*(.-)%s*$") -- String is valid but may contain padding, clean it.
number_string = number_string:match("^%+(.*)$") or number_string -- Trim any leading + signs.
if number_string:find('^%-?0[xX]') then
-- Number is using 0xnnn notation to indicate base 16; use the number that Lua detected instead.
number_string = tostring(number)
end
end
return number, number_string
end
--[[
Wrapper function that does basic argument processing. This ensures that all functions from #invoke can use either the current
frame or the parent frame, and it also trims whitespace for all arguments and removes blank arguments.
]]
local mt = { __index = function(t, k)
return function(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return wrap[k](getArgs(frame)) -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed.
end
end }
return setmetatable(p, mt)
53y9xuneyjocim7fhors0t2vo6rax8q
Module:MultiReplace
828
51070180
884966381
838829574
2019-02-25T03:38:04Z
MusikAnimal
14882394
Changed protection level for "[[Module:MultiReplace]]": [[WP:High-risk templates|High-risk Lua module]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
Scribunto
text/plain
p = {}
local function MultiReplace(args)
local input = args[1] or "{{{1}}}"
local plain = args.plain == "yes"
local i = 1
local changeList = {}
while args[i * 2] do
local change = {pattern = args[i * 2], repl = args[i * 2 + 1]}
if not change.repl then
return require('Module:Error').error{
'MultiReplace: Unpaired argument: <code>' .. (i * 2) .. ' = ' .. change.pattern .. '</code>'
}
end
changeList[i] = change
i = i + 1
end
local matchList = {}
local pos = 1
local len = mw.ustring.len(input)
local result = ""
while pos <= len do
local bestStart = len + 1
local bestStop = len
local bestChange
for _, change in ipairs(changeList) do
local start, stop = mw.ustring.find(input, change.pattern, pos, plain)
if start and (start < bestStart) then
bestStart = start
bestStop = stop
bestChange = change
end
end
result = result .. mw.ustring.sub(input, pos, bestStart - 1)
if bestChange then
local fragment = mw.ustring.sub(input, bestStart, bestStop)
result = result .. (plain and bestChange.repl or
mw.ustring.gsub(fragment, bestChange.pattern, bestChange.repl, 1))
end
pos = bestStop + 1
end
return result
end
function p.main(frame, ...)
local args =
type(frame) ~= 'table' and {frame, ...} or
type(frame.args) ~= 'table' and frame or
frame.args[1] and frame.args or
frame:getParent().args
return MultiReplace(args)
end
return p
95xnv3yvolixngufi1jdsiwnf7fdf62
Module:Namespace detect
828
39762919
602886406
601020017
2014-04-05T17:01:23Z
Mr. Stradivarius
4708675
use demopage instead of page as the main "page" parameter
Scribunto
text/plain
--[[
--------------------------------------------------------------------------------
-- --
-- NAMESPACE DETECT --
-- --
-- This module implements the {{namespace detect}} 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. The --
-- module can also use the corresponding subject namespace value if it is --
-- used on a talk page. Parameter names can be configured for different wikis --
-- by altering the values in the "cfg" table in --
-- Module:Namespace detect/config. --
-- --
--------------------------------------------------------------------------------
--]]
local data = mw.loadData('Module:Namespace detect/data')
local argKeys = data.argKeys
local cfg = data.cfg
local mappings = data.mappings
local yesno = require('Module:Yesno')
local mArguments -- Lazily initialise Module:Arguments
local mTableTools -- Lazily initilalise Module:TableTools
local ustringLower = mw.ustring.lower
local p = {}
local function fetchValue(t1, t2)
-- Fetches a value from the table t1 for the first key in array t2 where
-- a non-nil value of t1 exists.
for i, key in ipairs(t2) do
local value = t1[key]
if value ~= nil then
return value
end
end
return nil
end
local function equalsArrayValue(t, value)
-- Returns true if value equals a value in the array t. Otherwise
-- returns false.
for i, arrayValue in ipairs(t) do
if value == arrayValue then
return true
end
end
return false
end
function p.getPageObject(page)
-- Get the page object, passing the function through pcall in case of
-- errors, e.g. being over the expensive function count limit.
if page then
local success, pageObject = pcall(mw.title.new, page)
if success then
return pageObject
else
return nil
end
else
return mw.title.getCurrentTitle()
end
end
-- Provided for backward compatibility with other modules
function p.getParamMappings()
return mappings
end
local function getNamespace(args)
-- This function gets the namespace name from the page object.
local page = fetchValue(args, argKeys.demopage)
if page == '' then
page = nil
end
local demospace = fetchValue(args, argKeys.demospace)
if demospace == '' then
demospace = nil
end
local subjectns = fetchValue(args, argKeys.subjectns)
local ret
if demospace then
-- Handle "demospace = main" properly.
if equalsArrayValue(argKeys.main, ustringLower(demospace)) then
ret = mw.site.namespaces[0].name
else
ret = demospace
end
else
local pageObject = p.getPageObject(page)
if pageObject then
if pageObject.isTalkPage then
-- Get the subject namespace if the option is set,
-- otherwise use "talk".
if yesno(subjectns) then
ret = mw.site.namespaces[pageObject.namespace].subject.name
else
ret = 'talk'
end
else
ret = pageObject.nsText
end
else
return nil -- return nil if the page object doesn't exist.
end
end
ret = ret:gsub('_', ' ')
return ustringLower(ret)
end
function p._main(args)
-- Check the parameters stored in the mappings table for any matches.
local namespace = getNamespace(args) or 'other' -- "other" avoids nil table keys
local params = mappings[namespace] or {}
local ret = fetchValue(args, params)
--[[
-- If there were no matches, return parameters for other namespaces.
-- This happens if there was no text specified for the namespace that
-- was detected or if the demospace parameter is not a valid
-- namespace. Note that the parameter for the detected namespace must be
-- completely absent for this to happen, not merely blank.
--]]
if ret == nil then
ret = fetchValue(args, argKeys.other)
end
return ret
end
function p.main(frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame, {removeBlanks = false})
local ret = p._main(args)
return ret or ''
end
function p.table(frame)
--[[
-- Create a wikitable of all subject namespace parameters, for
-- documentation purposes. The talk parameter is optional, in case it
-- needs to be excluded in the documentation.
--]]
-- Load modules and initialise variables.
mTableTools = require('Module:TableTools')
local namespaces = mw.site.namespaces
local cfg = data.cfg
local useTalk = type(frame) == 'table'
and type(frame.args) == 'table'
and yesno(frame.args.talk) -- Whether to use the talk parameter.
-- Get the header names.
local function checkValue(value, default)
if type(value) == 'string' then
return value
else
return default
end
end
local nsHeader = checkValue(cfg.wikitableNamespaceHeader, 'Namespace')
local aliasesHeader = checkValue(cfg.wikitableAliasesHeader, 'Aliases')
-- Put the namespaces in order.
local mappingsOrdered = {}
for nsname, params in pairs(mappings) do
if useTalk or nsname ~= 'talk' then
local nsid = namespaces[nsname].id
-- Add 1, as the array must start with 1; nsid 0 would be lost otherwise.
nsid = nsid + 1
mappingsOrdered[nsid] = params
end
end
mappingsOrdered = mTableTools.compressSparseArray(mappingsOrdered)
-- Build the table.
local ret = '{| class="wikitable"'
.. '\n|-'
.. '\n! ' .. nsHeader
.. '\n! ' .. aliasesHeader
for i, params in ipairs(mappingsOrdered) do
for j, param in ipairs(params) do
if j == 1 then
ret = ret .. '\n|-'
.. '\n| <code>' .. param .. '</code>'
.. '\n| '
elseif j == 2 then
ret = ret .. '<code>' .. param .. '</code>'
else
ret = ret .. ', <code>' .. param .. '</code>'
end
end
end
ret = ret .. '\n|-'
.. '\n|}'
return ret
end
return p
j7kygz1y56jpz4doq0m2c6x1td5d8ar
Module:Namespace detect/config
828
42256703
948472518
948472515
2020-04-01T06:12:44Z
MusikAnimal
14882394
1 revision imported
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
Module:Namespace detect/data
828
42257476
948472520
948472519
2020-04-01T06:12:45Z
MusikAnimal
14882394
1 revision imported
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
Module:Navbar
828
38827227
1054994468
1054938041
2021-11-13T05:33:43Z
Izno
2927383
remove unnecessary line
Scribunto
text/plain
local p = {}
local cfg = mw.loadData('Module:Navbar/configuration')
local function get_title_arg(is_collapsible, template)
local title_arg = 1
if is_collapsible then title_arg = 2 end
if template then title_arg = 'template' end
return title_arg
end
local function choose_links(template, args)
-- The show table indicates the default displayed items.
-- view, talk, edit, hist, move, watch
-- TODO: Move to configuration.
local show = {true, true, true, false, false, false}
if template then
show[2] = false
show[3] = false
local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,
talk = 2, edit = 3, hist = 4, move = 5, watch = 6}
-- TODO: Consider removing TableTools dependency.
for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do
local num = index[v]
if num then show[num] = true end
end
end
local remove_edit_link = args.noedit
if remove_edit_link then show[3] = false end
return show
end
local function add_link(link_description, ul, is_mini, font_style)
local l
if link_description.url then
l = {'[', '', ']'}
else
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-' .. link_description.full)
:wikitext(l[1] .. link_description.link .. l[2])
:tag(is_mini and 'abbr' or 'span')
:attr('title', link_description.html_title)
:cssText(font_style)
:wikitext(is_mini and link_description.mini or link_description.full)
:done()
:wikitext(l[3])
:done()
end
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
if not title then
error(cfg.invalid_title .. title_text)
end
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
-- TODO: Get link_descriptions and show into the configuration module.
-- link_descriptions should be easier...
local link_descriptions = {
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
['link'] = title.fullText, ['url'] = false },
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
['link'] = talkpage, ['url'] = false },
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
['link'] = title:fullUrl('action=edit'), ['url'] = true },
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
['link'] = title:fullUrl('action=history'), ['url'] = true },
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template',
['link'] = title:fullUrl('action=watch'), ['url'] = true }
}
local ul = mw.html.create('ul')
if has_brackets then
ul:addClass(cfg.classes.brackets)
:cssText(font_style)
end
for i, _ in ipairs(displayed_links) do
if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end
end
return ul:done()
end
function p._navbar(args)
-- TODO: We probably don't need both fontstyle and fontcolor...
local font_style = args.fontstyle
local font_color = args.fontcolor
local is_collapsible = args.collapsible
local is_mini = args.mini
local is_plain = args.plain
local collapsible_class = nil
if is_collapsible then
collapsible_class = cfg.classes.collapsible
if not is_plain then is_mini = 1 end
if font_color then
font_style = (font_style or '') .. '; color: ' .. font_color .. ';'
end
end
local navbar_style = args.style
local div = mw.html.create():tag('div')
div
:addClass(cfg.classes.navbar)
:addClass(cfg.classes.plainlinks)
:addClass(cfg.classes.horizontal_list)
:addClass(collapsible_class) -- we made the determination earlier
:cssText(navbar_style)
if is_mini then div:addClass(cfg.classes.mini) end
local box_text = (args.text or cfg.box_text) .. ' '
-- the concatenated space guarantees the box text is separated
if not (is_mini or is_plain) then
div
:tag('span')
:addClass(cfg.classes.box_text)
:cssText(font_style)
:wikitext(box_text)
end
local template = args.template
local displayed_links = choose_links(template, args)
local has_brackets = args.brackets
local title_arg = get_title_arg(is_collapsible, template)
local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
div:node(list)
if is_collapsible then
local title_text_class
if is_mini then
title_text_class = cfg.classes.collapsible_title_mini
else
title_text_class = cfg.classes.collapsible_title_full
end
div:done()
:tag('div')
:addClass(title_text_class)
:cssText(font_style)
:wikitext(args[1])
end
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = cfg.templatestyles }
} .. tostring(div:done())
end
function p.navbar(frame)
return p._navbar(require('Module:Arguments').getArgs(frame))
end
return p
jd5no8v1zi4m1e6lvbwo0a9t0kogdvi
Module:Navbar/configuration
828
66010105
1054995103
992950717
2021-11-13T05:39:10Z
Izno
2927383
well, since I edited the other one...
Scribunto
text/plain
return {
['templatestyles'] = 'Module:Navbar/styles.css',
['box_text'] = 'This box: ', -- default text box when not plain or mini
['title_namespace'] = 'Template', -- namespace to default to for title
['invalid_title'] = 'Invalid title ',
['classes'] = { -- set a line to nil if you don't want it
['navbar'] = 'navbar',
['plainlinks'] = 'plainlinks', -- plainlinks
['horizontal_list'] = 'hlist', -- horizontal list class
['mini'] = 'navbar-mini', -- class indicating small links in the navbar
['this_box'] = 'navbar-boxtext',
['brackets'] = 'navbar-brackets',
-- 'collapsible' is the key for a class to indicate the navbar is
-- setting up the collapsible element in addition to the normal
-- navbar.
['collapsible'] = 'navbar-collapse',
['collapsible_title_mini'] = 'navbar-ct-mini',
['collapsible_title_full'] = 'navbar-ct-full'
}
}
lydm72m86hfvyzj0u2lqfps9lz9gquk
Module:Navbar/styles.css
828
58923020
1063604349
1054937957
2022-01-03T23:12:15Z
Izno
2927383
navbar styles that were moved to parent templates
sanitized-css
text/css
/* {{pp|small=yes}} */
.navbar {
display: inline;
font-size: 88%;
font-weight: normal;
}
.navbar-collapse {
float: left;
text-align: left;
}
.navbar-boxtext {
word-spacing: 0;
}
.navbar ul {
display: inline-block;
white-space: nowrap;
line-height: inherit;
}
.navbar-brackets::before {
margin-right: -0.125em;
content: '[ ';
}
.navbar-brackets::after {
margin-left: -0.125em;
content: ' ]';
}
.navbar li {
word-spacing: -0.125em;
}
.navbar a > span,
.navbar a > abbr {
text-decoration: inherit;
}
.navbar-mini abbr {
font-variant: small-caps;
border-bottom: none;
text-decoration: none;
cursor: inherit;
}
.navbar-ct-full {
font-size: 114%;
margin: 0 7em;
}
.navbar-ct-mini {
font-size: 114%;
margin: 0 4em;
}
id9uhrgq1wqygbzuyhnoc90pmdlwwhd
Module:Navbox
828
38634746
1064341473
1057332100
2022-01-07T21:39:23Z
Izno
2927383
remove titlegroup per templatestyles section on talk page
Scribunto
text/plain
local p = {}
local navbar = require('Module:Navbar')._navbar
local cfg = mw.loadData('Module:Navbox/configuration')
local getArgs -- lazily initialized
local args
local format = string.format
local function striped(wikitext, border)
-- Return wikitext with markers replaced for odd/even striping.
-- Child (subgroup) navboxes are flagged with a category that is removed
-- by parent navboxes. The result is that the category shows all pages
-- where a child navbox is not contained in a parent navbox.
local orphanCat = cfg.category.orphan
if border == cfg.keyword.border_subgroup and args[cfg.arg.orphan] ~= cfg.keyword.orphan_yes then
-- No change; striping occurs in outermost navbox.
return wikitext .. orphanCat
end
local first, second = cfg.class.navbox_odd_part, cfg.class.navbox_even_part
if args[cfg.arg.evenodd] then
if args[cfg.arg.evenodd] == cfg.keyword.evenodd_swap then
first, second = second, first
else
first = args[cfg.arg.evenodd]
second = first
end
end
local changer
if first == second then
changer = first
else
local index = 0
changer = function (code)
if code == '0' then
-- Current occurrence is for a group before a nested table.
-- Set it to first as a valid although pointless class.
-- The next occurrence will be the first row after a title
-- in a subgroup and will also be first.
index = 0
return first
end
index = index + 1
return index % 2 == 1 and first or second
end
end
local regex = orphanCat:gsub('([%[%]])', '%%%1')
return (wikitext:gsub(regex, ''):gsub(cfg.marker.regex, changer)) -- () omits gsub count
end
local function processItem(item, nowrapitems)
if item:sub(1, 2) == '{|' then
-- Applying nowrap to lines in a table does not make sense.
-- Add newlines to compensate for trim of x in |parm=x in a template.
return '\n' .. item ..'\n'
end
if nowrapitems == cfg.keyword.nowrapitems_yes then
local lines = {}
for line in (item .. '\n'):gmatch('([^\n]*)\n') do
local prefix, content = line:match('^([*:;#]+)%s*(.*)')
if prefix and not content:match(cfg.pattern.nowrap) then
line = format(cfg.nowrap_item, prefix, content)
end
table.insert(lines, line)
end
item = table.concat(lines, '\n')
end
if item:match('^[*:;#]') then
return '\n' .. item ..'\n'
end
return item
end
-- we will want this later when we want to add tstyles for hlist/plainlist
local function has_navbar()
return args[cfg.arg.navbar] ~= cfg.keyword.navbar_off
and args[cfg.arg.navbar] ~= cfg.keyword.navbar_plain
and (
args[cfg.arg.name]
or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.pattern.sandbox, '')
~= cfg.pattern.navbox
)
end
local function renderNavBar(titleCell)
if has_navbar() then
titleCell:wikitext(navbar{
[cfg.navbar.name] = args[cfg.arg.name],
[cfg.navbar.mini] = 1,
[cfg.navbar.fontstyle] = (args[cfg.arg.basestyle] or '') .. ';' ..
(args[cfg.arg.titlestyle] or '') ..
';background:none transparent;border:none;box-shadow:none;padding:0;'
})
end
end
local function renderTitleRow(tbl)
if not args[cfg.arg.title] then return end
local titleRow = tbl:tag('tr')
local titleCell = titleRow:tag('th'):attr('scope', 'col')
local titleColspan = 2
if args[cfg.arg.imageleft] then titleColspan = titleColspan + 1 end
if args[cfg.arg.image] then titleColspan = titleColspan + 1 end
titleCell
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.titlestyle])
:addClass(cfg.class.navbox_title)
:attr('colspan', titleColspan)
renderNavBar(titleCell)
titleCell
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args[cfg.arg.title]))
:addClass(args[cfg.arg.titleclass])
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItem(args[cfg.arg.title]))
end
local function getAboveBelowColspan()
local ret = 2
if args[cfg.arg.imageleft] then ret = ret + 1 end
if args[cfg.arg.image] then ret = ret + 1 end
return ret
end
local function renderAboveRow(tbl)
if not args[cfg.arg.above] then return end
tbl:tag('tr')
:tag('td')
:addClass(cfg.class.navbox_abovebelow)
:addClass(args[cfg.arg.aboveclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.abovestyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', args[cfg.arg.title] and nil or mw.uri.anchorEncode(args[cfg.arg.above]))
:wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems]))
end
local function renderBelowRow(tbl)
if not args[cfg.arg.below] then return end
tbl:tag('tr')
:tag('td')
:addClass(cfg.class.navbox_abovebelow)
:addClass(args[cfg.arg.belowclass])
:cssText(args[cfg.arg.basestyle])
:cssText(args[cfg.arg.belowstyle])
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItem(args[cfg.arg.below], args[cfg.arg.nowrapitems]))
end
local function renderListRow(tbl, index, listnum, listnums_size)
local row = tbl:tag('tr')
if index == 1 and args[cfg.arg.imageleft] then
row
:tag('td')
:addClass(cfg.class.noviewer)
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0 2px 0 0')
:cssText(args[cfg.arg.imageleftstyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.imageleft]))
end
local group_and_num = format(cfg.arg.group_and_num, listnum)
local groupstyle_and_num = format(cfg.arg.groupstyle_and_num, listnum)
if args[group_and_num] then
local groupCell = row:tag('th')
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group2]) then
groupCell
:attr('id', mw.uri.anchorEncode(args[cfg.arg.group1]))
end
groupCell
:attr('scope', 'row')
:addClass(cfg.class.navbox_group)
:addClass(args[cfg.arg.groupclass])
:cssText(args[cfg.arg.basestyle])
-- If groupwidth not specified, minimize width
:css('width', args[cfg.arg.groupwidth] or '1%')
groupCell
:cssText(args[cfg.arg.groupstyle])
:cssText(args[groupstyle_and_num])
:wikitext(args[group_and_num])
end
local listCell = row:tag('td')
if args[group_and_num] then
listCell
:addClass(cfg.class.navbox_list_with_group)
else
listCell:attr('colspan', 2)
end
if not args[cfg.arg.groupwidth] then
listCell:css('width', '100%')
end
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing
if index % 2 == 1 then
rowstyle = args[cfg.arg.oddstyle]
else
rowstyle = args[cfg.arg.evenstyle]
end
local list_and_num = format(cfg.arg.list_and_num, listnum)
local listText = args[list_and_num]
local oddEven = cfg.marker.oddeven
if listText:sub(1, 12) == '</div><table' then
-- Assume list text is for a subgroup navbox so no automatic striping for this row.
oddEven = listText:find(cfg.pattern.navbox_title) and cfg.marker.restart or cfg.class.navbox_odd_part
end
local liststyle_and_num = format(cfg.arg.liststyle_and_num, listnum)
local listclass_and_num = format(cfg.arg.listclass_and_num, listnum)
listCell
:css('padding', '0')
:cssText(args[cfg.arg.liststyle])
:cssText(rowstyle)
:cssText(args[liststyle_and_num])
:addClass(cfg.class.navbox_list)
:addClass(cfg.class.navbox_part .. oddEven)
:addClass(args[cfg.arg.listclass])
:addClass(args[listclass_and_num])
:tag('div')
:css('padding',
(index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0 0.25em'
)
:wikitext(processItem(listText, args[cfg.arg.nowrapitems]))
if index == 1 and args[cfg.arg.image] then
row
:tag('td')
:addClass(cfg.class.noviewer)
:addClass(cfg.class.navbox_image)
:addClass(args[cfg.arg.imageclass])
:css('width', '1px') -- Minimize width
:css('padding', '0 0 0 2px')
:cssText(args[cfg.arg.imagestyle])
:attr('rowspan', listnums_size)
:tag('div')
:wikitext(processItem(args[cfg.arg.image]))
end
end
-- uses this now to make the needHlistCategory correct
-- to use later for when we add list styles via navbox
local function has_list_class(htmlclass)
local class_args = { -- rough order of probability of use
cfg.arg.bodyclass, cfg.arg.listclass, cfg.arg.aboveclass,
cfg.arg.belowclass, cfg.arg.titleclass, cfg.arg.navboxclass,
cfg.arg.groupclass, cfg.arg.imageclass
}
local patterns = {
'^' .. htmlclass .. '$',
'%s' .. htmlclass .. '$',
'^' .. htmlclass .. '%s',
'%s' .. htmlclass .. '%s'
}
for _, arg in ipairs(class_args) do
for _, pattern in ipairs(patterns) do
if mw.ustring.find(args[arg] or '', pattern) then
return true
end
end
end
return false
end
local function needsHorizontalLists(border)
if border == cfg.keyword.border_subgroup or args[cfg.arg.tracking] == cfg.keyword.tracking_no then
return false
end
return not has_list_class(cfg.pattern.hlist) and not has_list_class(cfg.pattern.plainlist)
end
local function hasBackgroundColors()
for _, key in ipairs({cfg.arg.titlestyle, cfg.arg.groupstyle,
cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do
if tostring(args[key]):find('background', 1, true) then
return true
end
end
return false
end
local function hasBorders()
for _, key in ipairs({cfg.arg.groupstyle, cfg.arg.basestyle,
cfg.arg.abovestyle, cfg.arg.belowstyle}) do
if tostring(args[key]):find('border', 1, true) then
return true
end
end
return false
end
local function isIllegible()
local styleratio = require('Module:Color contrast')._styleratio
for key, style in pairs(args) do
if tostring(key):match(cfg.pattern.style) then
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then
return true
end
end
end
return false
end
local function getTrackingCategories(border)
local cats = {}
if needsHorizontalLists(border) then table.insert(cats, cfg.category.horizontal_lists) end
if hasBackgroundColors() then table.insert(cats, cfg.category.background_colors) end
if isIllegible() then table.insert(cats, cfg.category.illegible) end
if hasBorders() then table.insert(cats, cfg.category.borders) end
return cats
end
local function renderTrackingCategories(builder, border)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage == cfg.keyword.subpage_doc or subpage == cfg.keyword.subpage_sandbox
or subpage == cfg.keyword.subpage_testcases then return end
for _, cat in ipairs(getTrackingCategories(border)) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
end
local function renderMainTable(border, listnums)
local tbl = mw.html.create('table')
:addClass(cfg.class.nowraplinks)
:addClass(args[cfg.arg.bodyclass])
local state = args[cfg.arg.state]
if args[cfg.arg.title] and state ~= cfg.keyword.state_plain and state ~= cfg.keyword.state_off then
if state == cfg.keyword.state_collapsed then
state = cfg.class.collapsed
end
tbl
:addClass(cfg.class.collapsible)
:addClass(state or cfg.class.autocollapse)
end
tbl:css('border-spacing', 0)
if border == cfg.keyword.border_subgroup or border == cfg.keyword.border_none then
tbl
:addClass(cfg.class.navbox_subgroup)
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
:addClass(cfg.class.navbox_inner)
:css('background', 'transparent')
:css('color', 'inherit')
end
tbl:cssText(args[cfg.arg.innerstyle])
renderTitleRow(tbl)
renderAboveRow(tbl)
local listnums_size = #listnums
for i, listnum in ipairs(listnums) do
renderListRow(tbl, i, listnum, listnums_size)
end
renderBelowRow(tbl)
return tbl
end
local function add_navbox_styles()
local frame = mw.getCurrentFrame()
-- This is a lambda so that it doesn't need the frame as a parameter
local function add_user_styles(templatestyles)
if templatestyles and templatestyles ~= '' then
return frame:extensionTag{
name = 'templatestyles', args = { src = templatestyles }
}
end
return ''
end
-- get templatestyles. load base from config so that Lua only needs to do
-- the work once of parser tag expansion
local base_templatestyles = cfg.templatestyles
local templatestyles = add_user_styles(args[cfg.arg.templatestyles])
local child_templatestyles = add_user_styles(args[cfg.arg.child_templatestyles])
-- The 'navbox-styles' div exists for two reasons:
-- 1. To wrap the styles to work around T200206 more elegantly. Instead
-- of combinatorial rules, this ends up being linear number of CSS rules.
-- 2. To allow MobileFrontend to rip the styles out with 'nomobile' such that
-- they are not dumped into the mobile view.
return mw.html.create('div')
:addClass(cfg.class.navbox_styles)
:addClass(cfg.class.nomobile)
:wikitext(base_templatestyles .. templatestyles .. child_templatestyles)
:done()
end
function p._navbox(navboxArgs)
args = navboxArgs
local listnums = {}
for k, _ in pairs(args) do
if type(k) == 'string' then
local listnum = k:match(cfg.pattern.listnum)
if listnum then table.insert(listnums, tonumber(listnum)) end
end
end
table.sort(listnums)
local border = mw.text.trim(args[cfg.arg.border] or args[1] or '')
if border == cfg.keyword.border_child then
border = cfg.keyword.border_subgroup
end
-- render the main body of the navbox
local tbl = renderMainTable(border, listnums)
local res = mw.html.create()
-- render the appropriate wrapper for the navbox, based on the border param
if border == cfg.keyword.border_none then
res:node(add_navbox_styles())
local nav = res:tag('div')
:attr('role', 'navigation')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1]
and not args[cfg.arg.group2]) then
nav:attr(
'aria-labelledby',
mw.uri.anchorEncode(
args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]
)
)
else
nav:attr('aria-label', cfg.aria_label)
end
elseif border == cfg.keyword.border_subgroup then
-- We assume that this navbox is being rendered in a list cell of a
-- parent navbox, and is therefore inside a div with padding:0em 0.25em.
-- We start with a </div> to avoid the padding being applied, and at the
-- end add a <div> to balance out the parent's </div>
res
:wikitext('</div>')
:node(tbl)
:wikitext('<div>')
else
res:node(add_navbox_styles())
local nav = res:tag('div')
:attr('role', 'navigation')
:addClass(cfg.class.navbox)
:addClass(args[cfg.arg.navboxclass])
:cssText(args[cfg.arg.bodystyle])
:cssText(args[cfg.arg.style])
:css('padding', '3px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args[cfg.arg.title] or args[cfg.arg.above]
or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then
nav:attr(
'aria-labelledby',
mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1])
)
else
nav:attr('aria-label', cfg.aria_label)
end
end
if (args[cfg.arg.nocat] or cfg.keyword.nocat_false):lower() == cfg.keyword.nocat_false then
renderTrackingCategories(res, border)
end
return striped(tostring(res), border)
end
function p.navbox(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = {cfg.pattern.navbox}})
-- Read the arguments in the order they'll be output in, to make references
-- number in the right order.
local _
_ = args[cfg.arg.title]
_ = args[cfg.arg.above]
-- Limit this to 20 as covering 'most' cases (that's a SWAG) and because
-- iterator approach won't work here
for i = 1, 20 do
_ = args[format(cfg.arg.group_and_num, i)]
_ = args[format(cfg.arg.list_and_num, i)]
end
_ = args[cfg.arg.below]
return p._navbox(args)
end
return p
aps8opqyleqagctjqmi5zb3x6sq8mux
Module:Navbox/configuration
828
67685668
1064341544
1057330154
2022-01-07T21:39:52Z
Izno
2927383
remove titlegroup
Scribunto
text/plain
return {
aria_label = 'Navbox',
nowrap_item = '%s<span class="nowrap">%s</span>',
templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Navbox/styles.css' }
},
-- do not localize marker table
marker = {
oddeven = '\127_ODDEVEN_\127',
restart = '\127_ODDEVEN0_\127',
regex = '\127_ODDEVEN(%d?)_\127'
},
category = {
orphan = '[[Category:Navbox orphans]]',
horizontal_lists = 'Navigational boxes without horizontal lists',
background_colors = 'Navboxes using background colours',
illegible = 'Potentially illegible navboxes',
borders = 'Navboxes using borders',
},
keyword = {
border_subgroup = 'subgroup',
border_child = 'child',
border_none = 'none',
evenodd_swap = 'swap',
navbar_off = 'off',
navbar_plain = 'plain',
nocat_false = 'false',
nowrapitems_yes = 'yes',
orphan_yes = 'yes',
state_collapsed = 'collapsed',
state_off = 'off',
state_plain = 'plain',
subpage_doc = 'doc',
subpage_sandbox = 'sandbox',
subpage_testcases = 'testcases',
tracking_no = 'no'
},
class = {
autocollapse = 'autocollapse',
collapsible = 'mw-collapsible',
collapsed = 'mw-collapsed',
-- Warning
navbox = 'navbox', -- WMF currently hides 'navbox' from mobile,
-- so you probably shouldn't change the navbox class.
navbox_abovebelow = 'navbox-abovebelow',
navbox_group = 'navbox-group',
navbox_image = 'navbox-image',
navbox_inner = 'navbox-inner',
navbox_list = 'navbox-list',
navbox_list_with_group = 'navbox-list-with-group',
navbox_part = 'navbox-', -- do not l10n
navbox_styles = 'navbox-styles',
navbox_subgroup = 'navbox-subgroup',
navbox_title = 'navbox-title', -- l10n only if you change pattern.navbox_title below
navbox_odd_part = 'odd', -- do not l10n
navbox_even_part = 'even', -- do not l10n
nomobile = 'nomobile',
nowraplinks = 'nowraplinks',
noviewer = 'noviewer' -- used to remove images from MediaViewer
},
pattern = {
listnum = '^list(%d+)$',
sandbox = '/sandbox$',
navbox = 'Template:Navbox',
nowrap = '^<span class="nowrap">',
style = 'style$',
navbox_title = '<th[^>]*"navbox%-title"',
hlist = 'hlist',
plainlist = 'plainlist'
},
arg = {
above = 'above',
aboveclass = 'aboveclass',
abovestyle = 'abovestyle',
basestyle = 'basestyle',
bodyclass = 'bodyclass',
bodystyle = 'bodystyle',
border = 'border',
below = 'below',
belowclass = 'belowclass',
belowstyle = 'belowstyle',
evenodd = 'evenodd',
evenstyle = 'evenstyle',
group1 = 'group1',
group2 = 'group2',
group_and_num = 'group%d',
groupstyle_and_num = 'group%dstyle',
groupclass = 'groupclass',
groupstyle = 'groupstyle',
groupwidth = 'groupwidth',
innerstyle = 'innerstyle',
image = 'image',
imageclass = 'imageclass',
imageleft = 'imageleft',
imageleftstyle = 'imageleftstyle',
imagesetyle = 'imagestyle',
list_and_num = 'list%d',
listclass_and_num = 'list%dclass',
liststyle_and_num = 'list%dstyle',
list1padding = 'list1padding',
listclass = 'listclass',
listpadding = 'listpadding',
liststyle = 'liststyle',
name = 'name',
navbar = 'navbar',
navboxclass = 'navboxclass',
nocat = 'nocat',
nowrapitems = 'nowrapitems',
oddstyle = 'oddstyle',
orphan = 'orphan',
state = 'state',
style = 'style',
templatestyles = 'templatestyles',
child_templatestyles = 'child templatestyles',
title = 'title',
titleclass = 'titleclass',
titlestyle = 'titlestyle',
tracking = 'tracking'
},
-- names of navbar arguments
navbar = {
name = 1,
fontstyle = 'fontstyle',
mini = 'mini'
}
}
8npf15277sgmgep5j2bnmes7i7ktuvo
Module:Navbox/styles.css
828
69272159
1061467846
1057682214
2021-12-21T22:10:10Z
Izno
2927383
remove qualifications on th - this will remove styling from "hand-crafted" navboxes, but there's no other elegant way to deal with it. see talk page
sanitized-css
text/css
/* {{pp|small=y}} */
.navbox {
box-sizing: border-box;
border: 1px solid #a2a9b1;
width: 100%;
clear: both;
font-size: 88%;
text-align: center;
padding: 1px;
margin: 1em auto 0; /* Prevent preceding content from clinging to navboxes */
}
.navbox .navbox {
margin-top: 0; /* No top margin for nested navboxes */
}
.navbox + .navbox, /* TODO: remove first line after transclusions have updated */
.navbox + .navbox-styles + .navbox {
margin-top: -1px; /* Single pixel border between adjacent navboxes */
}
.navbox-inner,
.navbox-subgroup {
width: 100%;
}
.navbox-group,
.navbox-title,
.navbox-abovebelow {
padding: 0.25em 1em;
line-height: 1.5em;
text-align: center;
}
.navbox-group {
white-space: nowrap;
/* @noflip */
text-align: right;
}
.navbox,
.navbox-subgroup {
background-color: #fdfdfd;
}
.navbox-list {
line-height: 1.5em;
border-color: #fdfdfd; /* Must match background color */
}
.navbox-list-with-group {
text-align: left;
border-left-width: 2px;
border-left-style: solid;
}
/* cell spacing for navbox cells */
/* Borders above 2nd, 3rd, etc. rows */
/* TODO: figure out how to replace tr as structure;
* with div structure it should be just a matter of first-child */
tr + tr > .navbox-abovebelow,
tr + tr > .navbox-group,
tr + tr > .navbox-image,
tr + tr > .navbox-list {
border-top: 2px solid #fdfdfd; /* Must match background color */
}
.navbox-title {
background-color: #ccf; /* Level 1 color */
}
.navbox-abovebelow,
.navbox-group,
.navbox-subgroup .navbox-title {
background-color: #ddf; /* Level 2 color */
}
.navbox-subgroup .navbox-group,
.navbox-subgroup .navbox-abovebelow {
background-color: #e6e6ff; /* Level 3 color */
}
.navbox-even {
background-color: #f7f7f7;
}
.navbox-odd {
background-color: transparent;
}
/* TODO: figure out how to remove reliance on td as structure */
.navbox .hlist td dl,
.navbox .hlist td ol,
.navbox .hlist td ul,
.navbox td.hlist dl,
.navbox td.hlist ol,
.navbox td.hlist ul {
padding: 0.125em 0;
}
.navbox .navbar {
display: block;
font-size: 100%;
}
.navbox-title .navbar {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
/* @noflip */
margin-right: 0.5em;
}
r3sdo030s2y37osfqh0rur7i26x9epy
Module:Navbox top and bottom
828
69183309
1053571128
1053403404
2021-11-04T18:00:00Z
MusikBot II
29539620
Protected "[[Module:Navbox top and bottom]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3931 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
Scribunto
text/plain
-- This implements {{navbox top}} and {{navbox bottom}}
local p = {}
local function build_navbox(parentArgs, list)
local args = {}
for argName, value in pairs(parentArgs) do
if value ~= '' then
if type(argName) == 'string' then
args[argName] = value
end
end
end
args['bodystyle'] = 'display:table;' .. (args['bodystyle'] or '')
args['list1padding'] = '0'
args['list1style'] = 'border-width:0;'
args['list1'] = list
-- Note Navbox.navbox() has a kludge to order the parent frame's args
-- into a specific order. For now, this is omitted from this module.
local Navbox = require('Module:Navbox')
return Navbox._navbox(args)
end
function p.top(frame)
local args = frame:getParent().args
local parts = mw.text.split(build_navbox(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[1]
end
function p.bottom(frame)
local args = frame:getParent().args
local parts = mw.text.split(build_navbox(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[2]
end
return p
k4u6pww6woolztix1exofx2t2yk7vf6
Module:Navboxes
828
49336059
1080149775
880025066
2022-03-30T15:43:36Z
Ahecht
2016996
support direct invocation
Scribunto
text/plain
-- This implements Template:navboxes
local p = {}
local getArgs = require('Module:Arguments').getArgs
local Navbox = require('Module:Navbox')
local function isnotempty(s)
return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end
local function navboxes(args, list)
local navbar = (args['state'] and args['state'] == 'off') and 'off' or 'plain'
local title = args['title'] or 'Links to related articles'
local titlestyle = 'background:' .. (args['bg'] or '#e8e8ff') .. ';'
.. (isnotempty(args['fg']) and ('color:' .. args['fg'] .. ';') or '')
.. (isnotempty(args['bordercolor']) and ('border: 1px solid ' .. args['bordercolor'] .. ';') or '')
.. (args['titlestyle'] or '')
return Navbox._navbox({
navbar = navbar, title = title,
list1 = list,
state = args['state'] or 'collapsed',
titlestyle = titlestyle,
liststyle = 'font-size:114%',
listpadding = '0px',
tracking = 'no'
})
end
function p.top(frame)
local args = getArgs(frame)
local parts = mw.text.split(navboxes(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[1]
end
function p.bottom(frame)
local args = {}
local parts = mw.text.split(navboxes(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[2]
end
function p.navbox(frame)
local args = getArgs(frame)
local list = args['list1'] or args['list'] or ''
local track_cats = ''
if list == '' then
if mw.title.getCurrentTitle().namespace == 0 then
track_cats = '[[Category:Navboxes template with no content]]'
end
end
return navboxes(args, list) .. track_cats
end
return p
lzbz1dwwgd1pcozj0sff0cr91tyvwo2
Module:No globals
828
42567026
948473889
948472526
2020-04-01T06:28:55Z
MusikAnimal
14882394
Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])
Scribunto
text/plain
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
error('Tried to read nil global ' .. tostring(k), 2)
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error('Tried to write global ' .. tostring(k), 2)
end
rawset(t, k, v)
end
setmetatable(_G, mt)
gggsv54pq7f94l3up48hr91qtxnskdm
Module:Noinclude
828
52107793
746841122
746799326
2016-10-29T22:09:44Z
CambridgeBayWeather
294180
Protected "[[Module:Noinclude]]": [[WP:High-risk templates|High-risk Lua module]] ([Edit=Require template editor access] (indefinite))
Scribunto
text/plain
local p = {}
function p.noinclude(frame)
return frame:getParent():preprocess("<noinclude>" .. frame.args.text .. "</noinclude>");
end
return p
46540us5h0lf6rm25j7fyb26bxvq4q9
Module:Ns has subpages
828
44657407
637438142
637436476
2014-12-10T06:37:29Z
Mr. Stradivarius
4708675
Protected Module:Ns has subpages: [[WP:High-risk templates|High-risk Lua module]] ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
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
Module:Official website
828
49011003
1058036045
975989930
2021-12-01T02:12:57Z
Uzume
51070
update to use new mw.wikibase API changes
Scribunto
text/plain
local makeUrl = require('Module:URL')._url
local p = {}
-- Wrapper for pcall which returns nil on failure.
local function quickPcall(func)
local success, result = pcall(func)
if success then
return result
end
end
-- Gets the rank for a Wikidata property table. Returns 1, 0 or -1, in
-- order of rank.
local function getRank(prop)
local rank = prop.rank
if rank == 'preferred' then
return 1
elseif rank == 'normal' then
return 0
elseif rank == 'deprecated' then
return -1
else
-- No rank or undefined rank is treated as "normal".
return 0
end
end
-- Finds whether a Wikidata property is qualified as being in English.
local function isEnglish(prop)
local ret = quickPcall(function ()
for i, lang in ipairs(prop.qualifiers.P407) do
if lang.datavalue.value['numeric-id'] == 1860 then
return true
end
end
return false
end)
return ret == true
end
-- Fetches the official website URL from Wikidata.
local fetchWikidataUrl
fetchWikidataUrl = function()
-- Get objects for all official sites on Wikidata.
local websites = quickPcall(function ()
return mw.wikibase.getAllStatements(mw.wikibase.getEntityIdForCurrentPage(), 'P856')
end)
-- Clone the objects in case other code needs them in their original order.
websites = websites and mw.clone(websites) or {}
-- Add the table index to the objects in case it is needed in the sort.
for i, website in ipairs(websites) do
website._index = i
end
-- Sort the websites, first by highest rank, and then by websites in the
-- English language, then by the website's original position in the
-- property list. When we are done, get the URL from the highest-sorted
-- object.
table.sort(websites, function(ws1, ws2)
local r1 = getRank(ws1)
local r2 = getRank(ws2)
if r1 ~= r2 then
return r1 > r2
end
local e1 = isEnglish(ws1)
local e2 = isEnglish(ws2)
if e1 ~= e2 then
return e1
end
return ws1._index < ws2._index
end)
local url = quickPcall(function ()
return websites[1].mainsnak.datavalue.value
end)
-- Cache the result so that we only do the heavy lifting once per #invoke.
fetchWikidataUrl = function ()
return url
end
return url
end
-- Render the URL link, plus other visible output.
local function renderUrl(options)
if not options.url and not options.wikidataurl then
local qid = mw.wikibase.getEntityIdForCurrentPage()
local result = '<strong class="error">' ..
'No URL found. Please specify a URL here or add one to Wikidata.' ..
'</strong>'
if qid then
result = result.. ' [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/' .. qid .. '#P856|Edit this at Wikidata]]'
end
return result
end
local ret = {}
ret[#ret + 1] = string.format(
'<span class="official-website">%s</span>',
makeUrl(options.url or options.wikidataurl, options.display)
)
if options.wikidataurl and not options.url then
local qid = mw.wikibase.getEntityIdForCurrentPage()
if qid then
ret[#ret + 1] = '[[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/' .. qid .. '#P856|Edit this at Wikidata]]'
end
end
if options.format == 'flash' then
ret[#ret + 1] = mw.getCurrentFrame():expandTemplate{
title = 'Color',
args = {'#505050', '(Requires [[Adobe Flash Player]])'}
}
end
if options.mobile then
ret[#ret + 1] = '(' .. makeUrl(options.mobile, 'Mobile') .. ')'
end
return table.concat(ret, ' ')
end
-- Render the tracking category.
local function renderTrackingCategory(url, wikidataurl)
if mw.title.getCurrentTitle().namespace ~= 0 then
return ''
end
local category
if not url and not wikidataurl then
category = 'Official website missing URL'
elseif not url and wikidataurl then
return ''
elseif url and wikidataurl then
if url:gsub('/%s*$', '') ~= wikidataurl:gsub('/%s*$', '') then
category = 'Official website different in Wikidata and Wikipedia'
end
else
category = 'Official website not in Wikidata'
end
return category and string.format('[[Category:%s]]', category) or ''
end
function p._main(args)
local url = args[1] or args.URL or args.url
local wikidataurl = fetchWikidataUrl()
local formattedUrl = renderUrl{
url = url,
wikidataurl = wikidataurl,
display = args[2] or args.name or 'Official website',
format = args.format,
mobile = args.mobile
}
return formattedUrl .. renderTrackingCategory(url, wikidataurl)
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Official website'
})
return p._main(args)
end
return p
iwfkl44ed9889us5r0zb4qiigqay9vq
Module:Ordinal
828
51024595
888228748
884669415
2019-03-17T19:44:32Z
Pppery
28032115
[[Module:Ordinal/testcases]] doesn't exist; no prejudice against reverting when the testcases are created
Scribunto
text/plain
--[[
This template will add the appropriate ordinal suffix to a given integer.
Please do not modify this code without applying the changes first at
Module:Ordinal/sandbox and testing.
]]
local p = {}
local yesno = require('Module:Yesno') -- boolean value interpretation
--[[
This function converts an integer value into a numeral followed by ordinal indicator.
The output string might contain HTML tags.
Usage:
{{#invoke:Ordinal|ordinal|1=|2=|sup=}}
{{#invoke:Ordinal|ordinal}} - uses the caller's parameters
Parameters
1: Any number or string.
2: Set to "d" if the module should display "d" instead of "nd" and "rd".
sup: Set to yes/no to toggle superscript ordinal suffix.
]]
function p.ordinal(frame)
local args = frame.args
if args[1] == nil then
args = frame:getParent().args
end
if args[1] == nil then
args[1] = "{{{1}}}"
end
return p._ordinal(args[1], (args[2] == 'd'), yesno(args.sup))
end
function p._ordinal(n, d, sup)
local x = tonumber(mw.ustring.match(n, "(%d*)%W*$"))
local suffix = "th"
-- If tonumber(n) worked:
if x then
local mod10 = math.abs(x) % 10
local mod100 = math.abs(x) % 100
if mod10 == 1 and mod100 ~= 11 then
suffix = "st"
elseif mod10 == 2 and mod100 ~= 12 then
if d then suffix = "d" else suffix = "nd" end
elseif mod10 == 3 and mod100 ~= 13 then
if d then suffix = "d" else suffix = "rd" end
end
end
if sup then
suffix = "<sup>" .. suffix .. "</sup>"
end
return n .. suffix
end
return p
azbrsdhoe8ec6qvwgy7myjj7iz9onjy
Module:Page
828
38871182
885089473
866683104
2019-02-25T22:06:47Z
MusikAnimal
14882394
Changed protection level for "[[Module:Page]]": [[Wikipedia:High-risk templates|High-risk template or module]]; used in system message ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
local callAssert = require('Module:CallAssert')
local function main(frame, field)
local args, pargs = frame.args, ( frame:getParent() or {} ).args or {}
local makeTitle=args.makeTitle or pargs.makeTitle
local namespace=args.namespace or pargs.namespace or ""
local fragment=args.fragment or pargs.fragment or ""
local interwiki=args.interwiki or pargs.interwiki or ""
local page=args.page or args[1] or pargs.page or pargs[1] or ""
local id= tonumber( args.id or pargs.id )
local pn = {}
local title -- holds the result of the mw.title.xxx call
for i = 1,9 do pn[i] = args['p'..i] or pargs['p'..i] end
if not id and not mw.ustring.match( page, '%S' ) then page = nil end
if id then
title = callAssert(mw.title.new, 'mw.title.new', id)
elseif not page then
title = callAssert(mw.title.getCurrentTitle, 'getCurrentTitle')
elseif makeTitle then
title = callAssert(mw.title.makeTitle, 'makeTitle', namespace, page, fragment, interwiki)
else
title = callAssert(mw.title.new, 'mw.title.new', page, namespace)
end
local result = title[field]
if type(result) == "function" then
result = result(title, unpack(pn))
end
return tostring(result or "")
end
-- handle all errors in main
main = require('Module:Protect')(main)
local p = {}
-- main function does all the work
local meta = {}
function meta.__index(self, key)
return function(frame)
return main(frame, key)
end
end
setmetatable(p, meta)
function p.getContent(frame)
local args, pargs = frame.args, ( frame:getParent() or {} ).args or {}
local fmt = args.as or pargs.as or "pre"
local text = main(frame, "getContent")
fmt = mw.text.split( fmt, ", ?" )
for _, how in ipairs( fmt ) do
if how == "pre" then
text = table.concat{ "<pre>", text, "</pre>" }
elseif how == "expand" then
text = frame:preprocess(text)
elseif how == "nowiki" then
text = mw.text.nowiki(text)
end
end
return text
end
return p
i5nta7bvbxrzeibp6t5xzwzjtd3dtc4
Module:Pagetype
828
40875383
963271820
960206111
2020-06-18T21:22:08Z
RexxS
6112901
add caps parameter per talk request
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- PAGETYPE --
-- --
-- This is a meta-module intended to replace {{pagetype}} and similar --
-- templates. It 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 getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local nsDetectModule = require('Module:Namespace detect')
local nsDetect = nsDetectModule._main
local getParamMappings = nsDetectModule.getParamMappings
local getPageObject = nsDetectModule.getPageObject
local p = {}
local function shallowCopy(t)
-- Makes a shallow copy of a table.
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
local function checkPagetypeInput(namespace, val)
-- Checks to see whether we need the default value for the given namespace,
-- and if so gets it from the pagetypes table.
-- The yesno function returns true/false for "yes", "no", etc., and returns
-- val for other input.
local ret = yesno(val, val)
if ret and type(ret) ~= 'string' then
ret = cfg.pagetypes[namespace]
end
return ret
end
local function getPagetypeFromClass(class, param, aliasTable, default)
-- Gets the pagetype from a class specified from the first positional
-- parameter.
param = yesno(param, param)
if param ~= false then -- No check if specifically disallowed.
for _, alias in ipairs(aliasTable) do
if class == alias then
if type(param) == 'string' then
return param
else
return default
end
end
end
end
end
local function getNsDetectValue(args)
-- Builds the arguments to pass to [[Module:Namespace detect]] and returns
-- the result.
-- Get the default values.
local ndArgs = {}
local defaultns = args[cfg.defaultns]
if defaultns == cfg.defaultnsAll then
ndArgs = shallowCopy(cfg.pagetypes)
else
local defaultnsArray
if defaultns == cfg.defaultnsExtended then
defaultnsArray = cfg.extendedNamespaces
elseif defaultns == cfg.defaultnsNone then
defaultnsArray = {}
else
defaultnsArray = cfg.defaultNamespaces
end
for _, namespace in ipairs(defaultnsArray) do
ndArgs[namespace] = cfg.pagetypes[namespace]
end
end
--[[
-- Add custom values passed in from the arguments. These overwrite the
-- defaults. The possible argument names are fetched from
-- Module:Namespace detect automatically in case new namespaces are
-- added. Although we accept namespace aliases as parameters, we only pass
-- the local namespace name as a parameter to Module:Namespace detect.
-- This means that the "image" parameter can overwrite defaults for the
-- File: namespace, which wouldn't work if we passed the parameters through
-- separately.
--]]
local mappings = getParamMappings()
for ns, paramAliases in pairs(mappings) do
-- Copy the aliases table, as # doesn't work with tables returned from
-- mw.loadData.
paramAliases = shallowCopy(paramAliases)
local paramName = paramAliases[1]
-- Iterate backwards along the array so that any values for the local
-- namespace names overwrite those for namespace aliases.
for i = #paramAliases, 1, -1 do
local paramAlias = paramAliases[i]
local ndArg = checkPagetypeInput(paramAlias, args[paramAlias])
if ndArg == false then
-- If any arguments are false, convert them to nil to protect
-- against breakage by future changes to
-- [[Module:Namespace detect]].
ndArgs[paramName] = nil
elseif ndArg then
ndArgs[paramName] = ndArg
end
end
end
-- Check for disambiguation-class and N/A-class pages in mainspace.
if ndArgs.main then
local class = args[1]
if type(class) == 'string' then
-- Put in lower case so e.g. "Dab" and "dab" will both match.
class = mw.ustring.lower(class)
end
local dab = getPagetypeFromClass(
class,
args[cfg.dab],
cfg.dabAliases,
cfg.dabDefault
)
if dab then
ndArgs.main = dab
else
local na = getPagetypeFromClass(
class,
args[cfg.na],
cfg.naAliases,
cfg.naDefault
)
if na then
ndArgs.main = na
end
end
end
-- If there is no talk value specified, use the corresponding subject
-- namespace for talk pages.
if not ndArgs.talk then
ndArgs.subjectns = true
end
-- Add the fallback value. This can also be customised, but it cannot be
-- disabled.
local other = args[cfg.other]
-- We will ignore true/false/nil results from yesno here, but using it
-- anyway for consistency.
other = yesno(other, other)
if type(other) == 'string' then
ndArgs.other = other
else
ndArgs.other = cfg.otherDefault
end
-- Allow custom page values.
ndArgs.page = args.page
return nsDetect(ndArgs)
end
local function detectRedirects(args)
local redirect = args[cfg.redirect]
-- The yesno function returns true/false for "yes", "no", etc., and returns
-- redirect for other input.
redirect = yesno(redirect, redirect)
if redirect == false then
-- Detect redirects unless they have been explicitly disallowed with
-- "redirect=no" or similar.
return
end
local pageObject = getPageObject(args.page)
-- If we are using subject namespaces elsewhere, do so here as well.
if pageObject
and not yesno(args.talk, true)
and args[cfg.defaultns] ~= cfg.defaultnsAll
then
pageObject = getPageObject(
pageObject.subjectNsText .. ':' .. pageObject.text
)
end
-- Allow custom values for redirects.
if pageObject and pageObject.isRedirect then
if type(redirect) == 'string' then
return redirect
else
return cfg.redirectDefault
end
end
end
function p._main(args)
local redirect = detectRedirects(args)
local pagetype = ""
if redirect then
pagetype = redirect
else
pagetype = getNsDetectValue(args)
end
if yesno(args.plural, false) then
if cfg.irregularPlurals[pagetype] then
pagetype = cfg.irregularPlurals[pagetype]
else
pagetype = pagetype .. cfg.plural -- often 's'
end
end
if yesno(args.caps, false) then
pagetype = mw.ustring.upper(mw.ustring.sub(pagetype, 1, 1)) ..
mw.ustring.sub(pagetype, 2)
end
return pagetype
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
return p
3uutklb10j89clizor7gnyrlkhbqg0d
Module:Pagetype/config
828
42396800
1032938598
1029747509
2021-07-10T15:47:32Z
Trialpears
35786750
Book namespace removal will happen within a few days
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 values to use for "main=true", "user=true", etc. Keys to
-- this table should be namespace parameters that can be used with
-- [[Module:Namespace detect]].
cfg.pagetypes = {
['main'] = 'article',
['user'] = 'user page',
['project'] = 'project page',
['wikipedia'] = 'project page',
['wp'] = 'project page',
['file'] = 'file',
['image'] = 'file',
['mediawiki'] = 'interface page',
['template'] = 'template',
['help'] = 'help page',
['category'] = 'category',
['portal'] = 'portal',
['draft'] = 'draft',
['timedtext'] = 'Timed Text page',
['module'] = 'module',
['topic'] = 'topic',
['gadget'] = 'gadget',
['gadget definition'] = 'gadget definition',
['talk'] = 'talk page',
['special'] = 'special page',
['media'] = 'file',
}
-- This table holds the names of the namespaces to be looked up from
-- cfg.pagetypes by default.
cfg.defaultNamespaces = {
'main',
'file',
'template',
'category',
'module'
}
-- This table holds the names of the namespaces to be looked up from
-- cfg.pagetypes if cfg.defaultnsExtended is set.
cfg.extendedNamespaces = {
'main',
'user',
'project',
'file',
'mediawiki',
'template',
'category',
'help',
'portal',
'module',
'draft'
}
-- 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 disambiguation pages page.
cfg.dab = 'dab'
-- This table holds the different possible aliases for disambiguation-class
-- pages. These should be lower-case.
cfg.dabAliases = {
'disambiguation',
'disambig',
'disamb',
'dab'
}
-- 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', 'n/a'}
-- 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
qi8m5o0e66j9quw6kiawd2otsulzq9m
Module:Plain text
828
57117910
1054146023
1048464689
2021-11-08T09:46:54Z
Dinoguy1000
2412089
horizontal rules created via ---- can have any number of dashes after the first four
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
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('<.->.-<.->', '') --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
iav2fnozby82lzrlyf7cfy5wxhjm0dx
Module:Political party
828
68574299
1060274195
1059288078
2021-12-14T13:54:10Z
Primefac
11508456
add in option for using "colour" as an input option
Scribunto
text/plain
local p = {}
local default_color = '#F8F9FA'
local categories = {
party_not_in_list = '[[Category:Pages using Political party with unknown party]]',
shortname_not_in_list = '[[Category:Pages using Political party with missing shortname]]',
color_not_in_list = '[[Category:Pages using Political party with missing color]]',
}
local function create_error(error_message)
return string.format('<strong class="error">%s</strong>', error_message)
end
local function getFirstLetter(party)
local index = mw.ustring.sub(party, 1, 1)
-- Set index for non-A-Z starts
if string.match(index, '%A') then
return '1'
end
return string.upper(index)
end
local function stripToNil(text)
-- If text is a string, return its trimmed content, or nil if empty.
-- Otherwise return text (which may, for example, be nil).
if type(text) == 'string' then
text = text:match('(%S.-)%s*$')
local delink = require('Module:Delink')._delink
text = delink({text, wikilinks = "target"})
end
return text
end
-- Example of having all the data - color and names - in one table. Requires one page to be edited instead of two when adding a new party.
function p._fetch(args)
if not args[1] then
return create_error("parameter 1 should be a party name.")
end
if not args[2] then
return create_error("parameter 2 should be the output type.")
end
local party = stripToNil(args[1])
local out_type = stripToNil(args[2])
if out_type == 'colour' then
out_type = 'color'
end
local index = getFirstLetter(party)
-- Load data from submodule
local data = mw.loadData('Module:Political party/' .. index)
local data_all = data.full
local party_alt = data.alternate[party]
local party_info
if party_alt then
if data_all[party_alt] then
party_info = data_all[party_alt]
else
index = getFirstLetter(party_alt)
data = mw.loadData('Module:Political party/' .. index)
party_info = data.full[party_alt]
end
else
party_info = data_all[party]
end
-- Check if database value exists
-- * Not even in database - return given error or input
-- * No color - return error
-- * No shortname/abbrev - return first non-blank of abbrev->shortname->input
if not party_info then
if out_type == 'color' then
return args.error or default_color
else
return args.error or party
end
end
local return_value = party_info[out_type]
if return_value == "" then
if out_type == 'color' then
return args.error or create_error("Value not in template. Please request that it be added.")
elseif out_type == 'abbrev' then
if party_info.shortname ~= "" then
return party_info.shortname
else
return party
end
elseif out_type == 'shortname' then
if party_info.abbrev ~= "" then
return party_info.abbrev
else
return party
end
else
return party
end
end
if out_type == 'color' and string.find(return_value, '#') then
return_value = string.gsub(return_value, '#', '#')
end
return return_value
end
function p.fetch(frame)
-- Initialise and populate variables
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
return p._fetch(args)
end
return p
a22nrs3mu7354d8vgqm4gvq2do7ny9y
Module:Political party/A
828
68667041
1096709002
1096112220
2022-07-06T05:10:22Z
N Panama 84534
38274583
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["A test"] = {main = "Business and Professional Group", abbrev = "AT", shortname = "atest"},
["A Better Britain - Unionist Party"] = "A Better Britain – Unionist Party",
["A Public Party"] = "Other parties",
["Abolish the Welsh Assembly"] = "Abolish the Welsh Assembly Party",
["ABV"] = "Alternative for Bulgarian Revival",
["ACT Teachers"] = "ACT Teachers Partylist",
["Action Coalition for Thailand Party"] = "Action Coalition for Thailand",
["Action Committee for Democracy and Pensions Justice"] = "Alternative Democratic Reform Party",
["Action Party (Italy, 1848)"] = "Action Party (Italy, 1853)",
["Action (Italy)"] = "Action (Italian political party)",
["Adal (party)"] = "Adal (political party)",
["Adams Party (United States)"] = "Anti-Jacksonian Party",
["Adams-Clay Republican"] = "Democratic-Republican Party",
["Adelante Andalucía"] = "Adelante Andalucía (2018)",
["ADPL"] = "Hong Kong Association for Democracy and People's Livelihood",
["Advance NZ"] = "Advance New Zealand",
["African Independence Party of Guinea and Cape Verde"] = "African Party for the Independence of Guinea and Cape Verde",
["Aggrupation of Parties for Progress"] = "Aggrupation of Parties for Prosperity",
["Agrarian Party (Tajikistan)"] = "Agrarian Party of Tajikistan",
["Agrarian Party of Albania"] = "Environmentalist Agrarian Party",
["Agreement for Catalonia Progress"] = "Catalan Agreement of Progress",
["Agreement of Left Nationalists"] = "Left Nationalists",
["Agreement of Nationalist Unity"] = "Canarian Coalition",
["AIADMK"] = "All India Anna Dravida Munnetra Kazhagam",
["AITC"] = "Trinamool Congress",
["Akbayan Citizens' Action Party"] = "Akbayan",
["Akhil Bharatiya Lok Tantrik Congress"] = "Akhil Bharatiya Loktantrik Congress",
["Akhil Bharatiya Loktantrik Congres"] = "Akhil Bharatiya Loktantrik Congress",
["Aksyon Demokratiko"] = "Aksyon",
["Alabama Democratic Party"] = "Democratic Party (US)",
["Alabama Republican Party"] = "Republican Party (US)",
["Alaska Democratic Party"] = "Democratic Party (US)",
["Alaska Libertarian Party"] = "Libertarian Party (US)",
["Alaskan Independence Party"] = "Independence Party (US)",
["Albanian Fascist Party"] = "Fascist Party of Albania",
["Albanian Liberal Party"] = "Liberal Party of Albania",
["Alignment (political party)"] = "Alignment (Israel)",
["All Ceylon Muslim Congress"] = "All Ceylon Makkal Congress",
["All India Majlis-E-Ittehadul Muslimeen"] = "All India Majlis-e-Ittehadul Muslimeen",
["All India Trinamool Congress"] = "Trinamool Congress",
["All-Democratic Agricultural Front"] = "United Democratic Left",
["All-Ukrainian Union \"Fatherland\""] = "Batkivshchyna",
["All-Ukrainian Union \"Freedom\""] = "Svoboda (political party)",
["All-Ukrainian Union \"Svoboda\""] = "Svoboda (political party)",
["All"] = "Alleanza Bidla",
["Alliance '90/The Greens"] = "Alliance 90/The Greens",
["Alliance (New Zealand)"] = "Alliance (New Zealand political party)",
["Alliance for Human Rights, Animal and Environmental Protection"] = "Alliance for Human Rights, Animal and Nature Protection",
["Alliance for Progress and Renewal"] = "Liberal Conservative Reformers",
["Alliance for the Reliberation of Somalia"] = "Alliance for the Re-liberation of Somalia",
["Alliance of Alenka Bratušek"] = "Party of Alenka Bratušek",
["Alliance of Conservatives and Reformists in Europe"] = "Alliance of European Conservatives and Reformists",
["Alliance of Liberals and Democrats for Europe Group"] = "Alliance of Liberals and Democrats for Europe group",
["Alliance of Liberals and Democrats for Europe Party"] = "Alliance of Liberals and Democrats for Europe",
["Alliance of Progressive"] = "Alliance of Progressives",
["Alliance Party"] = "Alliance Party (Fiji)",
["Alternativa (Italy)"] = "Alternativa (Italian political party)",
["American Independent Party (United States)"] = "American Independent Party",
["American Independent"] = "American Independent Party",
["American Party (United States)"] = "Know Nothing",
["American Party (US)"] = "Know Nothing",
["American Party of South Carolina"] = "American Party (South Carolina)",
["American Party"] = "Know Nothing",
["Amma Makkal Munnetra Kazhagam"] = "Amma Makkal Munnettra Kazagam",
["Amplitude"] = "Amplitude (political party)",
["Amra Bangalee"] = "Amra Bangali",
["An Independence from Europe"] = "Independence from Europe",
["Anguilla United Front (2020)"] = "Anguilla United Front",
["Animals Count"] = "Animal Welfare Party",
["Anova-Nationalist Brotherhood"] = "Renewal–Nationalist Brotherhood",
["Anova–Nationalist Brotherhood"] = "Renewal–Nationalist Brotherhood",
["ANP"] = "Awami National Party",
["Anti Revolutionary Party"] = "Anti-Revolutionary Party",
["Anti-Administration Party (United States)"] = "Anti-Administration Party (US)",
["Anti-Austerity Alliance-People Before Profit"] = "People Before Profit/Solidarity",
["Anti-Jacksonian Party (United States)"] = "Anti-Jacksonian Party",
["Anti-Jacksonian Party (US)"] = "Anti-Jacksonian Party",
["Anti-Jacksonian"] = "Anti-Jacksonian Party",
["Anti-Lecompton Democratic Party (US)"] = "Democratic Party (US)",
["Anti-Masonic Party (United States)"] = "Anti-Masonic Party",
["Anti-Monopoly Party (United States)"] = "Anti-Monopoly Party (US)",
["Anti-Parnellite"] = "Irish National Federation",
["Aosta Valley"] = "Aosta Valley (political coalition)",
["AP–PDP–PDL–UCD"] = "People's Alliance (Spain)",
["Arab Socialist Union (Syria)"] = "Arab Socialist Union Party (Syria)",
["AraCatalunya"] = "Ara Reus",
["Arise the Republic"] = "Debout la République",
["Arizona Democratic Party"] = "Democratic Party (US)",
["Arizona Green Party"] = "Green Party (US)",
["Arizona Republican Party"] = "Republican Party (US)",
["Armenian Democratic Liberal Party"] = "Ramgavar",
["Armenian Renaissance (party)"] = "Orinats Yerkir",
["Armenian Revolutionary Federation in Lebanon"] = "Armenian Revolutionary Federation",
["Article 1 – Democratic and Progressive Movement"] = "Article One (political party)",
["Article One (Italy)"] = "Article One (political party)",
["Article One"] = "Article One (political party)",
["Artikel 1"] = "BIJ1",
["Association for Democracy and People's Livelihood"] = "Hong Kong Association for Democracy and People's Livelihood",
["Asturian Socialist Federation"] = "Spanish Socialist Workers' Party",
["Australian Country Party (1920)"] = "National Party of Australia",
["Australian Labour Party (Tasmanian Branch)"] = "Australian Labor Party (Tasmanian Branch)",
["Australian Labour Party"] = "Australian Labor Party",
["Authentic Party"] = "Partido Auténtico",
["Avante"] = "Avante (political party)",
["AWS"] = "Solidarity Electoral Action",
["Azerbaijan Democratic Party"] = "Azerbaijan Democrat Party",
}
local full = {
["A test no values"] = {abbrev = "", color = "", shortname = "",},
["A Better Britain – Unionist Party"] = {abbrev = "", color = "#000080", shortname = "",},
["A Better Future For Our Children"] = {abbrev = "ABFFOC", color = "#5F9EA0", shortname = "ABFFOC",},
["A Change for Curaçao"] = {abbrev = "", color = "#368035", shortname = "",},
["A Connecticut Party"] = {abbrev = "", color = "#FFA500", shortname = "",},
["A Guadalajara Hay Que Quererla"] = {abbrev = "", color = "#47873F", shortname = "",},
["A Just Costa Rica"] = {abbrev = "", color = "#02B2E3", shortname = "",},
["A Just Russia"] = {abbrev = "", color = "#FFC003", shortname = "",},
["A Just Russia — For Truth"] = {abbrev = "SRZP", color = "#FFC003", shortname = "",},
["A la valenciana"] = {abbrev = "", color = "#2AAB8C", shortname = "",},
["A New Era"] = {abbrev = "UNT", color = "#003399", shortname = "",},
["A Partnership for National Unity"] = {abbrev = "", color = "#1C9F43", shortname = "",},
["A-Combination"] = {abbrev = "AC", color = "#F1C40F", shortname = "",},
["A16 Alliance"] = {abbrev = "", color = "#F9AE3E", shortname = "",},
["Aam Aadmi Party"] = {abbrev = "AAP", color = "#0066A4", shortname = "",},
["Aama Odisha Party"] = {abbrev = "AOP", color = "#E1A95F", shortname = "",},
["Aapna Punjab Party"] = {abbrev = "APP", color = "#43DCFF", shortname = "",},
["Aarakashan Virodhi Party"] = {abbrev = "AVP", color = "#C171A1", shortname = "",},
["ABAKO"] = {abbrev = "", color = "#F9E99C", shortname = "",},
["Abantu Batho Congress"] = {abbrev = "", color = "#4EA338", shortname = "",},
["ABBA (Malta)"] = {abbrev = "ABBA", color = "#4C015E", shortname = "",},
["ABC (Cuba)"] = {abbrev = "", color = "#008000", shortname = "",},
["Abertzaleen Batasuna"] = {abbrev = "", color = "#800020", shortname = "",},
["Abolish the Scottish Parliament Party"] = {abbrev = "", color = "#1D8DFF", shortname = "Abolish the Scottish Parliament",},
["Abolish the Welsh Assembly Party"] = {abbrev = "", color = "#810000", shortname = "Abolish",},
["Abolition of Income Tax and Usury Party"] = {abbrev = "", color = "#99FF00", shortname = "",},
["Abono"] = {abbrev = "", color = "#B22222", shortname = "",},
["Abundant Nigeria Renewal Party"] = {abbrev = "ANRP", color = "#008000", shortname = "",},
["Academics In Support of Democracy"] = {abbrev = "", color = "#FFF100", shortname = "",},
["Accessibility without Exclusion"] = {abbrev = "PASE", color = "#4682B4", shortname = "",},
["Accion 21"] = {abbrev = "", color = "#0093D5", shortname = "",},
["Acción Chaqueña"] = {abbrev = "", color = "#000080", shortname = "",},
["Accord (Nigeria)"] = {abbrev = "A", color = "#99FF33", shortname = "",},
["Acoma Party"] = {abbrev = "", color = "red", shortname = "",},
["Acord Ciutadà"] = {abbrev = "", color = "#A91C30", shortname = "",},
["Acord pes Mercadal i Fornells"] = {abbrev = "", color = "#EFAF50", shortname = "",},
["ACT Greens"] = {abbrev = "", color = "#10C25B", shortname = "Greens",},
["ACT New Zealand"] = {abbrev = "ACT", color = "#FDE401", shortname = "",},
["Act to Stop the Decline"] = {abbrev = "", color = "#F00000", shortname = "",},
["Action (Italian political party)"] = {abbrev = "", color = "#0039AA", shortname = "Action",},
["Action (Serbia)"] = {abbrev = "", color = "#90C64A", shortname = "",},
["Action 18"] = {abbrev = "", color = "#1E5498", shortname = "",},
["Action 9"] = {abbrev = "", color = "#DBE767", shortname = "",},
["Action Alliance"] = {abbrev = "AA", color = "#3498DB", shortname = "",},
["Action Coalition for Thailand"] = {abbrev = "", color = "#2A3994", shortname = "",},
["Action Committee for Renewal"] = {abbrev = "", color = "#E4011C", shortname = "",},
["Action Congress of Nigeria"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Action Democratic Party (Nigeria)"] = {abbrev = "ADP", color = "#000080", shortname = "",},
["Action for Córdoba"] = {abbrev = "", color = "#AD1140", shortname = "",},
["Action for Independence"] = {abbrev = "", color = "#00335A", shortname = "",},
["Action for the Republic (Argentina)"] = {abbrev = "AxR", color = "#3E5298", shortname = "Action for the Republic",},
["Action for the Republic (Catalonia)"] = {abbrev = "", color = "#EC008B", shortname = "",},
["Action Front for Renewal and Development"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Action Group (Nigeria)"] = {abbrev = "", color = "red", shortname = "",},
["Action Party (Italy, 1853)"] = {abbrev = "", color = "#F0002B", shortname = "",},
["Action Party (Italy)"] = {abbrev = "", color = "#009246", shortname = "Action Party",},
["Action Party (Latvia)"] = {abbrev = "", color = "#266AAB", shortname = "",},
["Action Party (Morocco)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Action Peoples Party"] = {abbrev = "APP", color = "#DC143C", shortname = "",},
["ActionSA"] = {abbrev = "", color = "#05B615", shortname = "",},
["Active and Social Participation for Cerdanyola"] = {abbrev = "", color = "#BB1816", shortname = "",},
["Active Citizenship"] = {abbrev = "CA", color = "#BB0011", shortname = "",},
["Active Xàtiva"] = {abbrev = "", color = "#F9C21D", shortname = "",},
["Activism for Democracy Association"] = {abbrev = "", color = "#9F8170", shortname = "",},
["Actúa Torrent"] = {abbrev = "", color = "#FE8D00", shortname = "",},
["Actúa"] = {abbrev = "", color = "#007776", shortname = "",},
["Actual Equality"] = {abbrev = "", color = "#2ABE9C", shortname = "",},
["AD+PD"] = {abbrev = "", color = "#FFE700", shortname = "",},
["Adal (political party)"] = {abbrev = "", color = "#26B173", shortname = "Adal",},
["Adarshwaadi Congress Party"] = {abbrev = "ACP", color = "#81F7BE", shortname = "",},
["Adelante Andalucía (2018)"] = {abbrev = "", color = "#4EB270", shortname = "Adelante Andalucía",},
["Adelante Andalucía (2021)"] = {abbrev = "", color = "#24C87E", shortname = "Adelante Andalucía",},
["Adelante Melilla"] = {abbrev = "", color = "#535D9B", shortname = "",},
["Adelante Ourense"] = {abbrev = "", color = "#FBC000", shortname = "",},
["Adhaalath Party"] = {abbrev = "AP", color = "#31c642", shortname = "",},
["ADN Morvedre"] = {abbrev = "", color = "#A6489A", shortname = "",},
["ADÑ"] = {abbrev = "", color = "#FF7E00", shortname = "",},
["Advance (Ecuador)"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Advance New Zealand (1995)"] = {abbrev = "", color = "#AADDCC", shortname = "Advance NZ",},
["Advance New Zealand"] = {abbrev = "", color = "#1987D1", shortname = "Advance NZ",},
["Advance SA"] = {abbrev = "", color = "#10294F", shortname = "",},
["Advance San Luis"] = {abbrev = "", color = "#24A1BD", shortname = "",},
["Advance Together"] = {abbrev = "", color = "#FF008F", shortname = "Advance",},
["Advance"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Advancement Unification Party"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Afar Liberation Front"] = {abbrev = "", color = "#4189DD", shortname = "",},
["Afar National Democratic Party"] = {abbrev = "", color = "#1614BA", shortname = "",},
["Afek Tounes"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Afghan Millat Party"] = {abbrev = "", color = "red", shortname = "",},
["Africa Moral Party"] = {abbrev = "", color = "#47852C", shortname = "",},
["Africa Muslim Party"] = {abbrev = "", color = "#009f00", shortname = "",},
["Africa Restoration Alliance"] = {abbrev = "", color = "hotpink", shortname = "",},
["African Action Congress"] = {abbrev = "AAC", color = "#6F4E37", shortname = "",},
["African Christian Democratic Party"] = {abbrev = "ACDP", color = "#ba0c2f", shortname = "",},
["African Congress of Democrats"] = {abbrev = "", color = "#D12626", shortname = "",},
["African Content Movement"] = {abbrev = "", color = "#5a2d8a", shortname = "",},
["African Covenant"] = {abbrev = "", color = "#164518", shortname = "",},
["African Democratic Change"] = {abbrev = "", color = "#ff9933", shortname = "",},
["African Democratic Congress"] = {abbrev = "ADC", color = "#00A86B", shortname = "",},
["African Democratic Rally (Burkina Faso)"] = {abbrev = "", color = "#000000", shortname = "",},
["African Democratic Rally"] = {abbrev = "", color = "#000000", shortname = "",},
["African Forum for Reconstruction"] = {abbrev = "", color = "red", shortname = "",},
["African Independence Party – Renewal"] = {abbrev = "", color = "red", shortname = "",},
["African Independence Party (Burkina Faso)"] = {abbrev = "", color = "red", shortname = "",},
["African Independence Party (Touré)"] = {abbrev = "", color = "red", shortname = "",},
["African Independent Congress"] = {abbrev = "", color = "#ffb543", shortname = "",},
["African National Congress"] = {abbrev = "ANC", color = "#006600", shortname = "",},
["African Party for the Independence of Cape Verde"] = {abbrev = "PAICV", color = "#FCD116", shortname = "",},
["African Party for the Independence of Guinea and Cape Verde"] = {abbrev = "PAIGC", color = "#FF0000", shortname = "",},
["African People's Bloc"] = {abbrev = "BPA", color = "#F38C22", shortname = "",},
["African People's Convention"] = {abbrev = "", color = "#007500", shortname = "",},
["African People's Socialist Party"] = {abbrev = "", color = "#EA202C", shortname = "African People's Socialist",},
["African Regroupment Party – Senegal"] = {abbrev = "", color = "#5C96C4", shortname = "",},
["African Renaissance Unity Party"] = {abbrev = "", color = "#85251B", shortname = "",},
["African Security Congress"] = {abbrev = "", color = "#F21313", shortname = "",},
["African Socialist Movement"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["African Solidarity for Democracy and Independence"] = {abbrev = "", color = "#CC0707", shortname = "",},
["African Transformation Movement"] = {abbrev = "", color = "#00ADEE", shortname = "",},
["Afrikan Alliance of Social Democrats"] = {abbrev = "", color = "#179123", shortname = "",},
["Afrikaner Party"] = {abbrev = "", color = "#007090", shortname = "",},
["Afrikaner self-determination Party"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Afro-Shirazi Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Against all"] = {abbrev = "", color = "#000000", shortname = "",},
["Agalev"] = {abbrev = "", color = "#1B7710", shortname = "",},
["Agang South Africa"] = {abbrev = "", color = "#008752", shortname = "Agang SA",},
["Agar Jan Party"] = {abbrev = "AGRJP", color = "#B9C1C0", shortname = "",},
["Aggrupation of Parties for Prosperity"] = {abbrev = "APP", color = "#1325ae", shortname = "",},
["Agir (France)"] = {abbrev = "", color = "#43519E", shortname = "Agir",},
["Agir (Brazil)"] = {abbrev = "", color = "#025B97", shortname = "Agir",},
["Agora (Belgium)"] = {abbrev = "", color = "#4DBCB4", shortname = "",},
["Agrarian Bloc Electoral Group"] = {abbrev = "", color = "#32B2A3", shortname = "",},
["Agrarian Labor Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Agrarian League (Finland)"] = {abbrev = "", color = "#74C365", shortname = "Agrarian",},
["Agrarian Liberal"] = {abbrev = "", color = "#548D54", shortname = "",},
["Agrarian Democratic Party"] = {abbrev = "ADS", color = "#30A741", shortname = "",},
["Agrarian Party (Chile)"] = {abbrev = "", color = "#9ACD32", shortname = "",},
["Agrarian Party (Italy)"] = {abbrev = "", color = "#006600", shortname = "Agrarian",},
["Agrarian Party (Yugoslavia)"] = {abbrev = "", color = "#3D863D", shortname = "",},
["Agrarian Party of Greece"] = {abbrev = "", color = "yellow", shortname = "Agrarian",},
["Agrarian Party of Moldova"] = {abbrev = "", color = "#16924C", shortname = "",},
["Agrarian Party of Russia"] = {abbrev = "APR", color = "#EED23C", shortname = "",},
["Agrarian Party of Tajikistan"] = {abbrev = "", color = "#FDDC1D", shortname = "",},
["Agrarian Party of Turkmenistan"] = {abbrev = "TAP", color = "#FFD700", shortname = "",},
["Agrarian Party of Ukraine"] = {abbrev = "APU", color = "#80AC4D", shortname = "",},
["Agrarian People's Union"] = {abbrev = "", color = "#FF7212", shortname = "",},
["Agrarian Union (Poland)"] = {abbrev = "ZC", color = "#279B6A", shortname = "",},
["Agrarian Union \"Aleksandar Stamboliyski\""] = {abbrev = "", color = "#FE9901", shortname = "",},
["Agreement (political party)"] = {abbrev = "", color = "#230871", shortname = "",},
["Agreement for the Country"] = {abbrev = "IpP", color = "#0061A5", shortname = "",},
["Agreement of Independents for Badalona"] = {abbrev = "", color = "#4CC417", shortname = "",},
["Agreement of the Catalans"] = {abbrev = "", color = "#FFD901", shortname = "",},
["Agricultural and Labour Party"] = {abbrev = "AEK", color = "#ffb4a1", shortname = "",},
["Agricultural League"] = {abbrev = "", color = "#2FBA38", shortname = "",},
["Agricultural Party of Greece"] = {abbrev = "", color = "yellow", shortname = "",},
["Agricultural Party"] = {abbrev = "", color = "#F4A460", shortname = "",},
["Agricultural Party (Czech Republic)"] = {abbrev = "ZS", color = "#00B233", shortname = "",},
["Agricultural People's Front of Peru"] = {abbrev = "FREPAP", color = "#00009B", shortname = "",},
["Agriculture and Development"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Agriculture First"] = {abbrev = "", color = "#5FC099", shortname = "",},
["AGROunia"] = {abbrev = "", color = "#BBCB15", shortname = "",},
["Aguadulce en Marcha"] = {abbrev = "", color = "#00A0B0", shortname = "",},
["Agudas Israel (Latvia)"] = {abbrev = "", color = "lightblue", shortname = "Agudas Israel",},
["Agudat Yisrael"] = {abbrev = "", color = "#033669", shortname = "",},
["Ahd 54"] = {abbrev = "", color = "#2D5A20", shortname = "",},
["Ahdut HaAvoda"] = {abbrev = "", color = "#CE2029", shortname = "",},
["Ahora Almería"] = {abbrev = "", color = "#137776", shortname = "",},
["Ahora Arganda"] = {abbrev = "", color = "#00A58E", shortname = "",},
["Ahora Basauri Orain"] = {abbrev = "", color = "#016703", shortname = "",},
["Ahora Canarias"] = {abbrev = "", color = "#11865C", shortname = "",},
["Ahora Ciempozuelos"] = {abbrev = "", color = "#3F9D2F", shortname = "",},
["Ahora Decide"] = {abbrev = "", color = "#198100", shortname = "",},
["Ahora Estella"] = {abbrev = "", color = "#B21AAA", shortname = "",},
["Ahora Getafe"] = {abbrev = "", color = "#7F4098", shortname = "",},
["Ahora Guadalajara"] = {abbrev = "", color = "#810081", shortname = "",},
["Ahora Madrid"] = {abbrev = "", color = "#00A58E", shortname = "",},
["Ahora Patria"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Ahora Repúblicas"] = {abbrev = "", color = "#FCBC43", shortname = "",},
["Ahora Santa Cruz"] = {abbrev = "", color = "#6A205F", shortname = "",},
["Ahora Sí Torremolinos"] = {abbrev = "", color = "#BB9031", shortname = "",},
["Ailtirí na hAiséirghe"] = {abbrev = "AnaA", color = "#004400", shortname = "Ailtirí na hAiséirghe",},
["Aitaira"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Ak Jol"] = {abbrev = "", color = "#FF7070", shortname = "",},
["Ak Zhol Democratic Party"] = {abbrev = "Aq Jol", color = "#0A408A", shortname = "",},
["Akali Dal"] = {abbrev = "", color = "#72474c", shortname = "",},
["Akali Dal – Sant Fateh Singh Group"] = {abbrev = "AD(SFS)", color = "#FF8000", shortname = "Akali Dal (SFS)",},
["Akbayan"] = {abbrev = "", color = "#FE0000", shortname = "Akbayan",},
["Akha National Development Party"] = {abbrev = "ANDP", color = "#374BA1", shortname = "",},
["Akhand Bharat Mahasang Sarvahara Krantikari Party"] = {abbrev = "ABMSKP", color = "#DFB43D", shortname = "",},
["Akhand Bharat Samaj Party"] = {abbrev = "ABSP", color = "#9AFE2E", shortname = "",},
["Akhand Bharti"] = {abbrev = "AB", color = "#9AFE2E", shortname = "",},
["Akhil Bharat Hindu Mahasabha"] = {abbrev = "ABHM", color = "#FFFF00", shortname = "",},
["Akhil Bharatiya Aman Committee"] = {abbrev = "ABAC", color = "#D2EFF0", shortname = "",},
["Akhil Bharatiya Congress Dal (Ambedkar)"] = {abbrev = "ABCD", color = "#FFCCCC", shortname = "",},
["Akhil Bharatiya Dalit Utthan Party"] = {abbrev = "ABDUP", color = "#F2F5A9", shortname = "",},
["Akhil Bharatiya Dharmnirpeksh Dal"] = {abbrev = "DND", color = "#EBD023", shortname = "",},
["Akhil Bharatiya Gorkha League"] = {abbrev = "ABGL", color = "#7E5692", shortname = "",},
["Akhil Bharatiya Hindu Mahasabha"] = {abbrev = "ABHM", color = "orange", shortname = "",},
["Akhil Bharatiya Jana Sangh"] = {abbrev = "ABJS", color = "#FF9933", shortname = "",},
["Akhil Bharatiya Janata Congress"] = {abbrev = "ABJC", color = "#08088A", shortname = "",},
["Akhil Bharatiya Janata Vikas Party"] = {abbrev = "BJVP", color = "#A9F5BC", shortname = "",},
["Akhil Bharatiya Loktantrik Congress"] = {abbrev = "ABLTC", color = "#93DE73", shortname = "",},
["Akhil Bharatiya Manav Adhikar Dal"] = {abbrev = "ABMAD", color = "#A264C1", shortname = "",},
["Akhil Bharatiya Ram Rajya Parishad"] = {abbrev = "RRP", color = "#330033", shortname = "",},
["Akhil Bharatiya Rashtriya Azad Hind Party"] = {abbrev = "ABRAHP", color = "#FFFF66", shortname = "",},
["Akhil Bharatiya Sena"] = {abbrev = "ABS", color = "#3060D0", shortname = "",},
["Akhil Bharatiya Shivsena Rashtrawadi"] = {abbrev = "SHS", color = "#A9F5A9", shortname = "",},
["Akhil Bharatiya Shoshit Samaj Dal"] = {abbrev = "SSD", color = "#F2F5A9", shortname = "",},
["Akhil Bharatiya Sudhar Party"] = {abbrev = "ABSP", color = "#8A4B08", shortname = "",},
["Akhil Bharatiya Vikas Congress Party"] = {abbrev = "ABVCP", color = "#F2F5A9", shortname = "",},
["Akhila India Jananayaka Makkal Katchi"] = {abbrev = "AIJMK", color = "Red", shortname = "",},
["Akhl Bharatiya Garib Mazdoor Kisan Party"] = {abbrev = "ABGMKP", color = "#ADEFE5", shortname = "",},
["Akila India Jananayaka Makkal Katchi"] = {abbrev = "AIJMK", color = "", shortname = "",},
["AKMA-PTM"] = {abbrev = "", color = "#fbe405", shortname = "",},
["Ako Bicol Political Party"] = {abbrev = "", color = "#ffff00", shortname = "Ako Bicol",},
["Akshumkar"] = {abbrev = "", color = "#3DBCCB", shortname = "",},
["Aksyon"] = {abbrev = "", color = "#9683EC", shortname = "Aksyon",},
["Aktsent"] = {abbrev = "", color = "#008DA2", shortname = "",},
["Al Asalah"] = {abbrev = "", color = "#00568B", shortname = "",},
["Al Jama-ah"] = {abbrev = "", color = "#1c9069", shortname = "",},
["Al Wefaq"] = {abbrev = "", color = "#0D4173", shortname = "",},
["Al-Ahbash"] = {abbrev = "", color = "#DDB531", shortname = "",},
["Al-Ahrar Bloc"] = {abbrev = "", color = "#000000", shortname = "al-Ahrar",},
["Al-Arabiya Coalition"] = {abbrev = "", color = "#57888D", shortname = "al-Arabiya",},
["Al-ʽAhd (Morocco)"] = {abbrev = "", color = "#915701", shortname = "",},
["Al-Irada"] = {abbrev = "", color = "#ACACAC", shortname = "",},
["Al-Islah (Yemen)"] = {abbrev = "", color = "#0463D1", shortname = "Al-Islah",},
["Al-Menber Islamic Society"] = {abbrev = "", color = "#E93230", shortname = "",},
["Al-Muthanna Club"] = {abbrev = "", color = "#000000", shortname = "",},
["Al-Muwatin"] = {abbrev = "", color = "#009933", shortname = "",},
["Al-Nour Party"] = {abbrev = "", color = "#000000", shortname = "al-Nour",},
["Al-Sadiqoun Bloc"] = {abbrev = "", color = "#B5CA7F", shortname = "",},
["Al-Wasat Party"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Al-Watan Party (Tunisia)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Al-Wataniya"] = {abbrev = "", color = "#B5CA7F", shortname = "",},
["Alajuelense Democratic Action"] = {abbrev = "PADA", color = "#FF7E1C", shortname = "",},
["Alavese Unity"] = {abbrev = "", color = "#3159A5", shortname = "",},
["Alba Party"] = {abbrev = "", color = "#005EB8", shortname = "Alba",},
["Albanian Alternative"] = {abbrev = "ASH", color = "darkblue", shortname = "",},
["Albanian Christian Democratic Party of Kosovo"] = {abbrev = "", color = "#4775BF", shortname = "",},
["Albanian Coalition"] = {abbrev = "KSH", color = "#800000", shortname = "",},
["Albanian Coalition of Preševo Valley"] = {abbrev = "KSLP", color = "#0081CC", shortname = "",},
["Albanian List (Montenegro)"] = {abbrev = "LSh", color = "#E62927", shortname = "",},
["Albanian National Front Party"] = {abbrev = "PBK", color = "black", shortname = "",},
["Albanians Decisively"] = {abbrev = "AO", color = "#B1CF70", shortname = "",},
["Alberta Independence Party"] = {abbrev = "", color = "#55ba47", shortname = "",},
["Alcalá 100%"] = {abbrev = "", color = "#1D88BE", shortname = "",},
["Alcalá Habitable"] = {abbrev = "", color = "#336F27", shortname = "",},
["Alcalá Puede"] = {abbrev = "", color = "#7F215F", shortname = "",},
["Alderney representatives"] = {abbrev = "", color = "#BABCDB", shortname = "",},
["Ale Yarok"] = {abbrev = "", color = "#799A00", shortname = "",},
["Alfarista Radical Front"] = {abbrev = "FRA", color = "#4169E1", shortname = "",},
["Algaida for the Development of Sanlúcar"] = {abbrev = "", color = "#94FF00", shortname = "",},
["Algeciras 100x100"] = {abbrev = "", color = "#E75200", shortname = "",},
["Algeciras Citizen Action"] = {abbrev = "", color = "#FFC800", shortname = "",},
["Algeciras Sí Se Puede"] = {abbrev = "", color = "#761B5E", shortname = "",},
["Algerian Communist Party"] = {abbrev = "", color = "#CD0000", shortname = "",},
["Algerian National Front"] = {abbrev = "FNA", color = "#406080", shortname = "",},
["Algerian Popular Movement"] = {abbrev = "MPA", color = "green", shortname = "",},
["Alliance Party for Progress"] = {abbrev = "APP", color = "#0E9345", shortname = "",},
["Alianza Puertorriqueña"] = {abbrev = "", color = "#F0DC82", shortname = "",},
["Alignment (Israel)"] = {abbrev = "", color = "#3DEAFD", shortname = "Alignment",},
["All Basotho Convention"] = {abbrev = "ABC", color = "#FFE902", shortname = "",},
["All Blended Party"] = {abbrev = "ABP", color = "#040A55", shortname = "",},
["All Ceylon Makkal Congress"] = {abbrev = "", color = "#9acd32", shortname = "",},
["All Ceylon Tamil Congress"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["All for Latvia!"] = {abbrev = "", color = "#5A0505", shortname = "",},
["All for Unity"] = {abbrev = "", color = "#2C5781", shortname = "",},
["All India Anna Dravida Munnetra Kazhagam"] = {abbrev = "AIADMK", color = "#138808", shortname = "",},
["All India Anna Dravida Munnetra Kazhagam (Janaki)"] = {abbrev = "AIADMK(JA)", color = "#138808", shortname = "",},
["All India Anna Dravida Munnetra Kazhagam (Jayalalithaa)"] = {abbrev = "AIADMK(J)", color = "#138808", shortname = "",},
["All India Bahujan Samman Party"] = {abbrev = "AIBSP", color = "#A9F5D0", shortname = "",},
["All India Dalit Muslim Minorities Suraksha Mahasangh"] = {abbrev = "DMM", color = "#14D00D", shortname = "",},
["All India Forward Bloc (Marxist)"] = {abbrev = "FBL(M)", color = "#259268", shortname = "",},
["All India Forward Bloc"] = {abbrev = "AIFB", color = "#D70000", shortname = "",},
["All India Ganatantra Parishad"] = {abbrev = "", color = "#FF33CC", shortname = "",},
["All India Indira Congress (Tiwari)"] = {abbrev = "AIIC(T)", color = "#00FFFF", shortname = "",},
["All India Jharkhand Party"] = {abbrev = "", color = "#CC9999", shortname = "",},
["All India Mahila Empowerment Party"] = {abbrev = "AIMEP", color = "#FFF", shortname = "",},
["All India Majlis-e-Ittehadul Muslimeen"] = {abbrev = "AIMIM", color = "#0c6b4b", shortname = "",},
["All India Minorities Front"] = {abbrev = "AIMF", color = "#00FFFF", shortname = "",},
["All India Moovendar Munnani Kazhagam"] = {abbrev = "", color = "Red", shortname = "",},
["All India Muslim Forum"] = {abbrev = "", color = "green", shortname = "",},
["All India N.R. Congress"] = {abbrev = "AINRC", color = "#FFC000", shortname = "",},
["All India Party for the Protection of Civil Rights"] = {abbrev = "AIPPCR", color = "mistyrose", shortname = "",},
["All India Rajiv Krantikari Congress"] = {abbrev = "AIRKC", color = "#417A81", shortname = "",},
["All India Rashtriya Janata Party"] = {abbrev = "AIRJP", color = "#9A5815", shortname = "",},
["All India Samathuva Makkal Katchi"] = {abbrev = "SMK", color = "#fe0000", shortname = "",},
["All India United Democratic Front"] = {abbrev = "AIUDF", color = "#348017", shortname = "",},
["All Jharkhand Students Union"] = {abbrev = "AJSU", color = "#FF33FF", shortname = "",},
["All Liberia Coalition Party"] = {abbrev = "", color = "#000000", shortname = "",},
["All Malaysian Indian Progressive Front"] = {abbrev = "", color = "#EC2029", shortname = "",},
["All Mon Region Democracy Party"] = {abbrev = "AMRDP", color = "#DC143C", shortname = "",},
["All Nigeria Peoples Party"] = {abbrev = "ANPP", color = "#0000CD", shortname = "",},
["All Pakistan Awami Muslim League"] = {abbrev = "", color = "#006a4e", shortname = "",},
["All Pakistan Muslim League"] = {abbrev = "APML", color = "#556B2F", shortname = "",},
["All Party Alliance"] = {abbrev = "", color = "#C19A6B", shortname = "",},
["All Party Hill Leaders Conference"] = {abbrev = "AHL", color = "#FFFF00", shortname = "",},
["All People Front"] = {abbrev = "PM", color = "red", shortname = "",},
["All People's Congress (Ghana)"] = {abbrev = "", color = "#106338", shortname = "",},
["All People's Congress"] = {abbrev = "APC", color = "#FF0000", shortname = "",},
["All People's Party (Namibia)"] = {abbrev = "", color = "#D84F23", shortname = "",},
["All People's Party (UK)"] = {abbrev = "", color = "DarkOrange", shortname = "All People's Party",},
["All Progressives Congress"] = {abbrev = "APC", color = "#87BEEB", shortname = "",},
["All Progressives Grand Alliance"] = {abbrev = "APGA", color = "#00923F", shortname = "",},
["All Scotland Pensioners Party"] = {abbrev = "", color = "#BBD9DB", shortname = "",},
["All Together (Serbia)"] = {abbrev = "SZ", color = "brown", shortname = "",},
["All-for-Ireland League"] = {abbrev = "AFI", color = "#66FF99", shortname = "All-for-Ireland",},
["All-German Bloc/League of Expellees and Deprived of Rights"] = {abbrev = "GB/BHE", color = "#C3C318", shortname = "",},
["All-German People's Party"] = {abbrev = "GVP", color = "#FF7F00", shortname = "",},
["All-In Democracy"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["All-India Muslim League"] = {abbrev = "AIML", color = "#008000", shortname = "",},
["All-Union Communist Party of Bolsheviks (1991)"] = {abbrev = "", color = "#881300", shortname = "",},
["Allah-o-Akbar Tehreek"] = {abbrev = "AAT", color = "#FFD700", shortname = "",},
["Alleanza Bidla"] = {abbrev = "", color = "purple", shortname = "",},
["Allegiance Party (Papua New Guinea)"] = {abbrev ="AP", color = "#233F92", shortname = "",},
["Alliance (Argentina)"] = {abbrev = "", color = "#0AABDB", shortname = "Alianza",},
["Alliance (Chile)"] = {abbrev = "", color = "#4682B4", shortname = "Alliance",},
["Alliance (Kyrgyz political party)"] = {abbrev = "", color = "#25AAE2", shortname = "Alliance",},
["Alliance (New Zealand political party)"] = {abbrev = "", color = "#33CC66", shortname = "Alliance",},
["Alliance (Portugal)"] = {abbrev = "", color = "#6AD1E3", shortname = "",},
["Alliance (Slovak political party)"] = {abbrev = "", color = "#F48B24", shortname = "",},
["Alliance 21/RRP"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Alliance 90"] = {abbrev = "B90", color = "green", shortname = "",},
["Alliance 90/Greens of Serbia"] = {abbrev = "S90", color = "#286019", shortname = "",},
["Alliance 90/The Greens"] = {abbrev = "", color = "#64A12D", shortname = "Green",},
["Alliance C – Christians for Germany"] = {abbrev = "", color = "#00529C", shortname = "Bündnis C",},
["Alliance for a Triumphant Benin"] = {abbrev = "", color = "#CBE08F", shortname = "",},
["Alliance for Albanians"] = {abbrev = "AS", color = "#6D3D87", shortname = "",},
["Alliance for Barangay Concerns"] = {abbrev = "ABC", color = "#010066", shortname = "",},
["Alliance for Brazil"] = {abbrev = "", color = "#008000", shortname = "",},
["Alliance for Burgos"] = {abbrev = "", color = "#9F9152", shortname = "",},
["Alliance for Change (Guyana)"] = {abbrev = "", color = "#FFCC01", shortname = "",},
["Alliance for Change (Macau)"] = {abbrev = "MUDAR", color = "#00AB66", shortname = "",},
["Alliance for Change (Venezuela)"] = {abbrev = "", color = "#F50087", shortname = "",},
["Alliance for Change and Transparency"] = {abbrev = "", color = "#A03389", shortname = "ACT–Wazalendo",},
["Alliance for Change"] = {abbrev = "", color = "#ED6C10", shortname = "",},
["Alliance for Commerce and Housing"] = {abbrev = "", color = "#FFED00", shortname = "",},
["Alliance for Croatia"] = {abbrev = "", color = "#5D93D3", shortname = "",},
["Alliance for Democracy (Dominican Republic)"] = {abbrev = "", color = "#80A7BF", shortname = "",},
["Alliance for Democracy (Malawi)"] = {abbrev = "AFORD", color = "#25D9FA", shortname = "",},
["Alliance for Democracy (Nigeria)"] = {abbrev = "AD", color = "#186315", shortname = "",},
["Alliance for Democracy and Federation – African Democratic Rally"] = {abbrev = "", color = "#FFEF00", shortname = "",},
["Alliance for Democracy and Freedom (UK)"] = {abbrev = "ADF", color = "#00247D", shortname = "",},
["Alliance for Democracy and Reforms"] = {abbrev = "", color = "blue", shortname = "",},
["Alliance for Democracy in Mali"] = {abbrev = "ADEMA-PASJ", color = "#EB1D2A", shortname = "",},
["Alliance for Democratic Change"] = {abbrev = "", color = "navy", shortname = "",},
["Alliance for Democratic Renewal"] = {abbrev = "", color = "#D9BF08", shortname = "",},
["Alliance for Development and Nature"] = {abbrev = "", color = "#1D463B", shortname = "",},
["Alliance for Direct Democracy in Europe"] = {abbrev = "", color = "#800080", shortname = "",},
["Alliance for Equality and European Justice"] = {abbrev = "ABDE", color = "", shortname = "",},
["Alliance for Europe of the Nations"] = {abbrev = "AEN", color = "#00DDDD", shortname = "",},
["Alliance for Germany"] = {abbrev = "AFD", color = "#2483BB", shortname = "",},
["Alliance for Green Socialism"] = {abbrev = "", color = "#00A86B", shortname = "",},
["Alliance for Human Rights, Animal and Nature Protection"] = {abbrev = "", color = "#3d499a", shortname = "Tierschutzallianz",},
["Alliance for Innovation and Justice"] = {abbrev = "BIG", color = "orange", shortname = "",},
["Alliance for Italy"] = {abbrev = "", color = "#89CFF0", shortname = "",},
["Alliance for Justice and Democracy/Movement for Renewal"] = {abbrev = "AJD/MR", color = "#000000", shortname = "",},
["Alliance for Local Living"] = {abbrev = "", color = "#11B4BB", shortname = "",},
["Alliance for National Transformation"] = {abbrev = "", color = "#9954AD", shortname = "",},
["Alliance for New Nigeria"] = {abbrev = "ANN", color = "#358C43", shortname = "",},
["Alliance for Patriotic Reorientation and Construction"] = {abbrev = "APRC", color = "#0D6F4A", shortname = "",},
["Alliance for Peace and Democracy (Liberia)"] = {abbrev = "", color = "#E1EC2C", shortname = "",},
["Alliance for Peace and Freedom"] = {abbrev = "", color = "#000000", shortname = "",},
["Alliance for Progress (Peru)"] = {abbrev = "APP", color = "#1155cc", shortname = "",},
["Alliance for Real Change"] = {abbrev = "", color = "#730026", shortname = "",},
["Alliance for Romanian Unity"] = {abbrev = "AUR", color = "blue", shortname = "",},
["Alliance for Ronda"] = {abbrev = "", color = "#3E79BF", shortname = "",},
["Alliance for Social and Economic Advancement"] = {abbrev = "ASEA", color = "#009EE3", shortname = "",},
["Alliance for Tanzania Farmers Party"] = {abbrev = "AFP", color = "green", shortname = "",},
["Alliance for the Development of Macau"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Alliance for the Fatherland"] = {abbrev = "", color = "#08099F", shortname = "",},
["Alliance for the Future (Czech Republic)"] = {abbrev = "", color = "#005094", shortname = "",},
["Alliance for the Future (Peru)"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Alliance for the Future of Austria"] = {abbrev = "BZÖ", color = "#F29400", shortname = "",},
["Alliance for the Future of Kosovo"] = {abbrev = "AAK", color = "#03112C", shortname = "",},
["Alliance for the Great Change"] = {abbrev = "", color = "#00B0F6", shortname = "",},
["Alliance for the Progress of Peru"] = {abbrev = "", color = "#1E5BA8", shortname = "",},
["Alliance for the Re-liberation of Somalia"] = {abbrev = "ARS", color = "#000000", shortname = "",},
["Alliance for the Republic (Nicaragua)"] = {abbrev = "APRE", color = "#800080", shortname = "",},
["Alliance for the Republic (Senegal)"] = {abbrev = "APR", color = "#704214", shortname = "",},
["Alliance for the Republic (Spain)"] = {abbrev = "", color = "#C00040", shortname = "",},
["Alliance for the Union of Romanians"] = {abbrev = "AUR", color = "#FCC224", shortname = "",},
["Alliance for Transformation for All"] = {abbrev = "", color = "#47A165", shortname = "",},
["Alliance for Workers' Liberty"] = {abbrev = "", color = "red", shortname = "",},
["Alliance of Builders of Islamic Iran"] = {abbrev = "ABII", color = "#3835ba", shortname = "",},
["Alliance of Chinese and Expatriates"] = {abbrev = "ACE", color = "#99221A", shortname = "",},
["ACT Teachers Partylist"] = {abbrev = "", color = "#ADD8E6", shortname = "ACT Teachers",},
["Alliance of Democrats (Poland)"] = {abbrev = "SD", color = "#475196", shortname = "",},
["Alliance of European Conservatives and Reformists"] = {abbrev = "AECR", color = "#0054A5", shortname = "",},
["Alliance of European National Movements"] = {abbrev = "", color = "#000055", shortname = "",},
["Alliance of Free Democrats"] = {abbrev = "SZDSZ", color = "#1CA8E6", shortname = "",},
["Alliance of German Democrats"] = {abbrev = "ADD", color = "#1e5ea5", shortname = "",},
["Alliance of Independent Democrats in Europe"] = {abbrev = "ADIE", color = "#000066", shortname = "",},
["Alliance of Independent Social Democrats"] = {abbrev = "SNSD", color = "#990000", shortname = "",},
["Alliance of Independents"] = {abbrev = "LdU", color = "#FF00FF", shortname = "",},
["Alliance of Liberals and Democrats (Romania)"] = {abbrev = "ALDE", color = "#005487", shortname = "",},
["Alliance of Liberals and Democrats for Europe group"] = {abbrev = "ALDE", color = "gold", shortname = "",},
["Alliance of Liberals and Democrats for Europe"] = {abbrev = "ALDE", color = "gold", shortname = "",},
["Alliance of Liberties"] = {abbrev = "", color = "#6FA293", shortname = "",},
["Alliance of Movements for the Emergence of Niger"] = {abbrev = "", color = "#01d9f2", shortname = "",},
["Alliance of National Forces (Czech Republic)"] = {abbrev = "", color = "#2D3092", shortname = "",},
["Alliance of Nationalist Left Forces of the MNR"] = {abbrev = "", color = "#EB737E", shortname = "",},
["Alliance of Patriots of Georgia"] = {abbrev = "APG", color = "#DB9F00", shortname = "",},
["Alliance of Primorje-Gorski Kotar"] = {abbrev = "", color = "#00c8c8", shortname = "",},
["Alliance of Progressives"] = {abbrev = "", color = "#D90000", shortname = "",},
["Alliance of Resuming British Sovereignty over Hong Kong and Independence"] = {abbrev = "", color = "#07263A", shortname = "",},
["Alliance of Social Democrats"] = {abbrev = "", color = "#B22222", shortname = "Social Democrats",},
["Alliance of the Centre (Italy)"] = {abbrev = "", color = "#89CFF0", shortname = "",},
["Alliance of the Christian Democratic Popular Front"] = {abbrev = "AFPCD", color = "#C1500C", shortname = "",},
["Alliance of the Democratic Centre (Spain)"] = {abbrev = "", color = "#00974A", shortname = "",},
["Alliance of the Forces of Progress (Senegal)"] = {abbrev = "", color = "#000080", shortname = "",},
["Alliance of the National Left"] = {abbrev = "", color = "#E5D03C", shortname = "",},
["Alliance of the New Citizen"] = {abbrev = "ANO", color = "#FFB200", shortname = "",},
["Alliance of Vojvodina Hungarians"] = {abbrev = "VMSZ", color = "#00732B", shortname = "",},
["Alliance Party (Armenia)"] = {abbrev = "", color = "#0021C6", shortname = "",},
["Alliance Party (Fiji)"] = {abbrev = "", color = "#6495ED", shortname = "Alliance",},
["Alliance Party (Malaysia)"] = {abbrev = "", color = "#000080", shortname = "Alliance",},
["Alliance Party (Panama)"] = {abbrev = "", color = "#E2211C", shortname = "",},
["Alliance Party (United States)"] = {abbrev = "", color = "#385AA3", shortname = "Alliance",},
["Alliance Party for the Sake of Azerbaijan"] = {abbrev = "", color = "#00AF68", shortname = "",},
["Alliance Party Guernsey"] = {abbrev = "", color = "#E60E29", shortname = "",},
["Alliance Party of Kenya"] = {abbrev = "", color = "yellow", shortname = "",},
["Alliance Party of Northern Ireland"] = {abbrev = "APNI", color = "#F6CB2F", shortname = "Alliance",},
["Alliance PSD+PC"] = {abbrev = "PSD+PC", color = "#ED2128", shortname = "",},
["Alliance Royale"] = {abbrev = "AR", color = "#EEC400", shortname = "",},
["Allied Peoples Movement"] = {abbrev = "APM", color = "#00FFFF", shortname = "",},
["ALLinHK"] = {abbrev = "", color = "#F4681D", shortname = "",},
["Almerian Neighborhood Union"] = {abbrev = "", color = "#244A91", shortname = "",},
["Almerian Regionalist Union"] = {abbrev = "", color = "#B59639", shortname = "",},
["Aloha ʻĀina Party"] = {abbrev = "", color = "#ffd100", shortname = "Aloha ʻĀina",},
["Alsace d'Abord"] = {abbrev = "", color = "#80461B", shortname = "",},
["Alsace-Lorraine Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Alsasua Group"] = {abbrev = "", color = "#73A745", shortname = "",},
["Alternatiba (Basque political party)"] = {abbrev = "", color = "#CE010C", shortname = "",},
["Alternativa (Italian political party)"] = {abbrev = "", color = "#EE7622", shortname = "Alternativa",},
["Alternativa de Govern"] = {abbrev = "", color = "#008E9C", shortname = "",},
["Alternativa Sí se puede"] = {abbrev = "", color = "#E00686", shortname = "",},
["Alternativas desde Abajo"] = {abbrev = "", color = "#33D100", shortname = "",},
["Alternative and Change Party"] = {abbrev = "", color = "#DBB84D", shortname = "",},
["Alternative Democratic Movement"] = {abbrev = "", color = "#ff7538", shortname = "",},
["Alternative Democratic Pole"] = {abbrev = "PDA", color = "#FEF71F", shortname = "",},
["Alternative Democratic Reform Party"] = {abbrev = "ADR", color = "#00ADDC", shortname = "",},
["Alternative Ecologists"] = {abbrev = "OE", color = "green", shortname = "",},
["Alternative Faso"] = {abbrev = "", color = "#DD198D", shortname = "",},
["Alternative for Arzúa"] = {abbrev = "", color = "#5A439B", shortname = "",},
["Alternative for Benalmádena"] = {abbrev = "", color = "#40287B", shortname = "",},
["Alternative for Benidorm"] = {abbrev = "", color = "#E9582C", shortname = "",},
["Alternative for Boadilla"] = {abbrev = "", color = "#37703E", shortname = "",},
["Alternative for Bulgarian Revival"] = {abbrev = "ABV", color = "#6A013A", shortname = "",},
["Alternative for Castile and León"] = {abbrev = "", color = "#808080", shortname = "",},
["Alternative for Changes"] = {abbrev = "APN", color = "#1A70AB", shortname = "",},
["Alternative for Germany"] = {abbrev = "AfD", color = "#009EE0", shortname = "",},
["Alternative for Gran Canaria"] = {abbrev = "", color = "#A0A0A0", shortname = "",},
["Alternative for Sweden"] = {abbrev = "", color = "#000095", shortname = "",},
["Alternative Forces for Renewal and Emergence"] = {abbrev = "", color = "#68B0E5", shortname = "",},
["Alternative Island"] = {abbrev = "", color = "#E57815", shortname = "",},
["Alternative League for Haitian Progress and Emancipation"] = {abbrev = "LAPEH", color = "#F3E601", shortname = "",},
["Alternative Left"] = {abbrev = "", color = "#960018", shortname = "",},
["Alternative List"] = {abbrev = "", color = "#FA0000", shortname = "",},
["Alternative Moroneran Assembly"] = {abbrev = "", color = "#55BA51", shortname = "",},
["Alternative Party"] = {abbrev = "", color = "#E62E00", shortname = "",},
["Amaiur (1979 coalition)"] = {abbrev = "", color = "#66669A", shortname = "Amaiur",},
["Amaiur"] = {abbrev = "", color = "#087178", shortname = "",},
["Amal Movement"] = {abbrev = "", color = "#008000", shortname = "Amal",},
["Amani Coalition"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Amani National Congress"] = {abbrev = "", color = "brown", shortname = "Amani",},
["Ambedkar Kranti Dal"] = {abbrev = "AKD", color = "#B62559", shortname = "",},
["Ambedkar National Congress"] = {abbrev = "ANC", color = "#FFFFCC", shortname = "",},
["Ambedkar People's Movement"] = {abbrev = "APM", color = "tan", shortname = "",},
["Ambedkar Puratchikara Makkal Katchi"] = {abbrev = "APMK", color = "grey", shortname = "",},
["Ambedkar Samaj Party"] = {abbrev = "ASP", color = "#58D3F7", shortname = "",},
["Ambedkarite Party of India"] = {abbrev = "API", color = "blue", shortname = "",},
["America First Party (1943)"] = {abbrev = "", color = "Yellow", shortname = "America First",},
["America First Party (2002)"] = {abbrev = "", color = "#CC66FF", shortname = "",},
["American Constitution Party (Colorado)"] = {abbrev = "", color = "#A356DE", shortname = "American Constitution",},
["American Constitution Party"] = {abbrev = "", color = "transparent", shortname = "Constitution",},
["American Delta Party"] = {abbrev = "", color = "#355E39", shortname = "American Delta",},
["American Freedom Party"] = {abbrev = "", color = "#DDDDBB", shortname = "American Freedom",},
["American Independent Party"] = {abbrev = "", color = "#800080", shortname = "American Independent",},
["American Labor Party (1932)"] = {abbrev = "", color = "#0000CC", shortname = "American Labor",},
["American Labor Party"] = {abbrev = "", color = "#FF6347", shortname = "American Labor",},
["American Party (1924)"] = {abbrev = "", color = "#B340D1", shortname = "American",},
["American Party (1969)"] = {abbrev = "", color = "#CC66FF", shortname = "American",},
["American Party (South Carolina)"] = {abbrev = "", color = "#DDDDDD", shortname = "American",},
["American Patriot Party"] = {abbrev = "", color = "orange", shortname = "",},
["American Popular Revolutionary Alliance"] = {abbrev = "APRA", color = "#DF0101", shortname = "",},
["American Reform Party"] = {abbrev = "", color = "#C80000", shortname = "",},
["American Republican"] = {abbrev = "", color = "#005B96", shortname = "",},
["American Shopping Party"] = {abbrev = "", color = "#e23292", shortname = "American Shopping",},
["American Solidarity Party"] = {abbrev = "", color = "#FF7F00", shortname = "American Solidarity",},
["American Third Position Party"] = {abbrev = "", color = "#0018A8", shortname = "American Third Position",},
["Americans Elect"] = {abbrev = "", color = "#FFFF88", shortname = "",},
["Ames Novo"] = {abbrev = "", color = "#0C8A43", shortname = "",},
["Amhara Democratic Party"] = {abbrev = "", color = "#597E09", shortname = "",},
["Amma Makkal Munnettra Kazagam"] = {abbrev = "AMMK", color = "#488B54", shortname = "",},
["Amplitude (political party)"] = {abbrev = "", color = "#FCE883", shortname = "Amplitude",},
["Amra Bangali"] = {abbrev = "AMB", color = "#FF66CC", shortname = "",},
["Amsterdamska Koalicija"] = {abbrev = "", color = "#62ba49", shortname = "",},
["Amtsakhara"] = {abbrev = "", color = "#FE2726", shortname = "Amtsakhara",},
["An Rabharta Glas"] = {abbrev = "ARG-GL", color = "#488A89", shortname = "An Rabharta Glas",},
["Anaithindia Dravidar Samudaya Munnetra Kazhagam"] = {abbrev = "ADSMK", color = "peru", shortname = "",},
["Anaithinthiya Thamizhaga Munnetra Kazhagam"] = {abbrev = "ATMK", color = "gray", shortname = "",},
["Anakpawis"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Anarchist Pogo Party of Germany"] = {abbrev = "APPD", color = "#000000", shortname = "",},
["Anatolia Party"] = {abbrev = "", color = "#1575BF", shortname = "AnaParti",},
["Anchalik Gana Morcha"] = {abbrev = "AGM", color = "#FD5B78", shortname = "",},
["And-Jëf/African Party for Democracy and Socialism"] = {abbrev = "", color = "red", shortname = "",},
["Andaluces Levantaos"] = {abbrev = "AL", color = "#69C188", shortname = "",},
["Andalucía por Sí"] = {abbrev = "", color = "#83C141", shortname = "",},
["Andalusia Assembly"] = {abbrev = "", color = "#088A00", shortname = "",},
["Andalusian Coalition"] = {abbrev = "", color = "#006633", shortname = "",},
["Andalusian Convergence"] = {abbrev = "", color = "#5AB600", shortname = "",},
["Andalusian Democratic Centre"] = {abbrev = "", color = "#0C8902", shortname = "",},
["Andalusian Federation of Independents"] = {abbrev = "", color = "#138B59", shortname = "",},
["Andalusian Forum"] = {abbrev = "", color = "#00AA29", shortname = "",},
["Andalusian Front of Liberation"] = {abbrev = "", color = "#567E64", shortname = "",},
["Andalusian Horticulture Party"] = {abbrev = "", color = "#314910", shortname = "",},
["Andalusian Left (2017)"] = {abbrev = "", color = "#86B81C", shortname = "",},
["Andalusian Left"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Andalusian Liberation"] = {abbrev = "", color = "#2FB461", shortname = "",},
["Andalusian Nation"] = {abbrev = "", color = "#008800", shortname = "",},
["Andalusian Nationalist People"] = {abbrev = "", color = "#00B252", shortname = "",},
["Andalusian Party"] = {abbrev = "PA", color = "#005931", shortname = "",},
["Andalusian People's Initiative"] = {abbrev = "", color = "#007735", shortname = "",},
["Andalusian Popular Unity"] = {abbrev = "", color = "#E20A19", shortname = "",},
["Andalusian Progress Party"] = {abbrev = "", color = "#4DCA8B", shortname = "",},
["Andalusian Regional Unity"] = {abbrev = "", color = "#546B23", shortname = "",},
["Andalusian Social Democratic Party"] = {abbrev = "", color = "#218A31", shortname = "",},
["Andalusian Social Liberal Party"] = {abbrev = "", color = "#2F7769", shortname = "",},
["Andalusian Solidary Independent Republican Party"] = {abbrev = "", color = "#6B6918", shortname = "",},
["Andalusian Spring"] = {abbrev = "", color = "#1EA24B", shortname = "",},
["Andalusian Unity"] = {abbrev = "", color = "#FEED01", shortname = "",},
["Andalusian Workers' Group"] = {abbrev = "", color = "#D03634", shortname = "",},
["Andalusians of Jaén United"] = {abbrev = "", color = "#00AC32", shortname = "",},
["Andecha Astur"] = {abbrev = "", color = "#A53042", shortname = "",},
["Anders Lange's Party"] = {abbrev = "", color = "#0047e0", shortname = "Anders Lange's",},
["Andorra for Change"] = {abbrev = "", color = "#7A7A78", shortname = "",},
["Andover Alliance"] = {abbrev = "", color = "#bb00bb", shortname = "",},
["Ang Kapatiran"] = {abbrev = "", color = "#003C74", shortname = "",},
["Anguilla Democratic Party"] = {abbrev = "ADP", color = "#ffd700", shortname = "",},
["Anguilla for Good Government"] = {abbrev = "", color = "orange", shortname = "",},
["Anguilla National Alliance"] = {abbrev = "ANA", color = "#0087DC", shortname = "",},
["Anguilla Patriotic Movement"] = {abbrev = "APM", color = "#00008B", shortname = "",},
["Anguilla Progressive Movement"] = {abbrev = "APM", color = "#96CDEF", shortname = "",},
["Anguilla Progressive Party"] = {abbrev = "APP", color = "#FF6600", shortname = "",},
["Anguilla Strategic Alliance"] = {abbrev = "ANSA", color = "#FF1111", shortname = "",},
["Anguilla United Front (old)"] = {abbrev = "", color = "#095392", shortname = "",},
["Anguilla United Front"] = {abbrev = "AUF", color = "#ffc614", shortname = "",},
["Anguilla United Movement"] = {abbrev = "AUM", color = "#008000", shortname = "",},
["Anguilla United Party"] = {abbrev = "AUP", color = "#39944A", shortname = "",},
["Angus Independents Representatives"] = {abbrev = "", color = "#DDDDDD", shortname = "Angus Independents",},
["Anhui clique"] = {abbrev = "", color = "#a52a2a", shortname = "",},
["Animal Justice Party of Finland"] = {abbrev = "", color = "#FCBB01", shortname = "",},
["Animal Justice Party"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Animal Party Cyprus"] = {abbrev = "", color = "#04d404", shortname = "",},
["Animal Protection Party of Canada"] = {abbrev = "", color = "#336033", shortname = "Animal Protection",},
["Animal Protection Party"] = {abbrev = "", color = "#e9e9e9", shortname = "Animal Protection",},
["Animal Rights Party"] = {abbrev = "TRP", color = "lightgreen", shortname = "",},
["Animal Welfare Party"] = {abbrev = "", color = "#EE3263", shortname = "Animal Welfare",},
["Animalist Party Against Mistreatment of Animals"] = {abbrev = "", color = "#ADBE18", shortname = "",},
["Animalist Party"] = {abbrev = "PA", color = "#9C0D99", shortname = "",},
["Animals First"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Anna Democratic Human Rights Movement Party of India"] = {abbrev = "", color = "#C0C0C0", shortname = "Anna DHRM",},
["ANO 2011"] = {abbrev = "ANO", color = "#261060", shortname = "",},
["Another Democracy is Possible"] = {abbrev = "", color = "#F75921", shortname = "",},
["Another Sant Cugat–Citizen Platform for Sant Cugat"] = {abbrev = "", color = "#9DC5C2", shortname = "",},
["Antarsya"] = {abbrev = "", color = "#800000", shortname = "",},
["Antequera Sí Se Puede"] = {abbrev = "", color = "#77BF59", shortname = "",},
["Anti Common Market and Free Trade Party"] = {abbrev = "ACMFT", color = "#e6e6fa", shortname = "",},
["Anti H-Block"] = {abbrev = "AHB", color = "#008800", shortname = "Anti H-Block",},
["Anti-Administration Party (US)"] = {abbrev = "", color = "#CCFF66", shortname = "Anti-Administration",},
["Anti-Austerity Alliance–People Before Profit"] = {abbrev = "AAA–PBP", color = "#E5E500", shortname = "AAA–PBP",},
["Anti-Austerity Alliance"] = {abbrev = "AAA", color = "#FFFF00", shortname = "Anti-Austerity Alliance",},
["Anti-Capitalist Alliance"] = {abbrev = "", color = "#FF0066", shortname = "",},
["Anti-capitalists"] = {abbrev = "", color = "#62CC62", shortname = "",},
["Anti-Communist Bolivian Front"] = {abbrev = "", color = "#5866B1", shortname = "",},
["Anti-Corruption and Justice Party (Spain)"] = {abbrev = "", color = "#F7EA21", shortname = "",},
["Anti-Corruption Ireland"] = {abbrev = "", color = "#00cc00", shortname = "",},
["Anti-Corruption Party"] = {abbrev = "PAC", color = "#8dade3", shortname = "",},
["Anti-Fascist People's Freedom League"] = {abbrev = "AFPFL", color = "#DB2916", shortname = "",},
["Anti-fascist Revolutionary Left"] = {abbrev = "", color = "#AE2D2D", shortname = "",},
["Anti-Federalist League"] = {abbrev = "", color = "#F6CB2F", shortname = "",},
["Anti-Imperialist National Democratic Front"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Anti-Jacksonian Party"] = {abbrev = "", color = "#FFE6B0", shortname = "Anti-Jacksonian",},
["Anti-Jacksonian Party/Hold"] = {abbrev = "", color = "#FFF5D7", shortname = "",},
["Anti-Masonic Party"] = {abbrev = "", color = "#FFFF99", shortname = "Anti-Masonic",},
["Anti-Masonic Party/Hold"] = {abbrev = "", color = "#FFFFE6", shortname = "",},
["Anti-Ministerialists"] = {abbrev = "", color = "red", shortname = "",},
["Anti-Monopoly Party (US)"] = {abbrev = "", color = "#66F500", shortname = "Anti-Monopoly",},
["Anti-Nebraska movement"] = {abbrev = "", color = "#E4D96F", shortname = "Anti-Nebraska",},
["Anti-Partition of Ireland League"] = {abbrev = "", color = "#DDFFDD", shortname = "Anti-Partition",},
["Anti-PowerPoint Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Anti-Revolutionary Party"] = {abbrev = "ARP", color = "#008F90", shortname = "",},
["Anti-Socialist Party"] = {abbrev = "", color = "#BFFF00", shortname = "Anti-Socialist",},
["Anti-Trident Party"] = {abbrev = "ATP", color = "#CC0000", shortname = "",},
["Anti-Waste League"] = {abbrev = "", color = "lightblue", shortname = "",},
["Antigua and Barbuda Labour Party"] = {abbrev = "ABLP", color = "#EE3422", shortname = "",},
["Antipersonalist Radical Civic Union"] = {abbrev = "", color = "#641C34", shortname = "",},
["Aontacht Éireann"] = {abbrev = "AÉ", color = "#22FF00", shortname = "Aontacht Éireann",},
["Aontú"] = {abbrev = "Aon", color = "#44532A", shortname = "Aontú",},
["Aosta Valley (political coalition)"] = {abbrev = "", color = "#48D1CC", shortname = "Aosta Valley",},
["Aotearoa Legalise Cannabis Party"] = {abbrev = "", color = "#33CC33", shortname = "Legalise Cannabis",},
["Apna Dal"] = {abbrev = "AD", color = "#FF33CC", shortname = "",},
["Apna Dal (Kamerawadi)"] = {abbrev = "AD(K)", color = "#FF33CC", shortname = "",},
["Apna Dal (Sonelal)"] = {abbrev = "AD(S)", color = "#330066", shortname = "",},
["APPEM"] = {abbrev = "", color = "yellow", shortname = "",},
["Appointed"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Approval Voting Party"] = {abbrev = "", color = "MidnightBlue", shortname = "Approval Voting",},
["April Fifth Action"] = {abbrev = "", color = "#FC0000", shortname = "",},
["Apruebo Dignidad"] = {abbrev = "", color = "#FC415C", shortname = "",},
["Ar-Namys"] = {abbrev = "", color = "#0203FE", shortname = "",},
["Ara Eivissa"] = {abbrev = "", color = "#1FC6BC", shortname = "",},
["Ara Maó"] = {abbrev = "", color = "#39AFB1", shortname = "",},
["Ara Reus"] = {abbrev = "", color = "#71152C", shortname = "",},
["Arab Democratic Nasserist Party"] = {abbrev = "", color = "#305E30", shortname = "",},
["Arab Democratic Party (Israel)"] = {abbrev = "", color = "#009900", shortname = "Mada",},
["Arab Democratic Party (Lebanon)"] = {abbrev = "", color = "green", shortname = "",},
["ARAB Europeans for the Canaries"] = {abbrev = "", color = "#8BD4F7", shortname = "",},
["Arab Liberation Movement"] = {abbrev = "", color = "#CD7F32", shortname = "",},
["Arab Liberation Party"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Arab List for Bedouin and Villagers"] = {abbrev = "", color = "#C61318", shortname = "",},
["Arab Socialist Ba'ath Party – Iraq Region"] = {abbrev = "", color = "#017B48", shortname = "Ba'ath Party",},
["Arab Socialist Ba'ath Party – Lebanon Region"] = {abbrev = "", color = "#017B48", shortname = "",},
["Arab Socialist Ba'ath Party – Syria Region"] = {abbrev = "", color = "#017B48", shortname = "Ba'ath Party",},
["Arab Socialist Ba'ath Party – Yemen Region"] = {abbrev = "", color = "#017B48", shortname = "Ba'ath Party",},
["Arab Socialist Movement"] = {abbrev = "", color = "red", shortname = "",},
["Arab Socialist Union (Egypt)"] = {abbrev = "ASU", color = "#F0001C", shortname = "",},
["Arab Socialist Union (Iraq)"] = {abbrev = "", color = "#F0001C", shortname = "",},
["Arab Socialist Union (Libya)"] = {abbrev = "", color = "#F0001C", shortname = "",},
["Arab Socialist Union Party (Syria)"] = {abbrev = "", color = "#F0001C", shortname = "",},
["Arabic Democratic Union Party"] = {abbrev = "", color = "green", shortname = "",},
["Aragón Sí Puede"] = {abbrev = "", color = "#690194", shortname = "",},
["Aragon United Citizens Party"] = {abbrev = "", color = "#084108", shortname = "",},
["Aragonese Autonomist Front"] = {abbrev = "", color = "#F93235", shortname = "",},
["Aragonese Bloc"] = {abbrev = "", color = "#2BAE20", shortname = "",},
["Aragonese Candidacy of Democratic Unity"] = {abbrev = "", color = "#473C38", shortname = "",},
["Aragonese Christian Democracy"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Aragonese Initiative"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Aragonese Land"] = {abbrev = "", color = "#008300", shortname = "",},
["Aragonese Party"] = {abbrev = "PAR", color = "#FFCC66", shortname = "",},
["Arakan Front Party"] = {abbrev = "AFP", color = "#FE0000", shortname = "",},
["Arakan League for Democracy"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Arakan National Party"] = {abbrev = "ANP", color = "#EB1D27", shortname = "",},
["Aralar (Basque political party)"] = {abbrev = "", color = "#BD0000", shortname = "Aralar",},
["Aranese Democratic Convergence"] = {abbrev = "", color = "#E9960D", shortname = "",},
["Aranese Democratic Union"] = {abbrev = "", color = "#274737", shortname = "",},
["Arangkada San Joseño"] = {abbrev = "AR", color = "#FF8000", shortname = "",},
["Aranzadi"] = {abbrev = "", color = "#E61A74", shortname = "",},
["Archipelago Tomorrow"] = {abbrev = "", color = "#ED7F10", shortname = "",},
["Arcos en Común"] = {abbrev = "", color = "#AF084C", shortname = "",},
["Arganda Sí Puede"] = {abbrev = "", color = "#438D98", shortname = "",},
["Argentine People's Union"] = {abbrev = "UDELPA", color = "#00708B", shortname = "",},
["Argentine Socialist Party"] = {abbrev = "PSA", color = "#FF9900", shortname = "",},
["Arizona Libertarian Party"] = {abbrev = "", color = "#FED105", shortname = "Libertarian",},
["Arizona Progressive Democratic Party"] = {abbrev = "", color = "#87CEEB", shortname = "",},
["Armed Forces of Equatorial Guinea"] = {abbrev = "", color = "#C3B091", shortname = "",},
["Armed Forces Republic of Indonesia"] = {abbrev = "", color = "#FF0000", shortname = "Military",},
["Armenia Alliance"] = {abbrev = "", color = "#1D2E69", shortname = "",},
["Armenian Communist Party"] = {abbrev = "", color = "red", shortname = "Communist",},
["Armenian National Congress"] = {abbrev = "ANC", color = "#0033A0", shortname = "",},
["Armenian Revolutionary Federation"] = {abbrev = "ARF", color = "#AA0000", shortname = "",},
["Aroha Ngia Tatou"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Arona Independent Electoral Movement"] = {abbrev = "", color = "#3AA346", shortname = "",},
["Arrow Cross Party"] = {abbrev = "NYKP", color = "#964B00", shortname = "",},
["Article 45 Concern Group"] = {abbrev = "A45CG", color = "#2906CC", shortname = "",},
["Article 50 (political party)"] = {abbrev = "", color = "#ffa500", shortname = "",},
["Article One (political party)"] = {abbrev = "", color = "#D21B30", shortname = "",},
["Artsakh Freedom Party"] = {abbrev = "", color = "#020041", shortname = "",},
["Arts Party"] = {abbrev = "", color = "#800080", shortname = "",},
["Aruban Democratic Party"] = {abbrev = "", color = "#59479C", shortname = "",},
["Aruban Liberal Organization"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Aruban Patriotic Movement"] = {abbrev = "", color = "#F70084", shortname = "",},
["Aruban Patriotic Party"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Aruban People's Party"] = {abbrev = "", color = "#65B22E", shortname = "",},
["Aruban Sovereignty Movement"] = {abbrev = "", color = "#54C2E3", shortname = "",},
["Arunachal Congress"] = {abbrev = "", color = "#CCCCFF", shortname = "",},
["Asankhya Samaj Party"] = {abbrev = "ASP", color = "#D0A9F5", shortname = "",},
["Asenso Manileño"] = {abbrev = "", color = "#2F358D", shortname = "",},
["Ashfield Independents"] = {abbrev = "", color = "pink", shortname = "",},
["Ashford Independents"] = {abbrev = "", color = "#21A454", shortname = "",},
["Ashkali Party for Integration"] = {abbrev = "PAI", color = "black", shortname = "",},
["Asia Pacific United Party"] = {abbrev = "", color = "#33FF99", shortname = "Asia Pacific",},
["Askatasuna"] = {abbrev = "", color = "#008229", shortname = "",},
["Asom Gana Parishad"] = {abbrev = "AGP", color = "#99CCFF", shortname = "",},
["Aspire (political party)"] = {abbrev = "", color = "#FF5800", shortname = "Aspire",},
["Assam Jatiya Parishad"] = {abbrev = "AJP", color = "#0048BA", shortname = "",},
["Assam United Democratic Front"] = {abbrev = "AUDF", color = "green", shortname = "",},
["Assembleia do Povo Unido"] = {abbrev = "", color = "#CF1C3A", shortname = "",},
["Assembly for Cantabria"] = {abbrev = "", color = "#C1272F", shortname = "",},
["Assembly for Tarragona"] = {abbrev = "", color = "#793C8F", shortname = "",},
["Assembly for Unity"] = {abbrev = "", color = "#E30614", shortname = "",},
["Assembly of Alcalá"] = {abbrev = "", color = "#FFBD33", shortname = "",},
["Assembly of Greeks"] = {abbrev = "ES", color = "#007CC2", shortname = "",},
["Assembly of Independents"] = {abbrev = "", color = "#E5CC00", shortname = "Independents",},
["Assembly of People of Kazakhstan"] = {abbrev = "", color = "#1A4C96", shortname = "",},
["Assembly of the People United"] = {abbrev = "APU", color = "#094779", shortname = "",},
["Assembly to Energize Japan"] = {abbrev = "", color = "#F36F21", shortname = "",},
["Association for the Defense of Macau Interests"] = {abbrev = "ADIM", color = "#000080", shortname = "",},
["Association for Defence of Revolution Values"] = {abbrev = "ADRV", color = "#FFA500", shortname = "",},
["Association for Democracy Activism"] = {abbrev = "", color = "yellow", shortname = "",},
["Association for Democracy and Social Well-Being of Macau"] = {abbrev = "", color = "#FFFACD", shortname = "",},
["Association for Helping the Community and Engagement with the People"] = {abbrev = "", color = "#000000", shortname = "",},
["Association for Justice and Equality"] = {abbrev = "", color = "#034626", shortname = "Justice & Equality",},
["Association for Promotion of Civic Rights"] = {abbrev = "", color = "#13241E", shortname = "",},
["Association for Promotion of Social Services and Education"] = {abbrev = "", color = "#4F3286", shortname = "",},
["Association for the Advancement of Civil Rights"] = {abbrev = "AACR", color = "#0047AB", shortname = "",},
["Association for the Promotion of Democracy, Freedom, Human Rights and Rule of Law of Macau (Macau Ideals)"] = {abbrev = "", color = "#822571", shortname = "",},
["Association for the Rebirth of Madagascar"] = {abbrev = "AREMA", color = "#FF0000", shortname = "",},
["Association for Together Efforts to Improve the Community"] = {abbrev = "", color = "#64B4B5", shortname = "",},
["Association of Candidates"] = {abbrev = "", color = "#FCF318", shortname = "Kattusseqatigiit",},
["Association of Combatant Clerics"] = {abbrev = "ACC", color = "#098CDC", shortname = "",},
["Association of Free Democrats"] = {abbrev = "BFD", color = "#FFA500", shortname = "",},
["Association of Independent Members of Parliament"] = {abbrev = "", color = "#DCDCDC", shortname = "",},
["Association of Islamic Revolution Loyalists"] = {abbrev = "AIRL", color = "#24b8fe", shortname = "",},
["Association of Italians of Romania"] = {abbrev = "RO.AS.IT", color = "blue", shortname = "",},
["Association of Macedonians of Romania"] = {abbrev = "DMR", color = "#660000", shortname = "",},
["Association of Poles in Lithuania"] = {abbrev = "ZPL", color = "#F23F43", shortname = "",},
["Association of Timorese Heroes"] = {abbrev = "", color = "#000000", shortname = "",},
["Associative Movement of Italians Abroad"] = {abbrev = "MAIE", color = "#333B8E", shortname = "",},
["Assyrian Democratic Movement"] = {abbrev = "", color = "#5f21a9", shortname = "",},
["Asturian Democratic Convergence"] = {abbrev = "", color = "#4ABAB5", shortname = "",},
["Asturian Left Bloc"] = {abbrev = "", color = "#B60006", shortname = "",},
["Asturian Left"] = {abbrev = "", color = "#FFCC00", shortname = "",},
["Asturian Nationalist Council"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Asturian Nationalist Unity"] = {abbrev = "", color = "#0CACAD", shortname = "",},
["Asturian Renewal Union–Asturianist Party"] = {abbrev = "", color = "#106194", shortname = "",},
["Asturian Renewal Union"] = {abbrev = "URAS", color = "#155BC2", shortname = "",},
["Asturias Forum"] = {abbrev = "FAC", color = "#10286B", shortname = "",},
["Ata Meken Socialist Party"] = {abbrev = "", color = "#D2161D", shortname = "Ata-Meken",},
["Ata-Jurt Kyrgyzstan"] = {abbrev = "", color = "#1f247b", shortname = "",},
["Ata-Zhurt"] = {abbrev = "", color = "#3173C9", shortname = "",},
["Atarrabia Taldea"] = {abbrev = "", color = "#FFAA01", shortname = "",},
["Atassut"] = {abbrev = "", color = "#2B9996", shortname = "",},
["Atlantica Party"] = {abbrev = "", color = "#5073B8", shortname = "Atlantica",},
["Attack (political party)"] = {abbrev = "", color = "#344D28", shortname = "Ataka",},
["Attica Project"] = {abbrev = "", color = "#4BB8B3", shortname = "",},
["Atulya Bharat Party"] = {abbrev = "ABP", color = "#FEFEFE", shortname = "",},
["Auckland Future"] = {abbrev = "", color = "#00AEEF", shortname = "",},
["AUna Comunitat Valenciana"] = {abbrev = "", color = "#FE5D2F", shortname = "",},
["Auseva Red"] = {abbrev = "", color = "#515151", shortname = "",},
["Australian Citizens Party"] = {abbrev = "", color = "#656600", shortname = "",},
["Australian Conservatives"] = {abbrev = "", color = "#00B9FB", shortname = "",},
["Australian Democrats"] = {abbrev = "", color = "#FFCD00", shortname = "Democrats",},
["Australian Federation Party"] = {abbrev = "", color = "#538a2e", shortname = "",},
["Australian Greens Victoria"] = {abbrev = "", color = "#10C25B", shortname = "Greens",},
["Australian Greens"] = {abbrev = "", color = "#00a651", shortname = "Greens",},
["Australian Labor Party (Australian Capital Territory Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (New South Wales Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (Northern Territory Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (NSW)"] = {abbrev = "", color = "#DE3533", shortname = "Labor (NSW)",},
["Australian Labor Party (Queensland Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (South Australian Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (Tasmanian Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (Victorian Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party (Western Australian Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labor Party"] = {abbrev = "", color = "#DE3533", shortname = "Labor",},
["Australian Labour Party (Western Australian Branch)"] = {abbrev = "", color = "#DE3533", shortname = "Labour",},
["Australian Motoring Enthusiast Party"] = {abbrev = "", color = "#0528B6", shortname = "AMEP",},
["Australian Party"] = {abbrev = "", color = "#FB607F", shortname = "",},
["Australian People's Party"] = {abbrev = "", color = "#800020", shortname = "",},
["Australian Progressive Coalition"] = {abbrev = "", color = "#ffb400", shortname = "",},
["Australian Sex Party"] = {abbrev = "", color = "#FFBF00", shortname = "",},
["Australians Against Further Immigration"] = {abbrev = "AAFI", color = "#964B00", shortname = "AAFI",},
["Austraya Political Party"] = {abbrev = "", color = "#0099AA", shortname = "",},
["Austrian Nazism"] = {abbrev = "DNSAP", color = "#964B00", shortname = "",},
["Austrian People's Party (2017)"] = {abbrev = "ÖVP", color = "#63C3D0", shortname = "",},
["Austrian People's Party"] = {abbrev = "ÖVP", color = "#000000", shortname = "",},
["Authentic Croatian Party of Rights"] = {abbrev = "", color = "#000000", shortname = "",},
["Authentic Croatian Peasant Party"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Authentic Liberal Party"] = {abbrev = "PLA", color = "darkred", shortname = "",},
["Authentic Party of the Mexican Revolution"] = {abbrev = "PARM", color = "Olive", shortname = "",},
["Authentic Radical Liberal Party"] = {abbrev = "PLRA", color = "#2E3092", shortname = "",},
["Authentic Renewal Organization"] = {abbrev = "", color = "#B8FEFC", shortname = "",},
["Authentic Revolutionary Nationalist Movement"] = {abbrev = "", color = "#8079CE", shortname = "",},
["Authentic Revolutionary Party (Panama)"] = {abbrev = "", color = "#00A859", shortname = "",},
["Authentic Revolutionary Party"] = {abbrev = "", color = "#5A4FCF", shortname = "",},
["Authentic Socialist Party (Argentina)"] = {abbrev = "PSA", color = "#DD2C1A", shortname = "Authentic Socialist Party",},
["Authentic Socialist Party (Chile)"] = {abbrev = "", color = "darkred", shortname = "",},
["Authenticity and Modernity Party"] = {abbrev = "PAM", color = "#0047AB", shortname = "",},
["Authenticity Party"] = {abbrev = "", color = "black", shortname = "",},
["Autodeterminaziorako Bilgunea"] = {abbrev = "", color = "#B0C50E", shortname = "",},
["Autonomist Monarchist Federation"] = {abbrev = "", color = "#EFE4B0", shortname = "",},
["Autonomist Party of Corrientes"] = {abbrev = "", color = "#F08080", shortname = "",},
["Autonomist Party"] = {abbrev = "", color = "#475f8a", shortname = "",},
["Autonomist Republican Bloc"] = {abbrev = "", color = "#CC734C", shortname = "",},
["Autonomist Republican Union Party"] = {abbrev = "", color = "#581768", shortname = "",},
["Autonomist–Liberal Pact"] = {abbrev = "", color = "#40e0d0", shortname = "",},
["Autonomous Front"] = {abbrev = "", color = "#035612", shortname = "",},
["Autonomous Galician Republican Organization"] = {abbrev = "", color = "#0A70B8", shortname = "",},
["Autonomous Manacor People"] = {abbrev = "", color = "#8889B0", shortname = "",},
["Autonomous Nationalities for Change and Empowerment"] = {abbrev = "NACER", color = "#FFFF00", shortname = "",},
["Autonomous Nationalities for Change and Revolutionary Empowerment"] = {abbrev = "", color = "#026701", shortname = "",},
["Autonomous Socialist Party (Ticino)"] = {abbrev = "", color = "#8B1C62", shortname = "Autonomous Socialists",},
["Autonomous Socialist Party of South Jura"] = {abbrev = "", color = "#9E151C", shortname = "",},
["Autonomous State Demand Committee (United)"] = {abbrev = "ASDC(U)", color = "grey", shortname = "",},
["Autonomous State Demand Committee"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Autonomy Liberty Democracy"] = {abbrev = "", color = "#E56717", shortname = "",},
["Autonomy South"] = {abbrev = "", color = "#273BE2", shortname = "",},
["Auyl People's Democratic Patriotic Party"] = {abbrev = "", color = "#0A5B2D", shortname = "Auyl",},
["Auzolan"] = {abbrev = "", color = "#F92D36", shortname = "",},
["Avant"] = {abbrev = "", color = "#211473", shortname = "",},
["Avante La Laguna"] = {abbrev = "", color = "#B14B7C", shortname = "",},
["Avante (political party)"] = {abbrev = "", color = "#2eacb2", shortname = "Avante",},
["Avanza Libertad"] = {abbrev = "", color = "#3A3F92", shortname = "",},
["Avanzamos por ti"] = {abbrev = "", color = "#FFC60A", shortname = "",},
["Awakening (political party)"] = {abbrev = "", color = "#CF1F25", shortname = "",},
["Awami Jamhuri Ittehad Pakistan"] = {abbrev = "AJIP", color = "#5F9EA0", shortname = "",},
["Awami League"] = {abbrev = "", color = "#006a4e", shortname = "",},
["Awami Muslim League (Pakistan)"] = {abbrev = "AML", color = "#9ACD32", shortname = "",},
["Awami Muslim League"] = {abbrev = "", color = "#bcf55c", shortname = "",},
["Awami National Party"] = {abbrev = "ANP", color = "#c83737", shortname = "",},
["Awami Party"] = {abbrev = "AWP", color = "#DA81F5", shortname = "",},
["Awami Raj Party"] = {abbrev = "ARP", color = "#FFFF00", shortname = "",},
["Awami Vikas Party"] = {abbrev = "", color = "#1f7945", shortname = "",},
["Awami Workers Party"] = {abbrev = "AWP", color = "#DC143C", shortname = "",},
["Azad Hind Fauz (Rajkiya)"] = {abbrev = "AHF", color = "#00FFCC", shortname = "",},
["Azanian People's Organisation"] = {abbrev = "", color = "#f9a510", shortname = "",},
["Azerbaijan Communist Party (1993)"] = {abbrev = "AKP", color = "red", shortname = "",},
["Azerbaijan Democrat Party"] = {abbrev = "", color = "#FBFB07", shortname = "",},
["Azerbaijan Democratic Enlightenment Party"] = {abbrev = "ADMP", color = "#7C8EBC", shortname = "",},
["Azerbaijan Liberal Party"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Azerbaijan National Independence Party"] = {abbrev = "AMİP", color = "#0B94C2", shortname = "",},
["Azerbaijan Social Prosperity Party"] = {abbrev = "ASRP", color = "#0000CD", shortname = "",},
["Azerbaijani Popular Front Party"] = {abbrev = "APFP", color = "#5C5858", shortname = "",},
["Azerbaijani Social Democratic Party"] = {abbrev = "", color = "red", shortname = "",},
["Azir Moris"] = {abbrev = "", color = "#000000", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
5sj7zcezzw2g8iro67brwtsildd9im2
Module:Political party/C
828
68668236
1096899522
1096812328
2022-07-07T10:28:07Z
N Panama 84534
38274583
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["California Democratic Party"] = "Democratic Party (US)",
["California Progressive Party"] = "Progressive Party (US)",
["California Republican Party"] = "Republican Party (US)",
["Cambiamo"] = "Cambiamo!",
["Cambodian National Rescue Party"] = "Cambodia National Rescue Party",
["Canarian Nationalist Assembly"] = "Nationalist Canarian Assembly",
["Canarian United Left"] = "United Left (Spain)",
["Cap 21"] = "Cap21",
["Carlist Party (1970)"] = "Carlist Party",
["Carlist Party of Euskal Herria"] = "Carlist Party",
["Catalan Democratic Party"] = "Catalan European Democratic Party",
["Catalan Federation of the PSOE"] = "Spanish Socialist Workers' Party",
["Catalan Socialist Federation"] = "Spanish Socialist Workers' Party",
["Catalunya en Comú–Podem"] = "Catalunya en Comú",
["Catholic Democrats (The National Party)"] = "Catholic Democrats (Ireland)",
["Catholic Democrats"] = "Catholic Democrats (Ireland)",
["CCM"] = "Chama Cha Mapinduzi",
["CD&V"] = "Christen-Democratisch en Vlaams",
["CdH"] = "Humanist Democratic Centre",
["CDS - People's Party"] = "CDS – People's Party",
["CDU"] = "Christian Democratic Union of Germany",
["Centre Democratic Action of Galicia"] = "Citizens of Galicia Democratic Action",
["Centre démocrate humaniste"] = "Humanist Democratic Centre",
["Centre Independent Aragonese Candidacy"] = "Aragonese Party",
["Centre Party (Israel)"] = "Center Party (Israel)",
["Centre Party"] = "Centre Party (Sweden)",
["Centre Union (Greece)"] = "Centre Union",
["Centre-left coalition (Italy)"] = "Centre-left coalition",
["Centre-right coalition (Italy)"] = "Centre-right coalition",
["Centre-right Coalition"] = "Centre-right coalition",
["Centrist Party (United States)"] = "Centrist Party (US)",
["Centrists of Catalonia"] = "Union of the Democratic Centre (Spain)",
["Ceylon Indian Congress"] = "Ceylon Workers' Congress",
["Chama cha Mapinduzi"] = "Chama Cha Mapinduzi",
["Change 90 - New Majority"] = "Cambio 90",
["Change 90 – New Majority"] = "Cambio 90", -- dash differences
["Change UK – The Independent Group"] = "The Independent Group for Change",
["Change UK"] = "The Independent Group for Change",
["Chilean Socialist Party (1987-1990)"] = "Chilean Socialist Party",
["Chilean Socialist Party (1987–1990)"] = "Chilean Socialist Party", -- dash differences
["China Democratic National Construction Association"] = "China National Democratic Construction Association",
["Chrisitan Democracy for the Autonomies"] = "Christian Democracy for the Autonomies",
["Christian and Democratic Union - Czechoslovak People's Party"] = "KDU-ČSL",
["Christian and Democratic Union – Czechoslovak People's Party"] = "KDU-ČSL",
["Christian Democracy (Italy, historical)"] = "Christian Democracy (Italy)",
["Christian Democracy"] = "Christian Democracy (Italy)",
["Christian Democrat Party of Chile"] = "Christian Democratic Party (Chile)",
["Christian Democratic and Flemish"] = "Christen-Democratisch en Vlaams",
["Christian Democratic Party (France)"] = "VIA, the Way of the People",
["Christian Democratic Team of the Spanish State"] = "Christian Democracy Federation–Christian Democracy Team",
["Christian Democratic Union (Germany)"] = "Christian Democratic Union of Germany",
["Christian Democratic Unity"] = "Christian Democrats (Sweden)",
["Christian Heritage New Zealand"] = "Christian Heritage Party of New Zealand",
["Christian Liberal Party"] = "Christian Liberty Unification Party",
["Christian Liberty Party"] = "Christian Liberty Unification Party",
["Christian People's Party (Latvia)"] = "Popular Front of Latvia",
["Christian Social Party (Wallonia)"] = "Humanist Democratic Centre",
["Christian Social Party"] = "Christian Social Party (Germany)",
["Christian Social Union of Bavaria"] = "Christian Social Union in Bavaria",
["Christian Workers' Union (Finland)"] = "Christian Workers' Union of Finland",
["Christian-Democratic National Peasants' Party (Romania)"] = "Christian Democratic National Peasants' Party",
["ChristianUnion"] = "Christian Union (Netherlands)",
["CIBAC"] = "Citizens' Battle Against Corruption",
["CISTA"] = "Cannabis Is Safer Than Alcohol",
["Citizen Europe"] = "Cap21",
["Citizen’s Coalition for Justice Party (Mongolia)"] = "Citizen's Coalition for Justice Party (Mongolia)",
["Citizens of Democratic Centre"] = "Democratic Centre Coalition",
["Citizens Party (United States)"] = "Citizens Party (US)",
["Citizens' Liberation Party"] = "Nagrik Unmukti Party",
["Citizens' Movement (France)"] = "Citizen and Republican Movement",
["Citizens' Party (Philippines)"] = "Nationalist Citizens' Party",
["Citizenship, Action, Participation for the 21st Century"] = "Cap21",
["Civic Centre Alliance"] = "Center Civic Alliance",
["Civic-Liberal Alliance"] = "Civic Liberal Alliance",
["Civil Congress of Ukraine"] = "Slavic Party (Ukraine)",
["Civil Contract"] = "Civil Contract (Armenia)",
["Civil Initiative"] = "Civic Initiative",
["Civil Will–Green Party"] = "Civil Will-Green Party",
["Coalition for Bulgaria"] = "BSP for Bulgaria",
["Coalition for Democratic Unity"] = "Democratic Unity Roundtable",
["Coalition for Europe (2009)"] = "Coalition for Europe",
["Coalition for Europe (2014)"] = "Coalition for Europe",
["Coalition for Republic – Republican Party of Czechoslovakia"] = "Rally for the Republic – Republican Party of Czechoslovakia",
["Coalition for the Europe of the Peoples"] = "Europe of the Peoples",
["Coalition Liberal"] = "National Liberal Party (UK, 1922)",
["Coalition New Zealand"] = "Vision NZ",
["Coalition of the Radical Left"] = "Syriza",
["Coalition Party and Rural People's Association"] = "Estonian Coalition Party",
["Coalition Unionist"] = "Coalition Conservative",
["Collective Action Party — Civic Congress"] = "Collective Action Party – Civic Congress",
["Colorado Democratic Party"] = "Democratic Party (US)",
["Colorado Republican Party"] = "Republican Party (US)",
["Common Peoples' Party"] = "Other parties",
["Commonwealth Land Party (United States)"] = "Commonwealth Land Party (US)",
["Commonwealth Liberal"] = "Commonwealth Liberal Party",
["Communist League Marxist–Leninists (the revolutionaries)"] = "Communist Party (Sweden)",
["Communist Movement of Aragon"] = "Communist Movement (Spain)",
["Communist Movement of Asturias"] = "Communist Movement (Spain)",
["Communist Movement of Catalonia"] = "Communist Movement (Spain)",
["Communist Movement of Euskadi"] = "Communist Movement (Spain)",
["Communist Movement of Galicia"] = "Communist Movement (Spain)",
["Communist Movement of the Valencian Country"] = "Communist Movement (Spain)",
["Communist Party (United States)"] = "Communist Party (US)",
["Communist Party of Andalusia"] = "Communist Party of Spain",
["Communist Party of Aragon"] = "Communist Party of Spain",
["Communist Party of Armenia (Soviet Union)"] = "Communist Party of the Soviet Union",
["Communist Party of Asturias"] = "Communist Party of Spain",
["Communist Party of Belgium"] = "Workers' Party of Belgium",
["Communist Party of Britain (Marxist-Leninist)"] = "Communist Party of Britain (Marxist–Leninist)",
["Communist Party of Cantabria"] = "Communist Party of Spain",
["Communist Party of Castile and León"] = "Communist Party of Spain",
["Communist Party of Castilla–La Mancha"] = "Communist Party of Spain",
["Communist Party of Ceylon"] = "Communist Party of Sri Lanka",
["Communist Party of China"] = "Chinese Communist Party",
["Communist Party of Estonia"] = "Communist Party of the Soviet Union",
["Communist Party of Extremadura"] = "Communist Party of Spain",
["Communist Party of Finland (1997)"] = "Communist Party of Finland (1994)",
["Communist Party of Galicia (Revolutionary Marxist)"] = "Workers' Party of Spain–Communist Unity",
["Communist Party of Galicia"] = "Communist Party of Spain",
["Communist Party of Germany (Opposition)"] = "Communist Party of Germany",
["Communist Party of Great Britain (Marxist-Leninist)"] = "Communist Party of Great Britain (Marxist–Leninist)",
["Communist Party of India (Marxist-Leninist) (Liberation)"] = "Communist Party of India (Marxist–Leninist) Liberation",
["Communist Party of India (Marxist-Leninist) Liberation"] = "Communist Party of India (Marxist–Leninist) Liberation",
["Communist Party of India (Marxist-Leninist) Red Star"] = "Communist Party of India (Marxist–Leninist) Red Star",
["Communist Party of India (Marxist–Leninist)"] = "Provisional Central Committee, Communist Party of India (Marxist–Leninist)",
["Communist Party of Ireland (Marxist-Leninist)"] = "Communist Party of Ireland (Marxist–Leninist)",
["Communist Party of La Rioja"] = "Communist Party of Spain",
["Communist Party of Madrid"] = "Communist Party of Spain",
["Communist Party of Nepal (Marxist-Leninist) (1998)"] = "Communist Party of Nepal (Marxist–Leninist) (2002)",
["Communist Party of Nepal (Marxist-Leninist) (2002)"] = "Communist Party of Nepal (Marxist–Leninist) (2002)",
["Communist Party of Nepal (Unified Marxist-Leninist)"] = "Communist Party of Nepal (Unified Marxist–Leninist)",
["Communist Party of Switzerland"] = "Communist Party",
["Communist Party of the Balearic Islands"] = "Communist Party of Spain",
["Communist Party of the Basque Country"] = "Communist Party of Spain",
["Communist Party of the Canaries"] = "Communist Party of Spain",
["Communist Party of the Catalan People"] = "Communist Party of the Peoples of Spain",
["Communist Party of the Galician People"] = "Communist Party of the Peoples of Spain",
["Communist Party of the Portuguese Workers / Reorganizative Movement of the Party of the Proletariat"] = "Portuguese Workers' Communist Party",
["Communist Party of the Region of Murcia"] = "Communist Party of Spain",
["Communist Party of the Valencian Country"] = "Communist Party of Spain",
["Communist Party of Turkey (current)"] = "Communist Party of Turkey (modern)",
["Communist Party of Turkey (today)"] = "Communist Party of Turkey (modern)",
["Communist Party of Yugoslavia"] = "League of Communists of Yugoslavia",
["Communist People's Party of Kazakhstan"] = "People's Party of Kazakhstan",
["Communist Workers' Party of Catalonia"] = "Spanish Communist Workers' Party",
["Communists' Unity Board"] = "Workers' Party of Spain–Communist Unity",
["Community of the People"] = "Inuit Ataqatigiit",
["Concert of Parties for Democracy"] = "Concertación",
["Concertación de Partidos por la Democracia"] = "Concertación",
["Confederation for an Independent Poland"] = "Confederation of Independent Poland",
["Connecticut Democratic Party"] = "Democratic Party (US)",
["Connecticut for Lieberman"] = "Independent (US)",
["Connecticut Republican Party"] = "Republican Party (US)",
["Conservatism"] = "Conservatism sidebar",
["Conservative and National Liberal"] = "National Liberal Party (UK, 1931)",
["Conservative and Unionist"] = "Scottish Conservatives",
["Conservative Party (New York)"] = "Conservative Party (US)",
["Conservative Party (Norway)"] = "Conservative Party of Norway",
["Conservative Party (UK)"] = "Conservative and Unionist Party (UK)",
["Conservative Party (United States)"] = "Conservative Party (US)",
["Conservative Party (Virginia, 1867)"] = "Conservative Party (US)",
["Conservative Party of Cuba"] = "National Conservative Party (Cuba)",
["Conservative Party of New York State"] = "Conservative Party (US)",
["Conservative Party of New York"] = "Conservative Party (US)",
["Conservative Party of New Zealand"] = "New Conservative Party of New Zealand",
["Conservative Party of Virginia (1965)"] = "Conservative Party (Virginia, 1965)",
["Conservative Party"] = "Conservative and Unionist Party (UK)",
["Conservatives in Northern Ireland"] = "Northern Ireland Conservatives",
["Constituent Unity"] = "New Social Pact",
["Constitution Party (Oregon)"] = "Constitution Party (US)",
["Constitution Party (United States)"] = "Constitution Party (US)",
["Constitution Party (Utah)"] = "Constitution Party (US)",
["Constitution Party of Minnesota"] = "Constitution Party (US)",
["Constitution Party of Oregon"] = "Constitution Party (US)",
["Constitution Party of Washington"] = "Constitution Party (US)",
["Constitutional Democratic Rally"] = "Democratic Constitutional Rally",
["Constitutional Union Party (United States)"] = "Constitutional Union Party (US)",
["Constructive Ecological Party \"KEDR\""] = "Russian Ecological Party \"The Greens\"",
["Cook Islands Party Tumu"] = "Party Tumu",
["COPEI"] = "Copei",
["Country Party of Australia – Tasmania"] = "National Party of Australia – Tasmania",
["Country Party of Western Australia"] = "National Party of Australia",
["Country Party"] = "National Party of Australia",
["Country/Liberal coalition"] = "National Party of Australia",
["Country"] = "National Party of Australia",
["Country/National coalition"] = "National Party of Australia",
["Country/Nationalist coalition"] = "National Party of Australia",
["Country/QPP coalition"] = "National Party of Australia",
["Country/UAP coalition"] = "National Party of Australia",
["Country/United coalition"] = "National Party of Australia",
["Courage Italy"] = "Coraggio Italia",
["CPI(M)"] = "Communist Party of India (Marxist)",
["CREO Movement"] = "Creating Opportunities",
["Crescent Star Party"] = "Crescent Star Party (Indonesia)",
["Croatian Citizen Party"] = "Croatian Civic Party",
["Croatian Labourists - Labour Party"] = "Croatian Labourists – Labour Party",
["Croatian People's Party - Liberal Democrats"] = "Croatian People's Party – Liberal Democrats",
["Croatian Sustainable Development"] = "Sustainable Development of Croatia",
["Crossbench"] = "Crossbencher",
["CSSD"] = "Czech Social Democratic Party",
["Cuban Popular Party-National League"] = "Cuban Popular Party",
["Cumann na nGaedhael"] = "Cumann na nGaedheal",
["Cumbria First"] = "CumbriaFirst",
["CVP"] = "Christen-Democratisch en Vlaams",
}
local full = {
["Caballas Coalition"] = {abbrev = "", color = "#C9601C", shortname = "Caballas",},
["Cáceres Eres Tú"] = {abbrev = "", color = "#5A1E5A", shortname = "",},
["Caledonia Together"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Caledonian Union"] = {abbrev = "", color = "#008000", shortname = "",},
["California National Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Caló Nationalist Party"] = {abbrev = "", color = "#008284", shortname = "",},
["Cambia Avilés"] = {abbrev = "", color = "#19905A", shortname = "",},
["Cambia Logroño"] = {abbrev = "", color = "#A30052", shortname = "",},
["Cámbialo Municipalistas"] = {abbrev = "", color = "#AD0B5A", shortname = "",},
["Cambiamo!"] = {abbrev = "", color = "#E58321", shortname = "",},
["Cambiando Burlada"] = {abbrev = "", color = "#9F82A1", shortname = "",},
["Cambiar Huesca"] = {abbrev = "", color = "#27933E", shortname = "",},
["Cambiar la Región de Murcia"] = {abbrev = "", color = "#80B620", shortname = "",},
["Cambiemos Murcia"] = {abbrev = "", color = "#C0CD37", shortname = "",},
["Cambiemos Orihuela"] = {abbrev = "", color = "#009A97", shortname = "",},
["Cambiemos Parla"] = {abbrev = "", color = "#BF469A", shortname = "",},
["Cambiemos Villalba"] = {abbrev = "", color = "#B00868", shortname = "",},
["Cambiemos"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Cambio 90"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Cambio-Aldaketa"] = {abbrev = "", color = "#A2AA00", shortname = "",},
["Cambodia National Rescue Party"] = {abbrev = "CNRP", color = "#0047AB", shortname = "",},
["Cambodian People's Party"] = {abbrev = "CPP", color = "#1E90FF", shortname = "",},
["Cambridge Socialists"] = {abbrev = "", color = "red", shortname = "",},
["Camden Charter"] = {abbrev = "", color = "white", shortname = "",},
["Cameroon Democratic Union"] = {abbrev = "", color = "#032893", shortname = "",},
["Cameroon People's Democratic Movement"] = {abbrev = "RDPC", color = "#73C2FB", shortname = "",},
["Cameroon Renaissance Movement"] = {abbrev = "MRC", color = "#A8E2F0", shortname = "",},
["Cameroonian National Union"] = {abbrev = "", color = "#00CD12", shortname = "",},
["Cameroonian Union"] = {abbrev = "", color = "#007F00", shortname = "",},
["Camp of National Unity"] = {abbrev = "OZN", color = "#00177C", shortname = "",},
["Campaign for a More Prosperous Britain"] = {abbrev = "", color = "grey", shortname = "More Prosperous Britain",},
["Can Lao Party"] = {abbrev = "", color = "#39944A", shortname = "",},
["Canadian Alliance"] = {abbrev = "", color = "#5F9EA0", shortname = "Alliance",},
["Canarian Assembly"] = {abbrev = "", color = "#C62821", shortname = "",},
["Canarian Centrist Group"] = {abbrev = "", color = "#0D601C", shortname = "",},
["Canarian Coalition–New Canaries"] = {abbrev = "", color = "#BAF73E", shortname = "",},
["Canarian Coalition"] = {abbrev = "CC", color = "#FFD700", shortname = "",},
["Canarian Green Party"] = {abbrev = "", color = "#85C026", shortname = "",},
["Canarian Greens"] = {abbrev = "", color = "#008000", shortname = "",},
["Canarian Independent Groups"] = {abbrev = "AIC", color = "#000088", shortname = "",},
["Canarian Nationalist Alternative"] = {abbrev = "", color = "#AD221B", shortname = "",},
["Canarian Nationalist Convergence"] = {abbrev = "", color = "#65BFE3", shortname = "",},
["Canarian Nationalist Federation"] = {abbrev = "FNC", color = "#823D8F", shortname = "",},
["Canarian Nationalist Party"] = {abbrev = "", color = "#495087", shortname = "",},
["Canarian People's Union"] = {abbrev = "", color = "#BA0033", shortname = "",},
["Canarian Popular Alternative"] = {abbrev = "", color = "#009642", shortname = "",},
["Canarian Social Democratic Centre"] = {abbrev = "", color = "#FF7F02", shortname = "",},
["Canarian Union"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Canaries Decides"] = {abbrev = "", color = "#9B0024", shortname = "",},
["Canaries for Progress"] = {abbrev = "", color = "#3485BD", shortname = "",},
["Candidacy for the Neighbors' Participation in the City Council"] = {abbrev = "", color = "#DEC939", shortname = "",},
["Candidatura de Unidad Popular"] = {abbrev = "", color = "#A0866E", shortname = "",},
["Candlelight Party"] = {abbrev = "", color = "#020878", shortname = "Candlelight",},
["Cangas Left Alternative"] = {abbrev = "", color = "#6F956C", shortname = "",},
["Cannabis Is Safer Than Alcohol"] = {abbrev = "CISTA", color = "#D2B48C", shortname = "",},
["Cannabis Law Reform"] = {abbrev = "", color = "#556B2F", shortname = "",},
["Cannabis Party (Spain)"] = {abbrev = "", color = "#428600", shortname = "",},
["Cantabrian Nationalist Council"] = {abbrev = "", color = "#973D3C", shortname = "",},
["Cantabrian Unity"] = {abbrev = "", color = "#08C853", shortname = "",},
["Cantabristas"] = {abbrev = "", color = "#7D002E", shortname = "",},
["Cantonal Party"] = {abbrev = "", color = "#8F3F42", shortname = "",},
["Canvey Island Independent Party"] = {abbrev = "CIIP", color = "#000000", shortname = "",},
["Canviem entre Tots"] = {abbrev = "", color = "#5B244B", shortname = "",},
["Canviem Mollet"] = {abbrev = "", color = "#631F5E", shortname = "",},
["Cap Ecology"] = {abbrev = "", color = "#509A32", shortname = "",},
["Cap21"] = {abbrev = "", color = "#9db55c", shortname = "",},
["Cape Coloured Congress"] = {abbrev = "", color = "#000000", shortname = "",},
["Cape Party"] = {abbrev = "", color = "#000076", shortname = "",},
["Capitalist Party of South Africa"] = {abbrev = "", color = "#693C97", shortname = "",},
["Capitalist Party"] = {abbrev = "", color = "#4A104A", shortname = "",},
["Caribbean Socialist Party"] = {abbrev = "", color = "#be1918", shortname = "",},
["Caring Macau"] = {abbrev = "", color = "#1034A6", shortname = "",},
["Carlist Party"] = {abbrev = "", color = "#FF454F", shortname = "",},
["Carlist Traditionalist Communion"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Cartagena Sí Se Puede"] = {abbrev = "", color = "#572458", shortname = "",},
["Cartagenerist Party"] = {abbrev = "", color = "#BE2F33", shortname = "",},
["Cartago Agrarian Union Party"] = {abbrev = "PUAC", color = "#BA55D3", shortname = "",},
["Carthaginense Citizens' Initiative"] = {abbrev = "", color = "#820004", shortname = "",},
["Cartista"] = {abbrev = "", color = "#002395", shortname = "",},
["CASA–CE"] = {abbrev = "", color = "#52a8ff", shortname = "",},
["CasaPound"] = {abbrev = "", color = "#000000", shortname = "",},
["Cascadia Bioregional Party"] = {abbrev = "", color = "#067DC4", shortname = "",},
["Castelló en Moviment"] = {abbrev = "", color = "#35A299", shortname = "",},
["Castellón Democracy"] = {abbrev = "", color = "#0D9F4E", shortname = "",},
["Castilian Left"] = {abbrev = "", color = "#C5496F", shortname = "",},
["Castilian Party"] = {abbrev = "", color = "#551D79", shortname = "",},
["Castilian Regionalist Party"] = {abbrev = "", color = "#F0DD07", shortname = "",},
["Castilian Unity"] = {abbrev = "", color = "#313494", shortname = "",},
["Castilianist Union"] = {abbrev = "", color = "#DC143C", shortname = "",},
["CastroVerde (political party)"] = {abbrev = "", color = "#06BC58", shortname = "",},
["Catalan Action"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Catalan Agreement of Progress"] = {abbrev = "", color = "#FA8005", shortname = "",},
["Catalan Centre"] = {abbrev = "", color = "#6D1402", shortname = "",},
["Catalan Civil Support"] = {abbrev = "", color = "#A11C26", shortname = "",},
["Catalan Coexistence"] = {abbrev = "", color = "#0E2D87", shortname = "",},
["Catalan European Democratic Party"] = {abbrev = "PDeCAT", color = "#0263AC", shortname = "",},
["Catalan Left"] = {abbrev = "", color = "#D6B800", shortname = "",},
["Catalan Nationalist Republican"] = {abbrev = "", color = "#FACF9A", shortname = "",},
["Catalan Republican Party (1917)"] = {abbrev = "", color = "#B35359", shortname = "",},
["Catalan Republican Party"] = {abbrev = "", color = "#EB5604", shortname = "",},
["Catalan Solidarity (1906)"] = {abbrev = "SC", color = "#47ABA9", shortname = "",},
["Catalan Solidarity (1980)"] = {abbrev = "", color = "#FFA07A", shortname = "",},
["Catalan Solidarity for Independence"] = {abbrev = "SI", color = "#CA0405", shortname = "",},
["Catalan Sovereigntist Bloc"] = {abbrev = "", color = "#C1001F", shortname = "",},
["Catalonia in the Senate"] = {abbrev = "", color = "#FFD74D", shortname = "",},
["Catalonia Yes"] = {abbrev = "", color = "#1E242E", shortname = "",},
["Catalunya en Comú"] = {abbrev = "", color = "#912C45", shortname = "",},
["Catalunya Lliure"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Catalunya Sí que es Pot"] = {abbrev = "", color = "#C4375B", shortname = "CatSíqueesPot",},
["Catamarca People's Movement"] = {abbrev = "", color = "#0052CE", shortname = "",},
["Catholic Centre Party (Portugal)"] = {abbrev = "CCP", color = "#00BFFF", shortname = "Catholic Centre",},
["Catholic Church footer"] = {abbrev = "", color = "#FFD700", shortname = "Catholic",},
["Catholic Democrats (Ireland)"] = {abbrev = "", color = "#8A8AE0", shortname = "Catholic Democrats",},
["Catholic Election Action"] = {abbrev = "WAK", color = "#3F82C6", shortname = "",},
["Catholic National Party"] = {abbrev = "KNP", color = "#47B26B", shortname = "",},
["Catholic Party (Belgium)"] = {abbrev = "", color = "#FFD700", shortname = "Catholic",},
["Catholic Party (Indonesia)"] = {abbrev = "", color = "#800000", shortname = "",},
["Catholic Party (Liverpool)"] = {abbrev = "", color = "#99FF66", shortname = "Catholic",},
["Catholic People's Party (Poland)"] = {abbrev = "SKL", color = "#335B5B", shortname = "",},
["Catholic People's Party"] = {abbrev = "KVP", color = "#004F50", shortname = "",},
["Catholic Union (Spain)"] = {abbrev = "", color = "#1D5D96", shortname = "",},
["Cavalier"] = {abbrev = "", color = "white", shortname = "",},
["Cayman Democratic Party"] = {abbrev = "CDP", color = "#345284", shortname = "",},
["Cayman Islands People's Party"] = {abbrev = "", color = "#FFC30D", shortname = "",},
["CDS – People's Party"] = {abbrev = "CDS–PP", color = "#0093DD", shortname = "",},
["CDU/CSU"] = {abbrev = "", color = "#000000", shortname = "",},
["Ceann Comhairle"] = {abbrev = "", color = "#000000", shortname = "",},
["Ceire Cion"] = {abbrev = "", color = "salmon", shortname = "Ceire Cion",},
["Célbakísér Civil Szövetség"] = {abbrev = "", color = "#95C241", shortname = "",},
["Center Civic Alliance"] = {abbrev = "POC", color = "#FFD054", shortname = "",},
["Center for Islamic Iran Academics"] = {abbrev = "CIIA", color = "#03babe", shortname = "",},
["Center for the Study of Natural Resources"] = {abbrev = "", color = "#17AA5C", shortname = "",},
["Center Party (Israel)"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Center Party (Norway)"] = {abbrev = "", color = "#D63D2D", shortname = "",},
["Center Union-New Forces"] = {abbrev = "EK-ND", color = "#FF7F50", shortname = "",},
["Centered for Tarragona"] = {abbrev = "", color = "#00436E", shortname = "",},
["Centered Progressives Coalition"] = {abbrev = "", color = "#C60079", shortname = "",},
["Centrados"] = {abbrev = "", color = "#D9007F", shortname = "",},
["Central African Democratic Rally"] = {abbrev = "RDC", color = "#FFE339", shortname = "",},
["Central African Democratic Union"] = {abbrev = "UDC", color = "#B1CF70", shortname = "",},
["Central African Republican Party"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Central and Western Democratic Power"] = {abbrev = "CWDP", color = "#d75453", shortname = "",},
["Central and Western District Coalition"] = {abbrev = "", color = "#3FA900", shortname = "",},
["Centralist Republican Party"] = {abbrev = "", color = "#B82761", shortname = "",},
["Centre (Croatian political party)"] = {abbrev = "", color = "#2D7AB0", shortname = "",},
["Centre Alliance (Argentina)"] = {abbrev = "", color = "#0087D1", shortname = "Centre Alliance",},
["Centre Alliance"] = {abbrev = "", color = "#ff6300", shortname = "",},
["Centre and Democracy Forum"] = {abbrev = "", color = "#009E31", shortname = "",},
["Centre Democracy and Progress"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Centre Democrats (Denmark)"] = {abbrev = "", color = "#800080", shortname = "Centre Democrats",},
["Centre Democrats (Netherlands)"] = {abbrev = "CD", color = "#7F663D", shortname = "",},
["Centre Group"] = {abbrev = "", color = "#F47F31", shortname = "",},
["Centre of Arona"] = {abbrev = "", color = "#70B72B", shortname = "",},
["Centre of Social Democrats"] = {abbrev = "", color = "#4B0082", shortname = "",},
["Centre Party '86"] = {abbrev = "", color = "red", shortname = "",},
["Centre Party (Denmark)"] = {abbrev = "", color = "#39944A", shortname = "Centre",},
["Centre Party (Faroe Islands)"] = {abbrev = "", color = "#007cc2", shortname = "Centre",},
["Centre Party (Finland)"] = {abbrev = "", color = "#349a2b", shortname = "Centre",},
["Centre Party (Germany)"] = {abbrev = "", color = "#000000", shortname = "Centre",},
["Centre Party (Greenland)"] = {abbrev = "", color = "#FFCC00", shortname = "Akulliit",},
["Centre Party (Hungary)"] = {abbrev = "", color = "#FFB900", shortname = "Centre",},
["Centre Party (Iceland)"] = {abbrev = "", color = "#002169", shortname = "Centre",},
["Centre Party (Jersey)"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Centre Party (Latvia)"] = {abbrev = "", color = "#8D2421", shortname = "",},
["Centre Party (Nauru)"] = {abbrev = "", color = "#FFC718", shortname = "",},
["Centre Party (Netherlands)"] = {abbrev = "CP", color = "red", shortname = "",},
["Centre Party (Norway)"] = {abbrev = "", color = "#008542", shortname = "Centre",},
["Centre Party (Rhodesia)"] = {abbrev = "", color = "#0088ff", shortname = "Centre Party",},
["Centre Party (Sweden)"] = {abbrev = "C", color = "#016A39", shortname = "Centre",},
["Centre Party (Sweden, 1873)"] = {abbrev = "", color = "#6BB7EC", shortname = "Centre",},
["Centre Party (Tasmania)"] = {abbrev = "", color = "#3E933E", shortname = "Centre",},
["Centre Party (Turkey)"] = {abbrev = "", color = "#12A19A", shortname = "Centre",},
["Centre Republican Party"] = {abbrev = "", color = "#00984B", shortname = "",},
["Centre Union"] = {abbrev = "ΕΚ", color = "#FCB825", shortname = "",},
["Centre Union for Terrassa"] = {abbrev = "", color = "#C7DB08", shortname = "",},
["Centre Unity"] = {abbrev = "", color = "#881A2D", shortname = "",},
["Centre-left coalition"] = {abbrev = "", color = "#EF3E3E", shortname = "Centre-left coalition",},
["Centre-Left of Albacete"] = {abbrev = "", color = "#F4644A", shortname = "",},
["Centre-left politics"] = {abbrev = "", color = "#464646", shortname = "Centre-left",},
["Centre-right coalition"] = {abbrev = "", color = "#0A6BE1", shortname = "",},
["Centre-right politics"] = {abbrev = "", color = "#ADC1FD", shortname = "Centre-right",},
["Centrem"] = {abbrev = "", color = "#0B5663", shortname = "",},
["Centrist Alliance"] = {abbrev = "AC", color = "#473B84", shortname = "",},
["Centrist Convergence–Democratic and Social Centre"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Centrist Democratic Party (Rwanda)"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Centrist Democratic Party of the Philippines"] = {abbrev = "CDP", color = "#0067B4", shortname = "",},
["Centrist Party (Spain)"] = {abbrev = "", color = "#08D152", shortname = "",},
["Centrist Party (US)"] = {abbrev = "", color = "#3333FF", shortname = "",},
["Centrist Union of Moldova"] = {abbrev = "", color = "#062A78", shortname = "",},
["Centrists for Europe"] = {abbrev = "", color = "#A6DBEC", shortname = "",},
["Centrists of Galicia"] = {abbrev = "", color = "#0EB2D5", shortname = "",},
["Centrists of the Valencian Community"] = {abbrev = "", color = "#39B639", shortname = "",},
["Centrolew"] = {abbrev = "", color = "#BC235B", shortname = "",},
["Centrum"] = {abbrev = "", color = "#5F9F3F", shortname = "",},
["Cerna (political organization)"] = {abbrev = "", color = "#00A3E0", shortname = "",},
["Ceutan Democratic Union"] = {abbrev = "", color = "#AD2916", shortname = "",},
["Ceutan Party"] = {abbrev = "", color = "#2F4378", shortname = "",},
["Ceylon Communist Party (Maoist)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Ceylon Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Ceylon Workers' Congress"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Chadema"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Chadian Action for Unity and Socialism"] = {abbrev = "", color = "red", shortname = "",},
["Chadian Progressive Party"] = {abbrev = "", color = "#2D2A3B", shortname = "",},
["Chadian Social Action"] = {abbrev = "", color = "#F08080", shortname = "",},
["Chaldean Syriac Assyrian Popular Council"] = {abbrev = "", color = "saddlebrown", shortname = "",},
["Chama Cha Kijamii"] = {abbrev = "", color = "navy", shortname = "",},
["Chama Cha Mapinduzi"] = {abbrev = "CCM", color = "#228B22", shortname = "",},
["Chama Cha Mashinani"] = {abbrev = "", color = "#ffff00", shortname = "",},
["Chama cha Ukombozi wa Umma"] = {abbrev = "", color = "red", shortname = "",},
["Chama Cha Uzalendo"] = {abbrev = "", color = "green", shortname = "",},
["Change 2011"] = {abbrev = "", color = "#01414D", shortname = "",},
["Change It (Spain)"] = {abbrev = "", color = "#739C29", shortname = "",},
["Chart Pattana Party (2007)"] = {abbrev = "", color = "#F69520", shortname = "",},
["Chart Pattana Party"] = {abbrev = "", color = "#fe980d", shortname = "",},
["Charter Party"] = {abbrev = "", color = "#C0C0C0", shortname = "Charter",},
["Chartism"] = {abbrev = "", color = "#FF3333", shortname = "Chartist",},
["Chartthaipattana Party"] = {abbrev = "", color = "#DE2559", shortname = "",},
["Chase Community Independents Group"] = {abbrev = "", color = "#065E5E", shortname = "Chase Indies",},
["Chehabist"] = {abbrev = "", color = "#808080", shortname = "",},
["Cheung Sha Wan Community Establishment Power"] = {abbrev = "CSWCEP", color = "#F48326", shortname = "",},
["Cheung Sha Wan West Front"] = {abbrev = "CSWWF", color = "#53bfa7", shortname = "",},
["Chile Digno"] = {abbrev = "", color = "#EE113A", shortname = "",},
["Chile Podemos Más"] = {abbrev = "", color = "#ffd700", shortname = "",},
["Chile Vamos"] = {abbrev = "", color = "#006BB0", shortname = "",},
["Chilean Renovating Action"] = {abbrev = "", color = "black", shortname = "",},
["Chilean Social Democracy Party"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Chilean Socialist Party"] = {abbrev = "", color = "#ED1624", shortname = "",},
["ChileFirst"] = {abbrev = "", color = "#D1FF00", shortname = "",},
["Chin National League for Democracy"] = {abbrev = "CNLD", color = "#01AEF2", shortname = "",},
["Chin National Party"] = {abbrev = "CNP", color = "#006600", shortname = "",},
["Chin Progressive Party"] = {abbrev = "CPP", color = "#FFFFFF", shortname = "",},
["China Association for Promoting Democracy"] = {abbrev = "CAPD", color = "#FFF500", shortname = "",},
["China Democratic League"] = {abbrev = "CDL", color = "#cb7e1f", shortname = "",},
["China Democratic Socialist Party"] = {abbrev = "", color = "#008000", shortname = "Democratic Socialist",},
["China National Democratic Construction Association"] = {abbrev = "CNDCA", color = "Orangered", shortname = "",},
["China Youth Service & Recreation Centre"] = {abbrev = "CYSRC", color = "#4ED052", shortname = "",},
["China Zhi Gong Party"] = {abbrev = "CZGP", color = "Red", shortname = "",},
["Chinbak Yeondae"] = {abbrev = "", color = "#0a50a1", shortname = "",},
["Chinese Communist Party"] = {abbrev = "", color = "#DD0000", shortname = "Communist",},
["Chinese Peasants' and Workers' Democratic Party"] = {abbrev = "CPWDP", color = "#189df0", shortname = "",},
["Chinese People's Party"] = {abbrev = "", color = "green", shortname = "",},
["Chinese Production Party"] = {abbrev = "", color = "#21358F", shortname = "",},
["Chinese Social Democratic Party"] = {abbrev = "CSDP", color = "#FFD900", shortname = "",},
["Chinese Unification Promotion Party"] = {abbrev = "", color = "#253686", shortname = "",},
["Chinese Youth Party"] = {abbrev = "", color = "#FCE61E", shortname = "Youth",},
["Ching Fat Living Concern Group"] = {abbrev = "CFLCG", color = "#10791D", shortname = "",},
["Choi Hung Estate Social Service Association"] = {abbrev = "CHESSA", color = "#468CA8", shortname = "",},
["Choice of Russia (electoral bloc)"] = {abbrev = "VR", color = "#29166F", shortname = "",},
["Chondoist Chongu Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Christchurch 2021"] = {abbrev = "", color = "#AB0616", shortname = "",},
["Christen-Democratisch en Vlaams"] = {abbrev = "CD&V", color = "#FF7F2E", shortname = "",},
["Christian and Democratic Union"] = {abbrev = "KDU", color = "#FFCB03", shortname = "",},
["Christian Centre"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Christian Centrist Party"] = {abbrev = "", color = "#8032CC", shortname = "Christian Centrist",},
["Christian Citizens"] = {abbrev = "", color = "darkblue", shortname = "",},
["Christian Coalition (New Zealand)"] = {abbrev = "", color = "#878FB8", shortname = "Christian Coalition",},
["Christian Conservative Party (Chile)"] = {abbrev = "", color = "#000080", shortname = "",},
["Christian Conservative Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Christian Conservative Social Union"] = {abbrev = "", color = "#332F83", shortname = "",},
["Christian Democracy (Brazil)"] = {abbrev = "DC", color = "#0033FF", shortname = "",},
["Christian Democracy (Greece)"] = {abbrev = "ChD", color = "#013220", shortname = "",},
["Christian Democracy (Italy, 2002)"] = {abbrev = "", color = "#1560BD", shortname = "Christian Democracy",},
["Christian Democracy (Italy)"] = {abbrev = "", color = "#87CEFA", shortname = "Christian Democracy",},
["Christian Democracy (Poland)"] = {abbrev = "ChD", color = "#5C3FB5", shortname = "",},
["Christian Democracy Federation–Christian Democracy Team"] = {abbrev = "", color = "#E94E1B", shortname = "",},
["Christian Democracy for the Autonomies"] = {abbrev = "", color = "#ADD8E6", shortname = "Christian Democracy",},
["Christian Democrat Party (New Zealand)"] = {abbrev = "", color = "#800080", shortname = "Christian Democrats",},
["Christian Democrat Party (Peru)"] = {abbrev = "", color = "#00008B", shortname = "",},
["Christian Democratic Alliance (Costa Rica)"] = {abbrev = "ADC", color = "#483D8B", shortname = "",},
["Christian Democratic Alliance (South Africa)"] = {abbrev = "", color = "#300064", shortname = "Christian Democratic Alliance",},
["Christian Democratic Appeal (2021)"] = {abbrev = "", color = "#2CC84D", shortname = "",},
["Christian Democratic Appeal"] = {abbrev = "CDA", color = "#007C5E", shortname = "",},
["Christian Democratic Centre"] = {abbrev = "CCD", color = "#A6DBEC", shortname = "",},
["Christian Democratic Front"] = {abbrev = "", color = "orange", shortname = "",},
["Christian Democratic Movement"] = {abbrev = "KDH", color = "#173a70", shortname = "",},
["Christian Democratic National Peasants' Party"] = {abbrev = "PNŢ-CD", color = "#004A92", shortname = "",},
["Christian Democratic Party (Argentina)"] = {abbrev = "PDC", color = "#00008B", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Australia)"] = {abbrev = "", color = "#7F007F", shortname = "",},
["Christian Democratic Party (Belize)"] = {abbrev = "CDP", color = "#FF7F00", shortname = "",},
["Christian Democratic Party (Bolivia)"] = {abbrev = "PDC", color = "#016167", shortname = "",},
["Christian Democratic Party (Brazil)"] = {abbrev = "PDC", color = "#FF7700", shortname = "",},
["Christian Democratic Party (Chile)"] = {abbrev = "PDC", color = "#1E90FF", shortname = "",},
["Christian Democratic Party (Costa Rica)"] = {abbrev = "PDC", color = "#CC1B56", shortname = "",},
["Christian Democratic Party (Democratic Republic of the Congo)"] = {abbrev = "", color = "orange", shortname = "Christian Democratic Party",},
["Christian Democratic Party (East Timor)"] = {abbrev = "", color = "#3F5EBE", shortname = "Christian Democratic Party",},
["Christian Democratic Party (El Salvador)"] = {abbrev = "PDC", color = "#00A550", shortname = "",},
["Christian Democratic Party (Norway)"] = {abbrev = "", color = "#ffd773", shortname = "Christian Democratic",},
["Christian Democratic Party (Papua New Guinea)"] = {abbrev = "", color = "#FF0000", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Paraguay)"] = {abbrev = "", color = "#11a018", shortname = "Christian Democratic Party",},
["Christian Democratic Party (South Africa)"] = {abbrev = "", color = "#662D91", shortname = "Christian Democratic Party",},
["Christian Democratic Party (Spain)"] = {abbrev = "", color = "#068B1C", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Albania"] = {abbrev = "PKDSH", color = "#0080FF", shortname = "",},
["Christian Democratic Party of Cuba"] = {abbrev = "", color = "#3EB489", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Honduras"] = {abbrev = "CD", color = "#11992B", shortname = "",},
["Christian Democratic Party of Russia"] = {abbrev = "", color = "#9999FF", shortname = "Christian Democratic Party",},
["Christian Democratic Party of Serbia"] = {abbrev = "DHSS", color = "#964B00", shortname = "",},
["Christian Democratic Party of Ukraine"] = {abbrev = "CDPU", color = "#222629", shortname = "",},
["Christian Democratic People's Party (Hungary)"] = {abbrev = "KDNP", color = "#938862", shortname = "",},
["Christian Democratic People's Party of Switzerland"] = {abbrev = "", color = "#EF7D00", shortname = "Christian Democrats",},
["Christian Democratic Union (Dominican Republic)"] = {abbrev = "", color = "#ffd300", shortname = "",},
["Christian Democratic Union (East Germany)"] = {abbrev = "CDU", color = "#216CE5", shortname = "",},
["Christian Democratic Union (Ecuador)"] = {abbrev = "", color = "#008F4C", shortname = "",},
["Christian Democratic Union (Latvia)"] = {abbrev = "", color = "#F3AE12", shortname = "",},
["Christian Democratic Union (Lithuania)"] = {abbrev = "KDS", color = "#5DA782", shortname = "",},
["Christian Democratic Union (Netherlands)"] = {abbrev = "", color = "#E50066", shortname = "",},
["Christian Democratic Union (Ukraine)"] = {abbrev = "CDU", color = "#F39518", shortname = "",},
["Christian Democratic Union of Germany"] = {abbrev = "CDU", color = "#000000", shortname = "",},
["Christian Democratic Voice"] = {abbrev = "", color = "#24B87A", shortname = "",},
["Christian Democrats (Denmark)"] = {abbrev = "", color = "#E14526", shortname = "Christian Democrats",},
["Christian Democrats (Finland)"] = {abbrev = "", color = "#0135A5", shortname = "Christian Democrat",},
["Christian Democrats (Sweden)"] = {abbrev = "KD", color = "#005EA1", shortname = "Christian Democrat",},
["Christian Heritage Party of Canada"] = {abbrev = "", color = "#800020", shortname = "Christian Heritage",},
["Christian Heritage Party of New Zealand"] = {abbrev = "", color = "#878FB8", shortname = "Christian Heritage",},
["Christian Historical Party"] = {abbrev = "CHP", color = "#008080", shortname = "",},
["Christian Historical Union"] = {abbrev = "CHU", color = "#006F70", shortname = "",},
["Christian Independent Alliance"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Christian Labour Party"] = {abbrev = "PTC", color = "#009966", shortname = "",},
["Christian Liberty Unification Party"] = {abbrev = "", color = "#0095DA", shortname = "",},
["Christian Movement for a New Haiti"] = {abbrev = "", color = "#00923F", shortname = "",},
["Christian National Party (Chile)"] = {abbrev = "", color = "turquoise", shortname = "",},
["Christian National Union for the Reconstruction of Haiti"] = {abbrev = "UNCRH", color = "#FFFF00", shortname = "",},
["Christian National Union"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Christian Party (Samoa)"] = {abbrev = "SCP", color = "#FFFFDD", shortname = "",},
["Christian Party (UK)"] = {abbrev = "", color = "#9966CC", shortname = "Christian",},
["Christian Party of Austria"] = {abbrev = "", color = "#FAD41B", shortname = "Christian Party",},
["Christian People's Alliance"] = {abbrev = "", color = "#FF00FF", shortname = "",},
["Christian People's Party (Belgium)"] = {abbrev = "CVP", color = "#EEAA00", shortname = "",},
["Christian People's Party (Dominican Republic)"] = {abbrev = "", color = "#ff7900", shortname = "",},
["Christian People's Party (Faroe Islands)"] = {abbrev = "", color = "#FF7E00", shortname = "Christian People's",},
["Christian People's Party (Peru)"] = {abbrev = "", color = "#14953B", shortname = "",},
["Christian Peoples Alliance"] = {abbrev = "CPA", color = "#813887", shortname = "",},
["Christian Political Movement"] = {abbrev = "", color = "#E8AE0B", shortname = "",},
["Christian Positivist Party (Spain)"] = {abbrev = "", color = "#8B898B", shortname = "",},
["Christian Principles Party"] = {abbrev = "", color = "#8032CC", shortname = "Christian Principles",},
["Christian Social Democratic Party (Brazil)"] = {abbrev = "", color = "#7797E0", shortname = "",},
["Christian Social Front"] = {abbrev = "", color = "#2A58A6", shortname = "",},
["Christian Social Party (Austria)"] = {abbrev = "CS", color = "#000000", shortname = "",},
["Christian Social Party (Belgium, defunct)"] = {abbrev = "", color = "orange", shortname = "Christian Social",},
["Christian Social Party (Belgium)"] = {abbrev = "", color = "#FFCC99", shortname = "",},
["Christian Social Party (German-speaking Community)"] = {abbrev = "CSP", color = "orange", shortname = "",},
["Christian Social Party (Germany)"] = {abbrev = "", color = "#008080", shortname = "",},
["Christian Social Party (Liechtenstein)"] = {abbrev = "", color = "#80FFFF", shortname = "",},
["Christian Social Party (Netherlands)"] = {abbrev = "", color = "#D2691E", shortname = "",},
["Christian Social Party (Switzerland)"] = {abbrev = "", color = "#0F95A7", shortname = "Christian Social",},
["Christian Social Party of Obwalden"] = {abbrev = "", color = "#BF3235", shortname = "CSP Obwalden",},
["Christian Social People's Party"] = {abbrev = "CSV", color = "#F7911D", shortname = "",},
["Christian Social People's Service"] = {abbrev = "", color = "#808080", shortname = "",},
["Christian Social Union in Bavaria"] = {abbrev = "CSU", color = "#008AC5", shortname = "",},
["Christian Solidarity Party"] = {abbrev = "", color = "#FFFF99", shortname = "Christian Solidarity",},
["Christian Spanish Party"] = {abbrev = "", color = "#AAAAFF", shortname = "",},
["Christian Union – Reformed Political Party"] = {abbrev = "CU-SGP", color = "#00a7eb", shortname = "",},
["Christian Union (Lithuania)"] = {abbrev = "", color = "#445C64", shortname = "",},
["Christian Union (Netherlands)"] = {abbrev = "CU", color = "#00A7EB", shortname = "",},
["Christian Union (Slovakia)"] = {abbrev = "KÚ", color = "#04B2E8", shortname = "",},
["Christian Union Movement"] = {abbrev = "", color = "#6ca860", shortname = "",},
["Christian Union of National Unity"] = {abbrev = "ChZJN", color = "#2B3F3D", shortname = "",},
["Christian Unity Party"] = {abbrev = "", color = "#143d8d", shortname = "",},
["Christian Workers' Union of Finland"] = {abbrev = "SKrTL", color = "#FF5050", shortname = "",},
["Christian-Democratic Movement (Georgia)"] = {abbrev = "KDM", color = "#881532", shortname = "",},
["Christian-Democratic People's Party (Moldova)"] = {abbrev = "PPCD", color = "#8D8E56", shortname = "",},
["Christian-National Peasants' and Farmers' Party"] = {abbrev = "CNBL", color = "#DDDDDD", shortname = "",},
["Christian-Social People's Party (Liechtenstein)"] = {abbrev = "CSVP", color = "red", shortname = "",},
["Christians Against Abortion"] = {abbrev = "", color = "#000080", shortname = "",},
["Christians to the World"] = {abbrev = "", color = "#F2EA35", shortname = "",},
["Christlich Soziale Partei (Belgium)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Chubut Action Party"] = {abbrev = "", color = "#0A1172", shortname = "",},
["Chubut Somos Todos"] = {abbrev = "", color = "#008E6F", shortname = "",},
["Chunta Aragonesista"] = {abbrev = "CHA", color = "#008A21", shortname = "",},
["Chuquisaca We Are All"] = {abbrev = "", color = "#ED8603", shortname = "",},
["Church of the Militant Elvis Party"] = {abbrev = "", color = "#FF00FF", shortname = "Church of the Militant Elvis",},
["Chure Bhawar Rastriya Ekta Party Nepal"] = {abbrev = "", color = "honeydew", shortname = "Churebhawar Rastriya Ekta Party",},
["Cidadania"] = {abbrev = "", color = "#EC008C", shortname = "",},
["Ciervists"] = {abbrev = "", color = "#314F9D", shortname = "",},
["Circle of Liberal Reformers"] = {abbrev = "", color = "#FE492E", shortname = "",},
["Citizen Action of Ferrol"] = {abbrev = "", color = "#D9017A", shortname = "",},
["Citizen Alternative of Ponteareas"] = {abbrev = "", color = "#005747", shortname = "",},
["Citizen Alternative of Rubí"] = {abbrev = "", color = "#97C00E", shortname = "",},
["Citizen and Republican Movement"] = {abbrev = "MRC", color = "#DD391F", shortname = "",},
["Citizen Association Jesús Lara"] = {abbrev = "", color = "#F9CC67", shortname = "",},
["Citizen Convergence Movement"] = {abbrev = "", color = "#37960F", shortname = "",},
["Citizen Force"] = {abbrev = "", color = "#F5A23E", shortname = "",},
["Citizen Forum (Spain)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Citizen Forum of Cáceres"] = {abbrev = "", color = "#7EBA00", shortname = "",},
["Citizen Forum of Jerez"] = {abbrev = "", color = "#005AD6", shortname = "",},
["Citizen Hope (Spain)"] = {abbrev = "", color = "#F89430", shortname = "",},
["Citizen Initiative for Development"] = {abbrev = "", color = "#102547", shortname = "",},
["Citizen Initiative for Paracuellos"] = {abbrev = "", color = "#94C11F", shortname = "",},
["Citizen Initiative of Puertollano"] = {abbrev = "", color = "#FE6400", shortname = "",},
["Citizen Left"] = {abbrev = "", color = "#BB98C7", shortname = "",},
["Citizen Movement of Soria"] = {abbrev = "", color = "#EC9F42", shortname = "",},
["Citizen Open Platform of Lalín"] = {abbrev = "", color = "#999999", shortname = "",},
["Citizen Option for Macedonia"] = {abbrev = "GROM", color = "#00FFF7", shortname = "",},
["Citizen Option"] = {abbrev = "OC", color = "#FED403", shortname = "",},
["Citizen Platform for Sabadell"] = {abbrev = "", color = "#CD3037", shortname = "",},
["Citizen Power (political party)"] = {abbrev = "", color = "#412560", shortname = "Citizen Power",},
["Citizen Prosperity"] = {abbrev = "PC", color = "#FFDC2A", shortname = "",},
["Citizen Revolution"] = {abbrev = "", color = "#00B9EC", shortname = "",},
["Citizen Unity"] = {abbrev = "", color = "#CCE35F", shortname = "",},
["Citizen's Coalition for Justice Party (Mongolia)"] = {abbrev = "", color = "#f26022", shortname = "",},
["Citizen's Decision"] = {abbrev = "", color = "#82bb29", shortname = "",},
["Citizen's Unity"] = {abbrev = "", color = "#009CDE", shortname = "",},
["Citizens (Chilean political party)"] = {abbrev = "", color = "#db8f16", shortname = "Citizens",},
["Citizens (Spanish political party)"] = {abbrev = "Cs", color = "#EB6109", shortname = "",},
["Citizens & Ratepayers"] = {abbrev = "", color = "#00529F", shortname = "",},
["Citizens for Arona"] = {abbrev = "", color = "#77777B", shortname = "",},
["Citizens for Benidorm"] = {abbrev = "", color = "#855794", shortname = "",},
["Citizens for Blank Votes"] = {abbrev = "", color = "#969696", shortname = "",},
["Citizens for Cádiz"] = {abbrev = "", color = "#5E89AA", shortname = "",},
["Citizens for Canarian Change"] = {abbrev = "", color = "#1A3F98", shortname = "",},
["Citizens for Change"] = {abbrev = "", color = "#FF2F00", shortname = "",},
["Citizens for Ciempozuelos"] = {abbrev = "", color = "#2A277E", shortname = "",},
["Citizens for San Fernando"] = {abbrev = "", color = "#000B6F", shortname = "",},
["Citizens for their People"] = {abbrev = "", color = "#046305", shortname = "",},
["Citizens in Rage"] = {abbrev = "", color = "#0000AA", shortname = "",},
["Citizens of Alcalá de Guadaíra"] = {abbrev = "", color = "#23BEDC", shortname = "",},
["Citizens of Burgos"] = {abbrev = "", color = "#CA2D29", shortname = "",},
["Citizens of Democratic Centre–Independent Candidacy"] = {abbrev = "", color = "#F67A32", shortname = "",},
["Citizens of Galicia Democratic Action"] = {abbrev = "", color = "#63A6C6", shortname = "",},
["Citizens of Galicia"] = {abbrev = "", color = "#0BB70B", shortname = "",},
["Citizens of Logroño"] = {abbrev = "", color = "#E88005", shortname = "",},
["Citizens of Lorca"] = {abbrev = "", color = "#0D086E", shortname = "",},
["Citizens of Menorca"] = {abbrev = "", color = "#FA8100", shortname = "",},
["Citizens of Santa Cruz"] = {abbrev = "", color = "#0194E4", shortname = "",},
["Citizens Party (Hong Kong)"] = {abbrev = "", color = "#000000", shortname = "Citizens",},
["Citizens Party (US)"] = {abbrev = "", color = "#00FF90", shortname = "Citizens",},
["Citizens, Inhabitants and People of Marbella"] = {abbrev = "", color = "#FF9D21", shortname = "",},
["Citizens' Action for Málaga"] = {abbrev = "", color = "#A94699", shortname = "",},
["Citizens' Action Party (Costa Rica)"] = {abbrev = "PAC", color = "#FFD700", shortname = "",},
["Citizens' Action Party"] = {abbrev = "", color = "#FFE902", shortname = "",},
["Citizens' Alliance (Cyprus)"] = {abbrev = "SYPOL", color = "#9AB973", shortname = "",},
["Citizens' Assembly for Torrelavega"] = {abbrev = "", color = "#2F6623", shortname = "",},
["Citizens' Battle Against Corruption"] = {abbrev = "CIBAC", color = "#FDCD01", shortname = "",},
["Citizens' Convergence of the South-East"] = {abbrev = "", color = "#0824AD", shortname = "",},
["Citizens' Democratic Renewal Movement"] = {abbrev = "", color = "#6B2484", shortname = "",},
["Citizens' Forces"] = {abbrev = "", color = "#4C4B51", shortname = "",},
["Citizens' Forum Austria"] = {abbrev = "FRITZ", color = "#E43226", shortname = "",},
["Citizens' Initiative (Andorra)"] = {abbrev = "IC", color = "#390037", shortname = "",},
["Citizens' List"] = {abbrev = "", color = "darkgray", shortname = "",},
["Citizens' Movement (Iceland)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Citizens' Movement (Mexico)"] = {abbrev = "MC", color = "#FF8C00", shortname = "",},
["Citizens' Movement for Change"] = {abbrev = "", color = "#0897A7", shortname = "",},
["Citizens' Movement of Cartagena"] = {abbrev = "", color = "#87305B", shortname = "",},
["Citizens' Party (Finland)"] = {abbrev = "", color = "#2354A8", shortname = "Citizens' Party",},
["Citizens' Party (Iceland, 1923)"] = {abbrev = "", color = "#0026FF", shortname = "Citizens'",},
["Citizens' Party (Iceland, 1987)"] = {abbrev = "", color = "#000000", shortname = "Citizens'",},
["Citizens' Party for Revival"] = {abbrev = "", color = "yellow", shortname = "",},
["Citizens' Radio"] = {abbrev = "", color = "#ff7e22", shortname = "",},
["Citizens' Union–Independent Progressives of Canaries"] = {abbrev = "", color = "#181C21", shortname = "",},
["City Fusion Party"] = {abbrev = "", color = "#CF9FFF", shortname = "City Fusion",},
["City Vision (Auckland political ticket)"] = {abbrev = "", color = "#B3FFB3", shortname = "City Vision",},
["Ciutadella de Menorca People's Union"] = {abbrev = "", color = "#CA6601", shortname = "",},
["Cives"] = {abbrev = "", color = "#729E2A", shortname = "",},
["Civic 10"] = {abbrev = "", color = "#4BD9FD", shortname = "",},
["Civic Act-up"] = {abbrev = "", color = "#000000", shortname = "",},
["Civic Alliance of Serbia"] = {abbrev = "GSS", color = "orange", shortname = "",},
["Civic and Social Agreement"] = {abbrev = "", color = "#005599", shortname = "",},
["Civic Autonomy Power"] = {abbrev = "CAP", color = "#6CC6CF", shortname = "",},
["Civic Choice"] = {abbrev = "", color = "#1560BD", shortname = "",},
["Civic Coalition (Poland)"] = {abbrev = "", color = "#F68F2D", shortname = "",},
["Civic Coalition ARI"] = {abbrev = "CC-ARI", color = "#6fb53e", shortname = "",},
["Civic Coalition"] = {abbrev = "", color = "#008080", shortname = "",},
["Civic Community"] = {abbrev = "", color = "#F26524", shortname = "",},
["Civic Conservative Party (Slovakia)"] = {abbrev = "", color = "#A00000", shortname = "",},
["Civic Conservative Party"] = {abbrev = "", color = "#990000", shortname = "",},
["Civic Democratic Alliance"] = {abbrev = "ODA", color = "#0000FF", shortname = "",},
["Civic Democratic Forum"] = {abbrev = "GDF", color = "#272361", shortname = "",},
["Civic Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "GDS", color = "#ffdf00", shortname = "",},
["Civic Democratic Party (Czech Republic)"] = {abbrev = "ODS", color = "#034EA2", shortname = "",},
["Civic Democratic Union (Slovakia)"] = {abbrev = "", color = "#553D73", shortname = "",},
["Civic Force"] = {abbrev = "", color = "#3183CD", shortname = "",},
["Civic Forum (Central African Republic)"] = {abbrev = "", color = "#008080", shortname = "",},
["Civic Forum"] = {abbrev = "OF", color = "#386bA5", shortname = "",},
["Civic Front (Córdoba)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Civic Front for Santiago"] = {abbrev = "", color = "#FF0080", shortname = "",},
["Civic Initiative of Gora"] = {abbrev = "", color = "#82D1F7", shortname = "",},
["Civic Initiative"] = {abbrev = "", color = "#1B3E89", shortname = "",},
["Civic League"] = {abbrev = "", color = "#B8BFFE", shortname = "",},
["Civic Liberal Alliance"] = {abbrev = "", color = "#067CBF", shortname = "",},
["Civic List (Slovenia)"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Civic Movement"] = {abbrev = "OH", color = "#423F83", shortname = "",},
["Civic Party of Kazakhstan"] = {abbrev = "", color = "#2f2f2f", shortname = "",},
["Civic Party of Montenegro"] = {abbrev = "GPCG", color = "#2554C7", shortname = "",},
["Civic Party"] = {abbrev = "", color = "#7F3F98", shortname = "Civic",},
["Civic Passion–Proletariat Political Institute–Hong Kong Resurgence Order"] = {abbrev = "CP/PPI/HKRO", color = "#FBDD07", shortname = "",},
["Civic Passion"] = {abbrev = "", color = "#FBDD07", shortname = "",},
["Civic Platform (Russia)"] = {abbrev = "", color = "#420F77", shortname = "Civic Platform",},
["Civic Platform (Serbia)"] = {abbrev = "GP", color = "#002899", shortname = "",},
["Civic Platform"] = {abbrev = "PO", color = "#F68F2D", shortname = "",},
["Civic Renovation Party"] = {abbrev = "", color = "#183b69", shortname = "",},
["Civic Renewal Party"] = {abbrev = "PRC", color = "dodgerblue", shortname = "",},
["Civic Response"] = {abbrev = "PV", color = "#AE413A", shortname = "",},
["Civic Solidarity of Alicante"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Civic Solidarity Party"] = {abbrev = "", color = "#0F88C9", shortname = "Civic Solidarity",},
["Civic Union (Latvia)"] = {abbrev = "", color = "#9e1b34", shortname = "",},
["Civic Union (Russia)"] = {abbrev = "", color = "#F73239", shortname = "Civic Union",},
["Civic Union"] = {abbrev = "", color = "#AB3C20", shortname = "",},
["Civic United Front"] = {abbrev = "CUF", color = "#0293E2", shortname = "",},
["Civic Unity Party (Azerbaijan)"] = {abbrev = "", color = "#F29923", shortname = "",},
["Civil Alliance (Argentina)"] = {abbrev = "", color = "#F69A69", shortname = "Civil Alliance",},
["Civil Contract (Armenia)"] = {abbrev = "", color = "#5169B1", shortname = "Civil Contract",},
["Civil Democratic Alliance"] = {abbrev = "", color = "orange", shortname = "",},
["Civil Force"] = {abbrev = "", color = "#00a754", shortname = "",},
["Civil Liberties Party"] = {abbrev = "", color = "#0038A5", shortname = "",},
["Civil Party (Costa Rica)"] = {abbrev = "", color = "#C61318", shortname = "Civil",},
["Civil Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["Civil Position"] = {abbrev = "", color = "#FFDD00", shortname = "",},
["Civil Response"] = {abbrev = "", color = "#AE413A", shortname = "",},
["Civil Revolution"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Civil Rights Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Civil Rights Party (South Korea)"] = {abbrev = "", color = "#96f063", shortname = "Civil Rights Party",},
["Civil Rule Party"] = {abbrev = "", color = "#FFDD00", shortname = "",},
["Civil Society and Democracy"] = {abbrev = "", color = "#94969C", shortname = "",},
["Civil Watch"] = {abbrev = "", color = "#FF007F", shortname = "",},
["Civil Will-Green Party"] = {abbrev = "", color = "#027E40", shortname = "Civil Will-Green",},
["Civilista Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Civiqus"] = {abbrev = "", color = "#047235", shortname = "",},
["Civis (Montenegro)"] = {abbrev = "", color = "#D7D501", shortname = "",},
["Clann Éireann"] = {abbrev = "CÉ", color = "#228B22", shortname = "Clann Éireann",},
["Clann na Poblachta"] = {abbrev = "CnaP", color = "#DDFFDD", shortname = "Clann na Poblachta",},
["Clann na Talmhan"] = {abbrev = "CnaT", color = "#BDB76B", shortname = "Clann na Talmhan",},
["CLARO (political party)"] = {abbrev = "", color = "#314A82", shortname = "",},
["Class Action Reform Movement"] = {abbrev = "", color = "#000000", shortname = "CARM",},
["Class War"] = {abbrev = "", color = "Black", shortname = "",},
["Clause 28 Children's Protection Christian Democrats"] = {abbrev = "", color = "#bc8f8f", shortname = "Clause 28",},
["Clean Chile, Vote Happy"] = {abbrev = "", color = "green", shortname = "",},
["Clichy Club"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Climat Québec"] = {abbrev = "", color = "#0E9D0D", shortname = "",},
["Club of Committed Non-Party Members"] = {abbrev = "KAN", color = "#10547d", shortname = "",},
["Clydesdale and South Scotland Independent"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Co-operative Party"] = {abbrev = "", color = "#3F1D70", shortname = "",},
["Coalició Compromís"] = {abbrev = "Compromís", color = "#EC8953", shortname = "",},
["Coalition (Australia)"] = {abbrev = "", color = "#0033CC", shortname = "Coalition",},
["Coalition (Chile)"] = {abbrev = "", color = "blue", shortname = "",},
["Coalition Conservative"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Coalition for a New Socialist Party"] = {abbrev = "", color = "#D82E1E", shortname = "",},
["Coalition for a Solidary Europe"] = {abbrev = "", color = "#00309A", shortname = "",},
["Coalition for Cáceres"] = {abbrev = "", color = "#BE1C2B", shortname = "",},
["Coalition for Cayman"] = {abbrev = "C4C", color = "#0c1c47", shortname = "",},
["Coalition for Change"] = {abbrev = "", color = "Steelblue", shortname = "",},
["Coalition for Democratic Change"] = {abbrev = "", color = "#183883", shortname = "",},
["Coalition for El Bierzo"] = {abbrev = "", color = "#68A0D6", shortname = "",},
["Coalition for Europe"] = {abbrev = "", color = "#2D0680", shortname = "",},
["Coalition for Gran Canaria"] = {abbrev = "", color = "#0F47AF", shortname = "",},
["Coalition for L'Hospitalet"] = {abbrev = "", color = "#C32C25", shortname = "",},
["Coalition for Melilla"] = {abbrev = "CpM", color = "#298642", shortname = "",},
["Coalition for Reform Party"] = {abbrev = "", color = "#3AEB2A", shortname = "",},
["Coalition for Reforms and Democracy"] = {abbrev = "CORD", color = "#F6A438", shortname = "",},
["Coalition for Unity and Democracy"] = {abbrev = "", color = "blue", shortname = "",},
["Coalition Labour"] = {abbrev = "", color = "#e0afaf", shortname = "",},
["Coalition Movement"] = {abbrev = "", color = "#00CED1", shortname = "",},
["Coalition National Democratic and Labour Party"] = {abbrev = "", color = "#FFDEAD", shortname = "Coalition National Democratic",},
["Coalition of Democrats (Zimbabwe)"] = {abbrev = "CODE", color = "#ADD8E6", shortname = "",},
["Coalition of Ethiopian Federalist Forces"] = {abbrev = "", color = "#4398B4", shortname = "",},
["Coalition of Independents"] = {abbrev = "COI", color = "#5ce1e6", shortname = "",},
["Coalition of Islamic Parties"] = {abbrev = "CIP", color = "", shortname = "",},
["Coalition of People's Accord"] = {abbrev = "KNS", color = "#ffe01c", shortname = "",},
["Coalition of Progressive Organizations"] = {abbrev = "", color = "#394184", shortname = "",},
["Coalition of the Left and the Progress"] = {abbrev = "", color = "#FFD000", shortname = "Coalition of the Left (SYN)",},
["Coalition of the Left of Movements and Ecology"] = {abbrev = "", color = "#FFD000", shortname = "Coalition of the Left (SYN)",},
["Coalition of the Pleasant Scent of Servitude"] = {abbrev = "CPSS", color = "blue", shortname = "",},
["Coalition Party (Norway)"] = {abbrev = "", color = "#99EDBD", shortname = "Coalition",},
["Coastal Party"] = {abbrev = "", color = "#00ad8e", shortname = "Coastal",},
["Cochinchinese Democratic Party"] = {abbrev = "", color = "#E3FF2A", shortname = "",},
["Code Orange (political party)"] = {abbrev = "", color = "#EF7601", shortname = "Code Orange",},
["Coexistence (political party)"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Colère et espoir"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Collectif Des Inkoruptibles"] = {abbrev = "", color = "#FFBF60", shortname = "",},
["Collective Action Party – Civic Congress"] = {abbrev = "", color = "#EF7F1A", shortname = "",},
["Colombia First"] = {abbrev = "", color = "#800080", shortname = "",},
["Colombia Has a Future"] = {abbrev ="CFT", color = "#32CD32", shortname ="",},
["Colombian Communist Party"] = {abbrev = "", color = "#DA251D", shortname = "",},
["Colombian Community and Communal Political Movement"] = {abbrev = "MCCC", color = "#F5EC49", shortname = "",},
["Colombian Conservative Party"] = {abbrev = "", color = "#1935D0", shortname = "Conservative",},
["Colombian Liberal Party"] = {abbrev = "", color = "#FF3333", shortname = "Liberal",},
["Colorado Party (Paraguay)"] = {abbrev = "", color = "#EE1D23", shortname = "Colorado",},
["Colorado Party (Uruguay)"] = {abbrev = "", color = "#BB0000", shortname = "Colorado Party",},
["Colored Republican Party"] = {abbrev = "", color = "#FF5600", shortname = "Colored Republican",},
["Combatant Clergy Association"] = {abbrev = "CCA", color = "#009900", shortname = "",},
["Come Venezuela"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Comité d'Action Musulman"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Comités Jeanne"] = {abbrev = "", color = "#202F55", shortname = "",},
["Commitment for Caspe"] = {abbrev = "", color = "#ED750E", shortname = "",},
["Commitment to Cantabria"] = {abbrev = "", color = "#28734C", shortname = "",},
["Commitment to Europe"] = {abbrev = "", color = "#E7995C", shortname = "",},
["Commitment to Galicia"] = {abbrev = "", color = "#087D42", shortname = "",},
["Commitment to Gran Canaria"] = {abbrev = "", color = "#8AAD53", shortname = "",},
["Commitment to Torrevieja"] = {abbrev = "", color = "#266E87", shortname = "",},
["Commitment with Aragon"] = {abbrev = "", color = "#ECD807", shortname = "",},
["Commitment, Renewal and Order"] = {abbrev = "CREO", color = "#FDAF17", shortname = "",},
["Committee for a Worker's International (Ireland)"] = {abbrev = "", color = "#DC241F", shortname = "CWI (Ireland)",},
["Committee for Another Policy"] = {abbrev = "", color = "red", shortname = "",},
["Committee for the Defence of the Republic"] = {abbrev = "CDR", color = "#264E4E", shortname = "",},
["Committee of Freedom"] = {abbrev = "CdL", color = "#C71585", shortname = "",},
["Committee of National Unity"] = {abbrev = "", color = "#B93434", shortname = "",},
["Committees for the Defense of the Revolution"] = {abbrev = "CDR", color = "", shortname = "",},
["Common Alternative Revolutionary Force"] = {abbrev = "FARC", color = "#AF1120", shortname = "",},
["Common Choice"] = {abbrev = "", color = "#ED1B30", shortname = "",},
["Common Course"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Common Force"] = {abbrev = "", color = "#ED5C3E", shortname = "",},
["Common Ground Alliance"] = {abbrev = "", color = "#005B54", shortname = "Common Ground",},
["Common Sense Party (UK)"] = {abbrev = "", color = "#FFFFFF", shortname = "Common Sense",},
["Common Wealth Party"] = {abbrev = "", color = "#ff7f50", shortname = "Common Wealth",},
["Commoner Party of Thailand"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Commoners' Land"] = {abbrev = "TC–PNC", color = "#7A76B4", shortname = "",},
["Commoners' Party (Thailand)"] = {abbrev = "", color = "#000000", shortname = "",},
["Commons (Chilean political party)"] = {abbrev = "", color = "#461D3D", shortname = "",},
["Commons (Colombian political party)"] = {abbrev = "", color = "#AF1120", shortname = "Commons",},
["Commons (political party)"] = {abbrev = "", color = "#412560", shortname = "",},
["Commonwealth Labour Party"] = {abbrev = "ComLab", color = "#b22222", shortname = "Commonwealth Labour",},
["Commonwealth Land Party (US)"] = {abbrev = "", color = "#4C915F", shortname = "Commonwealth Land",},
["Commonwealth Liberal Party"] = {abbrev = "", color = "#8CB4D2", shortname = "Commonwealth Liberal",},
["Commonwealth Party (Gibraltar)"] = {abbrev = "", color = "#CE0F25", shortname = "Commonwealth",},
["Communal Democracy Party"] = {abbrev = "TDP", color = "#0D1AAF", shortname = "",},
["Communal Liberation Party"] = {abbrev = "", color = "red", shortname = "",},
["Communal Liberation Party New Forces"] = {abbrev = "TKP-YG", color = "#E3000D", shortname = "",},
["Communist Alternative Party"] = {abbrev = "", color = "maroon", shortname = "",},
["Communist Archio-Marxist Party of Greece"] = {abbrev = "KAKE", color = "red", shortname = "",},
["Communist Collective of Catalonia"] = {abbrev = "", color = "#B82E35", shortname = "",},
["Communist League (New Zealand)"] = {abbrev = "", color = "#dd0048", shortname = "Communist League",},
["Communist League (UK, 1988)"] = {abbrev = "", color = "#C71585", shortname = "Communist League",},
["Communist League of Great Britain"] = {abbrev = "", color = "red", shortname = "Communist League",},
["Communist League of West Germany"] = {abbrev = "KBW", color = "red", shortname = "",},
["Communist Marxist Party (John)"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Communist Marxist Party"] = {abbrev = "CMP", color = "#FF0000", shortname = "",},
["Communist Movement (Spain)"] = {abbrev = "", color = "#BF4249", shortname = "",},
["Communist Organization of Spain (Red Flag)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party (Argentina)"] = {abbrev = "PC", color = "#FF0000", shortname = "Communist Party",},
["Communist Party (bolsheviks) of Lithuania and Belorussia"] = {abbrev = "LBSSR", color = "#CC0000", shortname = "",},
["Communist Party (Bolsheviks) of Ukraine"] = {abbrev = "", color = "#DD0000", shortname = "Communist Party",},
["Communist Party (Bosnia and Herzegovina)"] = {abbrev = "", color = "red", shortname = "Communist Party",},
["Communist Party (Denmark)"] = {abbrev = "", color = "#FF0000", shortname = "Communist Party",},
["Communist Party (Italy)"] = {abbrev = "", color = "#F00000", shortname = "Communist Party",},
["Communist Party (Serbia)"] = {abbrev = "", color = "#C6363C", shortname = "Communist Party",},
["Communist Party (Sweden)"] = {abbrev = "", color = "#D91A12", shortname = "Communist",},
["Communist Party (Turkey, 2014)"] = {abbrev = "", color = "#c00", shortname = "Communist",},
["Communist Party (UK)"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party (US)"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Party in Denmark"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Albania (1991)"] = {abbrev = "", color = "#E61919", shortname = "",},
["Communist Party of Aragon (1980)"] = {abbrev = "", color = "#C5000F", shortname = "",},
["Communist Party of Argentina (Extraordinary Congress)"] = {abbrev = "", color = "#E0040B", shortname = "",},
["Communist Party of Argentina"] = {abbrev = "", color = "#E22928", shortname = "",},
["Communist Party of Artsakh"] = {abbrev = "", color = "#FF1111", shortname = "",},
["Communist Party of Australia"] = {abbrev = "", color = "#CD2027", shortname = "",},
["Communist Party of Austria"] = {abbrev = "KPÖ", color = "#AA0000", shortname = "",},
["Communist Party of Bangladesh (Marxist–Leninist) (Barua)"] = {abbrev = "CPB (M-L)", color = "#FB6F76", shortname = "",},
["Communist Party of Bangladesh"] = {abbrev = "CPB", color = "#E91621", shortname = "",},
["Communist Party of Belarus"] = {abbrev = "CPB", color = "#D30400", shortname = "",},
["Communist Party of Benin"] = {abbrev = "", color = "#B22222", shortname = "",},
["Communist Party of Bohemia and Moravia"] = {abbrev = "KSČM", color = "#CC0000", shortname = "",},
["Communist Party of Bolivia (Marxist–Leninist)"] = {abbrev = "", color = "#C9021A", shortname = "",},
["Communist Party of Bolivia"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Brazil"] = {abbrev = "PCdoB", color = "#820000", shortname = "",},
["Communist Party of Britain (Marxist–Leninist)"] = {abbrev = "", color = "#EE1F23", shortname = "Communist (ML)",},
["Communist Party of Britain"] = {abbrev = "", color = "#F93822", shortname = "Communist",},
["Communist Party of Bulgaria"] = {abbrev = "CPB", color = "#B20406", shortname = "",},
["Communist Party of Byelorussia"] = {abbrev = "CPB", color = "#DC143C", shortname = "",},
["Communist Party of Canada (Marxist–Leninist)"] = {abbrev = "", color = "#F5191A", shortname = "Marxist–Leninist",},
["Communist Party of Canada"] = {abbrev = "", color = "#FF6347", shortname = "Communist",},
["Communist Party of Chile"] = {abbrev = "", color = "#B22222", shortname = "Communist",},
["Communist Party of Cuba"] = {abbrev = "PCC", color = "#CE2029", shortname = "",},
["Communist Party of Czechoslovakia"] = {abbrev = "KSČ", color = "#DC241F", shortname = "",},
["Communist Party of Denmark"] = {abbrev = "", color = "#A52A2A", shortname = "Communists",},
["Communist Party of Denmark/Marxist–Leninists"] = {abbrev = "DKP/ML", color = "red", shortname = "",},
["Communist Party of Ecuador"] = {abbrev = "", color = "#da251d", shortname = "",},
["Communist Party of England (Marxist-Leninist)"] = {abbrev = "", color = "#660000", shortname = "Marxist-Leninist (England)",},
["Communist Party of Finland (1994)"] = {abbrev = "", color = "#8B0000", shortname = "Communist Party of Finland",},
["Communist Party of Finland"] = {abbrev = "", color = "#DA2301", shortname = "Communist Party",},
["Communist Party of Georgia (Soviet Union)"] = {abbrev = "SKP", color = "#CD0000", shortname = "",},
["Communist Party of Georgia"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Germany (1990)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Germany"] = {abbrev = "KPD", color = "#8B0000", shortname = "",},
["Communist Party of Germany/Marxists–Leninists"] = {abbrev = "KPD/ML", color = "red", shortname = "",},
["Communist Party of Great Britain (Marxist–Leninist)"] = {abbrev = "", color = "#FF0000", shortname = "Communist GB (ML)",},
["Communist Party of Great Britain (Provisional Central Committee)"] = {abbrev = "", color = "red", shortname = "Communist (PCC)",},
["Communist Party of Great Britain"] = {abbrev = "", color = "red", shortname = "Communist",},
["Communist Party of Greece (Interior)"] = {abbrev = "", color = "red", shortname = "KKE Interior",},
["Communist Party of Greece (Marxist–Leninist)"] = {abbrev = "KKE-M-L", color = "#960018", shortname = "",},
["Communist Party of Greece"] = {abbrev = "KKE", color = "#e30301", shortname = "",},
["Communist Party of Iceland"] = {abbrev = "", color = "#FF0000", shortname = "Communist",},
["Communist Party of Iceland (Marxist–Leninist)"] = {abbrev = "", color = "red", shortname = "Communist (M-L)",},
["Communist Party of India (Marxist-Leninist) (Kanu Sanyal)"] = {abbrev = "CPI(M-L)", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist-Leninist)"] = {abbrev = "CPI(ML)", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist–Leninist) Liberation"] = {abbrev = "CPI(ML)L", color = "#FF0000", shortname = "",},
["Communist Party of India (Marxist–Leninist) Red Star"] = {abbrev = "CPI(ML) Red Star", color = "red", shortname = "",},
["Communist Party of India (Marxist)"] = {abbrev = "CPI(M)", color = "#FF1D15", shortname = "",},
["Communist Party of India"] = {abbrev = "CPI", color = "#FF0000", shortname = "",},
["Communist Party of Indonesia"] = {abbrev = "", color = "#ED3237", shortname = "",},
["Communist Party of Ireland (Marxist–Leninist)"] = {abbrev = "", color = "#660000", shortname = "Marxist–Leninist (Ireland)",},
["Communist Party of Ireland"] = {abbrev = "", color = "#E3170D", shortname = "Communist Party",},
["Communist Party of Italy"] = {abbrev = "", color = "#C72F35", shortname = "",},
["Communist Party of Kampuchea"] = {abbrev = "", color = "#E61919", shortname = "",},
["Communist Party of Kazakhstan"] = {abbrev = "CPK", color = "#D40000", shortname = "",},
["Communist Party of Kenya"] = {abbrev = "", color = "#D40000", shortname = "",},
["Communist Party of Korea"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communist Party of Kurdistan – Iraq"] = {abbrev = "", color = "#dd0000", shortname = "",},
["Communist Party of Latvia"] = {abbrev = "", color = "#D40000", shortname = "",},
["Communist Party of Lithuania"] = {abbrev = "LKP", color = "#D1020A", shortname = "",},
["Communist Party of Luxembourg"] = {abbrev = "KPL", color = "#CC0000", shortname = "",},
["Communist Party of Malta"] = {abbrev = "", color = "Red", shortname = "",},
["Communist Party of Moldavia"] = {abbrev = "PCM", color = "#DF0000", shortname = "",},
["Communist Party of National Liberation"] = {abbrev = "", color = "#D00620", shortname = "",},
["Communist Party of Nepal (Maoist) (1994)"] = {abbrev = "", color = "#8B0000", shortname = "CPN (Maoist)",},
["Communist Party of Nepal (Maoist Centre)"] = {abbrev = "CPN (MC)", color = "#8B0000", shortname = "Maoist Centre",},
["Communist Party of Nepal (Marxist–Leninist) (2002)"] = {abbrev = "", color = "indianred", shortname = "",},
["Communist Party of Nepal (Marxist) (1991–2005)"] = {abbrev = "", color = "crimson", shortname = "CPN (Marxist)",},
["Communist Party of Nepal (Unified Marxist–Leninist)"] = {abbrev = "UML", color = "#FF2222", shortname = "CPN (UML)",},
["Communist Party of Nepal (Unified Socialist)"] = {abbrev = "CPN (US)", color = "#dd232c", shortname = "Unified Socialist",},
["Communist Party of Nepal (Unified)"] = {abbrev = "", color = "#ff007f", shortname = "CPN (Unified)",},
["Communist Party of Nepal (United Marxist)"] = {abbrev = "", color = "crimson", shortname = "CPN (United Marxist)",},
["Communist Party of Nepal (United) (1991–2005)"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Nepal (United)"] = {abbrev = "", color = "palevioletred", shortname = "CPN (United)",},
["Communist Party of Nepal (Unity Centre)"] = {abbrev = "", color = "Red", shortname = "",},
["Communist party of Nepal (Unity National Campaign)"] = {abbrev = "CPN (UNC)", color = "#FF0000", shortname = "Unity Campaign",},
["Communist Party of New Zealand"] = {abbrev = "", color = "#800000", shortname = "Communist",},
["Communist Party of Nicaragua"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Northern Ireland"] = {abbrev = "", color = "red", shortname = "Communist (NI)",},
["Communist Party of Norway"] = {abbrev = "", color = "#990000", shortname = "Communist",},
["Communist Party of Poland"] = {abbrev = "KPP", color = "#E20001", shortname = "",},
["Communist Party of Réunion"] = {abbrev = "PCR", color = "#DD0000", shortname = "",},
["Communist Party of Revolutionary Marxists"] = {abbrev = "CPRM", color = "#FF0000", shortname = "",},
["Communist Party of Scotland"] = {abbrev = "", color = "red", shortname = "Communist (Scotland)",},
["Communist Party of Slovakia – 91"] = {abbrev = "", color = "red", shortname = "",},
["Communist Party of Slovakia (1939)"] = {abbrev = "KSS", color = "#8B0000", shortname = "",},
["Communist Party of Slovakia"] = {abbrev = "KSS", color = "#e70101", shortname = "",},
["Communist Party of South Ossetia"] = {abbrev = "HIKP", color = "#CA0808", shortname = "",},
["Communist Party of Spain (Marxist–Leninist) (historical)"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Communist Party of Spain"] = {abbrev = "PCE", color = "#971324", shortname = "",},
["Communist Party of Sri Lanka"] = {abbrev = "", color = "#FF0000", shortname = "Communist Party",},
["Communist Party of Sweden (1921-1967)"] = {abbrev = "", color = "#b00000", shortname = "Communist",},
["Communist Party of Sweden (1924)"] = {abbrev = "", color = "#800000", shortname = "Höglund Communist",},
["Communist Party of Sweden (1995)"] = {abbrev = "", color = "#990000", shortname = "Communist - APK",},
["Communist Party of Sweden (Kilbommare)"] = {abbrev = "", color = "#b00000", shortname = "Kilbommare Communist",},
["Communist Party of Tajikistan"] = {abbrev = "", color = "#D91D1D", shortname = "Communist",},
["Communist Party of the Basque Homelands"] = {abbrev = "PCTV/EHAK", color = "#800118", shortname = "",},
["Communist Party of the Donetsk People's Republic"] = {abbrev = "", color = "#CF0A13", shortname = "",},
["Communist Party of the Netherlands"] = {abbrev = "CPN", color = "#BB5555", shortname = "",},
["Communist Party of the Peoples of Spain"] = {abbrev = "", color = "#D1141A", shortname = "",},
["Communist Party of the Russian Federation"] = {abbrev = "CPRF", color = "#CC1111", shortname = "",},
["Communist Party of the Russian Soviet Federative Socialist Republic"] = {abbrev = "", color = "#CD0000", shortname = "",},
["Communist Party of the Soviet Union"] = {abbrev = "CPSU", color = "#D40000", shortname = "",},
["Communist Party of the Workers of Spain"] = {abbrev = "", color = "#CD0711", shortname = "",},
["Communist Party of Turkey (modern)"] = {abbrev = "TKP", color = "#A63931", shortname = "",},
["Communist Party of Ukraine (Soviet Union)"] = {abbrev = "CPU", color = "#CD0000", shortname = "",},
["Communist Party of Ukraine"] = {abbrev = "KPU", color = "#B70100", shortname = "",},
["Communist Party of Uruguay"] = {abbrev = "", color = "#123E89", shortname = "",},
["Communist Party of Uzbekistan (1994)"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Communist Party of Venezuela"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Communist Party of Vietnam"] = {abbrev = "", color = "#EA0504", shortname = "Communist Party",},
["Communist Party USA"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Party"] = {abbrev = "", color = "#D50000", shortname = "Communist",},
["Communist Refoundation Party"] = {abbrev = "", color = "#A1292F", shortname = "Communist Refoundation",},
["Communist Unification of Spain"] = {abbrev = "", color = "#EF2808", shortname = "",},
["Communist Vanguard of the Revolutionary Workers' Party"] = {abbrev = "", color = "#aa0000", shortname = "",},
["Communist Workers League (Spain)"] = {abbrev = "", color = "#B1343A", shortname = "",},
["Communist Workers' Party – For Peace and Socialism"] = {abbrev = "", color = "#FF4D00", shortname = "",},
["Communist Workers Party (Denmark)"] = {abbrev = "KAP", color = "#de0000", shortname = "",},
["Communist"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Communistes"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Communists and Allies"] = {abbrev = "COM", color = "#990000", shortname = "",},
["Communists of Catalonia"] = {abbrev = "", color = "#CC082D", shortname = "",},
["Communists of Russia"] = {abbrev = "", color = "#D71A21", shortname = "",},
["Communities & Residents"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Communities United Party"] = {abbrev = "", color = "Orange", shortname = "Communities United",},
["Community Action Party"] = {abbrev = "", color = "#33FF33", shortname = "Community Action",},
["Community Alliance"] = {abbrev = "", color = "#1E4399", shortname = "",},
["Community Campaign (Hart)"] = {abbrev = "", color = "#8d19ff", shortname = "Community Campaign Hart",},
["Community Group"] = {abbrev = "", color = "#808080", shortname = "",},
["Community Integration Party"] = {abbrev = "", color = "#0869AD", shortname = "",},
["Community March"] = {abbrev = "", color = "#BDDC06", shortname = "",},
["Community of the Lipovan Russians in Romania"] = {abbrev = "ORL", color = "#DA7C3E", shortname = "",},
["Community Performance First"] = {abbrev = "", color = "yellowgreen", shortname = "",},
["Community Representatives"] = {abbrev = "", color = "#FF719D", shortname = "Community Representative",},
["Community Sha Tin"] = {abbrev = "", color = "#00B2BD", shortname = "",},
["Comorian Democratic Union"] = {abbrev = "UDC", color = "#008000", shortname = "",},
["Comorian Union for Progress"] = {abbrev = "UCP", color = "#77BC11", shortname = "",},
["Compatriots of South Africa"] = {abbrev = "", color = "#98E03A", shortname = "",},
["Compostela Aberta"] = {abbrev = "", color = "#69C8EC", shortname = "",},
["Compromís amb Formentera"] = {abbrev = "", color = "#0AC5B3", shortname = "",},
["Compromís pel País Valencià"] = {abbrev = "Compromís PV", color = "#F2635B", shortname = "",},
["Compromisu por Asturies"] = {abbrev = "", color = "#7CB900", shortname = "",},
["Comú de Lleida"] = {abbrev = "", color = "#8B001F", shortname = "",},
["Concentration of People's Forces"] = {abbrev = "CFP", color = "#000000", shortname = "",},
["Conceptual Party Unity"] = {abbrev = "", color = "#11007D", shortname = "",},
["Concern for the Nation Functional Party"] = {abbrev = "", color = "#014133", shortname = "",},
["Concern Group for Tseung Kwan O People's Livelihood"] = {abbrev = "CGPLTKO", color = "#E3572B", shortname = "",},
["Concerned Citizens Party"] = {abbrev = "", color = "#A356DE", shortname = "Concerned Citizens",},
["Concerned Citizens' Movement"] = {abbrev = "CCM", color = "#4F81BD", shortname = "",},
["Concert of Parties for Democracy & Juntos Podemos Más"] = {abbrev = "", color = "Orange", shortname = "",},
["Concertación"] = {abbrev = "", color = "#FFA500", shortname = "Concertación",},
["Conceyu Abiertu"] = {abbrev = "", color = "#214AFF", shortname = "",},
["Conceyu"] = {abbrev = "", color = "#D9DB4C", shortname = "",},
["Concordance (Bolivia)"] = {abbrev = "", color = "#4E81BD", shortname = "",},
["Concordancia (Argentina)"] = {abbrev = "", color = "#bfd0da", shortname = "Concordancia",},
["Concordia Association of Manchukuo"] = {abbrev = "", color = "#FFC500", shortname = "",},
["Condado–Paradanta Union"] = {abbrev = "", color = "#008675", shortname = "",},
["Confederation Liberty and Independence"] = {abbrev = "", color = "#122746", shortname = "",},
["Confederation of Democracy"] = {abbrev = "", color = "#104F7C", shortname = "",},
["Confederation of Feminist Organizations"] = {abbrev = "", color = "#530F66", shortname = "",},
["Confederation of Independent Poland"] = {abbrev = "KPN", color = "#333300", shortname = "",},
["Confederation of the Greens (1987)"] = {abbrev = "", color = "#36A119", shortname = "",},
["Confederation of the Greens"] = {abbrev = "", color = "#74B32A", shortname = "",},
["Confederation of the Polish Crown"] = {abbrev = "", color = "#D4AA00", shortname = "",},
["Conference Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Congolese Movement for Democracy and Integral Development"] = {abbrev = "", color = "#374CCB", shortname = "",},
["Congolese Party of Labour"] = {abbrev = "PCT", color = "#DC241F", shortname = "",},
["Congress (A)"] = {abbrev = "INC (A)", color = "#30D5C8", shortname = "",},
["Congress (J)"] = {abbrev = "INC(J)", color = "black", shortname = "",},
["Congress (Secular)"] = {abbrev = "Cong(S)", color = "#FF7F7F", shortname = "",},
["Congress for Democracy and Progress"] = {abbrev = "CDP", color = "#E5321C", shortname = "",},
["Congress for Democratic Change"] = {abbrev = "CDC", color = "#183883", shortname = "",},
["Congress for Progressive Change"] = {abbrev = "CPC", color = "lightskyblue", shortname = "",},
["Congress for the Republic (Niger)"] = {abbrev = "", color = "#11580C", shortname = "",},
["Congress for the Republic"] = {abbrev = "CPR", color = "#77B32A", shortname = "",},
["Congress Nationalist Party"] = {abbrev = "CNP", color = "#0099CC", shortname = "",},
["Congress of Democrats"] = {abbrev = "COD", color = "#0040FC", shortname = "",},
["Congress of Russian Communities"] = {abbrev = "KRO", color = "#FCCA19", shortname = "",},
["Congress of the New Right"] = {abbrev = "KNP", color = "#1B3458", shortname = "",},
["Congress of the People (South African political party)"] = {abbrev = "COPE", color = "#FFCA08", shortname = "",},
["Congress of the People (Trinidad and Tobago)"] = {abbrev = "COP", color = "#000000", shortname = "",},
["Congress of Ukrainian Nationalists"] = {abbrev = "KUN", color = "#B30027", shortname = "",},
["Congress Party Alliance"] = {abbrev = "", color = "#FCC800", shortname = "",},
["Congress Party for the Independence of Madagascar"] = {abbrev = "AKFM", color = "#B20000", shortname = "",},
["Connect Andalusia"] = {abbrev = "", color = "#FECB00", shortname = "",},
["Conscience of Fatherland"] = {abbrev = "", color = "#B8860B", shortname = "",},
["Conservatism sidebar"] = {abbrev = "", color = "#0000FF", shortname = "Conservative",},
["Conservative (New Zealand)"] = {abbrev = "", color = "#9999CC", shortname = "Conservative",},
["Conservative (South Korea)"] = {abbrev = "", color = "#E61E2B", shortname = "",},
["Conservative Alliance of Zimbabwe"] = {abbrev = "CAZ", color = "#800080", shortname = "",},
["Conservative and Liberal Unionist"] = {abbrev = "", color = "#0281aa", shortname = "",},
["Conservative and Unionist Party (UK)"] = {abbrev = "Con", color = "#0087DC", shortname = "Conservative",},
["Conservative Ascension Party"] = {abbrev = "", color = "#0053CF", shortname = "",},
["Conservative bloc (Hong Kong)"] = {abbrev = "", color = "#0D3B68", shortname = "Conservative",},
["Conservative Christian Party – BPF"] = {abbrev = "", color = "#B31B20", shortname = "",},
["Conservative-Democratic Party"] = {abbrev = "PCD", color = "#66CCFF", shortname = "",},
["Conservative Democratic Party (Greece)"] = {abbrev = "KSD", color = "#9F99E5", shortname = "",},
["Conservative Democratic Party of Switzerland"] = {abbrev = "BDP", color = "#FBD918", shortname = "",},
["Conservative Democrats of Slovakia"] = {abbrev = "", color = "#6F0470", shortname = "",},
["Conservative Group"] = {abbrev = "", color = "#006EB7", shortname = "",},
["Conservative Ministerialist"] = {abbrev = "", color = "darkblue", shortname = "Ministerialist",},
["Conservative Party (Bolivia)"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["Conservative Party (Bulgaria)"] = {abbrev = "", color = "#00008b", shortname = "",},
["Conservative Party (Chile)"] = {abbrev = "", color = "#1935D0", shortname = "Conservative",},
["Conservative Party (Czech Republic)"] = {abbrev = "", color = "#4b0082", shortname = "KONS",},
["Conservative Party (Ecuador)"] = {abbrev = "PC", color = "#0000FF", shortname = "",},
["Conservative Party (Egypt)"] = {abbrev = "", color = "#B31E46", shortname = "",},
["Conservative Party (Hong Kong)"] = {abbrev = "", color = "#0A4C90", shortname = "Conservative",},
["Conservative Party (Iceland)"] = {abbrev = "", color = "#87add7", shortname = "Conservative",},
["Conservative Party (Mexico)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Conservative Party (New Zealand)"] = {abbrev = "", color = "#00AEEF", shortname = "Conservative",},
["Conservative Party (Nicaragua)"] = {abbrev = "", color = "#008000", shortname = "Conservative",},
["Conservative Party (Panama)"] = {abbrev = "", color = "#095498", shortname = "",},
["Conservative Party (Prussia)"] = {abbrev = "", color = "#0750E5", shortname = "Conservatives",},
["Conservative Party (Romania, 1880–1918)"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Conservative Party (Romania)"] = {abbrev = "", color = "#66CCFF", shortname = "",},
["Conservative Party (Serbia)"] = {abbrev = "", color = "#134476", shortname = "",},
["Conservative Party (South Africa)"] = {abbrev = "", color = "#FFD700", shortname = "Conservative",},
["Conservative Party (Spain)"] = {abbrev = "", color = "#1286CB", shortname = "Conservative",},
["Conservative Party (Thailand)"] = {abbrev = "", color = "#FF0800", shortname = "",},
["Conservative Party (Uganda)"] = {abbrev = "", color = "purple", shortname = "",},
["Conservative Party (US)"] = {abbrev = "", color = "#FF8C00", shortname = "Conservative",},
["Conservative Party (Venezuela)"] = {abbrev = "", color = "#ED2939", shortname = "",},
["Conservative Party (Virginia, 1965)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Conservative Party (Virginia)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Conservative Party of Albania"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Conservative Party of Norway (2020)"] = {abbrev = "", color = "#0065F1", shortname = "",},
["Conservative Party of Norway"] = {abbrev = "", color = "#87add7", shortname = "Conservative",},
["Conservative Party of Russia"] = {abbrev = "", color = "#1093EC", shortname = "",},
["Conservative People's Party (Argentina)"] = {abbrev = "PCP", color = "#000081", shortname = "Conservative People's Party",},
["Conservative People's Party (Denmark)"] = {abbrev = "", color = "#00583C", shortname = "Conservative",},
["Conservative People's Party (Germany)"] = {abbrev = "KVP", color = "#191970", shortname = "",},
["Conservative People's Party of Estonia"] = {abbrev = "EKRE", color = "#0063AF", shortname = "",},
["Conservative People's Party"] = {abbrev = "", color = "#FFFFFF", shortname = "Conservative People's Party",},
["Conservative Republican Party"] = {abbrev = "", color = "#3333FF", shortname = "",},
["Conservative Resident"] = {abbrev = "", color = "#00ADEF", shortname = "",},
["Conservative Trade Unionist"] = {abbrev = "", color = "white", shortname = "",},
["Conservative Union (Spain)"] = {abbrev = "", color = "#27A6E2", shortname = "Silvelist",},
["Conservative"] = {abbrev = "", color = "#318CE7", shortname = "",},
["Conservatives and Reformists (Italy)"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Conservatives of Catalonia"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Constitution Party (Egypt)"] = {abbrev = "", color = "#0A72BB", shortname = "",},
["Constitution Party (Estonia)"] = {abbrev = "", color = "#E56509", shortname = "",},
["Constitution Party (US)"] = {abbrev = "", color = "#A356DE", shortname = "Constitution",},
["Constitutional Action Party"] = {abbrev = "", color = "#9ab27d", shortname = "",},
["Constitutional and Democratic Party (Spain)"] = {abbrev = "", color = "#9999FF", shortname = "",},
["Constitutional and Democratic Popular Movement"] = {abbrev = "", color = "#D0353B", shortname = "",},
["Constitutional Bloc (Bulgaria)"] = {abbrev = "", color = "#0092CB", shortname = "",},
["Constitutional Bloc (Lebanon)"] = {abbrev = "", color = "orange", shortname = "Constitutional Bloc",},
["Constitutional Democratic Party (Italy)"] = {abbrev = "", color = "#6495ed", shortname = "",},
["Constitutional Democratic Party (Japan)"] = {abbrev = "", color = "#6EA4CA", shortname = "Rikken Minseitō",},
["Constitutional Democratic Party of Japan"] = {abbrev = "", color = "#184589", shortname = "Constitutional Democratic",},
["Constitutional Democratic Party"] = {abbrev = "", color = "#0087DC", shortname = "Cadet",},
["Constitutional Front (Thailand)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Constitutional Nationalist Party UNIR"] = {abbrev = "", color = "#2E4371", shortname = "",},
["Constitutional Party (Malta)"] = {abbrev = "", color = "#C71585", shortname = "",},
["Constitutional Party (Peru)"] = {abbrev = "", color = "#0072BB", shortname = "",},
["Constitutional Party (Spain)"] = {abbrev = "", color = "#58B474", shortname = "Constitutional",},
["Constitutional Party (Vietnam)"] = {abbrev = "", color = "#D99FE8", shortname = "",},
["Constitutional Reform Association of Hong Kong"] = {abbrev = "CRA", color = "#000080", shortname = "",},
["Constitutional Right Party"] = {abbrev = "", color = "darkblue", shortname = "",},
["Constitutional Union (Morocco)"] = {abbrev = "UC", color = "#F29400", shortname = "",},
["Constitutional Union of Cuba"] = {abbrev = "", color = "#537AB0", shortname = "",},
["Constitutional Union Party (Iraq)"] = {abbrev = "CUP", color = "#A52A2A", shortname = "",},
["Constitutional Union Party (US)"] = {abbrev = "", color = "#F59100", shortname = "Constitutional Union",},
["Constitutionalist (UK)"] = {abbrev = "", color = "#8C92AC", shortname = "Constitutionalist",},
["Constitutionalist Liberal Party"] = {abbrev = "PLC", color = "#FF2400", shortname = "",},
["Constitutionalist Party of Iran"] = {abbrev = "", color = "#000099", shortname = "",},
["Constitutionalist"] = {abbrev = "", color = "white", shortname = "",},
["ConstitutionUSA Party"] = {abbrev = "", color = "#A356DE", shortname = "",}, -- TODO: is duplicate?
["Consultative Council for Indonesian Citizenship"] = {abbrev = "", color = "#800080", shortname = "",},
["Contigo (political party)"] = {abbrev = "", color = "#E2007A", shortname = "",},
["Contigo Más"] = {abbrev = "", color = "#DF617D", shortname = "",},
["Contigo Somos Democracia"] = {abbrev = "", color = "#85BE3D", shortname = "",},
["Convention for a Progressive Alternative"] = {abbrev = "CAP", color = "#FF0000", shortname = "",},
["Convention for the Renewal of the Comoros"] = {abbrev = "CRC", color = "#0471C3", shortname = "",},
["Convention Muslim League"] = {abbrev = "CML", color = "#00CCCC", shortname = "",},
["Convention of Christian Democrats"] = {abbrev = "", color = "#556627", shortname = "",},
["Convention of Democratic Forces"] = {abbrev = "", color = "green", shortname = "",},
["Convention of Republican Institutions"] = {abbrev = "", color = "#E75480", shortname = "",},
["Convention People's Party"] = {abbrev = "CPP", color = "#C80815", shortname = "",},
["Convergence (Guatemala)"] = {abbrev = "", color = "#3481B9", shortname = "",},
["Convergence (Mexico)"] = {abbrev = "", color = "#F18130", shortname = "Convergence",},
["Convergence and Union"] = {abbrev = "CiU", color = "#18307B", shortname = "",},
["Convergence for Development"] = {abbrev = "CODEM", color = "blue", shortname = "",},
["Convergence for Extremadura"] = {abbrev = "", color = "#0A892E", shortname = "",},
["Convergence for Social Democracy (Equatorial Guinea)"] = {abbrev = "", color = "red", shortname = "",},
["Convergence for the Development of Mali"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["Convergence for the Isles"] = {abbrev = "", color = "#02AECA", shortname = "",},
["Convergence for Vigo"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Convergence of Democrats of Navarre"] = {abbrev = "CDN", color = "#9D3E4D", shortname = "",},
["Convergence of Independents of Galicia"] = {abbrev = "", color = "#0062E3", shortname = "",},
["Convergence of Manacor"] = {abbrev = "", color = "#E2C767", shortname = "",},
["Convergence of Melilla"] = {abbrev = "", color = "#F04E98", shortname = "",},
["Convergents"] = {abbrev = "", color = "#172A88", shortname = "",},
["Converxencia XXI"] = {abbrev = "", color = "#FDB812", shortname = "",},
["Cook Islands First Party"] = {abbrev = "", color = "#FFDDFF", shortname = "",},
["Cook Islands National Party"] = {abbrev = "CINP", color = "#0000FF", shortname = "",},
["Cook Islands Party"] = {abbrev = "", color = "#005a00", shortname = "Cook Islands",},
["Cook Islands United Party"] = {abbrev = "", color = "#0000fe", shortname = "Cook Islands United",},
["Cooperation and Brotherhood"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Cooperation Party"] = {abbrev = "", color = "#311179", shortname = "",},
["Cooperative NATCCO Network Party"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Copei"] = {abbrev = "", color = "#009900", shortname = "",},
["Coraggio Italia"] = {abbrev = "", color = "#E5007D", shortname = "",},
["Córas na Poblachta"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Cordeliers club"] = {abbrev = "", color = "#374d5f", shortname = "",},
["Córdoba Neighbourhood Encounter"] = {abbrev = "", color = "#E76003", shortname = "",},
["Cordobese Union"] = {abbrev = "", color = "#067237", shortname = "",},
["Cork Socialist Party"] = {abbrev = "", color = "#D20000", shortname = "",},
["Cornellà en Comú–Crida per Cornellà"] = {abbrev = "", color = "#783E8B", shortname = "",},
["Cornellà Left Alternative"] = {abbrev = "", color = "#581960", shortname = "",},
["Cornish Nationalist Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Corsaris Democràtics"] = {abbrev = "", color = "#E7D072", shortname = "",},
["Corsica Libera"] = {abbrev = "CL", color = "#CC5500", shortname = "",},
["Corunnan Democracy"] = {abbrev = "", color = "#166CBF", shortname = "",},
["Corunnan Union"] = {abbrev = "", color = "#804B32", shortname = "",},
["Costa del Sol Sí Puede"] = {abbrev = "", color = "#269283", shortname = "",},
["Costa Rica Fair"] = {abbrev = "CRJ", color = "#00A5DB", shortname = "",},
["Costa Rican People's Party"] = {abbrev = "", color = "Red", shortname = "",},
["Costa Rican Peoples' Front"] = {abbrev = "FPC", color = "#800000", shortname = "",},
["Costa Rican Renovation Party"] = {abbrev = "PRC", color = "#0000FF", shortname = "",},
["Council Muslim League"] = {abbrev = "", color = "#00ffff", shortname = "",},
["Country Alliance (Dominican Republic)"] = {abbrev = "", color = "#00ACA1", shortname = "",},
["Country and Progressive National Party"] = {abbrev = "CPNP", color = "#008B8B", shortname = "",},
["Country Liberal Party"] = {abbrev = "", color = "#f8981d", shortname = "Country Liberal",},
["Country of Living"] = {abbrev = "", color = "#FC283F", shortname = "",},
["Country Party (New Zealand)"] = {abbrev = "", color = "#B9F58B", shortname = "Country Party",},
["Country Party (NSW)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party (South Australia)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party (Victoria)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party of Australia"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Country Party of Australia (1920)"] = {abbrev = "", color = "#006644", shortname = "Country",},
["Countryside Party (UK)"] = {abbrev = "", color = "olive", shortname = "Countryside",},
["Courage Party"] = {abbrev = "", color = "#CC66FF", shortname = "Courage",},
["Course of Freedom"] = {abbrev = "PE", color = "#9F1897", shortname = "",},
["Covenant Party (Northern Mariana Islands)"] = {abbrev = "", color = "#CCFFCC", shortname = "Covenant",},
["Covenant Society"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Cowry Forces for an Emerging Benin"] = {abbrev = "", color = "#56963F", shortname = "FCBE",},
["CPC"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Crawford Republican"] = {abbrev = "", color = "#5FD35F", shortname = "",},
["Creating Opportunities"] = {abbrev = "CREO", color = "#1B5DA6", shortname = "",},
["Creative Korea Party"] = {abbrev = "", color = "#FF69B4", shortname = "Creative Korea",},
["Creemos"] = {abbrev = "", color = "#d02d69", shortname = "",},
["Creo en Huelva"] = {abbrev = "", color = "#18B3B7", shortname = "",},
["Crescent Star Party (Indonesia)"] = {abbrev = "", color = "#005825", shortname = "",},
["Crida per Palma"] = {abbrev = "", color = "#F3CB2D", shortname = "",},
["Cristiannan Uni Reforzando Potencial di Aruba"] = {abbrev = "", color = "purple", shortname = "",},
["Croat People's Union"] = {abbrev = "", color = "blue", shortname = "",},
["Croat-Serb Coalition"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Croatia is Growing"] = {abbrev = "", color = "#e00f20", shortname = "",},
["Croatian Christian Democratic Union of Bosnia and Herzegovina"] = {abbrev = "", color = "blue", shortname = "",},
["Croatian Christian Democratic Union"] = {abbrev = "", color = "cornflowerblue", shortname = "",},
["Croatian Civic Initiative"] = {abbrev = "HGI", color = "#f08080", shortname = "",},
["Croatian Civic Party"] = {abbrev = "HGS", color = "#1F75FE", shortname = "",},
["Croatian Coalition (2010)"] = {abbrev = "", color = "#E61717", shortname = "",},
["Croatian Conservative Party"] = {abbrev = "", color = "#002366", shortname = "",},
["Croatian Demochristian Party"] = {abbrev = "", color = "#1974D2", shortname = "",},
["Croatian Democratic Alliance of Slavonia and Baranja"] = {abbrev = "HDSSB", color = "#990000", shortname = "",},
["Croatian Democratic Peasant Party"] = {abbrev = "", color = "green", shortname = "",},
["Croatian Democratic Union 1990"] = {abbrev = "HDZ 1990", color = "#A3DCFF", shortname = "",},
["Croatian Democratic Union of Bosnia and Herzegovina"] = {abbrev = "HDZ BiH", color = "#013971", shortname = "",},
["Croatian Democratic Union"] = {abbrev = "HDZ", color = "#005BAA", shortname = "",},
["Croatian Growth"] = {abbrev = "", color = "#5299E1", shortname = "",},
["Croatian Independent Party"] = {abbrev = "", color = "#5CA8EC", shortname = "",},
["Croatian Labourists – Labour Party"] = {abbrev = "", color = "#F4A460", shortname = "Labour",},
["Croatian Labourists"] = {abbrev = "HL", color = "#F4A460", shortname = "",},
["Croatian Liberation Movement"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Croatian Party of Pensioners"] = {abbrev = "", color = "#004B88", shortname = "HSU",},
["Croatian Party of Rights 1861"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Party of Rights Dr. Ante Starčević"] = {abbrev = "HSP AS", color = "#6082B6", shortname = "",},
["Croatian Party of Rights of Bosnia and Herzegovina"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Party of Rights"] = {abbrev = "HSP", color = "#000000", shortname = "",},
["Croatian Peasant Party of Bosnia and Herzegovina"] = {abbrev = "", color = "#3D863D", shortname = "",},
["Croatian Peasant Party"] = {abbrev = "HSS", color = "#02B14B", shortname = "",},
["Croatian People's Party – Liberal Democrats"] = {abbrev = "HNS-LD", color = "#FF931E", shortname = "",},
["Croatian People's Party"] = {abbrev = "HNS", color = "#F4A460", shortname = "",},
["Croatian Popular Party (1919)"] = {abbrev = "", color = "blue", shortname = "",},
["Croatian Pure Party of Rights"] = {abbrev = "", color = "#000000", shortname = "",},
["Croatian Republican Union"] = {abbrev = "", color = "black", shortname = "",},
["Croatian Right Bloc"] = {abbrev = "", color = "black", shortname = "",},
["Croatian Romani Union \"Kali Sara\""] = {abbrev = "", color = "red", shortname = "Kali Sara",},
["Croatian Social Democrats"] = {abbrev = "HSD", color = "#FF0000", shortname = "",},
["Croatian Social Liberal Party"] = {abbrev = "HSLS", color = "#FFE01A", shortname = "",},
["Croatian True Revival"] = {abbrev = "HIP", color = "darkblue", shortname = "",},
["Croatian Workers Party"] = {abbrev = "HRS", color = "Blue", shortname = "",},
["Croats Together"] = {abbrev = "HZ", color = "#A3DCFF", shortname = "",},
["Crofters Party"] = {abbrev = "", color = "#ddff55", shortname = "Crofters",},
["Cross-Community Labour Alternative"] = {abbrev = "", color = "#cd5c5c", shortname = "Labour Alternative",},
["Crossbencher"] = {abbrev = "", color = "grey", shortname = "Crossbench",},
["Crystal Party"] = {abbrev = "", color = "#88309E", shortname = "",},
["Cuban National Party"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Cuban Popular Party"] = {abbrev = "", color = "#C71585", shortname = "",},
["Cuenca Nos Une"] = {abbrev = "", color = "#13A69E", shortname = "",},
["Culleredo Neighborhood Tide"] = {abbrev = "", color = "#00ACEE", shortname = "",},
["Cultural Association of the GDR"] = {abbrev = "", color = "#011993", shortname = "",},
["Cultural Union of Ruthenians of Romania"] = {abbrev = "KTRR", color = "red", shortname = "",},
["Cumann na nGaedheal"] = {abbrev = "CnaG", color = "#87CEFA", shortname = "Cumann na nGaedheal",},
["Cumann Poblachta na hÉireann"] = {abbrev = "", color = "#008800", shortname = "",},
["Cumbernauld Independent Councillors Alliance"] = {abbrev = "CICA", color = "#DDDDDD", shortname = "",},
["CumbriaFirst"] = {abbrev = "", color = "#72A041", shortname = "Putting Cumbria First",},
["Curaçao a New Dutch Municipality"] = {abbrev = "", color = "#FE8A23", shortname = "",},
["Current of Love"] = {abbrev = "", color = "#C49A6C", shortname = "",},
["Cymru Rydd"] = {abbrev = "", color = "#E32636", shortname = "",},
["Cymru Sovereign"] = {abbrev = "", color = "#fbff3c", shortname = "",},
["Cynon Valley Party"] = {abbrev = "", color = "#fac43a", shortname = "",},
["Czech National Social Party"] = {abbrev = "ČSNS", color = "#FAC469", shortname = "",},
["Czech National Socialist Party"] = {abbrev = "ČSNS 2005", color = "#C80000", shortname = "",},
["Czech Pirate Party"] = {abbrev = "", color = "#000000", shortname = "Pirates",},
["Czech Social Democratic Party"] = {abbrev = "ČSSD", color = "#EC5800", shortname = "",},
["Czechoslovak National Democracy"] = {abbrev = "ČsND", color = "#2B347F", shortname = "",},
["Czechoslovak National Socialist Party"] = {abbrev = "ČSNS", color = "#FAC469", shortname = "",},
["Czechoslovak People's Party"] = {abbrev = "ČSL", color = "#FFD700", shortname = "",},
["Czechoslovak Social Democracy"] = {abbrev = "ČSSD", color = "#EC5800", shortname = "",},
["Czechoslovak Traders' Party"] = {abbrev = "ČŽOS", color = "#F27A7A", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
5kg4iaa2bs0776f9j5kg9f9iq5xlr99
Module:Political party/D
828
68668275
1096744825
1096378431
2022-07-06T10:50:03Z
DukeOfDelTaco
36908829
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Direct Democracy New Zealand"] = "Direct Democracy Party of New Zealand",
["DAB"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["DABHK"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["Delaware Democratic Party"] = "Democratic Party (US)",
["Delaware Republican Party"] = "Republican Party (US)",
["Demócrata Party"] = "Democrata Party",
["Democratic Agrarian Party of Moldova"] = "Agrarian Party of Moldova",
["Democratic Alliance for the Betterment of Hong Kong"] = "Democratic Alliance for the Betterment and Progress of Hong Kong",
["Democratic and Social Centre – People's Party"] = "CDS – People's Party",
["Democratic and Social Centre – People´s Party"] = "CDS – People's Party",
["Democratic Awakening"] = "Democratic Beginning",
["Democratic Center Party of Latvia"] = "Democratic Party \"Saimnieks\"",
["Democratic Coalition"] = "Democratic Coalition (Hungary)",
["Democratic Front (France)"] = "Democratic Movement (France)",
["Democratic Front of the Francophones"] = "DéFI",
["Democratic Group"] = "Democratic Party (Luxembourg)",
["Democratic Labour Party (UK)"] = "Democratic Labour Party (UK, 1998)",
["Democratic Labour Party"] = "Lincoln Democratic Labour Association",
["Democratic Liberal Party (Italy)"] = "Italian Democratic Liberal Party",
["Democratic Modernist Pole"] = "Ettajdid Movement",
["Democratic National Alliance"] = "Democratic National Alliance (Sri Lanka)",
["Democratic Obedience Party"] = "Democratic Conviction",
["Democratic Party - demokraci.pl"] = "Democratic Party – demokraci.pl",
["Democratic Party (Burma)"] = "Democratic Party (Myanmar)",
["Democratic Party (Japan)"] = "Democratic Party (Japan, 2016)",
["Democratic Party (Slovakia)"] = "Democratic Party (Slovakia, 1989)",
["Democratic Party (Turkey, historical)"] = "Democrat Party (Turkey, 1946–1961)",
["Democratic Party (United States)"] = "Democratic Party (US)",
["Democratic Party (Alabama)"] = "Democratic Party (US)",
["Democratic Party (Alaska)"] = "Democratic Party (US)",
["Democratic Party (Arizona)"] = "Democratic Party (US)",
["Democratic Party (Arkansas)"] = "Democratic Party (US)",
["Democratic Party (California)"] = "Democratic Party (US)",
["Democratic Party (Colorado)"] = "Democratic Party (US)",
["Democratic Party (Connecticut)"] = "Democratic Party (US)",
["Democratic Party (Delaware)"] = "Democratic Party (US)",
["Democratic Party (Georgia, US)"] = "Democratic Party (US)",
["Democratic Party (Guam)"] = "Democratic Party (US)",
["Democratic Party (Hawaii)"] = "Democratic Party (US)",
["Democratic Party (Idaho)"] = "Democratic Party (US)",
["Democratic Party (Illinois)"] = "Democratic Party (US)",
["Democratic Party (Iowa)"] = "Democratic Party (US)",
["Democratic Party (Maryland)"] = "Democratic Party (US)",
["Democratic Party (Massachusetts)"] = "Democratic Party (US)",
["Democratic Party (Michigan)"] = "Democratic Party (US)",
["Democratic Party (Minnesota)"] = "Democratic Party (US)",
["Democratic Party (Missouri)"] = "Democratic Party (US)",
["Democratic Party (Nevada)"] = "Democratic Party (US)",
["Democratic Party (New Mexico)"] = "Democratic Party (US)",
["Democratic Party (New York)"] = "Democratic Party (US)",
["Democratic Party (Northern Mariana Islands)"] = "Democratic Party (US)",
["Democratic Party (Pennsylvania)"] = "Democratic Party (US)",
["Democratic Party (Rhode Island)"] = "Democratic Party (US)",
["Democratic Party (Turkey, current)"] = "Democrat Party (Turkey, current)",
["Democratic Party (Utah)"] = "Democratic Party (US)",
["Democratic Party (Vermont)"] = "Democratic Party (US)",
["Democratic Party (Virginia)"] = "Democratic Party (US)",
["Democratic Party (Washington State)"] = "Democratic Party (US)",
["Democratic Party (Washington)"] = "Democratic Party (US)",
["Democratic Party (West Virginia)"] = "Democratic Party (US)",
["Democratic Party of Arkansas"] = "Democratic Party (US)",
["Democratic Party of Côte d'Ivoire – African Democratic Rally"] = "Democratic Party of Ivory Coast – African Democratic Rally",
["Democratic Party of Georgia"] = "Democratic Party (US)",
["Democratic Party of Illinois"] = "Democratic Party (US)",
["Democratic Party of Japan (1996)"] = "Democratic Party (Japan, 1996)",
["Democratic Party of Japan"] = "Democratic Party (Japan, 1998)",
["Democratic Party of Minnesota"] = "Democratic Party (US)",
["Democratic Party of New Mexico"] = "Democratic Party (US)",
["Democratic Party of Oregon"] = "Democratic Party (US)",
["Democratic Party of Virginia"] = "Democratic Party (US)",
["Democratic Party of Wisconsin"] = "Democratic Party (US)",
["Democratic Patriots' Movement"] = "Democratic Patriots' Unified Party",
["Democratic People's Liberation Front"] = "People's Liberation Organisation of Tamil Eelam",
["Democratic Popular Party (Spain)"] = "People's Democratic Party (Spain)",
["Democratic Socialist Party (Nepal)"] = "Loktantrik Samajwadi Party, Nepal",
["Democratic Tamil National Alliance"] = "Tamizh Democratic National Alliance",
["Democratic Turnhalle Alliance"] = "Popular Democratic Movement",
["Democratic Union of the Greek Minority"] = "Omonoia (organization)",
["Democratic Union"] = "Democratic Union (Poland)",
["Democratic Unity Coalition"] = "Unitary Democratic Coalition",
["Democratic Workers' Congress"] = "Democratic People's Front",
["Democratic-Farmer-Labor Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic-Republican Party (United States)"] = "Democratic-Republican Party",
["Democratic-Republican Party (US)"] = "Democratic-Republican Party",
["Democratic-Republican"] = "Democratic-Republican Party",
["Democratic–Farmer–Labor Party (Minnesota)"] = "Minnesota Democratic–Farmer–Labor Party",
["Democratic–Nonpartisan League Party (North Dakota)"] = "North Dakota Democratic-NPL Party",
["Democratic–Republican Party (United States)"] = "Democratic-Republican Party",
["Democrats (Norway)"] = "Democrats in Norway",
["Democrats and Progressives"] = "Article One (political party)",
["Democrats for Social Credit"] = "New Zealand Democratic Party for Social Credit",
["Demokraatit"] = "Democrats (Greenland)",
["Denk (Dutch political party)"] = "DENK (political party)",
["Denk (political party)"] = "DENK (political party)",
["DENK"] = "DENK (political party)",
["Direction – Social Democracy"] = "Direction – Slovak Social Democracy",
["Direction (Slovakia)"] = "Direction – Slovak Social Democracy",
["District of Columbia Democratic State Committee"] = "Democratic Party (US)",
["District of Columbia Republican Party"] = "Republican Party (US)",
["Dixiecrat Party (United States)"] = "Dixiecrat",
["DMK"] = "Dravida Munnetra Kazhagam",
["Dodd Independent Party"] = "Independent (US)",
["DPHK"] = "Democratic Party (Hong Kong)",
["Dutch Labour Party"] = "Labour Party (Netherlands)",
}
local full = {
["D.C. Statehood Green Party"] = {abbrev = "", color = "#0BDA51", shortname = "D.C. Statehood Green",},
["D.C. Statehood Party"] = {abbrev = "", color = "#0BDA51", shortname = "D.C. Statehood",},
["Da'am Workers Party"] = {abbrev = "", color = "#C60408", shortname = "",},
["Dabalorivhuwa Patriotic Front"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Dagga Party"] = {abbrev = "", color = "#009245", shortname = "",},
["Dahomeyan Democratic Movement"] = {abbrev = "", color = "#91ADBC", shortname = "",},
["Dahomeyan Democratic Union"] = {abbrev = "", color = "#5CBB72", shortname = "",},
["Dahomeyan Progressive Union"] = {abbrev = "UPD", color = "#5CBB72", shortname = "",},
["Dainiin Club"] = {abbrev = "", color = "#587dab", shortname = "",},
["Dalit Janajati Party"] = {abbrev = "", color = "blue", shortname = "",},
["Dalit Mazdoor Kisan Party"] = {abbrev = "DMKP", color = "#A5CBFA", shortname = "",},
["Dalit Muslim Vikas Party"] = {abbrev = "DMVP", color = "#293A03", shortname = "",},
["Dalmatian Action"] = {abbrev = "", color = "darkblue", shortname = "",},
["Danish Party"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Danish People's Party"] = {abbrev = "DPP", color = "#FCD03B", shortname = "",},
["Danish Social Liberal Party"] = {abbrev = "", color = "#ec008c", shortname = "Social Liberals",},
["Danish Unity"] = {abbrev = "", color = "#002366", shortname = "",},
["Dawn – National Coalition"] = {abbrev = "", color = "#004071", shortname = "Dawn",},
["Dawn (Iceland)"] = {abbrev = "", color = "#eab943", shortname = "",},
["Dawn of Direct Democracy"] = {abbrev = "", color = "#66BDFF", shortname = "Dawn",},
["Dayak Unity Party"] = {abbrev = "PPD", color = "#0093dd", shortname = "",},
["Daylight Saving"] = {abbrev = "", color = "#FFFD7A", shortname = "",},
["DCIDE"] = {abbrev = "", color = "#3B9F40", shortname = "",},
["De Basis"] = {abbrev = "", color = "#DDDC05", shortname = "Basis",},
["De Nou Reus"] = {abbrev = "", color = "#5CBACC", shortname = "",},
["Death to the System (Spain)"] = {abbrev = "", color = "#0A0A0A", shortname = "",},
["Debout la France"] = {abbrev = "DLF", color = "#0087CD", shortname = "",},
["Debout la République"] = {abbrev = "DLR", color = "#8040C0", shortname = "",},
["Debout Les Belges!"] = {abbrev = "", color = "#CA232B", shortname = "",},
["Decentralist Social Force Party"] = {abbrev = "", color = "#82BC1C", shortname = "",},
["DecideT–EligeT"] = {abbrev = "", color = "#21297C", shortname = "",},
["Decolonization and Social Emancipation Movement"] = {abbrev = "", color = "#AA0000", shortname = "",},
["Defense of the Andalusian People's Interests"] = {abbrev = "", color = "#40903B", shortname = "",},
["DéFI"] = {abbrev = "", color = "#DD0081", shortname = "",},
["Degel HaTorah"] = {abbrev = "", color = "#3E3E3E", shortname = "",},
["Degrowth Party"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Delhi Janata Party"] = {abbrev = "DJP", color = "#CEF6EC", shortname = "",},
["Delhi Poorvanchal Party"] = {abbrev = "DPP", color = "#BCA9F5", shortname = "",},
["Deliberation Tsuen Wan"] = {abbrev = "", color = "#7CBECC", shortname = "Deliberation TW",},
["Demo-Social 12"] = {abbrev = "", color = "#4D955D", shortname = "",},
["Demo-Social 60"] = {abbrev = "", color = "#F58025", shortname = "",},
["Demochristian Party of Albania"] = {abbrev = "PDK", color = "orange", shortname = "",},
["Democracy and Catalonia"] = {abbrev = "", color = "#F6BA1B", shortname = "",},
["Democracy and Freedom"] = {abbrev = "DiL", color = "#212765", shortname = "",},
["Democracy and Human Rights Party"] = {abbrev = "", color = "#2E3492", shortname = "",},
["Democracy and Progress Party"] = {abbrev = "", color = "#0069A7", shortname = "",},
["Democracy at Home Party"] = {abbrev = "PPDA", color = "#003399", shortname = "",},
["Democracy First"] = {abbrev = "", color = "ff8c00", shortname = "",},
["Democracy Groundwork"] = {abbrev = "", color = "#FEED59", shortname = "",},
["Democracy in Europe Movement 2025"] = {abbrev = "DiEM25", color = "#ec5122", shortname = "",},
["Democracy in Motion"] = {abbrev = "DiB", color = "#263d80", shortname = "",},
["Democracy Yes"] = {abbrev = "", color = "#B713C5", shortname = "",},
["Democracy and Development through Unity"] = {abbrev = "DOE", color = "#C8ED69", shortname = "",},
["Democracy, Citizenry and Republic"] = {abbrev = "", color = "#FCDB10", shortname = "",},
["Democrat Party (Chile)"] = {abbrev = "", color = "#E3431F", shortname = "Democrat",},
["Democrat Party (Thailand)"] = {abbrev = "", color = "#00A1F1", shortname = "Democrat",},
["Democrat Party (Turkey, 1946–1961)"] = {abbrev = "", color = "#F7819F", shortname = "Democrat",},
["Democrat Party (Turkey, current)"] = {abbrev = "DP", color = "#CC0000", shortname = "",},
["Democrat Party of Iran"] = {abbrev = "", color = "#093", shortname = "Democrat Party",},
["Democrat Social Movement"] = {abbrev = "", color = "#4CBB17", shortname = "",},
["Democrat Turkey Party"] = {abbrev = "DTP", color = "#DA7766", shortname = "",},
["Democrata Party"] = {abbrev = "", color = "#0000FF", shortname = "Democrata",},
["Democratic Accountants"] = {abbrev = "", color = "#47954E", shortname = "",},
["Democratic Action (El Salvador)"] = {abbrev = "", color = "#F95400", shortname = "",},
["Democratic Action (Venezuela)"] = {abbrev = "", color = "#C0C0C0", shortname = "Democratic Action",},
["Democratic Action Congress"] = {abbrev = "DAC", color = "#aa00d4", shortname = "",},
["Democratic Action Party (Spain)"] = {abbrev = "", color = "#3E4E3E", shortname = "",},
["Democratic Action Party"] = {abbrev = "DAP", color = "#ED1C24", shortname = "",},
["Democratic Agrarian Party of Romania"] = {abbrev = "PDAR", color = "yellow", shortname = "",},
["Democratic Action"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Democratic Alignment (2015)"] = {abbrev = "", color = "#2D902D", shortname = "",},
["Democratic Alliance (Bulgaria)"] = {abbrev = "", color = "gray", shortname = "",},
["Democratic Alliance (France)"] = {abbrev = "", color = "#FFBF00", shortname = "",},
["Democratic Alliance (Greece)"] = {abbrev = "", color = "#6D85CB", shortname = "",},
["Democratic Alliance (Italy)"] = {abbrev = "", color = "#228B22", shortname = "",},
["Democratic Alliance (Philippines)"] = {abbrev = "", color = "#DC143C", shortname = "Democratic Alliance",},
["Democratic Alliance (South Africa)"] = {abbrev = "", color = "#005BA6", shortname = "Democratic Alliance",},
["Democratic Alliance (Venezuela)"] = {abbrev = "", color = "#0F52BA", shortname = "",},
["Democratic Alliance for Niger"] = {abbrev = "", color = "#337585", shortname = "",},
["Democratic Alliance for the Betterment and Progress of Hong Kong"] = {abbrev = "DAB", color = "#1861AC", shortname = "",},
["Democratic Alliance of Croats in Vojvodina"] = {abbrev = "DSHV", color = "#EE1C25", shortname = "",},
["Democratic Alliance of Hungarians in Romania"] = {abbrev = "UDMR", color = "#296633", shortname = "",},
["Democratic Alliance of Wales"] = {abbrev = "DAW", color = "#CCCCCC", shortname = "",},
["Democratic Alliance Party (Albania)"] = {abbrev = "AD", color = "#1369B2", shortname = "",},
["Democratic Alliance Party (Solomon Islands)"] = {abbrev = "", color = "#68C76D", shortname = "",},
["Democratic Alliance Party (Tunisia)"] = {abbrev = "", color = "Salmon", shortname = "",},
["Democratic Alternative '91"] = {abbrev = "DA'91", color = "#FFF212", shortname = "",},
["Democratic Alternative (Chile)"] = {abbrev = "", color = "#9ACD32", shortname = "",},
["Democratic Alternative (Finland)"] = {abbrev = "", color = "#FF4D00", shortname = "",},
["Democratic Alternative (Malta)"] = {abbrev = "", color = "#7AC143", shortname = "",},
["Democratic Alternative (North Macedonia)"] = {abbrev = "DA", color = "#800080", shortname = "",},
["Democratic Alternative (Serbia)"] = {abbrev = "", color = "#FA8383", shortname = "",},
["Democratic Alternative Party"] = {abbrev = "", color = "#EF7619", shortname = "",},
["Democratic and Independent Cape Verdean Union"] = {abbrev = "", color = "#0066ff", shortname = "",},
["Democratic and Popular Union"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic and Republican Alliance"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Democratic and Social Centre (Spain)"] = {abbrev = "CDS", color = "#049456", shortname = "",},
["Democratic and Social Convention"] = {abbrev = "", color = "#679A6C", shortname = "CDS-Rahama",},
["Democratic and Social Movement (Algeria)"] = {abbrev = "", color = "#006FB6", shortname = "",},
["Democratic and Social Movement (Morocco)"] = {abbrev = "", color = "#9AAD35", shortname = "",},
["Democratic and Social Party of Ceuta"] = {abbrev = "", color = "#29806D", shortname = "",},
["Democratic and Socialist Union of the Resistance"] = {abbrev = "UDSR", color = "#EF5327", shortname = "",},
["Democratic Ashkali Party of Kosovo"] = {abbrev = "", color = "#01B965", shortname = "",},
["Democratic Axe"] = {abbrev = "", color = "#84171C", shortname = "",},
["Democratic Beginning"] = {abbrev = "DA", color = "#000000", shortname = "",},
["Democratic Bloc (Poland)"] = {abbrev = "BD", color = "#F02F2A", shortname = "",},
["Democratic Bloc (Ukraine)"] = {abbrev = "", color = "#0087DC", shortname = "Democratic Bloc",},
["Democratic Bloc"] = {abbrev = "", color = "blue", shortname = "",},
["Democratic Bulgaria"] = {abbrev = "DB", color = "#004A80", shortname = "",},
["Democratic Center (Colombia)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic Center",},
["Democratic Center (Ecuador)"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Democratic Centre of Macau"] = {abbrev = "CDM", color = "#DD0000", shortname = "Democratic",},
["Democratic Centre (Croatia)"] = {abbrev = "DC", color = "#006bb3", shortname = "",},
["Democratic Centre (France)"] = {abbrev = "CD", color = "#00CCCC", shortname = "",},
["Democratic Centre (Italy, 2013)"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Democratic Centre (Italy)"] = {abbrev = "", color = "#E86055", shortname = "",},
["Democratic Centre (Latvia)"] = {abbrev = "", color = "blue", shortname = "Democratic Centre",},
["Democratic Centre (Serbia)"] = {abbrev = "DC", color = "#FFFF99", shortname = "",},
["Democratic Centre Coalition"] = {abbrev = "", color = "#4CB034", shortname = "",},
["Democratic Change (El Salvador)"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Democratic Change (Panama)"] = {abbrev = "CD", color = "#2A889B", shortname = "",},
["Democratic Change (South Sudan)"] = {abbrev = "", color = "#FB2026", shortname = "",},
["Democratic Choice of Kazakhstan"] = {abbrev = "", color = "#0083cd", shortname = "",},
["Democratic Choice of Russia – United Democrats"] = {abbrev = "DVR–OD", color = "#3A46CE", shortname = "",},
["Democratic Choice of Russia"] = {abbrev = "", color = "#29166F", shortname = "",},
["Democratic Coalition (Hungary)"] = {abbrev = "DK", color = "#0067AA", shortname = "",},
["Democratic Coalition (Spain)"] = {abbrev = "CD", color = "#8E9629", shortname = "",},
["Democratic Coalition for DC Election"] = {abbrev = "", color = "#D38D4F", shortname = "Democratic Coalition",},
["Democratic Confederation of Labour (Morocco)"] = {abbrev = "", color = "#020202", shortname = "",},
["Democratic Congress"] = {abbrev = "DC", color = "#B70002", shortname = "",},
["Democratic Consent–Republican Party"] = {abbrev = "ID–PR", color = "#317C41", shortname = "",},
["Democratic Conservative Party"] = {abbrev = "PCD", color = "#0000FF", shortname = "",},
["Democratic Constitutional Rally"] = {abbrev = "RCD", color = "FireBrick", shortname = "",},
["Democratic Convention of African Peoples"] = {abbrev = "", color = "red", shortname = "",},
["Democratic Convention of Moldova"] = {abbrev = "CDM", color = "#0061D4", shortname = "",},
["Democratic Convergence (El Salvador)"] = {abbrev = "", color = "#DC241F", shortname = "",},
["Democratic Convergence of Catalonia"] = {abbrev = "CDC", color = "#232D7B", shortname = "",},
["Democratic Convergence Party (Guinea-Bissau)"] = {abbrev = "", color = "#0099FF", shortname = "",},
["Democratic Convergence Party (São Tomé and Príncipe)"] = {abbrev = "", color = "#1102DE", shortname = "",},
["Democratic Conviction"] = {abbrev = "", color = "#0098D8", shortname = "",},
["Democratic Current"] = {abbrev = "", color = "#FE6500", shortname = "",},
["Democratic Development Party"] = {abbrev = "DDP", color = "red", shortname = "",},
["Democratic Electoral Commission"] = {abbrev = "", color = "darkred", shortname = "",},
["Democratic European Force"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Democratic Farmers' Party of Germany"] = {abbrev = "DBD", color = "Green", shortname = "",},
["Democratic Fellowship of Vojvodina Hungarians"] = {abbrev = "VMDK", color = "green", shortname = "",},
["Democratic Force (Costa Rica)"] = {abbrev = "PFD", color = "#EB6109", shortname = "",},
["Democratic Forces of Guiana"] = {abbrev = "", color = "#A71585", shortname = "",},
["Democratic Forum (Spain)"] = {abbrev = "", color = "#1C5530", shortname = "",},
["Democratic Forum for Labour and Liberties"] = {abbrev = "", color = "#660000", shortname = "Ettakatol",},
["Democratic Forum for Modernity"] = {abbrev = "", color = "purple", shortname = "",},
["Democratic Forum of Germans in Romania"] = {abbrev = "", color = "#AA2421", shortname = "",},
["Democratic Front (Bosnia and Herzegovina)"] = {abbrev = "DF", color = "#F16822", shortname = "",},
["Democratic Front (Cyprus)"] = {abbrev = "DIPA", color = "#26ACE2", shortname = "",},
["Democratic Front (Montenegro)"] = {abbrev = "DF", color = "#00008B", shortname = "",},
["Democratic Front (Peru)"] = {abbrev = "FREDEMO", color = "#50a7f7", shortname = "",},
["Democratic Front for the Liberation of Palestine"] = {abbrev = "DFLP", color = "#D10A2B", shortname = "",},
["Democratic Front for the Reunification of the Fatherland"] = {abbrev = "", color = "#FF3333", shortname = "Fatherland Front",},
["Democratic Front of Albania"] = {abbrev = "", color = "#EF4A2E", shortname = "Democratic Front",},
["Democratic Front Party"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Democratic Galicianist Party"] = {abbrev = "", color = "#3886AC", shortname = "",},
["Democratic Generation Party"] = {abbrev = "", color = "#A9A5B4", shortname = "",},
["Democratic Green Party of Rwanda"] = {abbrev = "", color = "#00FA9A", shortname = "",},
["Democratic Groundwork"] = {abbrev = "", color = "#FEED59", shortname = "",},
["Democratic Group of the Centre"] = {abbrev = "GDC", color = "yellow", shortname = "",},
["Democratic Hygiene"] = {abbrev = "", color = "#4F6179", shortname = "",},
["Democratic Independence Party"] = {abbrev = "", color = "#AE872A", shortname = "",},
["Democratic Independent Party"] = {abbrev = "", color = "gold", shortname = "",},
["Democratic Independent Regionalist Party"] = {abbrev = "", color = "#4A1C51", shortname = "",},
["Democratic Indira Congress (Karunakaran)"] = {abbrev = "DIC", color = "darkblue", shortname = "",},
["Democratic Initiative for Benalmádena"] = {abbrev = "", color = "#22305E", shortname = "",},
["Democratic Innovation Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Democratic Israel"] = {abbrev = "", color = "#0E0348", shortname = "",},
["Democratic Justice Party"] = {abbrev = "", color = "#0094BC", shortname = "Democratic Justice",},
["Democratic Korea Party"] = {abbrev = "", color = "#87CCEB", shortname = "Democratic Korea",},
["Democratic Labor Party (historical)"] = {abbrev = "", color = "#008080", shortname = "",},
["Democratic Labor Party (South Korea)"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labor",},
["Democratic Labor Party"] = {abbrev = "", color = "#FF9C00", shortname = "",},
["Democratic Labour Party (Australia)"] = {abbrev = "", color = "#EEAF30", shortname = "Democratic Labour",},
["Democratic Labour Party (Barbados)"] = {abbrev = "DLP", color = "#FFD700", shortname = "",},
["Democratic Labour Party (Brazil)"] = {abbrev = "PDT", color = "#FD013A", shortname = "",},
["Democratic Labour Party (New Zealand)"] = {abbrev = "", color = "#FFA500", shortname = "Democratic Labour",},
["Democratic Labour Party (Trinidad and Tobago)"] = {abbrev = "DLP", color = "#e25822", shortname = "",},
["Democratic Labour Party (UK, 1972)"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labour",},
["Democratic Labour Party (UK, 1998)"] = {abbrev = "", color = "#E32636", shortname = "Democratic Labour",},
["Democratic Labour Party of Lithuania"] = {abbrev = "LDDP", color = "#E75480", shortname = "",},
["Democratic League (Catalonia)"] = {abbrev = "", color = "#002D70", shortname = "",},
["Democratic League in Montenegro"] = {abbrev = "DSCG", color = "cornflowerblue", shortname = "",},
["Democratic League of Dardania"] = {abbrev = "", color = "#005CA7", shortname = "",},
["Democratic League of Kosovo"] = {abbrev = "LDK", color = "#F37476", shortname = "",},
["Democratic League/Movement for the Labour Party"] = {abbrev = "", color = "#E392B6", shortname = "",},
["Democratic Left (Ecuador)"] = {abbrev = "ID", color = "#FFA500", shortname = "",},
["Democratic Left (Greece)"] = {abbrev = "DIMAR", color = "#FF4100", shortname = "",},
["Democratic Left (Ireland)"] = {abbrev = "DL", color = "#C700C7", shortname = "Democratic Left",},
["Democratic Left (Spain)"] = {abbrev = "", color = "#DB0000", shortname = "",},
["Democratic Left (UK)"] = {abbrev = "", color = "#CC0033", shortname = "Democratic Left",},
["Democratic Left Alliance – Labour Union"] = {abbrev = "SLD-UP", color = "#CA2021", shortname = "",},
["Democratic Left Alliance"] = {abbrev = "SLD", color = "#E2001A", shortname = "",},
["Democratic Left Front (Spain)"] = {abbrev = "", color = "#7F517C", shortname = "",},
["Democratic Left Front (Sri Lanka)"] = {abbrev = "", color = "#F90818", shortname = "",},
["Democratic Left Movement (Lebanon)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic Left of Catalonia"] = {abbrev = "", color = "#FFE507", shortname = "",},
["Democratic Left Party (Turkey)"] = {abbrev = "DSP", color = "#0087DC", shortname = "",},
["Democratic Left Scotland"] = {abbrev = "", color = "#CC0033", shortname = "Democratic Left",},
["Democratic Leftwing Republican Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic Liberal Congress"] = {abbrev = "", color = "#F70000", shortname = "",},
["Democratic Liberal Party (Japan)"] = {abbrev = "", color = "#459F36", shortname = "",},
["Democratic Liberal Party (Romania)"] = {abbrev = "PDL", color = "#FF6633", shortname = "",},
["Democratic Liberal Party (South Korea)"] = {abbrev = "", color = "#003990", shortname = "Democratic Liberal",},
["Democratic Liberal Party"] = {abbrev = "", color = "#098CDC", shortname = "",},
["Democratic List for Israeli Arabs"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Democratic List of Nazareth"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Democratic Majority (Spain)"] = {abbrev = "", color = "#0086D6", shortname = "",},
["Democratic Montenegro"] = {abbrev = "DCG", color = "#ED1B24", shortname = "",},
["Democratic Movement – United Georgia"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Democratic Movement (France)"] = {abbrev = "", color = "#EF5327", shortname = "MoDem",},
["Democratic Movement (San Marino)"] = {abbrev = "MD", color = "#F80000", shortname = "",},
["Democratic Movement for Change"] = {abbrev = "", color = "#253EFE", shortname = "Dash",},
["Democratic Movement of Mozambique"] = {abbrev = "MDM", color = "#F9B63C", shortname = "",},
["Democratic Movement of Serbia"] = {abbrev = "DEPOS", color = "#1A4A96", shortname = "",},
["Democratic Municipal Action"] = {abbrev = "", color = "#FF610F", shortname = "",},
["Democratic Nasserist Party"] = {abbrev = "", color = "green", shortname = "",},
["Democratic National Alliance (Bahamas)"] = {abbrev = "DNA", color = "#419b41", shortname = "",},
["Democratic National Alliance (Sri Lanka)"] = {abbrev = "", color = "#CCCC33", shortname = "Democratic National Alliance",},
["Democratic National Assembly"] = {abbrev = "", color = "#add8e6", shortname = "",},
["Democratic National Association"] = {abbrev = "", color = "#00008B", shortname = "",},
["Democratic National Front Party"] = {abbrev = "", color = "#BA0E00", shortname = "",},
["Democratic National Front"] = {abbrev = "", color = "#EB6F53", shortname = "",},
["Democratic National Initiative"] = {abbrev = "", color = "#FF00D4", shortname = "",},
["Democratic National Party (Cyprus)"] = {abbrev = "", color = "#783B12", shortname = "",},
["Democratic National Rally"] = {abbrev = "RND", color = "#003153", shortname = "",},
["Democratic National Salvation Front"] = {abbrev = "FDSN", color = "#cc3333", shortname = "",},
["Democratic Nationalist Party (Romania)"] = {abbrev = "PND", color = "#000000", shortname = "",},
["Democratic Nationalist Party (South Korea)"] = {abbrev = "", color = "#9acd32", shortname = "Democratic Nationalist",},
["Democratic Nationalists"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Democratic Nationhood Party"] = {abbrev = "", color = "#054C30", shortname = "",},
["Democratic Network"] = {abbrev = "", color = "white", shortname = "",},
["Democratic Non-Partisan Alliance"] = {abbrev = "DNPA", color = "#FF0D6C", shortname = "",},
["Democratic New Macau Association"] = {abbrev = "", color = "#008000", shortname = "",},
["Democratic Opposition of Serbia"] = {abbrev = "DOS", color = "#C0C0C0", shortname = "",},
["Democratic Pact for Catalonia"] = {abbrev = "PDC", color = "#FFC400", shortname = "",},
["Democratic Partnership"] = {abbrev = "", color = "khaki", shortname = "",},
["Democratic Party – demokraci.pl"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Democratic Party (1912)"] = {abbrev = "", color = "#008000", shortname = "Democratic",},
["Democratic Party (1943)"] = {abbrev = "", color = "#6482BF", shortname = "",},
["Democratic Party (Argentina)"] = {abbrev = "PD", color = "#005C9E", shortname = "Democratic Party",},
["Democratic Party (Bulgaria)"] = {abbrev = "", color = "gold", shortname = "",},
["Democratic Party (Cambodia)"] = {abbrev = "", color = "#800080", shortname = "Democratic",},
["Democratic Party (Chile)"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Democratic Party (Cook Islands)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic",},
["Democratic Party (Costa Rica)"] = {abbrev = "", color = "#2136C2", shortname = "Democratic",},
["Democratic Party (Cuba)"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Democratic Party (Curaçao)"] = {abbrev = "", color = "#E41E2A", shortname = "",},
["Democratic Party (Cyprus)"] = {abbrev = "DIKO", color = "#E07C00", shortname = "",},
["Democratic Party (East Timor)"] = {abbrev = "", color = "#004080", shortname = "Democratic Party",},
["Democratic Party (Georgia)"] = {abbrev = "", color = "#8F8FBF", shortname = "",},
["Democratic Party (Hong Kong)"] = {abbrev = "", color = "#5FB04A", shortname = "Democratic",},
["Democratic Party (Indonesia)"] = {abbrev = "", color = "#2643A3", shortname = "Demokrat",},
["Democratic Party (Italy)"] = {abbrev = "", color = "#EF1C27", shortname = "Democratic Party",},
["Democratic Party (Japan, 1947)"] = {abbrev = "", color = "#FFFF00", shortname = "Democratic",},
["Democratic Party (Japan, 1954)"] = {abbrev = "", color = "#99B022", shortname = "Democratic",},
["Democratic Party (Japan, 1996)"] = {abbrev = "", color = "#E60000", shortname = "Democratic",},
["Democratic Party (Japan, 1998)"] = {abbrev = "", color = "#CE2029", shortname = "Democratic",},
["Democratic Party (Japan, 2016)"] = {abbrev = "", color = "#02217b", shortname = "Democratic",},
["Democratic Party (Kenya)"] = {abbrev = "", color = "#336600", shortname = "Democratic",},
["Democratic Party (Laos)"] = {abbrev = "", color = "#FFCD00", shortname = "",},
["Democratic Party (Luxembourg)"] = {abbrev = "DP", color = "#004A90", shortname = "",},
["Democratic Party (Malta)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic Party (Mongolia)"] = {abbrev = "DP", color = "#11479E", shortname = "",},
["Democratic Party (Montenegro)"] = {abbrev = "", color = "#09B2ED", shortname = "",},
["Democratic Party (Myanmar)"] = {abbrev = "DP", color = "#FFB00D", shortname = "",},
["Democratic Party (Nicaragua)"] = {abbrev = "", color = "#800000", shortname = "Democratic",},
["Democratic Party (Northern Cyprus)"] = {abbrev = "DP", color = "#DC241f", shortname = "",},
["Democratic Party (Peru)"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Democratic Party (Philippines)"] = {abbrev = "", color = "#1E90FF", shortname = "Democratic",},
["Democratic Party (Poland)"] = {abbrev = "SD", color = "#6495ED", shortname = "",},
["Democratic Party (Portugal)"] = {abbrev = "PD", color = "#FF69B4", shortname = "Democratic",},
["Democratic Party (Romania)"] = {abbrev = "PD", color = "#FF6633", shortname = "",},
["Democratic Party (Serbia)"] = {abbrev = "DS", color = "#FFE000", shortname = "",},
["Democratic Party (Singapore)"] = {abbrev = "DP", color = "#DD6777", shortname = "",},
["Democratic Party (Sint Eustatius)"] = {abbrev = "DP", color = "#C00000", shortname = "",},
["Democratic Party (SL)"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Party (Slovakia, 1944)"] = {abbrev = "DS", color = "#002FA7", shortname = "",},
["Democratic Party (Slovakia, 1989)"] = {abbrev = "DS", color = "#002FA7", shortname = "",},
["Democratic Party (Solomon Islands)"] = {abbrev = "", color = "#FFEB33", shortname = "Democratic Party",},
["Democratic Party (South Africa)"] = {abbrev = "DP", color = "#6699CC", shortname = "",},
["Democratic Party (South Korea, 1955)"] = {abbrev = "", color = "#000080", shortname = "Democratic",},
["Democratic Party (South Korea, 1991)"] = {abbrev = "", color = "#9ACD32", shortname = "Democratic",},
["Democratic Party (South Korea, 2000)"] = {abbrev = "", color = "#00A594", shortname = "Democratic",},
["Democratic Party (South Korea, 2005)"] = {abbrev = "", color = "#00A594", shortname = "Democratic",},
["Democratic Party (South Korea, 2008)"] = {abbrev = "", color = "#04972D", shortname = "Democratic",},
["Democratic Party (South Korea, 2011)"] = {abbrev = "", color = "#FAC71A", shortname = "",},
["Democratic Party (Sri Lanka)"] = {abbrev = "", color = "#800080", shortname = "Democratic Party",},
["Democratic Party (Switzerland)"] = {abbrev = "", color = "#0B3861", shortname = "Democrats",},
["Democratic Party (Tajikistan)"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Democratic Party (Tanzania)"] = {abbrev = "", color = "black", shortname = "",},
["Democratic Party (Turkey, 1970)"] = {abbrev = "DP", color = "#ffa500", shortname = "",},
["Democratic Party (Turkey, 1992)"] = {abbrev = "DP", color = "#341D47", shortname = "",},
["Democratic Party (Uganda)"] = {abbrev = "DP", color = "#0C713A", shortname = "",},
["Democratic Party (UK, 1942)"] = {abbrev = "", color = "lightyellow", shortname = "Democratic",},
["Democratic Party (UK, 1969)"] = {abbrev = "", color = "#ffffff", shortname = "Democratic Party",},
["Democratic Party (US)"] = {abbrev = "", color = "#3333FF", shortname = "Democratic",},
["Democratic Party (Yugoslavia)"] = {abbrev = "DS", color = "#FFD300", shortname = "",},
["Democratic Party (Zambia)"] = {abbrev = "", color = "#ff338c", shortname = "",},
["Democratic Party \"Saimnieks\""] = {abbrev = "", color = "#861623", shortname = "",},
["Democratic Party Adilet"] = {abbrev = "", color = "#0085fc", shortname = "",},
["Democratic Party for a British Gibraltar"] = {abbrev = "DPBG", color = "", shortname = "",},
["Democratic Party for the People"] = {abbrev = "", color = "#FFD700", shortname = "Democratic for the People",},
["Democratic Party of Albania"] = {abbrev = "PD", color = "#0080C6", shortname = "",},
["Democratic Party of Albanians"] = {abbrev = "PDSh", color = "black", shortname = "",},
["Democratic Party of Armenia"] = {abbrev = "", color = "#EC1B24", shortname = "",},
["Democratic Party of Artsakh"] = {abbrev = "", color = "#0072B9", shortname = "Democratic Party",},
["Democratic Party of Chile (1988)"] = {abbrev = "", color = "#000080", shortname = "",},
["Democratic Party of Equatorial Guinea"] = {abbrev = "PDGE", color = "#3051A3", shortname = "",},
["Democratic Party of Greens"] = {abbrev = "DSZ", color = "#007b33", shortname = "",},
["Democratic Party of Guinea – African Democratic Rally"] = {abbrev = "PDG-RDA", color = "#000000", shortname = "",},
["Democratic Party of India (Ambedkar)"] = {abbrev = "DPIA (A)", color = "", shortname = "",},
["Democratic Party of Iranian Kurdistan"] = {abbrev = "KDPI", color = "#FC0000", shortname = "",},
["Democratic Party of Ivory Coast – African Democratic Rally"] = {abbrev = "PDCI–RDA", color = "#0FAF32", shortname = "",},
["Democratic Party of Kazakhstan"] = {abbrev = "", color = "#01AEF3", shortname = "",},
["Democratic Party of Korea"] = {abbrev = "", color = "#004EA2", shortname = "Democratic",},
["Democratic Party of Kosovo"] = {abbrev = "PDK", color = "#2E96D2", shortname = "",},
["Democratic Party of Labour"] = {abbrev = "PDM", color = "#ED2128", shortname = "",},
["Democratic Party of Macedonians"] = {abbrev = "DPM", color = "#F7D10C", shortname = "",},
["Democratic Party of Moldova"] = {abbrev = "PDM", color = "#264B9D", shortname = "",},
["Democratic Party of Nauru"] = {abbrev = "", color = "#002B7F", shortname = "",},
["Democratic Party of Pensioners of Slovenia"] = {abbrev = "DeSUS", color = "#8DC63F", shortname = "",},
["Democratic Party of Pensioners"] = {abbrev = "", color = "grey", shortname = "",},
["Democratic Party of Republika Srpska"] = {abbrev = "", color = "blue", shortname = "",},
["Democratic Party of Russia"] = {abbrev = "DPR", color = "#DBB726", shortname = "",},
["Democratic Party of Serbia"] = {abbrev = "DSS", color = "#126180", shortname = "",},
["Democratic Party of Slovenia"] = {abbrev = "", color = "#3300B2", shortname = "",},
["Democratic Party of Socialists of Montenegro (2021)"] = {abbrev = "", color = "#6866b2", shortname = "",},
["Democratic Party of Socialists of Montenegro"] = {abbrev = "DPS", color = "#F58634", shortname = "",},
["Democratic Party of the Atlantic"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Democratic Party of the Friendly Islands"] = {abbrev = "DPFI", color = "#C20100", shortname = "",},
["Democratic Party of the Left"] = {abbrev = "", color = "#C72F35", shortname = "",},
["Democratic Party of the New Left"] = {abbrev = "", color = "#FD3C0B", shortname = "",},
["Democratic Party of the Philippines"] = {abbrev = "DPP", color = "#0054A5", shortname = "",},
["Democratic Party of Trinidad and Tobago"] = {abbrev = "DPTT", color = "#2A3A8C", shortname = "",},
["Democratic Party of Turkmenistan"] = {abbrev = "TDP", color = "#1CC858", shortname = "",},
["Democratic Party of Turks"] = {abbrev = "DPTM", color = "red", shortname = "",},
["Democratic Party of Ukraine"] = {abbrev = "DPU", color = "#025BAB", shortname = "",},
["Democratic Party of Vietnam"] = {abbrev = "", color = "#0055A4", shortname = "",},
["Democratic Party of Vojvodina Hungarians"] = {abbrev = "", color = "#5c7b59", shortname = "",},
["Democratic Party of Zagorje"] = {abbrev = "", color = "#70bd5d", shortname = "",},
["Democratic Party Sint Maarten"] = {abbrev = "DP", color = "#E31D1A", shortname = "",},
["Democratic Patriotic Alliance of Kurdistan"] = {abbrev = "DPAK", color = "#CCFF33", shortname = "",},
["Democratic Patriots' Unified Party"] = {abbrev = "", color = "#D80100", shortname = "",},
["Democratic Peace Party"] = {abbrev = "", color = "#8DB7E9", shortname = "",},
["Democratic Peasants' Party–Lupu"] = {abbrev = "", color = "#B7D749", shortname = "PȚD–Lupu",},
["Democratic People (Spain)"] = {abbrev = "", color = "#5BB829", shortname = "",},
["Democratic People's Alliance"] = {abbrev = "DNS", color = "#2B0E72", shortname = "",},
["Democratic People's Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic People's Movement"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Democratic People's Party (Ghana)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Democratic People's Party (Montenegro)"] = {abbrev = "", color = "#35469B", shortname = "",},
["Democratic People's Party (San Marino)"] = {abbrev = "PDP", color = "#0068C1", shortname = "",},
["Democratic People's Party (South Korea)"] = {abbrev = "", color = "darkblue", shortname = "",},
["Democratic People's Party (Turkey)"] = {abbrev = "DEHAP", color = "#984A03", shortname = "",},
["Democratic People's Union"] = {abbrev = "", color = "#048AEB", shortname = "",},
["Democratic People"] = {abbrev = "", color = "#5AC2C5", shortname = "",},
["Democratic Progress Party"] = {abbrev = "DGP", color = "#FF0000", shortname = "",},
["Democratic Progressive Party (Argentina)"] = {abbrev = "PDP", color = "#005C9E", shortname = "Democratic Progressive Party",},
["Democratic Progressive Party (Austria)"] = {abbrev = "DFP", color = "#FFE500", shortname = "",},
["Democratic Progressive Party (Malawi)"] = {abbrev = "DPP", color = "#1E90FF", shortname = "",},
["Democratic Progressive Party (Singapore)"] = {abbrev = "DPP", color = "#FF9900", shortname = "",},
["Democratic Progressive Party (Spain)"] = {abbrev = "", color = "#C92B7D", shortname = "Democratic",},
["Democratic Progressive Party"] = {abbrev = "DPP", color = "#1B9431", shortname = "",},
["Democratic Prosperous Macau Association"] = {abbrev = "", color = "#006400", shortname = "",},
["Democratic Rally of the Comorian People"] = {abbrev = "RDPC", color = "#FFFFFF", shortname = "",},
["Democratic Rally of the Comoros"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Democratic Rally"] = {abbrev = "DISY", color = "#1569C7", shortname = "",},
["Democratic Reform Party (Japan)"] = {abbrev = "", color = "#FF0000", shortname = "Democratic Reform",},
["Democratic Reform"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Democratic Reform Party of Muslims"] = {abbrev = "DRSM", color = "#74C365", shortname = "",},
["Democratic Reformist Party"] = {abbrev = "", color = "#D13C21", shortname = "",},
["Democratic Reforms Party (Azerbaijan)"] = {abbrev = "", color = "#333399", shortname = "",},
["Democratic Regional Union"] = {abbrev = "DPE", color = "darkorange", shortname = "",},
["Democratic Renewal (Andorra)"] = {abbrev = "", color = "orange", shortname = "",},
["Democratic Renewal of Macedonia"] = {abbrev = "", color = "#8DC73F", shortname = "",},
["Democratic Renewal Party (Benin)"] = {abbrev = "PRD", color = "#FFFA00", shortname = "",},
["Democratic Renewal Party (Cape Verde)"] = {abbrev = "", color = "#02569F", shortname = "",},
["Democratic Renewal Party (Portugal)"] = {abbrev = "", color = "#008000", shortname = "",},
["Democratic Renewal"] = {abbrev = "DIANA", color = "#007FFF", shortname = "",},
["Democratic Renovation Party (Costa Rica)"] = {abbrev = "PRD", color = "#2C93FB", shortname = "",},
["Democratic Renovation"] = {abbrev = "", color = "orange", shortname = "",},
["Democratic Republic of Timor-Leste Party"] = {abbrev = "PDRT", color = "#DE5D83", shortname = "",},
["Democratic Republican Party (South Korea)"] = {abbrev = "", color = "#835B38", shortname = "Democratic Republican",},
["Democratic Republican Union"] = {abbrev = "", color = "#feed01", shortname = "",},
["Democratic Revival"] = {abbrev = "DA", color = "darkblue", shortname = "",},
["Democratic Revolution"] = {abbrev = "", color = "#1D4C4F", shortname = "",},
["Democratic Revolutionary Alliance (Bolivia)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Democratic Revolutionary Nationalist Party"] = {abbrev = "", color = "#bb0000", shortname = "",},
["Democratic Revolutionary Party"] = {abbrev = "PRD", color = "#003F87", shortname = "",},
["Democratic Revolutionary Peoples Party"] = {abbrev = "", color = "#006400", shortname = "",},
["Democratic Rioja"] = {abbrev = "", color = "#FFFF6F", shortname = "",},
["Democratic Senate"] = {abbrev = "", color = "#DB64DB", shortname = "",},
["Democratic Serb Party (Montenegro)"] = {abbrev = "DSS", color = "Darkblue", shortname = "",},
["Democratic Social Christian Party"] = {abbrev = "", color = "#556627", shortname = "",},
["Democratic Social Justice Party"] = {abbrev = "DSJP", color = "#A91B0D", shortname = "",},
["Democratic Social Movement"] = {abbrev = "DIKKI", color = "#FF7F00", shortname = "",},
["Democratic Social Party"] = {abbrev = "PDS", color = "#0067A5", shortname = "",},
["Democratic Social-Revolutionary Party of Cuba"] = {abbrev = "", color = "#D21F1B", shortname = "",},
["Democratic Socialist Alliance (Spain)"] = {abbrev = "", color = "#EE3507", shortname = "",},
["Democratic Socialist Alliance"] = {abbrev = "", color = "#CC4E5C", shortname = "",},
["Democratic Socialist Coalition"] = {abbrev = "CSD", color = "#00BFFF", shortname = "",},
["Democratic Socialist Left"] = {abbrev = "", color = "#D2323A", shortname = "",},
["Democratic Socialist Party (Argentina)"] = {abbrev = "PSD", color = "#FF9900", shortname = "Democratic Socialist Party",},
["Democratic Socialist Party (Ireland)"] = {abbrev = "DSP", color = "#FF0099", shortname = "Democratic Socialist",},
["Democratic Socialist Party (Japan)"] = {abbrev = "", color = "#FF5050", shortname = "Democratic Socialist",},
["Democratic Socialist Party (Morocco)"] = {abbrev = "", color = "#188410", shortname = "",},
["Democratic Socialist Party (Prabodh Chandra)"] = {abbrev = "DSP(PC)", color = "#FF033E", shortname = "",},
["Democratic Socialist Party (South Korea)"] = {abbrev = "", color = "#f99", shortname = "",},
["Democratic Socialist Party of Greece"] = {abbrev = "", color = "Yellow", shortname = "",},
["Democratic Socialist Radical Party"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Socialist Unionist Party"] = {abbrev = "", color = "red", shortname = "",},
["Democratic Socialists '70"] = {abbrev = "DS'70", color = "#A21756", shortname = "",},
["Democratic Socialists of America"] = {abbrev = "", color = "#EB2128", shortname = "",},
["Democratic Society Alliance"] = {abbrev = "", color = "#74C365", shortname = "",},
["Democratic Society Party"] = {abbrev = "DTP", color = "#008000", shortname = "",},
["Democratic swaraj party"] = {abbrev = "DSP", color = "#000000", shortname = "",},
["Democratic Turkish Union of Romania"] = {abbrev = "RDTB", color = "#E30A17", shortname = "",},
["Democratic Unification Party (South Korea)"] = {abbrev = "", color = "#c93", shortname = "Democratic Unification",},
["Democratic Unification Party"] = {abbrev = "UD", color = "#FEF100", shortname = "",},
["Democratic Union (Czech Republic)"] = {abbrev = "DEU", color = "#6D051C", shortname = "",},
["Democratic Union (Greece)"] = {abbrev = "DE", color = "#FFC0CB", shortname = "",},
["Democratic Union (Greece, 1956)"] = {abbrev = "DE", color = "#FFA500", shortname = "",},
["Democratic Union (Israel)"] = {abbrev = "", color = "#029A3D", shortname = "Democratic Union",},
["Democratic Union (Italy)"] = {abbrev = "", color = "#800080", shortname = "",},
["Democratic Union (Poland)"] = {abbrev = "UD", color = "#DB812E", shortname = "",},
["Democratic Union Coalition (1996–2000)"] = {abbrev = "", color = "#074DA9", shortname = "Democratic Union",},
["Democratic Union for Integration"] = {abbrev = "BDI", color = "#344b9b", shortname = "",},
["Democratic Union for Revival"] = {abbrev = "DAK", color = "#1F2563", shortname = "",},
["Democratic Union for the Republic"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Democratic Union Movement"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Democratic Union of Albanians"] = {abbrev = "UDSH", color = "#ED3938", shortname = "",},
["Democratic Union of Catalonia"] = {abbrev = "", color = "#0053A1", shortname = "",},
["Democratic Union of Hungarians in Romania"] = {abbrev = "", color = "#15803C", shortname = "",},
["Democratic Union of Hungarians of Croatia"] = {abbrev = "DZMH", color = "#15803C", shortname = "",},
["Democratic Union of Slovakia"] = {abbrev = "DEÚS", color = "#007BA7", shortname = "",},
["Democratic Union of Slovaks and Czechs of Romania"] = {abbrev = "UDSCR", color = "#1136F2", shortname = "",},
["Democratic Union of Taiwan"] = {abbrev = "", color = "#FF9826", shortname = "Democratic Union",},
["Democratic Union of the Malian People"] = {abbrev = "", color = "#008000", shortname = "",},
["Democratic Union of the Region of Murcia"] = {abbrev = "", color = "#039C06", shortname = "",},
["Democratic Union of the Rwandan People"] = {abbrev = "", color = "#344EA3", shortname = "",},
["Democratic Union of the Vlachs of Macedonia"] = {abbrev = "DSVM", color = "", shortname = "",},
["Democratic Union of Turkish-Muslim Tatars of Romania"] = {abbrev = "RMTTDB", color = "yellow", shortname = "",},
["Democratic Union Party (Romania)"] = {abbrev = "PDU", color = "blue", shortname = "",},
["Democratic Union–Broad Centre"] = {abbrev = "", color = "#F6643D", shortname = "",},
["Democratic Unionist Party (Sudan)"] = {abbrev = "DUP", color = "#00A6EF", shortname = "",},
["Democratic Unionist Party"] = {abbrev = "DUP", color = "#D46A4C", shortname = "",},
["Democratic United National Front"] = {abbrev = "", color = "green", shortname = "",},
["Democratic United Party"] = {abbrev = "", color = "#FAC71A", shortname = "Democratic United",},
["Democratic Unity Alliance"] = {abbrev = "", color = "#F8A718", shortname = "",},
["Democratic Unity Roundtable"] = {abbrev = "MUD", color = "#0F52BA", shortname = "",},
["Democratic Way (Spain)"] = {abbrev = "", color = "#FFAE00", shortname = "",},
["Democratic Way Party"] = {abbrev = "", color = "#87a1fe", shortname = "",},
["Democratic Women's League of Germany"] = {abbrev = "", color = "#3d61d6", shortname = "",},
["Democratic-Independent Party (North Dakota)"] = {abbrev = "", color = "#66CCFF", shortname = "",},
["Democratic-People's Party"] = {abbrev = "", color = "#3333FF", shortname = "Democratic-People's",},
["Democratic-Republican (Adams)"] = {abbrev = "", color = "#68C468", shortname = "",},
["Democratic-Republican (Jackson)"] = {abbrev = "", color = "#698DC5", shortname = "",},
["Democratic-Republican (Crawford)"] = {abbrev = "", color = "#E8EE73", shortname = "",},
["Democratic-Republican Party (1844)"] = {abbrev = "", color = "#808000", shortname = "",},
["Democratic-Republican Party"] = {abbrev = "", color = "#008000", shortname = "Democratic-Republican",},
["Democratic-Social Movement (Poland)"] = {abbrev = "RDS", color = "#FAAA49", shortname = "",},
["Democratic/Country coalition"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Democratic/Hold"] = {abbrev = "", color = "#EEF6FF", shortname = "",},
["Democrats (Brazil)"] = {abbrev = "DEM", color = "#8CC63E", shortname = "",},
["Democrats (Croatia)"] = {abbrev = "", color = "#B00F1F", shortname = "",},
["Democrats (Greenland)"] = {abbrev = "", color = "#152D49", shortname = "Democrats",},
["Democrats 66"] = {abbrev = "D66", color = "#00AE41", shortname = "",},
["Democrats and Veterans"] = {abbrev = "", color = "#000000", shortname = "",},
["Democrats for a Strong Bulgaria"] = {abbrev = "DSB", color = "#02528A", shortname = "",},
["Democrats for Andorra"] = {abbrev = "DA", color = "#EA7A28", shortname = "",},
["Democrats for Responsibility, Solidarity and Tolerance"] = {abbrev = "", color = "#1A70B8", shortname = "",},
["Democrats in Norway"] = {abbrev = "", color = "#293782", shortname = "",},
["Democrats of Catalonia"] = {abbrev = "DC", color = "#1375CE", shortname = "",},
["Democrats of the Left"] = {abbrev = "", color = "#C72F35", shortname = "",},
["DEMOS (Montenegro)"] = {abbrev = "DEMOS", color = "#89CFF0", shortname = "",},
["Demos+"] = {abbrev = "", color = "#F97D19", shortname = "",},
["Demosisto"] = {abbrev = "", color = "#37C8B4", shortname = "",},
["Demosistō"] = {abbrev = "", color = "#37C8B4", shortname = "",},
["DENK (political party)"] = {abbrev = "DENK", color = "#00B7B2", shortname = "",},
["Denok Hiritar"] = {abbrev = "", color = "#FEF900", shortname = "",},
["Der Wandel"] = {abbrev = "", color = "#D32C0B", shortname = "Wandel",},
["Derekh Eretz (political faction)"] = {abbrev = "", color = "#277EE5", shortname = "",},
["Derryn Hinch's Justice Party"] = {abbrev = "", color = "#002F5D", shortname = "Justice",},
["Derwentside Independents"] = {abbrev = "", color = "#9F009F", shortname = "",},
["Derzhava (Russian party)"] = {abbrev = "", color = "#959698", shortname = "",},
["Derzhava (Ukrainian party)"] = {abbrev = "", color = "#FF0000", shortname = "Derzhava",},
["Des de Baix"] = {abbrev = "", color = "#EF7D00", shortname = "",},
["Desh Bhakt Party"] = {abbrev = "DBP", color = "#B404AE", shortname = "",},
["Desire the Right Party"] = {abbrev = "", color = "#0087DC", shortname = "Desire the Right",},
["Desiya Murpokku Dravida Kazhagam"] = {abbrev = "DMDK", color = "#FFEA19", shortname = "",},
["Destiny New Zealand"] = {abbrev = "", color = "#FFFF00", shortname = "Destiny",},
["Destour"] = {abbrev = "", color = "#7F1A03", shortname = "",},
["Destourian Movement"] = {abbrev = "", color = "RebeccaPurple", shortname = "",},
["Deutsche Mitte"] = {abbrev = "DM", color = "#284f8d", shortname = "",},
["Deutsche Rechtspartei"] = {abbrev = "", color = "blue", shortname = "",},
["Deutsche Reichspartei"] = {abbrev = "", color = "#8B4726", shortname = "",},
["Development and Peace (political party)"] = {abbrev = "", color = "#6A287E", shortname = "Flatto-Sharon",},
["Development Movement"] = {abbrev = "", color = "#8F188F", shortname = "",},
["Development/For!"] = {abbrev = "AP!", color = "#FFEC00", shortname = "",},
["Devizes Guardians"] = {abbrev = "", color = "#9A114F", shortname = "",},
["Dhivehi Rayyithunge Party"] = {abbrev = "DRP", color = "#3F89C0", shortname = "",},
["Diàleg Republicà"] = {abbrev = "", color = "#CD2E33", shortname = "",},
["Dialogue for Hungary"] = {abbrev = "PM", color = "#3CB34D", shortname = "",},
["Dialogue Party"] = {abbrev = "", color = "#D32270", shortname = "",},
["Dibyojyoti Singh Deo"] = {abbrev = "", color = "#DD4561", shortname = "",},
["Die PARTEI"] = {abbrev = "PARTEI", color = "#B5152B", shortname = "",},
["Die Urbane. Eine HipHop Partei"] = {abbrev = "du.", color = "#E66346", shortname = "",},
["DierAnimal"] = {abbrev = "", color = "#148C8B", shortname = "",},
["Dignidad Ahora"] = {abbrev = "", color = "#EC8431", shortname = "",},
["Dignity and Charity"] = {abbrev = "DM", color = "#0BC3AD", shortname = "",},
["Dignity and Truth Platform Party"] = {abbrev = "PPDA", color = "#5E0C06", shortname = "",},
["Dignity Coalition"] = {abbrev = "", color = "#3D7254", shortname = "",},
["Dignity Now!"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Dignity Party (Egypt)"] = {abbrev = "", color = "#008000", shortname = "",},
["Dikwankwetla Party of South Africa"] = {abbrev = "", color = "#4B393B", shortname = "Dikwankwetla Party",},
["Direct Democracy (Peru)"] = {abbrev = "", color = "yellow", shortname = "",},
["Direct Democracy Ireland"] = {abbrev = "", color = "#87CEFA", shortname = "Direct Democracy",},
["Direct Democracy Party of New Zealand"] = {abbrev = "", color = "#F28317", shortname = "Direct Democracy",},
["Direct Democratic Participation of Galicia"] = {abbrev = "", color = "#4FAECD", shortname = "",},
["Direction – Slovak Social Democracy"] = {abbrev = "", color = "#d82222", shortname = "Smer–SSD",},
["Dissident left-wing"] = {abbrev = "", color = "#66CC99", shortname = "Dissident Left",},
["Dixiecrat"] = {abbrev = "", color = "#FF9955", shortname = "",},
["Do not let Belgrade drown"] = {abbrev = "", color = "#276030", shortname = "",},
["Doctrinaires"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Domani Motus Liberi"] = {abbrev = "DML", color = "#039ADA", shortname = "",},
["Dominica Freedom Party"] = {abbrev = "DFP", color = "#008000", shortname = "",},
["Dominica Labour Party"] = {abbrev = "DLP", color = "#F0001C", shortname = "",},
["Dominica United People's Party"] = {abbrev = "", color = "orange", shortname = "",},
["Dominican Communist Party"] = {abbrev = "", color = "#CE2029", shortname = "",},
["Dominican Humanist Party"] = {abbrev = "", color = "#FFEF52", shortname = "",},
["Dominican Liberation Party"] = {abbrev = "PLD", color = "#870B9C", shortname = "",},
["Dominican Party"] = {abbrev = "", color = "#964B00", shortname = "",},
["Dominican Revolutionary Party"] = {abbrev = "PRD", color = "#ADD8E6", shortname = "",},
["Dominicans for Change"] = {abbrev = "", color = "#12e3ff", shortname = "",},
["Dominion Labor Party (Alberta)"] = {abbrev = "", color = "transparent", shortname = "Labor",},
["Dominion Party (South Africa)"] = {abbrev = "", color = "#50C878", shortname = "Dominion",},
["Donegal Progressive Party"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Donetsk Republic (political party)"] = {abbrev = "", color = "#005087", shortname = "",},
["Doordarshi Party"] = {abbrev = "", color = "#00FF99", shortname = "",},
["Dor (political party)"] = {abbrev = "", color = "#409199", shortname = "",},
["Dōshi Club (1900s)"] = {abbrev = "", color = "#0018ED", shortname = "",},
["Dovira (parliamentary group)"] = {abbrev = "", color = "#3B7082", shortname = "Dovira",},
["Downlands Resident Group"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Dr. A. P. J. Abdul Kalam"] = {abbrev = "", color = "#DB7099", shortname = "",},
["Drassi"] = {abbrev = "", color = "#f37021", shortname = "",},
["Dravida Munnetra Kazhagam"] = {abbrev = "DMK", color = "#DD1100", shortname = "",},
["Druk Chirwang Tshogpa"] = {abbrev = "", color = "#FCB116", shortname = "",},
["Druk Nyamrup Tshogpa"] = {abbrev = "DNT", color = "#F9C6D9", shortname = "",},
["Druk Phuensum Tshogpa"] = {abbrev = "DPT", color = "#E48400", shortname = "",},
["Dublin Trades Council"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Duma Polska"] = {abbrev = "", color = "#E04A4B", shortname = "",},
["Dutch Peoples-Union"] = {abbrev = "", color = "red", shortname = "",},
["Dveri"] = {abbrev = "", color = "#E32636", shortname = "",},
["Dynastic Left"] = {abbrev = "", color = "#5FA082", shortname = "",},
["Džemijet"] = {abbrev = "", color = "black", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
i6765qldfxlonv7p5civgwtvl503bzp
Module:Political party/G
828
68668634
1095562562
1095339854
2022-06-29T02:58:51Z
Cypp0847
29882443
General Union for the Good of Macau
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["GABRIELA Women's Party"] = "Gabriela Women's Party",
["Galician National-Popular Bloc"] = "Galician Nationalist Bloc",
["Galician Nationalist Convergence"] = "Galician Coalition",
["Galician Progressive Coalition"] = "Galician Coalition",
["Galician Workers' Party"] = "Galician Left",
["Ganatantra Parishad"] = "All India Ganatantra Parishad",
["Génération.s, le mouvement"] = "Génération.s",
["Genzei Nippon"] = "Tax Cuts Japan",
["Georgia Republican Party"] = "Republican Party (US)",
["German Minority (political party)"] = "German Minority Electoral Committee",
["German Minority"] = "German Minority Electoral Committee",
["German Reich Party"] = "Free Conservative Party",
["Girondist"] = "Girondin",
["Go Peru"] = "Let’s Go Peru",
["Golkar"] = "Golongan Karya",
["Good Choice"] = "Good Choice (Slovakia)",
["Good Party"] = "İyi Party",
["Government by the People Green Party"] = "Green Party of South Africa",
["Grand Alliance (Bangladesh)"] = "Awami League",
["Grassroots-Legalize Cannabis Party"] = "Grassroots—Legalize Cannabis Party",
["Grassroots–Legalize Cannabis Party"] = "Grassroots—Legalize Cannabis Party",
["Grassroots Party (US)"] = "Grassroots Party",
["Great Union Party"] = "Great Unity Party",
["Greek politics/party colours/Panhellenic Sociali"] = "PASOK",
["Green (political party)"] = "Groen (political party)",
["Green Alliance"] = "Green Party (Ireland)",
["Green Alliance (Ireland)"] = "Green Party (Ireland)",
["Green List (Spain)"] = "Confederation of the Greens",
["Green Mountain Peace and Justice"] = "Green Mountain Peace and Justice Party",
["Green Movement (Israel)"] = "Green Party (Israel)",
["Green Party - Save Our Green Space"] = "Green Party of England and Wales",
["Green Party (Colombia)"] = "Green Alliance (Colombia)",
["Green Party (United States)"] = "Green Party (US)",
["Green Party in Northern Ireland"] = "Green Party Northern Ireland",
["Green Party of Alaska"] = "Green Party (US)",
["Green Party of Arkansas"] = "Green Party (US)",
["Green Party of California"] = "Green Party (US)",
["Green Party of Colorado"] = "Green Party (US)",
["Green Party of Connecticut"] = "Green Party (US)",
["Green Party of Michigan"] = "Green Party (US)",
["Green Party of Minnesota"] = "Green Party (US)",
["Green Party of Montana"] = "Green Party (US)",
["Green Party of New York"] = "Green Party (US)",
["Green Party of Northern Ireland"] = "Green Party Northern Ireland",
["Green Party of Ohio"] = "Green Party (US)",
["Green Party of Pennsylvania"] = "Green Party (US)",
["Green Party of Texas"] = "Green Party (US)",
["Green Party (Arizona)"] = "Green Party (US)",
["Green Party (Arkansas)"] = "Green Party (US)",
["Green Party (California)"] = "Green Party (US)",
["Green Party (Colorado)"] = "Green Party (US)",
["Green Party (Connecticut)"] = "Green Party (US)",
["Green Party (Hawaii)"] = "Green Party (US)",
["Green Party (Iowa)"] = "Green Party (US)",
["Green Party (Michigan)"] = "Green Party (US)",
["Green Party (New York)"] = "Green Party (US)",
["Green Party of the United States"] = "Green Party (US)",
["Green!"] = "Groen (political party)",
["Greenback Party (United States)"] = "Greenback Party",
["GreenLeft"] = "GroenLinks",
["Greens-European Free Alliance"] = "Greens–European Free Alliance",
["Gregor Virant's Civic List"] = "Civic List (Slovenia)",
["Groen!"] = "Groen (political party)",
["Group of Independent Citizens"] = "Independent Solution",
["Group of the Alliance of Liberals and Democrats for Europe"] = "Alliance of Liberals and Democrats for Europe group",
["GSD"] = "Gibraltar Social Democrats",
["GSLP"] = "Gibraltar Socialist Labour Party",
["Guanyar Alacant"] = "Acord Ciutadà",
["Guanyar Alcoi"] = "Acord Ciutadà",
["Guanyem Sant Josep de sa Talaia"] = "Guanyem Eivissa",
["Guanyem Santa Eulària des Riu"] = "Guanyem Eivissa",
["Guatemalan Republican Front"] = "Institutional Republican Party",
["Gwlad - The Welsh Independence Party"] = "Gwlad",
}
local full = {
["G17 Plus"] = {abbrev = "", color = "#545AA7", shortname = "",},
["G99"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Democratic and Social Union"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Democratic Bloc"] = {abbrev = "", color = "#008800", shortname = "",},
["Gabonese Democratic Party"] = {abbrev = "PDG", color = "#006533", shortname = "",},
["Gabonese Progress Party"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Socialist Party"] = {abbrev = "", color = "red", shortname = "",},
["Gabonese Socialist Union"] = {abbrev = "", color = "red", shortname = "",},
["Gabriela Women's Party"] = {abbrev = "", color = "#800080", shortname = "Gabriela",},
["Gabungan Parti Sarawak"] = {abbrev = "GPS", color = "#FF6060", shortname = "",},
["Gabungan Rakyat Sabah"] = {abbrev = "GRS", color = "#031e61", shortname = "",},
["Gagasan Sejahtera"] = {abbrev = "", color = "#008800", shortname = "",},
["Gahal"] = {abbrev = "", color = "#143997", shortname = "",},
["Galeusca–Peoples of Europe"] = {abbrev = "", color = "#2C3294", shortname = "Galeusca",},
["Galicia en Común"] = {abbrev = "", color = "#5D2C75", shortname = "Podemos–EU–Anova",},
["Galicia New Way"] = {abbrev = "", color = "#6FA7B6", shortname = "",},
["Galicia Sempre"] = {abbrev = "", color = "#8EC81E", shortname = "",},
["Galician Alternative"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Galician Coalition"] = {abbrev = "CG", color = "#002C9C", shortname = "",},
["Galician Convergence"] = {abbrev = "", color = "#087608", shortname = "",},
["Galician Democracy"] = {abbrev = "", color = "#81DAF5", shortname = "",},
["Galician Democratic Candidacy"] = {abbrev = "", color = "#15EAEA", shortname = "",},
["Galician Democratic Party"] = {abbrev = "", color = "#20ACE1", shortname = "",},
["Galician Identity"] = {abbrev = "", color = "#0579FC", shortname = "",},
["Galician Initiative"] = {abbrev = "", color = "#D54D13", shortname = "",},
["Galician Left Alternative"] = {abbrev = "AGE", color = "#62A3CA", shortname = "",},
["Galician Left"] = {abbrev = "EG", color = "#522998", shortname = "",},
["Galician Movement for Socialism"] = {abbrev = "", color = "#003F77", shortname = "",},
["Galician Nationalist Bloc"] = {abbrev = "BNG", color = "#ADCFEF", shortname = "",},
["Galician Nationalist Group of Narón"] = {abbrev = "", color = "#AA4CAA", shortname = "",},
["Galician Nationalist Party–Galicianist Party"] = {abbrev = "", color = "#639E00", shortname = "",},
["Galician Party of the Country"] = {abbrev = "", color = "#66BB66", shortname = "",},
["Galician People's Front"] = {abbrev = "", color = "#3920DE", shortname = "",},
["Galician People's Union"] = {abbrev = "", color = "#CF1B15", shortname = "",},
["Galician Progressive Democracy"] = {abbrev = "", color = "#C66900", shortname = "",},
["Galician Socialist Party (1963)"] = {abbrev = "", color = "#D73D2A", shortname = "",},
["Galician Socialist Party–Galician Left"] = {abbrev = "PSG–EG", color = "#2AAC24", shortname = "",},
["Galician Socialist Space"] = {abbrev = "", color = "#28AC90", shortname = "",},
["Galician Socialist Unity"] = {abbrev = "", color = "#FF3300", shortname = "",},
["Galician Unity"] = {abbrev = "", color = "#00CCF1", shortname = "",},
["Galician Workers' Front"] = {abbrev = "", color = "#3B96BB", shortname = "",},
["Galicianist Party (1931)"] = {abbrev = "", color = "#57ABB3", shortname = "",},
["Galicianist Party (1978)"] = {abbrev = "", color = "#E46D2B", shortname = "",},
["Galicianist Party–Centrists of Orense"] = {abbrev = "", color = "#986968", shortname = "",},
["Galicianist Party–Convergence of Independents of Galicia"] = {abbrev = "", color = "#726887", shortname = "",},
["Galiza Ceibe"] = {abbrev = "", color = "#29AEEF", shortname = "",},
["Gamacists"] = {abbrev = "", color = "#599F25", shortname = "",},
["Gambela People's Democratic Movement"] = {abbrev = "", color = "#AC1538", shortname = "",},
["Gambia Democratic Congress"] = {abbrev = "GDC", color = "#771C7C", shortname = "",},
["Gambia Party for Democracy and Progress"] = {abbrev = "", color = "#FB7F00", shortname = "",},
["Gamonie i Krasnoludki"] = {abbrev = "", color = "orange", shortname = "",},
["Gana Fuerteventura"] = {abbrev = "", color = "#FFC000", shortname = "",},
["Gana Suraksha Party"] = {abbrev = "", color = "#E74C3C", shortname = "",},
["Gana Zamora"] = {abbrev = "", color = "#146612", shortname = "",},
["Ganar Alcorcón"] = {abbrev = "", color = "#B507A6", shortname = "",},
["Ganar Cádiz en Común"] = {abbrev = "", color = "#187669", shortname = "",},
["Ganar Fuenlabrada"] = {abbrev = "", color = "#C63903", shortname = "",},
["Ganar Humanes"] = {abbrev = "", color = "#8A64A5", shortname = "",},
["Ganar la Región de Murcia"] = {abbrev = "", color = "#BB0017", shortname = "",},
["Ganar Móstoles"] = {abbrev = "", color = "#AAB93C", shortname = "",},
["Ganar Teruel"] = {abbrev = "", color = "#A91C30", shortname = "",},
["Ganar Torrejón"] = {abbrev = "", color = "#930B71", shortname = "",},
["Gandhi Kamaraj National Congress"] = {abbrev = "", color = "#187669", shortname = "GKC",},
["Ganatantri Dal"] = {abbrev = "", color = "blue", shortname = "",},
["Ganatantri Party"] = {abbrev = "", color = "#6a9a62", shortname = "",},
["Ganemos (2015)"] = {abbrev = "", color = "#3EADB9", shortname = "",},
["Ganemos (2019)"] = {abbrev = "", color = "#C2272D", shortname = "",},
["Ganemos al Fracking"] = {abbrev = "", color = "#D3CA23", shortname = "",},
["Ganemos Albacete"] = {abbrev = "", color = "#A30A40", shortname = "",},
["Ganemos Almería Sí Se Puede"] = {abbrev = "", color = "#D7C01A", shortname = "",},
["Ganemos Avilés en Común"] = {abbrev = "", color = "#FB0000", shortname = "",},
["Ganemos Cambre"] = {abbrev = "", color = "#02460B", shortname = "",},
["Ganemos Cantabria"] = {abbrev = "", color = "#A91515", shortname = "",},
["Ganemos Castilla–La Mancha"] = {abbrev = "", color = "#CC1A4E", shortname = "",},
["Ganemos Chiclana"] = {abbrev = "", color = "#7B0C2C", shortname = "",},
["Ganemos Ciudad Real"] = {abbrev = "", color = "#AB0D14", shortname = "",},
["Ganemos Córdoba"] = {abbrev = "", color = "#18A383", shortname = "",},
["Ganemos Culleredo"] = {abbrev = "", color = "#DD2E44", shortname = "",},
["Ganemos Elche"] = {abbrev = "", color = "#CD00A3", shortname = "",},
["Ganemos Euskadi"] = {abbrev = "", color = "#BA1652", shortname = "",},
["Gañemos Galicia"] = {abbrev = "", color = "#009ACF", shortname = "",},
["Ganemos Jerez"] = {abbrev = "", color = "#00BEB1", shortname = "",},
["Ganemos Madrid"] = {abbrev = "", color = "#009DBC", shortname = "",},
["Ganemos Orihuela"] = {abbrev = "", color = "#D83927", shortname = "",},
["Ganemos País Valencià"] = {abbrev = "", color = "#613041", shortname = "",},
["Ganemos Palencia"] = {abbrev = "", color = "#795EAC", shortname = "",},
["Ganemos Pinto"] = {abbrev = "", color = "#69388A", shortname = "",},
["Ganemos Ronda"] = {abbrev = "", color = "#8D1F20", shortname = "",},
["Ganemos Salamanca"] = {abbrev = "", color = "#9F3122", shortname = "",},
["Ganemos Santander Sí Puede"] = {abbrev = "", color = "#7F286D", shortname = "",},
["Ganemos Sevilla"] = {abbrev = "", color = "#0C7C18", shortname = "",},
["Ganemos Talavera"] = {abbrev = "", color = "#00679C", shortname = "",},
["Ganemos Toledo"] = {abbrev = "", color = "#32A59A", shortname = "",},
["Gañemos Vigo"] = {abbrev = "", color = "#D3122C", shortname = "",},
["Gano Azadi League"] = {abbrev = "GAL", color = "#BFAC00", shortname = "",},
["Gano Forum"] = {abbrev = "", color = "#47C187", shortname = "",},
["Gano Front"] = {abbrev = "", color = "#64a470", shortname = "",},
["Garforth and Swillington Independents"] = {abbrev = "", color = "#52F72E", shortname = "",},
["Garib Raj Party"] = {abbrev = "GRP", color = "#e7d18b", shortname = "",},
["Garo National Council"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Garuda Party"] = {abbrev = "", color = "#B3282B", shortname = "",},
["Gastoria VG"] = {abbrev = "", color = "#F29301", shortname = "",},
["Gaumee Itthihaad"] = {abbrev = "GIP", color = "#00A651", shortname = "",},
["Gay Party"] = {abbrev = "", color = "#562E75", shortname = "",},
["Gazankulu Liberation Congress"] = {abbrev = "", color = "#E9F294", shortname = "",},
["General Elderly Alliance"] = {abbrev = "AOV", color = "#972C95", shortname = "",},
["General Electoral League"] = {abbrev = "", color = "#00529C", shortname = "Electoral League",},
["General League of Roman Catholic Caucuses"] = {abbrev = "ABRKK", color = "#000000", shortname = "",},
["General Liberation and Development Party"] = {abbrev = "", color = "#F5D313", shortname = "",},
["General People's Congress (Yemen)"] = {abbrev = "GPC", color = "#FFCD00", shortname = "",},
["General Popular Radical Union"] = {abbrev = "GLRE", color = "grey", shortname = "",},
["General Union for the Good of Macau"] = {abbrev = "UBM", color = "#800080", shortname = "",},
["General Union of Neighbourhood Associations of Macau"] = {abbrev = "", color = "#183B7D", shortname = "",},
["General Union Party"] = {abbrev = "PUGEN", color = "#DAA520", shortname = "",},
["General Water Board Party"] = {abbrev = "AWP", color = "#021373", shortname = "",},
["General Zionists"] = {abbrev = "", color = "#12B6CF", shortname = "",},
["Generation Citizens"] = {abbrev = "", color = "#312883", shortname = "",},
["Generation for a National Encounter"] = {abbrev = "", color = "#E9242B", shortname = "",},
["Generation of Independence Party (Armenia)"] = {abbrev = "", color = "#FFCB00", shortname = "",},
["Génération.s"] = {abbrev = "G.s", color = "#CC1E54", shortname = "",},
["Geneva Citizens' Movement"] = {abbrev = "", color = "#FEE801", shortname = "Geneva Citizens'",},
["Gent de Canals"] = {abbrev = "", color = "#514D30", shortname = "",},
["Gent de Dénia"] = {abbrev = "", color = "#3CA48D", shortname = "",},
["Gent de Gramenet"] = {abbrev = "", color = "#D9951C", shortname = "",},
["Gent per Ciutadella"] = {abbrev = "", color = "#C50D1E", shortname = "",},
["Gent per Eivissa"] = {abbrev = "", color = "#04877D", shortname = "",},
["Gent per Formentera"] = {abbrev = "", color = "#96104E", shortname = "",},
["Gent per Santa María"] = {abbrev = "", color = "#FFF509", shortname = "",},
["Gente del Pueblo"] = {abbrev = "", color = "#6EA4B9", shortname = "",},
["Genuine Opposition"] = {abbrev = "GO", color = "#ffa500", shortname = "",},
["Genuine Republican Party"] = {abbrev = "", color = "#FFA500", shortname = "",},
["George's Day Movement"] = {abbrev = "", color = "#EEB600", shortname = "",},
["Georgian Dream"] = {abbrev = "", color = "#27509C", shortname = "",},
["Georgian Labour Party"] = {abbrev = "SLP", color = "#346FAB", shortname = "",},
["Georgian Socialist-Federalist Revolutionary Party"] = {abbrev = "SSPSP", color = "#483D8B", shortname = "",},
["Georgian Troupe"] = {abbrev = "", color = "red", shortname = "",},
["Georgios Papandreou Party"] = {abbrev = "KGP", color = "khaki", shortname = "",},
["GERB"] = {abbrev = "", color = "#0054A6", shortname = "",},
["German Agrarian League"] = {abbrev = "", color = "#008B45", shortname = "",},
["German Centre"] = {abbrev = "", color = "#005397", shortname = "",},
["German Christian Social People's Party"] = {abbrev = "DCVP", color = "#AA98A9", shortname = "",},
["German Communist Party"] = {abbrev = "DKP", color = "#ED1C24", shortname = "",},
["German Conservative Party"] = {abbrev = "DKP", color = "#000080", shortname = "",},
["German Democratic Party"] = {abbrev = "DDP", color = "#FFCC00", shortname = "",},
["German Electoral Coalition"] = {abbrev = "", color = "#00693E", shortname = "German Coalition",},
["German Farmers' Party"] = {abbrev = "", color = "#007A00", shortname = "",},
["German Free-minded Party"] = {abbrev = "DFP", color = "#FFD800", shortname = "",},
["German Minority Electoral Committee"] = {abbrev = "KWMN", color = "#237FC2", shortname = "",},
["German National People's Party"] = {abbrev = "DNVP", color = "#63B8FF", shortname = "",},
["German National Socialist Workers' Party"] = {abbrev = "DNSAP", color = "#8A3324", shortname = "",},
["German Party (1947)"] = {abbrev = "DP", color = "#63B8FF", shortname = "",},
["German Party (Romania)"] = {abbrev = "DPR", color = "black", shortname = "",},
["German Party"] = {abbrev = "", color = "#63B8FF", shortname = "",},
["German People's Party (1868)"] = {abbrev = "", color = "#FFAB00", shortname = "",},
["German People's Party (Austria)"] = {abbrev = "DVP", color = "#63C3D0", shortname = "",},
["German People's Party"] = {abbrev = "DVP", color = "#1874CD", shortname = "",},
["German People's Union"] = {abbrev = "DVU", color = "#AA4422", shortname = "",},
["German Pirate Party"] = {abbrev = "", color = "#FF820A", shortname = "Pirates",},
["German Progress Party (Austria)"] = {abbrev = "DSP", color = "#EEEEEE", shortname = "",},
["German Progress Party"] = {abbrev = "DFP", color = "#FFD700", shortname = "",},
["German Social Democratic Workers' Party in the Czechoslovak Republic"] = {abbrev = "DSAP", color = "#FA5A42", shortname = "",},
["German Social Party (Weimar Republic)"] = {abbrev = "", color = "#A46A44", shortname = "",},
["German Social Union (East Germany)"] = {abbrev = "DSU", color = "#6495ED", shortname = "",},
["German State Party"] = {abbrev = "DStP", color = "#63B8FF", shortname = "",},
["German Völkisch Freedom Party"] = {abbrev = "", color = "black", shortname = "",},
["German-Hanoverian Party"] = {abbrev = "DHP", color = "#AADE87", shortname = "",},
["German-National Party"] = {abbrev = "DNP", color = "#63B8FF", shortname = "",},
["Geroa Bai"] = {abbrev = "GBai", color = "#F75E42", shortname = "",},
["Geroa Socialverdes"] = {abbrev = "", color = "#6B8F36", shortname = "",},
["Gesher (2019 political party)"] = {abbrev = "", color = "#ED0963", shortname = "",},
["Gesher"] = {abbrev = "", color = "#252CAE", shortname = "",},
["Getxoko Udal Kandidatura"] = {abbrev = "", color = "#622D63", shortname = "",},
["Ghana Freedom Party"] = {abbrev = "", color = "#094715", shortname = "",},
["Ghana Union Movement"] = {abbrev = "", color = "#8B0021", shortname = "",},
["Ghibellines"] = {abbrev = "", color = "#E34234", shortname = "",},
["Gibraltar National Party"] = {abbrev = "", color = "#DF424D", shortname = "National",},
["Gibraltar Social Democrats"] = {abbrev = "", color = "#0A5BA6", shortname = "Social Democrats",},
["Gibraltar Socialist Labour Party"] = {abbrev = "", color = "#D20D13", shortname = "Socialist Labour",},
["Gijonese Unity"] = {abbrev = "", color = "#8D6E63", shortname = "",},
["Girchi - More Freedom"] = {abbrev = "", color = "#359239", shortname = "",},
["Girondin"] = {abbrev = "", color = "#6082B6", shortname = "",},
["Glasgow First"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Go on Country – Social Integration Party"] = {abbrev = "", color = "#E62171", shortname = "Go on Country",},
["Go on Country"] = {abbrev = "", color = "#E62171", shortname = "",},
["Goa Forward Party"] = {abbrev = "GFP", color = "#353982", shortname = "",},
["Goa Rajiv Congress Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Goa Suraksha Manch"] = {abbrev = "", color = "#E1A95F", shortname = "",},
["Goa Vikas Party"] = {abbrev = "", color = "orange", shortname = "",},
["Goazen Bilbao"] = {abbrev = "", color = "#B90DBB", shortname = "",},
["Golden Dawn (Greece)"] = {abbrev = "ΧΑ", color = "#00022D", shortname = "",},
["Golden Dawn"] = {abbrev = "", color = "black", shortname = "",},
["Golden India Party"] = {abbrev = "", color = "#330000", shortname = "",},
["Golongan Karya"] = {abbrev = "", color = "#FFFF00", shortname = "Golkar",},
["Gomera Group of Independents"] = {abbrev = "", color = "#0C1C94", shortname = "",},
["Gomera Socialist Group"] = {abbrev = "ASG", color = "#B61414", shortname = "",},
["Gondwana Ganatantra Party"] = {abbrev = "GGP", color = "purple", shortname = "",},
["Good (political party)"] = {abbrev = "", color = "#F36900", shortname = "Good",},
["Good Choice (Slovakia)"] = {abbrev = "", color = "#FF002B", shortname = "",},
["Good Governance Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Good Old Democratic Party"] = {abbrev = "", color = "#365476", shortname = "",},
["Good State (Slovenia)"] = {abbrev = "", color = "#015F9C", shortname = "",},
["Gorkha Janmukti Morcha (G)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Gorkha Janmukti Morcha (T)"] = {abbrev = "", color = "#FF2561", shortname = "",},
["Gorkha Janmukti Morcha"] = {abbrev = "GJM", color = "#52D017", shortname = "",},
["Gorkha National Liberation Front"] = {abbrev = "GNLF", color = "#347C17", shortname = "",},
["Gorkha Rashtriya Congress"] = {abbrev = "GRC", color = "#FF0130", shortname = "",},
["Gorkhaland Rajya Nirman Morcha"] = {abbrev = "", color = "#FF0274", shortname = "",},
["Gorran Movement"] = {abbrev = "", color = "#1F1C50", shortname = "Gorran",},
["Government Disciplined Services General Union"] = {abbrev = "", color = "#0000CC", shortname = "",},
["Government of South Korea"] = {abbrev = "", color = "#003865", shortname = "",},
["Government"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Governors of British Ceylon"] = {abbrev = "", color = "#000000", shortname = "",},
["Granada Truth and Democracy"] = {abbrev = "", color = "#E5349E", shortname = "",},
["Grand Alliance for Democracy"] = {abbrev = "GAD", color = "#4169E1", shortname = "",},
["Grand Alliance for National Unity"] = {abbrev = "GANA", color = "#13C3C6", shortname = "",},
["Grand Democratic Alliance"] = {abbrev = "GDA", color = "#199153", shortname = "",},
["Grand National Alliance (Dominican Republic)"] = {abbrev = "", color = "#F88379", shortname = "",},
["Grand National Alliance (Guatemala)"] = {abbrev = "GANA", color = "#0047AB", shortname = "",},
["Grand National Party"] = {abbrev = "", color = "#0095D9", shortname = "Grand National",},
["Grand Slam"] = {abbrev = "", color = "#f3e6d7", shortname = "",},
["Grand Unified Democratic New Party"] = {abbrev = "", color = "#FF8200", shortname = "Grand Unified Democratic New",},
["Grassroots Democratic Party of Germany"] = {abbrev = "", color = "#4AA79D", shortname = "dieBasis",},
["Grassroots—Legalize Cannabis Party"] = {abbrev = "", color = "#50C878", shortname = "Grassroots—LC",},
["Grassroots Party"] = {abbrev = "", color = "#50C878", shortname = "Grassroots",},
["Grau Unit"] = {abbrev = "", color = "#078930", shortname = "",},
["Great Consolidated Popular Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Great Fatherland Party"] = {abbrev = "", color = "#B00000", shortname = "Great Fatherland",},
["Great Indonesia Movement Party"] = {abbrev = "", color = "#B79164", shortname = "Gerindra",},
["Great Indonesia Unity Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Great Nigeria People's Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Great North"] = {abbrev = "", color = "#0045AA", shortname = "",},
["Great Order Party"] = {abbrev = "", color = "#ff101a", shortname = "",},
["Great Patriotic Pole"] = {abbrev = "GPP", color = "#F0001C", shortname = "",},
["Great Renewed National Alliance"] = {abbrev = "", color = "orange", shortname = "",},
["Great Unity Party"] = {abbrev = "BBP", color = "#CC5252", shortname = "",},
["Greater Dunedin"] = {abbrev = "", color = "#2690C4", shortname = "",},
["Greater German People's Party"] = {abbrev = "GDVP", color = "#5566CC", shortname = "",},
["Greater Moldova Party"] = {abbrev = "", color = "purple", shortname = "",},
["Greater Romania Party"] = {abbrev = "PRM", color = "#0258A4", shortname = "",},
["Greek Ecologists"] = {abbrev = "EO", color = "aquamarine", shortname = "",},
["Greek Radical Movement"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Greek Rally"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Greek Socialist Party"] = {abbrev = "ESK", color = "#FF7F50", shortname = "",},
["Greek Solution"] = {abbrev = "EL", color = "#5493ce", shortname = "",},
["Greeks for the Fatherland"] = {abbrev = "", color = "#124285", shortname = "",},
["Green Actions"] = {abbrev = "", color = "#4A7729", shortname = "",},
["Green Algeria Alliance"] = {abbrev = "", color = "#009900", shortname = "Green Alliance",},
["Green Alliance (Colombia)"] = {abbrev = "", color = "#07d400", shortname = "Green Alliance",},
["Green Alliance (Russia)"] = {abbrev = "", color = "#64A20C", shortname = "",},
["Green Alliance (Spain)"] = {abbrev = "", color = "#57AC48", shortname = "",},
["Green Alliance (Switzerland)"] = {abbrev = "", color = "#11BB44", shortname = "Green Alliance",},
["Green Alternative (Russia)"] = {abbrev = "", color = "#00A200", shortname = "",},
["Green Alternative–Ecologist Movement of Catalonia"] = {abbrev = "", color = "#009966", shortname = "",},
["Green and Liberal Alliance"] = {abbrev = "", color = "#99FF66", shortname = "",},
["Green and Red Canaries"] = {abbrev = "", color = "#CADC0B", shortname = "",},
["Green Assembly"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Breeze Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Coalition–Citizen Europe"] = {abbrev = "", color = "#099E40", shortname = "",},
["Green Confederation"] = {abbrev = "", color = "#61BC5F", shortname = "",},
["Green Ecologist Party (Chile)"] = {abbrev = "", color = "#03BF00", shortname = "Green",},
["Green Europe"] = {abbrev = "", color = "#54C160", shortname = "",},
["Green Humane City"] = {abbrev = "", color = "#059948", shortname = "",},
["Green independents"] = {abbrev = "", color = "#10C25B", shortname = "Ind. Green",},
["Green League"] = {abbrev = "", color = "#61BF1A", shortname = "",},
["Green Left Party (Morocco)"] = {abbrev = "", color = "green", shortname = "",},
["Green Left–Initiative for the Valencian Country"] = {abbrev = "", color = "#00A354", shortname = "",},
["Green Liberal Party of Switzerland"] = {abbrev = "", color = "#A6CF42", shortname = "Green Liberals",},
["Green List Ecological Initiative"] = {abbrev = "", color = "#8DB600", shortname = "",},
["Green List"] = {abbrev = "", color = "green", shortname = "",},
["Green Mountain Peace and Justice Party"] = {abbrev = "", color = "#D6FF33", shortname = "Green Mountain Peace and Justice",},
["Green Melilla Platform"] = {abbrev = "", color = "#9CFE67", shortname = "",},
["Green North Regional Force"] = {abbrev = "", color = "#32A12A", shortname = "",},
["Green Party (Brazil)"] = {abbrev = "PV", color = "#006600", shortname = "",},
["Green Party (Czech Republic)"] = {abbrev = "SZ", color = "#60B44C", shortname = "",},
["Green Party (Dominican Republic)"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Party (Ireland)"] = {abbrev = "GP", color = "#22AC6F", shortname = "Green",},
["Green Party (Israel)"] = {abbrev = "", color = "#59E059", shortname = "",},
["Green Party (Norway)"] = {abbrev = "", color = "#6A9325", shortname = "Green",},
["Green Party (Romania)"] = {abbrev = "", color = "#198A3A", shortname = "",},
["Green Party (Serbia)"] = {abbrev = "", color = "#016830", shortname = "",},
["Green Party (Slovakia)"] = {abbrev = "SZ", color = "#00FF00", shortname = "",},
["Green Party (Sweden)"] = {abbrev = "MP", color = "#53A045", shortname = "Green",},
["Green Party (Trinidad and Tobago)"] = {abbrev = "", color = "#377D22", shortname = "Green",},
["Green Party (Turkey)"] = {abbrev = "", color = "#009245", shortname = "",},
["Green Party (UK)"] = {abbrev = "GPUK", color = "#528D6B", shortname = "Green",},
["Green Party (US)"] = {abbrev = "", color = "#17aa5c", shortname = "Green",},
["Green Party for Progress"] = {abbrev = "", color = "#8CD901", shortname = "",},
["Green Party Korea"] = {abbrev = "", color = "#59B224", shortname = "Green",},
["Green Party Northern Ireland"] = {abbrev = "", color = "#8dc63f", shortname = "Green (NI)",},
["Green Party of Albania"] = {abbrev = "", color = "green", shortname = "",},
["Green Party of Aotearoa New Zealand"] = {abbrev = "", color = "#098137", shortname = "Green",},
["Green Party of Bulgaria"] = {abbrev = "", color = "#337E2C", shortname = "",},
["Green Party of England and Wales"] = {abbrev = "", color = "#6AB023", shortname = "Green",},
["Green Party of Georgia"] = {abbrev = "", color = "#26884A", shortname = "Green Party",},
["Green Party of Hong Kong"] = {abbrev = "", color = "#64aa4b", shortname = "Green",},
["Green Party of South Africa"] = {abbrev = "", color = "green", shortname = "Green Party",},
["Green Party of Switzerland"] = {abbrev = "", color = "#84B414", shortname = "Greens",},
["Green Party Taiwan"] = {abbrev = "", color = "#3AB483", shortname = "Green",},
["Green Progressive Accord"] = {abbrev = "GPA", color = "#76EE00", shortname = "",},
["Green Regionalist Coalition"] = {abbrev = "", color = "#008000", shortname = "",},
["Green Socialist Party"] = {abbrev = "", color = "green", shortname = "",},
["Green Society"] = {abbrev = "", color = "#74B249", shortname = "",},
["Green Tunisia Party"] = {abbrev = "", color = "green", shortname = "",},
["Green Wind"] = {abbrev = "", color = "green", shortname = "",},
["Green-Rainbow Party"] = {abbrev = "", color = "#17aa5c", shortname = "Green-Rainbow",},
["Green–Left Coalition"] = {abbrev = "", color = "#B31224", shortname = "",},
["Green"] = {abbrev = "", color = "#99CC33", shortname = "Greens",},
["Greenback Party"] = {abbrev = "", color = "#0BDA51", shortname = "Greenback",},
["Greens – Solidarity"] = {abbrev = "", color = "#32cd32", shortname = "Greens",},
["Greens (South Tyrol)"] = {abbrev = "", color = "#6B8E23", shortname = "",},
["Greens (Ukraine)"] = {abbrev = "", color = "#228B22", shortname = "Greens",},
["Greens and Castilians"] = {abbrev = "", color = "#5A9C30", shortname = "",},
["Greens and Eco-pacifists"] = {abbrev = "", color = "#36A119", shortname = "",},
["Greens Equo of the Valencian Country"] = {abbrev = "", color = "#36A119", shortname = "",},
["Greens Equo"] = {abbrev = "", color = "#46922B", shortname = "",},
["Greens Japan"] = {abbrev = "", color = "#52af45", shortname = "Greens",},
["Greens New South Wales"] = {abbrev = "", color = "#10C25B", shortname = "Greens",},
["Greens of Andorra"] = {abbrev = "Vd'A", color = "#ADFF2F", shortname = "",},
["Greens of Bosnia and Herzegovina"] = {abbrev = "", color = "green", shortname = "",},
["Greens of Burkina"] = {abbrev = "", color = "green", shortname = "",},
["Greens of Serbia"] = {abbrev = "ZS", color = "#059649", shortname = "",},
["Greens of Slovenia"] = {abbrev = "", color = "green", shortname = "",},
["Greens Party of Mozambique"] = {abbrev = "", color = "#64BC44", shortname = "",},
["Greens–European Free Alliance"] = {abbrev = "", color = "#57B45F", shortname = "Greens/EFA",},
["Grenada National Party"] = {abbrev = "", color = "green", shortname = "",},
["Grenada Renaissance Party"] = {abbrev = "", color = "#4BACC6", shortname = "",},
["Grenada United Labour Party"] = {abbrev = "", color = "#D50000", shortname = "",},
["Groen (political party)"] = {abbrev = "", color = "#01796F", shortname = "Groen",},
["GroenLinks"] = {abbrev = "GL", color = "#83BD00", shortname = "",},
["Group and Union for the Progress of Almeria"] = {abbrev = "", color = "#005121", shortname = "",},
["Group for La Laguna"] = {abbrev = "", color = "#9F2362", shortname = "",},
["Group of 89"] = {abbrev = "", color = "#0d3b68", shortname = "",},
["Group of Independents of Marratxí"] = {abbrev = "", color = "#6E7096", shortname = "",},
["Group of Independents, Progressives and Nationalists"] = {abbrev = "", color = "#F8C902", shortname = "",},
["Group of Transylvanian Saxons"] = {abbrev = "GST", color = "black", shortname = "",},
["Group Otten"] = {abbrev = "GO", color = "#FAE704", shortname = "",},
["Grouped Independent Neighbors"] = {abbrev = "", color = "#ECD060", shortname = "",},
["Grouped Independents of Ponferrada"] = {abbrev = "", color = "#F78513", shortname = "",},
["Grouped Rural Citizens"] = {abbrev = "", color = "#52CA6B", shortname = "",},
["Grouping to the Service of the Republic"] = {abbrev = "", color = "#6B1F7C", shortname = "",},
["Grup Independent de Son Carrió"] = {abbrev = "", color = "#E46668", shortname = "",},
["Grupo Común da Esquerda"] = {abbrev = "", color = "#6D52C1", shortname = "",},
["GSLP–Liberal Alliance"] = {abbrev = "", color = "#D20D13", shortname = "Alliance",},
["Guadeloupe Communist Party"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Guanyant Torrent"] = {abbrev = "", color = "#9A297E", shortname = "",},
["Guanyem Badalona–Badalona En Comú"] = {abbrev = "", color = "#D51D50", shortname = "",},
["Guanyem Catalunya (2020)"] = {abbrev = "", color = "#ED174B", shortname = "",},
["Guanyem Catalunya"] = {abbrev = "", color = "#9F1B3F", shortname = "",},
["Guanyem Eivissa"] = {abbrev = "", color = "#940000", shortname = "",},
["Guanyem Gandia"] = {abbrev = "", color = "#EE1F25", shortname = "",},
["Guanyem Girona"] = {abbrev = "", color = "#B41062", shortname = "",},
["Guanyem L'Hospitalet"] = {abbrev = "", color = "#7B0012", shortname = "",},
["Guanyem les Illes Balears"] = {abbrev = "", color = "#BD0E15", shortname = "",},
["Guanyem Sabadell"] = {abbrev = "", color = "#91030F", shortname = "",},
["Guanyem Tarragona"] = {abbrev = "", color = "#F93620", shortname = "",},
["Guanyem–L'Esquerra Unitària"] = {abbrev = "", color = "#D42B15", shortname = "",},
["Guasú Front"] = {abbrev = "", color = "#BA55D3", shortname = "",},
["Guatemalan Christian Democracy"] = {abbrev = "DCG", color = "#046637", shortname = "",},
["Guatemalan National Revolutionary Unity"] = {abbrev = "URNG", color = "#D79E2D", shortname = "",},
["Guatemalan Party of Labour"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Guelphs"] = {abbrev = "", color = "#000000", shortname = "",},
["Guianese Socialist Party"] = {abbrev = "PSG", color = "#EA8B9B", shortname = "",},
["Guildford Greenbelt Group"] = {abbrev = "GGG", color = "#006633", shortname = "",},
["Guinea for All"] = {abbrev = "", color = "#299D58", shortname = "",},
["Guinean Patriotic Union"] = {abbrev = "", color = "#2C2F74", shortname = "",},
["Gujarat Parivartan Party"] = {abbrev = "GPP", color = "#FADA5E", shortname = "",},
["Gure Aukera"] = {abbrev = "", color = "#DB005F", shortname = "",},
["Guxo"] = {abbrev = "", color = "#14B0A7", shortname = "",},
["Guyana Action Party"] = {abbrev = "", color = "red", shortname = "",},
["Gwlad Gwlad"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Gwlad"] = {abbrev = "", color = "#FF8000", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
6iuk5tfqd6zlrurrnlxlnp2isc9vr7r
Module:Political party/I
828
68669279
1095788817
1094813086
2022-06-30T11:14:04Z
N Panama 84534
38274583
More accurate shade
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["ICM Party (United States)"] = "ICM Party (US)",
["ICV-EUiA"] = "Initiative for Catalonia Greens",
["ICV–EUiA"] = "Initiative for Catalonia Greens", -- dash differences
["Idaho Democratic Party"] = "Democratic Party (US)",
["Idaho Republican Party"] = "Republican Party (US)",
["IDS"] = "Istrian Democratic Assembly",
["IJI"] = "Islami Jamhoori Ittehad",
["Illinois Democratic Party"] = "Democratic Party (US)",
["Illinois Republican Party"] = "Republican Party (US)",
["INC"] = "Indian National Congress",
["Independence Party (United States)"] = "Independence Party (US)",
["Independence Party of Florida"] = "Independence Party (US)",
["Independence Party of Minnesota"] = "Independence Party (US)",
["Independence Party of New York"] = "Independence Party (US)",
["Independent (Montana)"] = "Independent (US)",
["Independent"] = "Independent politician",
["Independent (politican)"] = "Independent politician",
["Independent (politician)"] = "Independent politician",
["Independent (politics)"] = "Independent politician",
["Independent (United States)"] = "Independent (US)",
["Independent American Party of Nevada"] = "Independent American Party",
["Independent Democrat Union"] = "Independent Democratic Union",
["Independent Democrat"] = "Independent Democratic",
["Independent Democratic Party"] = "Independent Democratic",
["Independent Forward Blok"] = "Independent Forward Bloc",
["Independent Galician Party"] = "Galician Coalition",
["Independent Green Party of Virginia"] = "Independent Greens (Virginia)",
["Independent Greens of Virginia"] = "Independent Greens (Virginia)",
["Independent Group of Porto Cristo-S'illoters and Sympathizers"] = "Independent Group of Porto Cristo–S'illoters and Sympathisers",
["Independent Group of Porto Cristo–S'illoters and Sympathizers"] = "Independent Group of Porto Cristo–S'illoters and Sympathisers", -- dash differences
["Independent Labour Party (UK)"] = "Independent Labour Party",
["Independent Liberal Party"] = "Independent Liberal Party (Nicaragua)",
["Independent nationalist"] = "Independent Nationalist",
["Independent Party (Oregon)"] = "Independent (US)",
["Independent Party (United States)"] = "Independent (US)",
["Independent Party (US)"] = "Independent (US)",
["Independent Party of Connecticut"] = "Independent (US)",
["Independent Party of Delaware"] = "Independent (US)",
["Independent Party of Oregon"] = "Independent (US)",
["Independent Party of Utah"] = "Independent (US)",
["Independent Party (Delaware)"] = "Independent (US)",
["Independent Party (Florida)"] = "Independent (US)",
["Independent Party (Utah)"] = "Independent (US)",
["Independent Party"] = "Independent Party (Thailand)",
["Independent Republican (United States)"] = "Independent Republican (US)",
["Independent Republican Party (US)"] = "Independent Republican (US)",
["Independent Republican"] = "Independent Republican (US)",
["Independent Residents"] = "Independent politician",
["Independent Social Alliance Movement"] = "Independent Social Alliance",
["Independent Social Democratic Party of the Valencian Community"] = "Social Democratic Party (Spain)",
["Independent Socialist Labor"] = "Socialist Labor Party of America",
["Independent Socialist Party (Bolivia, 1944)"] = "Independent Socialist Party (Bolivia)",
["Independent Socialist Party"] = "Social Democratic Party (Spain)",
["Independent Spanish Falange"] = "Falange Española Independiente",
["Independent Union of Majorca"] = "Independent Union of Mallorca",
["Independent Union"] = "Independent Union (political party)",
["Independent unionist"] = "Independent Unionist",
["Independent-Republican Party"] = "Independent-Republicans (Minnesota)",
["Independent-Republicans of Minnesota"] = "Independent-Republicans (Minnesota)",
["Independents for Equality Movement"] = "Independents 4 Change",
["Independents of Menorca"] = "Menorcan Union",
["Independents"] = "Independent politician",
["Indhiya Jananayaka Katchi"] = "Indhiya Jananayaga Katchi",
["Indian National Congress (Socialist)"] = "Indian Congress (Socialist)",
["Indian National Congress (I)"] = "Indian National Congress (Indira)",
["Indian Congress (J)"] = "Indian National Congress (Jagjivan)",
["Indian National Congress (Organization)"] = "Indian National Congress (Organisation)",
["Indian National Congress (O)"] = "Indian National Congress (Organisation)",
["Indian National Congress (R)"] = "Indian National Congress (Requisitionists)",
["Indian National Congress (U)"] = "Indian National Congress (Urs)",
["Indian Peoples Front"] = "Indian People's Front",
["Indigenous Nationalist Party of Tripura"] = "Indigenous Nationalist Party of Twipra",
["Individual Freedom Party"] = "Libertarian Party (Spain)",
["Indonesian Democratic Party - Struggle"] = "Indonesian Democratic Party of Struggle",
["Indonesian Democratic Party – Struggle"] = "Indonesian Democratic Party of Struggle", -- dash differences
["Industrial Government Party (United States)"] = "Industrial Government Party (US)",
["Industrial Labor Party (United States)"] = "Industrial Labor Party (US)",
["Industrial Party (United States)"] = "Industrial Party (US)",
["Initiative for Catalonia Greens - United and Alternative Left"] = "Initiative for Catalonia Greens",
["Initiative for Catalonia Greens–United and Alternative Left"] = "Initiative for Catalonia Greens",
["Initiative for Catalonia"] = "Initiative for Catalonia Greens",
["Initiatives from Osaka"] = "Nippon Ishin no Kai",
["Internal Macedonian Revolutionary Organization – Democratic Party for Macedonian National Unity"] = "VMRO-DPMNE",
["Internationalist Initiative–Solidarity among Peoples"] = "The Peoples Decide",
["Internet MANA"] = "Internet Party and Mana Movement",
["Internet Party and MANA Movement"] = "Internet Party and Mana Movement",
["Iowa Democratic Party"] = "Democratic Party (US)",
["Iowa New Party"] = "Other parties",
["Irish Liberal Party"] = "Liberal Party (UK)",
["Irish Repeal"] = "Repeal Association",
["Irish Republican"] = "Republican (Ireland)",
["Irish Unionist Party"] = "Irish Unionist Alliance",
["Irish Unionist"] = "Irish Unionist Alliance",
["Islamic Group of Kurdistan"] = "Kurdistan Islamic Group",
["Island Alternative (Spain)"] = "Island Alternative",
["Italian People's Party (1994-2002)"] = "Italian People's Party (1994)",
["Italian People's Party (1994–2002)"] = "Italian People's Party (1994)", -- dash differences
["Italian Reform Socialist Party"] = "Italian Reformist Socialist Party",
["Italy in Common"] = "Italia in Comune",
["Italy. Common Good"] = "Italia. Bene Comune",
}
local full = {
["I Have Honor Alliance"] = {abbrev = "", color = "#D9222A", shortname = "",},
["I live for Serbia"] = {abbrev = "ŽZS", color = "#2A2E83", shortname = "",},
["I Noble (Independent)"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["I the South"] = {abbrev = "", color = "#0A5C8A", shortname = "",},
["Iauko Group"] = {abbrev = "", color = "#6796B2", shortname = "Iauko",},
["Iberian Natural Action"] = {abbrev = "", color = "#0A6430", shortname = "",},
["ICCSian Liberal"] = {abbrev = "", color = "#23238E", shortname = "",},
["Icelandic Movement – Living Country"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Icelandic National Front"] = {abbrev = "", color = "#3b64a6", shortname = "",},
["Icelandic Socialist Party"] = {abbrev = "", color = "#EF4839", shortname = "",},
["ICM Party (US)"] = {abbrev = "", color = "#FF4500", shortname = "",},
["ICT Energy"] = {abbrev = "", color = "#F9882A", shortname = "",},
["Ideal Democratic Party"] = {abbrev = "", color = "#009900", shortname = "",},
["Idenpedent Party"] = {abbrev = "", color = "#ff8c00", shortname = "",},
["Identity and Action"] = {abbrev = "", color = "#0045AA", shortname = "",},
["Identity and Democracy"] = {abbrev = "ID", color = "#253D79", shortname = "",},
["Identity and Democracy Party"] = {abbrev = "ID", color = "#253D79", shortname = "",},
["Identity Ireland"] = {abbrev = "", color = "#1A1A68", shortname = "",},
["Identity, Tradition, Sovereignty"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Idle Toad"] = {abbrev = "", color = "#DC143C", shortname = "",},
["If You Want It, Chile Changes"] = {abbrev = "", color = "lightblue", shortname = "",},
["Ikkjutt Jammu"] = {abbrev = "", color = "#F4C430", shortname = "",},
["Ikune"] = {abbrev = "", color = "#88868B", shortname = "",},
["Ilia Chavchavadze Society"] = {abbrev = "", color = "#FFB900", shortname = "Chavchavadze Society",},
["Ilicitans for Elche"] = {abbrev = "", color = "#4A913C", shortname = "",},
["Illankai Tamil Arasu Kachchi"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Imagina Burgos"] = {abbrev = "", color = "#ADBF2D", shortname = "",},
["Imbokodvo National Movement"] = {abbrev = "", color = "purple", shortname = "",},
["Immigration Control Platform"] = {abbrev = "", color = "#A52A2A", shortname = "Immigration Control",},
["Imperial British Conservative Party"] = {abbrev = "", color = "#00008B", shortname = "Imperial British Conservative",},
["Imperial Liberal Party"] = {abbrev = "LRP", color = "#F7B600", shortname = "",},
["Imperial Party (UK)"] = {abbrev = "", color = "purple", shortname = "Imperial",},
["Imperial Rule Assistance Association"] = {abbrev = "", color = "#CE2029", shortname = "Taisei Yokusankai",},
["Imperium Europa"] = {abbrev = "", color = "black", shortname = "",},
["Impulsa Ciudad"] = {abbrev = "", color = "#2EB7B0", shortname = "",},
["Impulsa Getafe"] = {abbrev = "", color = "#7EBD28", shortname = "",},
["IMRO – Bulgarian National Movement"] = {abbrev = "IMRO–BNM", color = "#000000", shortname = "",},
["In Black and White (Montenegro)"] = {abbrev = "CnB", color = "#812991", shortname = "",},
["In Struggle"] = {abbrev = "", color = "#E63C2C", shortname = "",},
["IND"] = {abbrev = "", color = "Magenta", shortname = "Pankaj gupta",},
["Independence for Scotland Party"] = {abbrev = "ISP", color = "#2980B9", shortname = "",},
["Independence from Europe"] = {abbrev = "", color = "#800080", shortname = "",},
["Independence Party of the Czech Republic"] = {abbrev = "SNČR", color = "#EE3135", shortname = "",},
["Independence Party - Langsum"] = {abbrev = "", color = "#0085FF", shortname = "Langsum",},
["Independence Party - Þversum"] = {abbrev = "", color = "#3399FF", shortname = "",},
["Independence Party (Alaska)"] = {abbrev = "", color = "#FFC14E", shortname = "",},
["Independence Party (Finland)"] = {abbrev = "", color = "#017BC4", shortname = "",},
["Independence Party (Florida)"] = {abbrev = "", color = "#FFC14E", shortname = "Independence",},
["Independence Party (Iceland, historical)"] = {abbrev = "", color = "#0099FF", shortname = "Independence",},
["Independence Party (Iceland)"] = {abbrev = "", color = "#00ADEF", shortname = "Independence",},
["Independence Party (Minnesota)"] = {abbrev = "", color = "#FFC14E", shortname = "Independence",},
["Independence Party (New York)"] = {abbrev = "", color = "#FFC14E", shortname = "Independence",},
["Independence Party (Puerto Rico)"] = {abbrev = "", color = "#009C4D", shortname = "Puerto Rican Independence",},
["Independence Party (US)"] = {abbrev = "", color = "#FFC14E", shortname = "Independence",},
["Independence (Israeli political party)"] = {abbrev = "", color = "#013068", shortname = "Independence",},
["Independence/Democracy"] = {abbrev = "IND/DEM", color = "#F7AF20", shortname = "",},
["Independent (Delaware)"] = {abbrev = "", color = "#DDDDBB", shortname = "",},
["Independent (India)"] = {abbrev = "", color = "#DB7099", shortname = "",},
["Independent (US)"] = {abbrev = "", color = "#DDDDBB", shortname = "Independent",},
["Independent (Vietnam)"] = {abbrev = "", color = "#FF6666", shortname = "",},
["Independent Agrarian Movement"] = {abbrev = "", color = "#DAFF61", shortname = "",},
["Independent Alliance (Ireland)"] = {abbrev = "", color = "#CCCCFF", shortname = "Independent Alliance",},
["Independent Alliance for Reform"] = {abbrev = "", color = "#E50A81", shortname = "",},
["Independent Alternative for Italians Abroad"] = {abbrev = "", color = "#FFF100", shortname = "",},
["Independent Alternative for Zas"] = {abbrev = "", color = "#A3D6E4", shortname = "",},
["Independent Alternative of Galicia"] = {abbrev = "", color = "#000000", shortname = "",},
["Independent Alternative–Progressives"] = {abbrev = "", color = "#339966", shortname = "",},
["Independent American Party"] = {abbrev = "", color = "#A356DE", shortname = "Independent American",},
["Independent and Citizen Alternative Candidacy of Sabadell"] = {abbrev = "", color = "#DEC939", shortname = "",},
["Independent Aragonese Party"] = {abbrev = "", color = "#F4B74D", shortname = "",},
["Independent Autonomists"] = {abbrev = "", color = "#EBECF0", shortname = "",},
["Independent Bloc (Bosnia and Herzegovina)"] = {abbrev = "NB", color = "#4089B6", shortname = "",},
["Independent Britwellian Residents"] = {abbrev = "", color = "pink", shortname = "Britwellian",},
["Independent Candidacy (Castile and León)"] = {abbrev = "", color = "#CC2B54", shortname = "",},
["Independent Candidacy"] = {abbrev = "", color = "#AAAAAA", shortname = "",},
["Independent Canterbury Nationalist"] = {abbrev = "", color = "#E6E6FA", shortname = "",},
["Independent Carlist"] = {abbrev = "", color = "#A3B5F1", shortname = "",},
["Independent Catalan Nationalist"] = {abbrev = "", color = "#FFF895", shortname = "",},
["Independent Catholic (Netherlands)"] = {abbrev = "", color = "#032900", shortname = "",},
["Independent Catholic"] = {abbrev = "", color = "#C2CCE7", shortname = "",},
["Independent Centre of the Canaries"] = {abbrev = "", color = "#239CA4", shortname = "",},
["Independent Citizens Movement"] = {abbrev = "", color = "#67FFFF", shortname = "",},
["Independent Citizens of Sanlúcar"] = {abbrev = "", color = "#7EC55D", shortname = "",},
["Independent Civic Organisation of South Africa"] = {abbrev = "", color = "#999999", shortname = "Independent Civic Organisation",},
["Independent Communist"] = {abbrev = "", color = "#D50000", shortname = "",},
["Independent Conservative"] = {abbrev = "", color = "#DDEEFF", shortname = "Ind. Conservative",},
["Independent Coordinator"] = {abbrev = "", color = "#094C12", shortname = "",},
["Independent democrat (Hong Kong)"] = {abbrev = "", color = "#DDDDDD", shortname = "Ind. democrat",},
["Independent Democratic Action"] = {abbrev = "ADI", color = "#ffeb00", shortname = "",},
["Independent Democratic Alternative of Ibi"] = {abbrev = "", color = "#008366", shortname = "",},
["Independent Democratic Candidacy"] = {abbrev = "", color = "#EEEE6E", shortname = "",},
["Independent Democratic Centre"] = {abbrev = "", color = "#FBB126", shortname = "",},
["Independent Democratic Conference"] = {abbrev = "IDC", color = "", shortname = "",},
["Independent Democratic Party (US)"] = {abbrev = "", color = "#6699CC", shortname = "Independent Democratic",},
["Independent Democratic Party (Yugoslavia)"] = {abbrev = "SDS", color = "#FCF342", shortname = "",},
["Independent Democratic Pole"] = {abbrev = "", color = "yellow", shortname = "",},
["Independent Democratic Serb Party"] = {abbrev = "SDSS", color = "#2D3C8C", shortname = "",},
["Independent Democratic Union (Spain)"] = {abbrev = "", color = "#2295B3", shortname = "",},
["Independent Democratic Union of Chad"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Independent Democratic Union"] = {abbrev = "UDI", color = "#29398A", shortname = "",},
["Independent Democratic"] = {abbrev = "", color = "#6699CC", shortname = "",},
["Independent Democrats (Czech Republic)"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Independent Democrats"] = {abbrev = "ID", color = "#ef8321", shortname = "",},
["Independent Ecijan Socialist Party"] = {abbrev = "", color = "#3E4E72", shortname = "",},
["Independent Ecological Alliance"] = {abbrev = "AEI", color = "#a7c325", shortname = "",},
["Independent Ecological Movement"] = {abbrev = "MEI", color = "#6EBE43", shortname = "",},
["Independent Ecology"] = {abbrev = "", color = "PaleGreen", shortname = "",},
["Independent Effectiveness"] = {abbrev = "", color = "#B5955D", shortname = "",},
["Independent Farmers"] = {abbrev = "", color = "#66FF99", shortname = "Ind. Farmers",},
["Independent Farnham Residents"] = {abbrev = "", color = "pink", shortname = "Ind. Farnham Res.",},
["Independent Federalist Confederation"] = {abbrev = "", color = "#008000", shortname = "",},
["Independent Fianna Fáil"] = {abbrev = "IFF", color = "#7FFF00", shortname = "",},
["Independent Forward Bloc"] = {abbrev = "", color = "yellow", shortname = "",},
["Independent Genilensan Unity"] = {abbrev = "", color = "#F0B732", shortname = "",},
["Independent Greeks"] = {abbrev = "ANEL", color = "#38A3E7", shortname = "",},
["Independent Green Ecologists of the Balearics"] = {abbrev = "", color = "#07824A", shortname = "",},
["Independent Green Voice"] = {abbrev = "", color = "#008080", shortname = "",},
["Independent Green"] = {abbrev = "", color = "#ccffcc", shortname = "",},
["Independent Greens (Denmark)"] = {abbrev = "", color = "#E7D7ED", shortname = "Independent Greens",},
["Independent Greens (Virginia)"] = {abbrev = "", color = "#0BDA51", shortname = "Independent Greens",},
["Independent Group for Almería"] = {abbrev = "", color = "#0043A1", shortname = "",},
["Independent Group for the Municipal Autonomy of Torrenueva"] = {abbrev = "", color = "#759F91", shortname = "",},
["Independent Group for Villarrobledo"] = {abbrev = "", color = "#005246", shortname = "",},
["Independent Group of Benalmádena"] = {abbrev = "", color = "#EB7711", shortname = "",},
["Independent Group of Cendea de Cizur"] = {abbrev = "", color = "#FFDA1B", shortname = "",},
["Independent Group of Cercedilla"] = {abbrev = "", color = "#0E8535", shortname = "",},
["Independent Group of Estella"] = {abbrev = "", color = "#6E9BBC", shortname = "",},
["Independent Group of Huarte"] = {abbrev = "", color = "#F20114", shortname = "",},
["Independent Group of Porto Cristo–S'illoters and Sympathisers"] = {abbrev = "", color = "#128EA9", shortname = "",},
["Independent Group of Porto Cristo"] = {abbrev = "", color = "#0141AD", shortname = "",},
["Independent Group of Santa Úrsula"] = {abbrev = "", color = "#873597", shortname = "",},
["Independent Group of Torrejón"] = {abbrev = "", color = "#FCD91D", shortname = "",},
["Independent Group of Zizur Mayor"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Independent Group Pro-City Council of El Palmar de Troya"] = {abbrev = "", color = "#04BC0C", shortname = "",},
["Independent Grouping for Reflection"] = {abbrev = "GIR", color = "#005CAB", shortname = "",},
["Independent Health Alliance"] = {abbrev = "", color = "#B0C4DE", shortname = "Ind. Health Alliance",},
["Independent Herrenian Group"] = {abbrev = "AHI", color = "#29AA4D", shortname = "",},
["Independent Initiative (Spain)"] = {abbrev = "", color = "#212084", shortname = "",},
["Independent Initiative"] = {abbrev = "", color = "#2517AB", shortname = "",},
["Independent Irish Labour"] = {abbrev = "", color = "#FFE8E8", shortname = "",},
["Independent Irish Nationalist"] = {abbrev = "", color = "#99FF66", shortname = "",},
["Independent Irish Party"] = {abbrev = "", color = "#DDFFDD", shortname = "Independent Irish",},
["Independent Kidderminster Hospital and Health Concern"] = {abbrev = "", color = "hotpink", shortname = "Health Concern",},
["Independent Labour Group"] = {abbrev = "", color = "#FFE8E8", shortname = "Ind. Labour Group",},
["Independent Labour Party"] = {abbrev = "", color = "#B22222", shortname = "Ind. Labour Party",},
["Independent Labour"] = {abbrev = "", color = "#FFBBBB", shortname = "",},
["Independent Langley Residents"] = {abbrev = "", color = "pink", shortname = "Ind. Langley Res.",},
["Independent Left (Ireland)"] = {abbrev = "", color = "#FF3300", shortname = "Independent Left",},
["Independent Left (Italy)"] = {abbrev = "", color = "#CE2029", shortname = "Independent Left",},
["Independent Left of Castellón"] = {abbrev = "", color = "#528063", shortname = "",},
["Independent Left–Initiative for San Sebastián de los Reyes"] = {abbrev = "", color = "#18742A", shortname = "",},
["Independent Liberal"] = {abbrev = "", color = "#FFFFAA", shortname = "",},
["Independent Liberal (Spain)"] = {abbrev = "", color = "#DEF0CE", shortname = "",},
["Independent Liberal Democrat"] = {abbrev = "", color = "#FFEEAA", shortname = "Ind. Liberal Democrat",},
["Independent Liberal Group of Villaviciosa"] = {abbrev = "", color = "#40C052", shortname = "",},
["Independent Liberal-Labour"] = {abbrev = "Ind. Lib-Lab", color = "#FED8B1", shortname = "",},
["Independent Liberal Party (Chile)"] = {abbrev = "", color = "orange", shortname = "",},
["Independent Liberal Party (Kosovo)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Independent Liberal Party (Nicaragua)"] = {abbrev = "PLI", color = "#FF69B4", shortname = "",},
["Independent Liberal Party (Spain)"] = {abbrev = "", color = "#029138", shortname = "",},
["Independent Liberal Party (Trinidad and Tobago)"] = {abbrev = "ILP", color = "#006F45", shortname = "",},
["Independent Liberal Unionist"] = {abbrev = "", color = "white", shortname = "Ind. Liberal Unionist",},
["Independent Liberals (Israel)"] = {abbrev = "", color = "#FFD700", shortname = "Independent Liberals",},
["Independent Lugo Forum"] = {abbrev = "", color = "#028C64", shortname = "",},
["Independent Moralizing Front"] = {abbrev = "", color = "#F08080", shortname = "",},
["Independent Motrilenian Democratic Group"] = {abbrev = "", color = "#1BE4FF", shortname = "",},
["Independent Movement for Justice and Dignity"] = {abbrev = "", color = "#B0C236", shortname = "",},
["Independent Movement of Absolute Renovation"] = {abbrev = "MIRA", color = "#0033a0", shortname = "",},
["Independent National Electoral Movement"] = {abbrev = "", color = "#85614D", shortname = "",},
["Independent National Party (Luxembourg)"] = {abbrev = "", color = "#993366", shortname = "",},
["Independent National"] = {abbrev = "", color = "grey", shortname = "",},
["Independent Nationalist Party"] = {abbrev = "", color = "green", shortname = "",},
["Independent Nationalist"] = {abbrev = "", color = "#cdffab", shortname = "",},
["Independent Navarrese Front"] = {abbrev = "", color = "#FF0002", shortname = "",},
["Independent Neighborhood Initiative of Alcorcón"] = {abbrev = "", color = "#00923F", shortname = "",},
["Independent Neighbours from Velilla"] = {abbrev = "", color = "#0D00AF", shortname = "",},
["Independent Network"] = {abbrev = "", color = "#483D8B", shortname = "",},
["Independent Parliamentary Group"] = {abbrev = "IPG", color = "#DDDDDD", shortname = "Ind. Parliamentary Group",},
["Independent Party (Costa Rica)"] = {abbrev = "PI", color = "#663267", shortname = "",},
["Independent Party (Denmark)"] = {abbrev = "", color = "#8091BC", shortname = "Independents",},
["Independent Party (Laos)"] = {abbrev = "", color = "#002654", shortname = "",},
["Independent Party (Thailand)"] = {abbrev = "", color = "#ff8c00", shortname = "",},
["Independent Party (Uruguay)"] = {abbrev = "", color = "#500778", shortname = "Independent Party",},
["Independent Party of Capital Mérida"] = {abbrev = "", color = "#D7A039", shortname = "",},
["Independent Party of Ciempozuelos"] = {abbrev = "", color = "#357E39", shortname = "",},
["Independent Party of Melilla"] = {abbrev = "", color = "#F19D1A", shortname = "",},
["Independent Party of Nigrán"] = {abbrev = "", color = "#54B8F3", shortname = "",},
["Independent Party of Siero"] = {abbrev = "", color = "#B0008E", shortname = "",},
["Independent Party Ven–T"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Independent People's Party (Luxembourg)"] = {abbrev = "", color = "lightblue", shortname = "",},
["Independent Political Labour League"] = {abbrev = "", color = "#CC0033", shortname = "Ind. Labour League",},
["Independent politician (Ireland)"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Independent politician"] = {abbrev = "", color = "#DCDCDC", shortname = "Independent",}, -- Not affiliated with any party
["Independent politicians in Ireland"] = {abbrev = "Ind", color = "#DDDDDD", shortname = "Independent",},
["Independent Popular Action"] = {abbrev = "API", color = "#228B22", shortname = "",},
["Independent Popular Council of Formentera"] = {abbrev = "AIPF", color = "#49AE53", shortname = "",},
["Independent Progressive (Spain)"] = {abbrev = "", color = "#F0B9D6", shortname = "",},
["Independent Progressive Candidacy"] = {abbrev = "", color = "#EEA26E", shortname = "",},
["Independent Progressive Left of the Valencian Country"] = {abbrev = "", color = "#E62F4C", shortname = "",},
["Independent Progressive"] = {abbrev = "", color = "orange", shortname = "",},
["Independent Progressives (Torrevieja)"] = {abbrev = "", color = "#D2136A", shortname = "",},
["Independent Protestant (Netherlands)"] = {abbrev = "", color = "#009D70", shortname = "",},
["Independent Radical Party"] = {abbrev = "SRS", color = "#727497", shortname = "",},
["Independent Radical Socialist Republican Party"] = {abbrev = "", color = "#FF007F", shortname = "",},
["Independent Radicals"] = {abbrev = "RI", color = "#FFA07A", shortname = "",},
["Independent Reform"] = {abbrev = "", color = "#99FF99", shortname = "",},
["Independent Regional Unity"] = {abbrev = "", color = "#4437A2", shortname = "",},
["Independent Regionalist Force"] = {abbrev = "", color = "green", shortname = "",},
["Independent Regionalist Party"] = {abbrev = "", color = "#D42D34", shortname = "Regionalist",},
["Independent Republican (Ireland)"] = {abbrev = "", color = "#d1ffb2", shortname = "Independent Republican",},
["Independent Republican (Spain)"] = {abbrev = "", color = "#F4CADB", shortname = "",},
["Independent Republican (US)"] = {abbrev = "", color = "#CC6666", shortname = "Independent Republican",},
["Independent Republicans"] = {abbrev = "RI", color = "#00CCCC", shortname = "",},
["Independent Resident"] = {abbrev = "", color = "#dddddd", shortname = "",},
["Independent Revolutionary Party"] = {abbrev = "", color = "#008800", shortname = "",},
["Independent Segovian Alternative"] = {abbrev = "", color = "#5F8BB8", shortname = "",},
["Independent Senate Group"] = {abbrev = "OSF", color = "#B4C7D2", shortname = "",},
["Independent Sencelleran People"] = {abbrev = "", color = "#D12026", shortname = "",},
["Independent Sineueran People"] = {abbrev = "", color = "#FED200", shortname = "",},
["Independent Smallholders, Agrarian Workers and Civic Party"] = {abbrev = "FKGP", color = "#36492b", shortname = "",},
["Independent Social Alliance"] = {abbrev = "ASI", color = "#1FA12E", shortname = "",},
["Independent Social Democrat"] = {abbrev = "", color = "#D9B3FF", shortname = "Ind. Social Democrat",},
["Independent Social Democratic Party of Germany"] = {abbrev = "USPD", color = "#C40000", shortname = "",},
["Independent Social Group (Asturias)"] = {abbrev = "", color = "#606A77", shortname = "",},
["Independent Social Group of Avilés"] = {abbrev = "", color = "#E108DB", shortname = "",},
["Independent Social Group"] = {abbrev = "", color = "#006733", shortname = "",},
["Independent Social Party of the Rincón de la Victoria Municipality"] = {abbrev = "", color = "#445684", shortname = "",},
["Independent Socialist Labor Party (US)"] = {abbrev = "", color = "#CD3700", shortname = "Independent Socialist Labor",},
["Independent Socialist Party (Argentina)"] = {abbrev = "PSI", color = "#FFC0CB", shortname = "Independent Socialist Party",},
["Independent Socialist Party (Bolivia)"] = {abbrev = "", color = "#F4A460", shortname = "",},
["Independent Socialist Party (Luxembourg)"] = {abbrev = "", color = "#F8D821", shortname = "",},
["Independent Socialist"] = {abbrev = "", color = "red", shortname = "",},
["Independent Socialists of Extremadura"] = {abbrev = "", color = "#0BB828", shortname = "",},
["Independent Solidarity"] = {abbrev = "", color = "#EDE16F", shortname = "",},
["Independent Solution"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Independent Solutions for Roquetas de Mar"] = {abbrev = "", color = "#69D136", shortname = "",},
["Independent Sorian Alternative"] = {abbrev = "", color = "#C71585", shortname = "",},
["Independent Student Faction"] = {abbrev = "", color = "#631163", shortname = "",},
["Independent Tudelan Group"] = {abbrev = "", color = "#347AAD", shortname = "",},
["Independent Turkey Party"] = {abbrev = "BTP", color = "#FF4747", shortname = "",},
["Independent Union (political party)"] = {abbrev = "IU", color = "#203961", shortname = "",},
["Independent Union and Progress of Bétera"] = {abbrev = "", color = "#00652D", shortname = "",},
["Independent Union of Carreño"] = {abbrev = "", color = "#088241", shortname = "",},
["Independent Union of Mallorca"] = {abbrev = "", color = "#292C73", shortname = "",},
["Independent Unionist Association"] = {abbrev = "", color = "blue", shortname = "Ind. Unionist Party",},
["Independent Unionist"] = {abbrev = "Ind U", color = "#aadfff", shortname = "",},
["Independent Utreran Citizen Formation"] = {abbrev = "", color = "#FFB606", shortname = "",},
["Independent Voters Association"] = {abbrev = "", color = "#E64E4E", shortname = "Republican/IVA",},
["Independent Whig"] = {abbrev = "", color = "#FBCEB1", shortname = "Ind. Whig",},
["Independent Workers' Party"] = {abbrev = "POI", color = "#941318", shortname = "",},
["Independent Working Class Association"] = {abbrev = "", color = "#0095B6", shortname = "Ind. Working Class",},
["Independent Zimbabwe Group"] = {abbrev = "IZG", color = "#6B3FA0", shortname = "",},
["Independent-Republicans (Minnesota)"] = {abbrev = "", color = "#E81B23", shortname = "Ind.-Republican",},
["Independents (political party)"] = {abbrev = "NEZ", color = "#104E8B", shortname = "",},
["Independents 4 Change"] = {abbrev = "I4C", color = "#FFC0CB", shortname = "Inds. 4 Change",},
["Independents for Carballo"] = {abbrev = "", color = "#FD7D02", shortname = "",},
["Independents for Cartaya"] = {abbrev = "", color = "#0A396D", shortname = "",},
["Independents for Cee"] = {abbrev = "", color = "#08AF17", shortname = "",},
["Independents for Croatia"] = {abbrev = "", color = "#08457E", shortname = "",},
["Independents for Cuenca"] = {abbrev = "", color = "#FBF104", shortname = "",},
["Independents for Extremadura"] = {abbrev = "", color = "#019132", shortname = "",},
["Independents for Ferrol"] = {abbrev = "", color = "#0525B4", shortname = "",},
["Independents for Frome"] = {abbrev = "ifF", color = "#000000", shortname = "",},
["Independents for Huelva"] = {abbrev = "", color = "#053DDC", shortname = "",},
["Independents for León"] = {abbrev = "", color = "#800080", shortname = "",},
["Independents for Sa Pobla"] = {abbrev = "", color = "#16762F", shortname = "",},
["Independents for Teruel"] = {abbrev = "", color = "#B14173", shortname = "",},
["Independents for the Municipal Progress of Osona"] = {abbrev = "", color = "#BE624B", shortname = "",},
["Independents for Vilagarcía"] = {abbrev = "", color = "#3BD1FA", shortname = "",},
["Independents Movement (Cyprus)"] = {abbrev = "", color = "#402666", shortname = "",},
["Independents of Aguadulce and El Parador"] = {abbrev = "", color = "#A04D47", shortname = "",},
["Independents of Asma Lands"] = {abbrev = "", color = "#6DC5EF", shortname = "",},
["Independents of Asturias"] = {abbrev = "", color = "#2ECCFA", shortname = "",},
["Independents of Formentera Group"] = {abbrev = "", color = "#004D24", shortname = "",},
["Independents of Fuerteventura"] = {abbrev = "", color = "#AFAF39", shortname = "",},
["Independents of Galicia"] = {abbrev = "", color = "#1DB2B9", shortname = "",},
["Independents of Getxo"] = {abbrev = "", color = "#BF0161", shortname = "",},
["Independents of Hope"] = {abbrev = "", color = "#ECEEA1", shortname = "",},
["Independents of Ibiza and Formentera Federation"] = {abbrev = "", color = "#2A52BE", shortname = "",},
["Independents of Inca"] = {abbrev = "", color = "#4F71B0", shortname = "",},
["Independents of La Selva"] = {abbrev = "", color = "#3E66CA", shortname = "",},
["Independents of Marratxí"] = {abbrev = "", color = "#002651", shortname = "",},
["Independents of Meaño"] = {abbrev = "", color = "#92AF53", shortname = "",},
["Independents of Navarre"] = {abbrev = "", color = "#DB5A5A", shortname = "",},
["Independents of Porriño"] = {abbrev = "", color = "#4A4AB5", shortname = "",},
["Independientes Portuenses"] = {abbrev = "", color = "#FFD403", shortname = "",},
["Indhiya Jananayaga Katchi"] = {abbrev = "IJK", color = "#F08080", shortname = "",},
["India Janshakti Party"] = {abbrev = "IJP", color = "orangered", shortname = "",},
["Indian Bahujan Samajwadi Party"] = {abbrev = "IBSP", color = "#2EFEF7", shortname = "",},
["Indian Christian Secular Party"] = {abbrev = "ICSP", color = "#7002b0", shortname = "",},
["Indian Congress (Socialist) – Sarat Chandra Sinha"] = {abbrev = "INS(SCS)", color = "#000000", shortname = "",},
["Indian Congress (Socialist)"] = {abbrev = "IC(S)", color = "#00FF00", shortname = "",},
["Indian Democratic Party"] = {abbrev = "IDP", color = "silver", shortname = "",},
["Indian Democratic Socialist Party"] = {abbrev = "IDSP", color = "#0B3B0B", shortname = "",},
["Indian Federal Democratic Party"] = {abbrev = "", color = "#CC3399", shortname = "",},
["Indian Gandhiyan Party"] = {abbrev = "IGP", color = "#54C0DB", shortname = "",},
["Indian Justice Party"] = {abbrev = "IJP", color = "grey", shortname = "",},
["Indian Liberal Party"] = {abbrev = "ILP", color = "#FF9999", shortname = "",},
["Indian Movement Túpac Katari"] = {abbrev = "", color = "#9F62C3", shortname = "",},
["Indian National Congress"] = {abbrev = "INC", color = "#19AAED", shortname = "",},
["Indian National Congress (Indira)"] = {abbrev = "INC(I)", color = "#0EF4E1", shortname = "",},
["Indian National Congress (Jagjivan)"] = {abbrev = "INC(J)", color = "#00CCFF", shortname = "Indian Congress (J)",},
["Indian National Congress (Organisation)"] = {abbrev = "INC(O)", color = "#a5f1f9", shortname = "",},
["Indian National Congress (Requisitionists)"] = {abbrev = "INC(R)", color = "turquoise", shortname = "",},
["Indian National Congress (Urs)"] = {abbrev = "INC(U)", color = "red", shortname = "",},
["Indian National Democratic Congress"] = {abbrev = "CRC", color = "Blue", shortname = "",},
["Indian National Labour Party"] = {abbrev = "INLP", color = "#B7A693", shortname = "",},
["Indian National League"] = {abbrev = "INL", color = "#006600", shortname = "",},
["Indian National Lok Dal"] = {abbrev = "INLD", color = "#336600", shortname = "",},
["Indian Peace Party"] = {abbrev = "IPP", color = "#CECEF6", shortname = "",},
["Indian People's Forward Bloc"] = {abbrev = "IPFB", color = "Red", shortname = "",},
["Indian People's Front"] = {abbrev = "IPF", color = "#e40017", shortname = "",},
["Indian Secular Front"] = {abbrev = "ISF", color = "#0204ef", shortname = "",},
["Indian Union Muslim League"] = {abbrev = "IUML", color = "#006600", shortname = "",},
["Indigenous and Social Alternative Movement"] = {abbrev = "MAIS", color = "#ED151F", shortname = "",},
["Indigenous Authorities of Colombia"] = {abbrev = "", color = "green", shortname = "",},
["Indigenous Nationalist Party of Twipra"] = {abbrev = "INPT", color = "#008100", shortname = "",},
["Indigenous People's Front of Tripura"] = {abbrev = "IPFT", color = "#07892f", shortname = "",},
["Indigenous-Aboriginal Party of Australia"] = {abbrev = "", color = "#344734", shortname = "",},
["Indonesia People's Party"] = {abbrev = "", color = "#D2B48C", shortname = "",},
["Indonesian Christian Party 1945"] = {abbrev = "", color = "#0e2f25", shortname = "",},
["Indonesian Christian Party"] = {abbrev = "", color = "#799BCB", shortname = "",},
["Indonesian Democratic Party of Devotion"] = {abbrev = "", color = "#00862C", shortname = "",},
["Indonesian Democratic Party of Struggle"] = {abbrev = "PDI-P", color = "#DB2016", shortname = "",},
["Indonesian Democratic Party"] = {abbrev = "PDI", color = "#DB2016", shortname = "",},
["Indonesian Democratic Vanguard Party"] = {abbrev = "", color = "#F90313", shortname = "",},
["Indonesian Islamic Union Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Indonesian Justice and Unity Party"] = {abbrev = "", color = "#E4000E", shortname = "",},
["Indonesian Nahdlatul Community Party"] = {abbrev = "", color = "#1E6539", shortname = "",},
["Indonesian National Party Marhaenism"] = {abbrev = "", color = "#A50005", shortname = "",},
["Indonesian National Party"] = {abbrev = "PNI", color = "#D20000", shortname = "",},
["Indonesian National Populist Fortress Party"] = {abbrev = "", color = "#85011F", shortname = "",},
["Indonesian People's Party"] = {abbrev = "SRI", color = "#AE1C28", shortname = "",},
["Indonesian Solidarity Party"] = {abbrev = "", color = "#E6212A", shortname = "",},
["Indonesian Unity Party"] = {abbrev = "", color = "#9B4200", shortname = "",},
["Industrial Government Party (US)"] = {abbrev = "", color = "#DD051D", shortname = "Industrial Government",},
["Industrial Government Party"] = {abbrev = "", color = "#DD051D", shortname = "Industrial Government",},
["Industrial Labor Party (US)"] = {abbrev = "", color = "#996600", shortname = "Industrial Labor",},
["Industrial Party (US)"] = {abbrev = "", color = "#666633", shortname = "Industrial",},
["Industry and Business Party"] = {abbrev = "", color = "#01B0CF", shortname = "",},
["Industry Party"] = {abbrev = "", color = "#808080", shortname = "Industry",},
["Industry Will Save Georgia"] = {abbrev = "MGS", color = "#5E1317", shortname = "",},
["IniciativaVerds"] = {abbrev = "", color = "#A8A82B", shortname = "",},
["Inite"] = {abbrev = "", color = "#228B22", shortname = "",},
["Initiative for Albacete"] = {abbrev = "", color = "#CA1B23", shortname = "",},
["Initiative for Catalonia Greens"] = {abbrev = "", color = "#4E9E41", shortname = "",},
["Initiative for Tafalla"] = {abbrev = "", color = "#8DB974", shortname = "",},
["Initiative for the Development of Soria"] = {abbrev = "", color = "#DE6000", shortname = "",},
["Initiative for the Ribera"] = {abbrev = "", color = "#EB7747", shortname = "",},
["Inkatha Freedom Party"] = {abbrev = "IFP", color = "#FF0000", shortname = "",},
["Inn National Development Party"] = {abbrev = "", color = "#00923F", shortname = "",},
["Innovation and Unity Party"] = {abbrev = "PINU", color = "#EE9E09", shortname = "",},
["Innovative Action"] = {abbrev = "", color = "#09599B", shortname = "",},
["Institutional Democratic Party (Dominican Republic)"] = {abbrev = "", color = "#fd8204", shortname = "",},
["Institutional Democratic Party"] = {abbrev = "", color = "#0F4D92", shortname = "",},
["Institutional Renewal Party of National Action"] = {abbrev = "PRIAN", color = "#FFFF00", shortname = "",},
["Institutional Republican Party"] = {abbrev = "PRI", color = "#0F4D92", shortname = "",},
["Institutional Revolutionary Party"] = {abbrev = "PRI", color = "#4DA663", shortname = "",},
["Institutionalist Democratic Coalition"] = {abbrev = "", color = "#ADFF2F", shortname = "",},
["Insular Group of Gran Canaria"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Integration and Development Movement"] = {abbrev = "", color = "#05238F", shortname = "",},
["Integration Column"] = {abbrev = "", color = "#A52B20", shortname = "",},
["Integration with Britain Party"] = {abbrev = "IWBP", color = "#bfb", shortname = "",},
["Integration, Representation and New Hope"] = {abbrev = "", color = "#E50066", shortname = "",},
["Integrist Party"] = {abbrev = "", color = "#34457E", shortname = "",},
["Integrity Party of Aotearoa New Zealand"] = {abbrev = "", color = "#ffffff", shortname = "",},
["Integrity Southampton"] = {abbrev = "", color = "#110b0b", shortname = "",},
["Intellectual Armenia Party"] = {abbrev = "", color = "#4385E3", shortname = "",},
["Intelligent Madrid"] = {abbrev = "", color = "#FDDA0C", shortname = "",},
["Internal Macedonian Revolutionary Organization–Democratic Party for Macedonian National Unity"] = {abbrev = "VMRO–DPMNE", color = "#BF0202", shortname = "",},
["International Marxist Group"] = {abbrev = "", color = "red", shortname = "International Marxist",},
["International Marxist Group (Germany)"] = {abbrev = "GIM", color = "red", shortname = "",},
["International Revelation Congress"] = {abbrev = "", color = "#5BC22F", shortname = "",},
["International Socialist Alternative (Austria)"] = {abbrev = "ISA", color = "#CC0033", shortname = "",},
["International Workers' Union – Trotskyists"] = {abbrev = "EDE–T", color = "red", shortname = "",},
["Internationalist Socialist Workers' Party"] = {abbrev = "", color = "#BC021C", shortname = "",},
["Internationalist Solidarity and Self-Management"] = {abbrev = "", color = "#C1022C", shortname = "",},
["Internationalist Struggle"] = {abbrev = "", color = "#8C0C21", shortname = "",},
["Internet Party (New Zealand)"] = {abbrev = "", color = "#662C92", shortname = "Internet",},
["Internet Party (Spain)"] = {abbrev = "", color = "#FF6C00", shortname = "",},
["Internet Party and Mana Movement"] = {abbrev = "", color = "#7F0000", shortname = "Internet Mana",},
["Intransigent Party"] = {abbrev = "PI", color = "#D10047", shortname = "",},
["Intransigent Radical Civic Union"] = {abbrev = "", color = "#E36552", shortname = "",},
["Inuit Ataqatigiit"] = {abbrev = "", color = "#AB2328", shortname = "",},
["Inuit Party"] = {abbrev = "", color = "#CF181A", shortname = "Inuit",},
["Inzar"] = {abbrev = "", color = "#337B6D", shortname = "",},
["Irabazi"] = {abbrev = "", color = "#00B9F1", shortname = "",},
["Iran Novin Party"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Iran Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Iranian Principlists"] = {abbrev = "", color = "#000000", shortname = "",},
["Iranian Reformists"] = {abbrev = "", color = "#1C39BB", shortname = "",},
["Iraq Alliance"] = {abbrev = "", color = "#F16620", shortname = "",},
["Iraqi Accord Front"] = {abbrev = "", color = "#F47C20", shortname = "Tawafuq",},
["Iraqi Communist Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Iraqi Independence Party"] = {abbrev = "", color = "black", shortname = "",},
["Iraqi National Dialogue Front"] = {abbrev = "", color = "#00009F", shortname = "",},
["Iraqi National List"] = {abbrev = "", color = "black", shortname = "",},
["Iraqi Turkmen Front"] = {abbrev = "ITF", color = "#00B8FD", shortname = "",},
["Iratzarri"] = {abbrev = "", color = "#F93038", shortname = "",},
["Irish Confederate Party"] = {abbrev = "", color = "#044302", shortname = "Irish Confederate",},
["Irish Conservative Party"] = {abbrev = "", color = "#0087DC", shortname = "Conservative",},
["Irish Democratic Party"] = {abbrev = "IDP", color = "#23588C", shortname = "Irish Democratic",},
["Irish Freedom Party"] = {abbrev = "", color = "#006633", shortname = "Irish Freedom",},
["Irish Independence Party"] = {abbrev = "", color = "#32CD32", shortname = "Irish Independence",},
["Irish Labour Party"] = {abbrev = "", color = "#CC0000", shortname = "Irish Labour",},
["Irish Loyal and Patriotic Union"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Irish Militant Labour"] = {abbrev = "", color = "red", shortname = "Militant",},
["Irish National Federation"] = {abbrev = "", color = "#00FA9A", shortname = "",},
["Irish National League"] = {abbrev = "", color = "#99FF66", shortname = "",},
["Irish Parliamentary Party"] = {abbrev = "IPP", color = "#99FF66", shortname = "Irish Parliamentary",},
["Irish Patriot Party"] = {abbrev = "", color = "#008000", shortname = "Patriot",},
["Irish Republican Socialist Party"] = {abbrev = "", color = "#004400", shortname = "Irish Republican Socialist",},
["Irish Socialist Network"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Irish Unionist Alliance"] = {abbrev = "U", color = "#9999FF", shortname = "Irish Unionist",},
["Irish Worker League"] = {abbrev = "IWL", color = "#FF3300", shortname = "Irish Worker League",},
["Irish Workers' Party"] = {abbrev = "", color = "#FF3300", shortname = "",},
["Iron Guard"] = {abbrev = "", color = "#2E8B57", shortname = "",},
["Irun Herria"] = {abbrev = "", color = "#BD1C0F", shortname = "",},
["Isamaa"] = {abbrev = "", color = "#009CE2", shortname = "",},
["Ishenim"] = {abbrev = "", color = "#632D4D", shortname = "",},
["Ishin Seito Shimpu"] = {abbrev = "", color = "#CC3334", shortname = "",},
["ISLAM (political party)"] = {abbrev = "", color = "#226814", shortname = "",},
["Islami Andolan Bangladesh"] = {abbrev = "IAB", color = "#C7EA00", shortname = "",},
["Islami Jamhoori Ittehad"] = {abbrev = "IJI", color = "#284d00", shortname = "",},
["Islami Jatiya Oikya Front"] = {abbrev = "IJOF", color = "#54AC00", shortname = "",},
["Islami Oikya Jote"] = {abbrev = "IOJ", color = "#6AD900", shortname = "",},
["Islami Tehreek Pakistan"] = {abbrev = "ITP", color = "#000000", shortname = "",},
["Islamic Action Front"] = {abbrev = "", color = "#41984F", shortname = "",},
["Islamic Alliance (Egypt)"] = {abbrev = "IA", color = "#009900", shortname = "",},
["Islamic Association of Engineers"] = {abbrev = "IAE", color = "#A52A2A", shortname = "",},
["Islamic Association of Iranian Medical Society"] = {abbrev = "AIMSI", color = "#ffe5b2", shortname = "",},
["Islamic Association of Teachers of Iran"] = {abbrev = "IATI", color = "#3d98b3", shortname = "",},
["Islamic Association of University Instructors"] = {abbrev = "IAUI", color = "#D2691E", shortname = "",},
["Islamic Coalition Party"] = {abbrev = "ICP", color = "#009900", shortname = "",},
["Islamic Dawa Party"] = {abbrev = "", color = "#009900", shortname = "",},
["Islamic Dawah Organisation of Afghanistan"] = {abbrev = "", color = "#007F00", shortname = "",},
["Islamic Democratic Alliance"] = {abbrev = "", color = "#006600", shortname = "",},
["Islamic Democratic Party (Maldives)"] = {abbrev = "", color = "#F00", shortname = "",},
["Islamic Education Movement"] = {abbrev = "", color = "#005825", shortname = "",},
["Islamic Front Bangladesh"] = {abbrev = "", color = "#8F674E", shortname = "Islamic Front",},
["Islamic Group (Lebanon)"] = {abbrev = "", color = "#009900", shortname = "",},
["Islamic Iran Participation Front"] = {abbrev = "IIPF", color = "#43438b", shortname = "",},
["Islamic Labour Party"] = {abbrev = "ILP", color = "#90EE90", shortname = "",},
["Islamic Movement of Afghanistan"] = {abbrev = "", color = "#1D6D01", shortname = "",},
["Islamic Party of Britain"] = {abbrev = "", color = "#337263", shortname = "Islamic Party",},
["Islamic Renaissance Movement"] = {abbrev = "MRI", color = "#000099", shortname = "",},
["Islamic Renaissance Party of Tajikistan"] = {abbrev = "", color = "#224272", shortname = "Islamic Renaissance",},
["Islamic Republican Party"] = {abbrev = "IRP", color = "#000000", shortname = "",},
["Islamic Salvation Front"] = {abbrev = "FIS", color = "#008000", shortname = "",},
["Islamic Society of Athletes"] = {abbrev = "ISA", color = "Green", shortname = "",},
["Islamic Society of Engineers"] = {abbrev = "JAM", color = "#FDEE00", shortname = "",},
["Islamic Supreme Council of Iraq"] = {abbrev = "ISCI", color = "#03C03C", shortname = "",},
["Islamic Virtue Party"] = {abbrev = "", color = "#2929FD", shortname = "Fadhila",},
["Islamist Bloc"] = {abbrev = "", color = "black", shortname = "",},
["Island Alternative"] = {abbrev = "", color = "#132B41", shortname = "",},
["Island Independents"] = {abbrev = "", color = "#000000", shortname = "",},
["Islander Party of the Balearic Islands"] = {abbrev = "", color = "#636163", shortname = "",},
["Isle of Man Green Party"] = {abbrev = "", color = "#0B9444", shortname = "Green",},
["Isola Group"] = {abbrev = "", color = "#0087dc", shortname = "",},
["Israel Resilience Party"] = {abbrev = "", color = "#7D7F33", shortname = "",},
["Israeli Labor Party"] = {abbrev = "", color = "#EE1C25", shortname = "Labor",},
["Israeli Liberal Party"] = {abbrev = "", color = "#FFCC00", shortname = "Liberal",},
["Istiqlal Party"] = {abbrev = "", color = "#f1a4be", shortname = "Istiqlal",},
["Istrian Democratic Assembly"] = {abbrev = "IDS", color = "#0CB14B", shortname = "",},
["Istrian Social Democratic Forum"] = {abbrev = "", color = "red", shortname = "",},
["IT Voice 2012"] = {abbrev = "", color = "#F47622", shortname = "",},
["IT Voice"] = {abbrev = "", color = "#BB1F5E", shortname = "",},
["Italexit (political party)"] = {abbrev = "", color = "#366A9F", shortname = "Italexit",},
["Italia Viva"] = {abbrev = "", color = "#D6418C", shortname = "",},
["Italia. Bene Comune"] = {abbrev = "", color = "#EF3E3E", shortname = "",},
["Italian Associations in South America"] = {abbrev = "", color = "#2B346C", shortname = "",},
["Italian Catholic Electoral Union"] = {abbrev = "", color = "#FFEF65", shortname = "",},
["Italian Communist Party (2016)"] = {abbrev = "", color = "#C72F35", shortname = "Italian Communist Party",},
["Italian Communist Party"] = {abbrev = "", color = "#C72F35", shortname = "Communist Party",},
["Italian Democratic Liberal Party"] = {abbrev = "", color = "Gold", shortname = "",},
["Italian Democratic Party of Monarchist Unity"] = {abbrev = "", color = "#536CE8", shortname = "",},
["Italian Democratic Socialist Party"] = {abbrev = "", color = "#FF8282", shortname = "Social Democratic Party",},
["Italian Democratic Socialists"] = {abbrev = "", color = "#ED1B34", shortname = "",},
["Italian Left"] = {abbrev = "", color = "#EF3E3E", shortname = "",},
["Italian Liberal Party (1997)"] = {abbrev = "", color = "#2975C2", shortname = "",},
["Italian Liberal Party"] = {abbrev = "", color = "#2975C2", shortname = "Liberal Party",},
["Italian Nationalist Association"] = {abbrev = "", color = "#00008B", shortname = "",},
["Italian People's Party (1919)"] = {abbrev = "", color = "#87CEFA", shortname = "People's Party",},
["Italian People's Party (1994)"] = {abbrev = "", color = "#87CEFA", shortname = "People's Party",},
["Italian People's Party"] = {abbrev = "", color = "#B6CCFB", shortname = "",},
["Italian Radical Party"] = {abbrev = "", color = "#00542E", shortname = "Radical Party",},
["Italian Radicals"] = {abbrev = "", color = "#FFD700", shortname = "Radicals",},
["Italian Reformist Socialist Party"] = {abbrev = "", color = "Pink", shortname = "Reformist Socialist Party",},
["Italian Renewal"] = {abbrev = "", color = "#0039AA", shortname = "",},
["Italian Republican Party"] = {abbrev = "", color = "#3CB371", shortname = "Republican Party",},
["Italian Social Movement"] = {abbrev = "", color = "#000000", shortname = "Social Movement",},
["Italian Socialist Party (2007)"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Italian Socialist Party of Proletarian Unity"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Italian Socialist Party"] = {abbrev = "", color = "#ED2855", shortname = "Socialist Party",},
["Italia in Comune"] = {abbrev = "", color = "#349655", shortname = "",},
["Italy of Values"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Ittehad-e-Millat Council"] = {abbrev = "IEMC", color = "green", shortname = "",},
["Ittifaq al-Muslimin"] = {abbrev = "", color = "#009933", shortname = "",},
["Ittihad Party"] = {abbrev = "", color = "#6495ED", shortname = "Ittihad",},
["Ivan Rybkin Bloc"] = {abbrev = "", color = "#DA2021", shortname = "",},
["Ivica Dačić — Prime Minister of Serbia"] = {abbrev = "", color = "#FC2209", shortname = "SPS coalition",},
["Ivorian Popular Front"] = {abbrev = "FPI", color = "#0066cc", shortname = "",},
["Ivorian Workers' Party"] = {abbrev = "", color = "purple", shortname = "",},
["Izaugsme"] = {abbrev = "", color = "#3C8734", shortname = "",},
["Izquierda-Ezkerra"] = {abbrev = "I–E (n)", color = "#C80F70", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
mmfh5w0rksyuqkp6igly9cljvcmvrk4
Module:Political party/J
828
68669303
1094820796
1094820579
2022-06-24T17:47:11Z
Dhruv edits
39944258
Alternate name
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Jackson Party (United States)"] = "Jacksonian Party",
["Jackson Republican"] = "Democratic-Republican Party",
["Jacksonian Democrat"] = "Democratic Party (US)",
["Jacksonian Democratic"] = "Democratic Party (US)",
["Jacksonian Party (United States)"] = "Jacksonian Party",
["Jacksonian Party (US)"] = "Jacksonian Party",
["Jacksonian Republican"] = "Democratic-Republican Party",
["Jai jawan jai kisan party"] = "Jai Jawan Jai Kishan Party",
["Jai Prakash Janata Dal"] = "Jai Prakash Janta Dal",
["Jammu & Kashmir Apni Party"] = "Jammu and Kashmir Apni Party",
["Jammu & Kashmir Awami National Conference"] = "Jammu and Kashmir Awami National Conference",
["Jammu & Kashmir National Panthers Party"] = "Jammu and Kashmir National Panthers Party",
["Jammu & Kashmir People's Conference"] = "Jammu and Kashmir People's Conference",
["Jammu & Kashmir People's Democratic Front"] = "Jammu and Kashmir People's Democratic Front",
["Jammu & Kashmir People's Democratic Front (Secular)"] = "Jammu and Kashmir People's Democratic Front",
["Jammu & Kashmir People's Democratic Party"] = "Jammu and Kashmir Peoples Democratic Party",
["Jammu & Kashmir Peoples Democratic Party"] = "Jammu and Kashmir Peoples Democratic Party",
["Jammu & Kashmir Workers Party"] = "Jammu and Kashmir Workers Party",
["Jammu and Kashmir People's Democratic Front (Secular)"] = "Jammu and Kashmir People's Democratic Front",
["Jammu and Kashmir People's Democratic Party"] = "Jammu and Kashmir Peoples Democratic Party",
["Jammu and Kashmir National Conference"] = "Jammu & Kashmir National Conference",
["Jammu and Kashmir People's Movement"] = "Jammu & Kashmir People's Movement",
["Jan Adhikar Party Loktantrik"] = "Jan Adhikar Party (Loktantrik)",
["Jana Congress"] = "Orissa Jana Congress",
["Jana Sangh"] = "Akhil Bharatiya Jana Sangh",
["Jannayak Janata Party"] = "Jannayak Janta Party",
["January 21 Patriotic Society Party"] = "Patriotic Society Party",
["Japan Communist Party"] = "Japanese Communist Party",
["Japan Democratic Party (1954)"] = "Democratic Party (Japan, 1954)",
["Japan Future Party"] = "Tomorrow Party of Japan",
["Jatiya Party"] = "Jatiya Party (Ershad)",
["Junker Party"] = "Moderate Party",
["Junts per Catalunya"] = "Together for Catalonia (2017)",
["Jury Team (UK)"] = "Jury Team",
["Justice (Estonia)"] = "Estonian Left Party",
["Justice Alliance (Hong Kong)"] = "Justice Alliance",
["Justice Party (United States)"] = "Justice Party (US)",
}
local full = {
["JA21"] = {abbrev = "", color = "#242B57", shortname = "",},
["Jacksonian Party"] = {abbrev = "", color = "#DDEEFF", shortname = "Jacksonian",},
["Jacobin Club"] = {abbrev = "", color = "#E4433E", shortname = "Jacobin",},
["Jacqui Lambie Network"] = {abbrev = "", color = "#ffcb08", shortname = "Lambie Network",},
["Jaén Deserves More"] = {abbrev = "", color = "#3A6A40", shortname = "",},
["Jaén en Común"] = {abbrev = "", color = "#B901DC", shortname = "",},
["Jaén va a Crecer"] = {abbrev = "", color = "#4D8C3B", shortname = "",},
["Jaén, Sentido y Común"] = {abbrev = "", color = "#FF3765", shortname = "",},
["Jago Party"] = {abbrev = "", color = "#F984E5", shortname = "",},
["Jai Bharat Samanta Party"] = {abbrev = "", color = "#ffc000", shortname = "",},
["Jai Jawan Jai Kishan Party"] = {abbrev = "JWJK", color = "#000000", shortname = "",},
["Jai Prakash Janta Dal"] = {abbrev = "JPJD", color = "blue", shortname = "",},
["Jai Samaikyandhra Party"] = {abbrev = "JSP", color = "#008000", shortname = "",},
["JAMA (Iranian Party)"] = {abbrev = "JAMA", color = "#87CEFA", shortname = "",},
["JAMA (political party)"] = {abbrev = "JAMA", color = "", shortname = "",},
["Jamaat-e-Islami Pakistan"] = {abbrev = "JI", color = "#00AAE4", shortname = "",},
["Jamaat-e-Islami"] = {abbrev = "JI", color = "#0095cb", shortname = "",},
["Jamaat-e-Islami Kashmir"] = {abbrev = "JIJK", color = "#009F3C", shortname = "",},
["Jamaica Abolitionist Movement"] = {abbrev = "JAM", color = "#000000", shortname = "",},
["Jamaica Labour Party"] = {abbrev = "JLP", color = "#00A94C", shortname = "",},
["Jamhoori Wattan Party"] = {abbrev = "JWP", color = "#F08080", shortname = "",},
["Jamiat Ahle Hadith"] = {abbrev = "", color = "#008000", shortname = "",},
["Jamiat Ulama-e-Islam Nazryati"] = {abbrev = "JUINP", color = "black", shortname = "",},
["Jamiat Ulama-e-Islam Pakistan (S)"] = {abbrev = "JUI (S)", color = "#696969", shortname = "",},
["Jamiat Ulama-e-Pakistan (Noorani)"] = {abbrev = "JUP (N)", color = "#008000", shortname = "",},
["Jamiat Ulama-e-Pakistan"] = {abbrev = "JUP", color = "#008000", shortname = "",},
["Jamiat Ulema-e-Islam (F)"] = {abbrev = "JUI (F)", color = "#696969", shortname = "",},
["Jamiat Ulema-e-Islam (S)"] = {abbrev = "JUI-S", color = "#696969", shortname = "",},
["Jamiat Ulema-e-Islam Bangladesh"] = {abbrev = "", color = "green", shortname = "",},
["Jamiat Ulema-e-Islam"] = {abbrev = "", color = "black", shortname = "",},
["Jamiat Ulema-e-Pakistan"] = {abbrev = "", color = "#008000", shortname = "",},
["Jamiat-e Islami"] = {abbrev = "", color = "#02923E", shortname = "",},
["Jammu & Kashmir National Conference"] = {abbrev = "JKNC", color = "#fe0000", shortname = "",},
["Jammu & Kashmir People's Movement"] = {abbrev = "JKPM", color = "#295428", shortname = "",},
["Jammu and Kashmir Apni Party"] = {abbrev = "JKAP", color = "#072a61", shortname = "",},
["Jammu and Kashmir Awami National Conference"] = {abbrev = "JKANC", color = "#FF3D00", shortname = "",},
["Jammu and Kashmir National Panthers Party"] = {abbrev = "JKNPP", color = "#060950", shortname = "",},
["Jammu and Kashmir People's Conference"] = {abbrev = "JKPC", color = "#005085", shortname = "",},
["Jammu and Kashmir People's Democratic Front"] = {abbrev = "JKPDF", color = "#81F7BE", shortname = "",},
["Jammu and Kashmir Peoples Democratic Party"] = {abbrev = "JKPDP", color = "#058532", shortname = "",},
["Jammu and Kashmir Workers Party"] = {abbrev = "JKWP", color = "#1FB360", shortname = "",},
["Jammu Kashmir Peoples Party"] = {abbrev = "", color = "black", shortname = "",},
["Jamote Qaumi Movement"] = {abbrev = "", color = "#306EFF", shortname = "",},
["Jan Adhikar Party (Loktantrik)"] = {abbrev = "JAP(L)", color = "#009F3C", shortname = "",},
["Jan Chetna Party"] = {abbrev = "JCP", color = "#F7819F", shortname = "",},
["Jan Ekta Morcha"] = {abbrev = "JEM", color = "#C8FE2E", shortname = "",},
["Jan Kranti Dal"] = {abbrev = "", color = "#04B4AE", shortname = "",},
["Jan Morcha"] = {abbrev = "", color = "#2E8B57", shortname = "",},
["Jan Samanta Party"] = {abbrev = "JSMP", color = "#99D609", shortname = "",},
["Jan Surajya Shakti"] = {abbrev = "JSS", color = "#CEF6EC", shortname = "",},
["Jana Andolan Party"] = {abbrev = "JAP", color = "#FFD300", shortname = "",},
["Jana Sena Party"] = {abbrev = "", color = "#E62715", shortname = "Jana Sena",},
["Janadhipathya Kerala Congress"] = {abbrev = "JKC", color = "Red", shortname = "",},
["Janadhipathya Rashtriya Sabha"] = {abbrev = "JRS", color = "Green", shortname = "",},
["Janamat Party"] = {abbrev = "", color = "orangered", shortname = "",},
["Janamorcha Nepal"] = {abbrev = "", color = "tomato", shortname = "",},
["Janamukti Party Nepal"] = {abbrev = "", color = "yellow", shortname = "",},
["Janata Dal (Secular)"] = {abbrev = "JD(S)", color = "#138808", shortname = "",},
["Janata Dal (United)"] = {abbrev = "JD(U)", color = "#003366", shortname = "",},
["Janata Dal"] = {abbrev = "JD", color = "#2E8B57", shortname = "",},
["Janata Parivar"] = {abbrev = "", color = "green", shortname = "",},
["Janata Party (Secular)"] = {abbrev = "JP(S)", color = "#000080", shortname = "",},
["Janata Party"] = {abbrev = "JP", color = "#1F75FE", shortname = "",},
["Janatha Vimukthi Peramuna"] = {abbrev = "", color = "#F90818", shortname = "",},
["Janathipathiya Samrakshana Samithy"] = {abbrev = "JSS", color = "red", shortname = "",},
["Jannayak Janta Party"] = {abbrev = "JJP", color = "#026D37", shortname = "",},
["Jansatta Dal (Loktantrik)"] = {abbrev = "JD(L)", color = "Yellow", shortname = "Jansatta Dal (L)",},
["Janshoshit Samaj Party"] = {abbrev = "", color = "#8B9DA4", shortname = "Janshoshit Samaj",},
["Janta Congress Chhattisgarh"] = {abbrev = "JCC(J)", color = "#FFC0DB", shortname = "",},
["Janta Sena Rajasthan"] = {abbrev = "JSR", color = "Orange", shortname = "",},
["Janvadi Party (Socialist)"] = {abbrev = "JP(S)", color = "#1024E4", shortname = "",},
["Japan Farmers Party (1947–1949)"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Japan First Party"] = {abbrev = "", color = "#000000", shortname = "Japan First",},
["Japan Innovation Party"] = {abbrev = "", color = "#006699", shortname = "Innovation",},
["Japan Masses Party"] = {abbrev = "", color = "#DB001C", shortname = "Taishūtō",},
["Japan New Party"] = {abbrev = "", color = "#037766", shortname = "New Party",},
["Japan Progressive Party"] = {abbrev = "", color = "#99FF33", shortname = "Progressive",},
["Japan Renewal Party"] = {abbrev = "", color = "#0080EC", shortname = "Shinseito",},
["Japan Restoration Party"] = {abbrev = "", color = "#6FBA2C", shortname = "Restoration",},
["Japan Socialist Party"] = {abbrev = "", color = "#084195", shortname = "Socialist",},
["Japanese Communist Party"] = {abbrev = "", color = "#DB001C", shortname = "Communist",},
["Jathika Hela Urumaya"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Jathika Nidahas Peramuna"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Jatiya Ganotantrik Party"] = {abbrev = "", color = "black", shortname = "",},
["Jatiya Party (Ershad)"] = {abbrev = "JP(E)", color = "#F6F600", shortname = "",},
["Jatiya Party (Manju)"] = {abbrev = "", color = "#CCCC00", shortname = "Jatiya Party (M)",},
["Jatiya Samajtantrik Dal (Siraj)"] = {abbrev = "JSD (S)", color = "#94065C", shortname = "",},
["Jatiya Samajtantrik Dal-JSD"] = {abbrev = "JSD (R)", color = "#D35DA5", shortname = "",},
["Jatiya Samajtantrik Dal"] = {abbrev = "JSD", color = "#ED1C24", shortname = "",},
["Jatiyatabadi Ganatantrik Dal"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Jatiyo Samajtantrik Dal"] = {abbrev = "JSD", color = "#BB1278", shortname = "",},
["Jebamani Janata"] = {abbrev = "", color = "#CC9933", shortname = "",},
["Jerezan Progressive Initiative"] = {abbrev = "", color = "#0001FC", shortname = "",},
["Jerezan Rural Union"] = {abbrev = "", color = "#36368C", shortname = "",},
["Jerezanos en Acción"] = {abbrev = "", color = "#154F92", shortname = "",},
["Jersey Alliance"] = {abbrev = "", color = "#00A8E8", shortname = "",},
["Jersey Liberal Conservatives"] = {abbrev = "JLC", color = "#3741F0", shortname = "Liberal Conservatives",},
["Jesus Lives"] = {abbrev = "", color = "#5175B8", shortname = "",},
["JETZT (party)"] = {abbrev = "", color = "#ADADAD", shortname = "",},
["Jeune Bretagne"] = {abbrev = "", color = "#FFCC33", shortname = "",},
["Jewish Party (Czechoslovakia)"] = {abbrev = "", color = "#DAA520", shortname = "",},
["Jewish Party (Romania)"] = {abbrev = "PER", color = "#0038B8", shortname = "",},
["Jharkhand Anushilan Party"] = {abbrev = "JHAP", color = "#438D80", shortname = "",},
["Jharkhand Disom Party"] = {abbrev = "JDP", color = "#CC6633", shortname = "",},
["Jharkhand Mukti Morcha"] = {abbrev = "JMM", color = "#215B30", shortname = "",},
["Jharkhand Party (Naren)"] = {abbrev = "", color = "#CC0033", shortname = "",},
["Jharkhand Party"] = {abbrev = "", color = "green", shortname = "",},
["Jharkhand People's Party"] = {abbrev = "JPP", color = "#BDBDF2", shortname = "",},
["Jharkhand Vikas Morcha (Prajatantrik)"] = {abbrev = "JVM(P)", color = "#EDFB06", shortname = "",},
["Jim Anderton's Progressive Party"] = {abbrev = "", color = "#9E9E9E", shortname = "Progressive",},
["Jinin Kai"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Jiusan Society"] = {abbrev = "", color = "Indianred", shortname = "Jiusan",},
["Jobbik (2020)"] = {abbrev = "", color = "#008371", shortname = "Jobbik",},
["Jobbik"] = {abbrev = "", color = "#000000", shortname = "",},
["Joe Lhota"] = {abbrev = "", color = "#FF3333", shortname = "",},
["John Frum Movement"] = {abbrev = "", color = "#000080", shortname = "John Frum",},
["John Hampden New Freedom Party"] = {abbrev = "", color = "#801818", shortname = "New Freedom",},
["John Marek Independent Party"] = {abbrev = "JMIP", color = "#FFFFFF", shortname = "",},
["John Perrot"] = {abbrev = "", color = "#DC241f", shortname = "Perrotist",},
["Join Australia Movement Party"] = {abbrev = "", color = "#E7901F", shortname = "Join Australia",},
["Joint Economic Front Party"] = {abbrev = "", color = "#aacc99", shortname = "",},
["Joint List"] = {abbrev = "", color = "#01B2AC", shortname = "",},
["Joint Responsibility Party"] = {abbrev = "", color = "darkgreen", shortname = "",},
["Jordanian Arab Socialist Ba'ath Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Jordanian Communist Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Jordanian Democratic People's Party"] = {abbrev = "", color = "#B11015", shortname = "",},
["Jordanian Democratic Popular Unity Party"] = {abbrev = "", color = "#DF0024", shortname = "",},
["José Antonio Circles"] = {abbrev = "", color = "#00008B", shortname = "",},
["Jubilee Alliance"] = {abbrev = "", color = "#F5051c", shortname = "Jubilee",},
["Jubilee Party"] = {abbrev = "", color = "#E52C1A", shortname = "Jubilee",},
["Judged by Your Work Party"] = {abbrev = "AVI", color = "green", shortname = "",},
["JUI-F"] = {abbrev = "", color = "#595959", shortname = "",},
["Jujuy First"] = {abbrev = "", color = "#283B73", shortname = "",},
["Jujuy People's Movement"] = {abbrev = "", color = "#17117D", shortname = "",},
["Jumhooree Party"] = {abbrev = "JP", color = "#DC143C", shortname = "",},
["June List"] = {abbrev = "", color = "#FF9900", shortname = "",},
["June Movement"] = {abbrev = "", color = "#AAF0D1", shortname = "",},
["Juntos Ganamos"] = {abbrev = "", color = "#9A6859", shortname = "",},
["Juntos Hacemos Historia"] = {abbrev = "", color = "#B5261E", shortname = "",},
["Juntos Podemos Más"] = {abbrev = "", color = "red", shortname = "",},
["Juntos por el Cambio"] = {abbrev = "JxC", color = "#FFD700", shortname = "",},
["Junts pel Sí"] = {abbrev = "JxSí", color = "#5AB6A1", shortname = "",},
["Junts per Alaró"] = {abbrev = "", color = "#71B4DF", shortname = "",},
["Junts per Lô"] = {abbrev = "", color = "#E87C4D", shortname = "",},
["Junts"] = {abbrev = "", color = "#5A61AD", shortname = "",},
["Jury Team"] = {abbrev = "", color = "#708090", shortname = "",},
["Justice (Artsakh)"] = {abbrev = "", color = "#2A2F4D", shortname = "Justice",},
["Justice Alliance"] = {abbrev = "", color = "#4A6FB5", shortname = "",},
["Justice and Construction Party"] = {abbrev = "JCP", color = "#238CCE", shortname = "",},
["Justice and Development Front"] = {abbrev = "FJD", color = "#6F3412", shortname = "",},
["Justice and Development Party (Morocco)"] = {abbrev = "PJD", color = "#022E5F", shortname = "",},
["Justice and Development Party (Turkey)"] = {abbrev = "AKP", color = "#ff8700", shortname = "",},
["Justice and Prosperous People Party"] = {abbrev = "", color = "#20458B", shortname = "",},
["Justice and Reconciliation Party"] = {abbrev = "SPP", color = "#16321B", shortname = "",},
["Justice and Truth Alliance"] = {abbrev = "DA", color = "#FAA304", shortname = "",},
["Justice and Welfare Party"] = {abbrev = "UCID", color = "#355E3B", shortname = "",},
["Justice Coalition (Mongolia)"] = {abbrev = "", color = "#FBEC5D", shortname = "Justice Coalition",},
["Justice Coalition"] = {abbrev = "", color = "#FBEC5D", shortname = "",},
["Justice First"] = {abbrev = "PJ", color = "#FED141", shortname = "",},
["Justice Forum"] = {abbrev = "JEEMA", color = "#2D3094", shortname = "",},
["Justice Party (2001 UK)"] = {abbrev = "", color = "#FFEFD5", shortname = "Justice",},
["Justice Party (Azerbaijan)"] = {abbrev = "", color = "#C20403", shortname = "",},
["Justice Party (India)"] = {abbrev = "", color = "#FFA07A", shortname = "Justice Party",},
["Justice Party (Kosovo)"] = {abbrev = "", color = "red", shortname = "",},
["Justice Party (Mongolia)"] = {abbrev = "", color = "#0080FF", shortname = "",},
["Justice Party (South Korea)"] = {abbrev = "", color = "#FFCC00", shortname = "Justice",},
["Justice Party (Turkey)"] = {abbrev = "AP", color = "#DE0000", shortname = "",},
["Justice Party (Ukraine)"] = {abbrev = "", color = "#CE0700", shortname = "Justice Party",},
["Justice Party (US)"] = {abbrev = "", color = "#ADD8E6", shortname = "Justice",},
["Justice Party of Denmark"] = {abbrev = "", color = "#7F3F97", shortname = "Justice",},
["Justice Social Democratic Party"] = {abbrev = "ASDP", color = "#DA251C", shortname = "",},
["Justice Society (Iran)"] = {abbrev = "JC", color = "#ee1c25", shortname = "",},
["Justice Unity Party"] = {abbrev = "", color = "#32CD32", shortname = "Justice Unity",},
["Justicialist Party"] = {abbrev = "PJ", color = "#318CE7", shortname = "",},
["Juvento"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
amtbp6wx7b58vrwc6s9bizpcbnaecrs
Module:Political party/L
828
68585639
1096495580
1096342274
2022-07-04T20:45:14Z
Number 57
327289
+
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["La France insoumise"] = "La France Insoumise",
["Labor Front"] = "Labour Front",
["Labor Party (United States, 1996)"] = "Labor Party (US, 1996)",
["Labor Party (United States)"] = "Labor Party (US)",
["Labor Party (US, 19th century)"] = "Labor Party (United States, 19th century)",
["Labor Party"] = "Labour Party",
["Labor-Farm Party of Wisconsin"] = "Labor–Farm Party of Wisconsin",
["Labour and Co-operative"] = "Labour Co-operative",
["Labour Coalition"] = "Labour coalition",
["Labour Party (Mexico)"] = "Labor Party (Mexico)",
["Labour Party(UK)"] = "Labour Party (UK)",
["Lakas Kampi CMD"] = "Lakas–Kampi",
["Lakas-Christian Muslim Democrats"] = "Lakas–CMD",
["Lakas-CMD"] = "Lakas–CMD",
["Lakas-CMD (1991)"] = "Lakas–CMD (1991)",
["Lakas-CMD (2009)"] = "Lakas–CMD",
["Lakas-Kampi-CMD"] = "Lakas–Kampi",
["Lakas-NUCD-UMDP"] = "Lakas–CMD (1991)",
["Lakas-NUCD"] = "Lakas–CMD (1991)",
["Lakas–Christian Muslim Democrats"] = "Lakas–CMD",
["Lakas–CMD (2009)"] = "Lakas–CMD",
["Lakas–Kampi–CMD"] = "Lakas–CMD",
["Lakas–NUCD–UMDP"] = "Lakas–CMD (1991)",
["Lakas–NUCD"] = "Lakas–CMD (1991)",
["Lalit"] = "Lalit (Mauritius)",
["Lanka Democratic Party"] = "Lanka Prajathanthravadi Pakshaya",
["Lantmannapartiet"] = "Lantmanna Party",
["Latvian Centrist Party"] = "Centre Party (Latvia)",
["Latvian Social Democratic Alliance"] = "Latvian Social Democratic Workers' Party",
["Law and Order (Latvia)"] = "For Each and Every One",
["Law and Order Party (United States)"] = "Law and Order Party (US)",
["Left for the Right to Decide"] = "Republican Left of Catalonia",
["Left Front (India)"] = "Left Front",
["Left Front (Sri Lanka)"] = "Left Liberation Front",
["Left of the Peoples (1987)"] = "Left of the Peoples",
["Left of the Peoples (1989)"] = "Left of the Peoples",
["Left Option"] = "Estonian Left Party",
["Left Party – Communists"] = "Left Party (Sweden)",
["Left Party-Communists"] = "Left Party (Sweden)",
["Left Radical Party"] = "Radical Party of the Left",
["Left Unity (European Parliament)"] = "European United Left–Nordic Green Left",
["Leftist Workers and Farm Labourers"] = "Communist Party of Latvia",
["Lega per Salvini Premier"] = "Lega (political party)",
["Lib-Lab"] = "Liberal-Labour (UK)",
["Liberal Coalition Party"] = "Liberals (Sweden)",
["Liberal Constitutional Party (Italy)"] = "Historical Right (Italy)",
["Liberal Democratic Party (Chile)"] = "Liberal Democratic Party (Chile, 1893)",
["Liberal Democratic Party (Italy)"] = "Italian Democratic Liberal Party",
["Liberal Democratic Party (Lithuania)"] = "Order and Justice",
["Liberal Democratic Party (Serbia 2005)"] = "Liberal Democratic Party (Serbia)",
["Liberal Democratic Party (Spain)"] = "Liberal Democratic Party (Spain, 1982)",
["Liberal Democratic Party of Japan"] = "Liberal Democratic Party (Japan)",
["Liberal Democratic Party of Russia"] = "LDPR (political party)",
["Liberal Democratic Party of Switzerland"] = "Liberal Party of Switzerland",
["Liberal Democrats"] = "Liberal Democrats (UK)",
["Liberal Movement"] = "Liberal Movement (Australia)",
["Liberal National Party (UK, 1931)"] = "National Liberal Party (UK, 1931)",
["Liberal Party (Luxembourg)"] = "Liberal League (Luxembourg)",
["Liberal Party (Scotland)"] = "Scottish Liberal Party",
["Liberal Party of Australia (Australian Capital Territory Division)"] = "Liberal Party of Australia (A.C.T. Division)",
["Liberal Party of New York"] = "Liberal Party (New York)",
["Liberal Party of Sweden"] = "Liberals (Sweden)",
["Liberal Party"] = "Democratic Liberal Party (Japan)",
["Liberal People's Party (Sweden)"] = "Liberals (Sweden)",
["Liberal People's Party"] = "Liberals (Sweden)",
["Liberal Reformist Party + Democratic Front of Francophones"] = "Reformist Movement",
["Liberal Reformist Party"] = "Liberal Reformist Party (Belgium)",
["Liberal Republican Party (United States)"] = "Liberal Republican Party (US)",
["Liberal Socialist Party"] = "Liberal Socialist Party (Singapore)",
["Liberal Socialists Party"] = "Liberal Socialists Party (Egypt)",
["Liberal Unionist Party (UK)"] = "Liberal Unionist Party",
["Liberal Unionist"] = "Liberal Unionist Party",
["Liberal-Labour (New Zealand)"] = "Liberal–Labour (New Zealand)",
["Liberals (Italy)"] = "Liberal Union (Italy)",
["Liberals–Democrats–Radicals"] = "Liberals, Democrats and Radicals",
["Liberals' Movement of the Republic of Lithuania"] = "Liberal Movement (Lithuania)",
["Libertad y Refundación"] = "Liberty and Refoundation",
["Libertarian, Direct, Democratic"] = "Libertair, Direct, Democratisch",
["Libertarian Party (UK)"] = "Libertarian Party UK",
["Libertarian Party (United Kingdom)"] = "Libertarian Party UK",
["Libertarian Party (United States)"] = "Libertarian Party (US)",
["Libertarian Party (Alaska)"] = "Libertarian Party (US)",
["Libertarian Party (Arizona)"] = "Libertarian Party (US)",
["Libertarian Party (California)"] = "Libertarian Party (US)",
["Libertarian Party (Colorado)"] = "Libertarian Party (US)",
["Libertarian Party (Connecticut)"] = "Libertarian Party (US)",
["Libertarian Party (Delaware)"] = "Libertarian Party (US)",
["Libertarian Party (Iowa)"] = "Libertarian Party (US)",
["Libertarian Party (Massachusetts)"] = "Libertarian Party (US)",
["Libertarian Party (Michigan)"] = "Libertarian Party (US)",
["Libertarian Party (Missouri)"] = "Libertarian Party (US)",
["Libertarian Party (Nevada)"] = "Libertarian Party (US)",
["Libertarian Party (New Mexico)"] = "Libertarian Party (US)",
["Libertarian Party (New York)"] = "Libertarian Party (US)",
["Libertarian Party (Oregon)"] = "Libertarian Party (US)",
["Libertarian Party (Vermont)"] = "Libertarian Party (US)",
["Libertarian Party (Washington)"] = "Libertarian Party (US)",
["Libertarian Party of Arizona"] = "Libertarian Party (US)",
["Libertarian Party of California"] = "Libertarian Party (US)",
["Libertarian Party of Colorado"] = "Libertarian Party (US)",
["Libertarian Party of Connecticut"] = "Libertarian Party (US)",
["Libertarian Party of Delaware"] = "Libertarian Party (US)",
["Libertarian Party of Florida"] = "Libertarian Party (US)",
["Libertarian Party of Georgia"] = "Libertarian Party (US)",
["Libertarian Party of Kentucky"] = "Libertarian Party (US)",
["Libertarian Party of Maryland"] = "Libertarian Party (US)",
["Libertarian Party of Massachusetts"] = "Libertarian Party (US)",
["Libertarian Party of Michigan"] = "Libertarian Party (US)",
["Libertarian Party of Minnesota"] = "Libertarian Party (US)",
["Libertarian Party of Missouri"] = "Libertarian Party (US)",
["Libertarian Party of Montana"] = "Libertarian Party (US)",
["Libertarian Party of Nevada"] = "Libertarian Party (US)",
["Libertarian Party of New Mexico"] = "Libertarian Party (US)",
["Libertarian Party of New York"] = "Libertarian Party (US)",
["Libertarian Party of North Carolina"] = "Libertarian Party (US)",
["Libertarian Party of North Dakota"] = "Libertarian Party (US)",
["Libertarian Party of Ohio"] = "Libertarian Party (US)",
["Libertarian Party of Oregon"] = "Libertarian Party (US)",
["Libertarian Party of Pennsylvania"] = "Libertarian Party (US)",
["Libertarian Party of Texas"] = "Libertarian Party (US)",
["Libertarian Party of Utah"] = "Libertarian Party (US)",
["Libertarian Party of Washington"] = "Libertarian Party (US)",
["Libertarian Party of Wisconsin"] = "Libertarian Party (US)",
["Libertas (lobby group)"] = "Libertas.eu",
["Libertas Spain"] = "Libertas.eu",
["Liberty Forward Party"] = "Advancement Unification Party",
["Liberty Party (United States, 1840)"] = "Liberty Party (US)",
["Liberty Party (United States, 1932)"] = "Liberty Party (US)",
["Liberty Party (United States)"] = "Liberty Party (US)",
["Liberty Party (US, 1840)"] = "Liberty Party (US)",
["Liberty Party"] = "Liberty Party (US)",
["Libra Party (Albania)"] = "Libra Party",
["Libyan Arab Socialist Union"] = "Arab Socialist Union (Libya)",
["LID"] = "Left and Democrats",
["Ligue du Midi"] = "Ligue du Sud",
["Local"] = "Localist",
["Lok Dal"] = "Lokdal",
["Lok Jan Shakti Party"] = "Lok Janshakti Party",
["Long Live Tunisia"] = "Tahya Tounes",
["LPHK"] = "Liberal Party (Hong Kong)",
["LPR"] = "League of Polish Families",
["LSSP"] = "Lanka Sama Samaja Party",
["Luys Alliance"] = "Bright Alliance",
}
local full = {
["L'Alternativa c'è"] = {abbrev = "", color = "#FE9F07", shortname = "",},
["L'Hospitalet Left Alternative"] = {abbrev = "", color = "#42837D", shortname = "",},
["La Axarquía Progress"] = {abbrev = "", color = "#FF990E", shortname = "",},
["La España en Marcha"] = {abbrev = "", color = "#111011", shortname = "",},
["La Falange (1999)"] = {abbrev = "", color = "#29191E", shortname = "",},
["La France En Action"] = {abbrev = "", color = "#F8F1BB", shortname = "",},
["La France Insoumise"] = {abbrev = "LFI", color = "#C9462C", shortname = "",},
["La Fresneda Local Platform"] = {abbrev = "", color = "#004D21", shortname = "",},
["La Línea 100x100"] = {abbrev = "", color = "#FA5841", shortname = "",},
["La Palma Group of Independents"] = {abbrev = "", color = "#072357", shortname = "",},
["La République En Marche!"] = {abbrev = "LREM", color = "#FFD600", shortname = "",},
["Laban ng Demokratikong Pilipino"] = {abbrev = "LDP", color = "#0000CD", shortname = "",},
["Laban ng Makabayang Masang Pilipino"] = {abbrev = "LAMMP", color = "#ffa500", shortname = "",},
["Labor and Agrarian Party"] = {abbrev = "PALA", color = "royalblue", shortname = "",},
["Labor Party (Mexico)"] = {abbrev = "PT", color = "#DB2017", shortname = "",},
["Labor Party (South Korea)"] = {abbrev = "", color = "#DC143C", shortname = "Labor",},
["Labor Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["Labor Party (United States, 19th century)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party (US, 1996)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party (US)"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party of the United States"] = {abbrev = "", color = "#FF6347", shortname = "Labor",},
["Labor Party Philippines"] = {abbrev = "WPP", color = "#00039F", shortname = "",},
["Labor Solidarity"] = {abbrev = "SL", color = "purple", shortname = "",},
["Labor Union of Games and Gambling in Macau"] = {abbrev = "", color = "#B2FFFF", shortname = "",},
["Labor–Farm Party of Wisconsin"] = {abbrev = "", color = "#EEEEEE", shortname = "",},
["Labor-Gesher-Meretz"] = {abbrev = "", color = "#ED1B25", shortname = "Emet",},
["Labor-Gesher"] = {abbrev = "", color = "#EE161F", shortname = "",},
["Labor"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Laboring People's Party"] = {abbrev = "", color = "red", shortname = "",},
["Laborious Ukraine Electoral Bloc"] = {abbrev = "", color = "#872558", shortname = "Labour Ukraine",},
["Laborist Party (Mexico)"] = {abbrev = "", color = "#CE1126", shortname = "Laborist Party",},
["Laborista Party"] = {abbrev = "", color = "green", shortname = "",},
["Labour and Equity Party"] = {abbrev = "", color = "#4e92d3", shortname = "",},
["Labour and Justice Party (Spain)"] = {abbrev = "", color = "#AD0000", shortname = "",},
["Labour and Solidarity Party"] = {abbrev = "", color = "#5963cf", shortname = "",},
["Labour and Trade Union Group"] = {abbrev = "", color = "#D44442", shortname = "Labour and Trade Union",},
["Labour Cause's Party"] = {abbrev = "", color = "#9F030A", shortname = "",},
["Labour coalition"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Labour Co-operative"] = {abbrev = "", color = "#E4003B", shortname = "Labour Co-op",},
["Labour Democratic Party"] = {abbrev = "", color = "Pink", shortname = "Labour Democracy",},
["Labour Democrats"] = {abbrev = "", color = "#59A421", shortname = "",},
["Labour Electoral Association"] = {abbrev = "LEA", color = "#B22222", shortname = "",},
["Labour Faction (1937)"] = {abbrev = "SP", color = "#1693F4", shortname = "",},
["Labour Front"] = {abbrev = "LF", color = "#AA5634", shortname = "",},
["Labour Gathering Party"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Labour Independent Group"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Labour Party (Argentina)"] = {abbrev = "PL", color = "#00708B", shortname = "Labour Party",},
["Labour Party (Greenland)"] = {abbrev = "", color = "pink", shortname = "Labour",},
["Labour Party (Hong Kong)"] = {abbrev = "", color = "#F7941E", shortname = "Labour",},
["Labour Party (Indonesia, 1949)"] = {abbrev = "", color = "red", shortname = "Labour",},
["Labour Party (Indonesia, 1998)"] = {abbrev = "", color = "#000080", shortname = "Labour",},
["Labour Party (Indonesia, 2021)"] = {abbrev = "", color = "#ff6800", shortname = "Labour",},
["Labour Party (Ireland)"] = {abbrev = "Lab", color = "#CC0000", shortname = "Labour",},
["Labour Party (Lithuania)"] = {abbrev = "DP", color = "#1D578C", shortname = "",},
["Labour Party (Malta)"] = {abbrev = "", color = "#EE3224", shortname = "Labour",},
["Labour Party (Mauritius)"] = {abbrev = "", color = "#FF0000", shortname = "Labour Party",},
["Labour Party (Morocco)"] = {abbrev = "", color = "#D04933", shortname = "",},
["Labour Party (Netherlands)"] = {abbrev = "PvdA", color = "#DF111A", shortname = "",},
["Labour Party (New Caledonia)"] = {abbrev = "PT", color = "#9A0000", shortname = "",},
["Labour Party (Nigeria)"] = {abbrev = "LP", color = "#F0DC82", shortname = "",},
["Labour Party (Norway)"] = {abbrev = "", color = "#EF3340", shortname = "Labour",},
["Labour Party (Poland)"] = {abbrev = "SP", color = "#083A7F", shortname = "",},
["Labour Party (Secular)"] = {abbrev = "LP(S)", color = "#2E64FE", shortname = "",},
["Labour Party (Singapore)"] = {abbrev = "", color = "#CC8955", shortname = "Labour Party",},
["Labour Party (Slovakia)"] = {abbrev = "SP", color = "#C31B3E", shortname = "",},
["Labour Party (South Africa, 1969)"] = {abbrev = "", color = "#8D0000", shortname = "Labour",},
["Labour Party (South Africa)"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Party (Thailand)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Labour Party (Turkey)"] = {abbrev = "", color = "#FFDE4D", shortname = "Labour",},
["Labour Party (UK)"] = {abbrev = "Lab", color = "#E4003B", shortname = "Labour",},
["Labour Party in Northern Ireland"] = {abbrev = "", color = "#DC241F", shortname = "",},
["Labour Party of Bosnia and Herzegovina"] = {abbrev = "", color = "#013971", shortname = "",},
["Labour Party of Brazil"] = {abbrev = "PTdoB", color = "#00FF00", shortname = "",},
["Labour Party of Hong Kong"] = {abbrev = "", color = "#DE2910", shortname = "Labour",},
["Labour Party of India (V V Prasad)"] = {abbrev = "LPI(V)", color = "#4C81B6", shortname = "",},
["Labour Party of India"] = {abbrev = "LPI", color = "#E0E6F8", shortname = "",},
["Labour Party of Malaya"] = {abbrev = "", color = "#FAAFBA", shortname = "",},
["Labour Party of Northern Ireland"] = {abbrev = "", color = "#DC241f", shortname = "Labour Party NI",},
["Labour Party Pakistan"] = {abbrev = "", color = "#FE2712", shortname = "",},
["Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "Labour",},
["Labour Progressive"] = {abbrev = "", color = "red", shortname = "",},
["Labour Renewal Movement"] = {abbrev = "", color = "#23FF00", shortname = "",},
["Labour Representation Committee (1900)"] = {abbrev = "", color = "#b22222", shortname = "Labour Repr. Cmte.",},
["Labour Representation Committee"] = {abbrev = "", color = "#b22222", shortname = "Labour",},
["Labour Republican Party"] = {abbrev = "", color = "#FF9340", shortname = "",},
["Labour Solidarity"] = {abbrev = "SP", color = "#D33F49", shortname = "",},
["Labour Ukraine"] = {abbrev = "", color = "Purple", shortname = "",},
["Labour Union (Poland)"] = {abbrev = "UP", color = "#ED1C24", shortname = "",},
["Labour Unionist"] = {abbrev = "", color = "#DDEEFF", shortname = "",},
["Labour-Farmer Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Labour, Co-operative and Trade Union"] = {abbrev = "", color = "white", shortname = "Labour, Co-op & Trade Union",},
["Labourers and Farmers Party"] = {abbrev = "", color = "#FF0000", shortname = "Labourers–Farmers",},
["Ladlad"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Lahu National Development Party"] = {abbrev = "LHNDP", color = "#A66971", shortname = "",},
["Lakas ng Bansa"] = {abbrev = "", color = "#0000CD", shortname = "",},
["Lakas ng Bayan Coalition"] = {abbrev = "LABAN", color = "#FFFF40", shortname = "",},
["Lakas ng Bayan"] = {abbrev = "LABAN", color = "#FFFF00", shortname = "",},
["Lakas–CMD (1991)"] = {abbrev = "", color = "#B0E0E6", shortname = "Lakas",},
["Lakas–CMD"] = {abbrev = "", color = "#B0E0E6", shortname = "Lakas",},
["Lakas–Kampi"] = {abbrev = "LKS-KAM", color = "#B0E0E6", shortname = "Lakas–Kampi",},
["Lakas-Laban Coalition"] = {abbrev = "L–L", color = "#B0E0E6", shortname = "Lakas–Laban",},
["Lalit (Mauritius)"] = {abbrev = "", color = "#F7CC06", shortname = "",},
["Land and Justice Party"] = {abbrev = "", color = "#DC261B", shortname = "Land & Justice",},
["Land development"] = {abbrev = "", color = "#CDB79E", shortname = "",},
["Land Justice League"] = {abbrev = "", color = "#73BC7C", shortname = "",},
["Land Party (South Africa)"] = {abbrev = "", color = "#7e803e", shortname = "Land Party",},
["Land Party"] = {abbrev = "", color = "#4898B9", shortname = "",},
["Landbund"] = {abbrev = "", color = "#385A38", shortname = "",},
["Landless People's Movement (Namibia)"] = {abbrev = "", color = "#FC7B2C", shortname = "",},
["Lanka Prajathanthravadi Pakshaya"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Lanka Sama Samaja Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Lantmanna and Bourgeois Party"] = {abbrev = "", color = "#ff9933", shortname = "Lantmanna and Bourgeois",},
["Lantmanna Party"] = {abbrev = "", color = "#00529C", shortname = "Lantmanna",},
["Lanzarote Avanza"] = {abbrev = "", color = "#037468", shortname = "",},
["Lanzarote Independents Party"] = {abbrev = "", color = "#31B404", shortname = "",},
["Lanzarote Neighborhood Force"] = {abbrev = "", color = "#98CCFE", shortname = "",},
["Lao National Union Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Lao Patriotic Front"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Lao People's Revolutionary Party"] = {abbrev = "LPRP", color = "#CE1126", shortname = "",},
["Lapiang Manggagawa"] = {abbrev = "LM", color = "#00039f", shortname = "",},
["LaPrimaire.org"] = {abbrev = "", color = "#800080", shortname = "",},
["Las Palmas de Gran Canaria Puede"] = {abbrev = "", color = "#96CA2D", shortname = "",},
["Latgale Party"] = {abbrev = "", color = "#004B84", shortname = "",},
["Latvia First"] = {abbrev = "", color = "#9E3039", shortname = "",},
["Latvia's First Party"] = {abbrev = "", color = "#582B64", shortname = "",},
["Latvia's First Party/Latvian Way"] = {abbrev = "", color = "#682376", shortname = "",},
["Latvian Association of Regions"] = {abbrev = "LRA", color = "#0E3267", shortname = "",},
["Latvian Farmers' Union"] = {abbrev = "LZS", color = "#D5D900", shortname = "",},
["Latvian Green Party"] = {abbrev = "", color = "#00683A", shortname = "",},
["Latvian National Independence Movement"] = {abbrev = "", color = "#902E3B", shortname = "",},
["Latvian Nationalists"] = {abbrev = "", color = "#9E2B38", shortname = "",},
["Latvian Russian Union"] = {abbrev = "", color = "#3560A9", shortname = "",},
["Latvian Social Democratic Workers' Party"] = {abbrev = "LSDSP", color = "#830D30", shortname = "",},
["Latvian Unity Party"] = {abbrev = "", color = "#DC5356", shortname = "",},
["Latvian Way"] = {abbrev = "", color = "#FFE200", shortname = "",},
["Lauredian Union"] = {abbrev = "UL", color = "#000000", shortname = "",},
["Law and Justice (Georgia)"] = {abbrev = "", color = "#01FFFF", shortname = "",},
["Law and Justice"] = {abbrev = "PiS", color = "#263778", shortname = "",},
["Law and Order Party (US)"] = {abbrev = "", color = "#00DDDD", shortname = "Law and Order",},
["LDPR (political party)"] = {abbrev = "LDPR", color = "#4488CC", shortname = "",},
["Le Trèfle"] = {abbrev = "", color = "#77FF77", shortname = "",},
["Leaders Party of Vanuatu"] = {abbrev = "", color = "#3DAB48", shortname = "",},
["League Against Usury"] = {abbrev = "LCC", color = "lightgreen", shortname = "",},
["League for Democracy Party"] = {abbrev = "", color = "#3BB9FF", shortname = "",},
["League Nepal Shanti Ekta Party"] = {abbrev = "", color = "#E6DBCF", shortname = "",},
["League of Albanians of Romania"] = {abbrev = "LSR", color = "#444444", shortname = "",},
["League of Catalonia–Catalan Liberal Party"] = {abbrev = "", color = "#99FF00", shortname = "",},
["League of Communists – Movement for Yugoslavia"] = {abbrev = "", color = "#FF0000", shortname = "",},
["League of Communists of Bosnia and Herzegovina"] = {abbrev = "SK BiH", color = "#DD0000", shortname = "",},
["League of Communists of Croatia"] = {abbrev = "SKH", color = "#DD0000", shortname = "",},
["League of Communists of Montenegro"] = {abbrev = "SKCG", color = "#DD0000", shortname = "",},
["League of Communists of Serbia"] = {abbrev = "SKS", color = "#DD0000", shortname = "",},
["League of Communists of Slovenia"] = {abbrev = "ZKS", color = "#DD0000", shortname = "",},
["League of Communists of Yugoslavia"] = {abbrev = "SKJ", color = "#DD0000", shortname = "",},
["League of Democratic Socialists"] = {abbrev = "BDS", color = "red", shortname = "",},
["League of Free Liberals"] = {abbrev = "BVL", color = "#3399FF", shortname = "",},
["League of Polish Families"] = {abbrev = "LPR", color = "#2DA0D2", shortname = "",},
["League of Social Democrats of Vojvodina"] = {abbrev = "LSV", color = "#03C03C", shortname = "",},
["League of Social Democrats"] = {abbrev = "LSD", color = "#e0050d", shortname = "",},
["League of Socialist Youth of Bosnia and Herzegovina"] = {abbrev = "", color = "#FF6347", shortname = "",},
["League of Supporters of Indonesian Independence"] = {abbrev = "", color = "#D1E231", shortname = "",},
["League of the South (France)"] = {abbrev = "", color = "#C60B27", shortname = "",},
["League of West German Communists"] = {abbrev = "BWK", color = "red", shortname = "",},
["Lebanese Forces"] = {abbrev = "", color = "#8C0000", shortname = "",},
["Lecompton Democrat"] = {abbrev = "", color = "#ACCCFE", shortname = "Lecompton Democratic",},
["Leeds Left Alliance"] = {abbrev = "", color = "#00A86B", shortname = "",},
["Left (Austria)"] = {abbrev = "", color = "#FF0000", shortname = "Left",},
["Left Alliance (Finland)"] = {abbrev = "", color = "#F00A64", shortname = "Left Alliance",},
["Left Alliance (Spain)"] = {abbrev = "AI", color = "#CD0F0F", shortname = "",},
["Left Alternative"] = {abbrev = "", color = "red", shortname = "",},
["Left and Democrats"] = {abbrev = "LiD", color = "#D22833", shortname = "",},
["Left Andalusian Bloc"] = {abbrev = "", color = "#32754C", shortname = "",},
["Left Assembly of Tudela"] = {abbrev = "", color = "#CC7EAE", shortname = "",},
["Left Assembly–Initiative for Andalusia"] = {abbrev = "", color = "#ADA0A3", shortname = "",},
["Left Bloc (Portugal)"] = {abbrev = "BE", color = "#8B0000", shortname = "",},
["Left Bloc for National Liberation"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Left Bloc"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Left Camp of Israel"] = {abbrev = "Sheli", color = "#DC241F", shortname = "",},
["Left Coalition (Serbia)"] = {abbrev = "LK", color = "#A60C19", shortname = "",},
["Left Communists (Weimar Republic)"] = {abbrev = "LK", color = "red", shortname = "",},
["Left Democratic Front (Kerala)"] = {abbrev = "LDF", color = "#EE0000", shortname = "",},
["Left Democratic Front"] = {abbrev = "", color = "Red", shortname = "",},
["Left Ecology Freedom"] = {abbrev = "", color = "#C80815", shortname = "",},
["Left for Almería"] = {abbrev = "", color = "#037949", shortname = "",},
["Left Front (Asturias)"] = {abbrev = "", color = "#76319B", shortname = "",},
["Left Front (France)"] = {abbrev = "FG", color = "#D6232B", shortname = "",},
["Left Front (West Bengal)"] = {abbrev = "LF", color = "#FF0000", shortname = "",},
["Left Front"] = {abbrev = "LF", color = "red", shortname = "",},
["Left in Positive"] = {abbrev = "", color = "#9B0F3B", shortname = "",},
["Left Independentists"] = {abbrev = "", color = "#AF1B1D", shortname = "",},
["Left Liberation Front"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Left List"] = {abbrev = "", color = "red", shortname = "",},
["Left Movement"] = {abbrev = "", color = "#BD1928", shortname = "",},
["Left Nationalists"] = {abbrev = "", color = "#E53E13", shortname = "",},
["Left of Catalonia–Democratic Electoral Front"] = {abbrev = "", color = "#EFF24C", shortname = "",},
["Left of Galicia"] = {abbrev = "", color = "#E80810", shortname = "",},
["Left of the Peoples"] = {abbrev = "", color = "#D56545", shortname = "",},
["Left Party - Communists"] = {abbrev = "", color = "#b00000", shortname = "Left-Communist",},
["Left Party (France)"] = {abbrev = "", color = "#AA0000", shortname = "Left Party",},
["Left Party (Sweden)"] = {abbrev = "V", color = "#B00000", shortname = "Left",},
["Left Party (Turkey)"] = {abbrev = "", color = "#0069B4", shortname = "SOL",},
["Left Peraltese Union"] = {abbrev = "", color = "#A1138C", shortname = "",},
["Left Platform of Coslada"] = {abbrev = "", color = "#244E0E", shortname = "",},
["Left Republican Party (Spain)"] = {abbrev = "", color = "#7F1E6D", shortname = "",},
["Left Segovia"] = {abbrev = "", color = "#F53000", shortname = "",},
["Left Socialist Initiative"] = {abbrev = "", color = "#DE0929", shortname = "",},
["Left Socialist Party (Belgium)"] = {abbrev = "", color = "red", shortname = "",},
["Left Socialist Party (Sweden)"] = {abbrev = "", color = "red", shortname = "Left Socialist",},
["Left Socialists"] = {abbrev = "", color = "#E72240", shortname = "",},
["Left Struggle"] = {abbrev = "MA", color = "red", shortname = "",},
["Left Together"] = {abbrev = "", color = "#870f57", shortname = "",},
["Left Union for a Clean and Holy Republic"] = {abbrev = "", color = "#F11928", shortname = "",},
["Left Unity (UK)"] = {abbrev = "", color = "red", shortname = "Left Unity",},
["Left Unity"] = {abbrev = "", color = "#990000", shortname = "",},
["Left-Green Movement"] = {abbrev = "", color = "#00B878", shortname = "Left-Green",},
["Leftist Socialist Party of Japan"] = {abbrev = "", color = "#ff4444", shortname = "Leftist Socialist",},
["Leftwing Revolutionary Nationalist Movement"] = {abbrev = "", color = "#E34234", shortname = "",},
["Lega Nord"] = {abbrev = "", color = "#008000", shortname = "Lega Nord",},
["Lega (political party)"] = {abbrev = "", color = "#008000", shortname = "Lega",},
["Legal Marijuana Now Party"] = {abbrev = "", color = "#50C878", shortname = "Legal Marijuana Now",},
["Legalise Cannabis Australia"] = {abbrev = "", color = "#6fc442", shortname = "",},
["Legalise Cannabis Alliance"] = {abbrev = "", color = "#669966", shortname = "Legalise Cannabis",},
["Legality Movement Party"] = {abbrev = "", color = "#FFFF05", shortname = "",},
["Leganemos"] = {abbrev = "", color = "#8183D8", shortname = "",},
["Legitimist"] = {abbrev = "", color = "#1F497D", shortname = "",},
["Lelo for Georgia"] = {abbrev = "", color = "#F0CE0D", shortname = "Lelo",},
["León Despierta"] = {abbrev = "", color = "#4B244C", shortname = "",},
["León en Común"] = {abbrev = "", color = "#9D181D", shortname = "",},
["Leonese Autonomist Party–Leonesist Unity"] = {abbrev = "", color = "#D44F0C", shortname = "",},
["Leonese Convergence"] = {abbrev = "", color = "#FFCBDB", shortname = "",},
["Leonese People's Union"] = {abbrev = "UPL", color = "#B41062", shortname = "",},
["Leonid Chernovetskyi Bloc"] = {abbrev = "", color = "Gold", shortname = "",},
["Lepsza Polska"] = {abbrev = "", color = "white", shortname = "",},
["Les Centristes"] = {abbrev = "LC", color = "#6F97CF", shortname = "",},
["Les Verts Fraternels"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Lesotho Congress for Democracy"] = {abbrev = "LCD", color = "#78a22c", shortname = "",},
["Lespwa"] = {abbrev = "", color = "#30B700", shortname = "",},
["Let Every Child Have Both Parents"] = {abbrev = "", color = "#DAA520", shortname = "",},
["Let London Live"] = {abbrev = "", color = "#2d1e6d", shortname = "",},
["Let us Give the Change"] = {abbrev = "", color = "#F7D102", shortname = "",},
["Let's Connect Slovenia"] = {abbrev = "PoS", color = "#FDB92E", shortname = "",},
["Let’s Go Peru"] = {abbrev = "", color = "#FA8072", shortname = "",},
["Letterkenny Residents Party"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Levantemos El Puerto"] = {abbrev = "", color = "#93117E", shortname = "",},
["Leviathan Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Lewisham People Before Profit"] = {abbrev = "", color = "#9400d3", shortname = "People Before Profit",},
["Lewisham Peoples' Alliance"] = {abbrev = "", color = "#CCCCCC", shortname = "",},
["Liaison Committee for the Presidential Majority"] = {abbrev = "", color = "#0047AB", shortname = "Presidential Majority",},
["Libera San Marino"] = {abbrev = "", color = "#14AABC", shortname = "Libera",},
["Liberal (Costa Rica)"] = {abbrev = "", color = "#BF1313", shortname = "Liberal",},
["Liberal (South Korea)"] = {abbrev = "", color = "#004EA2", shortname = "",},
["Liberal Alliance (Chile)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Alliance (Denmark)"] = {abbrev = "", color = "#3FB2BE", shortname = "Liberal Alliance",},
["Liberal Alliance (Greece)"] = {abbrev = "FISY", color = "#800080", shortname = "",},
["Liberal Alliance (Spain)"] = {abbrev = "", color = "#99FF00", shortname = "",},
["Liberal Alliance of Montenegro"] = {abbrev = "LSCG", color = "#007F00", shortname = "",},
["Liberal Alternative for Manacor"] = {abbrev = "", color = "#291562", shortname = "",},
["Liberal Alternative"] = {abbrev = "", color = "#846394", shortname = "",},
["Liberal and Centre Union"] = {abbrev = "LiCS", color = "#FFD126", shortname = "",},
["Liberal and Country League (SA)"] = {abbrev = "", color = "#0095B6", shortname = "",},
["Liberal and Country League"] = {abbrev = "", color = "#0095B6", shortname = "",},
["Liberal and Country Party"] = {abbrev = "", color = "#080CAB", shortname = "Liberal and Country",},
["Liberal and Democratic Union"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Liberal and Social Alternative"] = {abbrev = "", color = "#4A4999", shortname = "",},
["Liberal Appeal"] = {abbrev = "", color = "#4A48CF", shortname = "",},
["Liberal bloc (Hong Kong)"] = {abbrev = "", color = "#297329", shortname = "Liberal",},
["Liberal Centre (Spain)"] = {abbrev = "", color = "#0DB85E", shortname = "",},
["Liberal Centre"] = {abbrev = "", color = "#00CCA3", shortname = "",},
["Liberal Centrist Union (Spain)"] = {abbrev = "", color = "#3399FF", shortname = "",},
["Liberal Citizens Action"] = {abbrev = "", color = "#F96611", shortname = "",},
["Liberal Conservative Reformers"] = {abbrev = "LKR", color = "#F29200", shortname = "",},
["Liberal Constitutional Party (Egypt)"] = {abbrev = "", color = "#483D8B", shortname = "Liberal Constitutional",},
["Liberal Constitutionalist Party (Mexico)"] = {abbrev = "PLC", color = "#D4AA00", shortname = "",},
["Liberal Democracy (France)"] = {abbrev = "DL", color = "cornflowerblue", shortname = "",},
["Liberal Democracy of Slovenia"] = {abbrev = "LDS", color = "#73C2FB", shortname = "",},
["Liberal Democrat Party (Turkey)"] = {abbrev = "", color = "#00008B", shortname = "Liberal Democrat",},
["Liberal Democrat Party of Chile"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Democratic Centre"] = {abbrev = "", color = "#21A631", shortname = "",},
["Liberal Democratic Congress"] = {abbrev = "KLD", color = "#007FB2", shortname = "",},
["Liberal Democratic Federation of Hong Kong"] = {abbrev = "LDF", color = "#DC2A2A", shortname = "",},
["Liberal Democratic Focus Team"] = {abbrev = "", color = "#FDBB30", shortname = "Lib Dem Focus Team",},
["Liberal Democratic Party (Australia)"] = {abbrev = "", color = "#0E3B6D", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Bangladesh)"] = {abbrev = "LDP", color = "#FFBF00", shortname = "",},
["Liberal Democratic Party (Cambodia)"] = {abbrev = "", color = "blue", shortname = "",},
["Liberal Democratic Party (Chile, 1893)"] = {abbrev = "", color = "#00CCCC", shortname = "Liberal Democratic",},
["Liberal Democratic Party (El Salvador)"] = {abbrev = "", color = "#E7D055", shortname = "",},
["Liberal Democratic Party (France)"] = {abbrev = "PLD", color = "#0080FF", shortname = "",},
["Liberal Democratic Party (Iceland)"] = {abbrev = "", color = "#3466E4", shortname = "",},
["Liberal Democratic Party (Japan)"] = {abbrev = "", color = "#3CA324", shortname = "Liberal Democratic",},
["Liberal Democratic Party (Kenya)"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Democratic Party (Malaysia)"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Liberal Democratic Party (Netherlands)"] = {abbrev = "", color = "#333399", shortname = "",},
["Liberal Democratic Party (North Macedonia)"] = {abbrev = "LDP", color = "#2B2F7D", shortname = "",},
["Liberal Democratic Party (Romania)"] = {abbrev = "PLD", color = "#ff6633", shortname = "",},
["Liberal Democratic Party (Serbia)"] = {abbrev = "LDP", color = "#6901d4", shortname = "",},
["Liberal Democratic Party (Slovenia)"] = {abbrev = "LDS", color = "#139BEA", shortname = "",},
["Liberal Democratic Party (Spain, 1913)"] = {abbrev = "", color = "#009933", shortname = "Liberal Democrats",},
["Liberal Democratic Party (Spain, 1982)"] = {abbrev = "PDL", color = "#339CD5", shortname = "",},
["Liberal Democratic Party (Thailand)"] = {abbrev = "", color = "#ffd700", shortname = "",},
["Liberal Democratic Party (Turkey)"] = {abbrev = "LDP", color = "#000099", shortname = "",},
["Liberal Democratic Party of the Soviet Union"] = {abbrev = "LDPSU", color = "#7295DB", shortname = "",},
["Liberal Democratic Party of Belarus"] = {abbrev = "LDPB", color = "#0064A9", shortname = "",},
["Liberal Democratic Party of Germany"] = {abbrev = "LDPD", color = "#FFA500", shortname = "",},
["Liberal Democratic Party of Moldova"] = {abbrev = "PLDM", color = "#0E8A4A", shortname = "",},
["Liberal Democratic Republican Party"] = {abbrev = "", color = "#1DACD6", shortname = "",},
["Liberal Democratic Union (Albania)"] = {abbrev = "BLD", color = "#2EA5E9", shortname = "",},
["Liberal Democrats (Germany)"] = {abbrev = "LD", color = "#F98113", shortname = "",},
["Liberal Democrats (UK)"] = {abbrev = "Lib Dem", color = "#FAA61A", shortname = "Liberal Democrats",},
["Liberal Democrats' Rally for National Reconstruction – Vivoten"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Egyptian Party"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Liberal Federation"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Liberal Force"] = {abbrev = "FL", color = "#FFDD93", shortname = "",},
["Liberal Forum"] = {abbrev = "LiF", color = "#FFDC00", shortname = "",},
["Liberal Front Party"] = {abbrev = "PFL", color = "#99ff33", shortname = "",},
["Liberal Group of Andratx"] = {abbrev = "", color = "#6699CC", shortname = "",},
["Liberal Group Sanxenxo"] = {abbrev = "", color = "#0078B3", shortname = "",},
["Liberal Independent Group"] = {abbrev = "", color = "#009B31", shortname = "",},
["Liberal Initiative"] = {abbrev = "", color = "#00ADEF", shortname = "",},
["Liberal League (Finland)"] = {abbrev = "", color = "mediumblue", shortname = "",},
["Liberal League (Japan)"] = {abbrev = "", color = "#FFDF00", shortname = "Liberal League",},
["Liberal League (Luxembourg)"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Left (France)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Left (Spain)"] = {abbrev = "IL", color = "#007138", shortname = "",},
["Liberal Left Coalition"] = {abbrev = "", color = "#6EBD57", shortname = "Liberal Left",},
["Liberal Movement (Australia)"] = {abbrev = "", color = "#8B008B", shortname = "Liberal Movement",},
["Liberal Movement (Lithuania)"] = {abbrev = "LRLS", color = "#F48100", shortname = "",},
["Liberal National Party of Queensland"] = {abbrev = "", color = "#1456F1", shortname = "Liberal National",},
["Liberal Opening Movement"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Oppositionist"] = {abbrev = "", color = "#FFBF00", shortname = "Oppositionist",},
["Liberal Party – Freedom to Choose"] = {abbrev = "", color = "#F19321", shortname = "",},
["Liberal Party (Armenia)"] = {abbrev = "", color = "#EB5F10", shortname = "",},
["Liberal Party (Belgium)"] = {abbrev = "", color = "#3C40D2", shortname = "Liberal",},
["Liberal Party (Bolivia)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party (Bourbon Restoration)"] = {abbrev = "", color = "#FDEE00", shortname = "",},
["Liberal Party (Brazil, 1985)"] = {abbrev = "PL", color = "#FF7F00", shortname = "",},
["Liberal Party (Brazil, 2006)"] = {abbrev = "PL", color = "#282883", shortname = "",},
["Liberal Party (Brazil)"] = {abbrev = "PL", color = "#FF7F00", shortname = "",},
["Liberal Party (Bulgaria)"] = {abbrev = "", color = "#EAC117", shortname = "",},
["Liberal Party (Cambodia)"] = {abbrev = "", color = "#FAAC58", shortname = "Liberal",},
["Liberal Party (Chile, 1849)"] = {abbrev = "", color = "#FFD700", shortname = "Liberal",},
["Liberal Party (Chile, 1988)"] = {abbrev = "", color = "#F5D60A", shortname = "",},
["Liberal Party (Chile, 1998)"] = {abbrev = "", color = "#FFEE00", shortname = "",},
["Liberal Party (Chile)"] = {abbrev = "", color = "#FFAE34", shortname = "",},
["Liberal Party (Croatia)"] = {abbrev = "", color = "#0303fa", shortname = "",},
["Liberal Party (Greece)"] = {abbrev = "", color = "#FFA500", shortname = "Liberal",},
["Liberal Party (Greece, modern)"] = {abbrev = "", color = "orange", shortname = "Liberal",},
["Liberal Party (Guatemala)"] = {abbrev = "", color = "#0000ff", shortname = "Liberal",},
["Liberal Party (Haiti)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party (Hong Kong)"] = {abbrev = "", color = "#00aeef", shortname = "Liberal",},
["Liberal Party (Iceland, historical)"] = {abbrev = "", color = "#00C6FF", shortname = "Liberal",},
["Liberal Party (Iceland)"] = {abbrev = "", color = "#406899", shortname = "Liberal",},
["Liberal Party (Israel)"] = {abbrev = "", color = "#FFCC00", shortname = "Liberal",},
["Liberal Party (Japan, 1890)"] = {abbrev = "", color = "#EFAB93", shortname = "",},
["Liberal Party (Japan, 1945)"] = {abbrev = "", color = "#33D6AD", shortname = "Liberal",},
["Liberal Party (Japan, 1950)"] = {abbrev = "", color = "#459F36", shortname = "Liberal",},
["Liberal Party (Japan, 1998)"] = {abbrev = "", color = "#000099", shortname = "Liberal",},
["Liberal Party (Japan, 2016)"] = {abbrev = "", color = "#0950A0", shortname = "Liberal",},
["Liberal Party (Mexico)"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Liberal Party (Moldova)"] = {abbrev = "PL", color = "#73C2FB", shortname = "",},
["Liberal Party (New York)"] = {abbrev = "", color = "#CC0000", shortname = "Liberal",},
["Liberal Party (Nicaragua)"] = {abbrev = "", color = "#800000", shortname = "Liberal",},
["Liberal Party (Norway)"] = {abbrev = "", color = "#006666", shortname = "Liberal",},
["Liberal Party (Panama)"] = {abbrev = "", color = "#FF0000", shortname = "Liberal",},
["Liberal Party (Paraguay)"] = {abbrev = "", color = "#0000FF", shortname = "Liberal",},
["Liberal Party (Philippines)"] = {abbrev = "LP", color = "#f0e68c", shortname = "Liberal",},
["Liberal Party (Radoslavists)"] = {abbrev = "", color = "maroon", shortname = "",},
["Liberal Party (Rwanda)"] = {abbrev = "PL", color = "#03b464", shortname = "",},
["Liberal Party (Serbia)"] = {abbrev = "", color = "#FAFC38", shortname = "",},
["Liberal Party (Slovenia)"] = {abbrev = "", color = "#FFCC00", shortname = "",},
["Liberal Party (South Korea)"] = {abbrev = "", color = "#098CDC", shortname = "Liberal",},
["Liberal Party (Spain, 1880)"] = {abbrev = "", color = "#83C53A", shortname = "Liberal",},
["Liberal Party (Spain, 1976)"] = {abbrev = "", color = "#006C95", shortname = "",},
["Liberal Party (Thailand)"] = {abbrev = "", color = "#00008B", shortname = "",},
["Liberal Party (UK, 1989)"] = {abbrev = "", color = "#EB7A43", shortname = "Liberal",},
["Liberal Party (UK)"] = {abbrev = "Lib", color = "#ffd700", shortname = "Liberal",},
["Liberal Party (Venezuela)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Party Bangladesh"] = {abbrev = "", color = "#EA6D6A", shortname = "",},
["Liberal Party of Albania"] = {abbrev = "", color = "#F2D863", shortname = "",},
["Liberal Party of Andorra"] = {abbrev = "L'A", color = "#00B1F0", shortname = "",},
["Liberal Party of Australia (A.C.T. Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (New South Wales Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Queensland Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (South Australian Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Tasmanian Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Victorian Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia (Western Australian Division)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Australia"] = {abbrev = "", color = "#0047AB", shortname = "Liberal",},
["Liberal Party of Chile (2013)"] = {abbrev = "", color = "#FF432C", shortname = "Liberal",},
["Liberal Party of Corrientes"] = {abbrev = "", color = "#35AAE0", shortname = "",},
["Liberal Party of Cuba"] = {abbrev = "", color = "#75AADB", shortname = "Liberal",},
["Liberal Party of Ghana"] = {abbrev = "", color = "#F96128", shortname = "",},
["Liberal Party of Gibraltar"] = {abbrev = "", color = "#DF424D", shortname = "Liberal",},
["Liberal Party of Honduras"] = {abbrev = "", color = "#CE2029", shortname = "Liberal",},
["Liberal Party of Kosovo"] = {abbrev = "", color = "brown", shortname = "",},
["Liberal Party of Macedonia"] = {abbrev = "LPM", color = "#FFFF00", shortname = "",},
["Liberal Party of Montenegro"] = {abbrev = "LPCG", color = "#87CEEB", shortname = "",},
["Liberal Party of Norway"] = {abbrev = "", color = "#8CD600", shortname = "Liberal",},
["Liberal Party of South Africa"] = {abbrev = "", color = "#FED86F", shortname = "",},
["Liberal Party of Sri Lanka"] = {abbrev = "", color = "#FFDE17", shortname = "",},
["Liberal Party of State Employment and Housing"] = {abbrev = "", color = "#311829", shortname = "",},
["Liberal Party of Switzerland"] = {abbrev = "", color = "#134B94", shortname = "Liberals",},
["Liberal Party of the Right"] = {abbrev = "", color = "#4955A1", shortname = "",},
["Liberal People's Party (Norway)"] = {abbrev = "", color = "purple", shortname = "",},
["Liberal Popular Alliance"] = {abbrev = "", color = "#3366FF", shortname = "",},
["Liberal Reform Party (Australia)"] = {abbrev = "", color = "#00CED1", shortname = "Liberal Reform",},
["Liberal Reform Party (Czech Republic)"] = {abbrev = "LiRA", color = "yellow", shortname = "",},
["Liberal Reformist Party (Belgium)"] = {abbrev = "PRL", color = "blue", shortname = "",},
["Liberal Reformist Party (Dominican Republic)"] = {abbrev = "", color = "#32cd32", shortname = "",},
["Liberal Reformist Party (Romania)"] = {abbrev = "", color = "#1A92D0", shortname = "",},
["Liberal Reformist Party (Spain)"] = {abbrev = "", color = "#13CED2", shortname = "Romerist",},
["Liberal Regenerator Party"] = {abbrev = "", color = "#1935D0", shortname = "",},
["Liberal Republican Party (Turkey)"] = {abbrev = "", color = "#348AC9", shortname = "",},
["Liberal Republican Party (US)"] = {abbrev = "", color = "#FF69B4", shortname = "Liberal Republican",},
["Liberal Republican Right"] = {abbrev = "DLR", color = "#4EC766", shortname = "",},
["Liberal Samajbadi Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Liberal Socialist Party (Singapore)"] = {abbrev = "LSP", color = "#EE5533", shortname = "",},
["Liberal Socialists Party (Egypt)"] = {abbrev = "", color = "#00EE00", shortname = "",},
["Liberal State Party"] = {abbrev = "", color = "#5A5CBD", shortname = "",},
["Liberal Swedish Party"] = {abbrev = "", color = "Blue", shortname = "",},
["Liberal Union (Australia)"] = {abbrev = "", color = "#0000FF", shortname = "Liberal Union",},
["Liberal Union (Germany)"] = {abbrev = "LV", color = "#EEDC82", shortname = "",},
["Liberal Union (Italy)"] = {abbrev = "", color = "#0047AB", shortname = "Liberal Union",},
["Liberal Union (Netherlands)"] = {abbrev = "LU", color = "#5873DF", shortname = "",},
["Liberal Union (Spain, 1983)"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Liberal Union (Spain)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Liberal Union–Bratiănu"] = {abbrev = "UL–B", color = "#FFDD00", shortname = "",},
["Liberal Union of Lithuania"] = {abbrev = "LLS", color = "#E8CA58", shortname = "",},
["Liberal Unionist Party"] = {abbrev = "LibU", color = "#2061A2", shortname = "Liberal Unionist",},
["Liberal Vannin Party"] = {abbrev = "", color = "#FA8000", shortname = "Liberal Vannin",},
["Liberal-Labour (UK)"] = {abbrev = "Lib-Lab", color = "orange", shortname = "",},
["Liberal-Labour"] = {abbrev = "", color = "orange", shortname = "",},
["Liberal–Labour (New Zealand)"] = {abbrev = "", color = "#FFA500", shortname = "Liberal–Labour",},
["Liberal-Social Union"] = {abbrev = "LSU", color = "#50C878", shortname = "",},
["Liberal/Country coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal/National coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal/NCP coalition"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Liberal"] = {abbrev = "", color = "#FFFF00", shortname = "",}, -- Generic color, not a party color; specify the actual party
["Liberalism in the Netherlands"] = {abbrev = "", color = "#e7cf25", shortname = "",},
["Liberalism"] = {abbrev = "", color = "#FFFF00", shortname = "Liberal",},
["Liberals (Finland)"] = {abbrev = "", color = "gold", shortname = "Liberals",},
["Liberals (Sweden)"] = {abbrev = "L", color = "#006AB3", shortname = "Liberal",},
["Liberals for Åland"] = {abbrev = "", color = "#8e96cb", shortname = "",},
["Liberals of Benidorm"] = {abbrev = "", color = "#359E74", shortname = "",},
["Liberals of Serbia"] = {abbrev = "LS", color = "#FF4F00", shortname = "",},
["Liberals, Democrats and Radicals"] = {abbrev = "", color = "Gold", shortname = "",},
["Liberation Rally"] = {abbrev = "", color = "#CD7F32", shortname = "",},
["Liberation Movement (Serbia)"] = {abbrev = "O", color = "#18478e", shortname = "",},
["Liberator Party (Brazil)"] = {abbrev = "", color = "#F9AF1E", shortname = "",},
["Liberia Destiny Party"] = {abbrev = "", color = "#BEC2CB", shortname = "",},
["Liberia National Union"] = {abbrev = "", color = "#2E7286", shortname = "",},
["Liberia Restoration Party"] = {abbrev = "", color = "#008000", shortname = "",},
["Liberia Transformation Party"] = {abbrev = "", color = "#330104", shortname = "",},
["Liberian Action Party"] = {abbrev = "LAP", color = "#00FFFF", shortname = "",},
["Liberian People's Party"] = {abbrev = "LPP", color = "#DC143C", shortname = "",},
["Libertair, Direct, Democratisch"] = {abbrev = "LDD", color = "#6DCFF6", shortname = "",},
["Libertarian Left (Chile)"] = {abbrev = "", color = "#451255", shortname = "",},
["Libertarian Movement (Costa Rica)"] = {abbrev = "PML", color = "#DC143C", shortname = "",},
["Libertarian Movement Party"] = {abbrev = "", color = "#BA151B", shortname = "",},
["Libertarian Party (Netherlands)"] = {abbrev = "", color = "#1170ce", shortname = "",},
["Libertarian Party (Spain)"] = {abbrev = "", color = "#C9A900", shortname = "",},
["Libertarian Party (Switzerland)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Libertarian Party (US)"] = {abbrev = "", color = "#FED105", shortname = "Libertarian",},
["Libertarian Party of Australia"] = {abbrev = "", color = "#E5C601", shortname = "",},
["Libertarian Party of South Africa"] = {abbrev = "", color = "#BE9F4D", shortname = "",},
["Libertarian Party UK"] = {abbrev = "", color = "#E2B128", shortname = "Libertarian",},
["Libertarianz"] = {abbrev = "", color = "#09296B", shortname = "",},
["Libertas Estonia"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Libertas France"] = {abbrev = "", color = "#003366", shortname = "Libertas",},
["Libertas Ireland"] = {abbrev = "", color = "#3333CC", shortname = "Libertas",},
["Libertas United Kingdom"] = {abbrev = "", color = "#900020", shortname = "Pro-Democracy: Libertas.eu",},
["Libertas.eu"] = {abbrev = "Lib.eu", color = "#2c296e", shortname = "",},
["Liberties and Territories"] = {abbrev = "", color = "#F5B2FF", shortname = "",},
["Liberty (political party, Palestine)"] = {abbrev = "", color = "#C69F14", shortname = "",},
["Liberty (political party)"] = {abbrev = "", color = "#1882C5", shortname = "Volia",},
["Liberty and Lawfulness"] = {abbrev = "WiP", color = "grey", shortname = "",},
["Liberty and Refoundation"] = {abbrev = "", color = "#8B0000", shortname = "Libre",},
["Liberty GB"] = {abbrev = "", color = "#000168", shortname = "",},
["Liberty Korea Party"] = {abbrev = "", color = "#C9151E", shortname = "Liberty Korea",},
["Liberty Party (Liberia)"] = {abbrev = "", color = "#FFD600", shortname = "",},
["Liberty Party (US, 1932)"] = {abbrev = "", color = "#00DDDD", shortname = "Liberty",},
["Liberty Party (US)"] = {abbrev = "", color = "#00DDDD", shortname = "Liberty",},
["Liberty Republican Party"] = {abbrev = "", color = "#009944", shortname = "",},
["Liberty Unification Party"] = {abbrev = "", color = "#E12F33", shortname = "",},
["Liberty Union Party"] = {abbrev = "", color = "#D6FF33", shortname = "Liberty Union",},
["Liberty, Worth Voting For"] = {abbrev = "", color = "#DDDDDD", shortname = "Liberty",},
["Libra Party"] = {abbrev = "", color = "#F8D308", shortname = "",},
["Libres"] = {abbrev = "", color = "#194955", shortname = "",},
["Lider (political party)"] = {abbrev = "", color = "#00AFF0", shortname = "",},
["Liepāja Party"] = {abbrev = "", color = "#50A640", shortname = "",},
["Life – National Party"] = {abbrev = "ŽIVOT–NS", color = "#032F67", shortname = "",},
["Life and Liberty Party"] = {abbrev = "", color = "black", shortname = "Life and Liberty",},
["Liga Veneta"] = {abbrev = "", color = "#0030AA", shortname = "",},
["LiGanDo"] = {abbrev = "", color = "#02A24A", shortname = "",},
["Light Blue and White Union"] = {abbrev = "", color = "blue", shortname = "",},
["Light of Faith (political party)"] = {abbrev = "", color = "#10C8DF", shortname = "Yiman Nuru",},
["Ligue du Sud"] = {abbrev = "LS", color = "#404040", shortname = "",},
["Likud Yisrael Beiteinu"] = {abbrev = "", color = "#1f5aa5", shortname = "",},
["Likud"] = {abbrev = "", color = "#1f5aa5", shortname = "",},
["Linares First"] = {abbrev = "", color = "#1F1715", shortname = "",},
["Lincoln Democratic Labour Association"] = {abbrev = "", color = "#FF6600", shortname = "Democratic Labour",},
["Lincolnshire Independents"] = {abbrev = "", color = "#000000", shortname = "Lincolnshire Independent",},
["Linese Alternative"] = {abbrev = "", color = "#0CB7F2", shortname = "",},
["Lingkod Taguig"] = {abbrev = "", color = "#0051B0", shortname = "",},
["Linyon Demokratik Seselwa"] = {abbrev = "", color = "#2C50A4", shortname = "",},
["List Burgenland"] = {abbrev = "", color = "#F8D323", shortname = "",},
["List Dedecker"] = {abbrev = "", color = "#000080", shortname = "",},
["List for Fiume"] = {abbrev = "", color = "#545AA7", shortname = "",},
["List for Sandžak"] = {abbrev = "", color = "#307A4D", shortname = "List for Sandžak",},
["List of Marjan Šarec"] = {abbrev = "LMŠ", color = "#005AAB", shortname = "",},
["Lista del Apruebo"] = {abbrev = "", color = "#6F4D9A", shortname = "",},
["Lista Niun Paso Atras"] = {abbrev = "", color = "gold", shortname = "",},
["Lisu National Development Party"] = {abbrev = "LNDP", color = "#DC0723", shortname = "",},
["Lithuanian Centre Party"] = {abbrev = "", color = "#0CA13B", shortname = "",},
["Lithuanian Centre Union"] = {abbrev = "LCS", color = "#D6D40F", shortname = "",},
["Lithuanian Christian Democratic Party"] = {abbrev = "LKDP", color = "#3D6DBF", shortname = "",},
["Lithuanian Christian Democrats"] = {abbrev = "", color = "#3333CC", shortname = "",},
["Lithuanian Citizens' Alliance"] = {abbrev = "LPA", color = "#799B6F", shortname = "",},
["Lithuanian Democratic Party"] = {abbrev = "LDP", color = "#007272", shortname = "",},
["Lithuanian Farmers and Greens Union"] = {abbrev = "LVŽS", color = "#009035", shortname = "",},
["Lithuanian Green Party"] = {abbrev = "LŽP", color = "#92C83E", shortname = "",},
["Lithuanian Liberty Union"] = {abbrev = "LLS", color = "#FBB800", shortname = "",},
["Lithuanian List"] = {abbrev = "LS", color = "#810305", shortname = "",},
["Lithuanian Nationalist and Republican Union"] = {abbrev = "", color = "#FDC52A", shortname = "",},
["Lithuanian Peasant Popular Union"] = {abbrev = "", color = "#BBFF02", shortname = "",},
["Lithuanian Peasants Party"] = {abbrev = "LVP", color = "#BAD759", shortname = "",},
["Lithuanian Regions Party"] = {abbrev = "LRP", color = "#CE2C29", shortname = "",},
["Lithuanian Union of Political Prisoners and Deportees"] = {abbrev = "LPKTS", color = "#216319", shortname = "",},
["Livable Netherlands"] = {abbrev = "LN", color = "#FF4400", shortname = "",},
["Liverpool Independent Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Liverpool Protestant Party"] = {abbrev = "", color = "#F88017", shortname = "Protestant",},
["Living Ourense"] = {abbrev = "", color = "#0082CD", shortname = "",},
["LIVRE"] = {abbrev = "", color = "#00CD8C", shortname = "",},
["Llais Gwynedd"] = {abbrev = "", color = "#006400", shortname = "",},
["Llantwit First Independents"] = {abbrev = "", color = "#999999", shortname = "Llantwit First Independent",},
["Lliures"] = {abbrev = "", color = "#E75C73", shortname = "",},
["Lloc Espai Independent"] = {abbrev = "", color = "#E6302B", shortname = "",},
["LMP – Hungary's Green Party"] = {abbrev = "LMP", color = "#36CA8B", shortname = "",},
["Local Alliance"] = {abbrev = "", color = "#000000", shortname = "",},
["Local and Rural Issues"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Local Education Action by Parents"] = {abbrev = "", color = "#CCCCCC", shortname = "",},
["Local Option"] = {abbrev = "", color = "silver", shortname = "",},
["Local Progressive Party"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Localist Bloc of Melilla"] = {abbrev = "", color = "#217118", shortname = "",},
["Localist"] = {abbrev = "", color = "#bb00bb", shortname = "",},
["Localist groups (Hong Kong)"] = {abbrev = "", color = "#002366", shortname = "Localist",},
["Lok Bhalai Party"] = {abbrev = "LBP", color = "#386059", shortname = "",},
["Lok Insaaf Party"] = {abbrev = "LIP", color = "Maroon", shortname = "",},
["Lok Janshakti Party (Ram Vilas)"] = {abbrev = "LJP(RV)", color = "#0093DD", shortname = "",},
["Lok Janshakti Party"] = {abbrev = "LJP", color = "#0093DD", shortname = "",},
["Lok Kalayankari Janata Party Nepal"] = {abbrev = "", color = "#FFEFD5", shortname = "Lok Kalayankari Janata Party",},
["Lok Paritran"] = {abbrev = "LKPT", color = "#f3c0f3", shortname = "",},
["Lok Raj Party Himachal Pradesh"] = {abbrev = "LRP", color = "indigo", shortname = "",},
["Lok Rajya Party"] = {abbrev = "", color = "#9900FF", shortname = "",},
["Lok Satta Party"] = {abbrev = "LSP", color = "#FF1493", shortname = "",},
["Lok Sewak Dal"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Lok Sewak Sangh"] = {abbrev = "", color = "#00FF00", shortname = "",},
["Lok Shakti"] = {abbrev = "", color = "#336600", shortname = "",},
["Lokdal"] = {abbrev = "LKD", color = "#00FF66", shortname = "",},
["Lokpriya Samaj Party"] = {abbrev = "LPSP", color = "#66FF99", shortname = "",},
["Loktanter Suraksha Party"] = {abbrev = "LSP", color = "#FF9900", shortname = "",},
["Loktantra Suraksha Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Loktantrik Jan Samta Party"] = {abbrev = "LJSP", color = "grey", shortname = "",},
["Loktantrik Janata Dal"] = {abbrev = "LJD", color = "#2E8B57", shortname = "",},
["Loktantrik Janata Party (Secular)"] = {abbrev = "LJP(S)", color = "pink", shortname = "",},
["Loktantrik Samajwadi Party, Nepal"] = {abbrev = "LSWP", color = "#c7f884 ", shortname = "Loktantrik Samajwadi",},
["Londependence Party"] = {abbrev = "", color = "#751056", shortname = "Londependence",},
["London Real Party"] = {abbrev = "", color = "#af0823", shortname = "London Real",},
["London Socialist Alliance"] = {abbrev = "", color = "red", shortname = "London Socialist",},
["Longthornton and Tamworth Residents Association"] = {abbrev = "", color = "#000000", shortname = "Longthornton and Tamworth Residents",},
["Lord Fusituʻa"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lord Nuku"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lord Tuʻiʻafitu"] = {abbrev = "", color = "#D3D3D3", shortname = "",},
["Lords Spiritual"] = {abbrev = "", color = "#7F00FF", shortname = "",},
["Loss"] = {abbrev = "", color = "#999999", shortname = "",},
["Loughton Residents Association"] = {abbrev = "", color = "#50C878", shortname = "Loughton Residents",},
["Love Malaysia Party"] = {abbrev = "", color = "#DAE2EA", shortname = "",},
["Love Party (Italy)"] = {abbrev = "", color = "#FF91AF", shortname = "",},
["Love Sabah Party"] = {abbrev = "", color = "#FB5B47", shortname = "",},
["Love, Faith, Hope"] = {abbrev = "", color = "#BC413C", shortname = "",},
["Lower Minho Independents"] = {abbrev = "", color = "#824941", shortname = "",},
["Loyalty and Dignity"] = {abbrev = "", color = "#1e90ff", shortname = "",},
["Luen Wo United"] = {abbrev = "", color = "#000000", shortname = "",},
["Lugonovo"] = {abbrev = "", color = "#E5432C", shortname = "",},
["Luhansk Economic Union"] = {abbrev = "LES", color = "#76C5F0", shortname = "",},
["Lung Mun Concern Group"] = {abbrev = "LMCG", color = "#11A0B4", shortname = "",},
["Lutte Ouvrière"] = {abbrev = "LO", color = "#AA0000", shortname = "",},
["Luxembourg Socialist Workers' Party"] = {abbrev = "LSAP", color = "#E50000", shortname = "",},
["LXE"] = {abbrev = "", color = "#47B9AF", shortname = "",},
["Lytvyn Bloc"] = {abbrev = "", color = "#01B8A4", shortname = "",},
["Lytyn Bloc"] = {abbrev = "", color = "Green", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
evmwzopoie8qotyslfrh28gtq652ei7
Module:Political party/O
828
68669540
1088947122
1088285183
2022-05-21T00:25:52Z
DukeOfDelTaco
36908829
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Octobrist Party"] = "Union of October 17",
["ODS"] = "Civic Democratic Party (Czech Republic)",
["Ohio Democratic Party"] = "Democratic Party (US)",
["Ohio Republican Party"] = "Republican Party (US)",
["One Love Party (UK)"] = "One Love Party",
["One Nation (Australia)"] = "One Nation",
["Open Vlaamse Liberalen en Democraten"] = "Open Flemish Liberals and Democrats",
["Opposition Party (United States)"] = "Opposition Party (US)",
["Opposition"] = "Opposition Party (Southern U.S.)",
["Ordinary People (Slovakia)"] = "Ordinary People and Independent Personalities",
["Ordinary People"] = "Ordinary People and Independent Personalities",
["Oregon Progressive Party"] = "Progressive Party (US)",
["Oregon Republican Party"] = "Republican Party (US)",
["Organisation du Peuple Rodriguais"] = "Rodrigues People's Organisation",
["Orthodox Party"] = "Partido Ortodoxo",
["Other parties (United States)"] = "Other parties",
["Other Party (United States)"] = "Other parties",
["Other parties (US)"] = "Other parties",
["Other Party (US)"] = "Other parties",
["Other"] = "Others",
["Our coalition (Mongolia)"] = "Our Coalition (Mongolia)",
["Our Home is Estonia"] = "Constitution Party (Estonia)",
["Our Home is Russia"] = "Our Home – Russia",
["Our Republican Party"] = "Our Republican Party (2020)",
["Our Ukraine"] = "Our Ukraine (political party)",
}
local full = {
["O Porinetia To Tatou Ai'a"] = {abbrev = "", color = "#FF0000", shortname = "To Tatou Ai'a",},
["Obnovlenie"] = {abbrev = "", color = "#00A900", shortname = "",},
["Occitan Party"] = {abbrev = "", color = "#FFCC33", shortname = "",},
["October Review"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Odisha Communist Party"] = {abbrev = "OCP", color = "#FF0000", shortname = "",},
["Odisha Gana Parishad"] = {abbrev = "OGP", color = "B24E5F", shortname = "",},
["Odisha Jan Morcha"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Odisha Janmorcha"] = {abbrev = "OJM", color = "#3CB371", shortname = "",},
["Odriist National Union"] = {abbrev = "", color = "yellow", shortname = "",},
["OdNowa RP"] = {abbrev = "ONRP", color = "#E0115F", shortname="",},
["Official Monster Raving Loony Party"] = {abbrev = "", color = "#FFF000", shortname = "Monster Raving Loony",},
["Official Sinn Féin"] = {abbrev = "", color = "#D73D3D", shortname = "",},
["Okinawa Social Mass Party"] = {abbrev = "", color = "#009140", shortname = "Okinawa Social Mass",},
["Okinawan People's Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["OlaCantabria"] = {abbrev = "", color = "#00A1AE", shortname = "",},
["Old Lantmanna Party"] = {abbrev = "", color = "#ffb366", shortname = "",},
["Old Social Democratic Party of Germany"] = {abbrev = "", color = "red", shortname = "",},
["Olive Tree (Greece)"] = {abbrev = "ELIA", color = "#008142", shortname = "",},
["Omnia"] = {abbrev = "", color = "#ED007E", shortname = "",},
["Omonoia (organization)"] = {abbrev = "", color = "#9FCBF0", shortname = "",},
["Ompia Party"] = {abbrev = "", color = "", shortname = "Ompia",},
["One Bermuda Alliance"] = {abbrev = "OBA", color = "#de1b22", shortname = "",},
["One Cebu"] = {abbrev = "", color = "#13049D", shortname = "1-Cebu",},
["One Cook Islands Movement"] = {abbrev = "OCI", color = "#20B2AA", shortname = "",},
["One Fiji Party"] = {abbrev = "", color = "#00FFFF", shortname = "",},
["One London"] = {abbrev = "", color = "#0095B6", shortname = "",},
["One Love Party"] = {abbrev = "", color = "#000000", shortname = "One Love",},
["One Nation (Israel)"] = {abbrev = "", color = "#A92F00", shortname = "One Nation",},
["One Nation"] = {abbrev = "", color = "#f36c21", shortname = "",},
["One New Zealand Party"] = {abbrev = "", color = "#800080", shortname = "One NZ",},
["One NL"] = {abbrev = "", color = "#0B3E8D", shortname = "",},
["ONE Party"] = {abbrev = "ONE", color = "#F9D11A", shortname = "",},
["One Rus"] = {abbrev = "", color = "#2200B6", shortname = "",},
["One St. Maarten People Party"] = {abbrev = "", color = "purple", shortname = "",},
["One Tobago Voice"] = {abbrev = "OTV", color = "#ddf969", shortname = "",},
["Ongi Etorri"] = {abbrev = "", color = "#76DD58", shortname = "",},
["Only Croatia – Movement for Croatia"] = {abbrev = "JH", color = "red", shortname = "",},
["Onuguu–Progress"] = {abbrev = "", color = "#BADD1D", shortname = "",},
["Onward for Future 4.0"] = {abbrev = "", color = "#EC1C24", shortname = "",},
["Opción Sampedreña"] = {abbrev = "", color = "#A43B37", shortname = "",},
["Open Cabildo"] = {abbrev = "", color = "#FBC22B", shortname = "",},
["Open Democratic Party"] = {abbrev = "", color = "#005099", shortname = "Open Democratic",},
["Open Democrats"] = {abbrev = "", color = "#0E3F95", shortname = "",},
["Open Flemish Liberals and Democrats"] = {abbrev = "", color = "#0087DC", shortname = "Open Vld",},
["Open Politics for Social Integrity"] = {abbrev = "PAIS", color = "#4F85C5", shortname = "",},
["Open Russia"] = {abbrev = "", color = "#FFDC02", shortname = "",},
["Opening for National Participation"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Operation Christian Vote"] = {abbrev = "", color = "#9966CC", shortname = "Christian Vote",},
["Opportunist Republicans"] = {abbrev = "", color = "#E6AF00", shortname = "",},
["Opposition (parliamentary)"] = {abbrev = "", color = "#9999CC", shortname = "Opposition",},
["Opposition Bloc (2019)"] = {abbrev = "", color = "#2F52A0", shortname = "Opposition Bloc",},
["Opposition Bloc"] = {abbrev = "", color = "#004DA5", shortname = "",},
["Opposition Democratic Coalition"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Opposition Party (Hungary)"] = {abbrev = "", color = "#68001D", shortname = "",},
["Opposition Party (Southern U.S.)"] = {abbrev = "", color = "#FFE153", shortname = "Opposition",},
["Opposition Party (US)"] = {abbrev = "", color = "#FFE153", shortname = "Opposition",},
["Opposition Platform — For Life"] = {abbrev = "OPZZh", color = "#1B62B0", shortname = "",},
["Oppositionist"] = {abbrev = "", color = "#FFBF00", shortname = "",},
["Opus Dei"] = {abbrev = "", color = "#EF9F13", shortname = "",},
["Orange Democratic Movement–Kenya"] = {abbrev = "", color = "orange", shortname = "ODM–Kenya",},
["Orange Democratic Movement"] = {abbrev = "ODM", color = "#F38521", shortname = "",},
["Orange Movement"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Orange Party"] = {abbrev = "", color = "orange", shortname = "",},
["Order and Justice"] = {abbrev = "TT", color = "#FFEC00", shortname = "",},
["Order and Law"] = {abbrev = "", color = "#BD941E", shortname = "",},
["Order, Law and Justice"] = {abbrev = "RZS", color = "#F66E22", shortname = "",},
["Order of the Nation (political party)"] = {abbrev = "RN", color = "darkblue", shortname = "",},
["Ordinary People and Independent Personalities"] = {abbrev = "OĽaNO", color = "#b2c933", shortname = "",},
["Organisation for Democracy and Labour"] = {abbrev = "", color = "blue", shortname = "",},
["Organisation for Democratic and Popular Action"] = {abbrev = "", color = "#FFF185", shortname = "",},
["Organisation Force in Motion"] = {abbrev = "", color = "#9A5F25", shortname = "",},
["Organisation of Internationalist Communists of Greece"] = {abbrev = "OKDE", color = "#CF1711", shortname = "",},
["Organisation of Trade Unions of Turkmenistan"] = {abbrev = "TKAMM", color = "#9ACD32", shortname = "",},
["Organization for Popular Democracy – Labour Movement"] = {abbrev = "", color = "#F0001C", shortname = "",},
["Organization for the Reconstruction of the Communist Party of Greece"] = {abbrev = "OAKKE", color = "red", shortname = "",},
["Organization of Iranian People's Fedai Guerrillas"] = {abbrev = "OIPGF", color = "#C80815", shortname = "",},
["Organization of Struggle for the Emancipation of the Working Class"] = {abbrev = "OSEWC", color = "#ee1c25", shortname = "",},
["Organization of Ukrainian Nationalists"] = {abbrev = "", color = "#000000", shortname = "",},
["Organized Community"] = {abbrev = "", color = "#1C4587", shortname = "",},
["Organized Socialist Party in Venezuela"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Orinats Yerkir"] = {abbrev = "", color = "#022161", shortname = "",},
["Orissa Jana Congress"] = {abbrev = "", color = "grey", shortname = "Jana Congress",},
["Orkney Manifesto Group"] = {abbrev = "", color = "#ff7300", shortname = "",},
["Orleanist"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Oromo Democratic Party"] = {abbrev = "", color = "Gold", shortname = "",},
["Osaka Ishin no Kai"] = {abbrev = "", color = "#6FBA2C", shortname = "",},
["Osaka Restoration Association"] = {abbrev = "", color = "#6FBA2C", shortname = "",},
["Ostravak"] = {abbrev = "", color = "#9F1A16", shortname = "",},
["Other parties and Independents"] = {abbrev = "", color = "silver", shortname = "",},
["Other parties"] = {abbrev = "", color = "white", shortname = "",},
["Others"] = {abbrev = "", color = "#DDDDBB", shortname = "",},
["Otzma Yehudit"] = {abbrev = "", color = "#EF2B1B", shortname = "",},
["Our Choice (Russia)"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Our Coalition (Mongolia)"] = {abbrev = "", color = "#F35C5C", shortname = "",},
["Our Country (Slovenia)"] = {abbrev = "", color = "#479A2E", shortname = "",},
["Our Development Party"] = {abbrev = "", color = "#F1A10F", shortname = "",},
["Our Home – Russia"] = {abbrev = "NDR", color = "#23238E", shortname = "",},
["Our Homeland Movement"] = {abbrev = "", color = "#688D1B", shortname = "",},
["Our Land (Ukraine)"] = {abbrev = "", color = "#0164A0", shortname = "Our Land",},
["Our Moldova Alliance"] = {abbrev = "AMN", color = "#FFE400", shortname = "",},
["Our Party (Bosnia and Herzegovina)"] = {abbrev = "NS", color = "#BC2922", shortname = "",},
["Our Party (Moldova)"] = {abbrev = "", color = "#003366", shortname = "",},
["Our Republican Party (2020)"] = {abbrev = "", color = "#009942", shortname = "Our Republican",},
["Our Ukraine–People's Self-Defense Bloc"] = {abbrev = "", color = "DarkOrange", shortname = "Our Ukraine Bloc",},
["Our Ukraine (political party)"] = {abbrev = "", color = "#FFA914", shortname = "Our Ukraine",},
["Our West Lancashire"] = {abbrev = "OWL", color = "#fabc13", shortname = "",},
["Ourensan Democracy"] = {abbrev = "", color = "#FFC926", shortname = "",},
["Ourensan Unity"] = {abbrev = "", color = "#447BBB", shortname = "",},
["Ourense en Común"] = {abbrev = "", color = "#662739", shortname = "",},
["Ourense Mellor"] = {abbrev = "", color = "#A11B26", shortname = "",},
["OurNZ Party"] = {abbrev = "OurNZ", color = "#8097a5", shortname = "",},
["Outdoor Recreation New Zealand"] = {abbrev = "ORNZ", color = "#666666", shortname = "",},
["OWL Party"] = {abbrev = "OWL", color = "yellow", shortname = "",},
["Ownership, Unity and Responsibility Party"] = {abbrev = "", color = "#D8BFD8", shortname = "OUR Party",},
["Oxygen Green Party"] = {abbrev = "", color = "#178D04", shortname = "",},
["Oyan, Qazaqstan"] = {abbrev = "", color = "#000000", shortname = "",},
["Oytcho-Visha"] = {abbrev = "", color = "#293378", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
rsetvw2s880g2w8ktnisgo6le5x46nr
Module:Political party/P
828
68669828
1096708401
1096708218
2022-07-06T05:05:07Z
N Panama 84534
38274583
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["PIT"] = "Pakistan Tehreek-e-Insaf",
["Pa-O National Organization"] = "Pa-O National Organisation",
["Pachakutik Plurinational Unity Movement – New Country"] = "Pachakutik Plurinational Unity Movement",
["Pakistan Awami Tehrik"] = "Pakistan Awami Tehreek",
["Pakistan Peoples Party Parliamentarians"] = "Pakistan Peoples Party",
["Pakistan Sunni Tehreek"] = "Sunni Tehreek",
["Pan-Malaysian Islamic Party"] = "Malaysian Islamic Party",
["Panhellenic Socialist Movement"] = "PASOK",
["Parkindo"] = "Indonesian Christian Party",
["Parnellite Nationalist"] = "Irish National League",
["Parnellite"] = "Irish National League",
["Parti Bersatu Sabah"] = "United Sabah Party",
["Parti Cinta Sabah"] = "Love Sabah Party",
["Parti Gerakan Rakyat Malaysia/m"] = "Parti Gerakan Rakyat Malaysia",
["Parti Keadilan Rakyat"] = "People's Justice Party (Malaysia)",
["Parti Rakyat Bersatu"] = "Sarawak United Party",
["Parti Socialiste (Belgium)"] = "Socialist Party (Belgium)",
["Parti Sosialis Malaysia"] = "Socialist Party of Malaysia",
["Partido Demokratiko Pilipino-Lakas ng Bayan"] = "PDP–Laban",
["Partido Demokratiko Pilipino–Lakas ng Bayan"] = "PDP–Laban",
["Partido Demokratiko Pilipino-Lakas ng Bayan (Cusi)"] = "PDP–Laban (Cusi)",
["Partido Demokratiko Pilipino–Lakas ng Bayan (Cusi)"] = "PDP–Laban (Cusi)",
["Partido Demokratiko Pilipino-Lakas ng Bayan (Pacquiao)"] = "PDP–Laban (Pacquiao)",
["Partido Demokratiko Pilipino–Lakas ng Bayan (Pacquiao)"] = "PDP–Laban (Pacquiao)",
["Partido Democrático Trabalhista"] = "Democratic Labour Party (Brazil)",
["Partido Demokratiko Sosyalista ng Pilipinas"] = "Philippine Democratic Socialist Party",
["Partido ng Demokratikong Reporma"] = "Partido para sa Demokratikong Reporma",
["Partido ng Manggagawa at Magsasaka"] = "Lapiang Manggagawa",
["Partido ng Masang Pilipino"] = "Pwersa ng Masang Pilipino",
["Partii Inuit"] = "Inuit Party",
["Partii Naleraq"] = "Naleraq",
["Party Alliance Our Moldova"] = "Our Moldova Alliance",
["Party for Democratic Reforms (Azerbaijan)"] = "Democratic Reforms Party (Azerbaijan)",
["Party for Freedom and Progress (Flanders)"] = "Open Flemish Liberals and Democrats",
["Party for Freedom and Progress (German-speaking Community)"] = "Reformist Movement",
["Party for the Restructured Antilles"] = "Real Alternative Party",
["Party Malin"] = "Parti Malin",
["Party of Civic Rights – Zemanovci"] = "Party of Civic Rights",
["Party of Homeland's Fighters"] = "Homeland Fighters' Party",
["Party of Industrialists and Entrepreneurs"] = "Party of Industrialists and Entrepreneurs of Turkmenistan",
["Party of Labour of Catalonia"] = "Party of Labour of Spain",
["Party of People's Unity"] = "Popular Unity Party (Tunisia)",
["Party of Social Democracy (Romania)"] = "Party of Social Democracy of Romania",
["Party of the Brazilian Woman"] = "Party of the Brazilian Women",
["Party of the National Reconstruction"] = "Christian Labour Party",
["Party of the U"] = "Union Party for the People",
["Party Workers' Liberation Front 30th of May"] = "Workers' Liberation Front (Curaçao)",
["Patriotic Alliance"] = "Patriotic Alliance (South Africa)",
["Patriotic and Democratic Group"] = "Democratic Party (Luxembourg)",
["Patriotic Unity"] = "Inite",
["Patto Segni"] = "Segni Pact",
["Pauline Hanson's One Nation"] = "One Nation",
["Peace and Freedom Party (United States)"] = "Peace and Freedom Party (US)",
["Peace and Freedom Party"] = "Peace and Freedom Party (US)",
["Peace Party (United Kingdom)"] = "Peace Party (UK)",
["Peace, Unity, and Development Party"] = "Kulmiye Peace, Unity, and Development Party",
["Peasants and New Democratic Party Union"] = "Lithuanian Peasant Popular Union",
["Peasants And Workers Party of India"] = "Peasants and Workers Party of India",
["Pennsylvania Democratic Party"] = "Democratic Party (US)",
["Pennsylvania Republican Party"] = "Republican Party (US)",
["People Before Profit Alliance"] = "People Before Profit",
["People First Party (Republic of China)"] = "People First Party (Taiwan)",
["People of Freedom"] = "The People of Freedom",
["People Party"] = "People Party (South Korea)",
["People Reform Party (Thailand)"] = "People Reform Party",
["People's Alliance–People's Democratic Party"] = "People's Alliance (Spain)",
["People's Coalition (Spain, 1983)"] = "People's Coalition (Spain)",
["People's Democracy"] = "People's Democracy (Ireland)",
["People's Democratic Party (Nigeria)"] = "Peoples Democratic Party (Nigeria)",
["People’s Democratic Party of Uzbekistan"] = "People's Democratic Party of Uzbekistan",
["People's Freedom Party (Nepal)"] = "Nagrik Unmukti Party",
["People's Movement (Romania)"] = "People's Movement Party",
["People's Movement"] = "People's Movement (Tunisia)",
["People's Party - Our Slovakia"] = "People's Party – Our Slovakia",
["People's Party - Reformists"] = "People's Party – Reformists",
["People's Party Our Slovakia"] = "People's Party – Our Slovakia",
["People's Party (Dalmatia)"] = "People's Party (Kingdom of Dalmatia)",
["People's Party (Greenland)"] = "Inuit Party",
["People's Party (Iceland, 2016)"] = "People's Party (Iceland)",
["People's Party (South Korea)"] = "People's Party (South Korea, 2016)",
["People's Party (Sweden)"] = "Liberals (Sweden)",
["People's Party (Turkey)"] = "Populist Party (Turkey)",
["People's Party (United States)"] = "People's Party (US)",
["People's Party of Andalusia"] = "People's Party (Spain)",
["People's Party of Aragon"] = "People's Party (Spain)",
["People's Party of Asturias"] = "People's Party (Spain)",
["People's Party of Cantabria"] = "People's Party (Spain)",
["People's Party of Castile and León"] = "People's Party (Spain)",
["People's Party of Castilla–La Mancha"] = "People's Party (Spain)",
["People's Party of Catalonia"] = "People's Party (Spain)",
["People's Party of Extremadura"] = "People's Party (Spain)",
["People's Party of Finland (1951)"] = "Liberals (Finland)",
["People's Party of Galicia"] = "People's Party (Spain)",
["People's Party of La Rioja"] = "People's Party (Spain)",
["People's Party of Navarre"] = "People's Party (Spain)",
["People's Party of the Balearic Islands"] = "People's Party (Spain)",
["People's Party of the Basque Country"] = "People's Party (Spain)",
["People's Party of the Canary Islands"] = "People's Party (Spain)",
["People's Party of the Community of Madrid"] = "People's Party (Spain)",
["People's Party of the Region of Murcia"] = "People's Party (Spain)",
["People's Party of the Valencian Community"] = "People's Party (Spain)",
["People's Progressive Party (Gambia)"] = "People's Progressive Party (The Gambia)",
["People's stream of Egypt"] = "Egyptian Popular Current",
["People’s Progressive Party (Vanuatu)"] = "People's Progressive Party (Vanuatu)",
["People’s Revolutionary Movement (South Africa)"] = "People's Revolutionary Movement (South Africa)",
["Peronist Party"] = "Justicialist Party",
["Peter Pilz List"] = "JETZT (party)",
["Petro Poroshenko Bloc"] = "Petro Poroshenko Bloc \"Solidarity\"",
["PH (2018)"] = "Pakatan Harapan",
["Pirate Party (Finland)"] = "Pirate Party of Finland",
["Pirate Party (United States)"] = "Pirate Party (US)",
["Pirate Party Germany"] = "German Pirate Party",
["Pirate Party of the Netherlands"] = "Pirate Party (Netherlands)",
["Pirate Party UK"] = "Pirate Party (United Kingdom)",
["Pirate Party"] = "Pirate Party (Sweden)",
["PIS"] = "Law and Justice",
["Pityusic Civic Union"] = "Civic Union",
["Plural Left (Spain, 2011)"] = "United Left (Spain)",
["Plural Left (Spain)"] = "United Left (Spain)",
["Plural Voices – Peoples of Macau"] = "Voz Plural - Gentes de Macau",
["PMK"] = "Pattali Makkal Katchi",
["PMP"] = "Pwersa ng Masa",
["PNV–EA"] = "Basque Nationalist Party",
["PO"] = "Civic Platform",
["Podemos Andalusia"] = "Podemos (Spanish political party)",
["Podemos Asturias"] = "Podemos (Spanish political party)",
["Podemos Castile and León"] = "Podemos (Spanish political party)",
["Podemos Region of Murcia"] = "Podemos (Spanish political party)",
["Polish People's Party \"Piast\" (1913-1931)"] = "Polish People's Party \"Piast\" (1913–1931)",
["Political party LDPR"] = "LDPR (political party)",
["Politically Independent Alignment"] = "Freethinkers' Party",
["Popular Civic"] = "Popular Civic List",
["Popular Democratic Party (United States)"] = "Popular Democratic Party (Puerto Rico)",
["Popular Democratic Party of Puerto Rico"] = "Popular Democratic Party (Puerto Rico)",
["Popular Front"] = "Popular Front (Philippines)",
["Popular Movement"] = "Popular Movement (Morocco)",
["Popular Petition"] = "Current of Love",
["Popular Renewa"] = "Popular Renewal",
["Popular Republican Union (2007)"] = "Popular Republican Union",
["Popular Unity (Spain)"] = "United Left (Spain)",
["Popular Unity Candidacy–Constituent Call"] = "Popular Unity Candidacy",
["Populist Party (United States, 1984)"] = "Populist Party (US, 1984)",
["Populist Party (United States)"] = "Populist Party (US)",
["Populist Party of Maryland"] = "Populist Party (Maryland)",
["Portenian Segregation"] = "Portenian Initiative",
["PPBM"] = "Malaysian United Indigenous Party",
["Pradist Democratic Movement"] = "Peruvian Democratic Movement",
["Praja Party"] = "Krishak Sramik Party",
["Pro Patria (Estonia)"] = "Isamaa",
["Pro Patria (Estonian political party)"] = "Isamaa",
["Pro Patria and ERSP Union"] = "Pro Patria Union",
["Pro Patria and Res Publica Union"] = "Isamaa",
["Pro Patria National Coalition Party"] = "Pro Patria Union",
["Pro Patria Union Party"] = "Pro Patria Union",
["Pro-Administration Party (United States)"] = "Pro-Administration Party (US)",
["Pro-Administration Party"] = "Pro-Administration Party (US)",
["Pro-Beijing Camp"] = "Pro-Beijing camp",
["Pro-Beijing"] = "Pro-Beijing camp",
["Pro-Park Coalition"] = "Future Hope Alliance",
["Probinsya Muna Development Initiative"] = "PROMDI",
["Progress Party (Thailand, 1983)"] = "Progress Party (Thailand)",
["Progress Party of the Fatherland"] = "Progress of the Fatherland Party",
["Progressive Democratic Party (Malaysia)"] = "Progressive Democratic Party",
["Progressive Democratic Party (Tunisia)"] = "Republican Party (Tunisia)",
["Progressive Democrats (Ireland)"] = "Progressive Democrats",
["Progressive Movement for the Devolution of Initiatives"] = "PROMDI",
["Progressive Party (Missouri)"] = "Progressive Party (US)",
["Progressive Party (South Africa)"] = "Progressive Federal Party",
["Progressive Party (US, 1912)"] = "Progressive Party (United States, 1912)",
["Progressive Party (US, 1924)"] = "Progressive Party (United States, 1924–34)",
["Progressive Party (United States, 1924-34)"] = "Progressive Party (United States, 1924–34)",
["Progressive Party (United States, 1924-46)"] = "Progressive Party (United States, 1924–34)",
["Progressive Party (United States, 1924)"] = "Progressive Party (United States, 1924–34)",
["Progressive Party (US, 1948)"] = "Progressive Party (United States, 1948)",
["Progressive Party (United States)"] = "Progressive Party (US)",
["Progressive Party (Wisconsin)"] = "Wisconsin Progressive Party",
["Progressive Party of Missouri"] = "Progressive Party (US)",
["Progressive Riojan Party"] = "Riojan Party",
["Progressive Unitary Movement"] = "Movement of Progressives",
["Prohibition Party (United States)"] = "Prohibition Party",
["Prohibition Party (US)"] = "Prohibition Party",
["Prolife Alliance"] = "ProLife Alliance",
["ProLife Party"] = "ProLife Alliance",
["Propel"] = "Propel (political party)",
["Prosperous Democratic Macau Association"] = "Democratic Prosperous Macau Association",
["Protectionist Party (Sweden)"] = "Moderate Party",
["PSL"] = "Polish People's Party",
["PSM–Nationalist Agreement"] = "Socialist Party of Majorca",
["PTI"] = "Pakistan Tehreek-e-Insaf",
["Public Ownership Party (United States)"] = "Public Ownership Party (US)",
["Puerto Rican Independence Party"] = "Independence Party (Puerto Rico)",
["Putting Cumbria First"] = "CumbriaFirst",
["Puwersa ng Masa"] = "Pwersa ng Masa",
}
local full = {
["Pa-O National Organisation"] = {abbrev = "PNO", color = "#28166F", shortname = "",},
["Paati Langafonua Tu'uloa"] = {abbrev = "PLT", color = "orange", shortname = "",},
["Pachakuti Indigenous Movement"] = {abbrev = "MIP", color = "orange", shortname = "",},
["Pachakutik Plurinational Unity Movement"] = {abbrev = "", color = "#FE2EC8", shortname = "",},
["Pacific Green Party"] = {abbrev = "", color = "#90EE90", shortname = "Pacific Green",},
["Pacifist Socialist Party"] = {abbrev = "PSP", color = "#FF3366", shortname = "",},
["Pact for Ames"] = {abbrev = "", color = "#F3B900", shortname = "",},
["Pact for Autonomy"] = {abbrev = "", color = "#0055AB", shortname = "",},
["Pact for San Marino"] = {abbrev = "", color = "blue", shortname = "",},
["Pact of Democrats"] = {abbrev = "", color = "darkorange", shortname = "",},
["Pacte per Eivissa"] = {abbrev = "", color = "#038284", shortname = "",},
["Pacte Progressista"] = {abbrev = "", color = "#01884C", shortname = "",},
["PAIS (Argentina)"] = {abbrev = "PAIS", color = "#4F85C5", shortname = "",},
["PAIS Alliance"] = {abbrev = "", color = "#00FF00", shortname = "",},
["País"] = {abbrev = "", color = "#c11469", shortname = "",},
["Pak Sarzameen Party"] = {abbrev = "PSP", color = "green", shortname = "",},
["Pakatan Harapan"] = {abbrev = "PH", color = "#ED1C24", shortname = "",},
["Pakatan Rakyat"] = {abbrev = "", color = "#C63B38", shortname = "",},
["Pakistan Awami Inqilabi League"] = {abbrev = "PAIL", color = "#00CED1", shortname = "",},
["Pakistan Awami League"] = {abbrev = "PAL", color = "#48D1CC", shortname = "",},
["Pakistan Awami Party"] = {abbrev = "PAP", color = "#0000FF", shortname = "",},
["Pakistan Awami Tehreek"] = {abbrev = "", color = "#FF6347", shortname = "",},
["Pakistan Christian Congress"] = {abbrev = "", color = "gold", shortname = "",},
["Pakistan Democratic Party"] = {abbrev = "PDP", color = "#3cb371", shortname = "",},
["Pakistan Human Party"] = {abbrev = "PHP", color = "#00FFFF", shortname = "",},
["Pakistan Justice and Democratic Party"] = {abbrev = "PJDP", color = "#1E90FF", shortname = "",},
["Pakistan Kissan Ittehad (Ch. Anwar)"] = {abbrev = "", color = "green", shortname = "PKI-Ch.Anwar",},
["Pakistan Mazdoor Kissan Party"] = {abbrev = "", color = "red", shortname = "",},
["Pakistan Muslim Alliance"] = {abbrev = "PMA", color = "#90EE90", shortname = "",},
["Pakistan Muslim League (F)"] = {abbrev = "PML(F)", color = "#8fac5d", shortname = "",},
["Pakistan Muslim League (J)"] = {abbrev = "", color = "#006400", shortname = "",},
["Pakistan Muslim League (N)"] = {abbrev = "PML(N)", color = "#228b22", shortname = "",},
["Pakistan Muslim League (Q)"] = {abbrev = "PML(Q)", color = "lime", shortname = "",},
["Pakistan Muslim League (Qayyum)"] = {abbrev = "PML (Qayyum)", color = "#228b22", shortname = "",},
["Pakistan Muslim League (Z)"] = {abbrev = "PML (Z)", color = "#00A877", shortname = "",},
["Pakistan Muslim League"] = {abbrev = "PML", color = "#228b22", shortname = "",},
["Pakistan National Alliance"] = {abbrev = "", color = "#138808", shortname = "",},
["Pakistan National Muslim League"] = {abbrev = "PNML", color = "#ADFF2F", shortname = "",},
["Pakistan Peoples Party (Shaheed Bhutto)"] = {abbrev = "PPP (SB)", color = "#FF7F50", shortname = "",},
["Pakistan Peoples Party Workers"] = {abbrev = "PPP-W", color = "#808080", shortname = "",},
["Pakistan Peoples Party"] = {abbrev = "PPP", color = "#000", shortname = "",},
["Pakistan Qaumi Yakjehti Party"] = {abbrev = "PQYP", color = "#AFEEEE", shortname = "",},
["Pakistan Rah-e-Haq Party"] = {abbrev = "PRHP", color = "#228B22", shortname = "",},
["Pakistan Tehreek-e-Insaf"] = {abbrev = "PTI", color = "#E70A0A", shortname = "",},
["Pakistan Welfare Party"] = {abbrev = "PWP", color = "#E0FFFF", shortname = "",},
["Palang Dharma Party"] = {abbrev = "", color = "#b0e0e6", shortname = "Palang Dharma",},
["Palang Pracharat Party"] = {abbrev = "", color = "#4061a6", shortname = "",},
["Palang Pracharath Party"] = {abbrev = "", color = "#4061A6", shortname = "Palang Pracharat",},
["Palangchon Party"] = {abbrev = "", color = "#1e90ff", shortname = "",},
["Palentine Unity"] = {abbrev = "", color = "#D23075", shortname = "",},
["Palestinian Arab Front"] = {abbrev = "", color = "#00A437", shortname = "",},
["Palestinian Democratic Union"] = {abbrev = "", color = "#008B4C", shortname = "",},
["Palestinian Liberation Front"] = {abbrev = "", color = "#D50407", shortname = "",},
["Palestinian National Initiative"] = {abbrev = "PNI", color = "#FF7F00", shortname = "",},
["Palestinian People's Party"] = {abbrev = "PPP", color = "darkred", shortname = "",},
["Palestinian Popular Struggle Front"] = {abbrev = "", color = "#CB0000", shortname = "",},
["Palikot's Movement"] = {abbrev = "RP", color = "#F08705", shortname = "",},
["Palmer United Party"] = {abbrev = "", color = "#FFED00", shortname = "Palmer United",},
["Pametno"] = {abbrev = "", color = "#23274D", shortname = "",},
["Pampa Federalist Movement"] = {abbrev = "", color = "#005C9E", shortname = "",},
["Pan Africanist Congress of Azania"] = {abbrev = "PAC", color = "#008718", shortname = "",},
["Pan Africanist Movement"] = {abbrev = "", color = "Green", shortname = "",},
["PAN Party (Mexico)"] = {abbrev = "", color = "#3333FF", shortname = "",},
["Pan-African Democratic Party"] = {abbrev = "", color = "green", shortname = "",},
["Pan-African Patriotic Convergence"] = {abbrev = "", color = "#ADFF2F", shortname = "",},
["Pan-African Union for Social Democracy"] = {abbrev = "", color = "#009A3F", shortname = "",},
["Pan-Armenian National Movement"] = {abbrev = "HHSh", color = "#FFC601", shortname = "",},
["Pan-Blue Coalition"] = {abbrev = "", color = "", shortname = "Pan-Blue",},
["Pan-democracy camp"] = {abbrev = "", color = "", shortname = "Pan-democracy",},
["Pan-Green Coalition"] = {abbrev = "", color = "", shortname = "Pan-Green",},
["Pan-Iranist Party"] = {abbrev = "", color = "green", shortname = "",},
["Pan-Malayan Islamic Party"] = {abbrev = "PMIP", color = "#009000", shortname = "",},
["Pan-Malaysian Islamic Front"] = {abbrev = "", color = "#730947", shortname = "",},
["PAN-Podemos"] = {abbrev = "", color = "#C1373B", shortname = "",},
["Panameñista Party"] = {abbrev = "", color = "#660099", shortname = "Panameñista",},
["Pangu Pati"] = {abbrev = "", color = "#50C201", shortname = "",},
["Pannella List"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Państwowe Zjednoczenie na Kresach"] = {abbrev = "", color = "#201F3F", shortname = "",},
["Papua New Guinea Greens"] = {abbrev = "", color = "green", shortname = "PNG Greens",},
["Papua New Guinea Party"] = {abbrev = "", color = "#FFEF00", shortname = "",},
["Paraguayan Communist Party"] = {abbrev = "", color = "#FF2400", shortname = "",},
["Paraguayan Humanist Party"] = {abbrev = "", color = "#FFA000", shortname = "",},
["Parivartan Samaj Party"] = {abbrev = "", color = "#990033", shortname = "",},
["Parliament of the United Kingdom"] = {abbrev = "", color = "#373151", shortname = "UK Parliament",},
["Parliamentary Centre"] = {abbrev = "", color = "#339966", shortname = "",},
["Parmehutu"] = {abbrev = "", color = "#8B4513", shortname = "",},
["Parochial Union of Independents Group"] = {abbrev = "", color = "#28574d", shortname = "",},
["Partei für Freiheit und Fortschritt"] = {abbrev = "", color = "#004179", shortname = "",},
["Partei für Gesundheitsforschung"] = {abbrev = "", color = "#000000", shortname = "Gesundheitsforschung",},
["Parti Bangsa Malaysia"] = {abbrev = "", color = "#622CA8", shortname = "",},
["Parti Bansa Dayak Sarawak Baru"] = {abbrev = "", color = "#E0F810", shortname = "",},
["Parti Bersatu Rakyat Sabah"] = {abbrev = "", color = "#FEDF00", shortname = "",},
["Parti Bumi Kenyalang"] = {abbrev = "", color = "#FBC625", shortname = "",},
["Parti Communautaire National-Européen"] = {abbrev = "", color = "#DA121A", shortname = "",},
["Parti fédéraliste européen"] = {abbrev = "", color = "#2F54A4", shortname = "",},
["Parti Gerakan Rakyat Malaysia"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Parti Malin"] = {abbrev = "", color = "#FFF0F5", shortname = "",},
["Parti Mauricien Social-Démocrate"] = {abbrev = "", color = "#0000CD", shortname = "",},
["Parti Melayu Semangat 46"] = {abbrev = "S46", color = "#FFFF00", shortname = "",},
["Parti Negara"] = {abbrev = "", color = "Yellow", shortname = "National Party",},
["Parti Pesaka Bumiputera Bersatu"] = {abbrev = "", color = "#FDEF8B", shortname = "",},
["Parti Pesaka Sarawak"] = {abbrev = "PESAKA", color = "", shortname = "",},
["Parti radical"] = {abbrev = "", color = "#4169E1", shortname = "Radical",},
["Parti Rakyat Gabungan Jaksa Pendamai"] = {abbrev = "", color = "#74764D", shortname = "",},
["Parti Rakyat Malaysia"] = {abbrev = "", color = "#D00000", shortname = "",},
["Parti Sarawak Bersatu"] = {abbrev = "PSB", color = "#FBFF94", shortname = "",},
["Parti Solidaire Africain"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Participa Huelva"] = {abbrev = "", color = "#342965", shortname = "",},
["Participa Sevilla"] = {abbrev = "", color = "#90317C", shortname = "",},
["Participando en Barañain"] = {abbrev = "", color = "#632C63", shortname = "",},
["Participate Huelva"] = {abbrev = "", color = "#342965", shortname = "",},
["Participatory Democracy"] = {abbrev = "", color = "#FE7E00", shortname = "",},
["Partido Abe Kapampangan"] = {abbrev = "PAK/ABE", color = "#006400", shortname = "",},
["Partido Auténtico"] = {abbrev = "", color = "#BBBBBB", shortname = "Auténtico",},
["Partido Barug"] = {abbrev = "", color = "#2f7829", shortname = "",},
["Partido de la Gente"] = {abbrev = "", color = "#92D050", shortname = "",},
["PDP–Laban"] = {abbrev = "PDPLBN", color = "#ffd700", shortname = "PDP–Laban",},
["PDP–Laban (Cusi)"] = {abbrev = "PDPLBN (Cusi)", color = "#ED2027", shortname = "PDP–Laban (Cusi)",},
["PDP–Laban (Pacquiao)"] = {abbrev = "PDPLBN (Pacquiao)", color = "#000040", shortname = "PDP–Laban (Pacquiao)",},
["Partido Ecologista Radical Intransigente"] = {abbrev = "PERI", color = "#009000", shortname = "",},
["Partido Federal ng Pilipinas"] = {abbrev = "PFP", color = "#0D5F31", shortname = "",},
["Partido Galing at Puso"] = {abbrev = "PGP", color = "#0070C0", shortname = "",},
["Partido Identidad Salteña"] = {abbrev = "", color = "#B21519", shortname = "",},
["Partido Inovashon Nashonal"] = {abbrev = "", color = "#25A9E0", shortname = "",},
["Partido Laban ng Masa"] = {abbrev = "PLM", color = "", shortname = "",},
["Partido Lakas ng Masa"] = {abbrev = "PLM", color = "#BE2D32", shortname = "",},
["Partido Magdiwang"] = {abbrev = "", color = "#FE4D00", shortname = "Magdiwang",},
["Partido Maharlika"] = {abbrev = "PM", color = "", shortname = "",},
["Partido MAN"] = {abbrev = "MAN", color = "#020F6B", shortname = "",},
["Partido Navoteño"] = {abbrev = "", color = "#568203", shortname = "Navoteño",},
["Partido ng Demokratikong Reporma-Lapiang Manggagawa"] = {abbrev = "", color = "#cc0000", shortname = "Reporma-LM",},
["Partido ng Manggagawa"] = {abbrev = "PM", color = "#BF0C0C", shortname = "",},
["Partido Ortodoxo"] = {abbrev = "", color = "#000000", shortname = "Ortodoxo",},
["Partido pa Adelanto I Inovashon Soshal"] = {abbrev = "", color = "#00A6E3", shortname = "",},
["Partido Panaghiusa"] = {abbrev = "", color = "#551a8b", shortname = "Panaghiusa",},
["Partido para sa Demokratikong Reporma"] = {abbrev = "", color = "#cc0000", shortname = "Reporma",},
["Partido Patria Libre"] = {abbrev = "", color = "#013068", shortname = "",},
["Partido Pederal ng Maharlika"] = {abbrev = "PPM", color = "", shortname = "",},
["Partido Pilipino sa Pagbabago"] = {abbrev = "PPP", color = "", shortname = "",},
["Partido por la Victoria del Pueblo"] = {abbrev = "", color = "Red", shortname = "",},
["Partidong Pagbabago ng Palawan"] = {abbrev = "PPPL", color = "#0099FF", shortname = "",},
["Partit per al Poble"] = {abbrev = "", color = "#006E66", shortname = "",},
["Partit per la Independència"] = {abbrev = "", color = "#003163", shortname = "",},
["Partit Renovador d'Arties e Garòs"] = {abbrev = "", color = "#006400", shortname = "",},
["Partíu Asturianista"] = {abbrev = "PAS", color = "#196C5B", shortname = "",},
["Party Association of Widows and Legal Wives"] = {abbrev = "", color = "#000000", shortname = "",},
["Party for a Country of Solidarity"] = {abbrev = "PPS", color = "#FFFF00", shortname = "",},
["Party for a European Future"] = {abbrev = "", color = "#003474", shortname = "",},
["Party for a Rule of Law Offensive"] = {abbrev = "", color = "#63B8FF", shortname = "Schill",},
["Party for Animal Welfare"] = {abbrev = "", color = "#DB1DEC", shortname = "",},
["Party for Bosnia and Herzegovina"] = {abbrev = "SBiH", color = "#FFD900", shortname = "",},
["Party for Civic and Patriotic Action"] = {abbrev = "", color = "#FFFF80", shortname = "",},
["Party for Culture, Education and Labour"] = {abbrev = "", color = "#D9E542", shortname = "",},
["Party for Democracy (Chile)"] = {abbrev = "", color = "#FFA500", shortname = "For Democracy",},
["Party for Democracy and Peace"] = {abbrev = "", color = "#40B02A", shortname = "Democracy and Peace",},
["Party for Democracy and Progress / Socialist Party"] = {abbrev = "", color = "red", shortname = "",},
["Party for Democracy and Socialism"] = {abbrev = "PDS", color = "#CD5C5C", shortname = "",},
["Party for Democracy and Socialism/Metba"] = {abbrev = "", color = "#0B9D06", shortname = "",},
["Party for Democratic Action"] = {abbrev = "PDD", color = "#0081cc", shortname = "",},
["Party for Democratic Socialism (India)"] = {abbrev = "PDS", color = "#beff32", shortname = "",},
["Party for Development and Change"] = {abbrev = "", color = "#4E9127", shortname = "",},
["Party for Dignified Life"] = {abbrev = "SDŽ", color = "#C63B28", shortname = "",},
["Party for Economic Development and Solidarity"] = {abbrev = "", color = "#037CF1", shortname = "",},
["Party for Freedom (Spain)"] = {abbrev = "", color = "#A71931", shortname = "",},
["Party for Freedom and Progress"] = {abbrev = "", color = "#0073CF", shortname = "",},
["Party for Freedom"] = {abbrev = "PVV", color = "#012758", shortname = "",},
["Party for Full Democracy"] = {abbrev = "", color = "#000000", shortname = "",},
["Party for Future Generations"] = {abbrev = "", color = "#1793D4", shortname = "Future Generations",},
["Party for Human and Spirit"] = {abbrev = "", color = "#A12063", shortname = "",},
["Party for Japanese Kokoro"] = {abbrev = "", color = "#EC7820", shortname = "Japanese Kokoro",},
["Party for Justice and Integration"] = {abbrev = "PDI", color = "#0193BD", shortname = "",},
["Party for Justice and Unity (Bonaire)"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Party for Justice and Unity"] = {abbrev = "", color = "#D6261F", shortname = "",},
["Party for Justice, Integration and Unity"] = {abbrev = "PDIU", color = "#009EE2", shortname = "",},
["Party for Life Security"] = {abbrev = "SŽJ", color = "#009035", shortname = "",},
["Party for National Rebirth"] = {abbrev = "", color = "#0a37ce", shortname = "",},
["Party for National Unity and Solidarity"] = {abbrev = "KTPI", color = "#113D2D", shortname = "",},
["Party for Neighbourly Love, Freedom, and Diversity"] = {abbrev = "", color = "#D2D6FE", shortname = "",},
["Party for Peace and Democracy"] = {abbrev = "", color = "#FDD200", shortname = "",},
["Party for People's Livelihoods"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Party for Progress and Concord"] = {abbrev = "PPC", color = "#FF8080", shortname = "",},
["Party for Social Renewal"] = {abbrev = "PRS", color = "#FFA500", shortname = "",},
["Party for Socialism and Democracy in Niger"] = {abbrev = "", color = "#008F3D", shortname = "",},
["Party for Socialism and Liberation"] = {abbrev = "", color = "red", shortname = "Socialism and Liberation",},
["Party for the Animals"] = {abbrev = "PvdD", color = "#006B2D", shortname = "",},
["Party for the Economic Development of Abkhazia"] = {abbrev = "", color = "#054101", shortname = "",},
["Party for the Future"] = {abbrev = "PvdT", color = "#F9E518", shortname = "",},
["Party for the Netherlands"] = {abbrev = "", color = "#EEAA00", shortname = "",},
["Party for the North"] = {abbrev = "PvhN", color = "#E8512A", shortname = "",},
["Party for the Open Society"] = {abbrev = "SOS", color = "#ffba00", shortname = "",},
["Party for the Regeneration of Democracy in Spain"] = {abbrev = "", color = "#1BA8DE", shortname = "",},
["Party for Unity and Rally"] = {abbrev = "", color = "#1FCF19", shortname = "",},
["Party for Victory"] = {abbrev = "", color = "#00CCFF", shortname = "",},
["Party of Action and Solidarity"] = {abbrev = "PAS", color = "#FFDE00", shortname = "",},
["Party of Alenka Bratušek"] = {abbrev = "", color = "#00a9e1", shortname = "",},
["Party of Almería"] = {abbrev = "", color = "#24AFF3", shortname = "",},
["Party of Belarusian Communists"] = {abbrev = "", color = "#ED1B24", shortname = "",},
["Party of Benidorm"] = {abbrev = "", color = "#0F9DEB", shortname = "",},
["Party of Bible-abiding Christians"] = {abbrev = "PBC", color = "#FF6666", shortname = "",},
["Party of Bulgarian Social Democrats"] = {abbrev = "", color = "red", shortname = "",},
["Party of Business"] = {abbrev = "", color = "#FFC11A", shortname = "",},
["Party of Christian Democrats"] = {abbrev = "PChD", color = "#869EDE", shortname = "",},
["Party of Civic Rights"] = {abbrev = "SPO", color = "#E2725B", shortname = "",},
["Party of Civic Understanding"] = {abbrev = "SOP", color = "#F53E13", shortname = "",},
["Party of Common Sense"] = {abbrev = "", color = "#6FB7C5", shortname = "",},
["Party of Communist Unification in the Canaries"] = {abbrev = "", color = "#5F0F23", shortname = "",},
["Party of Communists of Kyrgyzstan"] = {abbrev = "KKP", color = "#DF0024", shortname = "",},
["Party of Communists of the Republic of Moldova"] = {abbrev = "PCRM", color = "#C00302", shortname = "",},
["Party of Conservative Accord"] = {abbrev = "SKS", color = "#0087DC", shortname = "",},
["Party of Democratic Action (Kosovo)"] = {abbrev = "", color = "#000000", shortname = "",},
["Party of Democratic Action of Croatia"] = {abbrev = "SDAH", color = "green", shortname = "",},
["Party of Democratic Action of Montenegro"] = {abbrev = "SDA CG", color = "#00A859", shortname = "",},
["Party of Democratic Action of Sandžak"] = {abbrev = "SDA S", color = "#069443", shortname = "",},
["Party of Democratic Action"] = {abbrev = "SDA", color = "#00A859", shortname = "",},
["Party of Democratic Activity"] = {abbrev = "A-SDA", color = "darkgreen", shortname = "",},
["Party of Democratic Forces"] = {abbrev = "PFD", color = "#1184D4", shortname = "",},
["Party of Democratic Progress"] = {abbrev = "PDP", color = "#343399", shortname = "",},
["Party of Democratic Prosperity"] = {abbrev = "PDP", color = "darkred", shortname = "",},
["Party of Democratic Revival of Ukraine"] = {abbrev = "PDVU", color = "#5D91DA", shortname = "",},
["Party of Democratic Socialism (Czech Republic)"] = {abbrev = "SDS", color = "#BF0202", shortname = "",},
["Party of Democratic Socialism (Germany)"] = {abbrev = "PDS", color = "#FF0000", shortname = "",},
["Party of Democratic Socialism (Greece)"] = {abbrev = "", color = "red", shortname = "",},
["Party of Democratic Socialism (India)"] = {abbrev = "PDS", color = "red", shortname = "",},
["Party of Democrats of Melilla"] = {abbrev = "", color = "#078FBF", shortname = "",},
["Party of Democrats"] = {abbrev = "PD", color = "#E60909", shortname = "",},
["Party of Development and Reforms"] = {abbrev = "", color = "DarkMagenta", shortname = "",},
["Party of Direct Democracy (Russia)"] = {abbrev = "", color = "#08457E", shortname = "",},
["Party of Economic Freedom"] = {abbrev = "PES", color = "#295EC4", shortname = "",},
["Party of Economic Reform"] = {abbrev = "", color = "#32CD32", shortname = "",},
["Party of El Bierzo"] = {abbrev = "", color = "#0199CB", shortname = "",},
["Party of Elche"] = {abbrev = "", color = "#005120", shortname = "",},
["Party of Estepona"] = {abbrev = "", color = "#2A1873", shortname = "",},
["Party of Estonian Christian Democrats"] = {abbrev = "", color = "#000191", shortname = "",},
["Party of European Socialists"] = {abbrev = "PES", color = "#F0001C", shortname = "",},
["Party of Farmers and the Middle Class"] = {abbrev = "", color = "#BDD79A", shortname = "",},
["Party of Farmers, Traders and Independents"] = {abbrev = "", color = "#8DB600", shortname = "Farmers, Traders and Independents",},
["Party of France"] = {abbrev = "", color = "#32688F", shortname = "",},
["Party of Free Change"] = {abbrev = "PLS", color = "#ED2128", shortname = "",},
["Party of Free Citizens"] = {abbrev = "", color = "#009682", shortname = "Svobodní",},
["Party of Freedom and Justice"] = {abbrev = "", color = "#DB2927", shortname = "",},
["Party of Freedom and Progress"] = {abbrev = "", color = "#799CCF", shortname = "",},
["Party of Friendship, Equality and Peace"] = {abbrev = "DEB", color = "darkgreen", shortname = "",},
["Party of German-speaking Belgians"] = {abbrev = "", color = "#F96915", shortname = "",},
["Party of Gran Canaria"] = {abbrev = "", color = "#4F4FC9", shortname = "",},
["Party of Greek Hunters"] = {abbrev = "KEK", color = "black", shortname = "",},
["Party of Greens of Ukraine"] = {abbrev = "", color = "#02A24E", shortname = "Party of Greens",},
["Party of Growth"] = {abbrev = "", color = "#55AAFF", shortname = "",},
["Party of Hellenism"] = {abbrev = "KE", color = "black", shortname = "",},
["Party of Hope (Azerbaijan)"] = {abbrev = "", color = "#FFDF00", shortname = "Party of Hope",},
["Party of Hope"] = {abbrev = "", color = "#18643A", shortname = "",},
["Party of Humanists"] = {abbrev = "", color = "#110077", shortname = "Humanists",},
["Party of Hungarian Renewal"] = {abbrev = "", color = "#436F4D", shortname = "",},
["Party of Independence and Labour"] = {abbrev = "", color = "red", shortname = "",},
["Party of Independents of the East"] = {abbrev = "PIE", color = "#00FFFF", shortname = "",},
["Party of Industrialists and Entrepreneurs of Turkmenistan"] = {abbrev = "TSTP", color = "#006E61", shortname = "",},
["Party of Italian Communists"] = {abbrev = "", color = "#FC2D2D", shortname = "Italian Communists",},
["Party of Justice and Trust"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Party of Kanak Liberation"] = {abbrev = "", color = "#CC3300", shortname = "Palika",},
["Party of Labor (Ukraine)"] = {abbrev = "PP", color = "#D1CA46", shortname = "",},
["Party of Labour (Serbia)"] = {abbrev = "PR", color = "#C9000B", shortname = "",},
["Party of Labour of Albania"] = {abbrev = "PPSh", color = "#EF4A2E", shortname = "",},
["Party of Labour of Spain"] = {abbrev = "", color = "#B51818", shortname = "",},
["Party of Law and Justice"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Party of Liberty and Social Justice"] = {abbrev = "", color = "#B22234", shortname = "",},
["Party of Miro Cerar"] = {abbrev = "SMC", color = "#000099", shortname = "",},
["Party of Modern Serbia"] = {abbrev = "SMS",color = "#5D2D91", shortname = "",},
["Party of National Brotherhood"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Party of National Economic Development of Ukraine"] = {abbrev = "PNERU", color = "#EA38AF", shortname = "",},
["Party of National Mobilization"] = {abbrev = "PMN", color = "#EC2300", shortname = "",},
["Party of National Unity (Czechoslovakia)"] = {abbrev = "SNJ", color = "#162D5F", shortname = "",},
["Party of National Unity (Kenya)"] = {abbrev = "PNU", color = "#7e75bd", shortname = "",},
["Party of National Unity and Progress"] = {abbrev = "PNUP", color = "#F9A64A", shortname = "",},
["Party of Order"] = {abbrev = "", color = "#0067A5", shortname = "",},
["Party of Patriots of Kazakhstan"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Party of Peace and Unity"] = {abbrev = "", color = "#65297F", shortname = "",},
["Party of People's Unity (Tajikistan)"] = {abbrev = "", color = "#0000FF", shortname = "People's Unity",},
["Party of Political Progress Groups"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Party of Popular Representation"] = {abbrev = "", color = "#FF7538", shortname = "",},
["Party of Precarious Workers"] = {abbrev = "", color = "#633439", shortname = "",},
["Party of Progress and Socialism"] = {abbrev = "", color = "#009bdf", shortname = "",},
["Party of Reason"] = {abbrev = "PDV", color = "#005488", shortname = "",},
["Party of Rebirth and Conciliation of Moldova"] = {abbrev = "PRCM", color = "#15803C", shortname = "",},
["Party of Reforms and Freedom of Wallonia"] = {abbrev = "PRLW", color = "#4B0082", shortname = "",},
["Party of Regional Revival of Ukraine"] = {abbrev = "PRVU", color = "#003F81", shortname = "",},
["Party of Regions"] = {abbrev = "", color = "#003F81", shortname = "",},
["Party of Renaissance and Virtue"] = {abbrev = "", color = "#C0DE90", shortname = "",},
["Party of Renewal and Equity"] = {abbrev = "", color = "#FF2C97", shortname = "",},
["Party of Rights"] = {abbrev = "", color = "#8C8484", shortname = "",},
["Party of Russia's Rebirth"] = {abbrev = "PVR", color = "#00A1FF", shortname = "",},
["Party of Russian Unity and Accord"] = {abbrev = "PRES", color = "#019CDC", shortname = "",},
["Party of Sardinians"] = {abbrev = "", color = "#ED6D16", shortname = "",},
["Party of Self-employed and Professionals"] = {abbrev = "", color = "#636563", shortname = "",},
["Party of Self-employed, Retirees and Widows"] = {abbrev = "", color = "#291829", shortname = "",},
["Party of Serb Radicals"] = {abbrev = "SSR", color = "#002366", shortname = "",},
["Party of Serbian Unity"] = {abbrev = "SSJ", color = "#36454F", shortname = "",},
["Party of Shariy"] = {abbrev = "PSh", color = "#FF0000", shortname = "",},
["Party of Slovak Revival"] = {abbrev = "", color = "blue", shortname = "",},
["Party of Slovenian People"] = {abbrev = "", color = "lightblue", shortname = "",},
["Party of Social Concord"] = {abbrev = "", color = "#add8e6", shortname = "",},
["Party of Social Democracy of Romania"] = {abbrev = "PDSR", color = "#cc3333", shortname = "",},
["Party of Social Justice"] = {abbrev = "", color = "#0094DE", shortname = "",},
["Party of Socialists and Democrats"] = {abbrev = "PSD", color = "#DB4608", shortname = "",},
["Party of Socialists of the Republic of Moldova"] = {abbrev = "PSRM", color = "#8B0000", shortname = "",},
["Party of the Annexes and the Neighborhoods of Antequera"] = {abbrev = "", color = "#1B8D11", shortname = "",},
["Party of the Brazilian Women"] = {abbrev = "", color = "#333C61", shortname = "",},
["Party of the Bulgarian Communists"] = {abbrev = "", color = "#D82226", shortname = "",},
["Party of the Canarian Country"] = {abbrev = "", color = "#4944A0", shortname = "",},
["Party of the Cardenist Front of National Reconstruction"] = {abbrev = "PFCRN", color = "#D10000", shortname = "",},
["Party of the Communists of Catalonia"] = {abbrev = "", color = "#B90C3A", shortname = "",},
["Party of the Constitutional Union"] = {abbrev = "", color = "#FFA500", shortname = "Constitutional Union",},
["Party of the Corsican Nation"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Party of the Democratic Centre (Spain)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Party of the Democratic Karma"] = {abbrev = "", color = "#F1002A", shortname = "",},
["Party of the Democratic Left (Czech Republic)"] = {abbrev = "SDL", color = "#ED1B34", shortname = "",},
["Party of the Democratic Left (Slovakia, 2005)"] = {abbrev = "", color = "#960018", shortname = "",},
["Party of the Democratic Left (Slovakia)"] = {abbrev = "SDĽ", color = "#FF8080", shortname = "",},
["Party of the Democratic Revolution"] = {abbrev = "PRD", color = "#ffcd00", shortname = "",},
["Party of the Elderly and the Self-employed"] = {abbrev = "", color = "#9AC4E9", shortname = "",},
["Party of the European Left"] = {abbrev = "", color = "#b71c1c", shortname = "Left",},
["Party of the Functional Groups"] = {abbrev = "", color = "#ffff00", shortname = "Golkar",},
["Party of the Future"] = {abbrev = "", color = "orange", shortname = "",},
["Party of the Hungarian Coalition"] = {abbrev = "", color = "#029C02", shortname = "",},
["Party of the Hungarian Community"] = {abbrev = "SMK", color = "#029C02", shortname = "",},
["Party of the Immigrant in Spain"] = {abbrev = "", color = "#0001A4", shortname = "",},
["Party of the Nation's Retirees"] = {abbrev = "", color = "yellow", shortname = "",},
["Party of the Nationalist Society"] = {abbrev = "", color = "purple", shortname = "",},
["Party of the People (Chile)"] = {abbrev = "", color = "#00285E", shortname = "Party of the People",},
["Party of the People"] = {abbrev = "", color = "#181644", shortname = "",},
["Party of the Radical Left"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Party of the Reconstruction of the National Order"] = {abbrev = "PRONA", color = "#121212", shortname = "",},
["Party of the Republic"] = {abbrev = "PR", color = "#250088", shortname = "",},
["Party of the Right (Luxembourg)"] = {abbrev = "", color = "#3333CC", shortname = "",},
["Party of the Roma"] = {abbrev = "", color = "black", shortname = "",},
["Party of the Social Democratic Coalition"] = {abbrev = "", color = "red", shortname = "",},
["Party of the Socialist Revolution"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Party of the South (Chile)"] = {abbrev = "", color = "#00C100", shortname = "",},
["Party of the South"] = {abbrev = "", color = "#476099", shortname = "",},
["Party of the Swedes"] = {abbrev = "", color = "#BB8800", shortname = "",},
["Party of the Third Age"] = {abbrev = "", color = "white", shortname = "",},
["Party of the Vlachs of Macedonia"] = {abbrev = "PVM", color = "", shortname = "",},
["Party of Togolese Unity"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Party of Truth (Yemen)"] = {abbrev = "", color = "#336600", shortname = "Party of Truth",},
["Party of United Democrats of Macedonia"] = {abbrev = "", color = "#07569D", shortname = "",},
["Party of United Pensioners and the Disabled"] = {abbrev = "PPIR", color = "#696969", shortname = "",},
["Party of United Pensioners of Serbia"] = {abbrev = "PUPS", color = "#E8000D", shortname = "",},
["Party of Veterans of the Afghan War"] = {abbrev = "", color = "#644226", shortname = "Afghans' Party",},
["Party of Workers' Self-Government"] = {abbrev = "PST", color = "#FF4400", shortname = "",},
["Party of Young Free Democrats of Romania"] = {abbrev = "PTLDR", color = "red", shortname = "",},
["Party Tumu"] = {abbrev = "", color = "#ACE1AF", shortname = "Party Tumu",},
["Party with a First and Last Name"] = {abbrev = "", color = "#5BA4D7", shortname = "",},
["Party X"] = {abbrev = "X", color = "#05435C", shortname = "",},
["Pasban Pakistan"] = {abbrev = "PP", color = "#800000", shortname = "",},
["Pasban Party"] = {abbrev = "", color = "#B22224", shortname = "",},
["Pashtun Tahafuz Movement"] = {abbrev = "PTM", color = "#FF6347", shortname = "",},
["Pashtunkhwa Milli Awami Party"] = {abbrev = "PMAP", color = "#FF4500", shortname = "",},
["PASOK"] = {abbrev = "", color = "#2D902D", shortname = "PASOK",},
["Pasumpon Desiya Kazhagam"] = {abbrev = "", color = "Violet", shortname = "",},
["Patagonian Regional Democracy"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Patagonic Social Party"] = {abbrev = "", color = "#E42F28", shortname = "",},
["Paterna Sí Puede"] = {abbrev = "", color = "#5A2859", shortname = "",},
["Path of Change"] = {abbrev = "CZ", color = "#008B3F", shortname = "",},
["Path of Democracy"] = {abbrev = "PoD", color = "#BF3673", shortname = "",},
["Patient Focus (Norway)"] = {abbrev = "", color = "#F69465", shortname = "",},
["Patriot Front"] = {abbrev = "", color = "#AE8333", shortname = "",},
["Patriot Party (Indonesia)"] = {abbrev = "", color = "#CC1F1D", shortname = "",},
["Patriot Party of the United States"] = {abbrev = "", color = "darkorange", shortname = "",},
["Patriot Whigs"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Patriota"] = {abbrev = "", color = "#00A29B", shortname = "",},
["Patriotic Accord"] = {abbrev = "", color = "#9B2335", shortname = "",},
["Patriotic Alliance (Greece)"] = {abbrev = "PATRI.S", color = "navy", shortname = "",},
["Patriotic Alliance (South Africa)"] = {abbrev = "", color = "#388F35", shortname = "Patriotic Alliance",},
["Patriotic Alliance for Change"] = {abbrev = "", color = "#E32636", shortname = "",},
["Patriotic Bloc (San Marino)"] = {abbrev = "", color = "#000000", shortname = "",},
["Patriotic Coalition (Croatia)"] = {abbrev = "", color = "#005BAA", shortname = "Patriotic Coalition",},
["Patriotic Front (Bulgaria, 2021)"] = {abbrev = "", color = "#204D88", shortname = "",},
["Patriotic Front (Bulgaria)"] = {abbrev = "PF", color = "#000066", shortname = "",},
["Patriotic Front (Trinidad and Tobago)"] = {abbrev = "PF", color = "#9f6560", shortname = "",},
["Patriotic Front (Zambia)"] = {abbrev = "PF", color = "#3064B0", shortname = "",},
["Patriotic Front for Progress"] = {abbrev = "", color = "#FF8080", shortname = "",},
["Patriotic Komitas Union of Montenegro"] = {abbrev = "", color = "#126C48", shortname = "",},
["Patriotic Movement for Renewal"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Patriotic Movement for the Republic"] = {abbrev = "", color = "#F36B05", shortname = "",},
["Patriotic Party (Guatemala)"] = {abbrev = "PP", color = "#FF8000", shortname = "",},
["Patriotic Party (Turkey)"] = {abbrev = "", color = "#E30513", shortname = "Patriotic",},
["Patriotic People's Movement (1993)"] = {abbrev = "", color = "black", shortname = "",},
["Patriotic People's Movement"] = {abbrev = "", color = "#000000", shortname = "",},
["Patriotic Salvation Movement"] = {abbrev = "MPS", color = "#3333CC", shortname = "",},
["Patriotic Social Alliance"] = {abbrev = "", color = "#FAE819", shortname = "",},
["Patriotic Society Party"] = {abbrev = "PSP", color = "#006400", shortname = "",},
["Patriotic Union (Chile)"] = {abbrev = "", color = "#cc0000", shortname = "Patriotic Union",},
["Patriotic Union (Colombia)"] = {abbrev = "", color = "#dbd100", shortname = "",},
["Patriotic Union (Liechtenstein)"] = {abbrev = "VU", color = "#C90019", shortname = "",},
["Patriotic Union (Panama)"] = {abbrev = "UP", color = "#FFA500", shortname = "",},
["Patriotic Union of Kurdistan"] = {abbrev = "PUK", color = "#00A550", shortname = "",},
["Patriotic Union of Mandebeleland"] = {abbrev = "PUMA", color = "#F5F5DC", shortname = "",},
["Patriots of Russia"] = {abbrev = "", color = "#FFC20E", shortname = "",},
["Pattali Makal Katchi"] = {abbrev = "PMK", color = "#4900FF", shortname = "",},
["Pattali Makkal Katchi"] = {abbrev = "PMK", color = "#FFFF00", shortname = "",},
["Paulista Republican Party"] = {abbrev = "PRP", color = "#EA9978", shortname = "",},
["PAX Association"] = {abbrev = "PAX", color = "#223D2E", shortname = "",},
["PDFO"] = {abbrev = "", color = "#6764FF", shortname = "",},
["Pè a Corsica"] = {abbrev = "", color = "#FF691F", shortname = "",},
["Peace and Democracy Movement"] = {abbrev = "", color = "#000099", shortname = "",},
["Peace and Democracy Party"] = {abbrev = "BDP", color = "#008800", shortname = "",},
["Peace and Development Party"] = {abbrev = "PDP", color = "#32CD32", shortname = "",},
["Peace and Freedom Party (US)"] = {abbrev = "", color = "#00FF00", shortname = "Peace and Freedom",},
["Peace and Neutrality Party"] = {abbrev = "", color = "#CE1126", shortname = "",},
["Peace and Progress Party"] = {abbrev = "", color = "#CCCCFF", shortname = "Peace and Progress",},
["Peace Democratic Party"] = {abbrev = "", color = "#f1cd79", shortname = "",},
["Peace for Lugansk Region"] = {abbrev = "", color = "#00A0E3", shortname = "Peace for Luganshina",},
["Peace is Our Nation"] = {abbrev = "MjNN", color = "#F4AA09", shortname = "",},
["Peace Party (Turkey)"] = {abbrev = "BP", color = "#CD4A4C", shortname = "",},
["Peace Party (UK)"] = {abbrev = "", color = "#F58231", shortname = "Peace",},
["Peace Party of India"] = {abbrev = "PECP", color = "#E0E0F8", shortname = "",},
["Peace United Family Party"] = {abbrev = "PUFP", color = "#32CD32", shortname = "",},
["Peasant Party (Poland)"] = {abbrev = "SCh", color = "#72AA6B", shortname = "",},
["Peasant Party (Taiwan)"] = {abbrev = "", color = "green", shortname = "",},
["Peasant Party of Ukraine"] = {abbrev = "SelPU", color = "#FFD438", shortname = "",},
["Peasant Worker Movement"] = {abbrev = "", color = "#3333FF", shortname = "",},
["Peasant Workers' Bloc"] = {abbrev = "BMŢ)", color = "#CC0000", shortname = "",},
["Peasants and Workers Party of India"] = {abbrev = "PWP", color = "#E52620", shortname = "",},
["Peasants Mutual Aid Association"] = {abbrev = "", color = "#006e07", shortname = "",},
["Peasants Party of Serbia"] = {abbrev = "SSS", color = "green", shortname = "",},
["Peasants Party of Ukraine"] = {abbrev = "", color = "Yellow", shortname = "",},
["Peasants' Agreement"] = {abbrev = "PSL-PL", color = "#54A405", shortname = "",},
["Peasants' League"] = {abbrev = "", color = "#99B200", shortname = "",},
["Peasants' List"] = {abbrev = "", color = "darkgreen", shortname = "Peasants",},
["Peasants' Party (Romania)"] = {abbrev = "PȚ", color = "#008000", shortname = "",},
["Peasants' Party–Lupu"] = {abbrev = "PȚ–Lupu", color = "#aadb2a", shortname = "",},
["Peasants' Unity"] = {abbrev = "", color = "#B9BF01", shortname = "",},
["Pederalismo ng Dugong Dakilang Samahan"] = {abbrev = "PDDS", color = "#B10305", shortname = "",},
["Peelite"] = {abbrev = "", color = "#99FF99", shortname = "",},
["Pelucones"] = {abbrev = "", color = "#3333CC", shortname = "",},
["Penang Front Party"] = {abbrev = "", color = "#E45035", shortname = "",},
["Peninsular Commons"] = {abbrev = "", color = "#106999", shortname = "",},
["Pensioners in Action Party"] = {abbrev = "", color = "#BDC394", shortname = "",},
["Pensioners Party (England)"] = {abbrev = "", color = "#808080", shortname = "Pensioners",},
["Pensioners' Party (Denmark)"] = {abbrev = "", color = "#cccc00", shortname = "Pensioners",},
["Pensioners' Party (Finland)"] = {abbrev = "", color = "gold", shortname = "",},
["Pensioners' Party (Italy)"] = {abbrev = "", color = "#1560BD", shortname = "",},
["Pensioners' Party (Norway)"] = {abbrev = "", color = "#8098CE", shortname = "",},
["Pensioners' Party of Bosnia and Herzegovina"] = {abbrev = "", color = "gray", shortname = "",},
["Pensioners' Party"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Pensionist Assembly of the Canaries"] = {abbrev = "", color = "#457BF9", shortname = "",},
["Pentapartito"] = {abbrev = "", color = "#FF9966", shortname = "",},
["People Against Bureaucracy"] = {abbrev = "PAB", color = "black", shortname = "",},
["People and Justice"] = {abbrev = "", color = "navy", shortname = "",},
["People Before Profit"] = {abbrev = "PBP", color = "#E91D50", shortname = "People Before Profit",},
["People Before Profit/Solidarity"] = {abbrev = "PBP/S", color = "#8E2420", shortname = "PBP/Solidarity",},
["People First Party (Solomon Islands)"] = {abbrev = "", color = "#9000AD", shortname = "",},
["People First Party (South Korea)"] = {abbrev = "", color = "#FF66CC", shortname = "",},
["People First Party (Taiwan)"] = {abbrev = "", color = "#FF6310", shortname = "PFP",},
["People of Barañain"] = {abbrev = "", color = "#7EBBD8", shortname = "",},
["People Out of Parliament Party"] = {abbrev = "", color = "#EA235A", shortname = "",},
["People Party (South Korea)"] = {abbrev = "", color = "#EA5504", shortname = "People",},
["PEOPLE Party"] = {abbrev = "", color = "#ffd700", shortname = "PEOPLE",},
["People Power (Hong Kong)"] = {abbrev = "", color = "#FDD12B", shortname = "People Power",},
["People Power Coalition"] = {abbrev = "PPC", color = "#FFFF33", shortname = "",},
["People Power Party (South Korea)"] = {abbrev = "", color = "#E61E2B", shortname = "People Power",},
["People Power–League of Social Democrats"] = {abbrev = "PP/LSD", color = "#FDD12B", shortname = "",},
["People Reform Party"] = {abbrev = "", color = "#000465", shortname = "",},
["People–Animals–Nature"] = {abbrev = "", color = "#008080", shortname = "",},
["People's Action Movement"] = {abbrev = "PAM", color = "#FBD101", shortname = "",},
["People's Action No to More Road Tolls"] = {abbrev = "", color = "#ed1c24", shortname = "",},
["People's Action Party (Ghana)"] = {abbrev = "", color = "#970303", shortname = "",},
["People's Action Party (Papua New Guinea)"] = {abbrev = "", color = "gold", shortname = "",},
["People's Action Party (Vanuatu)"] = {abbrev = "PAP", color = "#013220", shortname = "",},
["People's Action Party"] = {abbrev = "PAP", color = "#2C59AC", shortname = "",},
["People's Action (Romania)"] = {abbrev = "AP", color = "#0000FF", shortname = "People's Action"},
["People's Alliance (Costa Rica)"] = {abbrev = "AP", color = "#8B0000", shortname = "",},
["People's Alliance (Iceland)"] = {abbrev = "", color = "#597f5a", shortname = "People's Alliance",},
["People's Alliance (Maldives)"] = {abbrev = "PA", color = "#B55489", shortname = "",},
["People's Alliance (Spain)"] = {abbrev = "AP", color = "#FFA519", shortname = "",},
["People's Alliance (Sri Lanka)"] = {abbrev = "", color = "#0000FF", shortname = "People's Alliance",},
["People's Alliance for Free Peace"] = {abbrev = "NSSM", color = "#FF4D4D", shortname = "",},
["People's Alliance for Gupkar Declaration"] = {abbrev = "PAGD", color = "#fe0000", shortname = "",},
["People's Alliance for Progress"] = {abbrev = "VVV", color = "green", shortname = "",},
["People's Alliance of New Brunswick"] = {abbrev = "", color = "#5C2D83", shortname = "People's Alliance",},
["People's Alliance of Tower Hamlets"] = {abbrev = "PATH", color = "#800020", shortname = "",},
["People's Alliance Party (Solomon Islands)"] = {abbrev = "", color = "#F28317", shortname = "People's Alliance Party",},
["People's Alternative Party"] = {abbrev = "", color = "#EDFBFF", shortname = "",},
["People's Ascent Party"] = {abbrev = "HYP", color = "#009933", shortname = "",},
["People's Candidacy of the Aranguren Valley"] = {abbrev = "", color = "#6897CF", shortname = "",},
["People's Champ Movement"] = {abbrev = "PCM", color = "#f77f00", shortname = "",},
["People's Choice Party"] = {abbrev = "", color = "#84C6C6", shortname = "The People's Choice",},
["People's Choice"] = {abbrev = "", color = "#008080", shortname = "",},
["People's Coalition (Spain)"] = {abbrev = "AP–PDP–PL", color = "#3282A8", shortname = "",},
["People's Coalition 5 Plus"] = {abbrev = "", color = "#29B1FD", shortname = "",},
["People's Concord of Montenegro"] = {abbrev = "NSCG", color = "#3399ff", shortname = "",},
["People's Congress Party (South Africa)"] = {abbrev = "", color = "#FFCA08", shortname = "People's Congress",},
["People's Congress Party"] = {abbrev = "PCP", color = "#F4A460", shortname = "",},
["People's Conscience Party"] = {abbrev = "", color = "#FF7F00", shortname = "Hanura",},
["People's Constitutional Party"] = {abbrev = "", color = "#00FF00", shortname = "People's Constitutional",},
["People's Convention Party"] = {abbrev = "", color = "red", shortname = "",},
["People's Cooperative Party of Kazakhstan"] = {abbrev = "", color = "#ffaf30", shortname = "",},
["People's Crusade Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["People's Democracy (Ireland)"] = {abbrev = "", color = "red", shortname = "People's Democracy",},
["People's Democracy Party"] = {abbrev = "", color = "#FDD300", shortname = "",},
["People's Democratic Alliance (Manipur)"] = {abbrev = "PDA", color = "black", shortname = "",},
["People's Democratic Front (Hyderabad)"] = {abbrev = "PDF", color = "#E6452E", shortname = "",},
["People's Democratic Front (Meghalaya)"] = {abbrev = "PDF", color = "#FFFF34", shortname = "",},
["People's Democratic Front (Romania)"] = {abbrev = "FDP", color = "#87CEEB", shortname = "",},
["People's Democratic Movement (Meghalaya)"] = {abbrev = "", color = "red", shortname = "",},
["People's Democratic Movement (Montserrat)"] = {abbrev = "", color = "#BE202E", shortname = "",},
["People's Democratic Movement (Turks and Caicos Islands)"] = {abbrev = "PDM", color = "#124D87", shortname = "",},
["People's Democratic Movement"] = {abbrev = "", color = "#0FE1F1", shortname = "",},
["People's Democratic Organisation for Independence and Socialism"] = {abbrev = "PDOIS", color = "#CA3403", shortname = "",},
["People's Democratic Party (Belize)"] = {abbrev = "PDP", color = "#00FFFF", shortname = "",},
["People's Democratic Party (Bhutan)"] = {abbrev = "PDP", color = "#324D7A", shortname = "",},
["People's Democratic Party (Chile)"] = {abbrev = "", color = "#013068", shortname = "",},
["People's Democratic Party (Dominican Republic)"] = {abbrev = "", color = "black", shortname = "",},
["People's Democratic Party (Fiji)"] = {abbrev = "", color = "#800000", shortname = "",},
["People's Democratic Party (Spain, 1974)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["People's Democratic Party (Spain)"] = {abbrev = "PDP", color = "#457F3F", shortname = "",},
["People's Democratic Party (Taiwan)"] = {abbrev = "", color = "red", shortname = "",},
["People's Democratic Party (Tonga)"] = {abbrev = "PDP", color = "blue", shortname = "",},
["People's Democratic Party (Trinidad and Tobago)"] = {abbrev = "", color = "#f4c430", shortname = "",},
["People's Democratic Party (Ukraine)"] = {abbrev = "NDP", color = "#87C86E", shortname = "",},
["People's Democratic Party of Afghanistan"] = {abbrev = "PDPA", color = "#db0a13", shortname = "",},
["People's Democratic Party of Tajikistan"] = {abbrev = "PDP", color = "#EE973E", shortname = "",},
["People's Democratic Party of Uzbekistan"] = {abbrev = "XDP", color = "#8D3589", shortname = "",},
["People's Democratic Party of Uzbekistan (1991)"] = {abbrev = "XDP", color = "#006400", shortname = "",},
["People's Democratic Party of Uzbekistan (2021)"] = {abbrev = "XDP", color = "", shortname = "",},
["People's Electoral Movement (Aruba)"] = {abbrev = "", color = "#F4D20D", shortname = "",},
["People's Electoral Movement (Venezuela)"] = {abbrev = "", color = "#6F0E81", shortname = "",},
["People's European Union of Bosnia and Herzegovina"] = {abbrev = "", color = "#87B030", shortname = "",},
["People's Experts"] = {abbrev = "", color = "#800000", shortname = "",},
["People's Force"] = {abbrev = "", color = "#00AC5B", shortname = "",},
["People's Freedom Movement (Serbia)"] = {abbrev = "NSP", color = "#256296", shortname = "",},
["People's Freedom Party \"For Russia without Lawlessness and Corruption\""] = {abbrev = "", color = "#233B95", shortname = "",},
["People's Freedom Party"] = {abbrev = "", color = "#8A1739", shortname = "People's Freedom",},
["People's Front (Georgia)"] = {abbrev = "", color = "#730109", shortname = "People's Front",},
["People's Front (Singapore)"] = {abbrev = "PF", color = "#7877BB", shortname = "",},
["People's Front (Ukraine)"] = {abbrev = "", color = "#E0BF40", shortname = "People's Front",},
["People's Front for Democracy and Justice"] = {abbrev = "", color = "green", shortname = "",},
["People's Front of Iceland"] = {abbrev = "", color = "#e21a21", shortname = "",},
["People's Front"] = {abbrev = "", color = "Blue", shortname = "",},
["People's Harmony Party"] = {abbrev = "", color = "#741C27", shortname = "",},
["People's Independent Party"] = {abbrev = "", color = "#B97333", shortname = "People's Independent",},
["People's Islamic Unity Party of Afghanistan"] = {abbrev = "PIUPA", color = "#FF0000", shortname = "",},
["People's Justice Front"] = {abbrev = "AKAR", color = "", shortname = "",},
["People's Justice Party (Malaysia)"] = {abbrev = "PKR", color = "#00ADEF", shortname = "",},
["People's Justice Party (UK)"] = {abbrev = "", color = "#7fffd4", shortname = "People's Justice",},
["People's Labour Party (Papua New Guinea)"] = {abbrev = "", color = "#E42716", shortname = "",},
["People's Labour Party (Saint Kitts and Nevis)"] = {abbrev = "PLP", color = "#EF8136", shortname = "",},
["People's Labour Party (UK)"] = {abbrev = "", color = "red", shortname = "People's Labour",},
["People's Liberal Party"] = {abbrev = "", color = "darkgreen", shortname = "",},
["People's Liberation Front (Sri Lanka)"] = {abbrev = "", color = "#F90818", shortname = "",},
["People's Liberation Organisation of Tamil Eelam"] = {abbrev = "", color = "#F41E1E", shortname = "",},
["People's Liberation Party (East Timor)"] = {abbrev = "PLP", color = "#3CB371", shortname = "",},
["People's Liberation Party"] = {abbrev = "HKP", color = "#E68A00", shortname = "",},
["People's Life First"] = {abbrev = "", color = "#00A550", shortname = "",},
["People's Life Party"] = {abbrev = "", color = "#BE3075", shortname = "People's Life",},
["People's Monarchist Party (Portugal)"] = {abbrev = "", color = "#005FAD", shortname = "People's Monarchist",},
["People's Movement (New Zealand)"] = {abbrev = "", color = "#00CED1", shortname = "People's Movement",},
["People's Movement (Tunisia)"] = {abbrev = "", color = "#FF363A", shortname = "",},
["People's Movement against the EU"] = {abbrev = "", color = "green", shortname = "People's Movement",},
["People's Movement for Change"] = {abbrev = "", color = "#147420", shortname = "",},
["People's Movement for Democratic Change"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["People's Movement for Justice and Welfare"] = {abbrev = "", color = "#204A87", shortname = "",},
["People's Movement for Latvia"] = {abbrev = "", color = "#9D2136", shortname = "",},
["People's Movement for Progress"] = {abbrev = "", color = "#FFA500", shortname = "",},
["People's Movement of Kosovo"] = {abbrev = "", color = "#FE0000", shortname = "",},
["People's Movement of Kyrgyzstan"] = {abbrev = "", color = "", shortname = "People's Movement",},
["People's Movement of Ukraine"] = {abbrev = "", color = "#0091D5", shortname = "Rukh",},
["People's Movement of Uzbekistan"] = {abbrev = "", color = "#009AB6", shortname = "",},
["People's Movement Party"] = {abbrev = "PMP", color = "#A7CF35", shortname = "",},
["People's Mujahedin of Iran"] = {abbrev = "PMOI", color = "#CE2029", shortname = "",},
["People's National Action"] = {abbrev = "ANP", color = "Blue", shortname = "",},
["People's National Alliance (Cayman Islands)"] = {abbrev = "PNA", color = "#401e5e", shortname = "",},
["People's National Congress (Guyana)"] = {abbrev = "PNC", color = "#006600", shortname = "",},
["People's National Congress (Maldives)"] = {abbrev = "", color = "#24DBCB", shortname = "",},
["People's National Congress (Papua New Guinea)"] = {abbrev = "PNC", color = "#292635", shortname = "",},
["People's National Convention (Ghana)"] = {abbrev = "", color = "#E5322D", shortname = "",},
["People's National Movement (Chile)"] = {abbrev = "", color = "#013068", shortname = "",},
["People's National Movement"] = {abbrev = "PNM", color = "#D71A16", shortname = "",},
["People's National Party (Belize)"] = {abbrev = "PNP", color = "#008000", shortname = "",},
["People's National Party (Ghana)"] = {abbrev = "", color = "red", shortname = "",},
["People's National Party"] = {abbrev = "PNP", color = "#fb740a", shortname = "",},
["People's New Party"] = {abbrev = "", color = "#FFA500", shortname = "People's New",},
["People's Palentine Group"] = {abbrev = "", color = "#742C64", shortname = "",},
["People's Participation Movement"] = {abbrev = "", color = "#599874", shortname = "",},
["People's Partnership"] = {abbrev = "", color = "#FCCC08", shortname = "",},
["People's Party (interwar Romania)"] = {abbrev = "PP", color = "#FFFF00", shortname = "",},
["People's Party – Reformists"] = {abbrev = "", color = "#4A217B", shortname = "",},
["People's Party – Dan Diaconescu"] = {abbrev = "PP–DD", color = "#4E2172", shortname = "",},
["People's Party – Movement for a Democratic Slovakia"] = {abbrev = "ĽS–HZDS", color = "#73C2FB", shortname = "",},
["People's Party – Our Slovakia"] = {abbrev = "ĽSNS", color = "#005222", shortname = "",},
["People's Party (1850's)"] = {abbrev = "", color = "#ACE1AF", shortname = "People's",},
["People's Party (Armenia)"] = {abbrev = "", color = "blue", shortname = "",},
["People's Party (Belgium)"] = {abbrev = "PP", color = "#842973", shortname = "",},
["People's Party (Bulgaria)"] = {abbrev = "", color = "#B87333", shortname = "",},
["People's Party (Denmark)"] = {abbrev = "", color = "#E4BD4A", shortname = "",},
["People's Party (Egypt)"] = {abbrev = "", color = "#00A6EF", shortname = "",},
["People's Party (Faroe Islands)"] = {abbrev = "", color = "#00843B", shortname = "People's",},
["People's Party (Finland, 1917)"] = {abbrev = "", color = "#47C7E6", shortname = "",},
["People's Party (Finland, 1932)"] = {abbrev = "", color = "Green", shortname = "",},
["People's Party (Georgia)"] = {abbrev = "", color = "#ba2b27", shortname = "",},
["People's Party (Greece)"] = {abbrev = "", color = "#4169E1", shortname = "People's Party",},
["People's Party (Hong Kong)"] = {abbrev = "", color = "#CA3E41", shortname = "",},
["People's Party (Iceland)"] = {abbrev = "", color = "#FFCA3E", shortname = "People's",},
["People's Party (Indiana)"] = {abbrev = "", color = "#ACE1AF", shortname = "People's",},
["People's Party (Iran)"] = {abbrev = "", color = "#FDEE00", shortname = "",},
["People's Party (Jujuy)"] = {abbrev = "", color = "#E9D66B", shortname = "",},
["People's Party (Kingdom of Croatia)"] = {abbrev = "", color = "#EE9745", shortname = "",},
["People's Party (Kingdom of Dalmatia)"] = {abbrev = "", color = "#c73b3b", shortname = "",},
["People's Party (Latvia)"] = {abbrev = "", color = "#F79239", shortname = "",},
["People's Party (Malawi)"] = {abbrev = "PP", color = "#FF6400", shortname = "",},
["People's Party (Malta)"] = {abbrev = "PP", color = "#1E3D5A", shortname = "",},
["People's Party (Montenegro, 1990)"] = {abbrev = "NS", color = "#153E7E", shortname = "",},
["People's Party (Montenegro)"] = {abbrev = "", color = "#153E7E", shortname = "",},
["People's Party (Northern Cyprus)"] = {abbrev = "HP", color = "#254561", shortname = "",},
["People's Party (Panama)"] = {abbrev = "", color = "#0082C8", shortname = "",},
["People's Party (Papua New Guinea)"] = {abbrev = "", color = "#87E86A", shortname = "",},
["People's Party (Romania)"] = {abbrev = "", color = "#D4AF37", shortname = "",},
["People's Party (Serbia)"] = {abbrev = "NS", color = "#800000", shortname = "",},
["People's Party (Serbia, 2017)"] = {abbrev = "", color = "#1E90FF", shortname = "Narodna",},
["People's Party (South Korea, 1963)"] = {abbrev = "", color = "#663", shortname = "",},
["People's Party (South Korea, 2016)"] = {abbrev = "", color = "#006542", shortname = "People's",},
["People's Party (Spain, 1976)"] = {abbrev = "", color = "#17BB4B", shortname = "",},
["People's Party (Spain)"] = {abbrev = "PP", color = "#1D84CE", shortname = "",},
["People's Party (Syria)"] = {abbrev = "", color = "#FF9900", shortname = "People's Party",},
["People's Party (Ukraine)"] = {abbrev = "", color = "#009CE0", shortname = "People's Party",},
["People's Party (US, 1971)"] = {abbrev = "", color = "#EE2C21", shortname = "People's",},
["People's Party (US)"] = {abbrev = "", color = "#ACE1AF", shortname = "Populist",},
["People's Party for Democracy and Development"] = {abbrev = "PdP", color = "#BBD17A", shortname = "",},
["People's Party for Freedom and Democracy (2020)"] = {abbrev = "", color = "#0A2CCA", shortname = "",},
["People's Party for Freedom and Democracy"] = {abbrev = "VVD", color = "#0D1E70", shortname = "",},
["People's Party for Reconstruction and Democracy"] = {abbrev = "", color = "#FFCC33", shortname = "",},
["People's Party For Work And Betterment"] = {abbrev = "", color = "#7BC3F3", shortname = "",},
["People's Party of Abkhazia"] = {abbrev = "", color = "red", shortname = "",},
["People's Party of Armenia"] = {abbrev = "", color = "red", shortname = "People's Party",},
["People's Party of Arunachal"] = {abbrev = "PPA", color = "green", shortname = "",},
["People's Party of India (Secular)"] = {abbrev = "PPI (S)", color = "Red", shortname = "",},
["People's Party of Kazakhstan"] = {abbrev = "", color = "#DC241F", shortname = "People's Party",},
["People's Party of Panama"] = {abbrev = "PPP", color = "orange", shortname = "",},
["People's Party of Punjab"] = {abbrev = "PPoP", color = "black", shortname = "",},
["People's Party of South Ossetia"] = {abbrev = "", color = "#F39C12", shortname = "People's Party",},
["People's Party of the Republic of Moldova"] = {abbrev = "PPRM", color = "#8757A3", shortname = "",},
["People's Party of the Russian Federation"] = {abbrev = "NPRF", color = "#FFCC00", shortname = "",},
["People's Party of Tibet"] = {abbrev = "PPT", color = "#3E4095", shortname = "",},
["People's Party of Timor"] = {abbrev = "", color = "#0099FF", shortname = "",},
["People's Party Work for Prosperity"] = {abbrev = "", color = "#4682B4", shortname = "",},
["People's Patagonic Movement"] = {abbrev = "", color = "#04923C", shortname = "",},
["People's Peasant Party"] = {abbrev = "NSS", color = "#2E3192", shortname = "",},
["People's Pioneer Party"] = {abbrev = "PPP", color = "#2E3492", shortname = "",},
["People's Political Party (Saint Vincent and the Grenadines)"] = {abbrev = "", color = "#7B68EE", shortname = "",},
["People's Power Party (Singapore)"] = {abbrev = "PPP", color = "#9A77BB", shortname = "",},
["People's Power Party (Thailand)"] = {abbrev = "", color = "#FF0800", shortname = "People's Power",},
["People's Progress Party"] = {abbrev = "", color = "#EB5A4A", shortname = "",},
["People's Progressive Alliance (Mauritania)"] = {abbrev = "PPA", color = "#FFCCFF", shortname = "",},
["People's Progressive Alliance (Sint Maarten)"] = {abbrev = "", color = "#ff6501", shortname = "",},
["People's Progressive Movement (Cayman Islands)"] = {abbrev = "PPM", color = "#E11921", shortname = "",},
["People's Progressive Movement (Malawi)"] = {abbrev = "PPM", color = "#C0C0C0", shortname = "",},
["People's Progressive Party (Anguilla)"] = {abbrev = "", color = "#74B230", shortname = "",},
["People's Progressive Party (Guyana)"] = {abbrev = "PPP", color = "#BF1B2C", shortname = "",},
["People's Progressive Party (Malaysia)"] = {abbrev = "", color = "#DAA520", shortname = "",},
["People's Progressive Party (Nepal)"] = {abbrev = "PPP", color = "#2460B9", shortname = "",},
["People's Progressive Party (Saint Lucia)"] = {abbrev = "", color = "#F79646", shortname = "",},
["People's Progressive Party (Solomon Islands)"] = {abbrev = "PPP", color = "#DB7093", shortname = "",},
["People's Progressive Party (The Gambia)"] = {abbrev = "PPP", color = "#FF69B4", shortname = "",},
["People's Progressive Party (Uganda)"] = {abbrev = "PPP", color = "#D38135", shortname = "",},
["People's Progressive Party (Vanuatu)"] = {abbrev = "PPP", color = "#D8BFD8", shortname = "",},
["People's Radical Civic Union"] = {abbrev = "UCRP", color = "#E10019", shortname = "",},
["People's Radical Party"] = {abbrev = "NRS", color = "#404371", shortname = "",},
["People's Rally for Progress"] = {abbrev = "RPP", color = "#009a00", shortname = "",},
["People's Redemption Party"] = {abbrev = "PRP", color = "#ed3136", shortname = "",},
["People's Reform Party"] = {abbrev = "PRP", color = "#F08080", shortname = "",},
["People's Representative Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["People's Revolutionary Movement (South Africa)"] = {abbrev = "", color = "#07E651", shortname = "",},
["People's Revolutionary Party of Benin"] = {abbrev = "", color = "#EF1029", shortname = "",},
["People's Services Party"] = {abbrev = "", color = "#2CADC8", shortname = "",},
["People's Socialist Party (Spain)"] = {abbrev = "", color = "#FF7979", shortname = "",},
["People's Socialist Party, Nepal"] = {abbrev = "PSP-N", color = "pink", shortname = "",},
["People's Socialist Party of Montenegro"] = {abbrev = "NSS CG", color = "red", shortname = "",},
["People's Socialist Union"] = {abbrev = "", color = "#D82028", shortname = "",},
["People's Transformation Party"] = {abbrev = "", color = "#C2D54C", shortname = "",},
["People's Unification Party"] = {abbrev = "", color = "#EE7543", shortname = "",},
["People's Union (Belgium)"] = {abbrev = "", color = "#FFED00", shortname = "",},
["People's Union (Bulgaria)"] = {abbrev = "", color = "#CC7722", shortname = "",},
["People's Union (Iraq)"] = {abbrev = "", color = "red", shortname = "",},
["People's Union (Russia)"] = {abbrev = "", color = "#C42700", shortname = "",},
["People's Union of Estonia"] = {abbrev = "", color = "#F5B453", shortname = "People's Union",},
["People's Union of Kazakhstan Unity"] = {abbrev = "", color = "#1CA9C9", shortname = "People's Union",},
["People's Unitary Candidacy of Arbucias"] = {abbrev = "", color = "#F7E904", shortname = "",},
["People's United Party (South Korea)"] = {abbrev = "", color = "#F47920", shortname = "People's United",},
["People's United Party"] = {abbrev = "PUP", color = "#003F87", shortname = "",},
["People's Unity Assembly"] = {abbrev = "", color = "#DEC939", shortname = "",},
["People's Unity Party – Socialist Party"] = {abbrev = "", color = "#FF0000", shortname = "Socialist",},
["People's Voice (Bulgaria)"] = {abbrev = "", color = "#112369", shortname = "",},
["People's Voice Party"] = {abbrev = "", color = "#00a3c9", shortname = "HAS Party",},
["People's Voice"] = {abbrev = "", color = "#C3103A", shortname = "",},
["People's Welfare Party (Malaysia)"] = {abbrev = "KITA", color = "#F2D6C0", shortname = "",},
["People's Welfare Party"] = {abbrev = "", color = "#CB78CB", shortname = "",},
["People's Will Ukraine"] = {abbrev = "", color = "#A1A724", shortname = "",},
["People’s Party of India (Secular)"] = {abbrev = "", color = "maroon", shortname = "",},
["Peoples Democratic Party (India)"] = {abbrev = "PDP", color = "#ED1C24", shortname = "",},
["Peoples Democratic Party (Nigeria)"] = {abbrev = "PDP", color = "#006903", shortname = "",},
["Peoples Green Party"] = {abbrev = "PGP", color = "#04B404", shortname = "",},
["Peoples Republican Party"] = {abbrev = "", color = "#999900", shortname = "",},
["Peoples Voice (Singapore)"] = {abbrev = "PV", color = "#91268E", shortname = "",},
["Peoples' Democratic Party (Turkey)"] = {abbrev = "HDP", color = "#951B88", shortname = "",},
["Peoples' Liberation Party (Turkey)"] = {abbrev = "", color = "#CC7A00", shortname = "",},
["Peoples' Party of Iran"] = {abbrev = "", color = "Orange", shortname = "",},
["Per Berga i per Catalunya"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Perikatan Nasional"] = {abbrev = "PN", color = "#031e61", shortname = "",},
["Perindo Party"] = {abbrev = "", color = "#2F318B", shortname = "",},
["Permai"] = {abbrev = "", color = "red", shortname = "",},
["Personal Choice Party"] = {abbrev = "", color = "#FBEC5D", shortname = "Personal Choice",},
["Pertjajah Luhur"] = {abbrev = "PL", color = "#DF0508", shortname = "",},
["Pertubuhan Kebangsaan Melayu Singapura"] = {abbrev = "PKMS", color = "#01CC00", shortname = "",},
["Peru 2000"] = {abbrev = "", color = "#FF5800", shortname = "",},
["Peru Nation"] = {abbrev = "", color = "#0093AF", shortname = "",},
["Peru Secure Homeland"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Peru Wins"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Perunthalaivar Makkal Katchi"] = {abbrev = "", color = "Aqua", shortname = "",},
["Peruvian Democratic Movement"] = {abbrev = "", color = "#87CEEB", shortname = "",},
["Peruvian Nationalist Party"] = {abbrev = "", color = "#E34234", shortname = "Gana Perú",},
["Peruvians for Change"] = {abbrev = "PPK", color = "#E2007A", shortname = "",},
["Petro Poroshenko Bloc \"Solidarity\""] = {abbrev = "", color = "#B1161D", shortname = "Petro Poroshenko Bloc",},
["Phalang Chon Party"] = {abbrev = "", color = "#00BFFF", shortname = "",},
["Phalang Pracharat Party"] = {abbrev = "", color = "#3e61a7", shortname = "",},
["Phalon-Sawaw Democratic Party"] = {abbrev = "PSDP", color = "Blue", shortname = "",},
["Pheu Thai Party"] = {abbrev = "", color = "#E30613", shortname = "Pheu Thai",},
["Philippine Democratic Socialist Party"] = {abbrev = "PDSP", color = "#CD5C5C", shortname = "",},
["Philippine Green Republican Party"] = {abbrev = "PGRP", color = "#39944A", shortname = "",},
["Picardie debout"] = {abbrev = "", color = "#F13C46", shortname = "",},
["Pillars of Truth"] = {abbrev = "PTK", color = "#001854", shortname = "",},
["Pim Fortuyn List"] = {abbrev = "LPF", color = "#FCE11F", shortname = "",},
["Pioneer of Victoria Park"] = {abbrev = "", color = "#911A35", shortname = "",},
["Pioneer"] = {abbrev = "", color = "#fc040b", shortname = "",},
["Pioneers' Party"] = {abbrev = "", color = "#FA0437", shortname = "",},
["Pipiolos"] = {abbrev = "", color = "#FFAE34", shortname = "",},
["Pirate Party (Belgium)"] = {abbrev = "", color = "#660087", shortname = "",},
["Pirate Party (Croatia)"] = {abbrev = "PS", color = "black", shortname = "",},
["Pirate Party (France)"] = {abbrev = "PP", color = "#8348B5", shortname = "",},
["Pirate Party (Iceland)"] = {abbrev = "", color = "#896EBD", shortname = "Pirates",},
["Pirate Party (Netherlands)"] = {abbrev = "", color = "#580091", shortname = "",},
["Pirate Party (Slovenia)"] = {abbrev = "", color = "#f68f35", shortname = "",},
["Pirate Party (Spain)"] = {abbrev = "", color = "#660087", shortname = "",},
["Pirate Party (Sweden)"] = {abbrev = "", color = "#512483", shortname = "Pirate",},
["Pirate Party (United Kingdom)"] = {abbrev = "", color = "#990099", shortname = "Pirate",},
["Pirate Party (US)"] = {abbrev = "", color = "#572b85", shortname = "Pirate",},
["Pirate Party Luxembourg"] = {abbrev = "", color = "#993399", shortname = "Pirates",},
["Pirate Party of Austria"] = {abbrev = "PIRAT", color = "#572b85", shortname = "",},
["Pirate Party of Catalonia"] = {abbrev = "", color = "#660087", shortname = "",},
["Pirate Party of Finland"] = {abbrev = "", color = "#660099", shortname = "",},
["Pirate Party of Israel"] = {abbrev = "", color = "black", shortname = "",},
["Pirate Party of Kazakhstan"] = {abbrev = "", color = "#1F1A17", shortname = "",},
["Pirate Party of New Zealand"] = {abbrev = "", color = "#7F27D6", shortname = "Pirate",},
["Pirate Party of Norway"] = {abbrev = "", color = "#ff8800", shortname = "",},
["Pirate Party of Switzerland"] = {abbrev = "", color = "#F9B200", shortname = "",},
["Pirate Party of Tunisia"] = {abbrev = "", color = "#000000", shortname = "",},
["Pirate Party Switzerland"] = {abbrev = "", color = "#F9B200", shortname = "",},
["Pirates of Catalonia"] = {abbrev = "", color = "#993399", shortname = "",},
["Piri Wiri Tua Movement"] = {abbrev = "", color = "#92000A", shortname = "Piri Wiri Tua",},
["Pittite"] = {abbrev = "", color = "#C0C0EF", shortname = "",},
["Pityusic Democracy"] = {abbrev = "", color = "#5C9770", shortname = "",},
["PkMAP"] = {abbrev = "", color = "#f23a02", shortname = "",},
["Plaaslike Besorgde Inwoners"] = {abbrev = "", color = "#E9F294", shortname = "",},
["Place Publique"] = {abbrev = "", color = "#FFF100", shortname = "",},
["Plaid Cymru"] = {abbrev = "", color = "#005B54", shortname = "",},
["Plain Tribals Council of Assam"] = {abbrev = "PTC", color = "#4A6673", shortname = "",},
["Plan Progress for Bolivia – National Convergence"] = {abbrev = "PPB-CN", color = "#E20A17", shortname = "National Convergence",},
["Plasencia en Común"] = {abbrev = "", color = "#FF5A3D", shortname = "",},
["Platfòm Pitit Desalin"] = {abbrev = "", color = "#EB1A22", shortname = "",},
["Platform for Catalonia"] = {abbrev = "", color = "#444042", shortname = "",},
["Platform of Gandia"] = {abbrev = "", color = "#59118E", shortname = "",},
["Platform of Independents of Spain"] = {abbrev = "", color = "#89C24D", shortname = "",},
["Platform of the Left of Coslada"] = {abbrev = "", color = "#244E0E", shortname = "",},
["Plazandreok"] = {abbrev = "", color = "#DD5CDB", shortname = "",},
["Ploughmen's Front"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Plural Calatayud"] = {abbrev = "", color = "#E75337", shortname = "",},
["Plural Democracy"] = {abbrev = "", color = "#B10608", shortname = "",},
["Plural Left (Spain, 2014)"] = {abbrev = "IP", color = "#732021", shortname = "",},
["Plurals Party"] = {abbrev = "PP", color = "#FF0000", shortname = "",},
["Plurinational Unity of the Lefts"] = {abbrev = "", color = "turquoise", shortname = "",},
["Plymouth Independents"] = {abbrev = "", color = "#EA9712", shortname = "",},
["PNA"] = {abbrev = "", color = "#228b22", shortname = "",},
["PNG Country Party"] = {abbrev = "", color = "#4F6F3C", shortname = "",},
["PNG One Nation Party"] = {abbrev = "", color = "#BFF67E", shortname = "",},
["Poalei Agudat Yisrael"] = {abbrev = "PAI", color = "#000", shortname = "",},
["Poble Lliure"] = {abbrev = "", color = "#C50455", shortname = "",},
["Pobleran Convergence"] = {abbrev = "", color = "#6A3271", shortname = "",},
["Podemos (Brazil)"] = {abbrev = "PODE", color = "#2da933", shortname = "",},
["Podemos (Guatemala)"] = {abbrev = "", color = "#D93335", shortname = "Podemos",},
["Podemos (Spanish political party)"] = {abbrev = "", color = "#5A205A", shortname = "Podemos",},
["Podemos Cambiar Málaga"] = {abbrev = "", color = "#03565E", shortname = "",},
["Podemos Perú"] = {abbrev = "", color = "#E09540", shortname = "",},
["Poland 2050"] = {abbrev = "", color = "#F9C013", shortname = "",},
["Poland Comes First"] = {abbrev = "", color = "#8C0046", shortname = "",},
["Poland Together"] = {abbrev = "", color = "#57BB59", shortname = "",},
["Polar Party"] = {abbrev = "", color = "blue", shortname = "Issittup",},
["Pole for Freedoms"] = {abbrev = "", color = "#0A6BE1", shortname = "",},
["Pole of Freedoms"] = {abbrev = "", color = "#0A6BE1", shortname = "",},
["Police Employee's Association of the Republic of Indonesia"] = {abbrev = "", color = "#D2691E", shortname = "",},
["Polisario Front"] = {abbrev = "", color = "#D70A0A", shortname = "POLISARIO",},
["Polish Affairs"] = {abbrev = "", color = "#8BC0EA", shortname = "",},
["Polish Beer-Lovers' Party"] = {abbrev = "PPPP", color = "#FAB43A", shortname = "",},
["Polish Centre"] = {abbrev = "PC", color = "#DBB44B", shortname = "",},
["Polish Christian Democratic Party"] = {abbrev = "PSChD", color = "#3346AD", shortname = "",},
["Polish Initiative"] = {abbrev = "", color = "#F02837", shortname = "",},
["Polish Labour Party - August 80"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Polish Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Polish Party"] = {abbrev = "", color = "#D49797", shortname = "",},
["Polish People's Party (1945–1949)"] = {abbrev = "PSL", color = "#255229", shortname = "",},
["Polish People's Party \"Left\""] = {abbrev = "", color = "#5EAE4D", shortname = "PSL \"Lewica\"",},
["Polish People's Party \"Nowe Wyzwolenie\""] = {abbrev = "", color = "#80461B", shortname = "PSL \"NW\"",},
["Polish People's Party \"Piast\""] = {abbrev = "", color = "#046834", shortname = "PSL \"Piast\"",},
["Polish People's Party \"Piast\" (1913–1931)"] = {abbrev = "", color = "#046834", shortname = "PSL \"Piast\"",},
["Polish People's Party \"Wyzwolenie\""] = {abbrev = "", color = "#2D8E47", shortname = "PSL \"Wyzwolenie\"",},
["Polish People's Party"] = {abbrev = "PSL", color = "#1BB100", shortname = "",},
["Polish Socialist Party"] = {abbrev = "PPS", color = "#D62D32", shortname = "",},
["Polish United Party"] = {abbrev = "PZL", color = "#A03E33", shortname = "",},
["Polish United Workers' Party"] = {abbrev = "PZPR", color = "#E3401B", shortname = "",},
["Political Evolution"] = {abbrev = "Evópoli", color = "#00BFFF", shortname = "",},
["Political Group of Okinawa Revolution"] = {abbrev = "", color = "#00469d", shortname = "",},
["Political Movement \"Social Democrats\""] = {abbrev = "", color = "#AF1518", shortname = "",},
["Political Party of Radicals"] = {abbrev = "PPR", color = "#15803C", shortname = "",},
["Political Renovation (Spain)"] = {abbrev = "", color = "#85F452", shortname = "",},
["Political Spring"] = {abbrev = "POLAN", color = "#100077", shortname = "",},
["Political Union of Economists"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Political Wing of the FAL"] = {abbrev = "PV FAL", color = "#1BB14E", shortname = "",},
["Politics Can Be Different"] = {abbrev = "LMP", color = "#7CC242", shortname = "",},
["Politihk Social Strategic"] = {abbrev = "", color = "#F12E64", shortname = "Politihk SS",},
["Polska Patriotyczna"] = {abbrev = "", color = "red", shortname = "",},
["Ponferrada en Común"] = {abbrev = "", color = "#6F1F78", shortname = "",},
["Pont (Haiti)"] = {abbrev = "", color = "#008080", shortname = "",},
["Poole People Party"] = {abbrev = "", color = "#6600CC", shortname = "Poole People",},
["Poole People"] = {abbrev = "", color = "#6600CC", shortname = "",},
["Poorvanchal Rashtriya Congress"] = {abbrev = "PRC", color = "#F2F5A9", shortname = "",},
["POPIS"] = {abbrev = "", color = "orange", shortname = "",},
["Poplar Party"] = {abbrev = "", color = "#ffffff", shortname = "Poplar",},
["Popular Action (Peru)"] = {abbrev = "", color = "#000000", shortname = "Popular Action",},
["Popular Action (Spain)"] = {abbrev = "", color = "#0033BA", shortname = "",},
["Popular Action Bloc"] = {abbrev = "", color = "#D39148", shortname = "",},
["Popular Action of Equatorial Guinea"] = {abbrev = "", color = "#F2BD2E", shortname = "",},
["Popular Alliance (Peru)"] = {abbrev = "", color = "#FF0000", shortname = "Popular Alliance",},
["Popular Alliance (San Marino, historical)"] = {abbrev = "AP", color = "#1E90FF", shortname = "",},
["Popular Alliance (San Marino)"] = {abbrev = "AP", color = "#EE7F2D", shortname = "",},
["Popular Alliance (UK)"] = {abbrev = "", color = "#FF4F00", shortname = "Popular Alliance",},
["Popular Alternative of Torrevieja"] = {abbrev = "", color = "#FF7900", shortname = "",},
["Popular Alternative"] = {abbrev = "", color = "#1464BE", shortname = "",},
["Popular Area"] = {abbrev = "", color = "#1464BE", shortname = "",},
["Popular Assembly"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Popular Bloc (Lebanon)"] = {abbrev = "", color = "#99CC33", shortname = "",},
["Popular Christian Movement"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Popular Civic List"] = {abbrev = "", color = "#DF0174", shortname = "Popular Civic",},
["Popular Coalition (Italy)"] = {abbrev = "", color = "#E4601D", shortname = "",},
["Popular Consensus"] = {abbrev = "CP", color = "orange", shortname = "",},
["Popular Command"] = {abbrev = "", color = "#000080", shortname = "",},
["Popular Congress Party (Sudan)"] = {abbrev = "PCP", color = "#00FF66", shortname = "",},
["Popular Congress Party"] = {abbrev = "", color = "#ffffff", shortname = "",},
["Popular Conservative Alliance"] = {abbrev = "", color = "#1c6d32", shortname = "",},
["Popular Democratic Action"] = {abbrev = "PADP", color = "#17073B", shortname = "",},
["Popular Democratic Front (Italy)"] = {abbrev = "", color = "#EE2C21", shortname = "Popular Democratic Front",},
["Popular Democratic Front (Venezuela)"] = {abbrev = "", color = "#2f4f4f", shortname = "",},
["Popular Democratic Movement"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Popular Democratic Party (Puerto Rico)"] = {abbrev = "", color = "#FF3333", shortname = "Popular Democratic",},
["Popular Democratic Unity"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Popular Democrats of Fuenlabrada"] = {abbrev = "", color = "#397D34", shortname = "",},
["Popular Democrats"] = {abbrev = "", color = "#BCD4E6", shortname = "",},
["Popular Force"] = {abbrev = "", color = "#FF5300", shortname = "",},
["Popular Freedom Alliance"] = {abbrev = "", color = "#808080", shortname = "",},
["Popular Front (Argentina)"] = {abbrev = "", color = "#C71585", shortname = "Popular Front",},
["Popular Front (Juan Sumulong Wing)"] = {abbrev = "", color = "#FF0066", shortname = "",},
["Popular Front (Philippines)"] = {abbrev = "", color = "#FF0066", shortname = "Popular Front",},
["Popular Front (Tunisia)"] = {abbrev = "", color = "#C90133", shortname = "Popular Front",},
["Popular Front for the Liberation of Palestine"] = {abbrev = "PFLP", color = "#DC143C", shortname = "",},
["Popular Front of Estonia"] = {abbrev = "", color = "#0d4abd", shortname = "Popular Front",},
["Popular Front of Latvia"] = {abbrev = "", color = "#9E3039", shortname = "",},
["Popular Front of Moldova"] = {abbrev = "FPM", color = "#DECA5A", shortname = "",},
["Popular Front of the Canary Islands"] = {abbrev = "", color = "#66B67B", shortname = "",},
["Popular Liberal Action"] = {abbrev = "ALP", color = "#6495ED", shortname = "",},
["Popular Movement (Morocco)"] = {abbrev = "MP", color = "#fcca50", shortname = "",},
["Popular Movement of the Revolution"] = {abbrev = "MPR", color = "#6ABD51", shortname = "",},
["Popular Nasserist Organization"] = {abbrev = "", color = "#007A3D", shortname = "",},
["Popular National Union"] = {abbrev = "ZLN", color = "#5B5B4E", shortname = "",},
["Popular Organization Movement"] = {abbrev = "", color = "#36892D", shortname = "",},
["Popular Orthodox Rally"] = {abbrev = "LAOS", color = "#000080", shortname = "",},
["Popular Party of Albania"] = {abbrev = "", color = "#84BF7F", shortname = "",},
["Popular Political Unit 89"] = {abbrev = "", color = "#D2691E", shortname = "",},
["Popular Renewal"] = {abbrev = "", color = "#049AD7", shortname = "",},
["Popular Republican Movement"] = {abbrev = "MRP", color = "#00CCCC", shortname = "",},
["Popular Republican Union"] = {abbrev = "UPR", color = "#057C85", shortname = "",},
["Popular Revolutionary Alternative"] = {abbrev = "", color = "#E50529", shortname = "",},
["Popular Sada Democratic Party"] = {abbrev = "", color = "#0195DD", shortname = "",},
["Popular Socialist Party (Brazil)"] = {abbrev = "PPS", color = "#F53B34", shortname = "",},
["Popular Socialist Party (Chile)"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Popular Socialist Party (Cuba)"] = {abbrev = "", color = "#FF1100", shortname = "Popular Socialist",},
["Popular Socialist Party (Mexico)"] = {abbrev = "PPS", color = "HotPink", shortname = "",},
["Popular Socialist Party of Mexico"] = {abbrev = "", color = "Red", shortname = "",},
["Popular Socialist Union (Chile)"] = {abbrev = "USOPO", color = "#FF1100", shortname = "",},
["Popular Socialists (Russia)"] = {abbrev = "", color = "#008000", shortname = "Popular Socialists",},
["Popular Solidarity Alliance"] = {abbrev = "", color = "#0299AE", shortname = "",},
["Popular Union of Equatorial Guinea"] = {abbrev = "", color = "Lightblue", shortname = "",},
["Popular Union"] = {abbrev = "", color = "#0070B8", shortname = "",},
["Popular Unions of Bipartisan Social Groups"] = {abbrev = "LEFKO", color = "black", shortname = "",},
["Popular Unity (Argentina)"] = {abbrev = "UP", color = "#00478F", shortname = "Popular Unity",},
["Popular Unity (Brazil)"] = {abbrev = "", color = "#000000", shortname = "",},
["Popular Unity (Chile)"] = {abbrev = "", color = "#DC0C0C", shortname = "Popular Unity",},
["Popular Unity (Ecuador)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Popular Unity (Greece)"] = {abbrev = "LAE", color = "#B01740", shortname = "",},
["Popular Unity (Uruguay)"] = {abbrev = "", color = "#000000", shortname = "Popular Unity",},
["Popular Unity Candidacy–For Rupture"] = {abbrev = "", color = "#FFED00", shortname = "",},
["Popular Unity Candidacy"] = {abbrev = "CUP", color = "#FFED00", shortname = "",},
["Popular Unity Council of Gijón"] = {abbrev = "", color = "#FC0203", shortname = "",},
["Popular Unity for Socialism Candidacy"] = {abbrev = "", color = "#BB0F0F", shortname = "",},
["Popular Unity in Common"] = {abbrev = "", color = "#5A5A5C", shortname = "",},
["Popular Unity Movement"] = {abbrev = "", color = "PaleGoldenrod", shortname = "",},
["Popular Unity Party (Tunisia)"] = {abbrev = "PUP", color = "PaleGoldenrod", shortname = "",},
["Popular Will"] = {abbrev = "", color = "Orange", shortname = "",},
["Populars for Italy"] = {abbrev = "", color = "#0D4AA5", shortname = "",},
["Populars in Freedom Party"] = {abbrev = "PPL", color = "#212E86", shortname = "",},
["Populist Party (Maryland)"] = {abbrev = "", color = "#000000", shortname = "Populist",},
["Populist Party (Turkey)"] = {abbrev = "HP", color = "#D40000", shortname = "",},
["Populist Party (UK)"] = {abbrev = "", color = "#808000", shortname = "Populist",},
["Populist Party (US, 1984)"] = {abbrev = "", color = "#FF7575", shortname = "Populist",},
["Populist Party (US)"] = {abbrev = "", color = "#ACE1AF", shortname = "Populist",},
["Por Andalucía"] = {abbrev = "PorA", color = "#009B7D", shortname = "",},
["Por Cádiz Sí Se Puede"] = {abbrev = "", color = "#6B1F5F", shortname = "",},
["Por Chiclana Sí Se Puede"] = {abbrev = "", color = "#6B215E", shortname = "",},
["Por Sanlúcar Sí Se Puede"] = {abbrev = "", color = "#A01E74", shortname = "",},
["Port of Spain People's Movement"] = {abbrev = "PPM", color = "#3acccf", shortname = "",},
["Portenian Initiative"] = {abbrev = "", color = "#FC9658", shortname = "",},
["Portishead Independents"] = {abbrev = "", color = "#000000", shortname = "",},
["Portugal Ahead"] = {abbrev = "", color = "#00AAAA", shortname = "",},
["Portugaluj@ Despierta"] = {abbrev = "", color = "#EECE47", shortname = "",},
["Portuguese Communist Party"] = {abbrev = "", color = "#DA251E", shortname = "",},
["Portuguese Republican Party"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Portuguese Socialist Party"] = {abbrev = "PSP", color = "#FF0000", shortname = "Socialist",},
["Portuguese Workers' Communist Party"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Positive Money New Zealand"] = {abbrev = "", color = "#86a83e", shortname = "",},
["Positive Montenegro"] = {abbrev = "PCG", color = "#F39C12", shortname = "",},
["Positive Slovenia"] = {abbrev = "PS", color = "#93C572", shortname = "",},
["Possibilist Democratic Party"] = {abbrev = "", color = "#932293", shortname = "Possibilist",},
["Possible (political party)"] = {abbrev = "", color = "#EA2D5A", shortname = "Possible",},
["Possible Peru Electoral Alliance"] = {abbrev = "", color = "#80FF00", shortname = "",},
["Possible Peru"] = {abbrev = "", color = "#80FF00", shortname = "",},
["Pour La Réunion"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Power Belongs to the People"] = {abbrev = "VKK", color = "#214627", shortname = "",},
["Power for Democracy"] = {abbrev = "PfD", color = "#627da5", shortname = "",},
["Power of Africans Unity"] = {abbrev = "", color = "#FFFF30", shortname = "",},
["Power of People"] = {abbrev = "", color = "Orange", shortname = "",},
["Power to the People (Italy)"] = {abbrev = "", color = "#A0142E", shortname = "Power to the People",},
["Power to the People (Russia)"] = {abbrev = "VN", color = "#FF9C00", shortname = "",},
["PP+Cs"] = {abbrev = "", color = "#7198B6", shortname = "",},
["PPP-S"] = {abbrev = "", color = "#b30029", shortname = "",},
["PPPP"] = {abbrev = "", color = "#000", shortname = "",},
["Prabuddha Republican Party"] = {abbrev = "", color = "#996600", shortname = "",},
["Prachachart Party"] = {abbrev = "", color = "#ba810d", shortname = "",},
["Pracharaj Party"] = {abbrev = "", color = "#000000", shortname = "Pracharaj",},
["Pracheachon"] = {abbrev = "", color = "red", shortname = "",},
["Pragatisheel Samajwadi Party (Lohiya)"] = {abbrev = "PSP(L)", color = "#FFD300", shortname = "",},
["Prahar Janshakti Party"] = {abbrev = "PJP", color = "#F7819F", shortname = "",},
["Praja Rajyam Party"] = {abbrev = "PRP", color = "#66FF00", shortname = "",},
["Praja Socialist Party"] = {abbrev = "PSP", color = "#F15270", shortname = "",},
["Pravasi Nivasi Party"] = {abbrev = "PNP", color = "#800080", shortname = "",},
["PRD–CiU–CG"] = {abbrev = "", color = "#333176", shortname = "",},
["President's Rule"] = {abbrev = "", color = "#808080", shortname = "",},
["Presiding Officer of the National Assembly for Wales"] = {abbrev = "", color = "#000000", shortname = "",},
["Presiding Officer of the Northern Ireland Assembly"] = {abbrev = "", color = "#000000", shortname = "",},
["Presiding Officer of the Scottish Parliament"] = {abbrev = "", color = "#000000", shortname = "Presiding Officer",},
["Pridnestrovie Communist Party"] = {abbrev = "PCP", color = "#CD0001", shortname = "",},
["Primàries Catalunya"] = {abbrev = "", color = "#EA5654", shortname = "",},
["Prime Minister of South Korea"] = {abbrev = "", color = "#003478", shortname = "",},
["Primeira Linha"] = {abbrev = "", color = "#ED1D25", shortname = "",},
["Primero Alcalá"] = {abbrev = "", color = "#EFFF00", shortname = "",},
["Priorité Monaco"] = {abbrev = "", color = "#8080C0", shortname = "",},
["Přísaha"] = {abbrev = "", color = "#0033FF", shortname = "",},
["Privy Council"] = {abbrev = "", color = "#AF8588", shortname = "",},
["Pro Bruxsel"] = {abbrev = "", color = "#008081", shortname = "",},
["Pro German-speaking Community"] = {abbrev = "", color = "#318CE7", shortname = "",},
["Pro Germany Citizens' Movement"] = {abbrev = "", color = "grey", shortname = "",},
["Pro Moldova"] = {abbrev = "", color = "#1C90BA", shortname = "",},
["Pro NRW"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Pro Patria Union"] = {abbrev = "", color = "#014F9A", shortname = "",},
["PRO Romania Social Liberal"] = {abbrev = "", color = "#1572BA", shortname = "",},
["PRO Romania"] = {abbrev = "", color = "#1572BA", shortname = "",},
["Pro-Administration Party (US)"] = {abbrev = "", color = "#00cc22", shortname = "Pro-Administration",},
["Pro-Assembly Unionist"] = {abbrev = "", color = "#FFA07A", shortname = "",},
["Pro-Beijing camp"] = {abbrev = "", color = "", shortname = "Pro-Beijing",},
["Pro-democracy camp"] = {abbrev = "", color = "", shortname = "Pro-democracy",},
["Pro-Democracy: Libertas.eu"] = {abbrev = "", color = "#B0E0E6", shortname = "Libertas",},
["Pro-Euro Conservative Party"] = {abbrev = "", color = "#31649D", shortname = "Pro-Euro Conservative",},
["Pro-Independence Association"] = {abbrev = "", color = "#417E5C", shortname = "",},
["Pro-Park Alliance"] = {abbrev = "", color = "#00008B", shortname = "Pro-Park",},
["Pro-Park New Party"] = {abbrev = "", color = "#E20010", shortname = "",},
["Pro-Torre del Mar Municipality Independent Group"] = {abbrev = "", color = "#F4CC35", shortname = "",},
["ProDem22"] = {abbrev = "", color = "#B40004", shortname = "",},
["ProDG (Belgium)"] = {abbrev = "", color = "#00BCE4", shortname = "ProDG",},
["Professional Commons"] = {abbrev = "", color = "#04569C", shortname = "Prof Commons",},
["Professional Forum"] = {abbrev = "", color = "#7f7f7f", shortname = "",},
["Professional Power"] = {abbrev = "PP", color = "#0E8AC8", shortname = "",},
["Professionals Guild"] = {abbrev = "", color = "#10396E", shortname = "",},
["Progresa Burgos"] = {abbrev = "", color = "#588948", shortname = "",},
["Progresista Party"] = {abbrev = "", color = "#CC33FF", shortname = "Progresista",},
["Progresistas"] = {abbrev = "", color = "#EE4D8B", shortname = "",},
["Progress (Faroe Islands)"] = {abbrev = "", color = "#E0750D", shortname = "Progress",},
["Progress and Development"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Progress and Freedom"] = {abbrev = "", color = "#F1592A", shortname = "",},
["Progress and Future of Ceuta"] = {abbrev = "", color = "#EA1585", shortname = "",},
["Progress and Work"] = {abbrev = "", color = "#AF0000", shortname = "",},
["Progress of the Fatherland Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Progress Party (Denmark)"] = {abbrev = "", color = "#FFFF00", shortname = "Progress",},
["Progress Party (Ghana)"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Progress Party (Iraq)"] = {abbrev = "", color = "#F6851D", shortname = "Progress Party",},
["Progress Party (Jersey)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Progress Party (Norway)"] = {abbrev = "", color = "#024c93", shortname = "Progress",},
["Progress Party (Thailand)"] = {abbrev = "", color = "#4040ff", shortname = "",},
["Progress Party of Castile and León Cities"] = {abbrev = "", color = "#C5923A", shortname = "",},
["Progress Party of Equatorial Guinea"] = {abbrev = "", color = "#B3CA95", shortname = "",},
["Progress Promotion Union"] = {abbrev = "UPP", color = "#FF0000", shortname = "",},
["Progress Singapore Party"] = {abbrev = "PSP", color = "#FF8889", shortname = "",},
["Progress Socialist Coalition"] = {abbrev = "", color = "#BFFF00", shortname = "",},
["Progress with Dignity Team"] = {abbrev = "", color = "#4BACC6", shortname = "",},
["Progress, Union and Freedom"] = {abbrev = "", color = "#6A3441", shortname = "",},
["Progressistas"] = {abbrev = "PP", color = "#7DC9FF", shortname = "",},
["Progressive (South Korea)"] = {abbrev = "", color = "#C40233", shortname = "",},
["Progressive Action Party"] = {abbrev = "", color = "#73C2FB", shortname = "Progressive Action",},
["Progressive Advance"] = {abbrev = "", color = "#FFA500", shortname = "Progressive Advance",},
["Progressive Alliance of Socialists and Democrats"] = {abbrev = "S&D", color = "#F0001C", shortname = "",},
["Progressive Alternative of Cullera"] = {abbrev = "", color = "#569E5E", shortname = "",},
["Progressive Area"] = {abbrev = "", color = "#F87431", shortname = "",},
["Progressive Camp"] = {abbrev = "", color = "#F87431", shortname = "",},
["Progressive Citizens' Party"] = {abbrev = "FBP", color = "#1E345D", shortname = "",},
["Progressive Coalition (Vermont)"] = {abbrev = "", color = "#c64c4b", shortname = "Progressive Coalition",},
["Progressive Conservative Party (Romania)"] = {abbrev = "PCP", color = "#F5F5DC", shortname = "",},
["Progressive Constitutionalist Party (Mexico)"] = {abbrev = "", color = "#A020F0", shortname = "",},
["Progressive Convergence"] = {abbrev = "", color = "#E70080", shortname = "",},
["Progressive Dane"] = {abbrev = "", color = "#d16fac", shortname = "",},
["Progressive Democratic Party (Bangladesh)"] = {abbrev = "PDP", color = "#A7452E", shortname = "",},
["Progressive Democratic Party (Gibraltar)"] = {abbrev = "", color = "#0000CC", shortname = "Progressive Democratic",},
["Progressive Democratic Party (Guadeloupe)"] = {abbrev = "", color = "#CC3366", shortname = "Progressive Democratic Party",},
["Progressive Democratic Party (Paraguay)"] = {abbrev = "PDP", color = "#7FBA27", shortname = "",},
["Progressive Democratic Party (South Carolina)"] = {abbrev = "", color = "#3333FF", shortname = "Progressive Democratic",},
["Progressive Democratic Party (Spain)"] = {abbrev = "", color = "#217844", shortname = "",},
["Progressive Democratic Party of Afghanistan"] = {abbrev = "", color = "#E23D28", shortname = "",},
["Progressive Democratic Party of the North"] = {abbrev = "", color = "#61BFE5", shortname = "",},
["Progressive Democratic Party"] = {abbrev = "", color = "#6ABFE6", shortname = "",},
["Progressive Democratic Patriots"] = {abbrev = "PDP", color = "#32CD32", shortname = "",},
["Progressive Democrats"] = {abbrev = "PD", color = "#3333CC", shortname = "Progressive Democrats",},
["Progressive Empowerment Party"] = {abbrev = "PEP", color = "#FF5500", shortname = "",},
["Progressive Federal Party"] = {abbrev = "PFP", color = "#005BA6", shortname = "",},
["Progressive Federation"] = {abbrev = "", color = "#007C3A", shortname = "",},
["Progressive Front"] = {abbrev = "", color = "#00693E", shortname = "",},
["Progressive Green Party (New Zealand)"] = {abbrev = "", color = "#339999", shortname = "Progressive Green",},
["Progressive Group of Culleredo"] = {abbrev = "", color = "#EAC102", shortname = "",},
["Progressive Group of Sangüesa"] = {abbrev = "", color = "#D908B9", shortname = "",},
["Progressive Hong Kong Society"] = {abbrev = "PHKS", color = "#8B0000", shortname = "",},
["Progressive Independent Party"] = {abbrev = "PIP", color = "blue", shortname = "",},
["Progressive Independent"] = {abbrev = "", color = "#5FD170", shortname = "",},
["Progressive Initiative of Ribeira"] = {abbrev = "", color = "#7585A2", shortname = "",},
["Progressive Labour Movement"] = {abbrev = "PLM", color = "#FF7F00", shortname = "",},
["Progressive Labour Party (Bermuda)"] = {abbrev = "PLP", color = "#048c44", shortname = "",},
["Progressive Labour Party (Saint Lucia)"] = {abbrev = "", color = "#FDBB30", shortname = "",},
["Progressive Labour Party (Sint Eustatius)"] = {abbrev = "PLP", color = "#FF6600", shortname = "",},
["Progressive Liberal Party (Bulgaria)"] = {abbrev = "", color = "teal", shortname = "",},
["Progressive Liberal Party (Chile)"] = {abbrev = "", color = "#00FFFF", shortname = "",},
["Progressive Liberal Party (Guatemala)"] = {abbrev = "", color = "#042EC6", shortname = "",},
["Progressive Liberal Party"] = {abbrev = "PLP", color = "#FFD700", shortname = "",},
["Progressive List for Peace"] = {abbrev = "PLFP", color = "#9CB071", shortname = "",},
["Progressive Movement (Curaçao)"] = {abbrev = "", color = "#DE2A73", shortname = "",},
["PROMDI"] = {abbrev = "PROMDI", color = "#000040", shortname = "",},
["Progressive National Party (Suriname)"] = {abbrev = "PNP", color = "#FFC303", shortname = "",},
["Progressive National Party (Turks and Caicos Islands)"] = {abbrev = "PNP", color = "#FFDD02", shortname = "",},
["Progressive Party (1901)"] = {abbrev = "", color = "#9966CC", shortname = "Progressive",},
["Progressive Party (1920)"] = {abbrev = "", color = "#7BA05B", shortname = "Progressive",},
["Progressive Party (Brazil, 1993)"] = {abbrev = "", color = "blue", shortname = "",},
["Progressive Party (Brazil)"] = {abbrev = "PP", color = "#1F3389", shortname = "",},
["Progressive Party (Cape Colony)"] = {abbrev = "", color = "#9ACD32", shortname = "",},
["Progressive Party (Chile)"] = {abbrev = "", color = "#FF1493", shortname = "Progressive",},
["Progressive Party (Greece)"] = {abbrev = "", color = "saddlebrown", shortname = "Progressive",},
["Progressive Party (Greece, Kafantaris)"] = {abbrev = "", color = "#90EE90", shortname = "Progressive",},
["Progressive Party (Iceland)"] = {abbrev = "", color = "#87FF91", shortname = "Progressive",},
["Progressive Party (Israel)"] = {abbrev = "", color = "#FFC800", shortname = "Progressive Party",},
["Progressive Party (Japan, 1987)"] = {abbrev = "", color = "#E5FF00", shortname = "",},
["Progressive Party (London)"] = {abbrev = "", color = "#ffd700", shortname = "Progressive",},
["Progressive Party (Oregon)"] = {abbrev = "", color = "#5FD170", shortname = "Progressive",},
["Progressive Party (Philippines)"] = {abbrev = "PPP", color = "#4F69C6", shortname = "Progressive",},
["Progressive Party (Portugal)"] = {abbrev = "", color = "#FF3333", shortname = "",},
["Progressive Party (Russia)"] = {abbrev = "", color = "#00008B", shortname = "Progressists",},
["Progressive Party (Singapore)"] = {abbrev = "PP", color = "#7789EF", shortname = "",},
["Progressive Party (South Korea, 2017)"] = {abbrev = "", color = "#d6001c", shortname = "Progressive",},
["Progressive Party (Spain)"] = {abbrev = "", color = "#FF8800", shortname = "Progressive Party",},
["Progressive Party (Trinidad and Tobago)"] = {abbrev = "", color = "#00529F", shortname = "Progressive",},
["Progressive Party (United States, 1912)"] = {abbrev = "", color = "#B63434", shortname = "Progressive",},
["Progressive Party (United States, 1924–34)"] = {abbrev = "", color = "#5FD170", shortname = "Progressive",},
["Progressive Party (United States, 1948)"] = {abbrev = "", color = "#5FD170", shortname = "Progressive",},
["Progressive Party (US)"] = {abbrev = "", color = "#5FD170", shortname = "Progressive",},
["Progressive Party (Vermont)"] = {abbrev = "", color = "#c64c4b", shortname = "Progressive",},
["Progressive Party of Aotearoa New Zealand"] = {abbrev = "", color = "#822472", shortname = "",},
["Progressive Party of Ecuador"] = {abbrev = "", color = "#ADD8E6", shortname = "Progressive",},
["Progressive Party of Maldives"] = {abbrev = "PPM", color = "#EC008C", shortname = "",},
["Progressive Party of the Cook Islands"] = {abbrev = "", color = "#3fe0d0", shortname = "Progressive",},
["Progressive Party of Washington State"] = {abbrev = "", color = "#EE3A8C", shortname = "Progressive",},
["Progressive Party of Working People"] = {abbrev = "AKEL", color = "#B31B1B", shortname = "",},
["Progressive People's Party (Germany)"] = {abbrev = "FVP", color = "#FFD800", shortname = "",},
["Progressive People's Party (Ghana)"] = {abbrev = "PPP", color = "#E62020", shortname = "",},
["Progressive Peoples Alliance"] = {abbrev = "PPA", color = "#007FFF", shortname = "",},
["Progressive Platform of the Gironinan Comarques"] = {abbrev = "", color = "#AF41AA", shortname = "",},
["Progressive Reform Party (Suriname)"] = {abbrev = "VHP", color = "#FF6500", shortname = "",},
["Progressive Republican Party (Brazil)"] = {abbrev = "PRP", color = "#7FE3D6", shortname = "",},
["Progressive Republican Party (Spain)"] = {abbrev = "", color = "#B72894", shortname = "Progressive Republican",},
["Progressive Republican Party (Turkey)"] = {abbrev = "", color = "#F0001C", shortname = "",},
["Progressive Republican Right"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Progressive Republicans (France)"] = {abbrev = "", color = "#6495ED", shortname = "",},
["Progressive Slovakia (2021)"] = {abbrev = "", color = "#00bdff", shortname = "",},
["Progressive Slovakia"] = {abbrev = "PS", color = "#00bdff", shortname = "",},
["Progressive Social Networks"] = {abbrev = "RSP", color = "#C62F38", shortname = "",},
["Progressive Social Work"] = {abbrev = "", color = "#47B055", shortname = "",},
["Progressive Socialist Party of Ukraine"] = {abbrev = "PSPU", color = "#EF1635", shortname = "",},
["Progressive Socialist Party"] = {abbrev = "PSP", color = "#CC0000", shortname = "",},
["Progressive Surinamese People's Party"] = {abbrev = "PSV", color = "black", shortname = "",},
["Progressive Union (Benin)"] = {abbrev = "UP", color = "", shortname = "",},
["Progressive Union of Menorca"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Progressive Unionist Party"] = {abbrev = "PUP", color = "#2B45A2", shortname = "",},
["Progressive Valdostan Union (2013)"] = {abbrev = "", color = "#F07636", shortname = "",},
["Progressive Workers' and Farmers' Union"] = {abbrev = "PALU", color = "#E40D15", shortname = "",},
["Progressive, Civic and Social Front"] = {abbrev = "FPCyS", color = "#FFA500", shortname = "",},
["Progressives (Scotland)"] = {abbrev = "", color = "#5555FF", shortname = "Progressives",},
["Progressives for the Balearic Islands"] = {abbrev = "", color = "#FF9933", shortname = "",},
["Progressives of Cambre"] = {abbrev = "", color = "#770077", shortname = "",},
["Prohibition Party"] = {abbrev = "", color = "#FF00FF", shortname = "Prohibition",},
["Project Dignity"] = {abbrev = "", color = "#00ADC6", shortname = "",},
["Project Republic of Sardinia"] = {abbrev = "", color = "#479C54", shortname = "",},
["Project Venezuela"] = {abbrev = "PROVE", color = "#FFFF00", shortname = "",},
["Proletarian Democracy"] = {abbrev = "", color = "#A1292F", shortname = "",},
["Proletarian Party of America"] = {abbrev = "", color = "#CD3700", shortname = "Proletarian",},
["Proletarian Unity Party"] = {abbrev = "", color = "#922727", shortname = "",},
["Proletariat Political Institute"] = {abbrev = "PPI", color = "#FFE000", shortname = "",},
["ProLife Alliance"] = {abbrev = "", color = "#333333", shortname = "",},
["Propel (political party)"] = {abbrev = "", color = "#0b8e36", shortname = "Propel",},
["Proponemos por las Minorías"] = {abbrev = "", color = "#96CF4D", shortname = "",},
["Proposition (party)"] = {abbrev = "", color = "#004F92", shortname = "",},
["Proposta per Eivissa"] = {abbrev = "", color = "#AA81B9", shortname = "",},
["Proposta per les Illes (2021)"] = {abbrev = "El Pi", color = "#0BD5AE", shortname = "",},
["Proposta per les Illes"] = {abbrev = "El Pi", color = "#8438AD", shortname = "",},
["Proriv (Transnistria)"] = {abbrev = "Proriv", color = "#FFCC00", shortname = "",},
["Prosperity Party"] = {abbrev = "", color = "#F9D416", shortname = "",},
["Prosperous Armenia"] = {abbrev = "PAP", color = "#183883", shortname = "",},
["Prosperous Justice Party"] = {abbrev = "PKS", color = "#ff5001", shortname = "",},
["Prosperous Peace Party"] = {abbrev = "", color = "#893BFF", shortname = "",},
["Protect the Maneaba"] = {abbrev = "MTM", color = "", shortname = "Protectionist",},
["Protectionist Party"] = {abbrev = "", color = "#3198FF", shortname = "Protectionist",},
["Protectora Political Force"] = {abbrev = "", color = "#1FAA89", shortname = "",},
["Protestant Action Society"] = {abbrev = "", color = "#000000", shortname = "Protestant Action",},
["Protestant Unionist Party"] = {abbrev = "", color = "#D46A4C", shortname = "Protestant Unionist",},
["Proud and Respected People"] = {abbrev = "", color = "#0000A0", shortname = "",},
["Proutist Bloc India"] = {abbrev = "", color = "#E3CEF6", shortname = "Proutist Bloc",},
["Proutist Sarva Samaj Samiti"] = {abbrev = "PSSS", color = "#00FFFF", shortname = "",},
["Proverist Party"] = {abbrev = "", color = "#391E2F", shortname = "",},
["Provincial Christian-Socialist Party"] = {abbrev = "OKSZP", color = "#7BA05B", shortname = "",},
["Provincial Defence–White Flag"] = {abbrev = "", color = "#A0A0A0", shortname = "",},
["Provisional Central Committee, Communist Party of India (Marxist–Leninist)"] = {abbrev = "CPI(M-L)", color = "Red", shortname = "",},
["Provisional Sinn Féin"] = {abbrev = "", color = "#008800", shortname = "Sinn Féin (Provisional)",},
["Proyecto Sur"] = {abbrev = "", color = "#41A400", shortname = "",},
["PS98"] = {abbrev = "", color = "green", shortname = "",},
["PSOE–Eivissa pel Canvi"] = {abbrev = "", color = "#FF6633", shortname = "",},
["Psychedelic Future Party"] = {abbrev = "", color = "#FF01FF", shortname = "Psychedelic Future",},
["Public Affairs (political party)"] = {abbrev = "VV", color = "#0099DD", shortname = "",},
["Public Against Violence"] = {abbrev = "VPN", color = "#B719A8", shortname = "",},
["Public Defense Organization"] = {abbrev = "", color = "#81D742", shortname = "",},
["Public Ownership Party (US)"] = {abbrev = "", color = "#ffdcc6", shortname = "Public Ownership",},
["Public Surgeons' United"] = {abbrev = "", color = "#51B0E1", shortname = "",},
["Public Trust"] = {abbrev = "", color = "#2E9A60", shortname = "",},
["Publican Party"] = {abbrev = "", color = "#008080", shortname = "",},
["Puea Pandin Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Puerto Ricans for Puerto Rico Party"] = {abbrev = "", color = "#FFA500", shortname = "Puerto Ricans for Puerto Rico",},
["Puigcerverists"] = {abbrev = "", color = "#D6ECBD", shortname = "",},
["Punjab Democratic Party"] = {abbrev = "PDP", color = "Black", shortname = "",},
["Punjab Ekta Party"] = {abbrev = "PEP", color = "Yellow", shortname = "",},
["Punjab Lok Congress"] = {abbrev = "PLC", color = "#0C9078", shortname = "",},
["Punjabi Ekta Party"] = {abbrev = "", color = "#FFFF00", shortname = "Punjab Ekta Party",},
["Puratchi Bharatham"] = {abbrev = "PB", color = "#008080", shortname = "",},
["Purified National Party"] = {abbrev = "", color = "#ff9933", shortname = "Purified National",},
["Purple Party"] = {abbrev = "", color = "#7026AB", shortname = "",},
["Pursharathi Panchayat"] = {abbrev = "", color = "brown", shortname = "",},
["Pusyon Bisaya"] = {abbrev = "", color = "#000000", shortname = "",},
["Puthiya Needhi Katchi"] = {abbrev = "PNK", color = "black", shortname = "",},
["Puthiya Tamilagam"] = {abbrev = "PT", color = "#cf0922", shortname = "",},
["Puthiya Tamilakam"] = {abbrev = "PT", color = "#708238", shortname = "",},
["Puthiya Tamizhagam"] = {abbrev = "PT", color = "black", shortname = "",},
["Putting Hackney First"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Putting Hartlepool First"] = {abbrev = "", color = "#017F7E", shortname = "",},
["Putting Llanelli First"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Puyalón de Cuchas"] = {abbrev = "", color = "#FF003C", shortname = "",},
["Pwersa ng Masa"] = {abbrev = "", color = "#ffa500", shortname = "",},
["Pwersa ng Masang Pilipino"] = {abbrev = "PMP", color = "#ffa500", shortname = "",},
["Pyramid Party of India"] = {abbrev = "", color = "#333399", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
t7grse2bo7rpb51y4z5v7c90vufw1k9
Module:Political party/R
828
68669590
1096421518
1096378736
2022-07-04T10:54:19Z
Vacant0
38123398
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Radical and Radical-Socialist Party"] = "Radical Party (France)",
["Radical Democracy Party (Chile)"] = "Radical Democracy (Chile)",
["Radical Party (Italy, 1877)"] = "Italian Radical Party",
["Radical Party (UK)"] = "Radicals (UK)",
["Radical Party (Ukraine)"] = "Radical Party of Oleh Liashko",
["Radical Party (Chile)"] = "Radical Party of Chile",
["Radical Party of Oleh Lyashko"] = "Radical Party of Oleh Liashko",
["Rainbow Group (1984-1989)"] = "Rainbow Group (1984–1989)",
["Rainbow Group"] = "Greens–European Free Alliance",
["Rally Wallonia France"] = "Rassemblement Wallonie France",
["Rassemblement bleu Marine"] = "National Rally",
["Rastakhiz Party"] = "Resurgence Party",
["Ratepayers Associations"] = "Ratepayers Association",
["Razem"] = "Left Together",
["Readjuster Party (United States)"] = "Readjuster Party",
["Red-Green Alliance (Denmark)"] = "Red–Green Alliance (Denmark)",
["Referendum Party (UK)"] = "Referendum Party",
["Reform and Development Party (Egypt)"] = "Reform and Development Misruna Party",
["Reform Party (Iceland, 2016)"] = "Reform Party (Iceland)",
["Reform Party (United States)"] = "Reform Party (US)",
["Reform Party of New York State"] = "Reform Party (New York State)",
["Reform Party of the United States of America"] = "Reform Party (US)",
["Reform Party"] = "Reform Party (Southern Rhodesia)",
["Reform"] = "Estonian Reform Party",
["Reformed Political Party - Reformatory Political Federation - Reformed Political League"] = "Reformed Political Party – Reformatory Political Federation – Reformed Political League",
["Regionalist Aragonese Party"] = "Aragonese Party",
["Régions et Peuples Solidaires"] = "Regionalist",
["Renaissance Party"] = "Ennahda Movement",
["Renew Britain"] = "Renew Party",
["Renewal (Transnistria)"] = "Obnovlenie",
["Renua Ireland"] = "Renua",
["REPUBLIC (Slovakia)"] = "Republic (Slovakia)",
["Republic Arise"] = "Debout la République",
["Republic Party"] = "Party of the Republic",
["Republican Coalition (Spain, 1996)"] = "Alliance for the Republic (Spain)",
["Republican Left of Catalonia-Sovereigntists"] = "Republican Left of Catalonia",
["Republican Left of Catalonia–Catalonia Yes"] = "Republican Left of Catalonia",
["Republican Left of Catalonia–Sovereigntists"] = "Republican Left of Catalonia",
["Republican Left of the Valencian Country"] = "Republican Left of Catalonia",
["Republican Moderate Party of Alaska"] = "Republican Moderate Party (Alaska)",
["Republican Party (Chile, 2019)"] = "Republican Party (Chile)",
["Republican Party (Faroe Islands)"] = "Republic (Faroe Islands)",
["Republican Party (Poland)"] = "The Republicans (Poland)",
["Republican Party (United States)"] = "Republican Party (US)",
["Republican Party (Alabama)"] = "Republican Party (US)",
["Republican Party (Alaska)"] = "Republican Party (US)",
["Republican Party (Arizona)"] = "Republican Party (US)",
["Republican Party (Arkansas)"] = "Republican Party (US)",
["Republican Party (California)"] = "Republican Party (US)",
["Republican Party (Colorado)"] = "Republican Party (US)",
["Republican Party (Connecticut)"] = "Republican Party (US)",
["Republican Party (Delaware)"] = "Republican Party (US)",
["Republican Party (Georgia, US)"] = "Republican Party (US)",
["Republican Party (Guam)"] = "Republican Party (US)",
["Republican Party (Hawaii)"] = "Republican Party (US)",
["Republican Party (Idaho)"] = "Republican Party (US)",
["Republican Party (Illinois)"] = "Republican Party (US)",
["Republican Party (Iowa)"] = "Republican Party (US)",
["Republican Party (Maryland)"] = "Republican Party (US)",
["Republican Party (Massachusetts)"] = "Republican Party (US)",
["Republican Party (Michigan)"] = "Republican Party (US)",
["Republican Party (Minnesota)"] = "Republican Party (US)",
["Republican Party (Missouri)"] = "Republican Party (US)",
["Republican Party (Nevada)"] = "Republican Party (US)",
["Republican Party (New Mexico)"] = "Republican Party (US)",
["Republican Party (New York)"] = "Republican Party (US)",
["Republican Party (North Dakota)"] = "Republican Party (US)",
["Republican Party (Northern Mariana Islands)"] = "Republican Party (US)",
["Republican Party (Pennsylvania)"] = "Republican Party (US)",
["Republican Party (Rhode Island)"] = "Republican Party (US)",
["Republican Party (Utah)"] = "Republican Party (US)",
["Republican Party (Vermont)"] = "Republican Party (US)",
["Republican Party (Virginia)"] = "Republican Party (US)",
["Republican Party (Washington State)"] = "Republican Party (US)",
["Republican Party (Washington)"] = "Republican Party (US)",
["Republican Party (West Virginia)"] = "Republican Party (US)",
["Republican Party of Alaska"] = "Republican Party (US)",
["Republican Party of Arkansas"] = "Republican Party (US)",
["Republican Party of India (A)"] = "Republican Party of India (Athawale)",
["Republican Party of India (Athvale)"] = "Republican Party of India (Athawale)",
["Republican Party of Iowa"] = "Republican Party (US)",
["Republican Party of Minnesota"] = "Republican Party (US)",
["Republican Party of New Mexico"] = "Republican Party (US)",
["Republican Party of Florida"] = "Republican Party (US)",
["Republican Party of Georgia"] = "Republican Party (US)",
["Republican Party of Kentucky"] = "Republican Party (US)",
["Republican Party of Russia – People's Freedom Party"] = "People's Freedom Party",
["Republican Party of São Paulo"] = "Paulista Republican Party",
["Republican Party of Texas"] = "Republican Party (US)",
["Republican Party of Wisconsin"] = "Republican Party (US)",
["Republican People's Party (Turkey)"] = "Republican People's Party",
["Republican Pole"] = "Citizen and Republican Movement",
["Republican Popular Unity"] = "Communist Party of Spain (Marxist–Leninist) (historical)",
["Republican Union (Spain, 1893)"] = "Republican Fusion",
["Republican, Radical and Radical-Socialist Party (historical)"] = "Radical Party (France)",
["Republican, Radical and Radical-Socialist Party"] = "Radical Party (France)",
["Reconquête (political party)"] = "Reconquête",
["Respect - The Unity Coalition"] = "Respect Party",
["Respect – The Unity Coalition"] = "Respect Party",
["RESPECT The Unity Coalition"] = "Respect Party",
["Respublika Party of Kyrgyzstan"] = "Respublika (political party)",
["Restoration Political Party - New Wind"] = "Ishin Seito Shimpu",
["Reunited National Party"] = "Herenigde Nasionale Party",
["Revolution Continues"] = "The Revolution Continues Alliance",
["Revolutionary Committee of the Kuomintang"] = "Revolutionary Committee of the Chinese Kuomintang",
["Revolutionary Communist Party (Furedi)"] = "Revolutionary Communist Party (UK, 1978)",
["Revolutionary Front for an Independent East Timor"] = "Fretilin",
["Revolutionary Nationalist Movement-Alliance"] = "Revolutionary Nationalist Movement",
["Revolutionary Nationalist Movement–Alliance"] = "Revolutionary Nationalist Movement",
["Revolutionary Socialist Party (Luxembourg)"] = "Revolutionary Communist League (Luxembourg)",
["Revolutionary Workers Party (United States)"] = "Revolutionary Workers Party (US)",
["Rhode Island Democratic Party"] = "Democratic Party (US)",
["Rhode Island Republican Party"] = "Republican Party (US)",
["Right Cause (political party)"] = "Right Cause",
["Rightist Party"] = "Moderate Party",
["Rikken Seiyukai"] = "Rikken Seiyūkai",
["Rikken Minseito"] = "Rikken Minseitō",
["Ring of Independents"] = "Alliance of Independents",
["Riojan Party (1990–2012)"] = "Riojan Party",
["RISE - Scotland's Left Alliance"] = "RISE – Scotland's Left Alliance",
["Rivers State People's Democratic Party"] = "Rivers State Peoples Democratic Party",
["Rodina"] = "Rodina (political party)",
["Romanian National Party (Moldova)"] = "New Historical Option",
["Rule of Law (Armenia)"] = "Orinats Yerkir",
["Runnymede Residents Association"] = "Runnymede Independent Residents Group",
}
local full = {
["Radical Cause"] = {abbrev = "LCR", color = "#1E90FF", shortname = "",},
["Radical Change"] = {abbrev = "", color = "#FB656F", shortname = "",},
["Radical Civic Union"] = {abbrev = "UCR", color = "#E10019", shortname = "",},
["Radical Democracy (Chile)"] = {abbrev = "", color = "#00E2C8", shortname = "",},
["Radical Democratic Party (Bulgaria)"] = {abbrev = "", color = "#1C4482", shortname = "",},
["Radical Democratic Party (Spain)"] = {abbrev = "", color = "#DD6284", shortname = "Radical",},
["Radical Doctrinaire Party"] = {abbrev = "", color = "lightseagreen", shortname = "",},
["Radical League"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Radical Left Front"] = {abbrev = "MERA", color = "indianred", shortname = "",},
["Radical Left Party (Chile)"] = {abbrev = "", color = "yellow", shortname = "",},
["Radical Liberal Party (Luxembourg)"] = {abbrev = "", color = "#F4EE00", shortname = "",},
["Radical Liberal Party (Paraguay)"] = {abbrev = "", color = "#808080", shortname = "Radical Liberal",},
["Radical Movement"] = {abbrev = "MR", color = "#E0B0FF", shortname = "",},
["Radical Party of Chile"] = {abbrev = "", color = "#CD5C5C", shortname = "Radical",},
["Radical Party of Chile (2018)"] = {abbrev = "", color = "#CD5C5C", shortname = "Radical",},
["Radical Party (France)"] = {abbrev = "PRV", color = "#E0B0FF", shortname = "",},
["Radical Party (Italy)"] = {abbrev = "PR", color = "orange", shortname = "Radical Party",},
["Radical Party of Oleh Liashko"] = {abbrev = "RPOL", color = "#D64541", shortname = "",},
["Radical Party of Republika Srpska"] = {abbrev = "", color = "Darkblue", shortname = "RS RS",},
["Radical Party of the Left"] = {abbrev = "PRG", color = "#F0C200", shortname = "",},
["Radical Peasant Party"] = {abbrev = "CSR", color = "#33452D", shortname = "",},
["Radical People's Party (Finland)"] = {abbrev = "", color = "Red", shortname = "",},
["Radical People's Party (Norway)"] = {abbrev = "", color = "#59A421", shortname = "Radical People's",},
["Radical Republican Party"] = {abbrev = "PRR", color = "#A871A8", shortname = "",},
["Radical Socialist Catalan Left"] = {abbrev = "", color = "#AF2A88", shortname = "",},
["Radical Socialist Party (Luxembourg)"] = {abbrev = "", color = "#F3C400", shortname = "",},
["Radical Socialist Republican Party"] = {abbrev = "PRRS", color = "#9A0DBC", shortname = "",},
["Radical Union (Cuba)"] = {abbrev = "", color = "#FA8072", shortname = "",},
["Radicals (UK)"] = {abbrev = "", color = "#FF3333", shortname = "Radical",},
["Rafi (political party)"] = {abbrev = "", color = "#1935D0", shortname = "Rafi",},
["Rafidain List"] = {abbrev = "", color = "#5f21a9", shortname = "",},
["Rah-e-Haq Party"] = {abbrev = "RHP", color = "#A9A9A9", shortname = "",},
["Rahanweyn Resistance Army"] = {abbrev = "RRA", color = "#DC143C", shortname = "",},
["Raijor Dal"] = {abbrev = "RD", color = "#EC2125", shortname = "",},
["Rainbow (Greece)"] = {abbrev = "", color = "#E2725B", shortname = "Rainbow",},
["Rainbow (Netherlands)"] = {abbrev = "", color = "#76EE00", shortname = "Rainbow",},
["Rainbow Group (1984–1989)"] = {abbrev = "RBW", color = "#ADFF2F", shortname = "",},
["Rainbow Group (1989–1994)"] = {abbrev = "RBW", color = "#ADFF2F", shortname = "",},
["Rainbow Party (Zambia)"] = {abbrev = "", color = "#E3001B", shortname = "",},
["Rainham & Wennington Independent Residents Group"] = {abbrev = "", color = "#dddddd", shortname = "",},
["RAIZ"] = {abbrev = "", color = "#2d3e4e", shortname = "",},
["Rajasthan Vikas Party"] = {abbrev = "RJVP", color = "#FF3366", shortname = "",},
["Rajyadhikara Party"] = {abbrev = "", color = "#DDD", shortname = "",},
["Rak Thailand Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Rakhine Nationalities Development Party"] = {abbrev = "RNDP", color = "#EB1D27", shortname = "",},
["Ralliement citoyen pour la patrie"] = {abbrev = "", color = "#7FFFD4", shortname = "",},
["Rally & Issues"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Rally for an Alternative of Harmonious and Integrated Development"] = {abbrev = "", color = "#A31124", shortname = "",},
["Rally for Caledonia"] = {abbrev = "RPC", color = "#1270C2", shortname = "",},
["Rally for Congolese Democracy"] = {abbrev = "", color = "green", shortname = "",},
["Rally for Culture and Democracy"] = {abbrev = "RCD", color = "#264989", shortname = "",},
["Rally for Democracy and Progress (Namibia)"] = {abbrev = "RDP", color = "#166B37", shortname = "",},
["Rally for Democracy and Progress (Niger)"] = {abbrev = "", color = "#FBD127", shortname = "",},
["Rally for Democracy and Social Progress"] = {abbrev = "", color = "#00B100", shortname = "",},
["Rally for Democracy and Unity"] = {abbrev = "RDU", color = "#4D92F1", shortname = "",},
["Rally for France"] = {abbrev = "RPF", color = "#003399", shortname = "",},
["Rally for Hope for Algeria"] = {abbrev = "TAJ", color = "#8C71FA", shortname = "",},
["Rally for Mali"] = {abbrev = "RPM", color = "#FCD116", shortname = "",},
["Rally for the Independence of France"] = {abbrev = "", color = "#003399", shortname = "",},
["Rally for the Monegasque Family"] = {abbrev = "", color = "#AB7141", shortname = "",},
["Rally for the Republic – Republican Party of Czechoslovakia"] = {abbrev = "SPR–RSČ", color = "#3E3E3E", shortname = "",},
["Rally for the Republic"] = {abbrev = "RPR", color = "#0066CC", shortname = "",},
["Rally of Congolese Ecologists – The Greens"] = {abbrev = "", color = "green", shortname = "",},
["Rally of Democratic Forces"] = {abbrev = "RFD", color = "#000000", shortname = "",},
["Rally of Houphouëtists for Democracy and Peace"] = {abbrev = "RHDP", color = "#FF7900", shortname = "",},
["Rally of Progressive National Democrats"] = {abbrev = "RPND", color = "#008000", shortname = "",},
["Rally of Republican Lefts"] = {abbrev = "", color = "#FFBF00", shortname = "",},
["Rally of the Ecologists of Burkina"] = {abbrev = "", color = "green", shortname = "",},
["Rally of the Ecologists of Senegal"] = {abbrev = "", color = "green", shortname = "",},
["Rally of the French People"] = {abbrev = "RPF", color = "#0000C8", shortname = "",},
["Rally of the Guinean People"] = {abbrev = "RPG", color = "#FEF200", shortname = "",},
["Rally of the Republicans"] = {abbrev = "RDR", color = "#FF9933", shortname = "",},
["Rally of the Togolese People"] = {abbrev = "RPT", color = "#037338", shortname = "",},
["Rally Responsibility Success"] = {abbrev = "", color = "red", shortname = "",},
["Ramgavar"] = {abbrev = "", color = "#2554C7", shortname = "Ramgavar",},
["RAŚ"] = {abbrev = "", color = "yellow", shortname = "",},
["Rashtra Bhakt Dal"] = {abbrev = "RBD", color = "#F75808", shortname = "",},
["Rashtravadi Bahujan Hitay Party"] = {abbrev = "RBHP", color = "#81F7F3", shortname = "",},
["Rashtravadi Janata Party"] = {abbrev = "RJP", color = "#cdfecd", shortname = "",},
["Rashtrawadi Labour Party"] = {abbrev = "RALP", color = "#BCA9F5", shortname = "",},
["Rashtrawadi Sena"] = {abbrev = "RWS", color = "blue", shortname = "",},
["Rashtriya Aadiwasi Bahujan Party"] = {abbrev = "RABP", color = "#cc0066", shortname = "",},
["Rashtriya Aikta Manch Party"] = {abbrev = "RAM", color = "#81F781", shortname = "",},
["Rashtriya Ali Sena"] = {abbrev = "RAS", color = "#0F6433", shortname = "",},
["Rashtriya Bahujan Congress Party"] = {abbrev = "RBCP", color = "#afeeee", shortname = "",},
["Rashtriya Bahujan Hitay Party"] = {abbrev = "RBHP", color = "#ffb5da", shortname = "",},
["Rashtriya Hith Congress"] = {abbrev = "RHC", color = "#5FB404", shortname = "",},
["Rashtriya Janadhikar Suraksha Party"] = {abbrev = "RJSP", color = "#ffdacc", shortname = "",},
["Rashtriya Janasachetan Party"] = {abbrev = "RJP", color = "orange", shortname = "",},
["Rashtriya Janata Dal"] = {abbrev = "RJD", color = "#008000", shortname = "",},
["Rashtriya Janmorcha"] = {abbrev = "", color = "#CA7EE4", shortname = "",},
["Rashtriya Kamgar Party"] = {abbrev = "RKAP", color = "#1E76D5", shortname = "",},
["Rashtriya Kranti Party"] = {abbrev = "RTKP", color = "#B47011", shortname = "",},
["Rashtriya Krantikari Janata Party"] = {abbrev = "RKJP", color = "#a8e4bc", shortname = "",},
["Rashtriya Krantikari Samajwadi Party"] = {abbrev = "RKSP", color = "#8A0886", shortname = "",},
["Rashtriya Lok Dal"] = {abbrev = "RLD", color = "#006400", shortname = "",},
["Rashtriya Lok Janshakti Party"] = {abbrev = "RLJP", color = "#0093DD", shortname = "",},
["Rashtriya Lok Samata Party"] = {abbrev = "RLSP", color = "#999966", shortname = "",},
["Rashtriya Lok Samta Party"] = {abbrev = "RLSP", color = "#999966", shortname = "",},
["Rashtriya Loktantrik Party"] = {abbrev = "RLP", color = "#DBE934", shortname = "",},
["Rashtriya Manav Samman Party"] = {abbrev = "RMSP", color = "#BDDC9D", shortname = "",},
["Rashtriya Matrabhoomi Party"] = {abbrev = "RMP", color = "#CA8610", shortname = "",},
["Rashtriya Mazdoor Ekta Party"] = {abbrev = "RMEP", color = "#5E610B", shortname = "",},
["Rashtriya Muslim Mujhahid Party"] = {abbrev = "RMMP", color = "#1F9E1D", shortname = "",},
["Rashtriya Parivartan Dal"] = {abbrev = "RPD", color = "#66FFCC", shortname = "",},
["Rashtriya Raksha Dal"] = {abbrev = "RRD", color = "#F79F81", shortname = "",},
["Rashtriya Samaj Paksha"] = {abbrev = "RSPS", color = "yellow", shortname = "",},
["Rashtriya Samajwadi Party (United)"] = {abbrev = "RSP(U)", color = "#A9F5F2", shortname = "",},
["Rashtriya Samanta Dal"] = {abbrev = "RSMD", color = "#D0FA58", shortname = "",},
["Rashtriya Samata Party (Secular)"] = {abbrev = "RSP(S)", color = "Brown", shortname = "",},
["Rashtriya Sawarn Shakti Party"] = {abbrev = "RSSHP", color = "#647E81", shortname = "",},
["Rashtriya Secular Majlis Party"] = {abbrev = "", color = "Green", shortname = "",},
["Rashtriya Swabhimaan Party"] = {abbrev = "RSBP", color = "#F5D0A9", shortname = "",},
["Rashtriya Swabhiman Party"] = {abbrev = "RSBP", color = "#2c2c8a", shortname = "",},
["Rashtriya Ulama Council"] = {abbrev = "RUC", color = "#ACFA58", shortname = "",},
["Rashtriya Unnatisheel Dal"] = {abbrev = "RUD", color = "#26B062", shortname = "",},
["Rashtriya Vikas Party"] = {abbrev = "RVP", color = "#D0A9F5", shortname = "",},
["Rassemblement Wallonie France"] = {abbrev = "", color = "blue", shortname = "",},
["Rastriya Janamorcha"] = {abbrev = "", color = "firebrick", shortname = "",},
["Rastriya Janamukti Party"] = {abbrev = "", color = "DodgerBlue", shortname = "Janamukti",},
["Rastriya Janata Dal Nepal"] = {abbrev = "", color = "#E6DBCF", shortname = "RJD Nepal",},
["Rastriya Janata Party Nepal"] = {abbrev = "RJPN", color = "#FFb300", shortname = "",},
["Rastriya Janshakti Party"] = {abbrev = "", color = "khaki", shortname = "Janashakti",},
["Rastriya Prajatantra Party (Chand)"] = {abbrev = "", color = "yellow", shortname = "RPP (Chand)",},
["Rastriya Prajatantra Party (Samyukta)"] = {abbrev = "", color = "#4682B4", shortname = "",},
["Rastriya Prajatantra Party Nepal"] = {abbrev = "", color = "orange", shortname = "RPP-Nepal",},
["Rastriya Prajatantra Party"] = {abbrev = "RPP", color = "gold", shortname = "",},
["Ratana"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Ratepayers and Residents Associations"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers & Residents",},
["Ratepayers Association"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers",},
["Ratepayers' and Citizens' Association"] = {abbrev = "", color = "#dddddd", shortname = "Ratepayers & Citizens",},
["Ratz (political party)"] = {abbrev = "", color = "#C80004", shortname = "Ratz",},
["Raving Loony Green Giant Party"] = {abbrev = "", color = "green", shortname = "Raving Loony Green Giant",},
["Rayalaseema Parirakshana Samithi"] = {abbrev = "", color = "red", shortname = "",},
["Rayyithunge Muthagaddim Party"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Raza Unida Party"] = {abbrev = "", color = "#CC853F", shortname = "Raza Unida",},
["Re-open Nominations"] = {abbrev = "RON", color = "Black", shortname = "",},
["Readjuster Party"] = {abbrev = "", color = "#0EBFE9", shortname = "Readjuster",},
["Reagrupament"] = {abbrev = "", color = "#841039", shortname = "",},
["Real Alternative Party"] = {abbrev = "PAR", color = "#FECD0B", shortname = "",},
["Real Democracy Movement"] = {abbrev = "", color = "#BFFF00", shortname = "Real Democracy",},
["Real Democracy"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Real NZ"] = {abbrev = "", color = "#72bfe8", shortname = "",},
["Real Politics Union"] = {abbrev = "UPR", color = "#031B45", shortname = "",},
["Realists (political party)"] = {abbrev = "", color = "#013888", shortname = "",},
["Reality Party"] = {abbrev = "", color = "Grey", shortname = "Reality",},
["Realizing Goals"] = {abbrev = "", color = "#0B76C0", shortname = "",},
["Reason Party (Australia)"] = {abbrev = "", color = "#4BB8B3", shortname = "",},
["Rebel Almería"] = {abbrev = "", color = "#981403", shortname = "",},
["Rebirth Party (Northern Cyprus)"] = {abbrev = "YDP", color = "#00CCFF", shortname = "",},
["Reborn Armenia"] = {abbrev = "", color = "#1E4277", shortname = "",},
["Reclaim Party"] = {abbrev = "", color = "#C03F31", shortname = "Reclaim",},
["Reconciliation and Liberation Bloc"] = {abbrev = "", color = "black", shortname = "",},
["Reconquête"] = {abbrev = "REC", color = "#170066", shortname = "",},
["Reconstitution Party"] = {abbrev = "", color = "#00FFFF", shortname = "",},
["Recrear"] = {abbrev = "", color = "#35649C", shortname = "",},
["Recreate Greece"] = {abbrev = "DX", color = "#F19914", shortname = "",},
["Recuperar Badajoz"] = {abbrev = "", color = "#6A1E5E", shortname = "",},
["Recuperemos El Ejido"] = {abbrev = "", color = "#01781E", shortname = "",},
["Red Current"] = {abbrev = "", color = "#CE1000", shortname = "",},
["Red Dot United"] = {abbrev = "RDU", color = "#DC6698", shortname = "",},
["Red Electoral Alliance"] = {abbrev = "", color = "#d4001a", shortname = "Red",},
["Red Flag Party"] = {abbrev = "", color = "red", shortname = "",},
["Red Front (UK)"] = {abbrev = "", color = "Red", shortname = "Red Front",},
["Red Party (Dominican Republic)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Red Party (Norway)"] = {abbrev = "", color = "#E90302", shortname = "Red",},
["Red-Green Alliance"] = {abbrev = "", color = "#E6801A", shortname = "",},
["Red-Greens (Sweden)"] = {abbrev = "", color = "#F0002D", shortname = "Red-Greens",},
["Red–Green Alliance (Denmark)"] = {abbrev = "", color = "#D0004D", shortname = "Red–Green",},
["Redondela Electors' Group"] = {abbrev = "", color = "#9A2428", shortname = "",},
["Redondela Pode"] = {abbrev = "", color = "#3C0C40", shortname = "",},
["Referendum Party"] = {abbrev = "", color = "#bf475c", shortname = "Referendum",},
["Reform and Development Misruna Party"] = {abbrev = "", color = "#C7A317", shortname = "",},
["Reform and Development Party (Morocco)"] = {abbrev = "", color = "#8CB803", shortname = "",},
["Reform Club of Hong Kong"] = {abbrev = "", color = "#D04627", shortname = "Reform",},
["Reform Front Party"] = {abbrev = "", color = "DodgerBlue", shortname = "",},
["Reform Group (Finland)"] = {abbrev = "", color = "#E6E600", shortname = "Reform",},
["Reform Jersey"] = {abbrev = "", color = "#01547C", shortname = "",},
["Reform Party (19th-century Wisconsin)"] = {abbrev = "", color = "#3333FF", shortname = "Reform",},
["Reform Party (Iceland)"] = {abbrev = "", color = "#FF7D14", shortname = "Reform",},
["Reform Party (Latvia)"] = {abbrev = "", color = "#10A5DF", shortname = "Reform",},
["Reform Party (Minnesota)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (Mississippi)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (New York State)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party (New Zealand)"] = {abbrev = "", color = "#00BB00", shortname = "Reform",},
["Reform Party (Philippines)"] = {abbrev = "", color = "#0000CD", shortname = "Reform",},
["Reform Party (Singapore)"] = {abbrev = "RP", color = "#FFC000", shortname = "",},
["Reform Party (Southern Rhodesia)"] = {abbrev = "", color = "#99FF99", shortname = "Reform",},
["Reform Party (US)"] = {abbrev = "", color = "#6A287E", shortname = "Reform",},
["Reform Party of Canada"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Reform PH - People's Party"] = {abbrev = "RP", color = "#800000", shortname = "",},
["Reform Progressive Party"] = {abbrev = "PPR", color = "#0000FF", shortname = "",},
["Reform Star Party"] = {abbrev = "", color = "#BCDA00", shortname = "",},
["Reform UK"] = {abbrev = "", color = "#12B6CF", shortname = "",},
["Reformatory Political Federation"] = {abbrev = "RPF", color = "#7FD3E9", shortname = "",},
["Reformed Democratic Party"] = {abbrev = "", color = "#F0E68C", shortname = "",},
["Reformed Political Alliance"] = {abbrev = "", color = "#f7af20", shortname = "",},
["Reformed Political League"] = {abbrev = "GPV", color = "#6CBFD9", shortname = "",},
["Reformed Political Party – Reformatory Political Federation – Reformed Political League"] = {abbrev = "SGP/RPF/GPV", color = "#00a7eb", shortname = "",},
["Reformed Political Party"] = {abbrev = "SGP", color = "#EA5B0B", shortname = "",},
["Reformers (Hungarian political party)"] = {abbrev = "", color = "#D19E33", shortname = "",},
["Reformist Bloc"] = {abbrev = "RB", color = "#2A3A79", shortname = "",},
["Reformist Canarian Centre"] = {abbrev = "", color = "#FDBB4A", shortname = "",},
["Reformist Movement"] = {abbrev = "MR", color = "#0047AB", shortname = "",},
["Reformist Party (Dominican Republic)"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Reformist Party (Portugal)"] = {abbrev = "", color = "#FB607F", shortname = "",},
["Reformist Party (Serbia)"] = {abbrev = "RS", color = "#FF6600", shortname = "",},
["Reformist Party (Spain)"] = {abbrev = "PR", color = "#FF9900", shortname = "",},
["Reformist Party ORA"] = {abbrev = "", color = "#29106B", shortname = "",},
["Reformists of Vojvodina"] = {abbrev = "RV", color = "#E46713", shortname = "",},
["Reforms and Freedom"] = {abbrev = "", color = "red", shortname = "",},
["Reforms and Order Party"] = {abbrev = "PRP", color = "#2581CC", shortname = "",},
["Regenerator Party"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Regional Citizens' Coalition"] = {abbrev = "", color = "#CE1244", shortname = "",},
["Regional Murcianist Party"] = {abbrev = "", color = "#FAE800", shortname = "",},
["Regional Unity Party"] = {abbrev = "", color = "#0066FF", shortname = "",},
["Regionalism (politics)"] = {abbrev = "", color = "#DDDD00", shortname = "Regionalists",},
["Regionalist (Restoration)"] = {abbrev = "", color = "#B4E0CA", shortname = "",},
["Regionalist Action Party of Chile"] = {abbrev = "", color = "#FDFA2F", shortname = "",},
["Regionalist Alicantine Party"] = {abbrev = "", color = "#095387", shortname = "",},
["Regionalist Call for Andalusia"] = {abbrev = "", color = "#08B618", shortname = "",},
["Regionalist Democracy of Castile and León"] = {abbrev = "", color = "#5DA923", shortname = "",},
["Regionalist Independent Party"] = {abbrev = "", color = "purple", shortname = "",},
["Regionalist League of Catalonia"] = {abbrev = "LRC", color = "#D5AD0F", shortname = "",},
["Regionalist League of the Balearic Islands"] = {abbrev = "", color = "#834098", shortname = "",},
["Regionalist Local Party"] = {abbrev = "", color = "#82CF05", shortname = "",},
["Regionalist Party for Eastern Andalusia"] = {abbrev = "", color = "#A6004D", shortname = "",},
["Regionalist Party of Cantabria"] = {abbrev = "PRC", color = "#C2CE0C", shortname = "",},
["Regionalist Party of Castilla-La Mancha"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Regionalist Party of Castilla–La Mancha"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Regionalist Party of El Bierzo"] = {abbrev = "", color = "#005DA1", shortname = "",},
["Regionalist Party of Guadalajara"] = {abbrev = "", color = "#7310AD", shortname = "",},
["Regionalist Party of Independents"] = {abbrev = "", color = "green", shortname = "",},
["Regionalist Party of the Independents"] = {abbrev = "", color = "#00FF00", shortname = "Regionalist",},
["Regionalist Party of the Leonese Country"] = {abbrev = "", color = "#D20062", shortname = "",},
["Regionalist Union of Castile and León"] = {abbrev = "", color = "#1E4D79", shortname = "",},
["Regionalist Unitary Party"] = {abbrev = "", color = "#882222", shortname = "",},
["Regionalist Unity of Castile and León"] = {abbrev = "", color = "#FE0000", shortname = "",},
["Regionalist Unity"] = {abbrev = "", color = "#C9286B", shortname = "",},
["Regionalist"] = {abbrev = "REG", color = "#FFCC33", shortname = "",},
["Reich Party for Civil Rights and Deflation"] = {abbrev = "", color = "#0075EB", shortname = "",},
["Reich Party of the German Middle Class"] = {abbrev = "WP", color = "#000000", shortname = "",},
["Reigate and Banstead Residents Association"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Reinicia Sant Antoni"] = {abbrev = "", color = "#570D9E", shortname = "",},
["Reiwa Shinsengumi"] = {abbrev = "", color = "#ED008C", shortname = "",},
["Rejoin EU"] = {abbrev = "", color = "#003399", shortname = "",},
["Religious Torah Front"] = {abbrev = "", color = "#000", shortname = "",},
["Religious Zionist Party"] = {abbrev = "", color = "#0071BD", shortname = "Religious Zionist",},
["Reload Bulgaria"] = {abbrev = "", color = "black", shortname = "",},
["Renaissance and Union of Europe Party"] = {abbrev = "", color = "#000000", shortname = "",},
["RENAMO"] = {abbrev = "", color = "#113077", shortname = "",},
["Renew Europe"] = {abbrev = "RE", color = "gold", shortname = "",},
["Renew Party"] = {abbrev = "", color = "#16C0D7", shortname = "Renew",},
["Renewal (Greece)"] = {abbrev = "", color = "#FAFF5F", shortname = "",},
["Renewal (political party)"] = {abbrev = "", color = "#2B4F32", shortname = "",},
["Renewal Crusade"] = {abbrev = "", color = "SkyBlue", shortname = "",},
["Renewal Front"] = {abbrev = "FR-PJ", color = "#0E3C61", shortname = "",},
["Renewal Liberal Centre"] = {abbrev = "", color = "#BD782D", shortname = "",},
["Renewal Party of Ibiza and Formentera"] = {abbrev = "", color = "#354B84", shortname = "",},
["Renewal–Nationalist Brotherhood"] = {abbrev = "", color = "#3EA3D2", shortname = "",},
["Renewed Caledonian Union"] = {abbrev = "UC-R", color = "green", shortname = "",},
["Renewed Democratic Liberty"] = {abbrev = "LIDER", color = "#FF0000", shortname = "",},
["Renewed United Democratic Centre"] = {abbrev = "", color = "#009191", shortname = "",},
["Renewing Communist Ecological Left"] = {abbrev = "", color = "#FF4900", shortname = "",},
["Renmen Ayiti"] = {abbrev = "", color = "#0087DC", shortname = "",},
["Renovating Action Party"] = {abbrev = "PAR", color = "#FDF38E", shortname = "",},
["Renovator Labour Party"] = {abbrev = "", color = "#E7393D", shortname = "",},
["Rent Is Too Damn High Party"] = {abbrev = "", color = "#703642", shortname = "Rent Is Too Damn High",},
["Renua"] = {abbrev = "Ren", color = "#FFA500", shortname = "Renua",},
["Repeal Association"] = {abbrev = "", color = "#DDFFDD", shortname = "Irish Repeal",},
["Repons Peyizan"] = {abbrev = "", color = "#009A17", shortname = "",},
["Republic (Faroe Islands)"] = {abbrev = "", color = "#C3CF00", shortname = "Republic",},
["Republic (party, Latvia)"] = {abbrev = "", color = "#075895", shortname = "",},
["Republic (Slovakia)"] = {abbrev = "", color = "#e30512", shortname = "REPUBLIC",},
["Republic (Transnistria)"] = {abbrev = "", color = "#990000", shortname = "Republic",},
["Republic of Fiji Military Forces"] = {abbrev = "RFMF", color = "#C3B091", shortname = "",},
["Republican (Ireland, 1923)"] = {abbrev = "Rep", color = "#008800", shortname = "Republican",},
["Republican (Ireland)"] = {abbrev = "", color = "#66BB66", shortname = "",},
["Republican Action (Spain)"] = {abbrev = "AR", color = "#FF7028", shortname = "",},
["Republican Alternative (Spain)"] = {abbrev = "", color = "#75246C", shortname = "",},
["Republican Alternative Party (Azerbaijan)"] = {abbrev = "", color = "#EF3340", shortname = "",},
["Republican and Socialist Left (2018)"] = {abbrev = "", color = "#D23150", shortname = "",},
["Republican and Socialist Left"] = {abbrev = "", color = "#D53150", shortname = "",},
["Republican Bicentennial Vanguard"] = {abbrev = "", color = "#BE4736", shortname = "",},
["Republican Bloc"] = {abbrev = "BR", color = "", shortname = "",},
["Republican Candidacy"] = {abbrev = "", color = "#6C3E89", shortname = "",},
["Republican Catalan Action"] = {abbrev = "", color = "#E2A554", shortname = "",},
["Republican Clubs"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Republican Coalition (Spain, 1901)"] = {abbrev = "CR", color = "#7A1B6A", shortname = "",},
["Republican Coalition (Spain, 1914)"] = {abbrev = "", color = "#864891", shortname = "",},
["Republican Democratic Movement"] = {abbrev = "", color = "#808080", shortname = "",},
["Republican Fascist Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Republican Federation (Spain)"] = {abbrev = "", color = "#804AB5", shortname = "",},
["Republican Federation"] = {abbrev = "", color = "#005ACA", shortname = "",},
["Republican Force"] = {abbrev = "", color = "#0070B8", shortname = "",},
["Republican Front (Catalonia)"] = {abbrev = "", color = "#EB2071", shortname = "",},
["Republican Fusion"] = {abbrev = "", color = "#711A5B", shortname = "Republican",},
["Republican Group of Coslada"] = {abbrev = "", color = "#82177F", shortname = "",},
["Republican Labour Party"] = {abbrev = "RepLab", color = "#85de59", shortname = "Republican Labour",},
["Republican Left (Spain, 1977)"] = {abbrev = "", color = "#B5047B", shortname = "",},
["Republican Left (Spain)"] = {abbrev = "IR", color = "#E25822", shortname = "",},
["Republican Left of Catalonia"] = {abbrev = "ERC", color = "#FFB232", shortname = "",},
["Republican Liberal Party (Panama)"] = {abbrev = "PLR", color = "pink", shortname = "",},
["Republican Liberal Party (Portugal)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Republican Moderate Party (Alaska)"] = {abbrev = "", color = "#DD4444", shortname = "Republican Moderate",},
["Republican Movement (Mauritius)"] = {abbrev = "", color = "red", shortname = "",},
["Republican Nation Party"] = {abbrev = "CMP", color = "#6F4E37", shortname = "",},
["Republican Nationalist Centre"] = {abbrev = "", color = "#CC9933", shortname = "",},
["Republican Nationalist Federal Union"] = {abbrev = "", color = "#993366", shortname = "",},
["Republican Nationalist Party of Ourense"] = {abbrev = "", color = "#4040C0", shortname = "",},
["Republican Network for Unity"] = {abbrev = "", color = "#004400", shortname = "Republican Network",},
["Republican Party (Belarus)"] = {abbrev = "", color = "#811F20", shortname = "Republican",},
["Republican Party (Bolivia)"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Republican Party (Bosnia and Herzegovina)"] = {abbrev = "", color = "Lightblue", shortname = "",},
["Republican Party (Brazil)"] = {abbrev = "", color = "#009F3C", shortname = "",},
["Republican Party (Cambodia)"] = {abbrev = "", color = "#0000FF", shortname = "Republican",},
["Republican Party (Chile)"] = {abbrev = "", color = "#22446D", shortname = "",},
["Republican Party (China)"] = {abbrev = "", color = "#FFC500", shortname = "Republican",},
["Republican Party (Costa Rica)"] = {abbrev = "", color = "#0018A8", shortname = "Republican",},
["Republican Party (East Timor)"] = {abbrev = "", color = "#24A236", shortname = "",},
["Republican Party (France)"] = {abbrev = "", color = "#00CCCC", shortname = "",},
["Republican Party (Liberia)"] = {abbrev = "", color = "#FF0000", shortname = "Republican",},
["Republican Party (Maldives)"] = {abbrev = "", color = "#DC0A0A", shortname = "",},
["Republican Party (Namibia)"] = {abbrev = "", color = "#FFF100", shortname = "",},
["Republican Party (Pakistan)"] = {abbrev = "", color = "#6495ED", shortname = "Republican Party",},
["Republican Party (Panama)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Republican Party (Philippines)"] = {abbrev = "", color = "#191970", shortname = "Republican",},
["Republican Party (Serbia)"] = {abbrev = "", color = "#c2121d", shortname = "",},
["Republican Party (Spain)"] = {abbrev = "", color = "#D69652", shortname = "",},
["Republican Party (Tunisia)"] = {abbrev = "", color = "#CF171F", shortname = "",},
["Republican Party (US)"] = {abbrev = "", color = "#E81B23", shortname = "Republican",},
["Republican Party for Democracy and Renewal"] = {abbrev = "PRDS", color = "#981c24", shortname = "",},
["Republican Party for Independence and Development"] = {abbrev = "PRID", color = "#FF8000", shortname = "",},
["Republican Party of Afghanistan"] = {abbrev = "", color = "skyblue", shortname = "",},
["Republican Party of Agricultural and Smallholder People"] = {abbrev = "", color = "#008000", shortname = "",},
["Republican Party of Albania"] = {abbrev = "PR", color = "#20267A", shortname = "",},
["Republican Party of Armenia"] = {abbrev = "", color = "#D2691E", shortname = "Republican",},
["Republican Party of Dahomey"] = {abbrev = "", color = "#F38C22", shortname = "",},
["Republican Party of Farmers and Peasants"] = {abbrev = "RSZML", color = "#008000", shortname = "",},
["Republican Party of Havana"] = {abbrev = "", color = "#CD5C5C", shortname = "Republican",},
["Republican Party of India (Athawale)"] = {abbrev = "RPI(A)", color = "#000080", shortname = "",},
["Republican Party of India (Gavai)"] = {abbrev = "RPI(G)", color = "#6633EE", shortname = "",},
["Republican Party of India (Khobragade)"] = {abbrev = "RPI(K)", color = "darkblue", shortname = "",},
["Republican Party of India Ektavadi"] = {abbrev = "RPIE", color = "#BFFF00", shortname = "",},
["Republican Party of India"] = {abbrev = "RPI", color = "#000066", shortname = "",},
["Republican Party of Labour and Justice"] = {abbrev = "RPTS", color = "#DE7673", shortname = "",},
["Republican Party of Liberty"] = {abbrev = "", color = "#0000CD", shortname = "",},
["Republican Party of Paraná"] = {abbrev = "", color = "#768000", shortname = "PR Paraná",},
["Republican Party of Russia"] = {abbrev = "RPR", color = "#FE4801", shortname = "",},
["Republican Party of the Social Order"] = {abbrev = "PROS", color = "#FF5460", shortname = "",},
["Republican People's Party (Egypt)"] = {abbrev = "", color = "#B7800B", shortname = "",},
["Republican People's Party"] = {abbrev = "CHP", color = "#ED1C24", shortname = "",},
["Republican Peronism"] = {abbrev = "", color = "#007FFF", shortname = "",},
["Republican Proposal"] = {abbrev = "PRO", color = "#ffd700", shortname = "",},
["Republican Reliance Party"] = {abbrev = "CGP", color = "#FF4500", shortname = "",},
["Republican Sinn Féin"] = {abbrev = "RSF", color = "#008800", shortname = "Republican Sinn Féin",},
["Republican Social Movement"] = {abbrev = "", color = "#313439", shortname = "",},
["Republican Socialist Unity Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Republican Statehood Party"] = {abbrev = "", color = "#151515", shortname = "Republican Statehood",},
["Republican Turkish Party"] = {abbrev = "CTP", color = "#008000", shortname = "",},
["Republican Union (France)"] = {abbrev = "", color = "#C0504D", shortname = "",},
["Republican Union (Portugal)"] = {abbrev = "PUR", color = "#A52A2A", shortname = "Republican Union",},
["Republican Union (Puerto Rico)"] = {abbrev = "", color = " ", shortname = "Republican Union",},
["Republican Union (Spain, 1934)"] = {abbrev = "", color = "#672F6C", shortname = "",},
["Republican Union Party (Ecuador)"] = {abbrev = "PUR", color = "#D0FF14", shortname = "",},
["Republican Union Party (Spain)"] = {abbrev = "PUR", color = "#931585", shortname = "",},
["Republican Union Party"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Republican Unity Party"] = {abbrev = "", color = "#D0FF14", shortname = "",},
["Republican Villagers Nation Party"] = {abbrev = "CKMP", color = "#DF7401", shortname = "",},
["Republican-Socialist Party"] = {abbrev = "PRS", color = "#DE3163", shortname = "",},
["Republican–Socialist Conjunction"] = {abbrev = "CRS", color = "#C11956", shortname = "",},
["Republican, Ecologist and Social Alliance"] = {abbrev = "ARES", color = "#4169E1", shortname = "",},
["Republican/Hold"] = {abbrev = "", color = "#FFF1EE", shortname = "",},
["Republicans (Brazil)"] = {abbrev = "", color = "#0070C5", shortname = "Republicanos",},
["Republicans for Bulgaria"] = {abbrev = "RzB", color = "#2B4A99", shortname = "",},
["Republicans"] = {abbrev = "", color = "#AB0EA7", shortname = "",},
["Res Publica Party"] = {abbrev = "", color = "#04427C", shortname = "Res Publica",},
["Residents Action Movement"] = {abbrev = "RAM", color = "#467CFA", shortname = "",},
["Residents Association of London"] = {abbrev = "", color = "teal", shortname = "Residents",},
["Residents Association"] = {abbrev = "", color = "#d3d3d3", shortname = "Residents",},
["Residents Associations of Epsom and Ewell"] = {abbrev = "", color = "pink", shortname = "Residents Association",},
["Residents for Guildford and Villages"] = {abbrev = "R4GV", color = "#CA1F7B", shortname = "",},
["Residents for Uttlesford"] = {abbrev = "R4U", color = "#00a88f", shortname = "",},
["Residents' Association of Barnet"] = {abbrev = "", color = "#669966", shortname = "Residents' Association",},
["Residents' Association of London"] = {abbrev = "", color = "gray", shortname = "",},
["Residents' association"] = {abbrev = "RA", color = "#666666", shortname = "",},
["RESIST (electoral list)"] = {abbrev = "", color = "#00A94F", shortname = "",},
["Resistance Front of Islamic Iran"] = {abbrev = "RFII", color = "#23aba1", shortname = "",},
["Resistance of Guinea-Bissau-Bafatá Movement"] = {abbrev = "", color = "#0A86F8", shortname = "",},
["Resistance Party (France)"] = {abbrev = "", color = "#0072BB", shortname = "",},
["Résistons!"] = {abbrev = "", color = "#034EA1", shortname = "",},
["Resni.ca"] = {abbrev = "", color = "#67359A", shortname = "",},
["Résoatao Party"] = {abbrev = "", color = "#154FE6", shortname = "",},
["Respect (Haiti)"] = {abbrev = "", color = "#0000FF", shortname = "Respect",},
["Respect Party"] = {abbrev = "", color = "#46801c", shortname = "Respect",},
["Respeto"] = {abbrev = "", color = "#8E1919", shortname = "",},
["Responsibility – Social Democratic Alliance of Political Parties"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["Responsible Future (Iceland)"] = {abbrev = "", color = "#322757", shortname = "",},
["Responsible Government Association"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Respublika (political party)"] = {abbrev = "", color = "#20959E", shortname = "Respublika",},
["Respublika–Ata Zhurt"] = {abbrev = "", color = "#FFCF06", shortname = "",},
["Restart Coalition"] = {abbrev = "", color = "#e00f20", shortname = "Restart",},
["Restore and Build Kenya"] = {abbrev = "", color = "#0000ff", shortname = "",},
["Restore Scotland"] = {abbrev = "", color = "#006EB6", shortname = "",},
["Restore the Family for Children's Sake"] = {abbrev = "", color = "Goldenrod", shortname = "",},
["Resurgence Party"] = {abbrev = "", color = "Blue", shortname = "",},
["RETE Movement"] = {abbrev = "RETE", color = "#275956", shortname = "",},
["Retirees Party for the Future"] = {abbrev = "", color = "#59A35A", shortname = "",},
["Reunification Democratic Party"] = {abbrev = "", color = "#EF4122", shortname = "Reunification Democratic",},
["Reunification Movement for Change"] = {abbrev = "", color = "#F16A26", shortname = "",},
["Reus Independent Coordinator"] = {abbrev = "", color = "#A71F21", shortname = "",},
["Revival (Bulgarian political party)"] = {abbrev = "", color = "#C09F62", shortname = "Revival",},
["Revival (Ukraine)"] = {abbrev = "", color = "#90BEDC", shortname = "Revival",},
["Revival Party"] = {abbrev = "", color = "Crimson", shortname = "",},
["Revolutionary Action Party"] = {abbrev = "PAR", color = "#4682b4", shortname = "",},
["Revolutionary Anticapitalist Left"] = {abbrev = "", color = "#B41E17", shortname = "",},
["Revolutionary Civic Union"] = {abbrev = "UCR", color = "#6B8E23", shortname = "",},
["Revolutionary Committee of the Chinese Kuomintang"] = {abbrev = "RCCK", color = "#1b65af", shortname = "",},
["Revolutionary Communist League (France)"] = {abbrev = "LCR", color = "#C41E3A", shortname = "",},
["Revolutionary Communist League (Luxembourg)"] = {abbrev = "", color = "#960018", shortname = "",},
["Revolutionary Communist League (Spain)"] = {abbrev = "", color = "#DF0101", shortname = "",},
["Revolutionary Communist Movement of Greece"] = {abbrev = "EKKE", color = "red", shortname = "",},
["Revolutionary Communist Party (Argentina)"] = {abbrev = "PCR", color = "#E00000", shortname = "Revolutionary Communist Party",},
["Revolutionary Communist Party (UK, 1978)"] = {abbrev = "", color = "#880000", shortname = "Revolutionary Communist",},
["Revolutionary Communist Party of Britain (Marxist-Leninist)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Communist Party of Britain (Marxist–Leninist)"] = {abbrev = "RCP (GB) (ML)", color = "#660000", shortname = "",},
["Revolutionary Communist Party of India"] = {abbrev = "RCPI", color = "Red", shortname = "",},
["Revolutionary Communist Party, USA"] = {abbrev = "", color = "#C80815", shortname = "",},
["Revolutionary Democratic Coalition"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Revolutionary Democratic Party of India"] = {abbrev = "RDP(I)", color = "#F78181", shortname = "",},
["Revolutionary Febrerista Party"] = {abbrev = "PRF", color = "#01a755", shortname = "",},
["Revolutionary Goans Party"] = {abbrev = "RGP", color = "#E3C773", shortname = "",},
["Revolutionary Left Front (Bolivia)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Left Front"] = {abbrev = "", color = "#0500BE", shortname = "",},
["Revolutionary Left Movement (Bolivia)"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Revolutionary Left Movement (Venezuela)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Left Party"] = {abbrev = "", color = "darkred", shortname = "",},
["Revolutionary Liberation Movement Tupaq Katari"] = {abbrev = "", color = "#A57DAD", shortname = "",},
["Revolutionary Marxist Party of India"] = {abbrev = "RMPI", color = "red", shortname = "",},
["Revolutionary Middle Class"] = {abbrev = "", color = "Black", shortname = "",},
["Revolutionary Nationalist Movement"] = {abbrev = "", color = "#F19CBB", shortname = "",},
["Revolutionary Organization"] = {abbrev = "RO", color = "#ee1c25", shortname = "",},
["Revolutionary Party (Guatemala)"] = {abbrev = "", color = "#964B00", shortname = "",},
["Revolutionary Party of Democratic Unification"] = {abbrev = "PRUD", color = "#FAAFBE", shortname = "",},
["Revolutionary Party of the Nationalist Left"] = {abbrev = "", color = "#D62222", shortname = "",},
["Revolutionary Social Democratic Party"] = {abbrev = "", color = "#200040", shortname = "",},
["Revolutionary Socialist Party (Bolshevik)"] = {abbrev = "RSP(B)", color = "#FF0000", shortname = "",},
["Revolutionary Socialist Party (India)"] = {abbrev = "RSP", color = "#FF4A4A", shortname = "",},
["Revolutionary Socialist Party (Leninist)"] = {abbrev = "RSP(L)", color = "#FF0000", shortname = "",},
["Revolutionary Socialist Party (Netherlands)"] = {abbrev = "", color = "#990000", shortname = "",},
["Revolutionary Socialist Party (Peru)"] = {abbrev = "", color = "Red", shortname = "",},
["Revolutionary Socialist Party of Kerala (Bolshevik)"] = {abbrev = "", color = "red", shortname = "",},
["Revolutionary Socialists (Egypt)"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Revolutionary Union (Peru)"] = {abbrev = "", color = "black", shortname = "",},
["Revolutionary United Front"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Revolutionary Workers Party (Chile)"] = {abbrev = "", color = "#6d0044", shortname = "",},
["Revolutionary Workers Party (US)"] = {abbrev = "", color = "#aa0000", shortname = "Revolutionary Workers",},
["Revolutionary Workers Party of Bangladesh"] = {abbrev = "BRWP", color = "#E38B9F", shortname = "",},
["Revolutionary Workers' Party (Bolivia)"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Revolutionary Workers' Party (Russia)"] = {abbrev = "", color = "#DE0403", shortname = "",},
["Revolutionary Workers' Party (Spain)"] = {abbrev = "", color = "#B22222", shortname = "",},
["Rewmi"] = {abbrev = "", color = "#E68F3F", shortname = "",},
["Rex Patrick Team"] = {abbrev = "", color = "#16b7cd", shortname = "",},
["Rezistans ek Alternativ"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Rhodesia Labour Party"] = {abbrev = "", color = "#DC241f", shortname = "Labour",},
["Rhodesia Party"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Rhodesian Action Party"] = {abbrev = "RAP", color = "#ffd700", shortname = "",},
["Rhodesian Front"] = {abbrev = "RF", color = "#C247C2", shortname = "",},
["Rhodesian Party"] = {abbrev = "", color = "Orange", shortname = "",},
["Rhuddlan Debt Protest Campaign"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Right Alliance (Belarus)"] = {abbrev = "", color = "#959492", shortname = "",},
["Right Bloc"] = {abbrev = "PB", color = "#8DB600", shortname = "",},
["Right Cause"] = {abbrev = "", color = "#F0BD48", shortname = "",},
["Right Person Electorate Coalition"] = {abbrev = "RPEC", color = "#6D3290", shortname = "",},
["Right Romania Alliance"] = {abbrev = "ARD", color = "#318CE7", shortname = "",},
["Right Sector"] = {abbrev = "", color = "#110C17", shortname = "",},
["Right to Change"] = {abbrev = "RTOC", color = "#EE4035", shortname = "",},
["Right to Life Party (New York)"] = {abbrev = "", color = "#F4C2C2", shortname = "Right to Life",},
["Right to Life Party (US)"] = {abbrev = "", color = "#F4C2C2", shortname = "",},
["Right Wing of the Republic"] = {abbrev = "", color = "#BE282D", shortname = "",},
["Right-wing independent"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Righteous Party"] = {abbrev = "", color = "#901380", shortname = "",},
["Rightist Opposition"] = {abbrev = "", color = "#7C1F3C", shortname = "Right Opposition",},
["Rightist Socialist Party of Japan"] = {abbrev = "", color = "#2AAAE6", shortname = "Rightist Socialist",},
["Rights and Equality Party"] = {abbrev = "HEPAR", color = "#000000", shortname = "",},
["Rights and Freedoms Party (Turkey)"] = {abbrev = "", color = "#FFDB4D", shortname = "",},
["Rights and Freedoms Party"] = {abbrev = "HAK-PAR", color = "#E6E600", shortname = "",},
["Rights and Justice Party"] = {abbrev = "HAP", color = "#996633", shortname = "",},
["Rights and Liberties Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Rights of Citizens Association"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Rights Party"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Rikken Doshikai"] = {abbrev = "", color = "#DA7B8B", shortname = "",},
["Rikken Kaishintō"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Rikken Kokumintō"] = {abbrev = "", color = "#A090E0", shortname = "",},
["Rikken Minseitō"] = {abbrev = "", color = "#6EA4CA", shortname = "",},
["Rikken Seiyūkai"] = {abbrev = "", color = "#B0D3A8", shortname = "",},
["Rikken Yōseikai"] = {abbrev = "", color = "#B0313F", shortname = "",},
["Rio Republican Party"] = {abbrev = "", color = "#E3FF2A", shortname = "PR Fluminense",},
["Rinnovu"] = {abbrev = "", color = "#500F0B", shortname = "Rinnovu",},
["Riojan Party"] = {abbrev = "PR+", color = "#00AA42", shortname = "",},
["Rionegrin Provincial Party"] = {abbrev = "", color = "#EB3721", shortname = "",},
["RISE – Scotland's Left Alliance"] = {abbrev = "RISE", color = "#f15723", shortname = "",},
["RISE (Ireland)"] = {abbrev = "", color = "#ED161F", shortname = "RISE",},
["Rise Party"] = {abbrev = "", color = "#2E127D", shortname = "",},
["Rising Sun Party"] = {abbrev = "RIS", color = "#FFB040", shortname = "",},
["Ritō (government supporters)"] = {abbrev = "", color = "#009933", shortname = "",},
["Rivas Puede"] = {abbrev = "", color = "#812868", shortname = "",},
["Rivers State Peoples Democratic Party"] = {abbrev = "PDP", color = "#FF0000", shortname = "",},
["Robbie the Pict (Independent)"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Rochford District Residents"] = {abbrev = "", color = "#930000", shortname = "Rochford Resident",},
["Rock 'n' Roll Loony Party"] = {abbrev = "", color = "#c71585", shortname = "Rock 'n' Roll Loony",},
["Rockingham Whigs"] = {abbrev = "", color = "#F0DC82", shortname = "",},
["Rodina (political party)"] = {abbrev = "", color = "#E61B23", shortname = "Rodina",},
["Rodney First"] = {abbrev = "", color = "#009999", shortname = "",},
["Rodrigues Movement"] = {abbrev = "", color = "#21FF21", shortname = "",},
["Rodrigues People's Organisation"] = {abbrev = "OPR", color = "#8B664B", shortname = "",},
["Roma Civic Initiative"] = {abbrev = "ROI", color = "brown", shortname = "",},
["Roma Party"] = {abbrev = "RP", color = "#016830", shortname = "",},
["Roma Union of Serbia"] = {abbrev = "URS", color = "#A3C5EA", shortname = "",},
["Roman Catholic Party of the Netherlands"] = {abbrev = "", color = "#0033BB", shortname = "",},
["Roman Catholic People's Party"] = {abbrev = "", color = "#7F7F99", shortname = "",},
["Roman Catholic State Party"] = {abbrev = "", color = "#003319", shortname = "",},
["Romanian Communist Party"] = {abbrev = "PCR", color = "#CC0000", shortname = "",},
["Romanian Democratic Convention"] = {abbrev = "CDR", color = "#004A92", shortname = "",},
["Romanian ethnic minority parties"] = {abbrev = "", color = "#000000", shortname = "Minority parties",},
["Romanian National Party"] = {abbrev = "PNR", color = "#5087B2", shortname = "",},
["Romanian National Unity Party"] = {abbrev = "PUNR", color = "#1BB0E8", shortname = "",},
["Romanian Nationhood Party"] = {abbrev = "NR", color = "#F7D117", shortname = "",},
["Romanian Popular Party"] = {abbrev = "PPR", color = "#FFFF00", shortname = "",},
["Romanian Social Democratic Party (1927–1948)"] = {abbrev = "PSD", color = "#D40000", shortname = "",},
["Romanian Social Democratic Party (1990–2001)"] = {abbrev = "", color = "pink", shortname = "PSDR (Social)",},
["Romanian Social Party"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Romanian Socialist Democratic Party"] = {abbrev = "", color = "#ED2128", shortname = "PSDR (Socialist)",},
["Romanian Socialist Party (1992–2015)"] = {abbrev = "PSR", color = "#CC0000", shortname = "",},
["Romanian Socialist Party (present-day)"] = {abbrev = "", color = "#E30615", shortname = "",},
["Romantic Mutual Support Party"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Ronda Green Space"] = {abbrev = "", color = "#52886E", shortname = "",},
["Ronda Sí Se Puede"] = {abbrev = "", color = "#63376A", shortname = "",},
["Rondeños por Ronda"] = {abbrev = "", color = "#7F7F7F", shortname = "",},
["Roos Party"] = {abbrev = "", color = "#FFD700", shortname = "Roos",},
["Roque Aguayro"] = {abbrev = "", color = "#D93224", shortname = "",},
["Roque de Gando"] = {abbrev = "", color = "#FFF200", shortname = "",},
["Rose in the Fist"] = {abbrev = "", color = "gold", shortname = "",},
["ROSSEM"] = {abbrev = "", color = "#B7007D", shortname = "",},
["Round Table—Free Georgia"] = {abbrev = "", color = "#BA2B27", shortname = "Round Table",},
["Roundhead"] = {abbrev = "", color = "white", shortname = "",},
["Roundtable (Hong Kong)"] = {abbrev = "", color = "#509ccd", shortname = "Roundtable",},
["Royalist"] = {abbrev = "", color = "#66023C", shortname = "",},
["RPR-UDF"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Ruiz-Mateos Group"] = {abbrev = "", color = "#28365D", shortname = "Ruiz-Mateos",},
["Runnymede Independent Residents Group"] = {abbrev = "", color = "#264404", shortname = "",},
["Rural Development Party (Papua New Guinea)"] = {abbrev = "RDP", color = "", shortname = "",},
["Rural Development Party (Vanuatu)"] = {abbrev = "RDP", color = "#000000", shortname = "",},
["Rural Independents Group"] = {abbrev = "", color = "#CCFFCC", shortname = "",},
["Rural Nationalist Bloc"] = {abbrev = "", color = "#048043", shortname = "",},
["Rural Party"] = {abbrev = "", color = "#808000", shortname = "",},
["Rurality Movement"] = {abbrev = "LMR", color = "#0049A1", shortname = "",},
["Russellite Unionist"] = {abbrev = "", color = "orange", shortname = "",},
["Russia of the Future"] = {abbrev = "", color = "#44B4E3", shortname = "",},
["Russian All-People's Union"] = {abbrev = "ROS", color = "#FF9C00", shortname = "",},
["Russian Communist Workers Party"] = {abbrev = "", color = "#D50000", shortname = "",},
["Russian Communist Workers' Party of the Communist Party of the Soviet Union"] = {abbrev = "", color = "#A9231B", shortname = "",},
["Russian Democratic Reform Movement"] = {abbrev = "RDDR", color = "#E9E26E", shortname = "",},
["Russian Ecological Party \"The Greens\""] = {abbrev = "", color = "#00953B", shortname = "The Greens",},
["Russian Party (Serbia)"] = {abbrev = "", color = "#0D3B66", shortname = "",},
["Russian Party in Estonia"] = {abbrev = "", color = "#2b677f", shortname = "",},
["Russian Party of Freedom and Justice"] = {abbrev = "RPSS", color = "#AC0907", shortname = "",},
["Russian Party of Life"] = {abbrev = "", color = "#D82828", shortname = "",},
["Russian Party of Pensioners for Social Justice"] = {abbrev = "", color = "#C52030", shortname = "",},
["Russian Party of Social Democracy"] = {abbrev = "", color = "#D51F76", shortname = "",},
["Russian Party"] = {abbrev = "", color = "#3CB371", shortname = "",},
["Russian People's Democratic Union"] = {abbrev = "", color = "#D00032", shortname = "",},
["Russian Social Democratic Labour Party"] = {abbrev = "RSDLP", color = "#D40000", shortname = "",},
["Russian Social Democratic Labour Party (Mensheviks)"] = {abbrev = "", color = "#ED1B34", shortname = "Mensheviks",},
["Russian Socialist Movement"] = {abbrev = "", color = "#D62B24", shortname = "",},
["Russian Socialist Party"] = {abbrev = "", color = "#020266", shortname = "",},
["Russian Unity"] = {abbrev = "", color = "#054C9F", shortname = "",},
["Rwandan Patriotic Front"] = {abbrev = "RPF", color = "#0087DC", shortname = "",},
["Rwandan Socialist Party"] = {abbrev = "", color = "#FFC0CB", shortname = "",},
["Ryokufūkai (1947–1960)"] = {abbrev = "", color = "#9ACBAB", shortname = "Ryokufūkai",},
}
return {
full = full,
alternate = alternate,
}
ogae3f54hona69r27gvoav9zfa9qsmf
Module:Political party/S
828
68669898
1096453800
1096442236
2022-07-04T15:41:33Z
Number 57
327289
+
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Sa Unió"] = "Sa Unió de Formentera",
["Sans étiquette"] = "Independent politician",
["Sarawak Alliance Parties"] = "Sarawak Parties Coalition",
["Sarawak Parties Alliance"] = "Sarawak Parties Coalition",
["Sarawak People's Energy Party(TERAS)"] = "Sarawak People's Energy Party",
["Sarawak People's Party"] = "Sarawak Peoples' Party",
["Sarawak Progressive Democratic Party"] = "Progressive Democratic Party",
["Sasna Tsrer"] = "Sasna Tsrer Pan-Armenian Party",
["Scania Party"] = "Scanian Party",
["Scottish Conservative and Unionist Party"] = "Scottish Conservatives",
["Scottish Conservative Party"] = "Scottish Conservatives",
["Scottish Green Party"] = "Scottish Greens",
["Scottish Green"] = "Scottish Greens",
["Scottish Labour Party"] = "Scottish Labour",
["Scottish Peoples Alliance"] = "Scottish People's Alliance",
["Scottish Unionist Party"] = "Unionist Party (Scotland)",
["SDP-Liberal Alliance"] = "SDP–Liberal Alliance",
["Self Reliance Party"] = "Self Reliance (political party)",
["Self-Defense of the Republic of Poland"] = "Self-Defence of the Republic of Poland",
["Self-Government Party (Faroe Islands)"] = "Self-Government (Faroe Islands)",
["Serb Democratic Party (Bosnia and Herzegovina)"] = "Serbian Democratic Party (Bosnia and Herzegovina)",
["Sha Tin Community Network"] = "Shatin Community Network",
["Shan National League for Democracy"] = "Shan Nationalities League for Democracy",
["Shan Nationalities Democ"] = "Shan Nationalities Democratic Party",
["Shiromani Akali Dal (Simranjit Singh Mann)"] = "Shiromani Akali Dal (Amritsar)",
["Shramik Krishak Samajbadi Dal"] = "Sramik Krishak Samajbadi Dal",
["Sikkim National People's Party"] = "Sikkim National People’s Party",
["Silver Party (United States)"] = "Silver Party",
["Silver Party (US)"] = "Silver Party",
["Singapore Malay National Organisation"] = "Pertubuhan Kebangsaan Melayu Singapura",
["Singapore Malay National Organization"] = "Pertubuhan Kebangsaan Melayu Singapura",
["Singapore United Front"] = "Democratic Progressive Party (Singapore)",
["Sinhala Heritage"] = "Jathika Hela Urumaya",
["Sinhala Language Front"] = "Sinhala Bhasa Peramuna",
["Sinn Féin the Workers Party"] = "Sinn Féin The Workers' Party",
["Sinn Fein"] = "Sinn Féin",
["SLD"] = "Left and Democrats",
["SLDLR"] = "Left Together",
["SLDUP"] = "Left and Democrats",
["Social Commitment Force"] = "Citizen Revolution",
["Social Democratic Left Party (Sweden)"] = "Left Party (Sweden)",
["Social Democratic Party (Brazil, 1945-65)"] = "Social Democratic Party (Brazil, 1945–65)",
["Social Democratic Party (Japan)"] = "Social Democratic Party of Japan",
["Social Democratic Party (UK, 1990-present)"] = "Social Democratic Party (UK, 1990–present)",
["Social Democratic Party (UK, 1990)"] = "Social Democratic Party (UK, 1990–present)",
["Social Democratic Party (United States)"] = "Social Democratic Party (US)",
["Social Democratic Party of Bosnia and Herzegovina"] = "Social Democratic Party (Bosnia and Herzegovina)",
["Social Democratic Party of the Roma"] = "Party of the Roma",
["Social Democratic Power"] = "Social and Democratic Power",
["Social Democratic Union (Latvia)"] = "Social Democratic Party (Latvia)",
["Social Democratic Union of Workers and Smallholders"] = "Social Democratic Party of Finland",
["Social Democratic Workers' Party of Germany"] = "Social Democratic Party of Germany",
["Social Party of National Unity"] = "Union Party for the People",
["Social-Liberal Union (Romania)"] = "Social Liberal Union",
["Socialism and Freedom Party"] = "Socialism and Liberty Party",
["Socialist Action (U.S.)"] = "Socialist Action (US)",
["Socialist Action (United States)"] = "Socialist Action (US)",
["Socialist Alliance Party (Romania)"] = "Romanian Socialist Party (present-day)",
["Socialist Alternative - Putting People First"] = "Socialist Alternative – Putting People First",
["Socialist Alternative (United States)"] = "Socialist Alternative (US)",
["Socialist Destourian Party"] = "Democratic Constitutional Rally",
["Socialist Equality Party (United States)"] = "Socialist Equality Party (US)",
["Socialist Labor Party (United States)"] = "Socialist Labor Party of America",
["Socialist Labor Party (US)"] = "Socialist Labor Party of America",
["Socialist Labor Party"] = "Socialist Labor Party of America",
["Socialist Party – Differently"] = "Socialist Party Differently",
["Socialist Party (Flanders)"] = "Socialist Party Differently",
["Socialist Party (francophone Belgium)"] = "Socialist Party (Belgium)",
["Socialist Party (German-speaking Community)"] = "Socialist Party (Belgium)",
["Socialist Party (Thailand)"] = "Socialist Party of Thailand",
["Socialist Party (United States)"] = "Socialist Party (US)",
["Socialist Party of Cantabria"] = "Spanish Socialist Workers' Party",
["Socialist Party of Castile and León"] = "Spanish Socialist Workers' Party",
["Socialist Party of Castilla–La Mancha"] = "Spanish Socialist Workers' Party",
["Socialist Party of Galicia"] = "Spanish Socialist Workers' Party",
["Socialist Party of Ireland"] = "Socialist Party (Ireland)",
["Socialist Party of La Rioja"] = "Spanish Socialist Workers' Party",
["Socialist Party of Madrid"] = "Spanish Socialist Workers' Party",
["Socialist Party of Mallorca"] = "Socialist Party of Majorca",
["Socialist Party of Mexico"] = "Socialist Party",
["Socialist Party of Navarre"] = "Spanish Socialist Workers' Party",
["Socialist Party of Oregon"] = "Socialist Party of America",
["Socialist Party of Oregon (Columbia County, Oregon)"] = "Socialist Party of America",
["Socialist Party of the Balearic Islands"] = "Spanish Socialist Workers' Party",
["Socialist Party of the Basque Country–Basque Country Left"] = "Spanish Socialist Workers' Party",
["Socialist Party of the Basque Country"] = "Spanish Socialist Workers' Party",
["Socialist Party of the Canaries"] = "Spanish Socialist Workers' Party",
["Socialist Party of the Region of Murcia"] = "Spanish Socialist Workers' Party",
["Socialist Party of the Valencian Country"] = "Spanish Socialist Workers' Party",
["Socialist Unity (Spain)"] = "People's Socialist Party (Spain)",
["Socialist Workers Network"] = "Socialist Workers Party (Ireland)",
["Socialist Workers Party (UK)"] = "Socialist Workers Party (Britain)",
["Socialist Workers Party (United States)"] = "Socialist Workers Party (US)",
["Socialist-Revolutionary Party"] = "Socialist Revolutionary Party",
["Socialistische Partij Anders"] = "Socialist Party Differently",
["Socialists' Party of Aragon"] = "Spanish Socialist Workers' Party",
["Socialists' Party of Galicia"] = "Spanish Socialist Workers' Party",
["SolidaritéS"] = "solidaritéS",
["Solidarity (Greenland)"] = "Atassut",
["Solidarity-People Before Profit"] = "People Before Profit/Solidarity",
["Solidarity–People Before Profit"] = "People Before Profit/Solidarity", -- dash differences
["Somali People's Democratic Party"] = "Ethiopian Somali People's Democratic Party",
["Sopi Coalition"] = "Senegalese Democratic Party",
["South African Party (Cape Colony)"] = "South African Party",
["South Dakota Democratic Party"] = "Democratic Party (US)",
["South Dakota Republican Party"] = "Republican Party (US)",
["South Kerry Independent Alliance"] = "Kerry Independent Alliance",
["South West Africa People's Organization (SWAPO)"] = "SWAPO",
["Southern Democratic (United States)"] = "Southern Democratic (US)",
["Soyuz"] = "Soyuz (political party)",
["SP.A"] = "Socialist Party Differently",
["Spanish Socialist Workers' Party of Andalusia"] = "Spanish Socialist Workers' Party",
["Spanish Socialist Workers' Party of Extremadura"] = "Spanish Socialist Workers' Party",
["Spanish Socialist Workers' Party of the Community of Madrid"] = "Spanish Socialist Workers' Party",
["Speaker of the British House of Commons"] = "Speaker of the House of Commons (United Kingdom)",
["SPOLU (Czech Republic)"] = "Spolu (Czech Republic)",
["Sri Lanka People's Party"] = "Sri Lanka Mahajana Pakshaya",
["SRP"] = "Self-Defence of the Republic of Poland",
["Stand Up! Mafia, Get Out!"] = "Stand Up.BG! We are coming!",
["States Rights"] = "States' Rights Party",
["States' Rights"] = "States' Rights Party",
["Stop the Decline"] = "Act to Stop the Decline",
["Stratford Fi"] = "Stratford First Independent",
["Stronnictwo Chłopskie"] = "Peasant Party (Poland)",
["Sudan People's Liberation Movement - Democratic Change"] = "Democratic Change (South Sudan)",
["Sudanese Socialist Democratic Union"] = "Sudanese Socialist Union",
["Suheldev Bhartiya Samaj Party"] = "Suheldev Bharatiya Samaj Party",
["Swatantra Bharat Paksha"] = "Swatantra Bharat Paksh",
["Swedish People's Party (Finland)"] = "Swedish People's Party of Finland",
["Swedish People's Party"] = "Swedish People's Party of Finland",
["Swiss Conservative People's Party"] = "Christian Democratic People's Party of Switzerland",
["SZ"] = "Green Party (Czech Republic)",
}
local full = {
["S'illoters and Sympathisers"] = {abbrev = "", color = "#4B5CAA", shortname = "",},
["Sa Unió de Formentera"] = {abbrev = "", color = "#009FDD", shortname = "",},
["SA-Best"] = {abbrev = "", color = "#ff6300", shortname = "",},
["Sa-Shakti Nepal"] = {abbrev = "", color = "pink", shortname = "Sa-Shakti",},
["Saadist Institutional Party"] = {abbrev = "", color = "#C71585", shortname = "Saadist",},
["Saba Labour Party"] = {abbrev = "SLP", color = "#2B41A7", shortname = "",},
["Sabah Chinese Association"] = {abbrev = "", color = "SCA", shortname = "",},
["Sabah Chinese Consolidated Party"] = {abbrev = "", color = "SCCP", shortname = "",},
["Sabah Heritage Party"] = {abbrev = "", color = "#A4E5FC", shortname = "",},
["Sabah National Momogun Party"] = {abbrev = "MOMOGUN", color = "", shortname = "",},
["Sabah Nationality Party"] = {abbrev = "", color = "#599E59", shortname = "",},
["Sabah Native Co-operation Party"] = {abbrev = "", color = "#F49950", shortname = "",},
["Sabah People's Front"] = {abbrev = "SPF", color = "", shortname = "",},
["Sabah People's Hope Party"] = {abbrev = "", color = "#6F92C0", shortname = "",},
["Sabah People's United Front"] = {abbrev = "BERJAYA", color = "", shortname = "",},
["Sabah People's Unity Party"] = {abbrev = "", color = "#FFCD00", shortname = "",},
["Sabah Progressive Party"] = {abbrev = "SAPP", color = "#F8F6BC", shortname = "",},
["Sadamaioría"] = {abbrev = "", color = "#2872AF", shortname = "",},
["Sadbhavana Party"] = {abbrev = "", color = "seagreen", shortname = "Sadbhavana",},
["Sadrist Movement"] = {abbrev = "", color = "black", shortname = "",},
["Saenuri Party (2017)"] = {abbrev = "", color = "#DA1F49", shortname = "Saenuri",},
["Saenuri Party"] = {abbrev = "", color = "#C8161E", shortname = "Saenuri",},
["Safe Home (Estonia)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Safina"] = {abbrev = "", color = "#CC6633", shortname = "",},
["Sagunto and Port Centrists"] = {abbrev = "", color = "#71DAFF", shortname = "",},
["Sahaphum Party"] = {abbrev = "", color = "#aacc99", shortname = "",},
["Sai Kung Commons"] = {abbrev = "", color = "#4DB847", shortname = "",},
["Saint Barth First!"] = {abbrev = "", color = "#0066CC", shortname = "",},
["Saint Kitts and Nevis Labour Party"] = {abbrev = "SKNLP", color = "#C0504D", shortname = "",},
["Saint Lucia Labour Party"] = {abbrev = "", color = "#ED1C24", shortname = "Labour Party",},
["Saint Vincent and the Grenadines Green Party"] = {abbrev = "", color = "#9ACD32", shortname = "",},
["Saint Vincent Labour Party"] = {abbrev = "SVLP", color = "#CD5C5C", shortname = "",},
["Sąjūdis"] = {abbrev = "", color = "#3A923A", shortname = "",},
["Salceda Movement"] = {abbrev = "", color = "#A6CE37", shortname = "",},
["Salta Renewal Party"] = {abbrev = "", color = "#1E90FF", shortname = "",},
["Sam Rainsy Party"] = {abbrev = "SRP", color = "#0000FF", shortname = "",},
["Sama-Sama Tarlac"] = {abbrev = "", color = "#98FB98", shortname = "Sama-Sama Tarlac",},
["Samagi Jana Balawegaya"] = {abbrev = "SJB", color = "#43894d", shortname = "",},
["Samajbadi Party, Nepal"] = {abbrev = "", color = "#FFC0CB", shortname = "Samajbadi",},
["Samajbadi Prajatantrik Janata Party, Nepal"] = {abbrev = "", color = "#c03000", shortname = "Samajbadi Prajatantrik Janata Party",},
["Samajwadi Alliance"] = {abbrev = "", color = "Red", shortname = "",},
["Samajwadi Forward Bloc"] = {abbrev = "SFB", color = "#FFFF00", shortname = "",},
["Samajwadi Jan Parishad"] = {abbrev = "", color = "#669966", shortname = "",},
["Samajwadi Janata Party (Rashtriya)"] = {abbrev = "SJP(R)", color = "#74C365", shortname = "",},
["Samajwadi Janata Party"] = {abbrev = "SJP", color = "#00FF00", shortname = "",},
["Samajwadi Party"] = {abbrev = "SP", color = "#FF2222", shortname = "",},
["SAMAK"] = {abbrev = "", color = "#A4262A", shortname = "",},
["Samata Kranti Dal"] = {abbrev = "SKD", color = "#008080", shortname = "",},
["Samata Party"] = {abbrev = "", color = "#F26F21", shortname = "",},
["Samata Samaj Party"] = {abbrev = "SMSP", color = "#999966", shortname = "",},
["Samata Sangharsh Party"] = {abbrev = "SSGP", color = "#D0F5A9", shortname = "",},
["Samathuva Makkal Katchi"] = {abbrev = "SMK", color = "#fe0000", shortname = "",},
["Sámi Parliament of Norway"] = {abbrev = "", color = "#EB4B2D", shortname = "",},
["Sammarinese Christian Democratic Party"] = {abbrev = "PDCS", color = "#9CB2D8", shortname = "",},
["Sammarinese Communist Party"] = {abbrev = "PCS", color = "#C50B11", shortname = "",},
["Sammarinese Communist Refoundation"] = {abbrev = "RCS", color = "#3900FF", shortname = "",},
["Sammarinese Democratic Progressive Party"] = {abbrev = "PPDS", color = "#DD2A3D", shortname = "",},
["Sammarinese Democratic Socialist Party"] = {abbrev = "PSDS", color = "#FF0000", shortname = "",},
["Sammarinese Democratic Union"] = {abbrev = "UDS", color = "#000DC0", shortname = "",},
["Sammarinese Fascist Party"] = {abbrev = "", color = "black", shortname = "Fascist Party",},
["Sammarinese Independent Democratic Socialist Party"] = {abbrev = "PSDIS", color = "#FF0000", shortname = "",},
["Sammarinese National Alliance"] = {abbrev = "ANS", color = "#008CE4", shortname = "",},
["Sammarinese People's Party"] = {abbrev = "PPS", color = "#000033", shortname = "",},
["Sammarinese Populars"] = {abbrev = "PS", color = "#00CCFF", shortname = "",},
["Sammarinese Socialist Party"] = {abbrev = "PSS", color = "#EC062A", shortname = "",},
["Sammarinese Union of Moderates"] = {abbrev = "USDM", color = "#019AD3", shortname = "",},
["Sammarineses for Freedom"] = {abbrev = "SpL", color = "#005797", shortname = "",},
["Samoa First Party"] = {abbrev = "", color = "#823E0D", shortname = "",},
["Samoa Liberal Party"] = {abbrev = "", color = "#00CED1", shortname = "",},
["Samoa National Democratic Party"] = {abbrev = "", color = "#F50808", shortname = "",},
["Samoa Party"] = {abbrev = "SP", color = "#FFE8E8", shortname = "",},
["Samoa Progressive Political Party"] = {abbrev = "SPPP", color = "#FFE5B4", shortname = "",},
["Samoan Democratic United Party"] = {abbrev = "SDUP", color = "#75ff75", shortname = "",},
["Samoan National Development Party"] = {abbrev = "SNDP", color = "#75ff75", shortname = "",},
["Samoan United People's Party"] = {abbrev = "", color = "#EF9B0F", shortname = "",},
["Samopomich"] = {abbrev = "", color = "#2E8B57", shortname = "",},
["Samruddha Odisha"] = {abbrev = "SAMO", color = "yellow", shortname = "",},
["Samta Party"] = {abbrev = "SAP", color = "#fcad03", shortname = "",},
["Samyak Parivartan Party"] = {abbrev = "", color = "#292A0A", shortname = "",},
["Samyukta Janamorcha Nepal"] = {abbrev = "", color = "maroon", shortname = "Samyukta Janamorcha",},
["Samyukta Socialist Party"] = {abbrev = "SSP", color = "#33CC00", shortname = "",},
["Samyukta Vidhayak Dal"] = {abbrev = "", color = "#C171A1", shortname = "",},
["San Fernando de Henares Sí Puede"] = {abbrev = "", color = "#0D7C52", shortname = "",},
["San Marino Common Good"] = {abbrev = "SMBC", color = "#4DBB4B", shortname = "",},
["San Sebastián Independent Group"] = {abbrev = "", color = "#FE9936", shortname = "",},
["Sandinista National Liberation Front"] = {abbrev = "FSLN", color = "#8B0000", shortname = "",},
["Sandinista Renovation Movement"] = {abbrev = "MRS", color = "#FF8C00", shortname = "",},
["Sanghiya Loktantrik Rastriya Manch"] = {abbrev = "", color = "hotpink", shortname = "",},
["Sangkum"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Sanjukta Morcha"] = {abbrev = "", color = "#800000", shortname = "",},
["Sanlakas"] = {abbrev = "", color = "#0000CD", shortname = "",},
["Sanluquenian Alternative"] = {abbrev = "", color = "#DD6599", shortname = "",},
["Sanluqueños Independientes"] = {abbrev = "", color = "#FCDD09", shortname = "",},
["Santa Cruz Common Sense"] = {abbrev = "", color = "#0D468B", shortname = "",},
["Sanyukt Sangharsh Party"] = {abbrev = "SSP", color = "green", shortname = "SSP",},
["Sanyukt Samaj Morcha"] = {abbrev = "SSM", color = "#026D37", shortname = "SSM",},
["Saoradh"] = {abbrev = "", color = "#4A5D23", shortname = "",},
["Sarangani Reconciliation and Reformation Organization"] = {abbrev = "SARRO", color = "#B0E0E6", shortname = "",},
["Sarawak Chinese Association"] = {abbrev = "SCA", color = "", shortname = "",},
["Sarawak Malaysian People's Association"] = {abbrev = "PERMAS", color = "", shortname = "",},
["Sarawak National Party"] = {abbrev = "SNAP", color = "#717190", shortname = "",},
["Sarawak Parties Coalition"] = {abbrev = "", color = "#FF6060", shortname = "",},
["Sarawak People's Energy Party"] = {abbrev = "", color = "#F4A460", shortname = "",},
["Sarawak People's National Party"] = {abbrev = "NEGARA", color = "", shortname = "",},
["Sarawak Peoples' Party"] = {abbrev = "", color = "#57D757", shortname = "",},
["Sarawak United Party"] = {abbrev = "", color = "#FDF642", shortname = "",},
["Sarawak United Peoples' Party"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Sarawak Workers Party"] = {abbrev = "", color = "#E2E2C0", shortname = "",},
["Sarb Hind Shiromani Akali Dal"] = {abbrev = "", color = "#FF9900", shortname = "",},
["Sardinia Nation"] = {abbrev = "", color = "#E04C38", shortname = "",},
["Sardinian Action Party"] = {abbrev = "", color = "#282828", shortname = "Sardinian Action",},
["Sardinian Reformers"] = {abbrev = "", color = "#2B65EC", shortname = "",},
["Sarmu Probo Nisi"] = {abbrev = "", color = "#E0218A", shortname = "",},
["Sasna Tsrer Pan-Armenian Party"] = {abbrev = "", color = "#D42222", shortname = "",},
["Sauti ya Umma"] = {abbrev = "", color = "black", shortname = "",},
["Save Austria"] = {abbrev = "RETT", color = "yellow", shortname = "",},
["Save Bucharest Union"] = {abbrev = "", color = "#0000ff", shortname = "",},
["Save Chase Farm"] = {abbrev = "", color = "#0066FF", shortname = "",},
["Save Huddersfield NHS"] = {abbrev = "", color = "red", shortname = "",},
["Save Local Hospitals"] = {abbrev = "", color = "#FF4500", shortname = "",},
["Save NHS Group"] = {abbrev = "", color = "#9966CC", shortname = "",},
["Save Romania Union"] = {abbrev = "USR", color = "#00aae7", shortname = "",},
["Savior Party of Honduras"] = {abbrev = "PSH", color = "#4CC8EF", shortname = "",},
["Sawab (Mauritania)"] = {abbrev = "", color = "#5B9BD5", shortname = "Sawab",},
["Sawaba"] = {abbrev = "", color = "#0000ff", shortname = "",},
["Say No to European Union"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Scanian Party"] = {abbrev = "", color = "#009933", shortname = "",},
["Schallenberg Cabinet"] = {abbrev = "", color = "", shortname = "",},
["Scheduled Castes Federation"] = {abbrev = "SCF", color = "violet", shortname = "",},
["Schittulli Political Movement"] = {abbrev = "", color = "#1464BE", shortname = "Schittulli Movement",},
["Schleswig Party"] = {abbrev = "", color = "#FFFF00", shortname = "Schleswig",},
["Science Party (UK)"] = {abbrev = "", color = "white", shortname = "Science",},
["Science Party (Australia)"] = {abbrev = "", color = "#13C5E9", shortname = "",},
["Scotia Future"] = {abbrev = "", color = "#9063CD", shortname = "",},
["Scotland Against Crooked Lawyers"] = {abbrev = "SACL", color = "#008080", shortname = "",},
["Scottish Christian Party"] = {abbrev = "", color = "#9966CC", shortname = "Scottish Christian",},
["Scottish Conservatives"] = {abbrev = "", color = "#0087DC", shortname = "Conservative",},
["Scottish Democratic Alliance"] = {abbrev = "SDA", color = "MediumOrchid", shortname = "",},
["Scottish Ecology Party"] = {abbrev = "", color = "#6AB023", shortname = "Scottish Ecology",},
["Scottish Enterprise Party"] = {abbrev = "", color = "#3333CC", shortname = "Scottish Enterprise",},
["Scottish Families and Pensioners Party"] = {abbrev = "", color = "#BBD9DB", shortname = "",},
["Scottish Family Party"] = {abbrev = "", color = "#19369A", shortname = "Scottish Family",},
["Scottish Fishing Party"] = {abbrev = "", color = "#000000", shortname = "Fishing",},
["Scottish Greens"] = {abbrev = "", color = "#00B140", shortname = "Green",},
["Scottish Homeland Party"] = {abbrev = "", color = "#08088A", shortname = "",},
["Scottish Jacobite Party"] = {abbrev = "", color = "#9966CC", shortname = "Scottish Jacobite",},
["Scottish Labour Party (1888)"] = {abbrev = "", color = "#B22222", shortname = "Scottish Labour",},
["Scottish Labour Party (1976)"] = {abbrev = "SLP", color = "Darkred", shortname = "",},
["Scottish Labour"] = {abbrev = "", color = "#E4003B", shortname = "Labour",},
["Scottish Liberal Democrats"] = {abbrev = "", color = "#FAA61A", shortname = "Liberal Democrats",},
["Scottish Liberal Party"] = {abbrev = "", color = "#ffd700", shortname = "Liberal",},
["Scottish Libertarian Party"] = {abbrev = "", color = "#F0DC83", shortname = "Libertarian",},
["Scottish Militant Labour"] = {abbrev = "", color = "#a22f32", shortname = "",},
["Scottish National Party"] = {abbrev = "SNP", color = "#FDF38E", shortname = "",},
["Scottish Parliament"] = {abbrev = "", color = "#52318D", shortname = "",},
["Scottish Party"] = {abbrev = "", color = "#99CCFF", shortname = "",},
["Scottish Pensioners Party"] = {abbrev = "", color = "#BBD9DB", shortname = "Scottish Pensioners",},
["Scottish People's Alliance"] = {abbrev = "", color = "#87cefa", shortname = "Scottish People's",},
["Scottish Prohibition Party"] = {abbrev = "", color = "purple", shortname = "Scottish Prohibition",},
["Scottish Protestant League"] = {abbrev = "SPL", color = "#000000", shortname = "",},
["Scottish Republican Socialist Party"] = {abbrev = "", color = "gold", shortname = "Scottish Republican Socialist",},
["Scottish Senior Citizens Unity Party"] = {abbrev = "", color = "#CC66CC", shortname = "Scottish Senior Citizens",},
["Scottish Social and Liberal Democrats"] = {abbrev = "SLD", color = "#fdbb30", shortname = "",},
["Scottish Socialist Alliance"] = {abbrev = "", color = "#990033", shortname = "Scottish Socialist",},
["Scottish Socialist Party"] = {abbrev = "", color = "#ff0000", shortname = "Scottish Socialist",},
["Scottish Unionist Party (1986)"] = {abbrev = "", color = "#5555FF", shortname = "Scottish Unionist",},
["Scottish United Trades Councils Labour Party"] = {abbrev = "", color = "red", shortname = "Scottish Trades Councils",},
["Scottish Voice"] = {abbrev = "", color = "#660099", shortname = "",},
["Scottish Workers Republican Party"] = {abbrev = "", color = "red", shortname = "",},
["Scottish Workers' Representation Committee"] = {abbrev = "", color = "#b22222", shortname = "Scottish Workers",},
["SDP–Liberal Alliance"] = {abbrev = "", color = "#FFD700", shortname = "Alliance",},
["Se Puede Ganar Telde"] = {abbrev = "", color = "#6B309B", shortname = "",},
["Secular Party of India"] = {abbrev = "", color = "#66FF33", shortname = "",},
["Security, Order and Liberty"] = {abbrev = "", color = "#E46113", shortname = "",},
["Segni Pact – National Alliance"] = {abbrev = "", color = "#0054A5", shortname = "",},
["Segni Pact"] = {abbrev = "", color = "Gold", shortname = "",},
["Segovia en Común"] = {abbrev = "", color = "#931F1F", shortname = "",},
["Segoviemos"] = {abbrev = "", color = "#E85300", shortname = "",},
["Self Reliance (political party)"] = {abbrev = "", color = "#006B2D", shortname = "Self Reliance",},
["Self-Defence of the Republic of Poland"] = {abbrev = "SRP", color = "#FCD600", shortname = "",},
["Self-determination and Freedom"] = {abbrev = "", color = "#592E6B", shortname = "",},
["Self-employed Party"] = {abbrev = "", color = "#009999", shortname = "",},
["Self-employed Spanish Party"] = {abbrev = "", color = "#94BADE", shortname = "",},
["Self-Government (Faroe Islands)"] = {abbrev = "", color = "#E6327E", shortname = "Self-Government",},
["Self-Sacrifice National Democratic Party"] = {abbrev = "", color = "#29298C", shortname = "Fidokorlar",},
["Selston Area Independents"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Semangat 46"] = {abbrev = "", color = "#FFFF00", shortname = "",},
["Semilla (Guatemala)"] = {abbrev = "", color = "#00CCC9", shortname = "Semilla",},
["Senate 2001"] = {abbrev = "", color = "#1356A3", shortname = "",},
["Senator 21"] = {abbrev = "SEN21", color = "#00A2AD", shortname = "",},
["Senegalese Democratic Party"] = {abbrev = "PDS", color = "#427BBE", shortname = "",},
["Senior Citizens Party"] = {abbrev = "", color = "#8B2929", shortname = "Senior Citizens",},
["Senior Citizens' Party of Finland"] = {abbrev = "", color = "#E8FF14", shortname = "",},
["Seniors Solidarity Party"] = {abbrev = "", color = "#00FF00", shortname = "Seniors Solidarity",},
["Sephardim and Oriental Communities"] = {abbrev = "", color = "#0047AB", shortname = "",},
["Serb Democratic Party (Croatia)"] = {abbrev = "", color = "#38659C", shortname = "",},
["Serb Independent Party"] = {abbrev = "", color = "#AC6443", shortname = "",},
["Serb List (2012)"] = {abbrev = "", color = "darkred", shortname = "Serb List",},
["Serb List (Kosovo)"] = {abbrev = "", color = "#000080", shortname = "Serb List",},
["Serb List"] = {abbrev = "", color = "#173968", shortname = "",},
["Serb National Alliance"] = {abbrev = "SNS", color = "#CD00CD", shortname = "",},
["Serb People's Party (Croatia)"] = {abbrev = "SNS", color = "#C6363C", shortname = "",},
["Serb People's Party (Montenegro)"] = {abbrev = "SNS", color = "#e6e600", shortname = "",},
["Serb Progressive Party"] = {abbrev = "", color = "#242970", shortname = "",},
["Serbia 21"] = {abbrev = "S21", color = "#018FBF", shortname = "",},
["Serbian Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "SDS", color = "#38659C", shortname = "",},
["Serbian Democratic Party (Serbia)"] = {abbrev = "SDS", color = "#2957A4", shortname = "",},
["Serbian Democratic Renewal Movement"] = {abbrev = "", color = "#0C4BAC", shortname = "",},
["Serbian Left (2015)"] = {abbrev = "LS", color = "#ec1d25", shortname = "",},
["Serbian Left (2022)"] = {abbrev = "SL", color = "#C8373E", shortname = "",},
["Serbian National Party (2014)"] = {abbrev = "", color = "#0A377B", shortname = "",},
["Serbian National Renewal"] = {abbrev = "SNO", color = "#6184d8", shortname = "",},
["Serbian Party Oathkeepers"] = {abbrev = "SSZ", color = "#174B84", shortname = "Zavetnici",},
["Serbian Party of Socialists (Croatia)"] = {abbrev = "", color = "#C6363C", shortname = "",},
["Serbian Patriotic Alliance"] = {abbrev = "SPAS", color = "#1F305E", shortname = "",},
["Serbian People's Party (2014)"] = {abbrev = "", color = "#0A377B", shortname = "",},
["Serbian Progressive Party (historical)"] = {abbrev = "SNS", color = "#ABC8C0", shortname = "",},
["Serbian Progressive Party"] = {abbrev = "SNS", color = "#242970", shortname = "",},
["Serbian Radical Party \"9th January\""] = {abbrev = "", color = "blue", shortname = "",},
["Serbian Radical Party of Republika Srpska"] = {abbrev = "SRS RS", color = "#4682B4", shortname = "",},
["Serbian Radical Party"] = {abbrev = "SRS", color = "#0000FF", shortname = "",},
["Serbian Renewal Movement"] = {abbrev = "SPO", color = "#4B9CD3", shortname = "",},
["Serbian Right"] = {abbrev = "SD", color = "#A2006D", shortname = "",},
["Serbian Social Democratic Party (Kingdom of Serbia)"] = {abbrev = "SSDP", color = "#D21F1B", shortname = "",},
["Seri Manangkhasila Party"] = {abbrev = "", color = "#FF0800", shortname = "Seri Manangkhasila",},
["Servant of the People (political party)"] = {abbrev = "SN", color = "#38B34A", shortname = "",},
["Serve America Movement"] = {abbrev = "SAM", color = "#0F4D92", shortname = "",},
["Setembrista"] = {abbrev = "", color = "#990000", shortname = "",},
["Seven Star Movement"] = {abbrev = "", color = "#239DAC", shortname = "",},
["Severočeši.cz"] = {abbrev = "", color = "lightblue", shortname = "",},
["Seychelles Democratic Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["Seychelles National Party"] = {abbrev = "", color = "#059649", shortname = "",},
["Seychellois Alliance"] = {abbrev = "", color = "#47d1ed", shortname = "",},
["Sfida për Shqipërinë"] = {abbrev = "", color = "#F7941F", shortname = "",},
["Sha Tin Community Vision"] = {abbrev = "STCV", color = "#F39800", shortname = "",},
["Shakai Taishūtō"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Shan Nationalities Democratic Party"] = {abbrev = "SNDP", color = "#298000", shortname = "",},
["Shan Nationalities League for Democracy"] = {abbrev = "SNLD", color = "#FFE63B", shortname = "",},
["Shanti Party Nepal"] = {abbrev = "", color = "orange", shortname = "Shanti Party",},
["Shas"] = {abbrev = "", color = "#000000", shortname = "",},
["Shatin Community Network"] = {abbrev = "", color = "#97B0F8", shortname = "",},
["Shau Kei Wan East Future"] = {abbrev = "SKWEF", color = "#FEF013", shortname = "",},
["Sheppey First"] = {abbrev = "", color = "#999999", shortname = "",},
["Shepway Independents"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Shetland Movement"] = {abbrev = "", color = "#0065CC", shortname = "",},
["Shiji Seitō Nashi"] = {abbrev = "", color = "#6A1684", shortname = "",},
["Shimpotō"] = {abbrev = "", color = "#DD8888", shortname = "",},
["Shintō Hitori Hitori"] = {abbrev = "", color = "#00B0EC", shortname = "",},
["Shinui"] = {abbrev = "", color = "#3081C0", shortname = "",},
["Shirikisho Party of Kenya"] = {abbrev = "", color = "#ADD8E6", shortname = "Shirikisho",},
["Shirinyan-Babajanyan Alliance of Democrats"] = {abbrev = "", color = "#CD383A", shortname = "",},
["Shiromani Akali Dal (Amritsar)"] = {abbrev = "SAD(A)", color = "#FFCF00", shortname = "",},
["Shiromani Akali Dal (Mann)"] = {abbrev = "", color = "#797979", shortname = "",},
["Shiromani Akali Dal (Sanyukt)"] = {abbrev = "SAD(S)", color = "orangered", shortname = "",},
["Shiromani Akali Dal (Simranjit Singh Mann)"] = {abbrev = "SAD(M)", color = "#A9F5D0", shortname = "",},
["Shiromani Akali Dal"] = {abbrev = "SAD", color = "#0F204A", shortname = "",},
["Shiromani Gurdwara Parbandhak Committee"] = {abbrev = "SGPC", color = "#FF9933", shortname = "",},
["Shiromani Lok Dal"] = {abbrev = "SLD", color = "", shortname = "",},
["Shiv Sena (Rashtravadi)"] = {abbrev = "SHS(R)", color = "#61210B", shortname = "",},
["Shiv Sena"] = {abbrev = "SHS", color = "#F26F21", shortname = "",},
["Shivsena Nepal"] = {abbrev = "", color = "orange", shortname = "",},
["Shlomtzion (political party)"] = {abbrev = "", color = "#0047AB", shortname = "Shlomtzion",},
["Shooters, Fishers and Farmers Party"] = {abbrev = "", color = "#E52B50", shortname = "Shooters, Fishers, Farmers",},
["Shore Action"] = {abbrev = "", color = "#501557", shortname = "",},
["Shoshit Samaj Party"] = {abbrev = "SHSP", color = "#2EFE64", shortname = "",},
["Shōwakai"] = {abbrev = "", color = "#49A581", shortname = "",},
["Shura-i-Islam"] = {abbrev = "", color = "#000080", shortname = "",},
["Sí Cumple"] = {abbrev = "", color = "#FF8000", shortname = "",},
["Sí Es Pot Gandia"] = {abbrev = "", color = "#5E215C", shortname = "",},
["Sí Podemos Canarias"] = {abbrev = "", color = "#6F2965", shortname = "",},
["Sí se Puede Benidorm"] = {abbrev = "", color = "#7F3888", shortname = "",},
["Sí Se Puede Calvià"] = {abbrev = "", color = "#602F66", shortname = "",},
["Sí Se Puede Dos Hermanas"] = {abbrev = "", color = "#6A2C65", shortname = "",},
["Sí Se Puede Irun"] = {abbrev = "", color = "#620079", shortname = "",},
["Sí Se Puede Llucmajor"] = {abbrev = "", color = "#692F6C", shortname = "",},
["Sí Se Puede San Fernando"] = {abbrev = "", color = "#632C63", shortname = "",},
["Sí Se Puede Santurtzi"] = {abbrev = "", color = "#5B2E8B", shortname = "",},
["Sí Se Puede Valladolid"] = {abbrev = "", color = "#703167", shortname = "",},
["Sicilian Alliance"] = {abbrev = "", color = "#004F91", shortname = "",},
["Siegburger Citizens Union"] = {abbrev = "SBU", color = "#00437F", shortname = "",},
["Sierra Leone People's Party"] = {abbrev = "SLPP", color = "#006600", shortname = "",},
["Sierra Norte Independent Citizens"] = {abbrev = "", color = "#E3DAC9", shortname = "",},
["Sikkim Congress (Revolutionary)"] = {abbrev = "SC (R)", color = "#7F00FF", shortname = "",},
["Sikkim Democratic Front"] = {abbrev = "SDF", color = "#FFFC06", shortname = "",},
["Sikkim Himali Rajya Parishad"] = {abbrev = "SHRP", color = "#666600", shortname = "",},
["Sikkim Janata Congress"] = {abbrev = "SJC", color = "#0000FF", shortname = "",},
["Sikkim Janata Parishad"] = {abbrev = "SJP", color = "#5bb30e", shortname = "",},
["Sikkim Janata Party"] = {abbrev = "SJP", color = "#0000FF", shortname = "",},
["Sikkim Krantikari Morcha"] = {abbrev = "SKM", color = "#ED1E26", shortname = "",},
["Sikkim National Congress"] = {abbrev = "SNC", color = "#007FFF", shortname = "",},
["Sikkim National Party"] = {abbrev = "SNP", color = "#FF5F3F", shortname = "",},
["Sikkim National People’s Party"] = {abbrev = "SNPP", color = "#E11584", shortname = "",},
["Sikkim Prajatantra Congress"] = {abbrev = "SPC", color = "#00BFFF", shortname = "",},
["Sikkim Republican Party"] = {abbrev = "SRP", color = "#0a0f77", shortname = "",},
["Sikkim Sangram Parishad"] = {abbrev = "SSP", color = "#663300", shortname = "",},
["Sikkim State Congress"] = {abbrev = "SSC", color = "#0000FF", shortname = "",},
["Silesian Autonomy Movement"] = {abbrev = "RAŚ", color = "#144172", shortname = "",},
["Silver Legion of America"] = {abbrev = "", color = "#C0C0C0", shortname = "",},
["Silver Party"] = {abbrev = "", color = "#A3BFBA", shortname = "Silver",},
["Silver Republican Party"] = {abbrev = "", color = "#F2CED4", shortname = "Silver Republican",},
["Sind United Party"] = {abbrev = "SUP", color = "red", shortname = "",},
["Sindh National Front"] = {abbrev = "", color = "#ed1c24", shortname = "",},
["Sindh United Party"] = {abbrev = "SUP", color = "#F08080", shortname = "",},
["Singapore Alliance"] = {abbrev = "SA", color = "#7700EE", shortname = "",},
["Singapore Democratic Alliance"] = {abbrev = "SDA", color = "#CB00CC", shortname = "",},
["Singapore Democratic Party"] = {abbrev = "SDP", color = "#BC0001", shortname = "",},
["Singapore Justice Party"] = {abbrev = "SJP", color = "#CDCC00", shortname = "",},
["Singapore People's Alliance"] = {abbrev = "SPA", color = "#9933EE", shortname = "",},
["Singapore People's Party"] = {abbrev = "SPP", color = "#AA0099", shortname = "",},
["Singaporeans First"] = {abbrev = "", color = "#4365DD", shortname = "SingFirst",},
["Single Tax Party"] = {abbrev = "", color = "#4C915F", shortname = "Single Tax",},
["Sinhala Bhasa Peramuna"] = {abbrev = "", color = "#00008B", shortname = "",},
["Sinhalaye Mahasammatha Bhoomiputra Pakshaya"] = {abbrev = "", color = "#00008B", shortname = "",},
["Sinn Féin"] = {abbrev = "SF", color = "#326760", shortname = "Sinn Féin",},
["Sinn Féin (Anti-Treaty)"] = {abbrev = "SF", color = "#326760", shortname = "Sinn Féin (Anti-Treaty)",},
["Sinn Féin (Pro-Treaty)"] = {abbrev = "SF", color = "#326760", shortname = "Sinn Féin (Pro-Treaty)",},
["Sinn Féin The Workers' Party"] = {abbrev = "SF-WP", color = "#D73D3D", shortname = "Sinn Féin – The Workers' Party",},
["Sint Maarten Christian Party"] = {abbrev = "", color = "#A52A2A", shortname = "",},
["Sisi Kwa Sisi"] = {abbrev = "", color = "#CCFF99", shortname = "",},
["Siumut (pre-2021)"] = {abbrev = "", color = "#BF8E00", shortname = "",},
["Siumut"] = {abbrev = "", color = "#FF0909", shortname = "",},
["Siva Senai"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Skelmersdale Independent Party"] = {abbrev = "", color = "#ded9c3", shortname = "",},
["SKG Alliance"] = {abbrev = "", color = "#DC4A3E", shortname = "",},
["Skuteczni"] = {abbrev = "", color = "#ED1D25", shortname = "",},
["Slavic Party (Ukraine)"] = {abbrev = "", color = "#F528C3", shortname = "",},
["Slavonia-Baranja Croatian Party"] = {abbrev = "", color = "#00adef", shortname = "",},
["Sligo Ratepayers Association"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Sligo/Leitrim Independent Socialist Organisation"] = {abbrev = "", color = "#FF3300", shortname = "Independent Socialist",},
["Slough Independents"] = {abbrev = "", color = "silver", shortname = "",},
["Slovak Conservative Party"] = {abbrev = "", color = "#0F75BC", shortname = "",},
["Slovak Democratic and Christian Union – Democratic Party"] = {abbrev = "SDKÚ-DS", color = "#0750A4", shortname = "",},
["Slovak Democratic and Christian Union"] = {abbrev = "SDKÚ", color = "#0000FF", shortname = "",},
["Slovak Democratic Coalition"] = {abbrev = "SDK", color = "#FFDD00", shortname = "",},
["Slovak Green Party"] = {abbrev = "", color = "green", shortname = "",},
["Slovak National and Peasant Party"] = {abbrev = "SNaRS", color = "#062751", shortname = "",},
["Slovak National Party (historical)"] = {abbrev = "SNS", color = "#062751", shortname = "",},
["Slovak National Party"] = {abbrev = "SNS", color = "#253A79", shortname = "",},
["Slovak People's Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Slovak Togetherness"] = {abbrev = "", color = "#29166F", shortname = "",},
["Slovaks Forward"] = {abbrev = "SN", color = "#83D0F4", shortname = "",},
["Slovene Christian Democrats"] = {abbrev = "SKD", color = "#008000", shortname = "",},
["Slovene People's Party (historical)"] = {abbrev = "SLS", color = "#74ca37", shortname = "",},
["Slovene People's Party"] = {abbrev = "", color = "#89B688", shortname = "",},
["Slovenia is Ours"] = {abbrev = "", color = "#E50066", shortname = "",},
["Slovenian Democratic Party"] = {abbrev = "SDS", color = "#FCDC00", shortname = "",},
["Slovenian Democratic Union"] = {abbrev = "SDZ", color = "", shortname = "",},
["Slovenian National Party"] = {abbrev = "SNS", color = "#221F1F", shortname = "",},
["Slovenian People's Party"] = {abbrev = "SLS", color = "#74ca37", shortname = "",},
["Small Farmers Party"] = {abbrev = "", color = "forestgreen", shortname = "",},
["Small Farmers' Party of Finland"] = {abbrev = "", color = "forestgreen", shortname = "",},
["SNK European Democrats"] = {abbrev = "SNK ED", color = "#FFDF00", shortname = "",},
["SNK Union of Independents"] = {abbrev = "SNK SN", color = "#FFDF00", shortname = "",},
["Sobiranistes"] = {abbrev = "", color = "#D91770", shortname = "",},
["Sociaal-Liberale Partij"] = {abbrev = "", color = "purple", shortname = "",},
["Social Action Party (India)"] = {abbrev = "SLAP", color = "blue", shortname = "",},
["Social Action Party"] = {abbrev = "", color = "#00008B", shortname = "",},
["Social Agrarian Party"] = {abbrev = "", color = "#d3d3d3", shortname = "",},
["Social Agreement (Greece)"] = {abbrev = "", color = "#007A74", shortname = "",},
["Social Agreement"] = {abbrev = "", color = "#008080", shortname = "",},
["Social Alliance Party"] = {abbrev = "", color = "#da3927", shortname = "",},
["Social Alliance"] = {abbrev = "", color = "green", shortname = "",},
["Social Alternative Movement"] = {abbrev = "", color = "#9C1A34", shortname = "",},
["Social Alternative"] = {abbrev = "", color = "#000080", shortname = "",},
["Social and Basque Party"] = {abbrev = "", color = "#669933", shortname = "",},
["Social and Democratic Power"] = {abbrev = "", color = "#F0001C", shortname = "Podemos",},
["Social and Ecologist Left"] = {abbrev = "", color = "#604161", shortname = "",},
["Social and Liberal Democrats"] = {abbrev = "SLD", color = "#FAA61A", shortname = "",},
["Social and Political Assembly"] = {abbrev = "", color = "#D2003F", shortname = "",},
["Social Aragonese Movement"] = {abbrev = "", color = "#153D7B", shortname = "",},
["Social Christian Conservative Party"] = {abbrev = "", color = "#00008B", shortname = "",},
["Social Christian Democracy of Catalonia"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Social Christian Party (Brazil)"] = {abbrev = "PSC", color = "#009118", shortname = "",},
["Social Christian Party (Ecuador)"] = {abbrev = "PSC", color = "#FFD700", shortname = "",},
["Social Christian Reformist Party"] = {abbrev = "PSRC", color = "#DC143C", shortname = "",},
["Social Christian Republican Party"] = {abbrev = "PRSC", color = "#BC141A", shortname = "",},
["Social Christian Revolutionary Party"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Social Christian Unity Party"] = {abbrev = "PUSC", color = "#0454A3", shortname = "",},
["Social Commitment to Humanes"] = {abbrev = "", color = "#3883F6", shortname = "",},
["Social Convergence"] = {abbrev = "", color = "#FF1455", shortname = "",},
["Social Credit Party (New Zealand)"] = {abbrev = "", color = "#CBE800", shortname = "Social Credit",},
["Social Credit Party of Great Britain and Northern Ireland"] = {abbrev = "", color = "#228B22", shortname = "Social Credit",},
["Social Credit-NZ"] = {abbrev = "", color = "#CBE800", shortname = "Social Credit",},
["Social Democracy (Italy)"] = {abbrev = "", color = "#1E99C5", shortname = "",},
["Social Democracy (Serbia)"] = {abbrev = "SD", color = "red", shortname = "",},
["Social Democracy and Progress"] = {abbrev = "", color = "#AC2058", shortname = "",},
["Social Democracy of Poland"] = {abbrev = "SDPL", color = "#C8191E", shortname = "",},
["Social Democracy Party (Turkey)"] = {abbrev = "SODEP", color = "#e30000", shortname = "",},
["Social Democracy Party of Albania"] = {abbrev = "PDS", color = "#DA251C", shortname = "",},
["Social Democrat Hunchakian Party"] = {abbrev = "", color = "#c00", shortname = "",},
["Social Democrat Movement"] = {abbrev = "MDS", color = "#43B53C", shortname = "",},
["Social Democrat Party (Chile)"] = {abbrev = "", color = "#EE0000", shortname = "",},
["Social Democrat Radical Party"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Social Democratic Action of Croatia"] = {abbrev = "ASH", color = "blue", shortname = "",},
["Social Democratic Alliance"] = {abbrev = "", color = "#EA0038", shortname = "Social Democratic",},
["Social Democratic and Labour Party"] = {abbrev = "SDLP", color = "#2AA82C", shortname = "",},
["Social Democratic and Peasant Alternative Party"] = {abbrev = "", color = "#3333CC", shortname = "",},
["Social Democratic and Popular Convergence"] = {abbrev = "", color = "red", shortname = "",},
["Social Democratic Federation"] = {abbrev = "", color = "red", shortname = "",},
["Social Democratic Front (Cameroon)"] = {abbrev = "SDF", color = "#008142", shortname = "",},
["Social Democratic Harmony Party"] = {abbrev = "KDM", color = "#F6787F", shortname = "",},
["Social Democratic Initiative (Kosovo)"] = {abbrev = "NISMA", color = "#800080", shortname = "",},
["Social Democratic Institutional Bloc"] = {abbrev = "", color = "#ffb6c1", shortname = "",},
["Social Democratic Labour Party of Lithuania"] = {abbrev = "LSDDP", color = "#C1272D", shortname = "",},
["Social Democratic Labour Party of Norway"] = {abbrev = "", color = "#FF5050", shortname = "Social Democratic Labour",},
["Social Democratic League"] = {abbrev = "", color = "red", shortname = "",},
["Social Democratic Left Party of Sweden (1921)"] = {abbrev = "SSV", color = "#CC0000", shortname = "",},
["Social Democratic Left Party of Sweden"] = {abbrev = "SSV", color = "#b00000", shortname = "",},
["Social Democratic Liberal Party"] = {abbrev = "SODELPA", color = "#00529F", shortname = "",},
["Social Democratic Movement"] = {abbrev = "MDS", color = "#4CBB17", shortname = "Democrat",},
["Social Democratic Movement – Green Party of São Tomé and Príncipe"] = {abbrev = "", color = "#006600", shortname = "",},
["Social Democratic Party (Andorra)"] = {abbrev = "PS", color = "#E30613", shortname = "",},
["Social Democratic Party (Benin)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Social Democratic Party (Bolivia)"] = {abbrev = "", color = "#49796B", shortname = "",},
["Social Democratic Party (Bosnia and Herzegovina)"] = {abbrev = "SDP BiH", color = "#FF0000", shortname = "",},
["Social Democratic Party (Brazil, 1945–65)"] = {abbrev = "PSD", color = "#0087DC", shortname = "",},
["Social Democratic Party (Brazil, 1987–2003)"] = {abbrev = "", color = "#FAC72D", shortname = "",},
["Social Democratic Party (Brazil, 2011)"] = {abbrev = "PSD", color = "#FFA500", shortname = "",},
["Social Democratic Party (Cape Verde)"] = {abbrev = "", color = "#7c3479", shortname = "",},
["Social Democratic Party (Central African Republic)"] = {abbrev = "", color = "green", shortname = "",},
["Social Democratic Party (East Timor)"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Social Democratic Party (El Salvador)"] = {abbrev = "", color = "#F84000", shortname = "",},
["Social Democratic Party (Estonia)"] = {abbrev = "", color = "#E10600", shortname = "Social Democratic",},
["Social Democratic Party (Faroe Islands)"] = {abbrev = "", color = "#A73033", shortname = "Social Democratic",},
["Social Democratic Party (France)"] = {abbrev = "", color = "#E4007C", shortname = "",},
["Social Democratic Party (Gabon)"] = {abbrev = "", color = "#BA1A2E", shortname = "",},
["Social Democratic Party (Guinea-Bissau)"] = {abbrev = "", color = "#b22323", shortname = "",},
["Social Democratic Party (Iceland)"] = {abbrev = "", color = "#da2128", shortname = "Social Democratic",},
["Social Democratic Party (Japan, 1926)"] = {abbrev = "", color = "#CC3333", shortname = "",},
["Social Democratic Party (Latvia)"] = {abbrev = "", color = "#CE1326", shortname = "",},
["Social Democratic Party (Luxembourg)"] = {abbrev = "", color = "darkorange", shortname = "",},
["Social Democratic Party (Malaysia)"] = {abbrev = "SDP", color = "", shortname = "",},
["Social Democratic Party (Mexico)"] = {abbrev = "", color = "#e02128", shortname = "",},
["Social Democratic Party (Moldova)"] = {abbrev = "", color = "#FF4040", shortname = "",},
["Social Democratic Party (New Zealand)"] = {abbrev = "", color = "#FF79BC", shortname = "Social Democrat",},
["Social Democratic Party (Niger)"] = {abbrev = "", color = "#9ECF40", shortname = "",},
["Social Democratic Party (Nigeria)"] = {abbrev = "SDP", color = "#e67819", shortname = "",},
["Social Democratic Party (Papua New Guinea)"] = {abbrev = "", color = "#FF1900", shortname = "",},
["Social Democratic Party (Portugal)"] = {abbrev = "PSD", color = "#FF9900", shortname = "",},
["Social Democratic Party (Romania)"] = {abbrev = "PSD", color = "#ED2128", shortname = "",},
["Social Democratic Party (Rwanda)"] = {abbrev = "PSD", color = "#00BFFF", shortname = "",},
["Social Democratic Party (Serbia)"] = {abbrev = "", color = "#FF004F", shortname = "",},
["Social Democratic Party (Spain, 1976)"] = {abbrev = "", color = "#8B0000", shortname = "",},
["Social Democratic Party (Spain)"] = {abbrev = "", color = "#D84927", shortname = "",},
["Social Democratic Party (Tajikistan)"] = {abbrev = "", color = "#213481", shortname = "",},
["Social Democratic Party (Thailand)"] = {abbrev = "", color = "red", shortname = "",},
["Social Democratic Party (UK, 1979)"] = {abbrev = "", color = "#8A795D", shortname = "Social Democrat (1979)",},
["Social Democratic Party (UK, 1988)"] = {abbrev = "SDP", color = "#2C478A", shortname = "",},
["Social Democratic Party (UK, 1990 - present)"] = {abbrev = "SDP", color = "#7D26CD", shortname = "",},
["Social Democratic Party (UK, 1990–present)"] = {abbrev = "SDP", color = "#D25469", shortname = "",},
["Social Democratic Party (UK)"] = {abbrev = "SDP", color = "#7D26CD", shortname = "",},
["Social Democratic Party (US)"] = {abbrev = "", color = "#FF3100", shortname = "Social Democrat",},
["Social Democratic Party \"Harmony\""] = {abbrev = "", color = "#EE222B", shortname = "Harmony",},
["Social Democratic Party \"Truth and Progress\""] = {abbrev = "", color = "#29B94C", shortname = "",},
["Social Democratic Party in the GDR"] = {abbrev = "SPD", color = "#FA0015", shortname = "",},
["Social Democratic Party of Albania (2021)"] = {abbrev = "", color = "#0C5D34", shortname = "",},
["Social Democratic Party of Albania"] = {abbrev = "PSD", color = "#EA131C", shortname = "",},
["Social Democratic Party of America"] = {abbrev = "", color = "#FF3300", shortname = "Social Democratic",},
["Social Democratic Party of Austria"] = {abbrev = "SPÖ", color = "#ce000c", shortname = "",},
["Social Democratic Party of Catalonia"] = {abbrev = "", color = "#B83F34", shortname = "",},
["Social Democratic Party of Croatia and Slavonia"] = {abbrev = "", color = "#FE3B3B", shortname = "",},
["Social Democratic Party of Croatia"] = {abbrev = "SDP", color = "#ED1C24", shortname = "",},
["Social Democratic Party of Finland"] = {abbrev = "", color = "#F54B4B", shortname = "Social Democratic",},
["Social Democratic Party of Germany"] = {abbrev = "SPD", color = "#EB001F", shortname = "",},
["Social Democratic Party of Hungary"] = {abbrev = "MSZDP", color = "#BE1F2E", shortname = "",},
["Social Democratic Party of India"] = {abbrev = "SDPI", color = "#ED1C24", shortname = "",},
["Social Democratic Party of Japan"] = {abbrev = "", color = "#1CA9E9", shortname = "Social Democratic",},
["Social Democratic Party of Kenya"] = {abbrev = "SDP", color = "#D40000", shortname = "",},
["Social Democratic Party of Kosovo"] = {abbrev = "", color = "#EA394B", shortname = "",},
["Social Democratic Party of Kyrgyzstan"] = {abbrev = "SDPK", color = "#186498", shortname = "",},
["Social Democratic Party of Lithuania"] = {abbrev = "LSDP", color = "#E10514", shortname = "",},
["Social Democratic Party of Macedonia"] = {abbrev = "", color = "#E3000A", shortname = "",},
["Social Democratic Party of Madagascar"] = {abbrev = "PSD", color = "red", shortname = "",},
["Social Democratic Party of Melilla"] = {abbrev = "", color = "#4272BF", shortname = "",},
["Social Democratic Party of Montenegro"] = {abbrev = "SDP", color = "#C11B17", shortname = "",},
["Social Democratic Party of Russia (1990)"] = {abbrev = "", color = "#D8271D", shortname = "",},
["Social Democratic Party of Russia"] = {abbrev = "", color = "#D60A0B", shortname = "",},
["Social Democratic Party of Popular Accord"] = {abbrev = "SDPNZ", color = "pink", shortname = "",},
["Social Democratic Party of Serbia"] = {abbrev = "SDPS", color = "#FF355E", shortname = "",},
["Social Democratic Party of Slovakia"] = {abbrev = "", color = "#E02816", shortname = "",},
["Social Democratic Party of Switzerland"] = {abbrev = "", color = "#E53136", shortname = "Social Democrats",},
["Social Democratic Party of the Free City of Danzig"] = {abbrev = "", color = "red", shortname = "",},
["Social Democratic Party of Ukraine (united)"] = {abbrev = "SDPU(o)", color = "#FF011C", shortname = "",},
["Social Democratic Party of Ukraine"] = {abbrev = "SDPU", color = "#FE0002", shortname = "",},
["Social Democratic Party"] = {abbrev = "", color = "#FF3300", shortname = "Social Democratic",},
["Social Democratic People's Party (Turkey)"] = {abbrev = "", color = "#b03b3b", shortname = "",},
["Social Democratic Pole of Romania"] = {abbrev = "PDSR", color = "#ED2128", shortname = "",},
["Social Democratic Populist Party (Turkey)"] = {abbrev = "SHP", color = "#DD0000", shortname = "",},
["Social Democratic Progress Party"] = {abbrev = "PPSD", color = "#39d430", shortname = "",},
["Social Democratic Radical Party"] = {abbrev = "", color = "#CD5C5C", shortname = "Social Democrat Radical",},
["Social Democratic Rally"] = {abbrev = "", color = "#F15F26", shortname = "",},
["Social Democratic Union (Romania)"] = {abbrev = "USD", color = "#bf0202", shortname = "",},
["Social Democratic Union of Bosnia and Herzegovina"] = {abbrev = "", color = "red", shortname = "",},
["Social Democratic Union of Macedonia"] = {abbrev = "SDSM", color = "#bf1e24", shortname = "",},
["Social Democratic Workers' Party (Netherlands)"] = {abbrev = "SDAP", color = "#CC0000", shortname = "",},
["Social Democratic Workers' Party of Austria"] = {abbrev = "SDAPÖ", color = "#ce000c", shortname = "",},
["Social Democratic"] = {abbrev = "", color = "#FF3300", shortname = "",},
["Social Democrats (Denmark)"] = {abbrev = "", color = "#F04D46", shortname = "Social Democrats",},
["Social Democrats (Ireland)"] = {abbrev = "SD", color = "#752F8B", shortname = "Social Democrats",},
["Social Democrats (Kyrgyzstan)"] = {abbrev = "", color = "#01509F", shortname = "",},
["Social Democrats (Slovenia)"] = {abbrev = "SD", color = "#E3000F", shortname = "",},
["Social Democrats of America"] = {abbrev = "", color = "#ED1651", shortname = "",},
["Social Democrats of Montenegro"] = {abbrev = "SD", color = "#F04949", shortname = "",},
["Social Democrats, USA"] = {abbrev = "", color = "#DE2139", shortname = "",},
["Social Encounter Party"] = {abbrev = "PES", color = "#6E2F7D", shortname = "",},
["Social Forces Front"] = {abbrev = "", color = "red", shortname = "",},
["Social Green Regionalist Federation"] = {abbrev = "", color = "#83B926", shortname = "Social Green Regionalist",},
["Social Impulse (Spain)"] = {abbrev = "", color = "#AB5AFF", shortname = "",},
["Social Justice Party (Thailand)"] = {abbrev = "", color = "#32CD32", shortname = "Social Justice",},
["Social Justice Team"] = {abbrev = "", color = "#800080", shortname = "",},
["Social Justice, Citizen Participation"] = {abbrev = "", color = "#8E1F85", shortname = "",},
["Social Justice"] = {abbrev = "", color = "#B73622", shortname = "",},
["Social Labour Party"] = {abbrev = "PST", color = "#5C9CD7", shortname = "",},
["Social Liberal Humanist Party"] = {abbrev = "PUSL", color = "#0066B6", shortname = "",},
["Social Liberal Movement"] = {abbrev = "", color = "#EE7520", shortname = "",},
["Social Liberal Party (Belgium)"] = {abbrev = "", color = "purple", shortname = "",},
["Social Liberal Party (Brazil)"] = {abbrev = "PSL", color = "#008000", shortname = "",},
["Social Liberal Party (Maldives)"] = {abbrev = "", color = "#306", shortname = "",},
["Social Liberal Party (Tunisia)"] = {abbrev = "", color = "Orange", shortname = "",},
["Social Liberal Union"] = {abbrev = "USL", color = "#FFB901", shortname = "",},
["Social Movement for Renewal"] = {abbrev = "", color = "#cd5c5c", shortname = "",},
["Social National Unity Party"] = {abbrev = "", color = "#FFA500", shortname = "",},
["Social Nationalist Party"] = {abbrev = "", color = "#f0e68c", shortname = "",},
["Social Party Imberakuri"] = {abbrev = "", color = "#C71585", shortname = "",},
["Social Party of Gandia"] = {abbrev = "", color = "#8A368B", shortname = "",},
["Social Pole"] = {abbrev = "", color = "#ffa500", shortname = "",},
["Social Progress Party (Morocco)"] = {abbrev = "", color = "green", shortname = "",},
["Social Progressive Party"] = {abbrev = "PSP", color = "#FF7F50", shortname = "",},
["Social Progressive Union of Corvera"] = {abbrev = "", color = "#FF9600", shortname = "",},
["Social Reconciliation Reform and Development Party"] = {abbrev = "", color = "#051A39", shortname = "TURK Party",},
["Social Renewal Party (Angola)"] = {abbrev = "", color = "#FEB40A", shortname = "",},
["Social Republican Party"] = {abbrev = "PRS", color = "#153E7E", shortname = "",},
["Social Unity of Bierzo Electors"] = {abbrev = "", color = "#ED7224", shortname = "",},
["Social-National Party of Ukraine"] = {abbrev = "", color = "#A08903", shortname = "",},
["Socialism and Liberty Party"] = {abbrev = "PSOL", color = "#E2202A", shortname = "",},
["Socialist Action (Hong Kong)"] = {abbrev = "", color = "#FF0000", shortname = "Socialist Action",},
["Socialist Action (US)"] = {abbrev = "", color = "#CD3700", shortname = "Socialist Action",},
["Socialist Action Movement"] = {abbrev = "", color = "#41D842", shortname = "",},
["Socialist Action Party (Costa Rica)"] = {abbrev = "PASO", color = "#3B3C36", shortname = "",},
["Socialist Action Party (Spain)"] = {abbrev = "", color = "#CE2A29", shortname = "",},
["Socialist Alliance (Australia)"] = {abbrev = "", color = "#D40000", shortname = "",},
["Socialist Alliance (England)"] = {abbrev = "", color = "red", shortname = "Socialist Alliance",},
["Socialist Alliance (Sri Lanka)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Socialist Alternative – Putting People First"] = {abbrev = "", color = "#FFBBBB", shortname = "",},
["Socialist Alternative (UK)"] = {abbrev = "", color = "Red", shortname = "Socialist Alternative",},
["Socialist Alternative (US)"] = {abbrev = "", color = "#FF3300", shortname = "Socialist Alternative",},
["Socialist Alternative Politics"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Aotearoa"] = {abbrev = "", color = "#ff1100", shortname = "",},
["Socialist Arab Lebanon Vanguard Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Socialist Collective"] = {abbrev = "", color = "#F2808E", shortname = "",},
["Socialist Cooperation Party"] = {abbrev = "", color = "#00B034", shortname = "",},
["Socialist Current Organisation"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Democracy (Spain)"] = {abbrev = "", color = "#FF7F57", shortname = "",},
["Socialist Democracy of Guinea"] = {abbrev = "DSG", color = "red", shortname = "",},
["Socialist Democracy Party"] = {abbrev = "", color = "#D90000", shortname = "",},
["Socialist Democratic Federation (Japan)"] = {abbrev = "", color = "#FF0000", shortname = "Socialist Democratic",},
["Socialist Democratic Unionist Party"] = {abbrev = "", color = "#007A3D", shortname = "",},
["Socialist Democratic Vanguard Party"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Electoral League"] = {abbrev = "", color = "#dc0028", shortname = "Socialist",},
["Socialist Electoral Organisation of Workers and Smallholders"] = {abbrev = "", color = "#b30000", shortname = "",},
["Socialist Environmental Alliance"] = {abbrev = "", color = "#BB0000", shortname = "Socialist Environmental",},
["Socialist Equality Party (Germany)"] = {abbrev = "PSG", color = "#FF0000", shortname = "",},
["Socialist Equality Party (Sri Lanka)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Socialist Equality Party (UK)"] = {abbrev = "", color = "#960018", shortname = "Socialist Equality",},
["Socialist Equality Party (US)"] = {abbrev = "", color = "#D30101", shortname = "Socialist Equality",},
["Socialist Forces Front"] = {abbrev = "FFS", color = "#208CCC", shortname = "",},
["Socialist Front (Thailand)"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Green Unity Coalition"] = {abbrev = "", color = "#DD0000", shortname = "Socialist Unity",},
["Socialist Group"] = {abbrev = "SOC", color = "#F0001C", shortname = "",},
["Socialist Janata (Democratic)"] = {abbrev = "SJ(D)", color = "#138808", shortname = "",},
["Socialist Janata Dal"] = {abbrev = "", color = "#00FF66", shortname = "",},
["Socialist Janata Party"] = {abbrev = "SJP", color = "#0B2161", shortname = "",},
["Socialist Justice Party"] = {abbrev = "", color = "#990000", shortname = "Socialist Justice",},
["Socialist Labor Party of America"] = {abbrev = "", color = "#DD051D", shortname = "Socialist Labor",},
["Socialist Labour (India)"] = {abbrev = "SL", color = "", shortname = "",},
["Socialist Labour Party (Ireland)"] = {abbrev = "SLP", color = "#AD3030", shortname = "Socialist Labour",},
["Socialist Labour Party (UK)"] = {abbrev = "", color = "#EE1C25", shortname = "Socialist Labour",},
["Socialist Labour Party of Croatia"] = {abbrev = "", color = "#DD0000", shortname = "",},
["Socialist League (Venezuela)"] = {abbrev = "", color = "red", shortname = "",},
["Socialist League Vpered"] = {abbrev = "", color = "#FB0B0B", shortname = "",},
["Socialist Left (Argentina)"] = {abbrev = "IS", color = "#E20612", shortname = "Socialist Left",},
["Socialist Left (Peru)"] = {abbrev = "", color = "#FF7F50", shortname = "Socialist Left",},
["Socialist Left Party (Austria)"] = {abbrev = "", color = "#CC0033", shortname = "Socialist Left Party",},
["Socialist Left Party (Norway)"] = {abbrev = "", color = "#BC2149", shortname = "Socialist Left",},
["Socialist Mass Party"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Socialist Movement for Integration"] = {abbrev = "LSI", color = "#FF7070", shortname = "",},
["Socialist Nation Party"] = {abbrev = "SNP", color = "#EE82EE", shortname = "",},
["Socialist October"] = {abbrev = "", color = "#F00000", shortname = "",},
["Socialist Pact for Renewal"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Party – Broad Front of Ecuador"] = {abbrev = "", color = "#AA0000", shortname = "Socialist",},
["Socialist Party – Peasant Party"] = {abbrev = "SPU–SelPU", color = "#F6584D", shortname = "",},
["Socialist Party (Argentina)"] = {abbrev = "PS", color = "#FF9900", shortname = "Socialist Party",},
["Socialist Party (Belgium)"] = {abbrev = "PS", color = "#FF0000", shortname = "",},
["Socialist Party (Bolivia)"] = {abbrev = "", color = "#DC143C", shortname = "Socialist Party",},
["Socialist Party (Bosnia and Herzegovina)"] = {abbrev = "SP", color = "#FF4D4D", shortname = "",},
["Socialist Party (England and Wales)"] = {abbrev = "", color = "#ED1941", shortname = "Socialist Alternative",},
["Socialist Party (France)"] = {abbrev = "PS", color = "#ED1651", shortname = "",},
["Socialist Party (India)"] = {abbrev = "", color = "#33CC00", shortname = "Socialist",},
["Socialist Party (Ireland)"] = {abbrev = "SP", color = "#FF3300", shortname = "Socialist Party",},
["Socialist Party (Luxembourg)"] = {abbrev = "", color = "#CC0000", shortname = "Socialist Party",},
["Socialist Party (Morocco)"] = {abbrev = "", color = "#63D207", shortname = "Socialist Party",},
["Socialist Party (Netherlands, interbellum)"] = {abbrev = "SP", color = "#800000", shortname = "",},
["Socialist Party (Netherlands)"] = {abbrev = "SP", color = "#F60000", shortname = "",},
["Socialist Party (Northern Ireland)"] = {abbrev = "", color = "#FF3300", shortname = "Socialist Party",},
["Socialist Party (Portugal)"] = {abbrev = "PS", color = "#FF66FF", shortname = "",},
["Socialist Party (Ramakant Pandey)"] = {abbrev = "SOP(RP)", color = "#A9F5BC", shortname = "",},
["Socialist Party (San Marino)"] = {abbrev = "", color = "#4EB7F0", shortname = "",},
["Socialist Party (South Africa)"] = {abbrev = "", color = "#CD5C5C", shortname = "",},
["Socialist Party (South Korea)"] = {abbrev = "", color = "#041821", shortname = "",},
["Socialist Party (Sweden, 1929)"] = {abbrev = "", color = "#FF1F00", shortname = "Socialist",},
["Socialist Party (Tunisia)"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Party (US)"] = {abbrev = "", color = "#CD3700", shortname = "Socialist",},
["Socialist Party (Zambia)"] = {abbrev = "", color = "#DE2827", shortname = "",},
["Socialist Party \"Fatherland\""] = {abbrev = "", color = "#00ff00", shortname = "",},
["Socialist Party Differently"] = {abbrev = "sp.a", color = "#DC241F", shortname = "",},
["Socialist Party of Albania"] = {abbrev = "PS", color = "#5B15B4", shortname = "",},
["Socialist Party of America"] = {abbrev = "", color = "#CD3700", shortname = "Socialist",},
["Socialist Party of Andalusia (2001)"] = {abbrev = "", color = "#006A20", shortname = "",},
["Socialist Party of Aragon"] = {abbrev = "", color = "#FF4433", shortname = "",},
["Socialist Party of Azania"] = {abbrev = "", color = "#ff0000", shortname = "",},
["Socialist Party of Bangladesh"] = {abbrev = "BSD", color = "#E00024", shortname = "",},
["Socialist Party of Catalonia–Congress"] = {abbrev = "", color = "#E20002", shortname = "",},
["Socialist Party of Catalonia–Regrouping"] = {abbrev = "", color = "#DE2818", shortname = "",},
["Socialist Party of Chile"] = {abbrev = "", color = "#ED1624", shortname = "Socialist",},
["Socialist Party of Egypt"] = {abbrev = "", color = "#CE2029", shortname = "",},
["Socialist Party of Great Britain"] = {abbrev = "", color = "#DC241f", shortname = "Socialist (GB)",},
["Socialist Party of Greece"] = {abbrev = "", color = "#DA251D", shortname = "",},
["Socialist Party of Guinea-Bissau"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Party of Indonesia"] = {abbrev = "", color = "#FA0000", shortname = "Socialist",},
["Socialist Party of Ireland (1971)"] = {abbrev = "", color = "#FF3333", shortname = "Socialist Party of Ireland",},
["Socialist Party of Labour"] = {abbrev = "PSM", color = "#CC0000", shortname = "",},
["Socialist Party of Latvia"] = {abbrev = "", color = "#B4171E", shortname = "",},
["Socialist Party of Macedonia"] = {abbrev = "", color = "#C40000", shortname = "",},
["Socialist Party of Majorca"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Socialist Party of Malaysia"] = {abbrev = "", color = "#800000", shortname = "",},
["Socialist Party of Menorca"] = {abbrev = "PSM", color = "#F18E00", shortname = "",},
["Socialist Party of Moldova"] = {abbrev = "PSM", color = "#D8271F", shortname = "",},
["Socialist Party of National Liberation"] = {abbrev = "", color = "#FF6600", shortname = "",},
["Socialist Party of Peru (1930)"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Party of Republika Srpska"] = {abbrev = "", color = "#ff4500", shortname = "",},
["Socialist Party of Romania"] = {abbrev = "PS", color = "red", shortname = "",},
["Socialist Party of Senegal"] = {abbrev = "", color = "#007806", shortname = "",},
["Socialist Party of Serbia"] = {abbrev = "SPS", color = "#A60C19", shortname = "",},
["Socialist Party of Slovenia"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Socialist Party of Sri Lanka"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Party of Tajikistan"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Socialist Party of Thailand"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Socialist Party of the Andalusian People"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Socialist Party of the Islands"] = {abbrev = "", color = "#DC8F23", shortname = "",},
["Socialist Party of the People of Ceuta"] = {abbrev = "", color = "#CC9900", shortname = "",},
["Socialist Party of the Valencian Country (1974)"] = {abbrev = "", color = "#FEE46E", shortname = "",},
["Socialist Party of the Workers"] = {abbrev = "PST", color = "#000000", shortname = "",},
["Socialist Party of Timor"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Party of Ukraine"] = {abbrev = "SPU", color = "#640000", shortname = "",},
["Socialist Party of Uruguay"] = {abbrev = "", color = "#008000", shortname = "",},
["Socialist Party of Venezuela"] = {abbrev = "", color = "#6391B2", shortname = "",},
["Socialist Party of Yugoslavia"] = {abbrev = "SPJ", color = "red", shortname = "",},
["Socialist Party USA"] = {abbrev = "", color = "#CD3700", shortname = "Socialist",},
["Socialist Party-1"] = {abbrev = "", color = "#DF0024", shortname = "",},
["Socialist Party"] = {abbrev = "", color = "#DC241F", shortname = "Socialist",},
["Socialist People's Front (Ceylon)"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Socialist People's Party (Brazil)"] = {abbrev = "PPS", color = "#FF0000", shortname = "",},
["Socialist People's Party (Denmark)"] = {abbrev = "SF", color = "#BF031A", shortname = "",},
["Socialist People's Party (Furness)"] = {abbrev = "", color = "red", shortname = "Socialist People's Party",},
["Socialist People's Party (Norway)"] = {abbrev = "", color = "#dc0028", shortname = "Socialist People's",},
["Socialist People's Party of Montenegro"] = {abbrev = "SNP", color = "cornflowerblue", shortname = "",},
["Socialist Popular Alliance Party"] = {abbrev = "", color = "#E1A95F", shortname = "",},
["Socialist Radical Party (Chile)"] = {abbrev = "", color = "#EE1100", shortname = "",},
["Socialist Republican Coalition for Andalusia"] = {abbrev = "CRSxA", color = "#2B6631", shortname = "",},
["Socialist Republican Party (Bolivia)"] = {abbrev = "", color = "#C71585", shortname = "",},
["Socialist Republican Party (Ireland)"] = {abbrev = "", color = "#228B22", shortname = "Socialist Republican",},
["Socialist Republican Union"] = {abbrev = "USR", color = "#000000", shortname = "",},
["Socialist Resistance (Russia)"] = {abbrev = "", color = "#FE0000", shortname = "",},
["Socialist Resistance of Kazakhstan"] = {abbrev = "", color = "#FF0103", shortname = "",},
["Socialist Revolution Party (Turkey)"] = {abbrev = "SDP", color = "#CC3333", shortname = "",},
["Socialist Revolutionary Party"] = {abbrev = "SRs", color = "#B4121A", shortname = "",},
["Socialist Revolutionary Workers Party (South Africa)"] = {abbrev = "", color = "#ED1C1C", shortname = "",},
["Socialist Single Front"] = {abbrev = "", color = "#E25600", shortname = "",},
["Socialist Union of Catalonia"] = {abbrev = "", color = "#F2706E", shortname = "",},
["Socialist Union of Popular Forces"] = {abbrev = "USFP", color = "#E15691", shortname = "",},
["Socialist Unionist Party (Syria)"] = {abbrev = "", color = "#BF0202", shortname = "",},
["Socialist United Party of Russia"] = {abbrev = "", color = "#FB0713", shortname = "",},
["Socialist Unity (Italy)"] = {abbrev = "", color = "#FF8282", shortname = "Socialist Unity",},
["Socialist Unity (UK)"] = {abbrev = "", color = "#FF4D00", shortname = "Socialist Unity",},
["Socialist Unity Centre of India (Communist)"] = {abbrev = "SUCI(C)", color = "darksalmon", shortname = "",},
["Socialist Unity Centre of India"] = {abbrev = "SUCI", color = "Red", shortname = "",},
["Socialist Unity Party (Finland)"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Unity Party (New Zealand)"] = {abbrev = "", color = "#EA0A34", shortname = "Socialist Unity",},
["Socialist Unity Party (Turkey)"] = {abbrev = "SBP", color = "red", shortname = "",},
["Socialist Unity Party of Germany"] = {abbrev = "SED", color = "#DC241F", shortname = "",},
["Socialist Workers Party (Algeria)"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Workers Party (Argentina)"] = {abbrev = "PTS", color = "#FF6347", shortname = "Socialist Workers Party",},
["Socialist Workers Party (Britain)"] = {abbrev = "", color = "#FF355E", shortname = "Socialist Workers",},
["Socialist Workers Party (Denmark)"] = {abbrev = "", color = "#A52A2A", shortname = "Socialist Workers",},
["Socialist Workers Party (Finland)"] = {abbrev = "", color = "Red", shortname = "",},
["Socialist Workers Party (Ireland)"] = {abbrev = "", color = "#660000", shortname = "Socialist Workers",},
["Socialist Workers Party (US)"] = {abbrev = "", color = "#AA0000", shortname = "Socialist Workers",},
["Socialist Workers Party of Iran"] = {abbrev = "SWPI", color = "#AA0000", shortname = "",},
["Socialist Workers' Movement"] = {abbrev = "", color = "#CC0000", shortname = "",},
["Socialist Workers' Party (Chile)"] = {abbrev = "", color = "#810F0F", shortname = "",},
["Socialist Workers' Party (Greece)"] = {abbrev = "SEK", color = "red", shortname = "",},
["Socialist Workers' Party of Finland"] = {abbrev = "", color = "red", shortname = "",},
["Socialist Workers' Party of Germany"] = {abbrev = "", color = "#C40000", shortname = "",},
["Socialist Workers' Party of Turkey"] = {abbrev = "TSİP", color = "#FF0000", shortname = "",},
["Socialisti.sk"] = {abbrev = "", color = "#EF462B", shortname = "",},
["Socialists and Republicans (Spain)"] = {abbrev = "", color = "#8C5194", shortname = "",},
["Socialists for Cartagena"] = {abbrev = "", color = "#D01408", shortname = "",},
["Socialists for Reform"] = {abbrev = "SR", color = "#FF4B19", shortname = "",},
["Socialists for Teruel"] = {abbrev = "", color = "#CC3433", shortname = "",},
["Socialists of Catalonia"] = {abbrev = "", color = "#DB3537", shortname = "",},
["Socialists' Party of Catalonia"] = {abbrev = "PSC", color = "#FF001C", shortname = "",},
["Socialists' Unification of the Basque Country"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Society – Political Party of the Successors of Kapodistrias"] = {abbrev = "", color = "brown", shortname = "Society",},
["Society of Devotees of the Islamic Revolution"] = {abbrev = "SDIR", color = "#1963a4", shortname = "",},
["Society of Pathseekers of the Islamic Revolution"] = {abbrev = "SPIR", color = "#000", shortname = "",},
["Society of Seminary Teachers of Qom"] = {abbrev = "", color = "#8d9075", shortname = "Seminary Teachers",},
["Society of the Friends of Peasants"] = {abbrev = "", color = "#6495ED", shortname = "Bondevennerne",},
["Society Party (Norway, 1930s)"] = {abbrev = "", color = "#FFCC66", shortname = "Society",},
["Society Party (Norway)"] = {abbrev = "", color = "black", shortname = "",},
["Socio-Political Movement \"Equality\""] = {abbrev = "", color = "#017BBC", shortname = "",},
["Solidariedade"] = {abbrev = "", color = "#FF9C2B", shortname = "",},
["solidaritéS"] = {abbrev = "", color = "#DC143C", shortname = "",},
["Solidarity (Iceland)"] = {abbrev = "", color = "#FF8C00", shortname = "",},
["Solidarity (Ireland)"] = {abbrev = "", color = "#BF2D2E", shortname = "Solidarity",},
["Solidarity (Polish trade union)"] = {abbrev = "", color = "#F89AB5", shortname = "Solidarity",},
["Solidarity (Scotland)"] = {abbrev = "", color = "#a22f32", shortname = "Solidarity",},
["Solidarity (South African political party)"] = {abbrev = "", color = "red", shortname = "Solidarity",},
["Solidarity Action Movement"] = {abbrev = "MAS", color = "#BA1E12", shortname = "",},
["Solidarity Alliance of Georgia"] = {abbrev = "", color = "#12395A", shortname = "",},
["Solidarity and Progress"] = {abbrev = "SP", color = "#808080", shortname = "",},
["Solidarity Citizens' Committee"] = {abbrev = "KO \"S\"", color = "#F56914", shortname = "",},
["Solidarity Civic Unity"] = {abbrev = "", color = "#00A8EC", shortname = "",},
["Solidarity Electoral Action"] = {abbrev = "AWS", color = "#F2F2F2", shortname = "",},
["Solidarity Movement (Cyprus)"] = {abbrev = "", color = "#004B91", shortname = "Solidarity",},
["Solidarity Party (Illinois)"] = {abbrev = "", color = "Green", shortname = "Illinois Solidarity",},
["Solidarity Party (Panama)"] = {abbrev = "", color = "black", shortname = "Solidarity",},
["Solidarity Party (Thailand)"] = {abbrev = "", color = "#ffd700", shortname = "",},
["Solidarity"] = {abbrev = "", color = "#BF2D2E", shortname = "",},
["Solidary Democracy"] = {abbrev = "", color = "#449192", shortname = "",},
["Solidarity Encounter Party"] = {abbrev = "PES", color = "#702F8A", shortname = "",},
["Solidary Party"] = {abbrev = "", color = "#029C6A", shortname = "",},
["Solihull and Meriden Residents Association"] = {abbrev = "", color = "white", shortname = "Residents Association",},
["Solo San Fernando"] = {abbrev = "", color = "#237F7E", shortname = "",},
["Solomon Islands Democratic Party"] = {abbrev = "SIDP", color = "#012887", shortname = "Liberal Party",},
["Solomon Islands Liberal Party"] = {abbrev = "", color = "#02AABE", shortname = "Liberal Party",},
["Solomon Islands Party for Rural Advancement"] = {abbrev = "SIPRA", color = "#9fdacc", shortname = "",},
["Solomon Islands Social Credit Party"] = {abbrev = "", color = "red", shortname = "",},
["Solomon Islands United Party"] = {abbrev = "", color = "#0844d6", shortname = "",},
["Soluciona"] = {abbrev = "", color = "#F5572A", shortname = "",},
["Solution Movement"] = {abbrev = "MEMO", color = "", shortname = ""},
["Solutions Barbados"] = {abbrev = "SB", color = "#016EB1", shortname = "",},
["Som Alternativa"] = {abbrev = "", color = "#743C5D", shortname = "",},
["Som Catalans"] = {abbrev = "", color = "#EEEE22", shortname = "",},
["Som Gramenet"] = {abbrev = "", color = "#961D82", shortname = "",},
["Som Identitaris"] = {abbrev = "", color = "#EB751D", shortname = "",},
["Som Palma"] = {abbrev = "", color = "#C61D45", shortname = "",},
["Som Terres de l'Ebre"] = {abbrev = "", color = "#293A99", shortname = "",},
["Somali African National Union"] = {abbrev = "", color = "green", shortname = "",},
["Somali Revolutionary Socialist Party"] = {abbrev = "SRSP", color = "#FE2E2E", shortname = "",},
["Somali Youth League"] = {abbrev = "SYL", color = "#348AC9", shortname = "",},
["Something New (political party)"] = {abbrev = "", color = "#000000", shortname = "Something New",},
["Somos (Argentina)"] = {abbrev = "", color = "#E2007A", shortname = "Somos",},
["Somos Alcalá"] = {abbrev = "", color = "#9F26B5", shortname = "",},
["Somos Barbate"] = {abbrev = "", color = "#F36606", shortname = "",},
["Somos Benalmádena"] = {abbrev = "", color = "#D8A202", shortname = "",},
["Somos Benidorm"] = {abbrev = "", color = "#00F801", shortname = "",},
["SOMOS Citizen Action"] = {abbrev = "", color = "#36B8BB", shortname = "",},
["Somos Coslada"] = {abbrev = "", color = "#8224E3", shortname = "",},
["Somos Elda"] = {abbrev = "", color = "#3EACA9", shortname = "",},
["Somos Lanzarote"] = {abbrev = "", color = "#BBC116", shortname = "",},
["Somos Paracuellos"] = {abbrev = "", color = "#602F67", shortname = "",},
["Somos Región"] = {abbrev = "", color = "#F9EB4C", shortname = "",},
["Somos Valle de Egüés"] = {abbrev = "", color = "#660066", shortname = "",},
["Somos Velilla"] = {abbrev = "", color = "#66407B", shortname = "",},
["Somos"] = {abbrev = "", color = "#742F68", shortname = "",},
["Son (political party)"] = {abbrev = "", color = "#81BEF7", shortname = "",},
["Soqosoqo Duavata ni Lewenivanua"] = {abbrev = "SDL", color = "#73C2FB", shortname = "",},
["Soqosoqo ni Vakavulewa ni Taukei"] = {abbrev = "SVT", color = "lightblue", shortname = "",},
["Soria ¡Ya!"] = {abbrev = "", color = "#2C2B27", shortname = "",},
["Soria en Común"] = {abbrev = "", color = "#B117DC", shortname = "",},
["Sorian People's Platform"] = {abbrev = "", color = "#12689A", shortname = "",},
["Sorian@s"] = {abbrev = "", color = "#94319B", shortname = "",},
["Sortu"] = {abbrev = "", color = "#9C0C57", shortname = "",},
["SOS Nature"] = {abbrev = "", color = "#A5A608", shortname = "",},
["SOS Save Our Services"] = {abbrev = "", color = "#DDDDDD", shortname = "Save Our Services",},
["Soshit Dal"] = {abbrev = "", color = "#22409A", shortname = "",},
["South African Communist Party"] = {abbrev = "", color = "#FE0000", shortname = "",},
["South African Maintenance and Estate Beneficiaries Association"] = {abbrev = "", color = "#A67171", shortname = "",},
["South African National Congress of Traditional Authorities"] = {abbrev = "", color = "#6AA1EB", shortname = "",},
["South African Party"] = {abbrev = "", color = "#87CEEB", shortname = "South African",},
["South American Union of Italian Emigrants"] = {abbrev = "USEI", color = "#DEE573", shortname = "",},
["South Schleswig Voter Federation"] = {abbrev = "SSW", color = "#003C8F", shortname = "",},
["South Schleswig Voters' Association"] = {abbrev = "SSW", color = "#003C8F", shortname = "",},
["South Tyneside Progressives"] = {abbrev = "", color = "#808080", shortname = "Progressives",},
["South Tyrolean People's Party"] = {abbrev = "SVP", color = "#000000", shortname = "",},
["South Woodham Ferrers Independents"] = {abbrev = "", color = "#990099", shortname = "SWFCTA",},
["Southern Action League"] = {abbrev = "", color = "#00008B", shortname = "",},
["Southern Democratic (US)"] = {abbrev = "", color = "#4F990C", shortname = "Southern Democratic",},
["Southern Democratic Alliance"] = {abbrev = "SDA", color = "#000000", shortname = "",},
["Southern Ethiopian People's Democratic Movement"] = {abbrev = "", color = "#8700BC", shortname = "",},
["Southern Front (Sudan)"] = {abbrev = "SF", color = "#FF0000", shortname = "",},
["Southern Rhodesia Liberal Party"] = {abbrev = "", color = "yellow", shortname = "",},
["Southern Rights Party (US)"] = {abbrev = "", color = "#6AB023", shortname = "Southern Rights",},
["Sovereignists (Serbia)"] = {abbrev = "", color = "#3551B5", shortname = "Sovereignists",},
["Sovereign Armenia Party"] = {abbrev = "", color = "#092366", shortname = "",},
["Sovereign European Ukraine"] = {abbrev = "", color = "#1BD216", shortname = "",},
["Sovereign Independent Samoa Party"] = {abbrev = "", color = "#158AB6", shortname = "",},
["Sovereign People"] = {abbrev = "", color = "#832929", shortname = "",},
["Sovereignty and Liberty Bolivia"] = {abbrev = "SOL.bo", color = "#FDE102", shortname = "Sovereignty and Liberty",},
["Sovereignty for the Isles"] = {abbrev = "", color = "#F9C54A", shortname = "",},
["Sovereignty, Independence and Freedoms"] = {abbrev = "SIEL", color = "#000000", shortname = "",},
["Soyons libres"] = {abbrev = "", color = "#0055FF", shortname = "",},
["Soyuz (political party)"] = {abbrev = "", color = "#008FE4", shortname = "Soyuz",},
["Spade (political party)"] = {abbrev = "", color = "#4C834C", shortname = "Zastup",},
["Spain 2000"] = {abbrev = "", color = "#0058A9", shortname = "",},
["Spain Elders' Force"] = {abbrev = "", color = "#0C87B3", shortname = "",},
["Spanish Agrarian Party"] = {abbrev = "", color = "#3188AC", shortname = "",},
["Spanish Alternative"] = {abbrev = "", color = "#706F6D", shortname = "",},
["Spanish Catholic Movement"] = {abbrev = "", color = "#A50C18", shortname = "",},
["Spanish Christian Democratic Union"] = {abbrev = "", color = "#000087", shortname = "",},
["Spanish Communist Workers' Party"] = {abbrev = "", color = "#FB3D42", shortname = "",},
["Spanish Confederation of the Autonomous Right"] = {abbrev = "CEDA", color = "#0000C8", shortname = "",},
["Spanish Democratic Centre"] = {abbrev = "", color = "#8398F5", shortname = "",},
["Spanish Democratic Party"] = {abbrev = "", color = "#0E1B57", shortname = "",},
["Spanish Democratic Republican Action"] = {abbrev = "", color = "#73246B", shortname = "",},
["Spanish Democratic Segovian Party"] = {abbrev = "", color = "#BF82D2", shortname = "",},
["Spanish Democratic Socialist Party"] = {abbrev = "", color = "#ED2605", shortname = "",},
["Spanish Democratic Union"] = {abbrev = "", color = "#0D3082", shortname = "",},
["Spanish Digital Democratic Union"] = {abbrev = "", color = "#B6EF09", shortname = "",},
["Spanish Front"] = {abbrev = "", color = "#314173", shortname = "",},
["Spanish Liberal Project"] = {abbrev = "", color = "#FFD517", shortname = "",},
["Spanish National Union"] = {abbrev = "", color = "#0D2881", shortname = "",},
["Spanish Nationalist Party of Melilla"] = {abbrev = "", color = "#313131", shortname = "",},
["Spanish Patriotic Union"] = {abbrev = "", color = "#996B42", shortname = "",},
["Spanish People's Union"] = {abbrev = "", color = "#088A4B", shortname = "",},
["Spanish Ruralist Party"] = {abbrev = "", color = "#A9A067", shortname = "",},
["Spanish Social Reform"] = {abbrev = "", color = "#99B233", shortname = "",},
["Spanish Socialist Workers' Party"] = {abbrev = "PSOE", color = "#EF1C27", shortname = "",},
["Spanish Solidarity"] = {abbrev = "", color = "#030E40", shortname = "",},
["Speaker of the House of Commons (United Kingdom)"] = {abbrev = "Spkr", color = "white", shortname = "Speaker",},
["Speaker of the Northern Ireland Assembly"] = {abbrev = "", color = "#000000", shortname = "Speaker",},
["Spirit of Japan Party"] = {abbrev = "", color = "#E10000", shortname = "",},
["Spiritual Heritage"] = {abbrev = "", color = "#1F3C79", shortname = "",},
["Splinter (political party)"] = {abbrev = "", color = "#4500AB", shortname = "",},
["Spoilt"] = {abbrev = "", color = "#999999", shortname = "Spoilt Ballots",},
["Spolu (Czech Republic)"] = {abbrev = "", color = "#37349D", shortname = "SPOLU",},
["Sports and Peace Party"] = {abbrev = "", color = "black", shortname = "Sports & Peace",},
["Spring (political party)"] = {abbrev = "", color = "#4F2D8F", shortname = "",},
["Sramik Krishak Samajbadi Dal"] = {abbrev = "SKSD", color = "#F86F9D", shortname = "",},
["Sri Lanka Freedom Party"] = {abbrev = "", color = "#2A2B87", shortname = "",},
["Sri Lanka Freedom Socialist Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Sri Lanka Mahajana Pakshaya"] = {abbrev = "", color = "#92278f", shortname = "",},
["Sri Lanka Muslim Congress"] = {abbrev = "", color = "#007B48", shortname = "",},
["Sri Lanka People's Freedom Alliance"] = {abbrev = "SLPFA", color = "#991511", shortname = "",},
["Sri Lanka Podujana Peramuna"] = {abbrev = "SLPP", color = "#9D1B25", shortname = "",},
["St. Eustatius Empowerment Party"] = {abbrev = "", color = "#FFCE0D", shortname = "",},
["St. Maarten Christian Party"] = {abbrev = "", color = "#814C48", shortname = "",},
["St. Maarten Development Movement"] = {abbrev = "", color = "#808080", shortname = "",},
["Staffordshire Independent Group"] = {abbrev = "", color = "#848484", shortname = "",},
["Stand Up.BG! We are coming!"] = {abbrev = "IBG-NI", color = "#50BE5B", shortname = "",},
["Stand Up.BG"] = {abbrev = "IS.BG", color = "#5BA546", shortname = "",},
["State for the People"] = {abbrev = "", color = "red", shortname = "",},
["State of Law Coalition"] = {abbrev = "", color = "#FF0000", shortname = "State of Law",},
["State of Spain Unionist Party"] = {abbrev = "", color = "#285101", shortname = "",},
["State Reform of Nostradamus"] = {abbrev = "", color = "#4F81BC", shortname = "",},
["State Reform Party"] = {abbrev = "STAR", color = "#E8C0F2", shortname = "",},
["States' Rights Party"] = {abbrev = "", color = "#F5BCA9", shortname = "States' Rights",},
["Statt Party"] = {abbrev = "", color = "darkblue", shortname = "",},
["Stellar Blue Party"] = {abbrev = "", color = "#78ACF5", shortname = "",},
["Stolen Babies (Serbia)"] = {abbrev = "OBAP", color = "#2F3039", shortname = "",},
["Stop Common Core Party"] = {abbrev = "", color = "#FFFF33", shortname = "Stop Common Core",},
["Stop Immigration"] = {abbrev = "", color = "darkblue", shortname = "",},
["Stop Morsi campaign!"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Stram Kurs"] = {abbrev = "", color = "#0198E1", shortname = "Stram Kurs",},
["Strategy Aghmashenebeli"] = {abbrev = "", color = "#FF0000", shortname = "Strategy Builder",},
["Stratford First Independent"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Strength and Honor"] = {abbrev = "SiCh", color = "#0064B4", shortname = "",},
["Strength is in Unity (coalition)"] = {abbrev = "", color = "#6000A5", shortname = "Strength is in Unity",},
["Strength of Serbia Movement"] = {abbrev = "PSS", color = "#062A78", shortname = "",},
["Strong Ukraine"] = {abbrev = "", color = "#FFDD00", shortname = "",},
["Struggling People's Organization"] = {abbrev = "", color = "#EB0505", shortname = "",},
["Sudan African National Union"] = {abbrev = "SANU", color = "#000000", shortname = "",},
["Sudan People's Liberation Movement-in-Opposition"] = {abbrev = "", color = "#008000", shortname = "",},
["Sudan People's Liberation Movement"] = {abbrev = "SPLM", color = "#0F47AF", shortname = "",},
["Sudanese Communist Party"] = {abbrev = "", color = "#ED2224", shortname = "",},
["Sudanese Socialist Union"] = {abbrev = "SSU", color = "#02822D", shortname = "",},
["Sudanese Union – African Democratic Rally"] = {abbrev = "", color = "#000000", shortname = "",},
["Sudeten German Party"] = {abbrev = "SdP", color = "#964B00", shortname = "",},
["Sueña Torrevieja"] = {abbrev = "", color = "#CE5A59", shortname = "",},
["Suffolk Together"] = {abbrev = "", color = "#58FA58", shortname = "",},
["Suheldev Bharatiya Samaj Party"] = {abbrev = "SBSP", color = "#f5d50a", shortname = "",},
["Sulong Zambales Party"] = {abbrev = "SZP", color = "#ff0000", shortname = "",},
["SUMA Party"] = {abbrev = "", color = "#87CEFA", shortname = "",},
["Sumam"] = {abbrev = "", color = "#192758", shortname = "",},
["Sumar (electoral platform)"] = {abbrev = "", color = "#EF4B91", shortname = "Sumar",},
["Sumemos Chiclana"] = {abbrev = "", color = "#E41B3D", shortname = "",},
["Sumemos Vélez-Málaga"] = {abbrev = "", color = "#00959B", shortname = "",},
["Sumemos"] = {abbrev = "", color = "#51297B", shortname = "",},
["Sumeti Mukti Morcha"] = {abbrev = "", color = "#007587", shortname = "",},
["Summation"] = {abbrev = "", color = "white", shortname = "'Total'",}, -- TODO: Not a party but a missuse of the module to create a total row. Usages should be fixed and this removed.
["Sunni Ittehad Council"] = {abbrev = "SIC", color = "#2F4F4F", shortname = "",},
["Sunni Tehreek"] = {abbrev = "PST", color = "#98FB98", shortname = "",},
["Sunrise Party of Japan"] = {abbrev = "", color = "#3D107B", shortname = "",},
["Sunrise Party"] = {abbrev = "", color = "#f77321", shortname = "Sunrise",},
["Superannuitants and Youth Action"] = {abbrev = "", color = "#787878", shortname = "Superannuitants & Youth",},
["Supervision by the Lower Class"] = {abbrev = "", color = "#D19A72", shortname = "",},
["Supports Green Shoots"] = {abbrev = "", color = "#DDDDDD", shortname = "",},
["Surinamese Democratic Party"] = {abbrev = "SDP", color = "#FFFF00", shortname = "",},
["Surinamese Labour Party"] = {abbrev = "SPA", color = "red", shortname = "",},
["Sustainability Network"] = {abbrev = "REDE", color = "#379E8D", shortname = "",},
["Sustainable Australia"] = {abbrev = "", color = "#008751", shortname = "",},
["Sustainable Development of Croatia"] = {abbrev = "ORaH", color = "#869B20", shortname = "",},
["Sustainable Initiative"] = {abbrev = "", color = "#349835", shortname = "",},
["Sustainable Nation-Building Party"] = {abbrev = "PLT", color = "orange", shortname = "",},
["Sustainable New Zealand Party"] = {abbrev = "", color = "#008080", shortname = "Sustainable NZ",},
["Svoboda (political party)"] = {abbrev = "", color = "#0E294D", shortname = "Svoboda",},
["Svobodní"] = {abbrev = "", color = "#009682", shortname = "Svobodní",},
["Swabhimani Paksha"] = {abbrev = "SWP", color = "#D06767", shortname = "",},
["Swabian Group"] = {abbrev = "SB", color = "black", shortname = "",},
["Swantantra Party"] = {abbrev = "", color = "#0000FF", shortname = "",},
["SWANU"] = {abbrev = "", color = "#003580", shortname = "",},
["SWAPO"] = {abbrev = "", color = "#F0001C", shortname = "",},
["Swaraj Party"] = {abbrev = "SP", color = "#FFA07A", shortname = "",},
["Swarna Bharat Party"] = {abbrev = "", color = "#FFD700", shortname = "",},
["Swatantra Bharat Paksh"] = {abbrev = "", color = "blue", shortname = "",},
["Swatantra Party"] = {abbrev = "SWA", color = "Blue", shortname = "",},
["Swatantra Samaj Party"] = {abbrev = "SwSP", color = "yellow", shortname = "",},
["Swaziland Progressive Party"] = {abbrev = "", color = "purple", shortname = "",},
["Sweden Democrats"] = {abbrev = "SD", color = "#FEDF09", shortname = "Sweden Democrat",},
["Swedish National Socialist Party"] = {abbrev = "SNSP", color = "blue", shortname = "",},
["Swedish People's Party of Finland"] = {abbrev = "", color = "#007ac9", shortname = "Swedish People's",},
["Swedish Senior Citizen Interest Party"] = {abbrev = "", color = "#033001", shortname = "SPI-Senior Citizens",},
["Swedish Social Democratic Party"] = {abbrev = "S/SAP", color = "#ED1B34", shortname = "Social Democrat",},
["Swiss Democracy (Czech Republic)"] = {abbrev = "", color = "#D8232A", shortname = "",},
["Swiss Democrats"] = {abbrev = "", color = "#CD5B45", shortname = "",},
["Swiss Motorists' Party"] = {abbrev = "", color = "#8D1919", shortname = "Motorists'",},
["Swiss Party of Labour"] = {abbrev = "", color = "#E93C1A", shortname = "Labour",},
["Swiss People's Party"] = {abbrev = "", color = "#009F4F", shortname = "Swiss People's",},
["Swiss Progressive Organisations"] = {abbrev = "POCH", color = "#DC143C", shortname = "",},
["Synaspismos"] = {abbrev = "", color = "#FFD000", shortname = "",},
["Syndicalist Party"] = {abbrev = "", color = "#1C1004", shortname = "",},
["Synergy Kowloon"] = {abbrev = "", color = "#F37943", shortname = "",},
["Synergy of Macao"] = {abbrev = "", color = "#ABDBE5", shortname = "Sinergia",},
["Syrian Communist Party (Bakdash)"] = {abbrev = "", color = "#DE3533", shortname = "",},
["Syrian Communist Party (Unified)"] = {abbrev = "", color = "red", shortname = "",},
["Syrian Communist Party"] = {abbrev = "", color = "red", shortname = "",},
["Syrian Social Nationalist Party"] = {abbrev = "SSNP", color = "#000000", shortname = "",},
["Syriza"] = {abbrev = "", color = "#ee808f", shortname = "",},
}
return {
full = full,
alternate = alternate,
}
p620nr5avg7e64k4hg2fz22usnn0oqe
Module:Political party/W
828
68669705
1094004072
1094003999
2022-06-20T05:39:19Z
Impru20
15596619
Scribunto
text/plain
-- Constant data used by [[Module:Political party]]
local alternate = {
["Washington Democratic Party"] = "Democratic Party (US)",
["Washington Libertarian Party"] = "Libertarian Party (US)",
["Washington Non Partisan"] = "Non Partisan (Washington)",
["Washington Republican Party"] = "Republican Party (US)",
["Washington State Democratic Party"] = "Democratic Party (US)",
["Washington State Republican Party"] = "Republican Party (US)",
["We Are Europeans"] = "Action (Italian political party)",
["Welsh Conservative Party"] = "Welsh Conservatives",
["Welsh Labour Party"] = "Welsh Labour",
["Welsh Nation Party"] = "Propel (political party)",
["West Virginia Democratic Party"] = "Democratic Party (US)",
["West Virginia Republican Party"] = "Republican Party (US)",
["Western People's Front"] = "Democratic People's Front",
["Whig (British political faction)"] = "Whigs (British political party)",
["Whig (British political party)"] = "Whigs (British political party)",
["Whig Party (UK)"] = "Whigs (British political party)",
["Whig Party (United States)"] = "Whig Party (US)",
["Whig Party"] = "Whig Party (US)",
["Whig"] = "Whigs (British political party)",
["Whigs"] = "Whigs (British political party)",
["Who Owns the State? (2021)"] = "For a Humane Latvia",
["Wiper Democratic Movement - Kenya"] = "Wiper Democratic Movement – Kenya",
["Women's List (Iceland)"] = "Women's List",
["Worker's People Party of Puerto Rico"] = "Working People's Party of Puerto Rico",
["Workers and Unemployed Action Group"] = "Workers and Unemployed Action",
["Workers Communist Party (United States)"] = "Workers Communist Party (US)",
["Workers League Party (United States)"] = "Workers League Party (US)",
["Workers Party (Ireland)"] = "Workers' Party of Ireland",
["Workers Party of Ireland"] = "Workers' Party of Ireland",
["Workers' List Party"] = "Workers Organisation for Socialist Action",
["Workers' Party – The Communists"] = "Communist Party of Sweden (1995)",
["Workers' Party (Belgium)"] = "Workers' Party of Belgium",
["Workers' Party (Ireland)"] = "Workers' Party of Ireland",
["Workers' Party of Singapore"] = "Workers' Party (Singapore)",
["Workers' Revolutionary Party (Spain)"] = "Workers' Socialist Party (Spain)",
["Workers' Revolutionary Party (UK)"] = "Workers Revolutionary Party (UK)",
["Workers' Struggle"] = "Lutte Ouvrière",
["Working Families Party of New York"] = "Working Families Party",
["Workingmen's Party (California)"] = "Workingmen's Party of California",
}
local full = {
["Wa Democratic Party"] = {abbrev = "WDP", color = "#13A0E7", shortname = "",},
["Wa National Unity Party"] = {abbrev = "", color = "#018CC5", shortname = "",},
["Waddani"] = {abbrev = "", color = "#DC6015", shortname = "",},
["Wafa Movement"] = {abbrev = "", color = "Gold", shortname = "",},
["Wafd Party"] = {abbrev = "", color = "#1C6339", shortname = "Wafd",},
["Wake Up–Constitutionalist Sociopolitical Party"] = {abbrev = "", color = "#716E9F", shortname = "",},
["Wales Green Party"] = {abbrev = "", color = "#6AB023", shortname = "Green",},
["Wallonie d'Abord"] = {abbrev = "", color = "#FF0800", shortname = "",},
["Walloon Rally"] = {abbrev = "", color = "#FFFF01", shortname = "",},
["Walter Lee (Australian politician)"] = {abbrev = "", color = "darkblue", shortname = "Liberal (Lee)",},
["Wan Chai Community Union"] = {abbrev = "", color = "#E50500", shortname = "",},
["Washington Progressive Party"] = {abbrev = "", color = "#c64c4b", shortname = "Progressive",},
["Watani Party"] = {abbrev = "", color = "#5F9EA0", shortname = "Watani",},
["Water Natuurlijk"] = {abbrev = "WN", color = "#2799D6", shortname = "",},
["Waterford People's Party"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Way Out Alliance"] = {abbrev = "", color = "#F2A800", shortname = "",},
["We Are Andalusians Party"] = {abbrev = "", color = "#189100", shortname = "",},
["We Are Family (Slovakia)"] = {abbrev = "", color = "#034b9f", shortname = "We Are Family",},
["We Are Family"] = {abbrev = "", color = "#0b3f95", shortname = "",},
["We Are Future"] = {abbrev = "", color = "#F5C343", shortname = "",},
["We Are Peru – Purple Party"] = {abbrev = "", color = "#48379b", shortname = "",},
["We Are Peru"] = {abbrev = "", color = "#20488E", shortname = "",},
["We Are Valencian"] = {abbrev = "", color = "#0570FF", shortname = "",},
["We can! (Croatia)"] = {abbrev = "", color = "#C9E265", shortname = "",},
["We Citizens"] = {abbrev = "", color = "#ADD8E6", shortname = "",},
["We Continue the Change"] = {abbrev = "PP", color = "#FAD630", shortname = "",},
["We Demand a Referendum Now"] = {abbrev = "", color = "#5D8AA8", shortname = "We Demand a Referendum",},
["We Demand a Referendum"] = {abbrev = "", color = "#5D8AA8", shortname = "",},
["We Do for Córdoba"] = {abbrev = "HpC", color = "#0050A3", shortname = "",},
["We for the Republic"] = {abbrev = "NpIR", color = "#EE3338", shortname = "",},
["We Go Into It Together"] = {abbrev = "", color = "#312d8c", shortname = "Together",},
["We Have Had Enough!"] = {abbrev = "", color = "#C41117", shortname = "",},
["We Must (Serbia)"] = {abbrev = "", color = "#52AA42", shortname = "Moramo",},
["We Sammarineses"] = {abbrev = "NS", color = "#003979", shortname = "",},
["We Won't Pay this Crisis"] = {abbrev = "", color = "#CE1000", shortname = "",},
["We–Galician Candidacy"] = {abbrev = "", color = "#7CC4EA", shortname = "",},
["We, Party of Social Regeneration"] = {abbrev = "", color = "#DE6E3D", shortname = "",},
["Welfare Empower Hong Kong"] = {abbrev = "", color = "#EA622B", shortname = "",},
["Welfare Party of India"] = {abbrev = "WPOI", color = "#FF76F9", shortname = "",},
["Welfare Party"] = {abbrev = "", color = "#D60000", shortname = "Welfare",},
["Wellington Citizens League"] = {abbrev = "", color = "#B8BFFE", shortname = "Citizens League",},
["Wellington Citizens' Association"] = {abbrev = "", color = "#B8BFFE", shortname = "Citizens'",},
["Welsh Christian Party"] = {abbrev = "", color = "#400071", shortname = "Welsh Christian",},
["Welsh Communist Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Welsh Conservatives"] = {abbrev = "", color = "#0087DC", shortname = "Conservative",},
["Welsh Green Party"] = {abbrev = "", color = "#6AB023", shortname = "",},
["Welsh Labour"] = {abbrev = "", color = "#E4003B", shortname = "Labour",},
["Welsh Liberal Democrats"] = {abbrev = "", color = "#FAA61A", shortname = "Liberal Democrats",},
["Welsh Socialist Alliance"] = {abbrev = "", color = "red", shortname = "Socialist Alliance",},
["Werrington First"] = {abbrev = "", color = "#754B53", shortname = "",},
["Wessex Regionalist Party"] = {abbrev = "", color = "#318B58", shortname = "Wessex Regionalist",},
["West Dunbartonshire Community Party"] = {abbrev = "", color = "#C5000B", shortname = "West Dunbartonshire Community",},
["West Indian National Congress Party"] = {abbrev = "", color = "#31859C", shortname = "",},
["West Indies Democratic Labour Party"] = {abbrev = "", color = "#3399FF", shortname = "Democrat",},
["West Indies Federal Labour Party"] = {abbrev = "", color = "#FF0000", shortname = "Federalist",},
["West Suffolk Independent"] = {abbrev = "", color = "#6EFFC5", shortname = "",},
["Western Australia Party"] = {abbrev = "", color = "#000000", shortname = "",},
["Western Australian Liberal Party (1911–1917)"] = {abbrev = "", color = "#8CB4D2", shortname = "Liberal",},
["Whig Party (British political party)"] = {abbrev = "", color = "#819FF7", shortname = "Whig",},
["Whig Party (US)"] = {abbrev = "", color = "#F0C862", shortname = "Whig",},
["Whigs (British political party)"] = {abbrev = "", color = "#FF7F00", shortname = "Whig",},
["White Electoral Alliance"] = {abbrev = "", color = "darkblue", shortname = "",},
["White Party of Pensioners"] = {abbrev = "", color = "#A0A0A0", shortname = "",},
["Whitnash Residents Association"] = {abbrev = "", color = "lightpink", shortname = "Whitnash Residents",},
["Who Owns the State?"] = {abbrev = "", color = "#AD2027", shortname = "",},
["Whole Azerbaijan Popular Front Party"] = {abbrev = "", color = "#003399", shortname = "",},
["Wildrose Independence Party of Alberta"] = {abbrev = "", color = "#0F8753", shortname = "",},
["Winaq"] = {abbrev = "", color = "#EB1C22", shortname = "",},
["Windward Islands People's Movement"] = {abbrev = "WIPM", color = "#EC7123", shortname = "",},
["Wiper Democratic Movement – Kenya"] = {abbrev = "", color = "#00ADEF", shortname = "Wiper - Kenya",},
["Wirral Independent Network"] = {abbrev = "WIN", color = "#FFFFFF", shortname = "",},
["Wisconsin Green Party"] = {abbrev = "", color = "#17aa5c", shortname = "Green",},
["Wisconsin Progressive Party"] = {abbrev = "", color = "#5FD170", shortname = "Progressive",},
["Witchery Tour Party"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["With Monti for Italy"] = {abbrev = "", color = "#5A8BE3", shortname = "",},
["Without Fear Movement"] = {abbrev = "", color = "#7FFF00", shortname = "",},
["Women Forward"] = {abbrev = "", color = "#009FE3", shortname = "",},
["Women of Russia"] = {abbrev = "ZhR", color = "#5F9FDA", shortname = "",},
["Women's Equality Party (New York)"] = {abbrev = "", color = "#328DE0", shortname = "Women's Equality",},
["Women's Equality Party (UK)"] = {abbrev = "", color = "#64B69A", shortname = "",},
["Women's Equality Party"] = {abbrev = "", color = "#64B69A", shortname = "Women's Equality",},
["Women's International Zionist Organization"] = {abbrev = "WIZO", color = "#cd1b68", shortname = "",},
["Women's List"] = {abbrev = "", color = "#B60096", shortname = "",},
["Women's Party (Finland)"] = {abbrev = "", color = "violet", shortname = "",},
["Women's Party (South Korea)"] = {abbrev = "", color = "#6400AA", shortname = "Women's",},
["Women's Party (UK)"] = {abbrev = "", color = "#ff1493", shortname = "Women's Party",},
["Women's Society of Iran"] = {abbrev = "WSI", color = "#ee1c25", shortname = "",},
["Women's Union of Turkmenistan"] = {abbrev = "TZB", color = "#C20E1A", shortname = "",},
["Women's General Association of Macau"] = {abbrev = "AGMM", color = "#FA5A78", shortname = "",},
["Worker House"] = {abbrev = "WH", color = "#008d7d", shortname = "",},
["Worker Peasant Student and Popular Front"] = {abbrev = "", color = "#98E723", shortname = "",},
["Worker's Way"] = {abbrev = "WW", color = "#FF0000", shortname = "",},
["Workers (Communist) Party"] = {abbrev = "", color = "#D50000", shortname = "Workers (Communist)",},
["Workers and Socialist Party"] = {abbrev = "", color = "#cc0000", shortname = "",},
["Workers and Unemployed Action"] = {abbrev = "WUA", color = "#FA8072", shortname = "",},
["Workers Communist Party (US)"] = {abbrev = "", color = "#FF4900", shortname = "Workers Communist",},
["Workers Democratic Party"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Workers Fight"] = {abbrev = "", color = "#BB0000", shortname = "",},
["Workers for Democracy Coalition"] = {abbrev = "", color = "#F34723", shortname = "",},
["Workers League Party (US)"] = {abbrev = "", color = "#B7410E", shortname = "Workers League",},
["Workers Organisation for Socialist Action"] = {abbrev = "", color = "red", shortname = "",},
["Workers Party of America"] = {abbrev = "", color = "#f2072e", shortname = "Workers",},
["Workers Party of Bangladesh"] = {abbrev = "", color = "#992d46", shortname = "Workers Party",},
["Workers Party of Barbados"] = {abbrev = "", color = "Red", shortname = "",},
["Workers Party of Britain"] = {abbrev = "", color = "#DB251E", shortname = "Workers Party",},
["Workers Party of India"] = {abbrev = "WPI", color = "#F2F527", shortname = "",},
["Workers Party of New Zealand"] = {abbrev = "", color = "#FF0066", shortname = "Workers Party",},
["Workers Party of Socialist Unity"] = {abbrev = "", color = "#FF0000", shortname = "",},
["Workers Revolutionary Party (Greece)"] = {abbrev = "EEK", color = "#D40C0C", shortname = "",},
["Workers Revolutionary Party (UK)"] = {abbrev = "", color = "#AA0000", shortname = "Workers Revolutionary",},
["Workers World Party"] = {abbrev = "", color = "#FF33AA", shortname = "Workers World",},
["Workers' Cause Party"] = {abbrev = "PCO", color = "#95080E", shortname = "",},
["Workers' Communist Party (Italy)"] = {abbrev = "", color = "#DC142F", shortname = "Workers' Communist Party",},
["Workers' Communist Party (Spain)"] = {abbrev = "", color = "#DC3E52", shortname = "",},
["Workers' Communist Party of Bosnia and Herzegovina"] = {abbrev = "", color = "#ED1C24", shortname = "",},
["Workers' Front (Croatia)"] = {abbrev = "", color = "#cc0000", shortname = "",},
["Workers' General Party"] = {abbrev = "", color = "#006600", shortname = "",},
["Workers' Left Front"] = {abbrev = "", color = "#F65058", shortname = "FIT – Unidad",},
["Workers' Liberation Front (Curaçao)"] = {abbrev = "", color = "#FF7F00", shortname = "",},
["Workers' Movement Front"] = {abbrev = "", color = "#B23A3A", shortname = "",},
["Workers' Party (Algeria)"] = {abbrev = "PT", color = "#FF0000", shortname = "",},
["Workers' Party (Argentina)"] = {abbrev = "PO", color = "#8B0000", shortname = "Workers' Party",},
["Workers' Party (Bolivia)"] = {abbrev = "", color = "#8B0000", shortname = "Workers' Party",},
["Workers' Party (Brazil)"] = {abbrev = "PT", color = "#e20e28", shortname = "",},
["Workers' Party (Czech Republic)"] = {abbrev = "", color = "#555555", shortname = "Workers' Party",},
["Workers' Party (France)"] = {abbrev = "", color = "#B22222", shortname = "Workers' Party",},
["Workers' Party (Guinea-Bissau)"] = {abbrev = "", color = "red", shortname = "Workers' Party",},
["Workers' Party (Montenegro)"] = {abbrev = "", color = "#A71110", shortname = "Workers' Party",},
["Workers' Party (Paraguay)"] = {abbrev = "", color = "red", shortname = "Workers' Party",},
["Workers' Party (Singapore)"] = {abbrev = "WP", color = "#EE0000", shortname = "",},
["Workers' Party (Spain)"] = {abbrev = "", color = "#B51818", shortname = "Workers' Party",},
["Workers' Party (Tunisia)"] = {abbrev = "", color = "IndianRed", shortname = "Workers' Party",},
["Workers' Party (Turkey)"] = {abbrev = "İP", color = "#990033", shortname = "",},
["Workers' Party (Uruguay)"] = {abbrev = "", color = "#FF0000", shortname = "Workers' Party",},
["Workers' Party of Belgium"] = {abbrev = "PVDA-PTB", color = "#8B0000", shortname = "",},
["Workers' Party of Ethiopia"] = {abbrev = "", color = "#D71F01", shortname = "",},
["Workers' Party of Finland"] = {abbrev = "", color = "#FF4D00", shortname = "",},
["Workers' Party of Ireland"] = {abbrev = "WP", color = "#930C1A", shortname = "Workers' Party",},
["Workers' Party of Korea"] = {abbrev = "", color = "#CE1126", shortname = "Workers' Party",},
["Workers' Party of New Zealand (1991)"] = {abbrev = "", color = "#DC143C", shortname = "Workers' Party",},
["Workers' Party of North Korea"] = {abbrev = "", color = "#FF0000", shortname = "Workers' Party",},
["Workers' Party of Social Justice"] = {abbrev = "DSSS", color = "black", shortname = "Workers' Party",},
["Workers' Party of South Korea"] = {abbrev = "", color = "#FF0000", shortname = "Workers' Party",},
["Workers' Party of Spain–Communist Unity"] = {abbrev = "", color = "#B51818", shortname = "",},
["Workers' Party of Turkey"] = {abbrev = "TİP", color = "#B10A11", shortname = "",},
["Workers' Party"] = {abbrev = "", color = "red", shortname = "",},
["Workers' Revolutionary Organization (Spain)"] = {abbrev = "", color = "#4C252A", shortname = "",},
["Workers' Revolutionary Party (Mexico)"] = {abbrev = "", color = "#e32525", shortname = "",},
["Workers' Socialist Party (Spain)"] = {abbrev = "", color = "#AA1153", shortname = "",},
["Workers' Union (Faroe Islands)"] = {abbrev = "", color = "#b30000", shortname = "Workers' Union",},
["Workers' Union"] = {abbrev = "", color = "#C19A6B", shortname = "",},
["Workers' Vanguard Party"] = {abbrev = "", color = "#E34234", shortname = "",},
["Working Class Party"] = {abbrev = "", color = "#CC6699", shortname = "Working Class",},
["Working Families Party"] = {abbrev = "", color = "#f598e2", shortname = "Working Families",},
["Working People's Alliance"] = {abbrev = "", color = "red", shortname = "",},
["Working People's Party of Puerto Rico"] = {abbrev = "", color = "#9900CC", shortname = "",},
["Working People's Party (Moldova)"] = {abbrev = "POM", color = "#A12820", shortname = "",},
["Working People’s Party"] = {abbrev = "", color = "#800000", shortname = "",},
["Workingman's Party"] = {abbrev = "", color = "#D99FE8", shortname = "Workingman's",},
["Workingmen's Party of California"] = {abbrev = "", color = "#999999", shortname = "",},
["Workingmen's Party"] = {abbrev = "", color = "#999999", shortname = "",},
["World Economic Community Party"] = {abbrev = "", color = "#000000", shortname = "",},
["World Government Party"] = {abbrev = "", color = "#DDDDDD", shortname = "World Government",},
["World Socialist Party (New Zealand)"] = {abbrev = "", color = "#DD0048", shortname = "World Socialist",},
["Worth Area Party"] = {abbrev = "", color = "#666666", shortname = "",},
["Write-in candidate"] = {abbrev = "", color = "white", shortname = "Write-In",},
["Write-in"] = {abbrev = "", color = "#FFFFFF", shortname = "",},
["Wspólnota Samorządowa"] = {abbrev = "", color = "brown", shortname = "",},
["Wycombe Independent"] = {abbrev = "", color = "#FAEBD7", shortname = "",},
["Wyoming Democratic Party"] = {abbrev = "", color = "#3333FF", shortname = "Democratic",},
["Wyoming Libertarian Party"] = {abbrev = "", color = "#FED105", shortname = "Libertarian",},
["Wyoming Republican Party"] = {abbrev = "", color = "#E81B23", shortname = "Republican",},
}
return {
full = full,
alternate = alternate,
}
89c4yfzroypet71fwqi1beoci6gmcxn
Module:Portal
828
38965350
1091571056
1091413537
2022-06-05T03:15:40Z
Hike395
11639
extend image function to take border argument
Scribunto
text/plain
--[==[ This module is a Lua implementation of the old {{Portal}} template. As of February 2019 it is used on nearly 7,900,000 articles.
-- Please take care when updating it! It outputs two functions: p.portal, which generates a list of portals, and p.image, which
-- produces the image name for an individual portal.
-- The portal image data is kept in submodules of [[Module:Portal/images]], listed below:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
--
-- The images data pages are separated by the first letter to reduce server load when images are added, changed, or removed.
-- Previously all the images were on one data page at [[Module:Portal/images]], but this had the disadvantage that all
-- 5,000,000 pages using this module needed to be refreshed every time an image was added or removed.
]==]
local p = {}
-- determine whether we're being called from a sandbox
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true)
local sandbox = isSandbox and '/sandbox' or ''
local function sandboxVersion(s)
return isSandbox and s..'-sand' or s
end
local templatestyles = 'Module:Portal'..sandbox..'/styles.css'
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
-- List of non-talk namespaces which should not be tracked (Talk pages are never tracked)
local badNamespaces = {'user','template','draft','wikipedia'}
-- Check whether to do tracking in this namespace
-- Returns true unless the page is one of the banned namespaces
local function checkTracking(title)
local thisPage = title or mw.title.getCurrentTitle()
if thisPage.isTalkPage then
return false
end
local ns = thisPage.nsText:lower()
for _, v in ipairs(badNamespaces) do
if ns == v then
return false
end
end
return true
end
local function matchImagePage(s)
-- Finds the appropriate image subpage given a lower-case
-- portal name plus the first letter of that portal name.
if type(s) ~= 'string' or #s < 1 then return end
local firstLetter = mw.ustring.sub(s, 1, 1)
local imagePage
if mw.ustring.find(firstLetter, '^[a-z]') then
imagePage = 'Module:Portal/images/' .. firstLetter .. sandbox
else
imagePage = 'Module:Portal/images/other' .. sandbox
end
return mw.loadData(imagePage)[s]
end
local function getAlias(s)
-- Gets an alias from the image alias data page.
local aliasData = mw.loadData('Module:Portal/images/aliases'..sandbox)
for portal, aliases in pairs(aliasData) do
for _, alias in ipairs(aliases) do
if alias == s then
return portal
end
end
end
end
local function getImageName(s)
-- Gets the image name for a given string.
local default = 'Portal-puzzle.svg|link=|alt='
if type(s) ~= 'string' or #s < 1 then
return default
end
s = mw.ustring.lower(s)
return matchImagePage(s) or matchImagePage(getAlias(s)) or default
end
-- Function to check argument portals for errors, generate tracking categories if needed
-- Function first checks for too few/many portals provided
-- Then checks the portal list to purge any portals that don't exist
-- Arguments:
-- portals: raw list of portals
-- args.tracking: is tracking requested? (will not track on bad titles or namespaces)
-- args.redlinks: should redlinks be displayed?
-- args.minPortals: minimum number of portal arguments
-- args.maxPortals: maximum number of portal arguments
-- Returns:
-- portals = list of portals, with redlinks purged (if args.redlinks=false)
-- trackingCat = possible tracking category
-- errorMsg = error message
function p._checkPortals(portals, args)
local trackingCat = ''
local errMsg = nil
-- Tracking is on by default.
-- It is disabled if any of the following is true
-- 1/ the parameter "tracking" is set to 'no, 'n', or 'false'
-- 2/ the current page fails the namespace or pagename tests
local trackingEnabled = args.tracking and checkTracking()
args.minPortals = args.minPortals or 1
args.maxPortals = args.maxPortals or -1
-- check for too few portals
if #portals < args.minPortals then
errMsg = 'please specify at least '..args.minPortals..' portal'..(args.minPortals > 1 and 's' or '')
trackingCat = (trackingEnabled and '[[Category:Portal templates with too few portals]]' or '')
return portals, trackingCat, errMsg
end
-- check for too many portals
if args.maxPortals >= 0 and #portals > args.maxPortals then
errMsg = 'too many portals (maximum = '..args.maxPortals..')'
trackingCat = (trackingEnabled and '[[Category:Portal templates with too many portals]]' or '')
return portals, trackingCat, errMsg
end
if not args.redlinks or trackingEnabled then
-- make new list of portals that exist
local existingPortals = {}
for _, portal in ipairs(portals) do
local portalTitle = mw.title.new(portal,"Portal")
-- if portal exists, put it into list
if portalTitle and portalTitle.exists then
table.insert(existingPortals,portal)
-- otherwise set tracking cat
elseif trackingEnabled then
trackingCat = "[[Category:Portal templates with redlinked portals]]"
end
end
-- If redlinks is off, use portal list purged of redlinks
portals = args.redlinks and portals or existingPortals
-- if nothing left after purge, set tracking cat
if #portals == 0 and trackingEnabled then
trackingCat = trackingCat.."[[Category:Pages with empty portal template]]"
end
end
return portals, trackingCat, errMsg
end
function p._portal(portals, args)
-- This function builds the portal box used by the {{portal}} template.
-- Normalize all arguments
if args.redlinks == 'include' then args.redlinks = true end
args.addBreak = args['break']
for key, default in pairs({left=false,tracking=true,nominimum=false,
redlinks=false,addBreak=false,border=true}) do
if args[key] == nil then args[key] = default end
args[key] = yesno(args[key], default)
end
local root = mw.html.create('div')
:attr('role', 'navigation')
:attr('aria-label', 'Portals')
:addClass('noprint plainlist')
:addClass(sandboxVersion('portalbox'))
:addClass(args.border and sandboxVersion('portalborder') or '')
:addClass(args.left and 'tleft' or 'tright')
:css('margin', args.margin or nil)
:newline()
local trackingCat = ''
local errMsg = nil
args.minPortals = args.nominimum and 0 or 1
args.maxPortals = -1
portals, trackingCat, errMsg = p._checkPortals(portals, args)
root:wikitext(trackingCat)
-- if error message, put it in the box and return
if errMsg then
if args.border then -- suppress error message when border=no
local errTag = root:tag('strong')
errTag:addClass('error')
errTag:css('padding','0.2em')
errTag:wikitext('Error: '..errMsg)
end
return tostring(root)
end
-- if no portals (and no error), just return tracking category
if #portals == 0 then
return trackingCat
end
-- Start the list. This corresponds to the start of the wikitext table in the old [[Template:Portal]].
local listroot = root:tag('ul')
:css('width', (tonumber(args.boxsize) or 0) > 0 and (args.boxsize .. 'px') or args.boxsize)
-- Display the portals specified in the positional arguments.
for _, portal in ipairs(portals) do
local image = getImageName(portal)
-- Generate the html for the image and the portal name.
listroot
:newline()
:tag('li')
:tag('span')
:wikitext(string.format('[[File:%s|32x28px|class=noviewer]]', image))
:done()
:tag('span')
:wikitext(string.format('[[Portal:%s|%s%sportal]]', portal, portal, args.addBreak and '<br />' or ' '))
end
return tostring(root)
end
function p._image(portal,nostrip)
-- Wrapper function to allow getImageName() to be accessed through #invoke.
-- backward compatibility: if table passed, take first element
if type(portal) == 'table' then
portal = portal[1]
end
local name = getImageName(portal)
-- If nostrip is yes (or equivalent), then allow all metadata (like image borders) to be returned
local strip = not yesno(nostrip)
return strip and name:match('^(.-)|') or name -- FIXME: use a more elegant way to separate borders etc. from the image name
end
local function getAllImageTables()
-- Returns an array containing all image subpages (minus aliases) as loaded by mw.loadData.
local images = {}
for i, subpage in ipairs{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'other'} do
images[i] = mw.loadData('Module:Portal/images/' .. subpage .. sandbox)
end
return images
end
function p._displayAll(portals, args)
-- This function displays all portals that have portal images. This function is for maintenance purposes and should not be used in
-- articles, for two reasons: 1) there are over 1500 portals with portal images, and 2) the module doesn't record how the portal
-- names are capitalized, so the portal links may be broken.
local lang = mw.language.getContentLanguage()
local count = 1
for _, imageTable in ipairs(getAllImageTables()) do
for portal in pairs(imageTable) do
portals[count] = lang:ucfirst(portal)
count = count + 1
end
end
return p._portal(portals, args)
end
function p._imageDupes()
-- This function searches the image subpages to find duplicate images. If duplicate images exist, it is not necessarily a bad thing,
-- as different portals might just happen to choose the same image. However, this function is helpful in identifying images that
-- should be moved to a portal alias for ease of maintenance.
local exists, dupes = {}, {}
for _, imageTable in ipairs(getAllImageTables()) do
for portal, image in pairs(imageTable) do
if not exists[image] then
exists[image] = portal
else
table.insert(dupes, string.format('The image "[[:File:%s|%s]]" is used for both portals "%s" and "%s".', image, image, exists[image], portal))
end
end
end
if #dupes < 1 then
return 'No duplicate images found.'
else
return 'The following duplicate images were found:\n* ' .. table.concat(dupes, '\n* ')
end
end
local function processPortalArgs(args)
-- This function processes a table of arguments and returns two tables: an array of portal names for processing by ipairs, and a table of
-- the named arguments that specify style options, etc. We need to use ipairs because we want to list all the portals in the order
-- they were passed to the template, but we also want to be able to deal with positional arguments passed explicitly, for example
-- {{portal|2=Politics}}. The behaviour of ipairs is undefined if nil values are present, so we need to make sure they are all removed.
args = type(args) == 'table' and args or {}
local portals = {}
local namedArgs = {}
for k, v in pairs(args) do
if type(k) == 'number' and type(v) == 'string' then -- Make sure we have no non-string portal names.
table.insert(portals, k)
elseif type(k) ~= 'number' then
namedArgs[k] = v
end
end
table.sort(portals)
for i, v in ipairs(portals) do
portals[i] = args[v]
end
return portals, namedArgs
end
-- Entry point for sorting portals from other named arguments
function p._processPortalArgs(args)
return processPortalArgs(args)
end
function p.image(frame)
local origArgs = getArgs(frame)
local portals, args = processPortalArgs(origArgs)
return p._image(portals[1],args.border)
end
local function makeWrapper(funcName)
-- Processes external arguments and sends them to the other functions.
return function (frame)
-- If called via #invoke, use the args passed into the invoking
-- template, or the args passed to #invoke if any exist. Otherwise
-- assume args are being passed directly in from the debug console
-- or from another Lua module.
-- Also: trim whitespace and remove blank arguments
local origArgs = getArgs(frame)
-- create two tables to pass to func: an array of portal names, and a table of named arguments.
local portals, args = processPortalArgs(origArgs)
local results = ''
if funcName == '_portal' or funcName == '_displayAll' then
results = frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles} }
end
return results .. p[funcName](portals, args)
end
end
for _, funcName in ipairs{'portal', 'imageDupes', 'displayAll'} do
p[funcName] = makeWrapper('_' .. funcName)
end
return p
0vqcu0mwn75em98oq80rw0ijukpjya3
Module:Portal-inline
828
59591956
1091572083
1091415275
2022-06-05T03:25:23Z
Hike395
11639
automatically call [[Module:Portal/sandbox]] under test + new interface to getImageName
Scribunto
text/plain
-- determine whether we're being called from a sandbox
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true)
local sandbox = isSandbox and '/sandbox' or ''
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local portalModule = require('Module:Portal'..sandbox)
local getImageName = portalModule._image
local checkPortals = portalModule._checkPortals
local processPortalArgs = portalModule._processPortalArgs
local p = {}
-- Function to format error message and tracking category
-- Arguments:
-- errMsg: string, or nil/false if no error
-- trackingCat: string for tracking category (or empty string)
local function formatError(errMsg, trackingCat)
local result = trackingCat or ''
if errMsg then
local errTag = mw.html.create('span')
errTag:addClass("error")
errTag:css("font-size",'100%')
errTag:wikitext("Error: "..errMsg)
result = tostring(errTag)..result
end
return result
end
local function image(portal, args)
local size = args.size == "tiny" and "16x16px" or "32x28px"
return string.format('[[File:%s|class=noviewer|%s]]',getImageName(portal,true), size)
end
local function link(portal, args)
local displayName = ""
if not (args.text == "" or args.text == nil) then
displayName = args.text
elseif args.short then
displayName = portal
else
displayName = portal .. " portal"
end
return string.format('[[Portal:%s|%s]]',portal,displayName)
end
function p._main(portals, args)
mw.logObject(args)
-- Normalize all arguments
if args.redlinks == 'include' then args.redlinks = true end
for key, default in pairs({tracking=true,redlinks=false,short=false}) do
if args[key] == nil then args[key] = default end
args[key] = yesno(args[key], default)
end
local trackingCat = ''
local errMsg = nil
-- Check for existing categories, drop if not.
-- Possible generate tracking category & error message if needed
args.minPortals = args.minPortals or 1
args.maxPortals = args.maxPortals or 1
portals, trackingCat, errMsg = checkPortals(portals,args)
-- use more specific tracking cat for inline portal
trackingCat = mw.ustring.gsub(trackingCat,"Portal templates","Portal-inline template")
-- either too many/few portals, or no portals left after filtering, then return
if errMsg or #portals == 0 then
return formatError(errMsg, trackingCat)
end
return image(portals[1],args)..' '..link(portals[1],args)..(trackingCat or '')
end
function p.main(frame)
local origArgs = getArgs(frame)
local portals, args = processPortalArgs(origArgs)
return p._main(portals, args)
end
return p
eqso1qpy8gt5ovz86xa0197gijtlhkm
Module:Portal/images/b
828
40416112
1060369661
1046938495
2021-12-15T02:46:35Z
Paine Ellsworth
9092818
per edit request at [[Template talk:WikiProject BBC#Template-protected edit request on 14 December 2021]] - update portal logo
Scribunto
text/plain
--[==[ This is the "B" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "B". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be
-- omitted.
]==]
return {
["babism"] = "Haykal2.gif|link=|alt=",
["bacon"] = "Bacon close-up.jpg|link=|alt=",
["baden-württemberg"] = "Flag of Baden-Württemberg.svg|border|link=|alt=flag", ["badminton"] = "Badminton racquet.svg|link=|alt=",
["bahá'í faith"] = "Bahai star.svg|link=|alt=",
["bahrain"] = "Flag of Bahrain.svg|border|link=|alt=flag",
["baja california"] = "Flag of Baja California.svg|border|link=|alt=flag",
["baja california sur"] = "Flag of Baja California Sur.svg|border|link=|alt=flag",
["ballet"] = "Ballerina-icon.jpg|alt=icon",
["bailiwick of guernsey"] = "Flag of Guernsey.svg|border|link=|alt=flag",
["bailiwick of jersey"] = "Flag of Jersey.svg|border|link=|alt=flag",
["balochistan, pakistan"] = "Flag of Balochistan.svg|border|link=|alt=",
["baltic sea"] = "Baltic Sea location map.svg|link=|alt=map",
["baltic states"] = "Subdivisions of baltic states.svg|link=|alt=map",
["baltimore"] = "Seal of Baltimore, Maryland.png|link=|alt=seal",
["bananas"] = "Banana-Single.jpg|link=|alt=",
["bangalore"] = "Bangalore Palace.jpg|alt=icon",
["bangladesh premier league"] = "BPL.svg|link=|alt=",
["bangladesh"] = "Flag of Bangladesh.svg|border|link=|alt=flag",
["banks"] = "All-currency-symbol.svg|link=|alt=icon",
["baptists"] = "Baptism logo.jpg|link=|alt=",
["barack obama"] = "Obama.svg|link=|alt=",
["barbados"] = "Flag of Barbados.svg|border|link=|alt=flag",
["barbecue"] = "Grilling.jpg|link=|alt=",
["barcelona"] = "Flag of Barcelona.svg|alt=flag",
["barley"] = "2009-05-20-barnim-by-RalfR-23.jpg|link=|alt=",
["baseball"] = "Baseball.svg|link=|alt=icon",
["basketball"] = "Basketball Clipart.svg|link=|alt=icon",
["basque"] = "Lauburu.svg|link=|alt=",
["bates college"] = "1864 Bates Seal.jpg|link=|alt=seal",
["battleships"] = "BS Bismarck.png|alt=icon",
["battlestar galactica"] = "BattlestarMandala.svg|alt=icon",
["bavaria"] = "Flag of Bavaria (lozengy).svg|border|link=|alt=flag",
["bbc"] = "BBC Logo 2021.svg|link=|alt=",
["beer"] = "Projet bière logo v2.png|alt=icon",
["beef"] = "Standing-rib-roast.jpg|link=|alt=",
["beijing"] = "Beijing-name.svg|alt=icon",
["belarus"] = "Flag of Belarus.svg|border|link=|alt=flag",
["belfast"] = "Flag of Belfast.svg|link=|alt=flag",
["belgium"] = "Flag of Belgium.svg|border|link=|alt=flag",
["belgrade"] = "Flag of Belgrade.svg|alt=flag",
["belize"] = "Flag of Belize.svg|border|link=|alt=flag",
["belo horizonte"] = "Brasão de Belo Horizonte.svg|alt=icon",
["bengal"] = "BengaliScriptKo.svg|link=|alt=",
["bengali"] = "Bangla Script.svg|alt=icon",
["bengali cinema"] = "Emojione 1F3A5.svg|alt=icon",
["bengali literature"] = "Bhasha Smritistambha Arnab Dutta 2011.jpg|alt=icon",
["benin"] = "Flag of Benin.svg|border|link=|alt=flag",
["berat"] = "Stema e Bashkisë Berat.svg|alt=icon",
["berbers"] = "Berber flag.svg|border|link=|alt=flag",
["bergamo"] = "BERGAMO.png|alt=icon",
["berkshire"] = "Flag of Berkshire.svg|link=|alt=flag",
["berlin"] = "Flag of Berlin (state).svg|border|link=|alt=flag",
["bermuda"] = "Flag of Bermuda.svg|border|link=|alt=flag",
["beyoncé knowles"] = "Beyonce cropped2.jpg|link=|alt=",
["bhutan"] = "Flag of Bhutan.svg|border|link=|alt=flag",
["bible"] = "Bible.malmesbury.arp.jpg|link=|alt=",
["bibliographies/science task force"] = "Principia Page 1726.jpg|link=|alt=photo",
["bicycles"] = "Mountainbike-zeichnung.png|alt=|link=",
["bihar"] = "Seal of Bihar.jpg|link=|alt=",
["biochemistry"] = "ATP-3D-vdW.png|link=|alt=icon",
["biography"] = "P vip.svg|link=|alt=",
["biological warfare"] = "Anthrax culture.jpg|link=|alt=",
["biology"] = "Issoria lathonia.jpg|alt=icon",
["biotechnology"] = "TRNA-Phe yeast 1ehz.png|alt=icon",
["birds"] = "Eagle 01.svg|link=|alt=",
["björk"] = "Björk signature.png|link=|alt=",
["blackberries"] = "Blackberry fruit.jpg|link=|alt=",
["blu-ray"] = "Blu-ray disc2.png|alt=icon",
["blueberries"] = "Antioxidant-berries-bilberry-988870.jpg|link=|alt=",
["blues"] = "Guit Blues.JPG|link=|alt=",
["bob dylan"] = "Bob dylan.jpg|alt=icon",
["bob weir"] = "Weir, Bob (2007) 3.jpg|link=|alt=",
["boca raton, florida"] = "Seal of Boca Raton, Florida.gif|alt=seal",
["bohemia"] = "Flag of Bohemia.svg|border|link=|alt=flag",
["bohol"] = "Chocolate Hills.jpg|alt=icon",
["bolivia"] = "Flag of Bolivia.svg|border|link=|alt=flag",
["bollywood"] = "Indiafilm.svg|alt=icon",
["bonaire"] = "Flag of Bonaire.svg|border|link=|alt=flag",
["book of mormon"] = "Book of Mormon English Missionary Edition Soft Cover.jpg|link=|alt=",
["books"] = "Nuvola apps bookcase.svg|alt=icon",
["bosnia and herzegovina"] = "Flag of Bosnia and Herzegovina.svg|border|link=|alt=flag",
["boston"] = "Flag of Boston.svg|border|link=|alt=flag",
["botany"] = "Rosa villosa.jpg|alt=icon",
["botswana"] = "Flag of Botswana.svg|border|link=|alt=flag",
["bottled water"] = "1989 HK Sheung Wan Bonham Strand VITA Distilled Water.jpg|link=|alt=",
["boxing"] = "Icon-boxing-gloves.jpg|alt=icon",
["braga"] = "BRG.png|alt=icon",
["brandenburg"] = "Flag of Brandenburg.svg|border|link=|alt=flag",
["brandy norwood"] = "BrandyNorwoodJuly04.jpg|alt=icon",
["brazil"] = "Flag of Brazil.svg|border|link=|alt=flag",
["brazilian cuisine"] = "Brigadeiro.jpg|link=|alt=",
["bread"] = "Emojione 1F35E.svg|link=|alt=",
["breakfast"] = "Breakfast!.jpg|link=|alt=",
["bremen"] = "Flag of Bremen.svg|border|link=|alt=flag",
["briarcliff manor, new york"] = "BriarcliffOutlook4-crop.jpg|link=|alt=",
["bridges"] = "Pont-type-4-haubans.svg|alt=icon",
["bridges"] = "Pont-type-4-haubans.svg|alt=icon",
["brigham young university"] = "Brigham Young University medallion.svg|link=|alt=seal",
["brighton"] = "Brighton Royal Pavilion.jpg|alt=icon",
["brisbane"] = "Brisbane COA.gif|link=|alt=",
["bristol"] = "Bristol arms cropped.jpg|alt=icon",
["british army"] = "Flag of the British Army.svg|border|link=|alt=flag",
["british columbia"] = "Flag of British Columbia.svg|border|link=|alt=flag",
["british crown dependencies"] = "Royal Coat of Arms of the United Kingdom.svg|link=|alt=icon",
["british cuisine"] = "British Cuisine title.jpg|link=|alt=",
["british empire"] = "British Empire 1897.jpg|link=|alt=",
["british indian ocean territory"] = "Flag of the British Indian Ocean Territory.svg|border|link=|alt=flag",
["british library"] = "British library london.jpg|link=|alt=",
["british politics"] = "Royal Coat of Arms of the United Kingdom.svg|alt=icon",
["british virgin islands"] = "Flag of the British Virgin Islands.svg|border|link=|alt=flag",
["britney spears"] = "Baby One More Time 2009.jpg|alt=icon",
["brittany"] = "Flag of Brittany.svg|border|link=|alt=flag",
["brunei"] = "Flag of Brunei.svg|border|link=|alt=flag",
["bruneian cuisine"] = "Ambuyat in Bandar Seri Begawan Brunei.jpg|link=|alt=",
["brussels"] = "Flag Belgium brussels.svg|border|link=|alt=flag",
["bryan adams"] = "Bryan Adams Hamburg MG 0631 flickr.jpg|alt=icon",
["bucharest"] = "ROU Bucharest CoA.png|link=|alt=",
["buckinghamshire"] = "EnglandBuckinghamshire.png|alt=icon",
["budapest"] = "Coat of arms of Budapest.svg|link=|alt=",
["buddhism"] = "Dharma Wheel.svg|alt=icon",
["buenos aires"] = "Flag of Buenos Aires City.png|border|link=|alt=flag",
["buffy the vampire slayer"] = "Buffya.jpg|link=|alt=",
["bulgaria"] = "Flag of Bulgaria.svg|border|link=|alt=flag",
["bulgarian cuisine"] = "Lukanka.jpg|link=|alt=",
["bulgarian empire"] = "Coat of arms of the Second Bulgarian Empire.svg|alt=icon",
["burkina faso"] = "Flag of Burkina Faso.svg|border|link=|alt=flag",
["burmese cuisine"] = "IMG Mohinga.JPG|link=|alt=",
["burundi"] = "Flag of Burundi.svg|border|link=|alt=flag",
["busan"] = "Symbol of Busan.svg|alt=icon",
["buses"] = "BSicon BUS.svg|link=|alt=",
["business and economics"] = "Emblem-money.svg|alt=icon",
["butter"] = "Melting butter.jpg|link=|alt=",
["byzantine empire"] = "Flag of Palaeologus Dynasty.svg|border|link=|alt=flag"
}
k7672q46a7q5g6yuo7b6ay4bicfbm37
Module:Portal/images/c
828
40416122
1049613735
1045885582
2021-10-12T20:52:54Z
Ahecht
2016996
["clans of scotland"] = "Scottish clan map.png|link=|alt=map",
Scribunto
text/plain
--[==[ This is the "C" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "C". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be
-- omitted.
]==]
local ambox_globe = "Ambox globe.svg"
local hour=tonumber(os.date("%k"))
if hour >= 22 or hour < 6 then
ambox_globe = "Ambox globe Asia Australia.svg"
else
if hour >= 14 and hour < 22 then
ambox_globe = "Ambox globe Americas.svg"
end
end
return {
["cabo verde"] = "Flag of Cape Verde.svg|border|link=|alt=flag",
["cake"] = "Emojione 1F370.svg|link=|alt=",
["cakes"] = "Emojione 1F370.svg|link=|alt=",
["cairo"] = "Flag of Cairo.svg|alt=icon",
["cajun cuisine"] = "Crawfish dinner.jpg|link=|alt=",
["calgary"] = "Flag of Calgary, Alberta.svg|border|link=|alt=flag",
["california"] = "Flag of California.svg|border|link=|alt=flag",
["california central valley"] = "California Central Valley county map.svg|link=|alt=map",
["california delta"] = "California SD-03 (2011).svg|link=|alt=map",
["california roads"] = "California 1.svg|link=|alt=sign",
["california state highways"] = "California 1.svg|link=|alt=sign",
["california state polytechnic university, pomona"] = "Cal Poly logo.svg|link=|alt=logo",
["california state university"] = "Flag of California.svg|border|link=|alt=flag",
["calvinism"] = "Kreuz-hugenotten.svg|alt=icon",
["cambodia"] = "Flag of Cambodia.svg|border|link=|alt=flag",
["cameroon"] = "Flag of Cameroon.svg|border|link=|alt=flag",
["campeche"] = "Flag of Campeche.svg|border|link=|alt=flag",
["canada"] = "Maple Leaf (from roundel).svg|link=|alt=flag",
["canada/kawartha lakes"] = "Kawartha Lakes flag.svg|border|link=|alt=flag",
["canadian armed forces"] = "Canadian Forces emblem.svg|alt=icon",
["canadian communities"] = "Map Canada political-geo.png|link=|alt=",
["canadian cuisine"] = "Maple syrup.jpg|link=|alt=",
["canadian football"] = "Canadian football.png|alt=icon",
["canadian law"] = "Supreme Court of Canada.jpg|link=|alt=",
["canadian politics"] = "Can-vote-stub.svg|alt=icon",
["canadian territories"] = "Northern Canada.svg|alt=icon",
["canary islands"] = "Flag of the Canary Islands.svg|border|link=|alt=flag",
["candy"] = "Twemoji 1f36d.svg|link=|alt=",
["cannabis"] = "Cannabis leaf.svg|alt=icon",
["cape cod and the islands"] = "Nobska Lighthouse 1.jpg|alt=icon",
["cape verde"] = "Flag of Cape Verde.svg|border|link=|alt=flag",
["capsicum"] = "Large Cayenne.jpg|link=|alt=",
["capital district"] = "Empire State Plaza symbol 2.svg|link=|alt=",
["capitalism"] = "Capitalismlogo.svg|alt=icon",
["caracas"] = "Flag of Caracas.svg|alt=icon",
["cardiff"] = "Flag of Cardiff.svg|alt=icon",
["caribbean"] = "Relief Map of Caribbean.png|link=|alt=map",
["caribbean community"] = "Flag of CARICOM.svg|border|link=|alt=flag",
["carnivorous plants"] = "Digested fly.JPG|link=|alt=photo",
["cars"] = "Sportcar sergio luiz ara 01.svg|link=|alt=",
["cartoon network"] = "Cartoon Network.svg|border|link=|alt=",
["cartoon"] = "Mad scientist.svg|alt=icon",
["catalan-speaking countries"] = "Siñal d'Aragón.svg|border|alt=icon",
["catholic church"] = "046CupolaSPietro.jpg|border|alt=icon",
["catholicism"] = "046CupolaSPietro.jpg|border|alt=icon",
["cats"] = "Cat03.jpg|alt=icon",
["cayman islands"] = "Flag of the Cayman Islands.svg|border|link=|alt=flag",
["celine dion"] = "Celine Dion Concert Singing 'Taking Chances' 2008.jpg|alt=icon",
["celtic studies"] = "Celtic-knot-insquare-39crossings.svg|link=|alt=",
["central african republic"] = "Flag of the Central African Republic.svg|border|link=|alt=flag",
["central america"] = "Age of Consent - Central America.svg|alt=icon",
["central asia"] = "Central Asian Games participating countries.PNG|alt=icon",
["cerritos, california"] = "Cerritos City Seal (color).png|link=|alt=seal",
["cetaceans"] = "Sperm whale fluke.jpg|link=|alt=",
["chad"] = "Flag of Chad.svg|border|link=|alt=flag",
["chandigarh"] = "Gandhi Bhawan at Punjab University.jpg|alt=icon",
["channel islands"] = "Flag of Sark.svg|border|link=|alt=flag",
["charles dickens"] = "Charles Dickens 3.jpg|link=|alt=",
["charleston, west virginia"] = "CharlestonWVseal.gif|link=|alt=seal",
["charlotte"] = "Dilworth, Charlotte, NC, USA - panoramio.jpg|link=|alt=photo",
["charlottetown"] = "Flag of Charlottetown.svg|link=|alt=flag",
["chattanooga"] = "Flag of Chattanooga.svg|link=|alt=flag",
["chechnya"] = "Flag of the Chechen Republic.svg|border|link=|alt=flag",
["cheese"] = "Noto Emoji Oreo 1f9c0.svg|link=|alt=",
["cheese dishes"] = "NCI cream cheese bagel.jpg|link=|alt=",
["cheesehead"] = "Cheesehead.png|alt=icon",
["cheltenham township, montgomery county, pennsylvania"] = "Cheltenham PA township seal.svg|alt=seal|link=",
["chemistry"] = "Papapishu-Lab-icon-6.svg|link=|alt=",
["chennai"] = "Chennai High Court 1200x800.jpg|alt=icon",
["cher"] = "Cher Assinatura.png|link=|alt=",
["cherries"] = "Cherry Stella444.jpg|link=|alt=",
["cheshire"] = "Cheshire Flag.svg|border|alt=icon",
["chess"] = "Nuvola apps package games strategy.png|alt=icon",
["chhattisgarh"] = "India Chhattisgarh locator map.svg|border|link=|alt=map",
["chiapas"] = "Flag of Chiapas.svg|border|link=|alt=flag",
["chicago"] = "Seal of Chicago, Illinois.svg|link=|alt=",
["chicken"] = "Chicken icon 05.svg|link=|alt=",
["chihuahua"] = "Flag of Chihuahua.svg|border|link=|alt=flag",
["children's literature"] = "Tom Sawyer 1876 frontispiece.jpg|link=|alt=",
["chile"] = "Flag of Chile.svg|border|link=|alt=flag",
["chilean cuisine"] = "Curanto Chilote - Flickr - Renzo Disi.jpg|link=|alt=",
["chili pepper"] = "Chilli pepper 1.svg|link=|alt=",
["chili peppers"] = "Chilli pepper 1.svg|link=|alt=",
["china"] = "Flag of the People's Republic of China.svg|border|link=|alt=flag",
["chinese cuisine"] = "ChineseDishLogo.png|link=|alt=",
["chinese folk religion"] = "禄_lù_or_子_zi_symbol---red.svg|link=|alt=icon",
["chino, california"] = "Seal of Chino, California.png|link=|alt=seal",
["chittagong"] = "Beach View of the Saint Martin's Island.jpg|alt=icon",
["chocolate"] = "Chocolate02.jpg|link=|alt=",
["christadelphian"] = "John Thomas.png|link=|alt=John Thomas",
["christian democracy"] = "Orange flag waving.svg|alt=icon",
["christian hardcore"] = "Guitar 1.svg|link=|alt=icon",
["christian metal"] = "Guitar 1.svg|link=|alt=",
["christian music"] = "Musical note nicu bucule 01.svg|link=|alt=",
["christianity"] = "P christianity.svg|alt=icon",
["christianity in china"] = "Blessing message.svg|link=|alt=",
["christianity in india"] = "India with cross.svg|alt=icon",
["christina aguilera"] = "Christina Aguilera (at premiere of \"To John With Love\", September 2010).jpg|alt=icon",
["christmas"] = "Xmas tree.svg|link=|alt=",
["christmas island"] = "Flag of Christmas Island.svg|link=|alt=flag",
["chronology"] = "Crystal clock.svg|alt=",
["civilizations"] = "Lascar Avenue of the Dead and the Pyramid of the Sun in the background (4566574277).jpg|border|link=|alt=",
["civil rights movement"] = "Logo SNCC.svg|link=WP:ACRM|alt=",
["cincinnati"] = "Cincinnati Dusk Light.JPG|link=|alt=",
["cities"] = "COL-city icon.png|link=|alt=",
["city of bradford"] = "Coat of arms of Bradford City Council.png|alt=icon",
["city of port of spain"] = "POS Academy for the Performing Arts 03 2012 0960.JPG|alt=icon",
["city of san fernando"] = "HilltopSandoview.jpg|link=|alt=",
["clans of scotland"] = "Scottish clan map.png|link=|alt=map",
["classical antiquity"] = "2006 01 21 Athènes Parthénon.JPG|alt=icon",
["classical civilisation"] = "2006 01 21 Athènes Parthénon.JPG|alt=icon",
["classical guitar"] = "Classical Guitar two views2.png|alt=icon",
["classical music"] = "Audio a.svg|link=|alt=",
["classical tamil"] = "Word_Tamil.svg|link=|alt=word",
["cleveland"] = "Flag of Cleveland, Ohio.svg|border|link=|alt=flag",
["climate"] = "The Earth seen from Apollo 17 with transparent background.png|link=|alt=icon",
["climate change"] = "Climate change icon.png|link=|alt=icon",
["climbing"] = "Pictograms-nps-land-technical_rock_climbing.svg|link=|alt=icon",
["clothing"] = "Emojione 1F458.svg|alt=icon",
["coahuila"] = "Flag of Coahuila.svg|border|link=|alt=flag",
["cocktails"] = "Emojione BW 1F378.svg|link=|alt=",
["coconuts"] = "Brokencoconut.jpg|link=|alt=",
["cocos (keeling) islands"] = "Flag of the Cocos (Keeling) Islands.svg|border|link=|alt=flag",
["coffee"] = "Emblem-relax.svg|alt=icon",
["cognitive science"] = "Crystal mind.jpg|link=|alt=icon",
["cold war"] = "Cold War Map 1959.svg|alt=icon",
["colima"] = "Flag of Colima.svg|border|link=|alt=flag",
["college basketball"] = "Basketball.png|link=|alt=",
["college football"] = "NCAAFootball transparent.png|alt=icon",
["colombia"] = "Flag of Colombia.svg|border|link=|alt=flag",
["colonialism"] = "PithHelmetTruman.jpg|link=|alt=",
["color"] = "Colouring pencils.jpg|alt=icon",
["colorado"] = "Flag of Colorado.svg|border|link=|alt=flag",
["colorado school of mines"] = "CSM Seal.JPG|link=|alt=seal",
["colorado state university"] = "Colorado State University logo.png|link=|alt=logo",
["columbia university"] = "Columbia University Shield.svg|link=|alt=shield",
["columbia, missouri"] = "Greetings from Columbia, Missouri (73489).jpg|link=|alt=postcard",
["comedy"] = "SMirC-laugh.svg|alt=icon",
["comics"] = "Wikipetan-manga.png|alt=icon",
["commonwealth games"] = "Commonwealth Games Federation seal.svg|alt=icon",
["commonwealth realms"] = "Commonwealth Realms map2.png|alt=icon",
["communism"] = "Symbol-hammer-and-sickle.svg|link=|alt=",
["community"] = "P globe blue.png|alt=icon",
["comoros"] = "Flag of the Comoros.svg|border|link=|alt=flag",
["compact disc"] = "OD Compact disc.svg|link=|alt=CD",
["companies"] = "Industry5.svg|link=|alt=",
["complementary and alternative medicine"] = "Rod of Asclepius2.svg|alt=icon",
["computer graphics"] = "5-cell.gif|link=|alt=",
["computer networking"] = "Bus icon.svg|link=|alt=",
["computer programming"] = "Octicons-terminal.svg|alt=icon",
["computer science"] = "Internet map 1024.jpg|alt=icon",
["computer security"] = "Monitor padlock.svg|alt=icon",
["computer-generated imagery"] = "Gaussian.JPG|link=|alt=",
["condiments"] = "Toicon-icon-avocado-spice.svg|link=|alt=",
["confucianism"] = "木鐸 --- Confucian wooden-clapper bell.svg|link=|alt=icon",
["connecticut"] = "Flag of Connecticut.svg|border|link=|alt=flag",
["conservatism"] = "DodgerBlue flag waving.svg|link=|alt=",
["constructed languages"] = "Design conlang.png|alt=icon",
["contents"] = "Wikipedia's W.svg|link=|alt=",
["contents/indexes"] = "Pointing-right.svg|link=|alt=icon",
["contents/lists"] = "Liste.svg|link=|alt=icon",
["contents/outlines"] = "Pointing-left.svg|link=|alt=icon",
["continents"] = "Continents vide couleurs-automatedvector.svg|link=|alt=map",
["cooking"] = "One chef's hat.png|link=|alt=",
["cook islands"] = "Flag of the Cook Islands.svg|border|link=|alt=flag",
["cooperatives"] = "Twinpines.svg|link=|alt=",
["copenhagen"] = "Coat_of_arms_of_Copenhagen.svg|alt=icon",
["córdoba"] = "Escudo ciudad de cordoba argentina.svg|link=|alt=",
["cornell university"] = "Cornell University seal.svg|link=|alt=seal",
["cornhusker"] = "Nebraska silhouette.png|alt=icon",
["cornwall"] = "Flag of Cornwall.svg|border|link=|alt=flag",
["coronavirus disease 2019"] = "SARS-CoV-2 (Wikimedia colors).svg|alt=virus icon",
["cosmology"] = "Ilc 9yr moll4096.png|link=|alt=",
["costa rica"] = "Flag of Costa Rica.svg|border|link=|alt=flag",
["côte d'ivoire"] = "Flag of Côte d'Ivoire.svg|border|link=|alt=flag",
["countries"] = "P countries-vector.svg|alt=icon",
["country music"] = "Steel guitar-KayEss.1.jpeg|alt=icon",
["county kilkenny"] = "County Kilkenny arms.svg|alt=coat of arms",
["courtney love"] = "Noloveever.PNG|alt=icon",
["covid-19"] = "SARS-CoV-2 (Wikimedia colors).svg|alt=virus icon",
["crabapples"] = "Malus sylvestris 005.JPG|link=|alt=",
["creationism"] = "Michelangelo, Creation of Adam 04.jpg|link=|alt=",
["cricket"] = "Cricketball.png|link=|alt=",
["crimea"] = "Flag of Crimea.svg|border|link=|alt=flag",
["criminal justice"] = "Scale of justice 2.svg|link=|alt=",
["croatia"] = "Flag of Croatia.svg|border|link=|alt=flag",
["crusades"] = "Arms of the Kingdom of Jerusalem.svg|alt=icon",
["crustaceans"] = "Charybdis japonica.jpg|alt=icon",
["cryptography"] = "Crypto key.svg|alt=icon",
["cryptozoology"] = "Okapi2.jpg|alt=icon",
["crystallography"] = "Pyriteespagne.jpg|link=|alt=image",
["cuba"] = "Flag of Cuba.svg|border|link=|alt=flag",
["cuisine"] = "Toicon-icon-stone-serve.svg|link=|alt=",
["cuisines"] = "Toicon-icon-stone-serve.svg|link=|alt=",
["cultural heritage of serbia"] = "Spomenik Kulture.svg|link=|alt=",
["culture"] = "P culture.svg|alt=icon",
["cumbria"] = "Herdwick sheep crop.jpg|alt=icon",
["curaçao"] = "Flag of Curaçao.svg|border|link=|alt=flag",
["cucurbita"] = "Pumpkin 252 - Evan Swigart.jpg|link=|alt=",
["cue sports"] = "Eight Ball Rack 2005 SeanMcClean.jpg|link=|alt=",
["current events"] = ambox_globe .. "|link=|alt=",
["current events/turkey"] = "Wikinews-logo.png|link=|alt=",
["cycling"] = "Cycling (road) pictogram.svg|link=|alt=",
["cyprus"] = "Flag of Cyprus.svg|border|link=|alt=flag",
["czech republic"] = "Flag of the Czech Republic.svg|border|link=|alt=flag",
["czechia"] = "Flag of the Czech Republic.svg|border|link=|alt=flag",
["czechoslovakia"] = "Flag of the Czech Republic.svg|border|link=|alt=flag"
}
p2t9jfcvbgwcwwhddk290w47wbdrkn0
Module:Portal/images/h
828
40416158
1096260025
1089894689
2022-07-03T09:29:19Z
Northamerica1000
14730724
Add: ["hotels"] = "Map Icon - Hotel.png|link=|alt=",
Scribunto
text/plain
--[==[ This is the "H" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "H". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be omitted.
]==]
return {
["haiti"] = "Flag of Haiti.svg|border|link=|alt=flag",
["halloween"] = "Emoji u1f383.svg|link=|alt=",
["halo"] = "Wikihalo.svg|alt=icon",
["ham"] = "Schinken.jpg|link=|alt=",
["hamburg"] = "Flag of Hamburg.svg|border|link=|alt=flag",
["hamburgers"] = "Cheeseburger.jpg|link=|alt=",
["hamilton, ontario"] = "Flag of Hamilton.svg|border|link=|alt=flag",
["hampshire"] = "EnglandHampshire.svg|link=|alt=",
["handball"] = "Ballon de handball.svg|link=|alt=",
["harare"] = "Flag of Harare.svg|border|link=|alt=flag",
["harry potter"] = "HP - Harry Potter wordmark.svg|link=|alt=",
["haryana"] = "YamunaRiver.jpg|alt=icon",
["harz"] = "DennertFirTree.svg|alt=icon",
["hats"] = "Melonĉapelo.svg|alt=icon",
["hawaii"] = "Flag of Hawaii.svg|border|link=|alt=flag",
["hazara people"] = "Hazara people portal logo.png|link=|alt=",
["health and fitness"] = "Nuvola apps package favorite.svg|alt=icon",
["heathenism"] = "Heathenism symbol.PNG|alt=icon",
["heavy metal"] = "Audio a.svg|link=|alt=",
["hellenismos"] = "Laurel wreath fa13.gif|link=|alt=",
["help"] = "Wikipedia help.png|alt=icon",
["helsinki"] = "Helsinki.vaakuna.svg|link=|alt=seal",
["hemp"] = "Hanflabyrinth Berlin 2009 - 40.jpg|link=|alt=",
["heraldry"] = "Azure, a bend Or.svg|link=|alt=",
["heraldry and vexillology"] = "En-wikipedia arms 9.svg|alt=icon",
["hertfordshire"] = "Hertsflag.jpg|link=|alt=",
["hesse"] = "Flag of Hesse.svg|border|link=|alt=flag",
["hidalgo"] = "Flag of Hidalgo.svg|border|link=|alt=flag",
["himachal pradesh"] = "Kinnaur Kailash.jpg|link=|alt=",
["himalayas"] = "Everest North Face toward Base Camp Tibet Luca Galuzzi 2006.jpg|alt=icon",
["hillary clinton"] = "Hillary Rodham Clinton.jpg|link=|alt=",
["hindi cinema"] = "Indiafilm.svg|alt=icon",
["hindu mythology"] = "HinduSwastika.svg|link=|alt=",
["hinduism"] = "Aum Om red.svg|link=|alt=",
["hindustani"] = "Hindustani.svg|link=|alt=script",
["hip hop"] = "Loudspeaker-crystal-theme.svg|alt=icon",
["hisar"] = "Fort of Firoz Shah Tughlaq at Hisar.jpg|link=|alt=photo",
["hispanic and latino americans"] = "Flag of the Hispanicity.svg|link=|alt=icon",
["history"] = "P history.svg|link=|alt=",
["history of biology"] = "Plato's Academy mosaic from Pompeii.jpg|link=|alt=mosaic",
["history of canada"] = "Canadian Red Ensign (1957-1965).svg|link=|alt=",
["history of europe"] = "Europa Prima Pars Terrae in Forma Virginis.jpg|link=|alt=",
["history of imperial china"] = "明太宗.jpg|link=|alt=",
["history of nuclear enterprise"] = "HD.6D.142 (10821940184).jpg|link=|alt=photo",
["history of science"] = "Newton's reflecting telescope.jpg|link=|alt=image",
["history of the latter day saint movement"] = "Joseph Smith receiving golden plates.jpg|border|link=|alt=",
["hitchhiker's"] = "Answer to Life.png|link=|alt=icon",
["hitchhiker's guide to the galaxy"] = "Answer to Life.png|link=|alt=icon",
["holidays"] = "Calendar icon.svg|alt=icon",
["holy roman empire"] = "Reichskrone.jpg|link=|alt=image",
["holy see"] = "Flag of the Vatican City.svg|border|link=|alt=flag",
["home improvement"] = "Preferences-system.svg|link=|alt=",
["honduras"] = "Flag of Honduras.svg|border|link=|alt=flag",
["hong kong"] = "Flag of Hong Kong.svg|border|link=|alt=flag",
["horror fiction"] = "Vampire Smiley.png|alt=icon",
["horse racing"] = "Flat racing clipart.svg|alt=icon",
["horses"] = "Finnhorse stallion.jpg|alt=icon",
["horticulture and gardening"] = "Pieskowa Skała ogród zamkowy.jpg|border|link=|alt=image",
["hot dogs"] = "Hot Dog.jpg|link=|alt=",
["hotels"] = "Map Icon - Hotel.png|link=|alt=",
["hot sauce"] = "Drop of hot sauce.svg|link=|alt=",
["hot sauces"] = "Drop of hot sauce.svg|link=|alt=",
["house, m.d."] = "Television.svg|alt=icon",
["housing"] = "Big single-family home 2.jpg|link=|alt=",
["houston"] = "Flag of Houston, Texas.svg|border|link=|alt=flag",
["hudson river"] = "Bear Mtn Bridge.jpg|link=|alt=",
["hudson valley"] = "Hudson river from bear mountain bridge.jpg|alt=icon",
["human body"] = "Human.png|link=|alt=",
["human rights"] = "HumanRightsLogo.svg|link=|alt=",
["human sexuality"] = "Bisexuality symbol (bold, color).svg|alt=icon",
["human spaceflight"] = "STS-41-B MMU.jpg|link=|alt=",
["hungary"] = "Flag of Hungary.svg|border|link=|alt=flag",
["hunger relief"] = "Food Bank icon.svg|link=|alt=",
["hyderabad"] = "Charminar Hyderabad 1.jpg|alt=icon",
["h. p. lovecraft"] = "H. P. Lovecraft, June 1934.jpg|alt=H. P. Lovecraft"
}
byuzyv29qney0iboni51ix9e9k7lsd5
Module:Portal/images/i
828
40416166
907990356
897386827
2019-07-26T17:01:39Z
Pppery
28032115
Change image for Indian religions per edit request
Scribunto
text/plain
--[==[ This is the "I" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "I". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be omitted.
]==]
return {
["ice hockey"] = "2hockeypucks.jpg|alt=icon",
["iceland"] = "Flag of Iceland.svg|border|link=|alt=flag",
["idaho"] = "Flag of Idaho.svg|border|link=|alt=flag",
["igbo"] = "Igbo ukwu pendant.jpg|alt=icon",
["illinois"] = "Flag of Illinois.svg|border|link=|alt=flag",
["imperial valley"] = "Salton Sea from Space.jpg|link=|alt=",
["india"] = "Flag of India.svg|border|link=|alt=flag",
["india localisation"] = "Flag of India.svg|border|link=|alt=flag",
["indian caste system"] = "Seventy-two Specimens of Castes in India (5).jpg|link=|alt=illustration",
["indian cinema"] = "Indiafilm.svg|link=|alt=icon",
["indian cities"] = "India population density map en.svg|link=|alt=map",
["indian classical music"] = "Tabla y duggi6.JPG|link=|alt=",
["indian cuisine"] = "Indian Spices.jpg|link=|alt=",
["indian districts"] = "India districts map.svg|link=|alt=map",
["indian economy"] = "Bombay24a.jpg|link=|alt=photo",
["indian history"] = "North Gateway - Rear Side - Stupa 1 - Sanchi Hill 2013-02-21 4480-4481.JPG|link=|alt=photo",
["indian independence movement"] = "1931 Flag of India.svg|link=|alt=",
["indian literature"] = "Ashoka Chakra.svg|link=|alt=icon",
["indian maps"] = "Map of Indian empire 1885.jpg|link=|alt=map",
["indian military history"] = "Armed forces logo.png|link=|alt=logo",
["indian music"] = "India-music.svg|link=|alt=icon",
["indian ocean"] = "Indian Ocean - en IHO.png|link=|alt=map",
["indian politics"] = "Emblem of India.svg|link=|alt=emblem",
["indian portals"] = "Gateway to Hooseinabad Bazaar, Lucknow, India2.jpg|link=|alt=photo",
["indian premier league"] = "Ipl.svg|link=|alt=",
["indian religions"] = "Dharmic Religions.jpg|alt=icon",
["indian roads"] = "India-roads.svg|link=|alt=icon",
["indian states"] = "India - administrative map.png|link=|alt=map",
["indian television"] = "India Television icon.svg|link=|alt=icon",
["indian translation"] = "Flag of India.svg|border|link=|alt=flag",
["indian wildlife"] = "Panthera tigris tigris.jpg|link=|alt=photo",
["indian women"] = "Rani Lakshmibai.jpg|link=|alt=image",
["indiana"] = "Flag of Indiana.svg|border|link=|alt=flag",
["indiana jones"] = "Hatt2.png|alt=icon",
["indianapolis"] = "Flag of Indianapolis.svg|border|link=|alt=flag",
["indigenous languages of california"] = "Edward S. Curtis Collection People 056.jpg|link=|alt=photo",
["indigenous peoples in canada"] = "Aboriginal War Veterans monument (close).JPG|alt=icon",
["indigenous peoples of australia"] = "Uluru sketch portal ipau.png|link=|alt=",
["indigenous peoples of north america"] = "Spiromoundsraccoon.svg|link=|alt=",
["indigenous peoples of the americas"] = "MAYA-g-log-cal-D10-Ok.svg|link=|alt=",
["indonesia"] = "Flag of Indonesia.svg|border|link=|alt=flag",
["indonesian cuisine"] = "Herbs in Indonesia.jpg|link=|alt=",
["industrial music"] = "Avidemux.png|alt=icon",
["information technology"] = "Desktop computer clipart - Yellow theme.svg|link=|alt=",
["infrastructure"] = "Darwin Airport Water Tower.jpg|alt=icon",
["inland empire"] = "California county map (Inland Empire highlighted).svg|link=|alt=",
["insects"] = "European wasp white bg.jpg|alt=icon",
["instant foods"] = "Frozen-TV-dinner-top-view.jpg|link=|alt=",
["intelligence"] = "Spy silhouette document.svg|alt=icon",
["international relations"] = "Terra.png|link=|alt=",
["internet"] = "Crystal Clear app linneighborhood.svg|alt=icon",
["internet relay chat"] = "Ircnetz-Schema.svg|link=|alt=",
["interstate highway system"] = "MUTCD M1-10a.svg|link=|alt=",
["iowa"] = "Flag of Iowa.svg|border|link=|alt=flag",
["iran"] = "Flag of Iran.svg|border|link=|alt=flag",
["iranian azerbaijan"] = "AZARBAIJAN MAP.JPG|alt=icon",
["iraq"] = "Flag of Iraq.svg|border|link=|alt=flag",
["ireland"] = "Four Provinces Flag.svg|border|link=|alt=flag",
["irish cuisine"] = "Irish stew 2007 (cropped).jpg|link=|alt=",
["iron maiden"] = "Iron Maiden's Eddie1.jpg|alt=icon",
["islam"] = "Allah-green.svg|link=|alt=",
["islam in china"] = "Islam in China.jpg|alt=icon",
["islamabad"] = "Proposed Flag of Islamabad Capital Territory.svg|border|link=|alt=flag",
["islamic state of iraq and the levant"] = "AQMI Flag asymmetric.svg|border|link=|alt=flag",
["islands"] = "Icône Ile.svg|alt=icon",
["isle of man"] = "Flag of the Isle of Man.svg|border|link=|alt=flag",
["isle of man tt"] = "Cameron IMG 0014.jpg|alt=icon",
["isle of wight"] = "Isle of Wight Council Flag.svg|border|link=|alt=flag",
["israel"] = "Flag of Israel.svg|border|link=|alt=flag",
["italian cuisine"] = "Linguine.jpg|link=|alt=",
["italian wars"] = "Marignano.jpg|link=|alt=",
["italy"] = "Flag of Italy.svg|border|link=|alt=flag",
["ivory coast"] = "Flag of Côte d'Ivoire.svg|border|link=|alt=flag"
}
cggr095nnk2ublapbf607k1yiz1hvji
Module:Portal/images/l
828
40416175
1089055367
1066390528
2022-05-21T17:17:30Z
Paine Ellsworth
9092818
per edit request on talk page - image deleted
Scribunto
text/plain
--[==[ This is the "L" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "L". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be omitted.
]==]
return {
["labuan"] = "Flag of Labuan.svg|border|link=|alt=flag",
["lacrosse"] = "Crossed lacrosse sticks.svg|alt=icon",
["lady gaga"] = "Monster ball uk dance in the dark cropped to face.jpg|alt=icon",
["lagomorpha"] = "Lapin01 flipped and colorized.svg|alt=icon",
["lagos"] = "Flag of Lagos.svg|alt=flag",
["lahore"] = "Badshahi Mosque July 1 2005 pic32 by Ali Imran (1).jpg|alt=icon",
["lakes"] = "Walden Pond, Massachusetts on June 27, 2012.png|link=|alt=image",
["lakshadweep"] = "India Lakshadweep locator map.svg|border|link=|alt=map",
["lancashire"] = "Lancashire rose.svg|alt=icon",
["lancaster, pennsylvania"] = "Flag of Lancaster, Pennsylvania.svg|border|link=|alt=flag",
["land of oz"] = "Oz flag.svg|alt=icon",
["language"] = "Globe of letters.svg|alt=icon",
["languages"] = "Globe of letters.svg|alt=icon",
["laos"] = "Flag of Laos.svg|border|link=|alt=flag",
["las vegas"] = "Flag of Las Vegas, Nevada.svg|border|link=|alt=flag",
["latin america"] = "Latin America (orthographic projection).svg|link=|alt=map",
["latin america music"] = "Musical note nicu bucule 01.svg|link=|alt=",
["latin american music"] = "Musical note nicu bucule 01.svg|link=|alt=",
["latin music"] = "Conga.svg|link=|alt=",
["latter day saints"] = "Christus statue temple square salt lake city.jpg|link=|alt=";
["latter day saint movement"] = "Christus statue temple square salt lake city.jpg|link=|alt=";
["latvia"] = "Flag of Latvia.svg|border|link=|alt=flag",
["laurentides"] = "Paysage lac Monroe.jpg|alt=icon",
["law"] = "Johnny-automatic-scales-of-justice.svg|link=|alt=",
["law enforcement"] = "Nuvola apps agent.svg|alt=icon",
["law enforcement/law enforcement topics"] = "Nuvola apps agent.svg|alt=icon",
["law of england and wales"] = "Scale of justice 2 new.jpeg|alt=icon",
["laws in india"] = "Constitution of India.jpg|link=|alt=image",
["lds church"] = "Christus statue temple square salt lake city.jpg|link=|alt=";
["lebanon"] = "Flag of Lebanon.svg|border|link=|alt=flag",
["lebanese cuisine"] = "Kibbeh3.jpg|link=|alt=",
["led zeppelin"] = "Zoso Robert Plant feather symbol.svg|link=|alt=",
["leeds"] = "Arms of Leeds.svg|alt=icon",
["leibniz"] = "Gottfried Wilhelm Leibniz, Bernhard Christoph Francke.jpg|link=|alt=painting",
["lesotho"] = "Flag of Lesotho.svg|border|link=|alt=flag",
["left-wing populism"] = "Fist.svg|link=|alt=",
["lego"] = "Plastic brick, red.svg|alt=icon",
["lemony snicket"] = "Eyes lumen design.svg|alt=icon",
["lgbt"] = "Nuvola LGBT flag.svg|link=|alt=",
["liberalism"] = "Yellow flag waving.svg|alt=icon",
["liberia"] = "Flag of Liberia.svg|border|link=|alt=flag",
["libertarianism"] = "2006 AEGold Proof Obv.png|link=|alt=coin",
["libraries"] = "Nuvola apps bookcase.svg|link=|alt=",
["library and information science"] = "Library-logo.svg|link=|alt=",
["libya"] = "Flag of Libya.svg|border|link=|alt=flag",
["liechtenstein"] = "Flag of Liechtenstein.svg|border|link=|alt=flag",
["lighthouses"] = "Lighthouse icon.svg|alt=icon",
["lima"] = "Coat of arms of Lima.svg|alt=icon",
["lincolnshire"] = "Lincolnshire flag.svg|border|link=|alt=flag",
["linguistics"] = "Globe of letters.svg|alt=icon",
["linkin park"] = "LPLogo-black.svg|link=|alt=",
["linux"] = "NewTux.svg|alt=icon",
["liquor"] = "Flessen drank.jpg|alt=icon",
["lisbon"] = "Flag of Lisboa.svg|border|alt=flag",
["lists"] = "Text-x-generic.svg|link=|alt=",
["literature"] = "Books-aj.svg aj ashton 01.svg|link=|alt=",
["lithuania"] = "Flag of Lithuania.svg|border|link=|alt=flag",
["livestock"] = "Sheep and cow in South Africa.jpg|link=|alt=photo",
["living people"] = "Angela Merkel 2007Jan04.jpg|link=|alt=photo",
["logic"] = "Logic portal.svg|alt=icon",
["lombardy"] = "Flag of Lombardy.svg|border|link=|alt=flag",
["london"] = "Clock Tower - Palace of Westminster, London - May 2007 icon.png|alt=icon",
["london transport"] = "Underground sign at Westminster.jpg|link=|alt=",
["lorraine"] = "Flag of Lorraine.svg|border|link=|alt=flag",
["los angeles"] = "LA Skyline Mountains2.jpg|link=|alt=photo",
["lost"] = "Lost Black Wikipedia.png|alt=icon",
["louisiana"] = "Flag of Louisiana.svg|border|link=|alt=flag",
["louisiana tech"] = "Louisiana Tech Athletics wordmark.svg|link=|alt=wordmark",
["louisville"] = "Fleur-de-lis-3d.png|link=|alt=",
["lowell, massachusetts"] = "Francis Cabot Lowell.jpg|border|link=|alt=silhouette",
["lower saxony"] = "Flag of Lower Saxony.svg|border|link=|alt=flag",
["lucknow"] = "Vidhan Sabha Lucknow.jpg|link=|alt=photo",
["lutheranism"] = "Lutherrose.svg|alt=icon",
["luton"] = "Luton Straw Hat.svg|alt=Straw Hat",
["luxembourg"] = "Flag of Luxembourg.svg|border|link=|alt=flag",
["lviv"] = "Flag of Lviv.svg|alt=icon",
["lyon"] = "Blason Ville fr Lyon.svg|alt=icon"
}
aqseo045z3cbbs3fyzkguzss5lvlzd2
Module:Portal/images/p
828
40416210
1093679606
1084998076
2022-06-18T05:24:09Z
Hike395
11639
add paleozoic
Scribunto
text/plain
--[==[ This is the "P" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "P". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/u]] - for portal names beginning with "U".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be omitted.
]==]
return {
["pacific northwest"] = "Abies lasiocarpa 0775.JPG|link=|alt=",
["pacific ocean"] = "Pacific Ocean - en.png|link=|alt=map",
["packaging"] = "Can(Easy Open Can).JPG|link=|alt=",
["pahang"] = "Flag of Pahang.svg|border|link=|alt=flag",
["painting"] = "600-artist-palette.svg|link=|alt=artist's palette",
["pakistan"] = "Flag of Pakistan.svg|border|link=|alt=flag",
["pakistani cuisine"] = "Punjabi Utensil - Chaba.JPG|link=|alt=",
["palaeontology"] = "Allosaurus Jardin des Plantes.png|link=|alt=icon",
["palau"] = "Flag of Palau.svg|border|link=|alt=flag",
["paleontology"] = "Allosaurus Jardin des Plantes.png|link=|alt=icon",
["paleozoic"] = "Tiktaalik BW flopped.jpg|alt=icon",
["palermo"] = "Flag of Palermo.svg|link=|alt=flag",
["palestine"] = "Flag of Palestine.svg|border|link=|alt=flag",
["palestinian territories"] = "Flag of Palestine.svg|border|link=|alt=flag",
["pan-africanism"] = "Flag of the UNIA.svg",
["panama"] = "Flag of Panama.svg|border|link=|alt=flag",
["pancakes"] = "Pancakes with powdered sugar.jpg|link=|alt=",
["pandemics"] = "Protokol Kesehatan.jpg|link=|alt=",
["papua new guinea"] = "Flag of Papua New Guinea.svg|border|link=|alt=flag",
["paraguay"] = "Flag of Paraguay.svg|border|link=|alt=flag",
["paralympic games"] = "IPC logo (2004).svg|link=|alt=",
["paris"] = "Eiffel tower.svg|link=|alt=",
["parliamentary procedure"] = "Gavel.png|link=|alt=",
["pastries"] = "Postre vector.png|link=|alt=",
["pasta"] = "Pastasciutta.JPG|link=|alt=",
["patna"] = "Golghar, Patna, 1888.jpg|link=|alt=",
["peach"] = "Peach.svg|link=|alt=",
["peaches"] = "Peach.svg|link=|alt=",
["peanut"] = "Cacahuete - Petr Kratochvil.jpg|link=|alt=",
["peanuts"] = "Cacahuete - Petr Kratochvil.jpg|link=|alt=",
["pear"] = "PearPhoto.jpg|link=|alt=",
["pears"] = "PearPhoto.jpg|link=|alt=",
["peer review"] = "PR icon.png|alt=icon",
["peerage and baronetage"] = "General Sir Bernard Montgomery in England, 1943 TR1036.jpg|link=|alt=photo",
["penang"] = "Flag of Penang (Malaysia).svg|border|alt=flag",
["pennsylvania"] = "Flag of Pennsylvania.svg|border|link=|alt=flag",
["pennsylvania state university"] = "Penn State Athletics wordmark.svg|link=|alt=wordmark",
["people's republic of china"] = "Flag of the People's Republic of China.svg|border|link=|alt=flag",
["pepsico"] = "Pepsico logo.png|link=|alt=logo",
["perak"] = "Flag of Perak.svg|border|link=|alt=flag",
["percussion"] = "Bendir.jpg|alt=icon",
["perlis"] = "Flag of Perlis.svg|border|link=|alt=flag",
["perth"] = "Perth COA.jpg|alt=icon",
["peru"] = "Flag of Peru.svg|border|link=|alt=flag",
["pervasive developmental disorders"] = "Autism-stacking-cans 2nd edit.jpg|alt=icon",
["pharmacy and pharmacology"] = "Tabletten.JPG|alt=icon",
["philadelphia"] = "Libertybell alone small.jpg|link=|alt=",
["philately"] = "Stamp UK Penny Red pl148.jpg|link=|alt=",
["philippines"] = "Flag of the Philippines.svg|border|link=|alt=flag",
["philosophers"] = "Ibn rushd.jpg|link=|alt=image",
["philosophy"] = "Socrates.png|link=|alt=",
["philosophy of mind"] = "Phrenology1.jpg|link=|alt=",
["philosophy of science"] = "P philosophy.png|alt=icon",
["phoenicia"] = "Phoenician aleph.svg|alt=Black on white image of the Phoenician letter Aleph",
["photography"] = "Large format camera lens.png|link=|alt=",
["physical chemistry"] = "Nuvola apps edu science.svg|alt=icon",
["physical science"] = "Kepler-first-law.svg|link=|alt=diagram",
["physics"] = "Stylised atom with three Bohr model orbits and stylised nucleus.svg|alt=icon",
["piano"] = "Bechstein Schriftzug.jpg|alt=icon",
["pichilemu"] = "Coat of arms of Pichilemu.svg|link=|alt=",
["pies"] = "Cherry-Pie-Slice.jpg|link=|alt=",
["pigs"] = "Pig icon 05.svg|link=|alt=",
["pineapple"] = "Tux Paint pineapple.svg|link=|alt=",
["pineapples"] = "Tux Paint pineapple.svg|link=|alt=",
["pink floyd"] = "Dispersion prism.jpg|link=|alt=",
["pipe organ"] = "Ittenheim StGall32.JPG|alt=icon",
["piracy"] = "Skull and crossbones.svg|link=|alt=",
["pitcairn islands"] = "Flag of the Pitcairn Islands.svg|border|link=|alt=flag",
["pittsburgh"] = "Pittsburgh city coat of arms.svg|link=|alt=",
["pizza"] = "Emojione 1F355.svg|link=|alt=",
["plants"] = "Leaf 1 web.jpg|alt=icon",
["plum"] = "Plum on tree.jpg|link=|alt=",
["plums"] = "Plum on tree.jpg|link=|alt=",
["podcasting"] = "Feed-icon headphones.svg|link=|alt=",
["poetry"] = "Quill and ink.svg|alt=icon",
["pokémon"] = "Wikiball.svg|alt=icon",
["poland"] = "Flag of Poland.svg|border|link=|alt=flag",
["political science"] = "Plato-raphael.jpg|link=|alt=",
["politics"] = "A coloured voting box.svg|border|alt=icon",
["politics and government"] = "President Barack Obama.jpg|link=|alt=photo",
["polyhedra"] = "Small snub icosicosidodecahedron.png|link=|alt=icon",
["polynesia"] = "Polynesia.png|link=|alt=map",
["pollution"] = "Benxi Steel Industries.jpg|link=|alt=photo",
["potato"] = "Noto Emoji Oreo 1f954.svg|link=|alt=",
["potatoes"] = "Noto Emoji Oreo 1f954.svg|link=|alt=",
["poultry"] = "Toicon-icon-hatch-roast.svg|link=|alt=",
["pomerania"] = "Wappen Pommern.svg|link=|alt=",
["pop music"] = "Audio-input-microphone.png|alt=icon",
["pope"] = "Coat of arms Holy See.svg|link=|alt=",
["port of spain"] = "Internationalfinancecentre.JPG|alt=icon",
["portal"] = "PorcheCentralNordCathedraleChartre041130-.jpg|alt=icon",
["portland, oregon"] = "Flag of Portland, Oregon.svg|link=|alt=flag",
["portugal"] = "Flag of Portugal.svg|border|link=|alt=flag",
["portuguese"] = "Grammatica da Lingoagem portuguesa.JPG|link=Portuguese language|alt=icon",
["poznań"] = "POL Poznań flag.svg|border|alt=flag",
["prague"] = "Prague CoA CZ.svg|link=|alt=",
["prehistoric mammals"] = "Smilodon Knight.jpg|link=|alt=",
["prehistoric technology"] = "Roue primitive.png|link=|alt=",
["prescott-russell"] = "Map of Ontario PRESCOTT AND RUSSELL.svg|link=|alt=",
["pretoria"] = "Flag of Pretoria.svg|link=|alt=flag",
["primates"] = "Man of the woods.JPG|alt=icon",
["prince edward island"] = "Flag of Prince Edward Island.svg|border|link=|alt=flag",
["prisons"] = "Prisonbars.svg|border|alt=icon",
["private revelation"] = "Tuam Cathedral of the Assumption Sacred Heart Detail 2009 09 14.jpg|alt=icon",
["probability"] = "Nuvola apps atlantik.png|link=|alt=icon",
["professional wrestling"] = "WWE ring.jpg|alt=icon",
["progressive rock"] = "Audio a.svg|link=|alt=",
["prostitution"] = "Bombilla roja - red Edison lamp.svg|link=alt=icon",
["prostitution in the united kingdom"] = "Umbrella-159361.svg|link=|alt=",
["protected areas of india"] = "Nagzira Tiger By Vijay Phulwadhawa.jpg|link=|alt=photo",
["prussia"] = "Flag of Prussia (1892-1918).svg|link=|alt=photo",
["pseudoscience"] = "Question opening-closing.svg|link=|alt=icon",
["psychiatry"] = "American Lady Against The Sky.jpg|alt=icon",
["psychology"] = "Psi2.svg|link=|alt=",
["puducherry"] = "Seal of Puducherry (cropped).svg|link=|alt=",
["puebla"] = "Flag of Puebla.svg|border|link=|alt=flag",
["puerto rico"] = "Flag of Puerto Rico.svg|border|link=|alt=flag",
["pune"] = "Dagaduseth halwai ganpati temple.jpg|link=|alt=photo",
["punjab"] = "Golden Temple (Harmandir Sahib) in Amritsar, India.jpg|border|link=|alt=image",
["punjab, india"] = "Seal of Punjab.gif|link=|alt=icon",
["punjab, pakistan"] = "Flag of Punjab.svg|border|link=|alt=flag",
["punk rock"] = "Crystal Clear app kguitar.png|alt=icon",
["python programming"] = "Python-logo-notext.svg|link=|alt=",
["pyrotechnics"] = "D-W002 Warnung vor explosionsgefaehrlichen Stoffen ty.svg|link=|alt="
}
5n58gmidvjdkpkd8lwtkatzwxpg8t1w
Module:Portal/images/u
828
40416237
1081911117
958132149
2022-04-10T11:17:17Z
Terasail
39239779
Use svg versions. [[:File:Emblem of the United States Navy.png]] -> [[:File:Emblem of the United States Navy.svg]] & [[:File:Military service mark of the United States Army.png]] -> [[:File:Mark of the United States Army.svg]]
Scribunto
text/plain
--[==[ This is the "U" list of portal image names. It contains a list of portal images for use with [[Module:Portal]]
-- for portal names that start with the letter "U". For aliases to existing portal names, and for portal names that
-- start with other letters, please use the appropriate page from the following list:
-- [[Module:Portal/images/a]] - for portal names beginning with "A".
-- [[Module:Portal/images/b]] - for portal names beginning with "B".
-- [[Module:Portal/images/c]] - for portal names beginning with "C".
-- [[Module:Portal/images/d]] - for portal names beginning with "D".
-- [[Module:Portal/images/e]] - for portal names beginning with "E".
-- [[Module:Portal/images/f]] - for portal names beginning with "F".
-- [[Module:Portal/images/g]] - for portal names beginning with "G".
-- [[Module:Portal/images/h]] - for portal names beginning with "H".
-- [[Module:Portal/images/i]] - for portal names beginning with "I".
-- [[Module:Portal/images/j]] - for portal names beginning with "J".
-- [[Module:Portal/images/k]] - for portal names beginning with "K".
-- [[Module:Portal/images/l]] - for portal names beginning with "L".
-- [[Module:Portal/images/m]] - for portal names beginning with "M".
-- [[Module:Portal/images/n]] - for portal names beginning with "N".
-- [[Module:Portal/images/o]] - for portal names beginning with "O".
-- [[Module:Portal/images/p]] - for portal names beginning with "P".
-- [[Module:Portal/images/q]] - for portal names beginning with "Q".
-- [[Module:Portal/images/r]] - for portal names beginning with "R".
-- [[Module:Portal/images/s]] - for portal names beginning with "S".
-- [[Module:Portal/images/t]] - for portal names beginning with "T".
-- [[Module:Portal/images/v]] - for portal names beginning with "V".
-- [[Module:Portal/images/w]] - for portal names beginning with "W".
-- [[Module:Portal/images/x]] - for portal names beginning with "X".
-- [[Module:Portal/images/y]] - for portal names beginning with "Y".
-- [[Module:Portal/images/z]] - for portal names beginning with "Z".
-- [[Module:Portal/images/other]] - for portal names beginning with any other letters. This includes numbers,
-- letters with diacritics, and letters in non-Latin alphabets.
-- [[Module:Portal/images/aliases]] - for adding aliases for existing portal names. Use this page for variations
-- in spelling and diacritics, etc., no matter what letter the portal begins with.
-- When adding entries, please use alphabetical order. The format of the images table entries is as follows:
-- ["portal name"] = "image.svg",
-- The portal name should be the name of your portal, in lower case. For example, the portal name for
-- "Portal:United Kingdom" would be "united kingdom". The image name should be capitalised normally, and the "File:"
-- namespace prefix should be omitted.
]==]
return {
["u2"] = "U2portallogo.png|alt=icon",
["udaipur"] = "Udaipur palace night.jpg|link=|alt=photo",
["uganda"] = "Flag of Uganda.svg|border|link=|alt=flag",
["uk railways"] = "170433 at Edinburgh Waverley.JPG|alt=icon",
["uk waterways"] = "Moore Bridge.jpg|link=|alt=",
["ukraine"] = "Flag of Ukraine.svg|border|link=|alt=flag",
["ulan bator"] = "Mn flag ulaanbaatar.png|border|link=|alt=flag",
["umm al quwain"] = "Flag of Umm al-Qaiwain.svg|border|link=|alt=flag",
["underwater diving"] = "Helmet logo for Underwater Diving portal.png|link=|alt=",
["unidentified flying objects"] = "PurportedUFO2cropped.jpg|link=|alt=",
["united arab emirates"] = "Flag of the United Arab Emirates.svg|border|link=|alt=flag",
["united kingdom"] = "Flag of the United Kingdom.svg|border|link=|alt=flag",
["united nations"] = "UN emblem blue.svg|link=|alt=",
["united states"] = "Flag of the United States.svg|border|link=|alt=flag",
["united states air force"] = "Military service mark of the United States Air Force.svg|link=|alt=seal",
["united states arms"] = "United States Arms.svg|link=|alt=arms",
["united states army"] = "Mark of the United States Army.svg|link=|alt=emblem",
["united states coast guard"] = "USCG W.svg|link=|alt=seal",
["united states coast guard auxiliary"] = "Seal of the United States Coast Guard Auxiliary.svg|link=|alt=seal",
["united states comics"] = "Bouclier Captain America 1018.png|link=|alt=icon",
["united states congress"] = "Seal of the United States Congress.svg|link=|alt=seal",
["united states constitution"] = "Constitution Pg1of4 AC icon cut.png|link=|alt=image",
["united states counties"] = "USA Counties.svg|link=|alt=map",
["united states courts and judges"] = "Legal font awesome.svg|link=|alt=icon",
["united states government"] = "DC 49 1 (6633999321).jpg|link=|alt=photo",
["united states governors"] = "United States Governors map.svg|link=|alt=map",
["united states history"] = "MayflowerHarbor.jpg|link=|alt=painting",
["united states marine corps"] = "Emblem of the United States Marine Corps.svg|link=|alt=",
["united states merchant marine"] = "Usmm-seal.png|link=|alt=",
["united states presidential elections"] = "2016-election-map (30798493391).jpg|link=|alt=map",
["united states navy"] = "Emblem of the United States Navy.svg|link=|alt=emblem",
["united states politicians"] = "US House 2016.svg|link=|alt=map",
["united states presidential elections"] = "2016-election-map (30798493391).jpg|link=|alt=map",
["united states presidents"] = "Portrait of George Washington-transparent.png|link=|alt=portrait",
["united states public policy"] = "Color US Map with borders.svg|border|link=|alt=map",
["united states roads"] = "Blank shield.svg|link=|alt=logo",
["united states space force"] = "Seal of the United States Space Force.png|link=|alt=seal",
["united states state legislatures"] = "United States state legislatures.svg|link=|alt=map",
["united states streets"] = "USST signblades.jpg|link=|alt=photo",
["united states supreme court"] = "Seal of the United States Supreme Court.svg|link=|alt=seal",
["united states territories"] = "US insular areas.svg|link=|alt=map",
["united states virgin islands"] = "Flag of the United States Virgin Islands.svg|border|link=|alt=flag",
["unreferenced biographies of living persons"] = "Vraagteken.svg|link=|alt=icon",
["university"] = "Platopainting.jpg|link=|alt=",
["university of california"] = "University of California logo.svg|link=|alt=logo",
["university of arkansas"] = "Arkansas text logo.svg|link=|alt=logo",
["university of cambridge"] = "University of Cambridge coat of arms.svg|alt=arms",
["university of colorado"] = "Colorado Buffaloes wordmark.svg|link=|alt=logo",
["university of connecticut"] = "University of Connecticut logo.svg|link=|alt=logo",
["university of florida"] = "University of Florida Vertical Signature.svg|link=|alt=logo",
["university of houston"] = "University of Houston logo.svg|link=|alt=logo",
["university of massachusetts"] = "UMass System Logo.jpg|link=|alt=logo",
["university of missouri"] = "University of Missouri logo.svg|link=|alt=logo",
["university of montana"] = "Montana UM logo.gif|link=|alt=logo",
["university of north carolina at chapel hill"] = "North Carolina Tar Heels logo.svg|link=|alt=logo",
["university of north texas"] = "North Texas Stacked Wordmark.png|link=|alt=wordmark",
["university of notre dame"] = "Notre Dame coat of arms.png|link=|alt=arms",
["university of oklahoma"] = "OU-Logo.svg|link=|alt=logo",
["university of oxford"] = "Bibliotheksstempel Bodleiana.jpg|link=|alt=",
["university of pennsylvania"] = "Penn Quakers logo.svg|link=|alt=logo",
["university of pittsburgh"] = "Pitt mark.png|link=|alt=logo",
["university of san francisco"] = "SanFranciscoDonslogobeginning2012.jpg|link=|alt=logo",
["university of southern california"] = "CaptureUSClogo.JPG|link=|alt=logo",
["university of texas at austin"] = "UT&T text logo.svg|link=|alt=logo",
["university of the arctic"] = "School.svg|link=|alt=icon",
["university of virginia"] = "Virginia Athletics wordmark.svg|link=|alt=wordmark",
["universities"] = "Platopainting.jpg|link=|alt=",
["uranus"] = "Uranus2.jpg|link=|alt=",
["urdu"] = "Urdu example.svg|alt=icon",
["uruguay"] = "Flag of Uruguay.svg|border|link=|alt=flag",
["userboxes"] = "Crystal kthememgr.svg|link=|alt=icon",
["usher"] = "Usherraymond (300dpi).jpg|alt=icon",
["utah"] = "Flag of Utah.svg|border|link=|alt=flag",
["uttar pradesh"] = "Seal of Uttar Pradesh.png|link=|alt=seal",
["uttarakhand"] = "India Uttarakhand locator map.svg|link=|alt=map",
["uzbekistan"] = "Flag of Uzbekistan.svg|border|link=|alt=flag"
}
9yzqjipiju3sivo933djl4isoniiefw
Module:Portal/styles.css
828
62816794
1093669538
1072126029
2022-06-18T03:30:37Z
Hike395
11639
float should be specified by tright/tleft, not this class
sanitized-css
text/css
/* {{pp-template}} */
.portalbox {
padding: 0; /* Timeless adds padding */
}
.portalborder {
border: solid #aaa 1px;
}
.portalbox.tleft {
margin: 0.5em 1em 0.5em 0
}
.portalbox.tright {
margin: 0.5em 0 0.5em 1em
}
.portalbox > ul {
display: table;
box-sizing: border-box;
max-width: 175px;
font-size: 85%;
line-height: 110%;
font-style: italic;
font-weight: bold;
}
.portalborder > ul {
padding: 0.1em;
background: #f9f9f9;
}
.portalbox > ul > li {
display: table-row;
}
.portalbox > ul > li > span:first-child {
display: table-cell;
padding: 0.2em;
vertical-align: middle;
text-align: center;
}
.portalbox > ul > li > span:last-child {
display: table-cell;
padding: 0.2em 0.2em 0.2em 0.3em;
vertical-align: middle;
}
8bizyp0pzt95ed4o8kuys7xxbx8kstm
Module:Protect
828
58199327
887566004
880025068
2019-03-13T12:54:02Z
Xaosflux
502540
Changed protection level for "[[Module:Protect]]": used in interface [[MediaWiki:Protectedinterface]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
local function processResult(options, success, ...)
if not success then
local message = tostring(... or '(no message)')
if options.removeLocation then
message = string.gsub(message, '^Module:[^:]+:%d+: ', '', 1)
end
return string.format(options.errFormat, message)
end
return ...
end
local function protect(func, errFormat, options)
if type(errFormat) == 'table' then
options = options or errFormat
errFormat = nil
end
options = mw.clone(options) or {}
options.errFormat = errFormat or options.errFormat or 'Error: %s'
if not options.raw then
options.errFormat = '<strong class="error">' .. options.errFormat .. '</strong>'
end
options.removeLocation = options.removeLocation == nil or options.removeLocation
return function (...)
return processResult(options, pcall(func, ...))
end
end
return protect
lpwbveqfkihxx5w7otzmx6xlb5y323h
Module:Protection banner
828
42040984
1033879006
1013845490
2021-07-16T11:59:29Z
ProcrastinatingReader
32939139
add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('Module:No globals')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'Module:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isUserScript()
-- Whether the page is a user JavaScript or CSS page.
local title = self.title
return title.namespace == 2 and (
title.contentModel == 'javascript' or title.contentModel == 'css'
)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:shouldShowLock()
-- Whether we should output a banner/padlock
return self:isProtected() and not self:isUserScript()
end
-- Whether this page needs a protection category.
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
if not self:shouldHaveProtectionCategory() then
return ''
end
local cfg = self._cfg
local title = self.title
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:shouldHaveProtectionCategory()
or type(expiry) == 'number' and expiry < os.time()
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = {self:makeProtectionCategory()}
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return mw.getCurrentFrame():expandTemplate{
title="vandal-m",
args={self._args.user or self._protectionObj.title.baseText}
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
obj._imageFilename = imageFilename
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 40
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 20
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if not yesno(args.catonly) and (protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)])
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:shouldShowLock() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
ktral6mmlw9hhlxwgaq85237qklrdx8
Module:Protection banner/config
828
42982788
1069763876
1053458493
2022-02-03T23:49:55Z
Andrybak
23735172
add categorization into [[:Category:Wikipedia extended-confirmed-protected modules]] per [[Special:Diff/1069761256|request]]
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = 'Page ${PROTECTIONLEVEL}'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
edit = {
blp = {
description = 'For pages protected to promote compliance with the'
.. ' [[Wikipedia:Biographies of living persons'
.. '|biographies of living persons]] policy',
text = '${INTROFRAGMENT} to promote compliance with'
.. ' [[Wikipedia:Biographies of living persons'
.. "|Wikipedia's policy on the biographies"
.. ' of living people]].',
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living persons',
},
dmca = {
description = 'For pages protected by the Wikimedia Foundation'
.. ' due to [[Digital Millennium Copyright Act]] takedown requests',
explanation = function (protectionObj, args)
local ret = 'Pursuant to a rights owner notice under the Digital'
.. ' Millennium Copyright Act (DMCA) regarding some content'
.. ' in this article, the Wikimedia Foundation acted under'
.. ' applicable law and took down and restricted the content'
.. ' in question.'
if args.notice then
ret = ret .. ' A copy of the received notice can be found here: '
.. args.notice .. '.'
end
ret = ret .. ' For more information, including websites discussing'
.. ' how to file a counter-notice, please see'
.. " [[Wikipedia:Office actions]] and the article's ${TALKPAGE}."
.. "'''Do not remove this template from the article until the"
.. " restrictions are withdrawn'''."
return ret
end,
image = 'Office-protection-shackle.svg',
},
dispute = {
description = 'For pages protected due to editing disputes',
text = function (protectionObj, args)
-- Find the value of "disputes".
local display = 'disputes'
local disputes
if args.section then
disputes = string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[protectionObj.title.namespace].talk.name,
protectionObj.title.text,
args.section,
display
)
else
disputes = display
end
-- Make the blurb, depending on the expiry.
local msg
if type(protectionObj.expiry) == 'number' then
msg = '${INTROFRAGMENT} or until editing %s have been resolved.'
else
msg = '${INTROFRAGMENT} until editing %s have been resolved.'
end
return string.format(msg, disputes)
end,
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPFRAGMENT} due to editing disputes',
},
ecp = {
description = 'For articles in topic areas authorized by'
.. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
.. ' meets the criteria for community use',
tooltip = 'This ${PAGETYPE} is extended-confirmed protected',
alt = 'Extended-protected ${PAGETYPE}',
},
mainpage = {
description = 'For pages protected for being displayed on the [[Main Page]]',
text = 'This file is currently'
.. ' [[Wikipedia:This page is protected|protected]] from'
.. ' editing because it is currently or will soon be displayed'
.. ' on the [[Main Page]].',
explanation = 'Images on the Main Page are protected due to their high'
.. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
.. '<br /><span style="font-size:90%;">'
.. "'''Administrators:''' Once this image is definitely off the Main Page,"
.. ' please unprotect this file, or reduce to semi-protection,'
.. ' as appropriate.</span>',
},
office = {
description = 'For pages protected by the Wikimedia Foundation',
text = function (protectionObj, args)
local ret = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.'
if protectionObj.protectionDate then
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.'
end
return ret
end,
explanation = "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this"
.. " page unless you are authorized by the Wikimedia Foundation to do"
.. " so.'''",
image = 'Office-protection-shackle.svg',
},
reset = {
description = 'For pages protected by the Wikimedia Foundation and'
.. ' "reset" to a bare-bones version',
text = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.protectionDate then
ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was'
else
ret = ret .. 'This ${PAGETYPE} has been'
end
ret = ret .. ' reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' will eventually be open to all editors—and will be strictly'
.. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while'
.. ' it is being rebuilt.\n\n'
.. 'Any insertion of material directly from'
.. ' pre-protection revisions of the ${PAGETYPE} will be removed, as'
.. ' will any material added to the ${PAGETYPE} that is not properly'
.. ' sourced. The associated talk page(s) were also cleared on the'
.. " same date.\n\n"
.. "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not override"
.. " this action, and do not remove protection from this page,"
.. " unless you are authorized by the Wikimedia Foundation"
.. " to do so. No editor may remove this notice.'''"
return ret
end,
image = 'Office-protection-shackle.svg',
},
sock = {
description = 'For pages protected due to'
.. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
.. ' [[Wikipedia:Blocking policy|blocked]] or'
.. ' [[Wikipedia:Banning policy|banned users]]'
.. ' from editing it.',
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
.. ' editing it',
},
template = {
description = 'For [[Wikipedia:High-risk templates|high-risk]]'
.. ' templates and Lua modules',
text = 'This is a permanently [[Help:Protection|protected]] ${PAGETYPE},'
.. ' as it is [[Wikipedia:High-risk templates|high-risk]].',
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] or'
.. ' [[Wikipedia:Template editor|template editor]] to make an edit if'
.. ' it is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by'
.. ' [[Wikipedia:Consensus|consensus]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}'
.. ' to prevent vandalism',
alt = 'Permanently protected ${PAGETYPE}',
},
usertalk = {
description = 'For pages protected against disruptive edits by a'
.. ' particular user',
text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
.. ' such as abusing the'
.. ' {{[[Template:unblock|unblock]]}} template.',
explanation = 'If you cannot edit this user talk page and you need to'
.. ' make a change or leave a message, you can'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for edits to a protected page'
.. '|request an edit]],'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]],'
.. ' [[Special:Userlogin|log in]],'
.. ' or [[Special:UserLogin/signup|create an account]].',
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism|vandalism]]',
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|vandalism]].',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.level == 'sysop' then
ret = ret .. "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. '
end
return ret .. '${EXPLANATIONBLURB}'
end,
tooltip = '${TOOLTIPFRAGMENT} due to vandalism',
}
},
move = {
dispute = {
description = 'For pages protected against page moves due to'
.. ' disputes over the page title',
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
image = 'Move-protection-shackle.svg'
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism#Page-move vandalism'
.. ' |page-move vandalism]]'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|'
.. 'protected]] from editing',
autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access'
.. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered'
.. ' users|unregistered]] users is currently [[Help:Protection|disabled]]',
extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection',
},
move = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'
.. ' from [[Help:Moving a page|page moves]]'
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'Uploading new versions of this ${PAGETYPE} is currently disabled'
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
},
extendedconfirmed = {
default = 'Extended confirmed protection prevents edits from all unregistered editors'
.. ' and registered users with fewer than 30 days tenure and 500 edits.'
.. ' The [[Wikipedia:Protection policy#extended|policy on community use]]'
.. ' specifies that extended confirmed protection can be applied to combat'
.. ' disruption, if semi-protection has proven to be ineffective.'
.. ' Extended confirmed protection may also be applied to enforce'
.. ' [[Wikipedia:Arbitration Committee|arbitration sanctions]].'
.. ' Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask for uncontroversial changes supported by'
.. ' [[Wikipedia:Consensus|consensus]].'
},
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]]. You may also [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|request]] that this page be unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' You may [[Wikipedia:Requests for page'
.. ' protection#Current requests for edits to a protected page|request an'
.. ' edit]] to this page, or [[Wikipedia:Requests for'
.. ' page protection#Current requests for reduction in protection level'
.. '|ask]] for it to be unprotected.'
}
},
move = {
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves on the'
.. ' ${TALKPAGE} or at [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves at'
.. ' [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but new versions of the file'
.. ' cannot be uploaded until it is unprotected. You can'
.. ' request that a new version be uploaded by using a'
.. ' [[Wikipedia:Edit requests|protected edit request]], or you'
.. ' can [[Wikipedia:Requests for page protection|request]]'
.. ' that the file be unprotected.'
}
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and protection level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionLevels = {
edit = {
default = 'protected',
templateeditor = 'template-protected',
extendedconfirmed = 'extended-protected',
autoconfirmed = 'semi-protected',
},
move = {
default = 'move-protected'
},
autoreview = {
},
upload = {
default = 'upload-protected'
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Full-protection-shackle.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Extended-protection-shackle.svg',
autoconfirmed = 'Semi-protection-shackle.svg'
},
move = {
default = 'Move-protection-shackle.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload-protection-shackle.svg'
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:Protection policy#full',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:Protection policy#extended',
autoconfirmed = 'Wikipedia:Protection policy#semi'
},
move = {
default = 'Wikipedia:Protection policy#move'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = 'Wikipedia:Protection policy#upload'
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
autoreview = 'pp-autoreview',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = 'Wikipedia fully protected pages',
['all|all|office|all|all'] = 'Wikipedia Office-protected pages',
['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',
['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',
['all|all|mainpage|all|all'] = 'Wikipedia fully-protected main page files',
['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',
['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',
['all|template|all|all|edit'] = 'Wikipedia fully protected templates',
['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages',
['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',
['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',
['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',
['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',
['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',
['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',
['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',
['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',
['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',
['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates',
['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',
['all|all|all|templateeditor|edit'] = 'Wikipedia template-protected pages other than templates and modules',
['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',
['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates
['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',
['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',
['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',
['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',
['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',
['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',
['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files',
['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages',
['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages',
['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates',
['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates',
['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',
['all|module|all|all|edit'] = 'Wikipedia fully-protected modules',
['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',
['all|module|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected modules',
['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules',
['all|all|all|sysop|move'] = 'Wikipedia move-protected pages',
['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',
['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',
['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',
['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',
['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',
['all|template|all|sysop|move'] = 'Wikipedia move-protected templates',
['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',
['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',
['all|file|all|all|upload'] = 'Wikipedia upload-protected files',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true,
upload = false
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
[0] = 'article',
[6] = 'file',
[10] = 'template',
[14] = 'category',
[828] = 'module',
default = 'page'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-extended'] = {'ecp'},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move', catonly = 'yes'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc'] = {action = 'autoreview', small = true},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-upload'] = {action = 'upload'},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.',
['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.',
['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',
['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},',
['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = 'protection log',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = 'current title',
['current-version-edit-display'] = 'current version',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'talk page',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'F j, Y "at" H:i e',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates',
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Full-protection-shackle.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
eeb6sgpzkp24z3uln44ko8rah6nhotf
Module:Redirect
828
38849415
1043472510
1043456012
2021-09-10T07:46:37Z
Johnuniq
6036800
restore p.getTargetFromText which is used by [[Module:RfD]] which is causing "Lua error in Module:RfD at line 87: attempt to call upvalue 'getTargetFromText' (a nil value)"
Scribunto
text/plain
-- This module provides functions for getting the target of a redirect page.
local p = {}
-- Gets a mw.title object, using pcall to avoid generating script errors if we
-- are over the expensive function count limit (among other possible causes).
local function getTitle(...)
local success, titleObj = pcall(mw.title.new, ...)
if success then
return titleObj
else
return nil
end
end
-- Gets the name of a page that a redirect leads to, or nil if it isn't a
-- redirect.
function p.getTargetFromText(text)
local target = string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)%]%]"
) or string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)|[^%[%]]-%]%]"
)
return target and mw.uri.decode(target, 'PATH')
end
-- Gets the target of a redirect. If the page specified is not a redirect,
-- returns nil.
function p.getTarget(page, fulltext)
-- Get the title object. Both page names and title objects are allowed
-- as input.
local titleObj
if type(page) == 'string' or type(page) == 'number' then
titleObj = getTitle(page)
elseif type(page) == 'table' and type(page.getContent) == 'function' then
titleObj = page
else
error(string.format(
"bad argument #1 to 'getTarget'"
.. " (string, number, or title object expected, got %s)",
type(page)
), 2)
end
if not titleObj then
return nil
end
local targetTitle = titleObj.redirectTarget
if targetTitle then
if fulltext then
return targetTitle.fullText
else
return targetTitle.prefixedText
end
else
return nil
end
end
--[[
-- Given a single page name determines what page it redirects to and returns the
-- target page name, or the passed page name when not a redirect. The passed
-- page name can be given as plain text or as a page link.
--
-- Returns page name as plain text, or when the bracket parameter is given, as a
-- page link. Returns an error message when page does not exist or the redirect
-- target cannot be determined for some reason.
--]]
function p.luaMain(rname, bracket, fulltext)
if type(rname) ~= "string" or not rname:find("%S") then
return nil
end
bracket = bracket and "[[%s]]" or "%s"
rname = rname:match("%[%[(.+)%]%]") or rname
local target = p.getTarget(rname, fulltext)
local ret = target or rname
ret = getTitle(ret)
if ret then
if fulltext then
ret = ret.fullText
else
ret = ret.prefixedText
end
return bracket:format(ret)
else
return nil
end
end
-- Provides access to the luaMain function from wikitext.
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
return p.luaMain(args[1], args.bracket, args.fulltext) or ''
end
-- Returns true if the specified page is a redirect, and false otherwise.
function p.luaIsRedirect(page)
local titleObj = getTitle(page)
if not titleObj then
return false
end
if titleObj.isRedirect then
return true
else
return false
end
end
-- Provides access to the luaIsRedirect function from wikitext, returning 'yes'
-- if the specified page is a redirect, and the blank string otherwise.
function p.isRedirect(frame)
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
if p.luaIsRedirect(args[1]) then
return 'yes'
else
return ''
end
end
return p
ixuh7hehfu8mxwx3ai7pksok45inaxs
Module:Redirect hatnote
828
42680232
1086940527
1021502368
2022-05-09T09:30:25Z
Tamzin
17820167
add kerning for redir titles beginning or ending with apostrophes or quotation marks, as at [[Neighbourhood]] and [[Kurtis Blow]]
Scribunto
text/plain
--[[
-- This module produces a "redirect" hatnote. It looks like this:
-- '"X" redirects here. For other uses, see Y.'
-- It implements the {{redirect}} template.
--]]
local mHatnote = require('Module:Hatnote')
local mHatList = require('Module:Hatnote list')
local mArguments --lazily initialize
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
local p = {}
local function getTitle(...)
local success, titleObj = pcall(mw.title.new, ...)
if success then
return titleObj
else
return nil
end
end
function p.redirect(frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame, {parentOnly=true})
--Get number of redirects
local numRedirects = tonumber(frame.args[1]) or 1
-- Create the options table.
local options = {}
options.selfref = args.selfref
return p._redirect(args, numRedirects, options)
end
function p._redirect(args, numRedirects, options, currentTitle, redirectTitle, targetTitle)
-- Validate the input. Don't bother checking currentTitle, redirectTitle or
-- targetTitle, as they are only used in testing.
checkType('_redirect', 1, args, 'table')
checkType('_redirect', 2, numRedirects, 'number', true)
numRedirects = numRedirects or 1
checkType('_redirect', 3, options, 'table', true)
options = options or {}
currentTitle = currentTitle or mw.title.getCurrentTitle()
-- Get the table of redirects
local redirect = {}
for i = 1, numRedirects do
-- Return an error if a redirect parameter is missing.
if not args[i] then
return mHatnote.makeWikitextError(
'missing redirect parameter',
'Template:Redirect#Errors',
args.category
)
end
redirect[i] = args[i]
end
-- Generate the text.
local formattedRedirect = {}
for k,v in pairs(redirect) do
formattedRedirect[k] = p._quote(v)
end
local text = {
mHatList.andList(formattedRedirect) .. ' ' .. (#redirect == 1 and 'redirects' or 'redirect') .. ' here.',
mHatList._forSee(args, #redirect + 1, {title = redirect[1], extratext = args.text})
}
text = table.concat(text, ' ')
-- Functionality for adding categories
local categoryTable = {}
local function addCategory(cat)
if cat and cat ~= '' then
-- Add by index to avoid duplicates
categoryTable[string.format('[[Category:%s]]', cat)] = true
end
end
--Generate tracking categories
local mhOptions = {}
local redirTitle
for k,v in pairs(redirect) do
-- We don't need a tracking category if the template invocation has been
-- copied directly from the docs, or if we aren't in main- or category-space.
if not v:find('^REDIRECT%d*$') and v ~= 'TERM' --
and currentTitle.namespace == 0 or currentTitle.namespace == 14
then
redirTitle = redirectTitle or getTitle(v)
if not redirTitle or not redirTitle.exists then
addCategory('Missing redirects')
elseif not redirTitle.isRedirect then
if string.find(redirTitle:getContent(), '#invoke:RfD') then
addCategory('Articles with redirect hatnotes impacted by RfD')
else
addCategory('Articles with redirect hatnotes needing review')
end
else
local target = targetTitle or redirTitle.redirectTarget
if target and target ~= currentTitle then
addCategory('Articles with redirect hatnotes needing review')
end
end
end
-- Generate the options to pass to [[Module:Hatnote]].
if currentTitle.namespace == 0 and not mhOptions.selfref
and redirTitle and redirTitle.namespace ~= 0
then
-- We are on a mainspace page, and the hatnote starts with something
-- like "Wikipedia:Foo redirects here", so automatically label it as
-- a self-reference.
mhOptions.selfref = true
else
mhOptions.selfref = options.selfref
end
end
--concatenate all the categories
local category = ''
for k,v in pairs(categoryTable) do
category = category .. k
end
return mHatnote._hatnote(text, mhOptions) .. category
end
function p._quote(title)
local quotationMarks = {["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true}
local style = ""
-- If string starts with anything in quotationMarks, kern to same degree {{-'}} does
if quotationMarks[string.sub(title, 1, 1)] then
style = "padding-left:0.15em;"
end
-- Likewise if it ends with any of them
if quotationMarks[string.sub(title, -1, -1)] then
style = style .. "padding-right:0.15em;"
end
return style ~= "" and '"<span style="' .. style .. '">' .. title .. '</span>"' or '"' .. title .. '"'
end
return p
4ptvz3xvkukjuuvtkt8mhdcswfxv2xx
Module:ResolveEntityId
828
56477902
1074949613
1073901179
2022-03-03T02:11:37Z
Ahecht
2016996
Sync from sandbox. Follow Wikipedia redirects, remove _entityid() function. Feel free to revert if any more issues crop up.
Scribunto
text/plain
local p = {}
function p._id(idOrTitle, alt)
local function checkId(id)
if id and mw.wikibase.entityExists(id) then
local sitelink = mw.wikibase.getSitelink(id)
if sitelink then
return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(id).id
end
return mw.wikibase.getEntity(id).id
else
return alt
end
end
if type(idOrTitle) == 'string' then
idOrTitle = mw.ustring.upper(mw.ustring.sub(idOrTitle, 1, 1)) .. mw.ustring.sub(idOrTitle, 2)
if mw.wikibase.isValidEntityId(idOrTitle) then
-- idOrTitle is in the proper format for a Wikidata entity ID
return checkId(idOrTitle)
else
local eid = mw.wikibase.getEntityIdForTitle(idOrTitle)
if eid then
-- idOrTitle is a title that matches a Wikidata entity
local instanceOf = mw.wikibase.getBestStatements(eid, 'P31')[1] --instance of
if not instanceOf or instanceOf.mainsnak.datavalue.value.id ~= 'Q4167410' then
-- instance-of value is missing or is not "disambiguation"
return checkId(eid)
end
else
-- idOrTitle is a title, but no wikidata item exists for that title
local rtarget = mw.title.new(idOrTitle).redirectTarget
if rtarget then
-- title is a Wikipedia redirect
return p._id(rtarget.fullText, alt)
end
end
end
end
return alt
end
function p.entityid(frame)
return p._id(frame.args[1], frame.args[2])
end
return p
9l1sws0u0b0ltjr9lghqn47cx0xng74
Module:Respell
828
54048265
910816349
910657161
2019-08-14T17:08:51Z
Nardog
5908908
simpler
Scribunto
text/plain
local p = {}
function p._main(args)
local ret = {}
for i, v in ipairs(args) do
v = mw.text.trim(v)
-- Compatibility: Ignore arguments that only contain an apostrophe
if v ~= '' and v ~= "'" then
if ret[#ret]
and not (ret[#ret]:find('_') or ret[#ret]:find('%-%)?$'))
and not (v:find('_') or v:find('^%(?%-'))
then
table.insert(ret, '-')
end
if v:find('^[%u%(%)]+$') then
v = '<span style="font-size:90%">' .. v .. '</span>'
end
table.insert(ret, v)
end
end
ret = '<i title="English pronunciation respelling">' ..
table.concat(ret):gsub('_', ' ')
-- Avoid dangling hyphens
:gsub(' %-', ' -⁠')
:gsub('^%-', '-⁠')
.. '</i>'
if args.link ~= 'no' then
ret = '[[Help:Pronunciation respelling key|' .. ret .. ']]'
end
return ret
end
function p.main(frame)
return p._main(frame:getParent().args)
end
return p
htpmgpv11yz1k327zvrcx0cmq7gk1mz
Module:SDcat
828
64744418
973333723
973332619
2020-08-16T17:20:37Z
RexxS
6112901
if no connection to Wikidata, then do nothing
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
Module:Separated entries
828
46440383
874210307
847543373
2018-12-17T20:54:33Z
Amorymeltzer
141948
Changed protection level for "[[Module:Separated entries]]": [[WP:High-risk templates|High-risk Lua module]]: Over 2M transclusions ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
Scribunto
text/plain
-- This module takes positional parameters as input and concatenates them with
-- an optional separator. The final separator (the "conjunction") can be
-- specified independently, enabling natural-language lists like
-- "foo, bar, baz and qux". The starting parameter can also be specified.
local compressSparseArray = require('Module:TableTools').compressSparseArray
local p = {}
function p._main(args)
local separator = args.separator
-- Decode (convert to Unicode) HTML escape sequences, such as " " for space.
and mw.text.decode(args.separator) or ''
local conjunction = args.conjunction and mw.text.decode(args.conjunction) or separator
-- Discard values before the starting parameter.
local start = tonumber(args.start)
if start then
for i = 1, start - 1 do args[i] = nil end
end
-- Discard named parameters.
local values = compressSparseArray(args)
return mw.text.listToText(values, separator, conjunction)
end
local function makeInvokeFunction(separator, conjunction, first)
return function (frame)
local args = require('Module:Arguments').getArgs(frame)
args.separator = separator or args.separator
args.conjunction = conjunction or args.conjunction
args.first = first or args.first
return p._main(args)
end
end
p.main = makeInvokeFunction()
p.br = makeInvokeFunction('<br />')
p.comma = makeInvokeFunction(mw.message.new('comma-separator'):plain())
return p
r3n53qz4zycs3vxyo5ms9qjo1jm32bp
Module:Side box
828
42926982
1096940545
1033200411
2022-07-07T17:00:06Z
Izno
2927383
-mbox, templatestyled, table -> div
Scribunto
text/plain
local yesno = require('Module:Yesno')
local p = {}
local function makeData(args)
local data = {}
-- Main table classes
data.classes = {}
if yesno(args.metadata) ~= false then
table.insert(data.classes, 'metadata')
end
if args.position and args.position:lower() == 'left' then
table.insert(data.classes, 'side-box-left')
else
table.insert(data.classes, 'side-box-right')
end
if args.collapsible then
table.insert(data.classes, 'mw-collapsible')
if args.collapsible == "collapsed" then
table.insert(data.classes, 'mw-collapsed')
end
data.collapsible = true
end
table.insert(data.classes, args.class)
-- Image
if args.image and args.image ~= 'none' then
data.image = args.image
end
-- Copy over data that does not need adjusting
local argsToCopy = {
-- aria qualities
'role',
'labelledby',
-- Classes
'textclass',
-- Styles
'style',
'textstyle',
'templatestyles',
-- Above row
'above',
'abovestyle',
-- Body row
'text',
'imageright',
-- Below row
'below',
}
for i, key in ipairs(argsToCopy) do
data[key] = args[key]
end
return data
end
local function renderSidebox(data)
-- Renders the sidebox HTML.
-- Table root
local root = mw.html.create('div')
root:attr('role', data.role)
:attr('aria-labelledby', data.labelledby)
:addClass('side-box')
for i, class in ipairs(data.classes or {}) do
root:addClass(class)
end
if data.style then
root:cssText(data.style)
end
-- The "above" row
if data.above then
local above = root:newline():tag('div')
above:addClass('side-box-abovebelow')
:newline()
:wikitext(data.above)
if data.textstyle then
above:cssText(data.textstyle)
end
if data.abovestyle then
above:cssText(data.abovestyle)
end
end
-- The body row
local body = root:newline():tag('div')
body:addClass('side-box-flex')
:addClass(data.collapsible and 'mw-collapsible-content')
:newline()
if data.image then
body:tag('div')
:addClass('side-box-image')
:wikitext(data.image)
end
local text = body:newline():tag('div')
text:addClass('side-box-text')
:addClass(data.textclass or 'plainlist')
if data.textstyle then
text:cssText(data.textstyle)
end
text:wikitext(data.text)
if data.imageright then
body:newline():tag('div')
:addClass('side-box-imageright')
:wikitext(data.imageright)
end
-- The below row
if data.below then
local below = root:newline():tag('div')
below
:addClass('side-box-abovebelow')
:wikitext(data.below)
if data.textstyle then
below:cssText(data.textstyle)
end
end
root:newline()
local frame = mw.getCurrentFrame()
local templatestyles = ''
if data.templatestyles then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = data.templatestyles }
}
end
return frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Side box/styles.css' }
} .. templatestyles .. tostring(root)
end
function p._main(args)
local data = makeData(args)
return renderSidebox(data)
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
egcspx2irukqbdg26nexp0sq0xy7sp0
Module:Sidebar
828
38866323
1036808367
1013637399
2021-08-02T20:35:56Z
Izno
2927383
make wraplinks work like it used to
Scribunto
text/plain
--
-- This module implements {{Sidebar}}
--
require('Module:No globals')
local cfg = mw.loadData('Module:Sidebar/configuration')
local p = {}
local getArgs = require('Module:Arguments').getArgs
--[[
Categorizes calling templates and modules with a 'style' parameter of any sort
for tracking to convert to TemplateStyles.
TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module.
TODO would probably want to remove /log and /archive as CS1 does
]]
local function categorizeTemplatesWithInlineStyles(args)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 and title.namespace ~= 828 then return '' end
for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do
if title.text:match(pattern) then return '' end
end
for key, _ in pairs(args) do
if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then
return cfg.i18n.category.conversion
end
end
end
--[[
For compatibility with the original {{sidebar with collapsible lists}}
implementation, which passed some parameters through {{#if}} to trim their
whitespace. This also triggered the automatic newline behavior.
]]
-- See ([[meta:Help:Newlines and spaces#Automatic newline]])
local function trimAndAddAutomaticNewline(s)
s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")
if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then
return '\n' .. s
else
return s
end
end
--[[
Finds whether a sidebar has a subgroup sidebar.
]]
local function hasSubgroup(s)
if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then
return true
else
return false
end
end
--[[
Main sidebar function. Takes the frame, args, and an optional collapsibleClass.
The collapsibleClass is and should be used only for sidebars with collapsible
lists, as in p.collapsible.
]]
function p.sidebar(frame, args, collapsibleClass)
if not args then
args = getArgs(frame)
end
local root = mw.html.create()
local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes
root = root:tag('table')
if not child then
root
:addClass(cfg.i18n.class.sidebar)
-- force collapsibleclass to be sidebar-collapse otherwise output nothing
:addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil)
:addClass('nomobile')
:addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil)
:addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil)
:addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil)
:addClass(args.bodyclass or args.class)
:css('width', args.width or nil)
:cssText(args.bodystyle or args.style)
if args.outertitle then
root
:tag('caption')
:addClass(cfg.i18n.class.outer_title)
:addClass(args.outertitleclass)
:cssText(args.outertitlestyle)
:wikitext(args.outertitle)
end
if args.topimage then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.top_image)
:addClass(args.topimageclass)
:cssText(args.topimagestyle)
:wikitext(args.topimage)
if args.topcaption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.top_caption)
:cssText(args.topcaptionstyle)
:wikitext(args.topcaption)
end
end
if args.pretitle then
root
:tag('tr')
:tag('td')
:addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image
or cfg.i18n.class.pretitle)
:addClass(args.pretitleclass)
:cssText(args.basestyle)
:cssText(args.pretitlestyle)
:wikitext(args.pretitle)
end
else
root
:addClass(cfg.i18n.class.subgroup)
:addClass(args.bodyclass or args.class)
:cssText(args.bodystyle or args.style)
end
if args.title then
if child then
root
:wikitext(args.title)
else
root
:tag('tr')
:tag('th')
:addClass(args.pretitle and cfg.i18n.class.title_with_pretitle
or cfg.i18n.class.title)
:addClass(args.titleclass)
:cssText(args.basestyle)
:cssText(args.titlestyle)
:wikitext(args.title)
end
end
if args.image then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.image)
:addClass(args.imageclass)
:cssText(args.imagestyle)
:wikitext(args.image)
if args.caption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.caption)
:cssText(args.captionstyle)
:wikitext(args.caption)
end
end
if args.above then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.above)
:addClass(args.aboveclass)
:cssText(args.abovestyle)
:newline() -- newline required for bullet-points to work
:wikitext(args.above)
end
local rowNums = {}
for k, v in pairs(args) do
k = '' .. k
local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$')
if num then table.insert(rowNums, tonumber(num)) end
end
table.sort(rowNums)
-- remove duplicates from the list (e.g. 3 will be duplicated if both heading3
-- and content3 are specified)
for i = #rowNums, 1, -1 do
if rowNums[i] == rowNums[i - 1] then
table.remove(rowNums, i)
end
end
for i, num in ipairs(rowNums) do
local heading = args['heading' .. num]
if heading then
root
:tag('tr')
:tag('th')
:addClass(cfg.i18n.class.heading)
:addClass(args.headingclass)
:addClass(args['heading' .. num .. 'class'])
:cssText(args.basestyle)
:cssText(args.headingstyle)
:cssText(args['heading' .. num .. 'style'])
:newline()
:wikitext(heading)
end
local content = args['content' .. num]
if content then
root
:tag('tr')
:tag('td')
:addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup
or cfg.i18n.class.content)
:addClass(args.contentclass)
:addClass(args['content' .. num .. 'class'])
:cssText(args.contentstyle)
:cssText(args['content' .. num .. 'style'])
:newline()
:wikitext(content)
:done()
-- Without a linebreak after the </td>, a nested list like
-- "* {{hlist| ...}}" doesn't parse correctly.
:newline()
end
end
if args.below then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.below)
:addClass(args.belowclass)
:cssText(args.belowstyle)
:newline()
:wikitext(args.below)
end
if not child then
if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and
(args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~=
cfg.i18n.title_not_to_add_navbar) then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.navbar)
:cssText(args.navbarstyle)
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
fontstyle = args.navbarfontstyle
})
end
end
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.i18n.templatestyles }
}
local templatestyles = ''
if args['templatestyles'] and args['templatestyles'] ~= '' then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] and args['child templatestyles'] ~= '' then
child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then
grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
base_templatestyles,
templatestyles,
child_templatestyles,
grandchild_templatestyles,
tostring(root),
(child and cfg.i18n.category.child or ''),
categorizeTemplatesWithInlineStyles(args)
})
end
local function list_title(args, is_centered_list_titles, num)
local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title']
or cfg.i18n.default_list_title)
local title
if is_centered_list_titles then
-- collapsible can be finicky, so provide some CSS/HTML to support
title = mw.html.create('div')
:addClass(cfg.i18n.class.list_title_centered)
:wikitext(title_text)
else
title = mw.html.create()
:wikitext(title_text)
end
local title_container = mw.html.create('div')
:addClass(cfg.i18n.class.list_title)
-- don't /need/ a listnumtitleclass because you can do
-- .templateclass .listnumclass .sidebar-list-title
:addClass(args.listtitleclass)
:cssText(args.basestyle)
:cssText(args.listtitlestyle)
:cssText(args['list' .. num .. 'titlestyle'])
:node(title)
:done()
return title_container
end
--[[
Main entry point for sidebar with collapsible lists.
Does the work of creating the collapsible lists themselves and including them
into the args.
]]
function p.collapsible(frame)
local args = getArgs(frame)
if not args.name and
frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') ==
cfg.i18n.collapse_title_not_to_add_navbar then
args.navbar = cfg.i18n.navbar_none
end
local contentArgs = {}
local is_centered_list_titles
if args['centered list titles'] and args['centered list titles'] ~= '' then
is_centered_list_titles = true
else
is_centered_list_titles = false
end
for k, v in pairs(args) do
local num = string.match(k, '^list(%d+)$')
if num then
local expand = args.expanded and
(args.expanded == 'all' or args.expanded == args['list' .. num .. 'name'])
local row = mw.html.create('div')
row
:addClass(cfg.i18n.class.list)
:addClass('mw-collapsible')
:addClass((not expand) and 'mw-collapsed' or nil)
:addClass(args['list' .. num .. 'class'])
:cssText(args.listframestyle)
:cssText(args['list' .. num .. 'framestyle'])
:node(list_title(args, is_centered_list_titles, num))
:tag('div')
:addClass(cfg.i18n.class.list_content)
:addClass('mw-collapsible-content')
-- don't /need/ a listnumstyleclass because you can do
-- .templatename .listnumclass .sidebar-list
:addClass(args.listclass)
:cssText(args.liststyle)
:cssText(args['list' .. num .. 'style'])
:wikitext(trimAndAddAutomaticNewline(args['list' .. num]))
contentArgs['content' .. num] = tostring(row)
end
end
for k, v in pairs(contentArgs) do
args[k] = v
end
return p.sidebar(frame, args, cfg.i18n.class.collapse)
end
return p
dqe3p6l293j6ldrj3b5n5gg76puqau7
Module:Sidebar/configuration
828
66261134
1036808391
1013635331
2021-08-02T20:36:03Z
Izno
2927383
wraplinks work like it used to
Scribunto
text/plain
return {
i18n = {
child_yes = 'yes',
float_none = 'none',
float_left = 'left',
wrap_true = 'true',
navbar_none = 'none',
navbar_off = 'off',
default_list_title = 'List',
title_not_to_add_navbar = 'Template:Sidebar',
collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists',
templatestyles = 'Module:Sidebar/styles.css',
category = {
child = '[[Category:Pages using sidebar with the child parameter]]',
conversion = '[[Category:Sidebars with styles needing conversion]]'
},
pattern = {
collapse_sandbox = '/sandbox$',
sandbox = '/sandbox$',
subgroup = 'sidebar%-subgroup',
style_conversion = 'style$',
uncategorized_conversion_titles = {
'/[Ss]andbox',
'/[Tt]estcases',
'/[Dd]oc$'
}
},
class = {
sidebar = 'sidebar',
subgroup = 'sidebar-subgroup',
collapse = 'sidebar-collapse',
float_none = 'sidebar-none',
float_left = 'sidebar-left',
wraplinks = 'nowraplinks',
outer_title = 'sidebar-outer-title',
top_image = 'sidebar-top-image',
top_caption = 'sidebar-top-caption',
pretitle = 'sidebar-pretitle',
pretitle_with_top_image = 'sidebar-pretitle-with-top-image',
title = 'sidebar-title',
title_with_pretitle = 'sidebar-title-with-pretitle',
image = 'sidebar-image',
caption = 'sidebar-caption',
above = 'sidebar-above',
heading = 'sidebar-heading',
content = 'sidebar-content',
content_with_subgroup = 'sidebar-content-with-subgroup',
below = 'sidebar-below',
navbar = 'sidebar-navbar',
list = 'sidebar-list',
list_title = 'sidebar-list-title',
list_title_centered = 'sidebar-list-title-c',
list_content = 'sidebar-list-content'
}
}
}
0rujaua8lftdvsbwq4988fo6iw6xlak
Module:Sidebar/styles.css
828
66235483
1045330069
1045150921
2021-09-20T01:15:45Z
Goszei
36510957
self-rv, it's a little tight
sanitized-css
text/css
/* {{pp-template}} */
/* TODO: Invert width design to be "mobile first" */
.sidebar {
/* TODO: Ask if we should have max-width 22em instead */
width: 22em;
/* @noflip */
float: right;
/* @noflip */
clear: right;
/* @noflip */
margin: 0.5em 0 1em 1em;
background: #f8f9fa;
border: 1px solid #aaa;
padding: 0.2em;
text-align: center;
line-height: 1.4em;
font-size: 88%;
border-collapse: collapse;
/* Timeless has display: none on .nomobile at mobile resolutions, so we
* unhide it with display: table and let precedence and proximity win.
*/
display: table;
}
/* Unfortunately, so does Minerva desktop, except Minerva drops an
* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on [[:phab:T111565]].)
*/
body.skin-minerva .sidebar {
display: table !important;
/* also, minerva is way too aggressive about other stylings on tables.
* TODO remove when this template gets moved to a div. plans on talk page.
* We always float right on Minerva because that's a lot of extra CSS
* otherwise. */
float: right !important;
margin: 0.5em 0 1em 1em !important;
}
.sidebar-subgroup {
width: 100%;
margin: 0;
border-spacing: 0;
}
.sidebar-left {
/* @noflip */
float: left;
/* @noflip */
clear: left;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-none {
float: none;
clear: both;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-outer-title {
padding: 0 0.4em 0.2em;
font-size: 125%;
line-height: 1.2em;
font-weight: bold;
}
.sidebar-top-image {
padding: 0.4em;
}
.sidebar-top-caption,
.sidebar-pretitle-with-top-image,
.sidebar-caption {
padding: 0.2em 0.4em 0;
line-height: 1.2em;
}
.sidebar-pretitle {
padding: 0.4em 0.4em 0;
line-height: 1.2em;
}
.sidebar-title,
.sidebar-title-with-pretitle {
padding: 0.2em 0.8em;
font-size: 145%;
line-height: 1.2em;
}
.sidebar-title-with-pretitle {
padding: 0.1em 0.4em;
}
.sidebar-image {
padding: 0.2em 0.4em 0.4em;
}
.sidebar-heading {
padding: 0.1em 0.4em;
}
.sidebar-content {
padding: 0 0.5em 0.4em;
}
.sidebar-content-with-subgroup {
padding: 0.1em 0.4em 0.2em;
}
.sidebar-above,
.sidebar-below {
padding: 0.3em 0.8em;
font-weight: bold;
}
.sidebar-collapse .sidebar-above,
.sidebar-collapse .sidebar-below {
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
.sidebar-navbar {
text-align: right;
font-size: 115%;
padding: 0 0.4em 0.4em;
}
.sidebar-list-title {
padding: 0 0.4em;
text-align: left;
font-weight: bold;
line-height: 1.6em;
font-size: 105%;
}
/* centered text with mw-collapsible headers is finicky */
.sidebar-list-title-c {
padding: 0 0.4em;
text-align: center;
margin: 0 3.3em;
}
@media (max-width: 720px) {
/* users have wide latitude to set arbitrary width and margin :(
"Super-specific" selector to prevent overriding this appearance by
lower level sidebars too */
body.mediawiki .sidebar {
width: 100% !important;
clear: both;
float: none !important; /* Remove when we div based; Minerva is dumb */
margin-left: 0 !important;
margin-right: 0 !important;
}
/* TODO: We might consider making all links wrap at small resolutions and then
* only introduce nowrap at higher resolutions. Do when we invert the media
* query.
*/
}
en9f828813j59rhubpbkm63sj6kasx7
Module:Sister project links
828
66183378
1096941182
1092844931
2022-07-07T17:05:25Z
Izno
2927383
split templatestyles to bar and not bar forms
Scribunto
text/plain
require('Module:No globals')
-- Module to create sister project link box
local getArgs = require('Module:Arguments').getArgs
local commonsLink = require('Module:Commons link')
local sideBox = require('Module:Side box')._main
local generateWarning = require('Module:If preview')._warning
local p = {}
local logo = {
wikt="Wiktionary-logo-v2.svg",
c="Commons-logo.svg",
n="Wikinews-logo.svg",
q="Wikiquote-logo.svg",
s="Wikisource-logo.svg",
b="Wikibooks-logo.svg",
voy="Wikivoyage-Logo-v3-icon.svg",
v="Wikiversity logo 2017.svg",
d="Wikidata-logo.svg",
species="Wikispecies-logo.svg",
m="Wikimedia Community Logo.svg",
mw="MediaWiki-2020-icon.svg"}
local prefixList = {'wikt', 'c', 'n', 'q', 's', 'b', 'voy', 'v', 'd',
'species', 'species_author', 'm', 'mw'}
local sisterName = {
wikt="Wiktionary",
c="Commons",
n="Wikinews",
q="Wikiquote",
s="Wikisource",
b="Wikibooks",
voy="Wikivoyage",
v="Wikiversity",
d="Wikidata",
species="Wikispecies",
m="Meta-Wiki",
mw="MediaWiki"}
local sisterInfo = {
wikt="Definitions",
c="Media",
n="News",
q="Quotations",
s="Texts",
b="Textbooks",
voy="Travel guides",
v="Resources",
d="Data",
species="Taxa",
species_author="Authorship",
m="Discussions",
mw="Documentation"
}
local defaultSisters = {
wikt=true,
c=true,
n=true,
q=true,
s=true,
b=true,
voy='auto',
v=true,
d=false,
species='auto',
species_author=false,
m=false,
mw=false
}
local sisterDb = {
wikt="enwiktionary",
n="enwikinews",
q="enwikiquote",
s="enwikisource",
b="enwikibooks",
voy="enwikivoyage",
v="enwikiversity",
species="specieswiki"}
local trackingType = {
wdMismatch="Pages using Sister project links with wikidata mismatch",
wdNamespace="Pages using Sister project links with wikidata namespace mismatch",
wdHidden="Pages using Sister project links with hidden wikidata",
defaultSearch="Pages using Sister project links with default search"}
local inSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true)
-- Function to add "-sand" to classes when called from sandbox
local function sandbox(s)
return inSandbox and s.."-sand" or s
end
-- Function to canonicalize string
-- search for variants of "yes", and "no", and transform
-- them into a standard form (like [[Template:YesNo]])
-- Argument:
-- s --- input string
-- Result:
-- {x,y} list of length 2
-- x = nil if s is canonicalized, otherwise has trimmed s
-- y = canonical form of s (true if "yes" or other, false if "no", nil if blank)
local function canonicalize(s)
if s == nil then
return {nil, nil}
end
-- if s is table/list, then assume already canonicalized and return unchanged
if tostring(type(s)) == "table" then
return s
end
s = mw.text.trim(tostring(s))
if s == "" then
return {nil, nil}
end
local lowerS = s:lower()
-- Check for various forms of "yes"
if lowerS == 'yes' or lowerS == 'y' or lowerS == 't'
or lowerS == '1' or lowerS == 'true' or lowerS == 'on' then
return {nil, true}
end
-- Check for various forms of "no"
if lowerS == 'no' or lowerS == 'n' or lowerS == 'f'
or lowerS == '0' or lowerS == 'false' or lowerS == 'off'then
return {nil, false}
end
-- Neither yes nor no recognized, leave string trimmed
return {s, true}
end
-- Merge two or more canonicalized argument lists
-- Arguments:
-- argList = list of canonicalized arguments
-- noAll = if true, return no when all argList is no.
-- otherwise, return blank when all argList is blank
local function mergeArgs(argList,noAll)
local test = nil -- default, return blank if all blank
if noAll then
test = false -- return no if all no
end
local allSame = true
-- Search through string for first non-no or non-blank
for _, arg in ipairs(argList) do
if arg[2] then
return arg -- found non-no and non-blank, return it
end
-- test to see if argList is all blank / no
allSame = allSame and (arg[2] == test)
end
-- if all blank / no, return blank / no
if allSame then
return {nil, test} -- all match no/blank, return it
end
-- otherwise, return no / blank
if noAll then
return {nil, nil}
end
return {nil, false}
end
-- Function to get sitelink for a wiki
-- Arguments:
-- wiki = db name of wiki to lookup
-- qid = QID of entity to search for, current page entity by default
local function getSitelink(wiki,qid)
-- return nil if some sort of lookup failure
return qid and mw.wikibase.getSitelink(qid,wiki)
end
-- Function to get sitelink for a wiki
-- Arguments:
-- prefix = prefix string for wiki to lookup
-- qid = QID of entity to search for, current page entity by default
local function fetchWikidata(prefix,qid)
local sisterDbName = sisterDb[prefix]
return sisterDbName and getSitelink(sisterDbName,qid)
end
-- Function to generate the sister link itself
-- Arguments:
-- args = argument table for function
-- args[1] = page to fetch
-- args.default = link when blank
-- args.auto = new auto mode (don't fall back to search)
-- args.sitelink = wikidata sitelink (if available)
-- args.qid = QID of entity
-- args.search = fallback string to search for
-- args.sisterPrefix = wikitext prefix for sister site
-- args.information = type of info sister site contains
-- tracking = tracking table
local function genSisterLink(args, tracking)
if args[1][2] == false or (not args.default and args[1][2] == nil) then
return nil --- either editor specified "no", or "blank" (and default=no), then skip this sister
end
local sitelink = args.sitelink or fetchWikidata(args.sisterPrefix,args.qid)
if args.auto and not sitelink and args[1][2] == nil then
return nil --- in auto mode, if link is blank and no sitelink, then skip
end
-- fallback order of sister link: first specified page, then wikidata, then search
local link = args[1][1] or sitelink or (args.search and "Special:"..args.search)
if not link then
return nil --- no link found, just skip
end
if tracking then
-- update state for tracking categories
if args[1][1] and sitelink then
-- transform supplied page name to be in wiki-format
local page = mw.ustring.gsub(args[1][1],"_"," ")
page = mw.ustring.sub(page,1,1):upper()..mw.ustring.sub(page,2)
local pageNS = mw.ustring.match(page,"^([^:]+):")
local sitelinkNS = mw.ustring.match(sitelink,"^([^:]+):")
if page == sitelink then
tracking.wdHidden = args.sisterPrefix
elseif pageNS ~= sitelinkNS then
tracking.wdNamespace = args.sisterPrefix
else
tracking.wdMismatch = args.sisterPrefix
end
-- if no page link, nor a wikidata entry, and search is on, then warn
elseif not (args[1][2] or sitelink) and args.search then
tracking.defaultSearch = args.sisterPrefix
end
end
return {prefix=args.sisterPrefix, link=link, information=args.information}
end
-- Function to handle special case of commons link
local function commonsLinks(args, commonsPage)
-- use [[Module:Commons link]] to determine best commons link
local cLink = (not args.commonscat) and commonsLink._hasGallery(args.qid)
or commonsLink._hasCategory(args.qid)
if commonsPage[1] and not mw.ustring.match(commonsPage[1]:lower(),"^category:") then
commonsPage[1] = (args.commonscat and "Category:" or "")..commonsPage[1]
end
local commonsSearch = "Search/"..(args.commonscat and "Category:" or "")..args[1]
return {link=cLink, search=commonsSearch}
end
-- Function to handle special case for "author" and "cookbook"
local function handleSubtype(args)
local ns = args.ns
local ns_len = mw.ustring.len(ns)
local result = {}
result.sitelink = fetchWikidata(args.prefix, args.qid)
local subtype = false
if args.page then
if mw.ustring.sub(args.page,1,ns_len) == ns then
subtype = true
elseif args.subtype then
result.page = ns..args.page
subtype = true
end
elseif result.sitelink then
subtype = mw.ustring.sub(result.sitelink,1,ns_len) == ns
elseif args.subtype then
result.search = "Search/"..ns..args.default
subtype = true
end
if subtype then
result.info = args.info
end
return result
end
-- Function to create a sister link, by prefix
-- Arguments:
-- prefix = sister prefix (e.g., "c" for commons)
-- args = arguments for this sister (see p._sisterLink above)
-- tracking = tracking table
local function sisterLink(prefix, args, tracking)
-- determine arguments to genSisterLink according to prefix
if prefix == 'species_author' and not args.species[1] and args.species[2] and not args.species_author[1] and args.species_author[2] then
return nil
end
local default = defaultSisters[prefix]
if default == 'auto' then
default = args.auto
end
-- Handle exceptions by prefix
local search = ((prefix == 'd' and "ItemByTitle/enwiki/") or "Search/")..args[1]
local sitelink = prefix == 'd' and args.qid
local page = args[prefix]
local info = sisterInfo[prefix]
-- special case handling of author and cookbook
local subtype = nil
if prefix == 's' then
subtype = handleSubtype({prefix='s',qid=args.qid,subtype=args.author,page=page[1],
ns='Author:',info=nil,default=args[1]})
elseif prefix == 'b' then
subtype = handleSubtype({prefix='b',qid=args.qid,subtype=args.cookbook,page=page[1],
ns='Cookbook:',info='Recipes',default=args[1]})
end
if subtype then
page[1] = subtype.page or page[1]
search = subtype.search or search
sitelink = subtype.sitelink or sitelink
info = subtype.info or info
end
if prefix == 'voy' and not args.bar and not page[1] and page[2] ~= nil then
info = "Travel information"
end
info = args.information or info
if prefix == 'c' then
local commons = commonsLinks(args, page)
search = commons.search
sitelink = commons.link
end
prefix = (prefix == 'species_author' and 'species') or prefix
return genSisterLink({
page,
auto=args.auto,
qid=args.qid,
sitelink=sitelink,
default=default,
sisterPrefix = prefix,
search=search,
information=info}, tracking)
end
local function templatestyles_page(is_bar)
local sandbox = inSandbox and 'sandbox/' or ''
if is_bar then
return mw.ustring.format(
'Module:Sister project links/bar/%sstyles.css',
sandbox
)
end
return mw.ustring.format(
'Module:Sister project links/%sstyles.css',
sandbox
)
end
-- Function to create html containers for sister project link list
-- Arguments:
-- args = table of arguments
-- args.position: if 'left', position links to left
-- args.collapsible: if non-empty, make box collapsible. If 'collapse', start box hidden
-- args.style: CSS style string appended to end of default CSS
-- args.display: boldface name to display
local function createSisterBox(sisterList, args)
local list = mw.html.create('ul')
for i, link in ipairs(sisterList) do
local li = list:tag('li')
-- html element for 27px-high logo
local logoSpan = li:tag('span')
logoSpan:addClass(sandbox("sister-logo"))
logoSpan:wikitext("[[File:"..logo[link.prefix].."|27x27px|middle|link=|alt=]]")
-- html element for link
local linkspan = li:tag('span')
linkspan:addClass(sandbox("sister-link"))
local linkText = "[["..link.prefix..":"..link.link.."|"..link.information .."]] from "..sisterName[link.prefix]
linkspan:wikitext(linkText)
end
list:allDone()
return sideBox({
role = 'navigation',
labelledby = 'sister-projects',
class = sandbox("sister-box") .. ' sistersitebox plainlinks',
position = args.position,
style = args.style,
abovestyle = args.collapsible and 'clear: both' or nil,
above = mw.ustring.format(
"'''%s''' at Wikipedia's [[Wikipedia:Wikimedia sister projects|<span id=\"sister-projects\">sister projects</span>]]",
args.display or args[1]
),
text = tostring(list),
collapsible = args.collapsible,
templatestyles = templatestyles_page()
})
end
local function createSisterBar(sisterList,args)
local nav = mw.html.create( 'div' )
nav:addClass( 'noprint')
nav:addClass( 'metadata')
nav:addClass( sandbox('sister-bar'))
nav:attr( 'role', 'navigation' )
nav:attr( 'aria-label' , 'sister-projects' )
local header = nav:tag('div')
header:addClass(sandbox('sister-bar-header'))
local pagename = header:tag('b')
pagename:wikitext(args.display or args[1])
local headerText = " at Wikipedia's [[Wikipedia:Wikimedia sister projects|"
headerText = headerText..'<span id="sister-projects" style="white-space:nowrap;">sister projects</span>]]:'
header:wikitext(headerText)
if #sisterList == 1 then
header:wikitext("[[Category:Pages with single-entry sister bar]]")
end
local container = nav:tag('div')
container:addClass(sandbox('sister-bar-content'))
for _, link in ipairs(sisterList) do
local item = container:tag('div')
item:addClass(sandbox('sister-bar-item'))
local logoSpan = item:tag('span')
logoSpan:addClass(sandbox('sister-bar-logo'))
logoSpan:wikitext("[[File:"..logo[link.prefix].."|21x19px|link=|alt=]]")
local linkSpan = item:tag('span')
linkSpan:addClass(sandbox('sister-bar-link'))
linkSpan:wikitext("<b>[["..link.prefix..":"..link.link.."|"..link.information .."]]</b> from "..sisterName[link.prefix])
end
return nav
end
function p._main(args)
local titleObject = mw.title.getCurrentTitle()
-- find qid, either supplied with args, from search string, or from current page
args.qid = args.qid or mw.wikibase.getEntityIdForTitle(args[1] or "") or mw.wikibase.getEntityIdForCurrentPage()
args.qid = args.qid and args.qid:upper()
-- search string defaults to PAGENAME
args[1] = args[1] or mw.wikibase.getSitelink(args.qid or "") or titleObject.text
-- handle redundant "commons"/"c" prefix
args.c = args.c or args.commons
-- Canonicalize all sister links (handle yes/no/empty)
for _, k in ipairs(prefixList) do
args[k] = canonicalize(args[k])
end
-- Canonicalize cookbook
args.cookbook = canonicalize(args.cookbook)
args.b = mergeArgs({args.b,args.cookbook})
args.cookbook = args.cookbook[2]
-- Canonicalize general parameters
for _,k in pairs({"auto","commonscat","author","bar","tracking","sandbox"}) do
args[k] = canonicalize(args[k])[2]
end
-- Initialize tracking categories if main namespace
local tracking = (args.tracking or titleObject.namespace == 0) and {}
local sisterList = {}
local prefix
-- Loop through all sister projects, generate possible links
for _, prefix in ipairs(prefixList) do
local link = sisterLink(prefix, args, tracking)
if link then
table.insert(sisterList, link)
end
end
local box = mw.html.create()
if args.bar and #sisterList > 0 then
box:wikitext(mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = templatestyles_page(true) }
})
box:node(createSisterBar(sisterList,args))
elseif #sisterList == 1 then
-- Use single sister box instead of multi-sister box
local sister = sisterList[1]
local link = "[["..sister.prefix..":"..sister.link.."|<b><i>"..(args.display or args[1]).."</i></b>]]"
box:wikitext(sideBox({
role = 'navigation',
position=args.position,
image="[[File:"..logo[sister.prefix].."|40x40px|class=noviewer|alt=|link=]]",
metadata='no',
class='plainlinks sistersitebox',
text=sisterName[sister.prefix].." has "..mw.ustring.lower(sister.information).." related to "..link,
templatestyles = templatestyles_page()
}))
elseif #sisterList > 0 then
-- else use sister box if non-empty
box:wikitext(createSisterBox(sisterList,args))
end
if #sisterList == 0 and args.auto then
box:wikitext(generateWarning({"No sister project links found in Wikidata. Try auto=0"}))
end
-- Append tracking categories to container div
-- Alpha ordering is by sister prefix
if tracking then
for k, v in pairs(tracking) do
box:wikitext("[[Category:"..trackingType[k].."|"..v.."]]")
end
if #sisterList == 0 then
box:wikitext("[[Category:Pages with empty sister project links]]")
end
end
return tostring(box)
end
-- Main entry point for generating sister project links box
function p.main(frame)
local args = getArgs(frame,{frameOnly=false,parentOnly=false,parentFirst=false})
return p._main(args)
end
-- Lua entry point for generate one sister link
function p._sisterlink(args)
local prefix = args.prefix
-- Canonicalize all sister links (handle yes/no/empty)
for _, k in ipairs(prefixList) do
args[k] = canonicalize(args[k])
end
-- Canonicalize cookbook
args.cookbook = canonicalize(args.cookbook)
args.b = mergeArgs({args.b,args.cookbook})
args.cookbook = args.cookbook[2]
-- Canonicalize general parameters
for _,k in pairs({"auto","commonscat","author"}) do
args[k] = canonicalize(args[k])[2]
end
args[1] = args[1] or mw.title.getCurrentTitle().text
args.qid = args.qid or mw.wikibase.getEntityIdForCurrentPage()
args.qid = args.qid and args.qid:upper()
local link = sisterLink(prefix, args,nil)
if not link then
return ""
end
return "[["..link.prefix..":"..link.link.."|"..link.information .."]] from "..sisterName[link.prefix]
end
-- Template entry point for generating one sister link
function p.link(frame)
local args = getArgs(frame)
return p._sisterlink(args)
end
return p
hr47rmsc19vyv0rhnmw7tfp4ew0puvb
Module:Sister project links/bar/styles.css
828
70967175
1092071493
1092071468
2022-06-08T01:32:32Z
Izno
2927383
pp
sanitized-css
text/css
/* {{pp|small=y}} */
.sister-bar {
display:flex;
justify-content: center;
align-items: baseline;
font-size: 88%;
background-color: #fdfdfd;
border: 1px solid #a2a9b1;
clear: both;
margin: 1em 0 0;
padding: 0 2em;
}
.sister-bar-header {
margin: 0 1em 0 0.5em;
padding: 0.2em 0;
flex:0 0 auto;
min-height: 24px;
line-height: 22px;
}
.sister-bar-content {
display:flex;
flex-flow: row wrap;
flex:0 1 auto;
align-items: baseline;
padding: 0.2em 0;
column-gap: 1em;
}
.sister-bar-item {
display:flex;
align-items: baseline;
margin:0.15em 0;
min-height:24px;
text-align:left;
}
.sister-bar-logo {
width: 22px;
line-height: 22px;
margin:0 0.2em;
text-align: right;
}
.sister-bar-link {
margin:0 0.2em;
text-align: left;
}
@media screen and (max-width:960px) {
.sister-bar {
flex-flow: column wrap;
margin: 1em auto 0;
}
.sister-bar-header {
flex:0 1;
}
.sister-bar-content {
flex:1;
border-top: 1px solid #a2a9b1;
}
.sister-bar-item {
flex:0 0 20em;
min-width: 20em;
}
}
.navbox + link + .sister-bar,
.navbox + style + .sister-bar,
.portal-bar + link + .sister-bar,
.portal-bar + style + .sister-bar,
.sister-bar + .navbox-styles + .navbox,
.sister-bar + .navbox-styles + .portal-bar {
margin-top: -1px;
}
e2uzts4hp4xug97l0hy3lrw03idta7m
Module:String
828
38569505
970815276
924313232
2020-08-02T15:49:42Z
RexxS
6112901
separate annotations for str.match from those for str._match
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:Errors reported by Module String].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'Errors reported by Module String'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
cufmbepw7ml3gut4lchtqrhtj5r63cp
Module:Subject bar
828
40791023
1092849664
1092831980
2022-06-13T00:33:13Z
Hike395
11639
if author or cookbook are set, then use sister bar
Scribunto
text/plain
require('Module:No globals')
local sisterBar = nil
local portalBar = nil
local compressSparseArray = nil
local getArgs = require('Module:Arguments').getArgs
local yesNo = require('Module:Yesno')
local p = {}
local sisters = {'commons','species','voy','n','wikt','b','q','s','v','d'}
local function findNumericArgs(key, args)
local pattern = "^"..key.."_?(%d+)$" -- pattern to match
local values = {}
for k, v in pairs(args) do --- loop through all arguments
local ord = tonumber(mw.ustring.match(k,pattern)) --- if "foo_?%d+", extract number
if ord then
values[ord] = v
end
end
if args[key] ~= nil then
values[1] = args[key]
end
values = compressSparseArray(values) --- squeeze out gaps/nils in values, keep ordering
return values
end
function p._main(args)
local result = ""
local hasPortal = false
for key, _ in pairs(args) do
if mw.ustring.sub(key,1,6) == 'portal' or tonumber(key) then
hasPortal = true
break
end
end
if hasPortal then
portalBar = require('Module:Portal bar')._main
compressSparseArray = require('Module:TableTools').compressSparseArray
local portalList = findNumericArgs("portal",args)
for _, positional in ipairs(args) do
table.insert(portalList, positional)
end
result = portalBar(portalList, {tracking=args.tracking, qid=args.qid})
end
local hasSister = yesNo(args.auto,true) or yesNo(args.author,true) or yesNo(args.cookbook,true)
for _, sister in ipairs(sisters) do
if hasSister then
break
end
if yesNo(args[sister],true) or yesNo(args[sister..'-search'],true) then
hasSister = true
end
end
if hasSister then
sisterBar = require('Module:Sister project links')._main
local sisterArgs = {auto=1, bar=1}
sisterArgs[1] = args.search
for _, k in ipairs({'author','commonscat','cookbook','display','tracking','qid'}) do
sisterArgs[k] = args[k]
end
for _, t in ipairs(sisters) do
sisterArgs[t] = args[t..'-search'] or args[t]
end
result = result..sisterBar(sisterArgs)
end
return result
end
function p.main(frame)
-- If called via #invoke, use the args passed into the invoking template,
-- or the args passed to #invoke if any exist. Otherwise assume args are
-- being passed directly in from the debug console or from another Lua module.
local args = getArgs(frame)
return p._main(args)
end
return p
af2cye2rk7gbyxtf7xxmv8tzth3pu2t
Module:TableTools
828
41371028
1069058368
1048120640
2022-01-31T13:08:18Z
MSGJ
42630
updates/fixes requested by [[User:Uzume]]
Scribunto
text/plain
------------------------------------------------------------------------------------
-- TableTools --
-- --
-- This module includes a number of functions for dealing with Lua tables. --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke. --
------------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local p = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
return type(v) == 'number' and v ~= v
end
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
checkType('shallowClone', 1, t, 'table')
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(arr)
checkType('removeDuplicates', 1, arr, 'table')
local isNan = p.isNan
local ret, exists = {}, {}
for _, v in ipairs(arr) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[#ret + 1] = v
else
if not exists[v] then
ret[#ret + 1] = v
exists[v] = true
end
end
end
return ret
end
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
checkType('numKeys', 1, t, 'table')
local isPositiveInteger = p.isPositiveInteger
local nums = {}
for k in pairs(t) do
if isPositiveInteger(k) then
nums[#nums + 1] = k
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
checkType('affixNums', 1, t, 'table')
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
for k in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
checkType('numData', 1, t, 'table')
checkType('numData', 2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = p.compressSparseArray(ret)
ret.other = other
end
return ret
end
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local nums = p.numKeys(t)
for _, num in ipairs(nums) do
ret[#ret + 1] = t[num]
end
return ret
end
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = p.numKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i <= lim then
local key = nums[i]
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
local function defaultKeySort(item1, item2)
-- "number" < "string", so numbers will be sorted before strings.
local type1, type2 = type(item1), type(item2)
if type1 ~= type2 then
return type1 < type2
elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
return tostring(item1) < tostring(item2)
else
return item1 < item2
end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
if not checked then
checkType('keysToList', 1, t, 'table')
checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
end
local arr = {}
local index = 1
for k in pairs(t) do
arr[index] = k
index = index + 1
end
if keySort ~= false then
keySort = type(keySort) == 'function' and keySort or defaultKeySort
table.sort(arr, keySort)
end
return arr
end
------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
checkType('sortedPairs', 1, t, 'table')
checkType('sortedPairs', 2, keySort, 'function', true)
local arr = p.keysToList(t, keySort, true)
local i = 0
return function ()
i = i + 1
local key = arr[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
if type(v) ~= 'table' then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
if not pcall(pairs, v) then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
checkType("invert", 1, arr, "table")
local isNan = p.isNan
local map = {}
for i, v in ipairs(arr) do
if not isNan(v) then
map[v] = i
end
end
return map
end
------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
checkType("listToSet", 1, arr, "table")
local isNan = p.isNan
local set = {}
for _, v in ipairs(arr) do
if not isNan(v) then
set[v] = true
end
end
return set
end
------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
-- Stores copies of tables indexed by the original table.
already_seen = already_seen or {}
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
if type(orig) == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
end
already_seen[orig] = copy
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
local mt_copy = _deepCopy(mt, includeMetatable, already_seen)
setmetatable(copy, mt_copy)
already_seen[mt] = mt_copy
end
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function p.deepCopy(orig, noMetatable, already_seen)
checkType("deepCopy", 3, already_seen, "table", true)
return _deepCopy(orig, not noMetatable, already_seen)
end
------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d} => "acd"
-- sparseConcat{nil, b, c, d} => "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
local arr = {}
local arr_i = 0
for _, v in p.sparseIpairs(t) do
arr_i = arr_i + 1
arr[arr_i] = v
end
return table.concat(arr, sep, i, j)
end
------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
-- requiring module inline so that [[Module:Exponential search]] which is
-- only needed by this one function doesn't get millions of transclusions
local expSearch = require("Module:Exponential search")
checkType('length', 1, t, 'table')
checkType('length', 2, prefix, 'string', true)
return expSearch(function (i)
local key
if prefix then
key = prefix .. tostring(i)
else
key = i
end
return t[key] ~= nil
end) or 0
end
------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if valueToFind is a member of the array, and false otherwise.
------------------------------------------------------------------------------------
function p.inArray(arr, valueToFind)
checkType("inArray", 1, arr, "table")
-- if valueToFind is nil, error?
for _, v in ipairs(arr) do
if v == valueToFind then
return true
end
end
return false
end
return p
0z6y1iz1ggzcjp1rhkrrhgprosuh475
Module:URL
828
38600887
998414802
907988365
2021-01-05T07:56:15Z
MSGJ
42630
fixes for pen icon
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 '')
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')
-- Handle URLs from Wikidata of the format http://
url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?)://', 'http%1://')
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
mmtcfgkoaj98icy0uwzqcqtkbcrk02b
Module:Unsubst
828
40945493
1048913973
872090768
2021-10-08T18:22:16Z
Trappist the monk
10289486
sync from sandbox; see [[Module_talk:Unsubst#template_invocation_name_override|talk]];
Scribunto
text/plain
local checkType = require('libraryUtil').checkType
local p = {}
local BODY_PARAM = '$B'
local specialParams = {
['$params'] = 'parameter list',
['$aliases'] = 'parameter aliases',
['$flags'] = 'flags',
['$B'] = 'template content',
['$template-name'] = 'template invocation name override',
}
function p.main(frame, body)
-- If we are substing, this function returns a template invocation, and if
-- not, it returns the template body. The template body can be specified in
-- the body parameter, or in the template parameter defined in the
-- BODY_PARAM variable. This function can be called from Lua or from
-- #invoke.
-- Return the template body if we aren't substing.
if not mw.isSubsting() then
if body ~= nil then
return body
elseif frame.args[BODY_PARAM] ~= nil then
return frame.args[BODY_PARAM]
else
error(string.format(
"no template content specified (use parameter '%s' from #invoke)",
BODY_PARAM
), 2)
end
end
-- Sanity check for the frame object.
if type(frame) ~= 'table'
or type(frame.getParent) ~= 'function'
or not frame:getParent()
then
error(
"argument #1 to 'main' must be a frame object with a parent " ..
"frame available",
2
)
end
-- Find the invocation name.
local mTemplateInvocation = require('Module:Template invocation')
local name
if frame.args['$template-name'] and '' ~= frame.args['$template-name'] then
name = frame.args['$template-name'] -- override whatever the template name is with this name
else
name = mTemplateInvocation.name(frame:getParent():getTitle())
end
-- Combine passed args with passed defaults
local args = {}
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
for k, v in pairs( frame.args ) do
if not specialParams[k] then
if v == '__DATE__' then
v = mw.getContentLanguage():formatDate( 'F Y' )
end
args[k] = v
end
end
else
for k, v in pairs( frame.args ) do
if not specialParams[k] then
if v == '__DATE__' then
v = mw.getContentLanguage():formatDate( 'F Y' )
end
args[k] = v
end
end
for k, v in pairs( frame:getParent().args ) do
args[k] = v
end
end
-- Trim parameters, if not specified otherwise
if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then
for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '^%s*(.*)%s*$') or '' end
end
-- Pull information from parameter aliases
local aliases = {}
if frame.args['$aliases'] then
local list = mw.text.split( frame.args['$aliases'], '%s*,%s*' )
for k, v in ipairs( list ) do
local tmp = mw.text.split( v, '%s*>%s*' )
aliases[tonumber(mw.ustring.match(tmp[1], '^[1-9][0-9]*$')) or tmp[1]] = ((tonumber(mw.ustring.match(tmp[2], '^[1-9][0-9]*$'))) or tmp[2])
end
end
for k, v in pairs( aliases ) do
if args[k] and ( not args[v] or args[v] == '' ) then
args[v] = args[k]
end
args[k] = nil
end
-- Remove empty parameters, if specified
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*remove%-empty%s*,' ) then
local tmp = 0
for k, v in ipairs( args ) do
if v ~= '' or ( args[k+1] and args[k+1] ~= '' ) or ( args[k+2] and args[k+2] ~= '' ) then
tmp = k
else
break
end
end
for k, v in pairs( args ) do
if v == '' then
if not (type(k) == 'number' and k < tmp) then args[k] = nil end
end
end
end
-- Order parameters
if frame.args['$params'] then
local params, tmp = mw.text.split( frame.args['$params'], '%s*,%s*' ), {}
for k, v in ipairs(params) do
v = tonumber(mw.ustring.match(v, '^[1-9][0-9]*$')) or v
if args[v] then tmp[v], args[v] = args[v], nil end
end
for k, v in pairs(args) do tmp[k], args[k] = args[k], nil end
args = tmp
end
return mTemplateInvocation.invocation(name, args)
end
p[''] = p.main -- For backwards compatibility
return p
eu3d3ip0gtd6n65iz4vmtpogb62rxdi
Module:Wd
828
51376229
1073619513
1073461681
2022-02-23T17:08:07Z
Thayts
9149033
Partial revert to undo introduction of linking obscurity
Scribunto
text/plain
-- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]].
local p = {}
local arg = ...
local i18n
local function loadI18n(aliasesP, frame)
local title
if frame then
-- current module invoked by page/template, get its title from frame
title = frame:getTitle()
else
-- current module included by other module, get its title from ...
title = arg
end
if not i18n then
i18n = require(title .. "/i18n").init(aliasesP)
end
end
p.claimCommands = {
property = "property",
properties = "properties",
qualifier = "qualifier",
qualifiers = "qualifiers",
reference = "reference",
references = "references"
}
p.generalCommands = {
label = "label",
title = "title",
description = "description",
alias = "alias",
aliases = "aliases",
badge = "badge",
badges = "badges"
}
p.flags = {
linked = "linked",
short = "short",
raw = "raw",
multilanguage = "multilanguage",
unit = "unit",
-------------
preferred = "preferred",
normal = "normal",
deprecated = "deprecated",
best = "best",
future = "future",
current = "current",
former = "former",
edit = "edit",
editAtEnd = "edit@end",
mdy = "mdy",
single = "single",
sourced = "sourced"
}
p.args = {
eid = "eid",
page = "page",
date = "date"
}
local aliasesP = {
coord = "P625",
-----------------------
image = "P18",
author = "P50",
publisher = "P123",
importedFrom = "P143",
statedIn = "P248",
pages = "P304",
language = "P407",
hasPart = "P527",
publicationDate = "P577",
startTime = "P580",
endTime = "P582",
chapter = "P792",
retrieved = "P813",
referenceURL = "P854",
sectionVerseOrParagraph = "P958",
archiveURL = "P1065",
title = "P1476",
formatterURL = "P1630",
quote = "P1683",
shortName = "P1813",
definingFormula = "P2534",
archiveDate = "P2960",
inferredFrom = "P3452",
typeOfReference = "P3865",
column = "P3903"
}
local aliasesQ = {
percentage = "Q11229",
prolepticJulianCalendar = "Q1985786",
citeWeb = "Q5637226",
citeQ = "Q22321052"
}
local parameters = {
property = "%p",
qualifier = "%q",
reference = "%r",
alias = "%a",
badge = "%b",
separator = "%s",
general = "%x"
}
local formats = {
property = "%p[%s][%r]",
qualifier = "%q[%s][%r]",
reference = "%r",
propertyWithQualifier = "%p[ <span style=\"font-size:85\\%\">(%q)</span>][%s][%r]",
alias = "%a[%s]",
badge = "%b[%s]"
}
local hookNames = { -- {level_1, level_2}
[parameters.property] = {"getProperty"},
[parameters.reference] = {"getReferences", "getReference"},
[parameters.qualifier] = {"getAllQualifiers"},
[parameters.qualifier.."\\d"] = {"getQualifiers", "getQualifier"},
[parameters.alias] = {"getAlias"},
[parameters.badge] = {"getBadge"}
}
-- default value objects, should NOT be mutated but instead copied
local defaultSeparators = {
["sep"] = {" "},
["sep%s"] = {","},
["sep%q"] = {"; "},
["sep%q\\d"] = {", "},
["sep%r"] = nil, -- none
["punc"] = nil -- none
}
local rankTable = {
["preferred"] = 1,
["normal"] = 2,
["deprecated"] = 3
}
local Config = {}
-- allows for recursive calls
function Config:new()
local cfg = {}
setmetatable(cfg, self)
self.__index = self
cfg.separators = {
-- single value objects wrapped in arrays so that we can pass by reference
["sep"] = {copyTable(defaultSeparators["sep"])},
["sep%s"] = {copyTable(defaultSeparators["sep%s"])},
["sep%q"] = {copyTable(defaultSeparators["sep%q"])},
["sep%r"] = {copyTable(defaultSeparators["sep%r"])},
["punc"] = {copyTable(defaultSeparators["punc"])}
}
cfg.entity = nil
cfg.entityID = nil
cfg.propertyID = nil
cfg.propertyValue = nil
cfg.qualifierIDs = {}
cfg.qualifierIDsAndValues = {}
cfg.bestRank = true
cfg.ranks = {true, true, false} -- preferred = true, normal = true, deprecated = false
cfg.foundRank = #cfg.ranks
cfg.flagBest = false
cfg.flagRank = false
cfg.periods = {true, true, true} -- future = true, current = true, former = true
cfg.flagPeriod = false
cfg.atDate = {parseDate(os.date('!%Y-%m-%d'))} -- today as {year, month, day}
cfg.mdyDate = false
cfg.singleClaim = false
cfg.sourcedOnly = false
cfg.editable = false
cfg.editAtEnd = false
cfg.inSitelinks = false
cfg.langCode = mw.language.getContentLanguage().code
cfg.langName = mw.language.fetchLanguageName(cfg.langCode, cfg.langCode)
cfg.langObj = mw.language.new(cfg.langCode)
cfg.siteID = mw.wikibase.getGlobalSiteId()
cfg.states = {}
cfg.states.qualifiersCount = 0
cfg.curState = nil
cfg.prefetchedRefs = nil
return cfg
end
local State = {}
function State:new(cfg, type)
local stt = {}
setmetatable(stt, self)
self.__index = self
stt.conf = cfg
stt.type = type
stt.results = {}
stt.parsedFormat = {}
stt.separator = {}
stt.movSeparator = {}
stt.puncMark = {}
stt.linked = false
stt.rawValue = false
stt.shortName = false
stt.anyLanguage = false
stt.unitOnly = false
stt.singleValue = false
return stt
end
local function replaceAlias(id)
if aliasesP[id] then
id = aliasesP[id]
end
return id
end
local function errorText(code, param)
local text = i18n["errors"][code]
if param then text = mw.ustring.gsub(text, "$1", param) end
return text
end
local function throwError(errorMessage, param)
error(errorText(errorMessage, param))
end
local function replaceDecimalMark(num)
return mw.ustring.gsub(num, "[.]", i18n['numeric']['decimal-mark'], 1)
end
local function padZeros(num, numDigits)
local numZeros
local negative = false
if num < 0 then
negative = true
num = num * -1
end
num = tostring(num)
numZeros = numDigits - num:len()
for _ = 1, numZeros do
num = "0"..num
end
if negative then
num = "-"..num
end
return num
end
local function replaceSpecialChar(chr)
if chr == '_' then
-- replace underscores with spaces
return ' '
else
return chr
end
end
local function replaceSpecialChars(str)
local chr
local esc = false
local strOut = ""
for i = 1, #str do
chr = str:sub(i,i)
if not esc then
if chr == '\\' then
esc = true
else
strOut = strOut .. replaceSpecialChar(chr)
end
else
strOut = strOut .. chr
esc = false
end
end
return strOut
end
local function buildWikilink(target, label)
if not label or target == label then
return "[[" .. target .. "]]"
else
return "[[" .. target .. "|" .. label .. "]]"
end
end
-- used to make frame.args mutable, to replace #frame.args (which is always 0)
-- with the actual amount and to simply copy tables
function copyTable(tIn)
if not tIn then
return nil
end
local tOut = {}
for i, v in pairs(tIn) do
tOut[i] = v
end
return tOut
end
-- used to merge output arrays together;
-- note that it currently mutates the first input array
local function mergeArrays(a1, a2)
for i = 1, #a2 do
a1[#a1 + 1] = a2[i]
end
return a1
end
local function split(str, del)
local out = {}
local i, j = str:find(del)
if i and j then
out[1] = str:sub(1, i - 1)
out[2] = str:sub(j + 1)
else
out[1] = str
end
return out
end
local function parseWikidataURL(url)
local id
if url:match('^http[s]?://') then
id = split(url, "Q")
if id[2] then
return "Q" .. id[2]
end
end
return nil
end
function parseDate(dateStr, precision)
precision = precision or "d"
local i, j, index, ptr
local parts = {nil, nil, nil}
if dateStr == nil then
return parts[1], parts[2], parts[3] -- year, month, day
end
-- 'T' for snak values, '/' for outputs with '/Julian' attached
i, j = dateStr:find("[T/]")
if i then
dateStr = dateStr:sub(1, i-1)
end
local from = 1
if dateStr:sub(1,1) == "-" then
-- this is a negative number, look further ahead
from = 2
end
index = 1
ptr = 1
i, j = dateStr:find("-", from)
if i then
-- year
parts[index] = tonumber(mw.ustring.gsub(dateStr:sub(ptr, i-1), "^\+(.+)$", "%1"), 10) -- remove '+' sign (explicitly give base 10 to prevent error)
if parts[index] == -0 then
parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead
end
if precision == "y" then
-- we're done
return parts[1], parts[2], parts[3] -- year, month, day
end
index = index + 1
ptr = i + 1
i, j = dateStr:find("-", ptr)
if i then
-- month
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10)
if precision == "m" then
-- we're done
return parts[1], parts[2], parts[3] -- year, month, day
end
index = index + 1
ptr = i + 1
end
end
if dateStr:sub(ptr) ~= "" then
-- day if we have month, month if we have year, or year
parts[index] = tonumber(dateStr:sub(ptr), 10)
end
return parts[1], parts[2], parts[3] -- year, month, day
end
local function datePrecedesDate(aY, aM, aD, bY, bM, bD)
if aY == nil or bY == nil then
return nil
end
aM = aM or 1
aD = aD or 1
bM = bM or 1
bD = bD or 1
if aY < bY then
return true
end
if aY > bY then
return false
end
if aM < bM then
return true
end
if aM > bM then
return false
end
if aD < bD then
return true
end
return false
end
local function getHookName(param, index)
if hookNames[param] then
return hookNames[param][index]
elseif param:len() > 2 then
return hookNames[param:sub(1, 2).."\\d"][index]
else
return nil
end
end
local function alwaysTrue()
return true
end
-- The following function parses a format string.
--
-- The example below shows how a parsed string is structured in memory.
-- Variables other than 'str' and 'child' are left out for clarity's sake.
--
-- Example:
-- "A %p B [%s[%q1]] C [%r] D"
--
-- Structure:
-- [
-- {
-- str = "A "
-- },
-- {
-- str = "%p"
-- },
-- {
-- str = " B ",
-- child =
-- [
-- {
-- str = "%s",
-- child =
-- [
-- {
-- str = "%q1"
-- }
-- ]
-- }
-- ]
-- },
-- {
-- str = " C ",
-- child =
-- [
-- {
-- str = "%r"
-- }
-- ]
-- },
-- {
-- str = " D"
-- }
-- ]
--
local function parseFormat(str)
local chr, esc, param, root, cur, prev, new
local params = {}
local function newObject(array)
local obj = {} -- new object
obj.str = ""
array[#array + 1] = obj -- array{object}
obj.parent = array
return obj
end
local function endParam()
if param > 0 then
if cur.str ~= "" then
cur.str = "%"..cur.str
cur.param = true
params[cur.str] = true
cur.parent.req[cur.str] = true
prev = cur
cur = newObject(cur.parent)
end
param = 0
end
end
root = {} -- array
root.req = {}
cur = newObject(root)
prev = nil
esc = false
param = 0
for i = 1, #str do
chr = str:sub(i,i)
if not esc then
if chr == '\\' then
endParam()
esc = true
elseif chr == '%' then
endParam()
if cur.str ~= "" then
cur = newObject(cur.parent)
end
param = 2
elseif chr == '[' then
endParam()
if prev and cur.str == "" then
table.remove(cur.parent)
cur = prev
end
cur.child = {} -- new array
cur.child.req = {}
cur.child.parent = cur
cur = newObject(cur.child)
elseif chr == ']' then
endParam()
if cur.parent.parent then
new = newObject(cur.parent.parent.parent)
if cur.str == "" then
table.remove(cur.parent)
end
cur = new
end
else
if param > 1 then
param = param - 1
elseif param == 1 then
if not chr:match('%d') then
endParam()
end
end
cur.str = cur.str .. replaceSpecialChar(chr)
end
else
cur.str = cur.str .. chr
esc = false
end
prev = nil
end
endParam()
-- make sure that at least one required parameter has been defined
if not next(root.req) then
throwError("missing-required-parameter")
end
-- make sure that the separator parameter "%s" is not amongst the required parameters
if root.req[parameters.separator] then
throwError("extra-required-parameter", parameters.separator)
end
return root, params
end
local function sortOnRank(claims)
local rankPos
local ranks = {{}, {}, {}, {}} -- preferred, normal, deprecated, (default)
local sorted = {}
for _, v in ipairs(claims) do
rankPos = rankTable[v.rank] or 4
ranks[rankPos][#ranks[rankPos] + 1] = v
end
sorted = ranks[1]
sorted = mergeArrays(sorted, ranks[2])
sorted = mergeArrays(sorted, ranks[3])
return sorted
end
-- if id == nil then item connected to current page is used
function Config:getLabel(id, raw, link, short)
local label = nil
local prefix, title= "", nil
if not id then
id = mw.wikibase.getEntityIdForCurrentPage()
if not id then
return ""
end
end
id = id:upper() -- just to be sure
if raw then
-- check if given id actually exists
if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then
label = id
end
prefix, title = "d:Special:EntityPage/", label -- may be nil
else
-- try short name first if requested
if short then
label = p._property{aliasesP.shortName, [p.args.eid] = id} -- get short name
if label == "" then
label = nil
end
end
-- get label
if not label then
label = mw.wikibase.getLabelByLang(id, self.langCode) -- XXX: should use fallback labels?
end
end
if not label then
label = ""
elseif link then
-- build a link if requested
if not title then
if id:sub(1,1) == "Q" then
title = mw.wikibase.getSitelink(id)
elseif id:sub(1,1) == "P" then
-- properties have no sitelink, link to Wikidata instead
prefix, title = "d:Special:EntityPage/", id
end
end
label = mw.text.nowiki(label) -- escape raw label text so it cannot be wikitext markup
if title then
label = buildWikilink(prefix .. title, label)
end
end
return label
end
function Config:getEditIcon()
local value = ""
local prefix = ""
local front = " "
local back = ""
if self.entityID:sub(1,1) == "P" then
prefix = "Property:"
end
if self.editAtEnd then
front = '<span style="float:'
if self.langObj:isRTL() then
front = front .. 'left'
else
front = front .. 'right'
end
front = front .. '">'
back = '</span>'
end
value = "[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=" .. i18n['info']['edit-on-wikidata'] .. "|link=https://www.wikidata.org/wiki/" .. prefix .. self.entityID .. "?uselang=" .. self.langCode
if self.propertyID then
value = value .. "#" .. self.propertyID
elseif self.inSitelinks then
value = value .. "#sitelinks-wikipedia"
end
value = value .. "|" .. i18n['info']['edit-on-wikidata'] .. "]]"
return front .. value .. back
end
-- used to create the final output string when it's all done, so that for references the
-- function extensionTag("ref", ...) is only called when they really ended up in the final output
function Config:concatValues(valuesArray)
local outString = ""
local j, skip
for i = 1, #valuesArray do
-- check if this is a reference
if valuesArray[i].refHash then
j = i - 1
skip = false
-- skip this reference if it is part of a continuous row of references that already contains the exact same reference
while valuesArray[j] and valuesArray[j].refHash do
if valuesArray[i].refHash == valuesArray[j].refHash then
skip = true
break
end
j = j - 1
end
if not skip then
-- add <ref> tag with the reference's hash as its name (to deduplicate references)
outString = outString .. mw.getCurrentFrame():extensionTag("ref", valuesArray[i][1], {name = valuesArray[i].refHash})
end
else
outString = outString .. valuesArray[i][1]
end
end
return outString
end
function Config:convertUnit(unit, raw, link, short, unitOnly)
local space = " "
local label = ""
local itemID
if unit == "" or unit == "1" then
return nil
end
if unitOnly then
space = ""
end
itemID = parseWikidataURL(unit)
if itemID then
if itemID == aliasesQ.percentage then
return "%"
else
label = self:getLabel(itemID, raw, link, short)
if label ~= "" then
return space .. label
end
end
end
return ""
end
function State:getValue(snak)
return self.conf:getValue(snak, self.rawValue, self.linked, self.shortName, self.anyLanguage, self.unitOnly, false, self.type:sub(1,2))
end
function Config:getValue(snak, raw, link, short, anyLang, unitOnly, noSpecial, type)
if snak.snaktype == 'value' then
local datatype = snak.datavalue.type
local subtype = snak.datatype
local datavalue = snak.datavalue.value
if datatype == 'string' then
if subtype == 'url' and link then
-- create link explicitly
if raw then
-- will render as a linked number like [1]
return "[" .. datavalue .. "]"
else
return "[" .. datavalue .. " " .. datavalue .. "]"
end
elseif subtype == 'commonsMedia' then
if link then
return buildWikilink("c:File:" .. datavalue, datavalue)
elseif not raw then
return "[[File:" .. datavalue .. "]]"
else
return datavalue
end
elseif subtype == 'geo-shape' and link then
return buildWikilink("c:" .. datavalue, datavalue)
elseif subtype == 'math' and not raw then
local attribute = nil
if (type == parameters.property or (type == parameters.qualifier and self.propertyID == aliasesP.hasPart)) and snak.property == aliasesP.definingFormula then
attribute = {qid = self.entityID}
end
return mw.getCurrentFrame():extensionTag("math", datavalue, attribute)
elseif subtype == 'external-id' and link then
local url = p._property{aliasesP.formatterURL, [p.args.eid] = snak.property} -- get formatter URL
if url ~= "" then
url = mw.ustring.gsub(url, "$1", datavalue)
return "[" .. url .. " " .. datavalue .. "]"
else
return datavalue
end
else
return datavalue
end
elseif datatype == 'monolingualtext' then
if anyLang or datavalue['language'] == self.langCode then
return datavalue['text']
else
return nil
end
elseif datatype == 'quantity' then
local value = ""
local unit
if not unitOnly then
-- get value and strip + signs from front
value = mw.ustring.gsub(datavalue['amount'], "^\+(.+)$", "%1")
if raw then
return value
end
-- replace decimal mark based on locale
value = replaceDecimalMark(value)
-- add delimiters for readability
value = i18n.addDelimiters(value)
end
unit = self:convertUnit(datavalue['unit'], raw, link, short, unitOnly)
if unit then
value = value .. unit
end
return value
elseif datatype == 'time' then
local y, m, d, p, yDiv, yRound, yFull, value, calendarID, dateStr
local yFactor = 1
local sign = 1
local prefix = ""
local suffix = ""
local mayAddCalendar = false
local calendar = ""
local precision = datavalue['precision']
if precision == 11 then
p = "d"
elseif precision == 10 then
p = "m"
else
p = "y"
yFactor = 10^(9-precision)
end
y, m, d = parseDate(datavalue['time'], p)
if y < 0 then
sign = -1
y = y * sign
end
-- if precision is tens/hundreds/thousands/millions/billions of years
if precision <= 8 then
yDiv = y / yFactor
-- if precision is tens/hundreds/thousands of years
if precision >= 6 then
mayAddCalendar = true
if precision <= 7 then
-- round centuries/millenniums up (e.g. 20th century or 3rd millennium)
yRound = math.ceil(yDiv)
if not raw then
if precision == 6 then
suffix = i18n['datetime']['suffixes']['millennium']
else
suffix = i18n['datetime']['suffixes']['century']
end
suffix = i18n.getOrdinalSuffix(yRound) .. suffix
else
-- if not verbose, take the first year of the century/millennium
-- (e.g. 1901 for 20th century or 2001 for 3rd millennium)
yRound = (yRound - 1) * yFactor + 1
end
else
-- precision == 8
-- round decades down (e.g. 2010s)
yRound = math.floor(yDiv) * yFactor
if not raw then
prefix = i18n['datetime']['prefixes']['decade-period']
suffix = i18n['datetime']['suffixes']['decade-period']
end
end
if raw and sign < 0 then
-- if BCE then compensate for "counting backwards"
-- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE)
yRound = yRound + yFactor - 1
end
else
local yReFactor, yReDiv, yReRound
-- round to nearest for tens of thousands of years or more
yRound = math.floor(yDiv + 0.5)
if yRound == 0 then
if precision <= 2 and y ~= 0 then
yReFactor = 1e6
yReDiv = y / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to millions of years only if we have a whole number of them
precision = 3
yFactor = yReFactor
yRound = yReRound
end
end
if yRound == 0 then
-- otherwise, take the unrounded (original) number of years
precision = 5
yFactor = 1
yRound = y
mayAddCalendar = true
end
end
if precision >= 1 and y ~= 0 then
yFull = yRound * yFactor
yReFactor = 1e9
yReDiv = yFull / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to billions of years if we're in that range
precision = 0
yFactor = yReFactor
yRound = yReRound
else
yReFactor = 1e6
yReDiv = yFull / yReFactor
yReRound = math.floor(yReDiv + 0.5)
if yReDiv == yReRound then
-- change precision to millions of years if we're in that range
precision = 3
yFactor = yReFactor
yRound = yReRound
end
end
end
if not raw then
if precision == 3 then
suffix = i18n['datetime']['suffixes']['million-years']
elseif precision == 0 then
suffix = i18n['datetime']['suffixes']['billion-years']
else
yRound = yRound * yFactor
if yRound == 1 then
suffix = i18n['datetime']['suffixes']['year']
else
suffix = i18n['datetime']['suffixes']['years']
end
end
else
yRound = yRound * yFactor
end
end
else
yRound = y
mayAddCalendar = true
end
if mayAddCalendar then
calendarID = parseWikidataURL(datavalue['calendarmodel'])
if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then
if not raw then
if link then
calendar = " ("..buildWikilink(i18n['datetime']['julian-calendar'], i18n['datetime']['julian'])..")"
else
calendar = " ("..i18n['datetime']['julian']..")"
end
else
calendar = "/"..i18n['datetime']['julian']
end
end
end
if not raw then
local ce = nil
if sign < 0 then
ce = i18n['datetime']['BCE']
elseif precision <= 5 then
ce = i18n['datetime']['CE']
end
if ce then
if link then
ce = buildWikilink(i18n['datetime']['common-era'], ce)
end
suffix = suffix .. " " .. ce
end
value = tostring(yRound)
if m then
dateStr = self.langObj:formatDate("F", "1-"..m.."-1")
if d then
if self.mdyDate then
dateStr = dateStr .. " " .. d .. ","
else
dateStr = d .. " " .. dateStr
end
end
value = dateStr .. " " .. value
end
value = prefix .. value .. suffix .. calendar
else
value = padZeros(yRound * sign, 4)
if m then
value = value .. "-" .. padZeros(m, 2)
if d then
value = value .. "-" .. padZeros(d, 2)
end
end
value = value .. calendar
end
return value
elseif datatype == 'globecoordinate' then
-- logic from https://github.com/DataValues/Geo (v4.0.1)
local precision, unitsPerDegree, numDigits, strFormat, value, globe
local latitude, latConv, latValue, latLink
local longitude, lonConv, lonValue, lonLink
local latDirection, latDirectionN, latDirectionS, latDirectionEN
local lonDirection, lonDirectionE, lonDirectionW, lonDirectionEN
local degSymbol, minSymbol, secSymbol, separator
local latDegrees = nil
local latMinutes = nil
local latSeconds = nil
local lonDegrees = nil
local lonMinutes = nil
local lonSeconds = nil
local latDegSym = ""
local latMinSym = ""
local latSecSym = ""
local lonDegSym = ""
local lonMinSym = ""
local lonSecSym = ""
local latDirectionEN_N = "N"
local latDirectionEN_S = "S"
local lonDirectionEN_E = "E"
local lonDirectionEN_W = "W"
if not raw then
latDirectionN = i18n['coord']['latitude-north']
latDirectionS = i18n['coord']['latitude-south']
lonDirectionE = i18n['coord']['longitude-east']
lonDirectionW = i18n['coord']['longitude-west']
degSymbol = i18n['coord']['degrees']
minSymbol = i18n['coord']['minutes']
secSymbol = i18n['coord']['seconds']
separator = i18n['coord']['separator']
else
latDirectionN = latDirectionEN_N
latDirectionS = latDirectionEN_S
lonDirectionE = lonDirectionEN_E
lonDirectionW = lonDirectionEN_W
degSymbol = "/"
minSymbol = "/"
secSymbol = "/"
separator = "/"
end
latitude = datavalue['latitude']
longitude = datavalue['longitude']
if latitude < 0 then
latDirection = latDirectionS
latDirectionEN = latDirectionEN_S
latitude = math.abs(latitude)
else
latDirection = latDirectionN
latDirectionEN = latDirectionEN_N
end
if longitude < 0 then
lonDirection = lonDirectionW
lonDirectionEN = lonDirectionEN_W
longitude = math.abs(longitude)
else
lonDirection = lonDirectionE
lonDirectionEN = lonDirectionEN_E
end
precision = datavalue['precision']
if not precision or precision <= 0 then
precision = 1 / 3600 -- precision not set (correctly), set to arcsecond
end
-- remove insignificant detail
latitude = math.floor(latitude / precision + 0.5) * precision
longitude = math.floor(longitude / precision + 0.5) * precision
if precision >= 1 - (1 / 60) and precision < 1 then
precision = 1
elseif precision >= (1 / 60) - (1 / 3600) and precision < (1 / 60) then
precision = 1 / 60
end
if precision >= 1 then
unitsPerDegree = 1
elseif precision >= (1 / 60) then
unitsPerDegree = 60
else
unitsPerDegree = 3600
end
numDigits = math.ceil(-math.log10(unitsPerDegree * precision))
if numDigits <= 0 then
numDigits = tonumber("0") -- for some reason, 'numDigits = 0' may actually store '-0', so parse from string instead
end
strFormat = "%." .. numDigits .. "f"
if precision >= 1 then
latDegrees = strFormat:format(latitude)
lonDegrees = strFormat:format(longitude)
if not raw then
latDegSym = replaceDecimalMark(latDegrees) .. degSymbol
lonDegSym = replaceDecimalMark(lonDegrees) .. degSymbol
else
latDegSym = latDegrees .. degSymbol
lonDegSym = lonDegrees .. degSymbol
end
else
latConv = math.floor(latitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits
lonConv = math.floor(longitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits
if precision >= (1 / 60) then
latMinutes = latConv
lonMinutes = lonConv
else
latSeconds = latConv
lonSeconds = lonConv
latMinutes = math.floor(latSeconds / 60)
lonMinutes = math.floor(lonSeconds / 60)
latSeconds = strFormat:format(latSeconds - (latMinutes * 60))
lonSeconds = strFormat:format(lonSeconds - (lonMinutes * 60))
if not raw then
latSecSym = replaceDecimalMark(latSeconds) .. secSymbol
lonSecSym = replaceDecimalMark(lonSeconds) .. secSymbol
else
latSecSym = latSeconds .. secSymbol
lonSecSym = lonSeconds .. secSymbol
end
end
latDegrees = math.floor(latMinutes / 60)
lonDegrees = math.floor(lonMinutes / 60)
latDegSym = latDegrees .. degSymbol
lonDegSym = lonDegrees .. degSymbol
latMinutes = latMinutes - (latDegrees * 60)
lonMinutes = lonMinutes - (lonDegrees * 60)
if precision >= (1 / 60) then
latMinutes = strFormat:format(latMinutes)
lonMinutes = strFormat:format(lonMinutes)
if not raw then
latMinSym = replaceDecimalMark(latMinutes) .. minSymbol
lonMinSym = replaceDecimalMark(lonMinutes) .. minSymbol
else
latMinSym = latMinutes .. minSymbol
lonMinSym = lonMinutes .. minSymbol
end
else
latMinSym = latMinutes .. minSymbol
lonMinSym = lonMinutes .. minSymbol
end
end
latValue = latDegSym .. latMinSym .. latSecSym .. latDirection
lonValue = lonDegSym .. lonMinSym .. lonSecSym .. lonDirection
value = latValue .. separator .. lonValue
if link then
globe = parseWikidataURL(datavalue['globe'])
if globe then
globe = mw.wikibase.getLabelByLang(globe, "en"):lower()
else
globe = "earth"
end
latLink = table.concat({latDegrees, latMinutes, latSeconds}, "_")
lonLink = table.concat({lonDegrees, lonMinutes, lonSeconds}, "_")
value = "[https://tools.wmflabs.org/geohack/geohack.php?language="..self.langCode.."¶ms="..latLink.."_"..latDirectionEN.."_"..lonLink.."_"..lonDirectionEN.."_globe:"..globe.." "..value.."]"
end
return value
elseif datatype == 'wikibase-entityid' then
local label
local itemID = datavalue['numeric-id']
if subtype == 'wikibase-item' then
itemID = "Q" .. itemID
elseif subtype == 'wikibase-property' then
itemID = "P" .. itemID
else
return '<strong class="error">' .. errorText('unknown-data-type', subtype) .. '</strong>'
end
label = self:getLabel(itemID, raw, link, short)
if label == "" then
label = nil
end
return label
else
return '<strong class="error">' .. errorText('unknown-data-type', datatype) .. '</strong>'
end
elseif snak.snaktype == 'somevalue' and not noSpecial then
if raw then
return " " -- single space represents 'somevalue'
else
return i18n['values']['unknown']
end
elseif snak.snaktype == 'novalue' and not noSpecial then
if raw then
return "" -- empty string represents 'novalue'
else
return i18n['values']['none']
end
else
return nil
end
end
function Config:getSingleRawQualifier(claim, qualifierID)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[qualifierID] end
if qualifiers and qualifiers[1] then
return self:getValue(qualifiers[1], true) -- raw = true
else
return nil
end
end
function Config:snakEqualsValue(snak, value)
local snakValue = self:getValue(snak, true) -- raw = true
if snakValue and snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then value = value:upper() end
return snakValue == value
end
function Config:setRank(rank)
local rankPos
if rank == p.flags.best then
self.bestRank = true
self.flagBest = true -- mark that 'best' flag was given
return
end
if rank:sub(1,9) == p.flags.preferred then
rankPos = 1
elseif rank:sub(1,6) == p.flags.normal then
rankPos = 2
elseif rank:sub(1,10) == p.flags.deprecated then
rankPos = 3
else
return
end
-- one of the rank flags was given, check if another one was given before
if not self.flagRank then
self.ranks = {false, false, false} -- no other rank flag given before, so unset ranks
self.bestRank = self.flagBest -- unsets bestRank only if 'best' flag was not given before
self.flagRank = true -- mark that a rank flag was given
end
if rank:sub(-1) == "+" then
for i = rankPos, 1, -1 do
self.ranks[i] = true
end
elseif rank:sub(-1) == "-" then
for i = rankPos, #self.ranks do
self.ranks[i] = true
end
else
self.ranks[rankPos] = true
end
end
function Config:setPeriod(period)
local periodPos
if period == p.flags.future then
periodPos = 1
elseif period == p.flags.current then
periodPos = 2
elseif period == p.flags.former then
periodPos = 3
else
return
end
-- one of the period flags was given, check if another one was given before
if not self.flagPeriod then
self.periods = {false, false, false} -- no other period flag given before, so unset periods
self.flagPeriod = true -- mark that a period flag was given
end
self.periods[periodPos] = true
end
function Config:qualifierMatches(claim, id, value)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[id] end
if qualifiers then
for _, v in pairs(qualifiers) do
if self:snakEqualsValue(v, value) then
return true
end
end
elseif value == "" then
-- if the qualifier is not present then treat it the same as the special value 'novalue'
return true
end
return false
end
function Config:rankMatches(rankPos)
if self.bestRank then
return (self.ranks[rankPos] and self.foundRank >= rankPos)
else
return self.ranks[rankPos]
end
end
function Config:timeMatches(claim)
local startTime = nil
local startTimeY = nil
local startTimeM = nil
local startTimeD = nil
local endTime = nil
local endTimeY = nil
local endTimeM = nil
local endTimeD = nil
if self.periods[1] and self.periods[2] and self.periods[3] then
-- any time
return true
end
startTime = self:getSingleRawQualifier(claim, aliasesP.startTime)
if startTime and startTime ~= "" and startTime ~= " " then
startTimeY, startTimeM, startTimeD = parseDate(startTime)
end
endTime = self:getSingleRawQualifier(claim, aliasesP.endTime)
if endTime and endTime ~= "" and endTime ~= " " then
endTimeY, endTimeM, endTimeD = parseDate(endTime)
end
if startTimeY ~= nil and endTimeY ~= nil and datePrecedesDate(endTimeY, endTimeM, endTimeD, startTimeY, startTimeM, startTimeD) then
-- invalidate end time if it precedes start time
endTimeY = nil
endTimeM = nil
endTimeD = nil
end
if self.periods[1] then
-- future
if startTimeY and datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD) then
return true
end
end
if self.periods[2] then
-- current
if (startTimeY == nil or not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD)) and
(endTimeY == nil or datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD)) then
return true
end
end
if self.periods[3] then
-- former
if endTimeY and not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD) then
return true
end
end
return false
end
function Config:processFlag(flag)
if not flag then
return false
end
if flag == p.flags.linked then
self.curState.linked = true
return true
elseif flag == p.flags.raw then
self.curState.rawValue = true
if self.curState == self.states[parameters.reference] then
-- raw reference values end with periods and require a separator (other than none)
self.separators["sep%r"][1] = {" "}
end
return true
elseif flag == p.flags.short then
self.curState.shortName = true
return true
elseif flag == p.flags.multilanguage then
self.curState.anyLanguage = true
return true
elseif flag == p.flags.unit then
self.curState.unitOnly = true
return true
elseif flag == p.flags.mdy then
self.mdyDate = true
return true
elseif flag == p.flags.single then
self.singleClaim = true
return true
elseif flag == p.flags.sourced then
self.sourcedOnly = true
return true
elseif flag == p.flags.edit then
self.editable = true
return true
elseif flag == p.flags.editAtEnd then
self.editable = true
self.editAtEnd = true
return true
elseif flag == p.flags.best or flag:match('^'..p.flags.preferred..'[+-]?$') or flag:match('^'..p.flags.normal..'[+-]?$') or flag:match('^'..p.flags.deprecated..'[+-]?$') then
self:setRank(flag)
return true
elseif flag == p.flags.future or flag == p.flags.current or flag == p.flags.former then
self:setPeriod(flag)
return true
elseif flag == "" then
-- ignore empty flags and carry on
return true
else
return false
end
end
function Config:processFlagOrCommand(flag)
local param = ""
if not flag then
return false
end
if flag == p.claimCommands.property or flag == p.claimCommands.properties then
param = parameters.property
elseif flag == p.claimCommands.qualifier or flag == p.claimCommands.qualifiers then
self.states.qualifiersCount = self.states.qualifiersCount + 1
param = parameters.qualifier .. self.states.qualifiersCount
self.separators["sep"..param] = {copyTable(defaultSeparators["sep%q\\d"])}
elseif flag == p.claimCommands.reference or flag == p.claimCommands.references then
param = parameters.reference
else
return self:processFlag(flag)
end
if self.states[param] then
return false
end
-- create a new state for each command
self.states[param] = State:new(self, param)
-- use "%x" as the general parameter name
self.states[param].parsedFormat = parseFormat(parameters.general) -- will be overwritten for param=="%p"
-- set the separator
self.states[param].separator = self.separators["sep"..param] -- will be nil for param=="%p", which will be set separately
if flag == p.claimCommands.property or flag == p.claimCommands.qualifier or flag == p.claimCommands.reference then
self.states[param].singleValue = true
end
self.curState = self.states[param]
return true
end
function Config:processSeparators(args)
local sep
for i, v in pairs(self.separators) do
if args[i] then
sep = replaceSpecialChars(args[i])
if sep ~= "" then
self.separators[i][1] = {sep}
else
self.separators[i][1] = nil
end
end
end
end
function Config:setFormatAndSeparators(state, parsedFormat)
state.parsedFormat = parsedFormat
state.separator = self.separators["sep"]
state.movSeparator = self.separators["sep"..parameters.separator]
state.puncMark = self.separators["punc"]
end
-- determines if a claim has references by prefetching them from the claim using getReferences,
-- which applies some filtering that determines if a reference is actually returned,
-- and caches the references for later use
function State:isSourced(claim)
self.conf.prefetchedRefs = self:getReferences(claim)
return (#self.conf.prefetchedRefs > 0)
end
function State:resetCaches()
-- any prefetched references of the previous claim must not be used
self.conf.prefetchedRefs = nil
end
function State:claimMatches(claim)
local matches, rankPos
-- first of all, reset any cached values used for the previous claim
self:resetCaches()
-- if a property value was given, check if it matches the claim's property value
if self.conf.propertyValue then
matches = self.conf:snakEqualsValue(claim.mainsnak, self.conf.propertyValue)
else
matches = true
end
-- if any qualifier values were given, check if each matches one of the claim's qualifier values
for i, v in pairs(self.conf.qualifierIDsAndValues) do
matches = (matches and self.conf:qualifierMatches(claim, i, v))
end
-- check if the claim's rank and time period match
rankPos = rankTable[claim.rank] or 4
matches = (matches and self.conf:rankMatches(rankPos) and self.conf:timeMatches(claim))
-- if only claims with references must be returned, check if this one has any
if self.conf.sourcedOnly then
matches = (matches and self:isSourced(claim)) -- prefetches and caches references
end
return matches, rankPos
end
function State:out()
local result -- collection of arrays with value objects
local valuesArray -- array with value objects
local sep = nil -- value object
local out = {} -- array with value objects
local function walk(formatTable, result)
local valuesArray = {} -- array with value objects
for i, v in pairs(formatTable.req) do
if not result[i] or not result[i][1] then
-- we've got no result for a parameter that is required on this level,
-- so skip this level (and its children) by returning an empty result
return {}
end
end
for _, v in ipairs(formatTable) do
if v.param then
valuesArray = mergeArrays(valuesArray, result[v.str])
elseif v.str ~= "" then
valuesArray[#valuesArray + 1] = {v.str}
end
if v.child then
valuesArray = mergeArrays(valuesArray, walk(v.child, result))
end
end
return valuesArray
end
-- iterate through the results from back to front, so that we know when to add separators
for i = #self.results, 1, -1 do
result = self.results[i]
-- if there is already some output, then add the separators
if #out > 0 then
sep = self.separator[1] -- fixed separator
result[parameters.separator] = {self.movSeparator[1]} -- movable separator
else
sep = nil
result[parameters.separator] = {self.puncMark[1]} -- optional punctuation mark
end
valuesArray = walk(self.parsedFormat, result)
if #valuesArray > 0 then
if sep then
valuesArray[#valuesArray + 1] = sep
end
out = mergeArrays(valuesArray, out)
end
end
-- reset state before next iteration
self.results = {}
return out
end
-- level 1 hook
function State:getProperty(claim)
local value = {self:getValue(claim.mainsnak)} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getQualifiers(claim, param)
local qualifiers
if claim.qualifiers then qualifiers = claim.qualifiers[self.conf.qualifierIDs[param]] end
if qualifiers then
-- iterate through claim's qualifier statements to collect their values;
-- return array with multiple value objects
return self.conf.states[param]:iterate(qualifiers, {[parameters.general] = hookNames[parameters.qualifier.."\\d"][2], count = 1}) -- pass qualifier state with level 2 hook
else
return {} -- return empty array
end
end
-- level 2 hook
function State:getQualifier(snak)
local value = {self:getValue(snak)} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getAllQualifiers(claim, param, result, hooks)
local out = {} -- array with value objects
local sep = self.conf.separators["sep"..parameters.qualifier][1] -- value object
-- iterate through the output of the separate "qualifier(s)" commands
for i = 1, self.conf.states.qualifiersCount do
-- if a hook has not been called yet, call it now
if not result[parameters.qualifier..i] then
self:callHook(parameters.qualifier..i, hooks, claim, result)
end
-- if there is output for this particular "qualifier(s)" command, then add it
if result[parameters.qualifier..i] and result[parameters.qualifier..i][1] then
-- if there is already some output, then add the separator
if #out > 0 and sep then
out[#out + 1] = sep
end
out = mergeArrays(out, result[parameters.qualifier..i])
end
end
return out
end
-- level 1 hook
function State:getReferences(claim)
if self.conf.prefetchedRefs then
-- return references that have been prefetched by isSourced
return self.conf.prefetchedRefs
end
if claim.references then
-- iterate through claim's reference statements to collect their values;
-- return array with multiple value objects
return self.conf.states[parameters.reference]:iterate(claim.references, {[parameters.general] = hookNames[parameters.reference][2], count = 1}) -- pass reference state with level 2 hook
else
return {} -- return empty array
end
end
-- level 2 hook
function State:getReference(statement)
local key, citeWeb, citeQ, label
local params = {}
local citeParams = {['web'] = {}, ['q'] = {}}
local citeMismatch = {}
local useCite = nil
local useParams = nil
local value = ""
local ref = {}
local version = 1 -- increment this each time the below logic is changed to avoid conflict errors
if statement.snaks then
-- don't include "imported from", which is added by a bot
if statement.snaks[aliasesP.importedFrom] then
statement.snaks[aliasesP.importedFrom] = nil
end
-- don't include "inferred from", which is added by a bot
if statement.snaks[aliasesP.inferredFrom] then
statement.snaks[aliasesP.inferredFrom] = nil
end
-- don't include "type of reference"
if statement.snaks[aliasesP.typeOfReference] then
statement.snaks[aliasesP.typeOfReference] = nil
end
-- don't include "image" to prevent littering
if statement.snaks[aliasesP.image] then
statement.snaks[aliasesP.image] = nil
end
-- don't include "language" if it is equal to the local one
if self:getReferenceDetail(statement.snaks, aliasesP.language) == self.conf.langName then
statement.snaks[aliasesP.language] = nil
end
-- retrieve all the parameters
for i in pairs(statement.snaks) do
label = ""
-- multiple authors may be given
if i == aliasesP.author then
params[i] = self:getReferenceDetails(statement.snaks, i, false, self.linked, true) -- link = true/false, anyLang = true
else
params[i] = {self:getReferenceDetail(statement.snaks, i, false, (self.linked or (i == aliasesP.statedIn)) and (statement.snaks[i][1].datatype ~= 'url'), true)} -- link = true/false, anyLang = true
end
if #params[i] == 0 then
params[i] = nil
else
if statement.snaks[i][1].datatype == 'external-id' then
key = "external-id"
label = self.conf:getLabel(i)
if label ~= "" then
label = label .. " "
end
else
key = i
end
-- add the parameter to each matching type of citation
for j in pairs(citeParams) do
-- do so if there was no mismatch with a previous parameter
if not citeMismatch[j] then
-- check if this parameter is not mismatching itself
if i18n['cite'][j][key] then
-- continue if an option is available in the corresponding cite template
if i18n['cite'][j][key] ~= "" then
citeParams[j][i18n['cite'][j][key]] = label .. params[i][1]
-- if there are multiple parameter values (authors), add those too
for k=2, #params[i] do
citeParams[j][i18n['cite'][j][key]..k] = label .. params[i][k]
end
end
else
citeMismatch[j] = true
end
end
end
end
end
-- get title of general template for citing web references
citeWeb = split(mw.wikibase.getSitelink(aliasesQ.citeWeb) or "", ":")[2] -- split off namespace from front
-- get title of template that expands stated-in references into citations
citeQ = split(mw.wikibase.getSitelink(aliasesQ.citeQ) or "", ":")[2] -- split off namespace from front
-- (1) use the general template for citing web references if there is a match and if at least both "reference URL" and "title" are present
if citeWeb and not citeMismatch['web'] and citeParams['web'][i18n['cite']['web'][aliasesP.referenceURL]] and citeParams['web'][i18n['cite']['web'][aliasesP.title]] then
useCite = citeWeb
useParams = citeParams['web']
-- (2) use the template that expands stated-in references into citations if there is a match and if at least "stated in" is present
elseif citeQ and not citeMismatch['q'] and citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] then
-- we need the raw "stated in" Q-identifier for the this template
citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] = self:getReferenceDetail(statement.snaks, aliasesP.statedIn, true) -- raw = true
useCite = citeQ
useParams = citeParams['q']
end
if useCite and useParams then
-- if this module is being substituted then build a regular template call, otherwise expand the template
if mw.isSubsting() then
for i, v in pairs(useParams) do
value = value .. "|" .. i .. "=" .. v
end
value = "{{" .. useCite .. value .. "}}"
else
value = mw.getCurrentFrame():expandTemplate{title=useCite, args=useParams}
end
-- (3) else, do some default rendering of name-value pairs, but only if at least "stated in", "reference URL" or "title" is present
elseif params[aliasesP.statedIn] or params[aliasesP.referenceURL] or params[aliasesP.title] then
citeParams['default'] = {}
-- start by adding authors up front
if params[aliasesP.author] and #params[aliasesP.author] > 0 then
citeParams['default'][#citeParams['default'] + 1] = table.concat(params[aliasesP.author], " & ")
end
-- combine "reference URL" and "title" into one link if both are present
if params[aliasesP.referenceURL] and params[aliasesP.title] then
citeParams['default'][#citeParams['default'] + 1] = '[' .. params[aliasesP.referenceURL][1] .. ' "' .. params[aliasesP.title][1] .. '"]'
elseif params[aliasesP.referenceURL] then
citeParams['default'][#citeParams['default'] + 1] = params[aliasesP.referenceURL][1]
elseif params[aliasesP.title] then
citeParams['default'][#citeParams['default'] + 1] = '"' .. params[aliasesP.title][1] .. '"'
end
-- then add "stated in"
if params[aliasesP.statedIn] then
citeParams['default'][#citeParams['default'] + 1] = "''" .. params[aliasesP.statedIn][1] .. "''"
end
-- remove previously added parameters so that they won't be added a second time
params[aliasesP.author] = nil
params[aliasesP.referenceURL] = nil
params[aliasesP.title] = nil
params[aliasesP.statedIn] = nil
-- add the rest of the parameters
for i, v in pairs(params) do
i = self.conf:getLabel(i)
if i ~= "" then
citeParams['default'][#citeParams['default'] + 1] = i .. ": " .. v[1]
end
end
value = table.concat(citeParams['default'], "; ")
if value ~= "" then
value = value .. "."
end
end
if value ~= "" then
value = {value} -- create one value object
if not self.rawValue then
-- this should become a <ref> tag, so save the reference's hash for later
value.refHash = "wikidata-" .. statement.hash .. "-v" .. (tonumber(i18n['cite']['version']) + version)
end
ref = {value} -- wrap the value object in an array
end
end
return ref
end
-- gets a detail of one particular type for a reference
function State:getReferenceDetail(snaks, dType, raw, link, anyLang)
local switchLang = anyLang
local value = nil
if not snaks[dType] then
return nil
end
-- if anyLang, first try the local language and otherwise any language
repeat
for _, v in ipairs(snaks[dType]) do
value = self.conf:getValue(v, raw, link, false, anyLang and not switchLang, false, true) -- noSpecial = true
if value then
break
end
end
if value or not anyLang then
break
end
switchLang = not switchLang
until anyLang and switchLang
return value
end
-- gets the details of one particular type for a reference
function State:getReferenceDetails(snaks, dType, raw, link, anyLang)
local values = {}
if not snaks[dType] then
return {}
end
for _, v in ipairs(snaks[dType]) do
-- if nil is returned then it will not be added to the table
values[#values + 1] = self.conf:getValue(v, raw, link, false, anyLang, false, true) -- noSpecial = true
end
return values
end
-- level 1 hook
function State:getAlias(object)
local value = object.value
local title = nil
if value and self.linked then
if self.conf.entityID:sub(1,1) == "Q" then
title = mw.wikibase.getSitelink(self.conf.entityID)
elseif self.conf.entityID:sub(1,1) == "P" then
title = "d:Property:" .. self.conf.entityID
end
if title then
value = buildWikilink(title, value)
end
end
value = {value} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
-- level 1 hook
function State:getBadge(value)
value = self.conf:getLabel(value, self.rawValue, self.linked, self.shortName)
if value == "" then
value = nil
end
value = {value} -- create one value object
if #value > 0 then
return {value} -- wrap the value object in an array and return it
else
return {} -- return empty array if there was no value
end
end
function State:callHook(param, hooks, statement, result)
local valuesArray, refHash
-- call a parameter's hook if it has been defined and if it has not been called before
if not result[param] and hooks[param] then
valuesArray = self[hooks[param]](self, statement, param, result, hooks) -- array with value objects
-- add to the result
if #valuesArray > 0 then
result[param] = valuesArray
result.count = result.count + 1
else
result[param] = {} -- an empty array to indicate that we've tried this hook already
return true -- miss == true
end
end
return false
end
-- iterate through claims, claim's qualifiers or claim's references to collect values
function State:iterate(statements, hooks, matchHook)
matchHook = matchHook or alwaysTrue
local matches = false
local rankPos = nil
local result, gotRequired
for _, v in ipairs(statements) do
-- rankPos will be nil for non-claim statements (e.g. qualifiers, references, etc.)
matches, rankPos = matchHook(self, v)
if matches then
result = {count = 0} -- collection of arrays with value objects
local function walk(formatTable)
local miss
for i2, v2 in pairs(formatTable.req) do
-- call a hook, adding its return value to the result
miss = self:callHook(i2, hooks, v, result)
if miss then
-- we miss a required value for this level, so return false
return false
end
if result.count == hooks.count then
-- we're done if all hooks have been called;
-- returning at this point breaks the loop
return true
end
end
for _, v2 in ipairs(formatTable) do
if result.count == hooks.count then
-- we're done if all hooks have been called;
-- returning at this point prevents further childs from being processed
return true
end
if v2.child then
walk(v2.child)
end
end
return true
end
gotRequired = walk(self.parsedFormat)
-- only append the result if we got values for all required parameters on the root level
if gotRequired then
-- if we have a rankPos (only with matchHook() for complete claims), then update the foundRank
if rankPos and self.conf.foundRank > rankPos then
self.conf.foundRank = rankPos
end
-- append the result
self.results[#self.results + 1] = result
-- break if we only need a single value
if self.singleValue then
break
end
end
end
end
return self:out()
end
local function getEntityId(arg, eid, page, allowOmitPropPrefix)
local id = nil
local prop = nil
if arg then
if arg:sub(1,1) == ":" then
page = arg
eid = nil
elseif arg:sub(1,1):upper() == "Q" or arg:sub(1,9):lower() == "property:" or allowOmitPropPrefix then
eid = arg
page = nil
else
prop = arg
end
end
if eid then
if eid:sub(1,9):lower() == "property:" then
id = replaceAlias(mw.text.trim(eid:sub(10)))
if id:sub(1,1):upper() ~= "P" then
id = ""
end
else
id = replaceAlias(eid)
end
elseif page then
if page:sub(1,1) == ":" then
page = mw.text.trim(page:sub(2))
end
id = mw.wikibase.getEntityIdForTitle(page) or ""
end
if not id then
id = mw.wikibase.getEntityIdForCurrentPage() or ""
end
id = id:upper()
if not mw.wikibase.isValidEntityId(id) then
id = ""
end
return id, prop
end
local function nextArg(args)
local arg = args[args.pointer]
if arg then
args.pointer = args.pointer + 1
return mw.text.trim(arg)
else
return nil
end
end
local function claimCommand(args, funcName)
local cfg = Config:new()
cfg:processFlagOrCommand(funcName) -- process first command (== function name)
local lastArg, parsedFormat, formatParams, claims, value
local hooks = {count = 0}
-- set the date if given;
-- must come BEFORE processing the flags
if args[p.args.date] then
cfg.atDate = {parseDate(args[p.args.date])}
cfg.periods = {false, true, false} -- change default time constraint to 'current'
end
-- process flags and commands
repeat
lastArg = nextArg(args)
until not cfg:processFlagOrCommand(lastArg)
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page])
if cfg.entityID == "" then
return "" -- we cannot continue without a valid entity ID
end
cfg.entity = mw.wikibase.getEntity(cfg.entityID)
if not cfg.propertyID then
cfg.propertyID = nextArg(args)
end
cfg.propertyID = replaceAlias(cfg.propertyID)
if not cfg.entity or not cfg.propertyID then
return "" -- we cannot continue without an entity or a property ID
end
cfg.propertyID = cfg.propertyID:upper()
if not cfg.entity.claims or not cfg.entity.claims[cfg.propertyID] then
return "" -- there is no use to continue without any claims
end
claims = cfg.entity.claims[cfg.propertyID]
if cfg.states.qualifiersCount > 0 then
-- do further processing if "qualifier(s)" command was given
if #args - args.pointer + 1 > cfg.states.qualifiersCount then
-- claim ID or literal value has been given
cfg.propertyValue = nextArg(args)
end
for i = 1, cfg.states.qualifiersCount do
-- check if given qualifier ID is an alias and add it
cfg.qualifierIDs[parameters.qualifier..i] = replaceAlias(nextArg(args) or ""):upper()
end
elseif cfg.states[parameters.reference] then
-- do further processing if "reference(s)" command was given
cfg.propertyValue = nextArg(args)
end
-- check for special property value 'somevalue' or 'novalue'
if cfg.propertyValue then
cfg.propertyValue = replaceSpecialChars(cfg.propertyValue)
if cfg.propertyValue ~= "" and mw.text.trim(cfg.propertyValue) == "" then
cfg.propertyValue = " " -- single space represents 'somevalue', whereas empty string represents 'novalue'
else
cfg.propertyValue = mw.text.trim(cfg.propertyValue)
end
end
-- parse the desired format, or choose an appropriate format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
elseif cfg.states.qualifiersCount > 0 then -- "qualifier(s)" command given
if cfg.states[parameters.property] then -- "propert(y|ies)" command given
parsedFormat, formatParams = parseFormat(formats.propertyWithQualifier)
else
parsedFormat, formatParams = parseFormat(formats.qualifier)
end
elseif cfg.states[parameters.property] then -- "propert(y|ies)" command given
parsedFormat, formatParams = parseFormat(formats.property)
else -- "reference(s)" command given
parsedFormat, formatParams = parseFormat(formats.reference)
end
-- if a "qualifier(s)" command and no "propert(y|ies)" command has been given, make the movable separator a semicolon
if cfg.states.qualifiersCount > 0 and not cfg.states[parameters.property] then
cfg.separators["sep"..parameters.separator][1] = {";"}
end
-- if only "reference(s)" has been given, set the default separator to none (except when raw)
if cfg.states[parameters.reference] and not cfg.states[parameters.property] and cfg.states.qualifiersCount == 0
and not cfg.states[parameters.reference].rawValue then
cfg.separators["sep"][1] = nil
end
-- if exactly one "qualifier(s)" command has been given, make "sep%q" point to "sep%q1" to make them equivalent
if cfg.states.qualifiersCount == 1 then
cfg.separators["sep"..parameters.qualifier] = cfg.separators["sep"..parameters.qualifier.."1"]
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hooks that should be called (getProperty, getQualifiers, getReferences);
-- only define a hook if both its command ("propert(y|ies)", "reference(s)", "qualifier(s)") and its parameter ("%p", "%r", "%q1", "%q2", "%q3") have been given
for i, v in pairs(cfg.states) do
-- e.g. 'formatParams["%q1"] or formatParams["%q"]' to define hook even if "%q1" was not defined to be able to build a complete value for "%q"
if formatParams[i] or formatParams[i:sub(1, 2)] then
hooks[i] = getHookName(i, 1)
hooks.count = hooks.count + 1
end
end
-- the "%q" parameter is not attached to a state, but is a collection of the results of multiple states (attached to "%q1", "%q2", "%q3", ...);
-- so if this parameter is given then this hook must be defined separately, but only if at least one "qualifier(s)" command has been given
if formatParams[parameters.qualifier] and cfg.states.qualifiersCount > 0 then
hooks[parameters.qualifier] = getHookName(parameters.qualifier, 1)
hooks.count = hooks.count + 1
end
-- create a state for "properties" if it doesn't exist yet, which will be used as a base configuration for each claim iteration;
-- must come AFTER defining the hooks
if not cfg.states[parameters.property] then
cfg.states[parameters.property] = State:new(cfg, parameters.property)
-- if the "single" flag has been given then this state should be equivalent to "property" (singular)
if cfg.singleClaim then
cfg.states[parameters.property].singleValue = true
end
end
-- if the "sourced" flag has been given then create a state for "reference" if it doesn't exist yet, using default values,
-- which must exist in order to be able to determine if a claim has any references;
-- must come AFTER defining the hooks
if cfg.sourcedOnly and not cfg.states[parameters.reference] then
cfg:processFlagOrCommand(p.claimCommands.reference) -- use singular "reference" to minimize overhead
end
-- set the parsed format and the separators (and optional punctuation mark);
-- must come AFTER creating the additonal states
cfg:setFormatAndSeparators(cfg.states[parameters.property], parsedFormat)
-- process qualifier matching values, analogous to cfg.propertyValue
for i, v in pairs(args) do
i = tostring(i)
if i:match('^[Pp]%d+$') or aliasesP[i] then
v = replaceSpecialChars(v)
-- check for special qualifier value 'somevalue'
if v ~= "" and mw.text.trim(v) == "" then
v = " " -- single space represents 'somevalue'
end
cfg.qualifierIDsAndValues[replaceAlias(i):upper()] = v
end
end
-- first sort the claims on rank to pre-define the order of output (preferred first, then normal, then deprecated)
claims = sortOnRank(claims)
-- then iterate through the claims to collect values
value = cfg:concatValues(cfg.states[parameters.property]:iterate(claims, hooks, State.claimMatches)) -- pass property state with level 1 hooks and matchHook
-- if desired, add a clickable icon that may be used to edit the returned values on Wikidata
if cfg.editable and value ~= "" then
value = value .. cfg:getEditIcon()
end
return value
end
local function generalCommand(args, funcName)
local cfg = Config:new()
cfg.curState = State:new(cfg)
local lastArg
local value = nil
repeat
lastArg = nextArg(args)
until not cfg:processFlag(lastArg)
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true)
if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then
return "" -- we cannot continue without an entity
end
-- serve according to the given command
if funcName == p.generalCommands.label then
value = cfg:getLabel(cfg.entityID, cfg.curState.rawValue, cfg.curState.linked, cfg.curState.shortName)
elseif funcName == p.generalCommands.title then
cfg.inSitelinks = true
if cfg.entityID:sub(1,1) == "Q" then
value = mw.wikibase.getSitelink(cfg.entityID)
end
if cfg.curState.linked and value then
value = buildWikilink(value)
end
elseif funcName == p.generalCommands.description then
value = mw.wikibase.getDescription(cfg.entityID)
else
local parsedFormat, formatParams
local hooks = {count = 0}
cfg.entity = mw.wikibase.getEntity(cfg.entityID)
if funcName == p.generalCommands.alias or funcName == p.generalCommands.badge then
cfg.curState.singleValue = true
end
if funcName == p.generalCommands.alias or funcName == p.generalCommands.aliases then
if not cfg.entity.aliases or not cfg.entity.aliases[cfg.langCode] then
return "" -- there is no use to continue without any aliasses
end
local aliases = cfg.entity.aliases[cfg.langCode]
-- parse the desired format, or parse the default aliases format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
else
parsedFormat, formatParams = parseFormat(formats.alias)
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hook that should be called (getAlias);
-- only define the hook if the parameter ("%a") has been given
if formatParams[parameters.alias] then
hooks[parameters.alias] = getHookName(parameters.alias, 1)
hooks.count = hooks.count + 1
end
-- set the parsed format and the separators (and optional punctuation mark)
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)
-- iterate to collect values
value = cfg:concatValues(cfg.curState:iterate(aliases, hooks))
elseif funcName == p.generalCommands.badge or funcName == p.generalCommands.badges then
if not cfg.entity.sitelinks or not cfg.entity.sitelinks[cfg.siteID] or not cfg.entity.sitelinks[cfg.siteID].badges then
return "" -- there is no use to continue without any badges
end
local badges = cfg.entity.sitelinks[cfg.siteID].badges
cfg.inSitelinks = true
-- parse the desired format, or parse the default aliases format
if args["format"] then
parsedFormat, formatParams = parseFormat(args["format"])
else
parsedFormat, formatParams = parseFormat(formats.badge)
end
-- process overridden separator values;
-- must come AFTER tweaking the default separators
cfg:processSeparators(args)
-- define the hook that should be called (getBadge);
-- only define the hook if the parameter ("%b") has been given
if formatParams[parameters.badge] then
hooks[parameters.badge] = getHookName(parameters.badge, 1)
hooks.count = hooks.count + 1
end
-- set the parsed format and the separators (and optional punctuation mark)
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)
-- iterate to collect values
value = cfg:concatValues(cfg.curState:iterate(badges, hooks))
end
end
value = value or ""
if cfg.editable and value ~= "" then
-- if desired, add a clickable icon that may be used to edit the returned value on Wikidata
value = value .. cfg:getEditIcon()
end
return value
end
-- modules that include this module should call the functions with an underscore prepended, e.g.: p._property(args)
local function establishCommands(commandList, commandFunc)
for _, commandName in pairs(commandList) do
local function wikitextWrapper(frame)
local args = copyTable(frame.args)
args.pointer = 1
loadI18n(aliasesP, frame)
return commandFunc(args, commandName)
end
p[commandName] = wikitextWrapper
local function luaWrapper(args)
args = copyTable(args)
args.pointer = 1
loadI18n(aliasesP)
return commandFunc(args, commandName)
end
p["_" .. commandName] = luaWrapper
end
end
establishCommands(p.claimCommands, claimCommand)
establishCommands(p.generalCommands, generalCommand)
-- main function that is supposed to be used by wrapper templates
function p.main(frame)
if not mw.wikibase then return nil end
local f, args
loadI18n(aliasesP, frame)
-- get the parent frame to take the arguments that were passed to the wrapper template
frame = frame:getParent() or frame
if not frame.args[1] then
throwError("no-function-specified")
end
f = mw.text.trim(frame.args[1])
if f == "main" then
throwError("main-called-twice")
end
assert(p["_"..f], errorText('no-such-function', f))
-- copy arguments from immutable to mutable table
args = copyTable(frame.args)
-- remove the function name from the list
table.remove(args, 1)
return p["_"..f](args)
end
return p
9scru16s5146chaxiyatugrhsfa43zn
Module:Wd/i18n
828
54004752
951882658
951879406
2020-04-19T11:12:50Z
Thayts
9149033
Scribunto
text/plain
-- The values and functions in this submodule should be localized per wiki.
local p = {}
function p.init(aliasesP)
p = {
["errors"] = {
["unknown-data-type"] = "Unknown or unsupported datatype '$1'.",
["missing-required-parameter"] = "No required parameters defined, needing at least one",
["extra-required-parameter"] = "Parameter '$1' must be defined as optional",
["no-function-specified"] = "You must specify a function to call", -- equal to the standard module error message
["main-called-twice"] = 'The function "main" cannot be called twice',
["no-such-function"] = 'The function "$1" does not exist' -- equal to the standard module error message
},
["info"] = {
["edit-on-wikidata"] = "Edit this on Wikidata"
},
["numeric"] = {
["decimal-mark"] = ".",
["delimiter"] = ","
},
["datetime"] = {
["prefixes"] = {
["decade-period"] = ""
},
["suffixes"] = {
["decade-period"] = "s",
["millennium"] = " millennium",
["century"] = " century",
["million-years"] = " million years",
["billion-years"] = " billion years",
["year"] = " year",
["years"] = " years"
},
["julian-calendar"] = "Julian calendar", -- linked page title
["julian"] = "Julian",
["BCE"] = "BCE",
["CE"] = "CE",
["common-era"] = "Common Era" -- linked page title
},
["coord"] = {
["latitude-north"] = "N",
["latitude-south"] = "S",
["longitude-east"] = "E",
["longitude-west"] = "W",
["degrees"] = "°",
["minutes"] = "'",
["seconds"] = '"',
["separator"] = ", "
},
["values"] = {
["unknown"] = "unknown",
["none"] = "none"
},
["cite"] = {
["version"] = "2", -- increment this each time the below parameters are changed to avoid conflict errors
["web"] = {
-- <= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. "")
[aliasesP.statedIn] = "website",
[aliasesP.referenceURL] = "url",
[aliasesP.publicationDate] = "date",
[aliasesP.retrieved] = "access-date",
[aliasesP.title] = "title",
[aliasesP.archiveURL] = "archive-url",
[aliasesP.archiveDate] = "archive-date",
[aliasesP.language] = "language",
[aliasesP.author] = "author", -- existence of author1, author2, author3, etc. is assumed
[aliasesP.publisher] = "publisher",
[aliasesP.quote] = "quote",
[aliasesP.pages] = "pages" -- extra option
},
["q"] = {
-- <= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. "")
[aliasesP.statedIn] = "1",
[aliasesP.pages] = "pages",
[aliasesP.column] = "at",
[aliasesP.chapter] = "chapter",
[aliasesP.sectionVerseOrParagraph] = "section",
["external-id"] = "id", -- used for any type of database property ID
[aliasesP.title] = "title",
[aliasesP.publicationDate] = "date",
[aliasesP.retrieved] = "access-date"
}
}
}
p.getOrdinalSuffix = function(num)
if tostring(num):sub(-2,-2) == '1' then
return "th" -- 10th, 11th, 12th, 13th, ... 19th
end
num = tostring(num):sub(-1)
if num == '1' then
return "st"
elseif num == '2' then
return "nd"
elseif num == '3' then
return "rd"
else
return "th"
end
end
p.addDelimiters = function(n)
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
if left and num and right then
return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. p['numeric']['delimiter']):reverse()) .. right
else
return n
end
end
return p
end
return p
h70ieb0uxswts38nevjbf8jjyt60l0l
Module:Webarchive
828
51937454
1068391951
1068212258
2022-01-28T05:19:57Z
Zyxw
473593
Add option where date extracted from URL can be displayed in formats other than ISO. Tested first with /sandbox. See examples in [[Module:Webarchive/testcases]] and [[Template:Webarchive/testcases/Production]].
Scribunto
text/plain
--[[ ----------------------------------
Lua module implementing the {{webarchive}} template.
A merger of the functionality of three templates: {{wayback}}, {{webcite}} and {{cite archives}}
]]
--[[--------------------------< D E P E N D E N C I E S >------------------------------------------------------
]]
require('Module:No globals');
local getArgs = require ('Module:Arguments').getArgs;
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local categories = {}; -- category names
local config = {}; -- global configuration settings
local digits = {}; -- for i18n; table that translates local-wiki digits to western digits
local err_warn_msgs = {}; -- error and warning messages
local excepted_pages = {};
local month_num = {}; -- for i18n; table that translates local-wiki month names to western digits
local prefixes = {}; -- service provider tail string prefixes
local services = {}; -- archive service provider data from
local s_text = {}; -- table of static text strings used to build final rendering
local uncategorized_namespaces = {}; -- list of namespaces that we should not categorize
local uncategorized_subpages = {}; -- list of subpages that should not be categorized
--[[--------------------------< P A G E S C O P E I D E N T I F I E R S >----------------------------------
]]
local non_western_digits; -- boolean flag set true when data.digits.enable is true
local this_page = mw.title.getCurrentTitle();
local track = {}; -- Associative array to hold tracking categories
local ulx = {}; -- Associative array to hold template data
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Populates numbered arguments in a message string using an argument table.
]]
local function substitute (msg, args)
return args and mw.message.newRawMessage (msg, args):plain() or msg;
end
--[[--------------------------< tableLength >-----------------------
Given a 1-D table, return number of elements
]]
local function tableLength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
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, 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, no_link)
if nil == no_link then
if link and ('' ~= link) then
if display and ('' ~= display) then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
end
return display or ''; -- link not set so return the display text
else -- no_link
if display and ('' ~= display) then -- if there is display text
return display; -- return that
else
return link or ''; -- return the target article name or empty string
end
end
end
--[[--------------------------< createTracking >-----------------------
Return data in track[] ie. tracking categories
]]
local function createTracking()
if not excepted_pages[this_page.fullText] then -- namespace:title/fragment is allowed to be categorized (typically this module's / template's testcases page(s))
if uncategorized_namespaces[this_page.nsText] then
return ''; -- this page not to be categorized so return empty string
end
for _,v in ipairs (uncategorized_subpages) do -- cycle through page name patterns
if this_page.text:match (v) then -- test page name against each pattern
return ''; -- this subpage type not to be categorized so return empty string
end
end
end
local out = {};
if tableLength(track) > 0 then
for key, _ in pairs(track) do -- loop through table
table.insert (out, make_wikilink (key)); -- and convert category names to links
end
end
return table.concat (out); -- concat into one big string; empty string if table is empty
end
--[[--------------------------< inlineError >-----------------------
Critical error. Render output completely in red. Add to tracking category.
This function called as the last thing before abandoning this module
]]
local function inlineError (msg, args)
track[categories.error] = 1
return table.concat ({
'<span style="font-size:100%" class="error citation-comment">Error in ', -- open the error message span
config.tname, -- insert the local language template name
' template: ',
substitute (msg, args), -- insert the formatted error message
'.</span>', -- close the span
createTracking() -- add the category
})
end
--[[--------------------------< inlineRed >-----------------------
Render a text fragment in red, such as a warning as part of the final output.
Add tracking category.
]]
local function inlineRed(msg, trackmsg)
if trackmsg == "warning" then
track[categories.warning] = 1;
elseif trackmsg == "error" then
track[categories.error] = 1;
end
return '<span style="font-size:100%" class="error citation-comment">' .. msg .. '</span>'
end
--[[--------------------------< base62 >-----------------------
Convert base-62 to base-10
Credit: https://de.wikipedia.org/wiki/Modul:Expr
]]
local function base62( value )
local r = 1 -- default return value is input value is malformed
if value:match ('%W') then -- value must only be in the set [0-9a-zA-Z]
return; -- nil return when value contains extraneous characters
end
local n = #value -- number of characters in value
local k = 1
local c
r = 0
for i = n, 1, -1 do -- loop through all characters in value from ls digit to ms digit
c = value:byte( i, i )
if c >= 48 and c <= 57 then -- character is digit 0-9
c = c - 48
elseif c >= 65 and c <= 90 then -- character is ascii a-z
c = c - 55
else -- must be ascii A-Z
c = c - 61
end
r = r + c * k -- accumulate this base62 character's value
k = k * 62 -- bump for next
end -- for i
return r
end
--[[--------------------------< D E C O D E _ D A T E >--------------------------------------------------------
Given a date string, return it in iso format along with an indicator of the date's format. Except that month names
must be recognizable as legitimate month names with proper capitalization, and that the date string must match one
of the recognized date formats, no error checking is done here; return nil else
]]
local function decode_date (date_str)
local patterns = {
['dmy'] = {'^(%d%d?) +([^%s%d]+) +(%d%d%d%d)$', 'd', 'm', 'y'}, -- %a does not recognize unicode combining characters used by some languages
['mdy'] = {'^([^%s%d]+) (%d%d?), +(%d%d%d%d)$', 'm', 'd', 'y'},
['ymd'] = {'^(%d%d%d%d) +([^%s%d]+) (%d%d?)$', 'y', 'm', 'd'}, -- not mos compliant at en.wiki but may be acceptible at other wikis
};
local t = {};
if non_western_digits then -- this wiki uses non-western digits?
date_str = mw.ustring.gsub (date_str, '%d', digits); -- convert this wiki's non-western digits to western digits
end
if date_str:match ('^%d%d%d%d%-%d%d%-%d%d$') then -- already an iso format date, return western digits form
return date_str, 'iso';
end
for k, v in pairs (patterns) do
local c1, c2, c3 = mw.ustring.match (date_str, patterns[k][1]); -- c1 .. c3 are captured but we don't know what they hold
if c1 then -- set on match
t = { -- translate unspecified captures to y, m, and d
[patterns[k][2]] = c1, -- fill the table of captures with the captures
[patterns[k][3]] = c2, -- take index names from src_pattern table and assign sequential captures
[patterns[k][4]] = c3,
};
if month_num[t.m] then -- when month not already a number
t.m = month_num[t.m]; -- replace valid month name with a number
else
return nil, 'iso'; -- not a valid date form because month not valid
end
return mw.ustring.format ('%.4d-%.2d-%.2d', t.y, t.m, t.d), k; -- return date in iso format
end
end
return nil, 'iso'; -- date could not be decoded; return nil and default iso date
end
--[[--------------------------< makeDate >-----------------------
Given year, month, day numbers, (zero-padded or not) return a full date in df format
where df may be one of:
mdy, dmy, iso, ymd
on entry, year, month, day are presumed to be correct for the date that they represent; all are required
in this module, makeDate() is sometimes given an iso-format date in year:
makeDate (2018-09-20, nil, nil, df)
this works because table.concat() sees only one table member
]]
local function makeDate (year, month, day, df)
local format = {
['dmy'] = 'j F Y',
['mdy'] = 'F j, Y',
['ymd'] = 'Y F j',
['iso'] = 'Y-m-d',
};
local date = table.concat ({year, month, day}, '-'); -- assemble year-initial numeric-format date (zero padding not required here)
if non_western_digits then -- this wiki uses non-western digits?
date = mw.ustring.gsub (date, '%d', digits); -- convert this wiki's non-western digits to western digits
end
return mw.getContentLanguage():formatDate (format[df], date);
end
--[[--------------------------< I S _ V A L I D _ D A T E >----------------------------------------------------
Returns true if date is after 31 December 1899 (why is 1900 the min year? shouldn't the internet's date-of-birth
be min year?), not after today's date, and represents a valid date (29 February 2017 is not a valid date). Applies
Gregorian leapyear rules.
all arguments are required
]]
local function is_valid_date (year, month, day)
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
local month_length;
local y, m, d;
local today = os.date ('*t'); -- fetch a table of current date parts
if not year or '' == year or not month or '' == month or not day or '' == day then
return false; -- something missing
end
y = tonumber (year);
m = tonumber (month);
d = tonumber (day);
if 1900 > y or today.year < y or 1 > m or 12 < m then -- year and month are within bounds TODO: 1900?
return false;
end
if (2==m) then -- if February
month_length = 28; -- then 28 days unless
if (0==(y%4) and (0~=(y%100) or 0==(y%400))) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
else
month_length=days_in_month[m];
end
if 1 > d or month_length < d then -- day is within bounds
return false;
end
-- here when date parts represent a valid date
return os.time({['year']=y, ['month']=m, ['day']=d, ['hour']=0}) <= os.time(); -- date at midnight must be less than or equal to current date/time
end
--[[--------------------------< decodeWebciteDate >-----------------------
Given a URI-path to Webcite (eg. /67xHmVFWP) return the encoded date in df format
returns date string in df format - webcite date is a unix timestamp encoded as bae62
or the string 'query'
]]
local function decodeWebciteDate(path, df)
local dt = {};
local decode;
dt = mw.text.split(path, "/")
-- valid URL formats that are not base62
-- http://www.webcitation.org/query?id=1138911916587475
-- http://www.webcitation.org/query?url=http..&date=2012-06-01+21:40:03
-- http://www.webcitation.org/1138911916587475
-- http://www.webcitation.org/cache/73e53dd1f16cf8c5da298418d2a6e452870cf50e
-- http://www.webcitation.org/getfile.php?fileid=1c46e791d68e89e12d0c2532cc3cf629b8bc8c8e
if dt[2]:find ('query', 1, true) or
dt[2]:find ('cache', 1, true) or
dt[2]:find ('getfile', 1, true) or
tonumber(dt[2]) then
return 'query';
end
decode = base62(dt[2]); -- base62 string -> exponential number
if not decode then
return nil; -- nil return when dt[2] contains characters not in %w
end
dt = os.date('*t', string.format("%d", decode):sub(1,10)) -- exponential number -> text -> first 10 characters (a unix timestamp) -> a table of date parts
decode = makeDate (dt.year, dt.month, dt.day, 'iso'); -- date comparisons are all done in iso format with western digits
if non_western_digits then -- this wiki uses non-western digits?
decode = mw.ustring.gsub (decode, '%d', digits); -- convert this wiki's non-western digits to western digits
end
return decode;
end
--[[--------------------------< decodeWaybackDate >-----------------------
Given a URI-path to Wayback (eg. /web/20160901010101/http://example.com )
or Library of Congress Web Archives (eg. /all/20160901010101/http://example.com)
or UK Government Web Archive (eg. /ukgwa/20160901010101/http://example.com or /tna/20160901010101/http://example.com)
return the formatted date eg. "September 1, 2016" in df format
Handle non-digits in snapshot ID such as "re_" and "-" and "*"
returns two values:
first value is one of these:
valid date string in df format - wayback date is valid (including the text string 'index' when date is '/*/')
empty string - wayback date is malformed (less than 8 digits, not a valid date)
nil - wayback date is '/save/' or otherwise not a number
second return value is an appropriate 'message' may or may not be formatted
]]
local function decodeWaybackDate(path, df)
local msg, snapdate;
snapdate = path:gsub ('^/web/', ''):gsub ('^/all/', ''):gsub ('^/ukgwa/', ''):gsub ('^/tna/', ''):gsub ('^/', ''); -- remove leading /web/, /all/, /ukgwa/, /tna/, or /
snapdate = snapdate:match ('^[^/]+'); -- get timestamp
if snapdate == "*" then -- eg. /web/*/http.., etc.
return 'index'; -- return indicator that this url has an index date
end
snapdate = snapdate:gsub ('%a%a_%d?$', ''):gsub ('%-', ''); -- from date, remove any trailing "re_", dashes
msg = '';
if snapdate:match ('%*$') then -- a trailing '*' causes calendar display at archive .org
snapdate = snapdate:gsub ('%*$', ''); -- remove so not part of length calc later
msg = inlineRed (err_warn_msgs.ts_cal, 'warning'); -- make a message
end
if not tonumber(snapdate) then
return nil, 'ts_nan'; -- return nil (fatal error flag) and message selector
end
local dlen = snapdate:len();
if dlen < 8 then -- we need 8 digits TODO: but shouldn't this be testing for 14 digits?
return '', inlineRed (err_warn_msgs.ts_short, 'error'); -- return empty string and error message
end
local year, month, day = snapdate:match ('(%d%d%d%d)(%d%d)(%d%d)'); -- no need for snapdatelong here
if not is_valid_date (year, month, day) then
return '', inlineRed (err_warn_msgs.ts_date, 'error'); -- return empty string and error message
end
snapdate = table.concat ({year, month, day}, '-'); -- date comparisons are all done in iso format
if 14 == dlen then
return snapdate, msg; -- return date with message if any
else
return snapdate, msg .. inlineRed (err_warn_msgs.ts_len, 'warning'); -- return date with warning message(s)
end
end
--[[--------------------------< decodeArchiveisDate >-----------------------
Given an Archive.is "long link" URI-path (e.g. /2016.08.28-144552/http://example.com)
return the date in df format (e.g. if df = dmy, return 28 August 2016)
Handles "." and "-" in snapshot date, so 2016.08.28-144552 is same as 20160828144552
returns two values:
first value is one of these:
valid date string in df format - archive.is date is valid (including the text string 'short link' when url is the short form)
empty string - wayback date is malformed (not a number, less than 8 digits, not a valid date)
nil - wayback date is '/save/'
second return value is an appropriate 'message' may or may not be formatted
]]
local function decodeArchiveisDate(path, df)
local snapdate
if path:match ('^/%w+$') then -- short form url path is '/' followed by some number of base 62 digits and nothing else
return "short link" -- e.g. http://archive.is/hD1qz
end
snapdate = mw.text.split (path, '/')[2]:gsub('[%.%-]', ''); -- get snapshot date, e.g. 2016.08.28-144552; remove periods and hyphens
local dlen = string.len(snapdate)
if dlen < 8 then -- we need 8 digits TODO: but shouldn't this be testing for 14 digits?
return '', inlineRed (err_warn_msgs.ts_short, 'error'); -- return empty string and error message
end
local year, month, day = snapdate:match ('(%d%d%d%d)(%d%d)(%d%d)'); -- no need for snapdatelong here
if not is_valid_date (year, month, day) then
return '', inlineRed (err_warn_msgs.ts_date, 'error'); -- return empty string and error message
end
snapdate = table.concat ({year, month, day}, '-'); -- date comparisons are all done in iso format
if 14 == dlen then
return snapdate; -- return date
else
return snapdate, inlineRed (err_warn_msgs.ts_len, 'warning'); -- return date with warning message
end
end
--[[--------------------------< serviceName >-----------------------
Given a domain extracted by mw.uri.new() (eg. web.archive.org) set tail string and service ID
]]
local function serviceName(host, no_link)
local tracking;
local index;
host = host:lower():gsub ('^web%.(.+)', '%1'):gsub ('^www%.(.+)', '%1'); -- lowercase, remove web. and www. subdomains
if services[host] then
index = host;
else
for k, _ in pairs (services) do
if host:find ('%f[%a]'..k:gsub ('([%.%-])', '%%%1')) then
index = k;
break;
end
end
end
if index then
local out = {''}; -- empty string in [1] so that concatenated result has leading single space
ulx.url1.service = services[index][4] or 'other';
tracking = services[index][5] or categories.other;
-- build tail string
if false == services[index][1] then -- select prefix
table.insert (out, prefixes.at);
elseif true == services[index][1] then
table.insert (out, prefixes.atthe);
else
table.insert (out, services[index][1]);
end
table.insert (out, make_wikilink (services[index][2], services[index][3], no_link)); -- add article wikilink
if services[index][6] then -- add tail postfix if it exists
table.insert (out, services[index][6]);
end
ulx.url1.tail = table.concat (out, ' '); -- put it all together; result has leading space character
else -- here when unknown archive
ulx.url1.service = 'other';
tracking = categories.unknown;
ulx.url1.tail = table.concat ({'', prefixes.at, host, inlineRed (err_warn_msgs.unknown_url, error)}, ' ');
end
track[tracking] = 1
end
--[[--------------------------< parseExtraArgs >-----------------------
Parse numbered arguments starting at 2, such as url2..url10, date2..date10, title2..title10
For example: {{webarchive |url=.. |url4=.. |url7=..}}
Three url arguments not in numeric sequence (1..4..7).
Function only processes arguments numbered 2 or greater (in this case 4 and 7)
It creates numeric sequenced table entries like:
urlx.url2.url = <argument value for url4>
urlx.url3.url = <argument value for url7>
Returns the number of URL arguments found numbered 2 or greater (in this case returns "2")
]]
local function parseExtraArgs(args)
local i, j, argurl, argurl2, argdate, argtitle
j = 2
for i = 2, config.maxurls do
argurl = "url" .. i
if args[argurl] then
argurl2 = "url" .. j
ulx[argurl2] = {}
ulx[argurl2]["url"] = args[argurl]
argdate = "date" .. j
if args[argdate] then
ulx[argurl2]["date"] = args[argdate]
else
ulx[argurl2]["date"] = inlineRed (err_warn_msgs.date_miss, 'warning');
end
argtitle = "title" .. j
if args[argtitle] then
ulx[argurl2]["title"] = args[argtitle]
else
ulx[argurl2]["title"] = nil
end
j = j + 1
end
end
if j == 2 then
return 0
else
return j - 2
end
end
--[[--------------------------< comma >-----------------------
Given a date string, return "," if it's MDY
]]
local function comma(date)
return (date and date:match ('%a+ +%d%d?(,) +%d%d%d%d')) or '';
end
--[[--------------------------< createRendering >-----------------------
Return a rendering of the data in ulx[][]
]]
local function createRendering()
local displayfield
local out = {};
local index_date, msg = ulx.url1.date:match ('(index)(.*)'); -- when ulx.url1.date extract 'index' text and message text (if there is a message)
ulx.url1.date = ulx.url1.date:gsub ('index.*', 'index'); -- remove message
if 'none' == ulx.url1.format then -- For {{wayback}}, {{webcite}}
table.insert (out, '['); -- open extlink markup
table.insert (out, ulx.url1.url); -- add url
if ulx.url1.title then
table.insert (out, ' ') -- the required space
table.insert (out, ulx.url1.title) -- the title
table.insert (out, ']'); -- close extlink markup
table.insert (out, ulx.url1.tail); -- tail text
if ulx.url1.date then
table.insert (out, ' ('); -- open date text; TODO: why the html entity? replace with regular space?
table.insert (out, 'index' == ulx.url1.date and s_text.archive or s_text.archived); -- add text
table.insert (out, ' '); -- insert a space
table.insert (out, ulx.url1.date); -- add date
table.insert (out, ')'); -- close date text
end
else -- no title
if index_date then -- when url date is 'index'
table.insert (out, table.concat ({' ', s_text.Archive_index, ']'})); -- add the index link label
table.insert (out, msg or ''); -- add date mismatch message when url date is /*/ and |date= has valid date
else
table.insert (out, table.concat ({' ', s_text.Archived, '] '})); -- add link label for url has timestamp date (will include mismatch message if there is one)
end
if ulx.url1.date then
if 'index' ~= ulx.url1.date then
table.insert (out, ulx.url1.date); -- add date when data is not 'index'
end
table.insert (out, comma(ulx.url1.date)); -- add ',' if date format is mdy
table.insert (out, ulx.url1.tail); -- add tail text
else -- no date
table.insert (out, ulx.url1.tail); -- add tail text
end
end
if 0 < ulx.url1.extraurls then -- For multiple archive URLs
local tot = ulx.url1.extraurls + 1
table.insert (out, '.') -- terminate first url
table.insert (out, table.concat ({' ', s_text.addlarchives, ': '})); -- add header text
for i=2, tot do -- loop through the additionals
local index = table.concat ({'url', i}); -- make an index
displayfield = ulx[index]['title'] and 'title' or 'date'; -- choose display text
table.insert (out, '['); -- open extlink markup
table.insert (out, ulx[index]['url']); -- add the url
table.insert (out, ' '); -- the required space
table.insert (out, ulx[index][displayfield]); -- add the label
table.insert (out, ']'); -- close extlink markup
table.insert (out, i==tot and '.' or ', '); -- add terminator
end
end
return table.concat (out); -- make a big string and done
else -- For {{cite archives}}
if 'addlarchives' == ulx.url1.format then -- Multiple archive services
table.insert (out, table.concat ({s_text.addlarchives, ': '})); -- add header text
else -- Multiple pages from the same archive
table.insert (out, table.concat ({s_text.addlpages, ' '})); -- add header text
table.insert (out, ulx.url1.date); -- add date to header text
table.insert (out, ': '); -- close header text
end
local tot = ulx.url1.extraurls + 1;
for i=1, tot do -- loop through the additionals
local index = table.concat ({'url', i}); -- make an index
table.insert (out, '['); -- open extlink markup
table.insert (out, ulx[index]['url']); -- add url
table.insert (out, ' '); -- add required space
displayfield = ulx[index]['title'];
if 'addlarchives' == ulx.url1.format then
if not displayfield then
displayfield = ulx[index]['date']
end
else -- must be addlpages
if not displayfield then
displayfield = table.concat ({s_text.Page, ' ', i});
end
end
table.insert (out, displayfield); -- add title, date, page label text
table.insert (out, ']'); -- close extlink markup
table.insert (out, (i==tot and '.' or ', ')); -- add terminator
end
return table.concat (out); -- make a big string and done
end
end
--[[--------------------------< P A R A M E T E R _ N A M E _ X L A T E >--------------------------------------
for internaltionalization, translate local-language parameter names to their English equivalents
TODO: return error message if multiple aliases of the same canonical parameter name are found?
returns two tables:
new_args - holds canonical form parameters and their values either from translation or because the parameter was already in canonical form
origin - maps canonical-form parameter names to their untranslated (local language) form for error messaging in the local language
unrecognized parameters are ignored
]]
local function parameter_name_xlate (args, params, enum_params)
local name; -- holds modifiable name of the parameter name during evaluation
local enum; -- for enumerated parameters, holds the enumerator during evaluation
local found = false; -- flag used to break out of nested for loops
local new_args = {}; -- a table that holds canonical and translated parameter k/v pairs
local origin = {}; -- a table that maps original (local language) parameter names to their canonical name for local language error messaging
local unnamed_params; -- set true when unsupported positional parameters are detected
for k, v in pairs (args) do -- loop through all of the arguments in the args table
name = k; -- copy of original parameter name
if 'string' == type (k) then
if non_western_digits then -- true when non-western digits supported at this wiki
name = mw.ustring.gsub (name, '%d', digits); -- convert this wiki's non-western digits to western digits
end
enum = name:match ('%d+$'); -- get parameter enumerator if it exists; nil else
if not enum then -- no enumerator so looking for non-enumnerated parameters
-- TODO: insert shortcut here? if params[name] then name holds the canonical parameter name; no need to search further
for pname, aliases in pairs (params) do -- loop through each parameter the params table
for _, alias in ipairs (aliases) do -- loop through each alias in the parameter's aliases table
if name == alias then
new_args[pname] = v; -- create a new entry in the new_args table
origin [pname] = k; -- create an entry to make canonical parameter name to original local language parameter name
found = true; -- flag so that we can break out of these nested for loops
break; -- no need to search the rest of the aliases table for name so go on to the next k, v pair
end
end
if found then -- true when we found an alias that matched name
found = false; -- reset the flag
break; -- go do next args k/v pair
end
end
else -- enumerated parameters
name = name:gsub ('%d$', '#'); -- replace enumeration digits with place holder for table search
-- TODO: insert shortcut here? if num_params[name] then name holds the canonical parameter name; no need to search further
for pname, aliases in pairs (enum_params) do -- loop through each parameter the num_params table
for _, alias in ipairs (aliases) do -- loop through each alias in the parameter's aliases table
if name == alias then
pname = pname:gsub ('#$', enum); -- replace the '#' place holder with the actual enumerator
new_args[pname] = v; -- create a new entry in the new_args table
origin [pname] = k; -- create an entry to make canonical parameter name to original local language parameter name
found = true; -- flag so that we can break out of these nested for loops
break; -- no need to search the rest of the aliases table for name so go on to the next k, v pair
end
end
if found then -- true when we found an alias that matched name
found = false; -- reset the flag
break; -- go do next args k/v pair
end
end
end
else
unnamed_params = true; -- flag for unsupported positional parameters
end
end -- for k, v
return new_args, origin, unnamed_params;
end
--[[--------------------------< W E B A R C H I V E >----------------------------------------------------------
template entry point
]]
local function webarchive(frame)
local args = getArgs (frame);
local data = mw.loadData (table.concat ({ -- make a data module name; sandbox or live
'Module:Webarchive/data',
frame:getTitle():find('sandbox', 1, true) and '/sandbox' or '' -- this instance is ./sandbox then append /sandbox
}));
categories = data.categories; -- fill in the forward declarations
config = data.config;
if data.digits.enable then
digits = data.digits; -- for i18n; table of digits in the local wiki's language
non_western_digits = true; -- use_non_western_digits
end
err_warn_msgs = data.err_warn_msgs;
excepted_pages = data.excepted_pages;
month_num = data.month_num; -- for i18n; table of month names in the local wiki's language
prefixes = data.prefixes;
services = data.services;
s_text = data.s_text;
uncategorized_namespaces = data.uncategorized_namespaces;
uncategorized_subpages = data.uncategorized_subpages;
local origin = {}; -- holds a map of English to local language parameter names used in the current template; not currently used
local unnamed_params; -- boolean set to true when template call has unnamed parameters
args, origin, unnamed_params = parameter_name_xlate (args, data.params, data.enum_params); -- translate parameter names in args to English
local date, format, msg, udate, uri, url;
local ldf = 'iso'; -- when there is no |date= parameter, render url dates in iso format
if args.url and args.url1 then -- URL argument (first)
return inlineError (data.crit_err_msgs.conflicting, {origin.url, origin.url1});
end
url = args.url or args.url1;
if not url then
return inlineError (data.crit_err_msgs.empty);
end
-- these iabot bugs perportedly fixed; removing these causes lua script error
--[[ -- at Template:Webarchive/testcases/Production; resolve that before deleting these tests
if mw.ustring.find( url, "https://web.http", 1, true ) then -- track bug - TODO: IAbot bug; not known if the bug has been fixed; deferred
track[categories.error] = 1;
return inlineError (data.crit_err_msgs.iabot1);
end
if url == "https://web.archive.org/http:/" then -- track bug - TODO: IAbot bug; not known if the bug has been fixed; deferred
track[categories.error] = 1;
return inlineError (data.crit_err_msgs.iabot2);
end
]]
if not (url:lower():find ('^http') or url:find ('^//')) then
return inlineError (data.crit_err_msgs.invalid_url );
end
ulx.url1 = {}
ulx.url1.url = url
ulx.url1.extraurls = parseExtraArgs(args)
local good = false;
good, uri = pcall (mw.uri.new, ulx.url1.url); -- get a table of uri parts from this url; protected mode to prevent lua error when ulx.url1.url is malformed
if not good or nil == uri.host then -- abandon when ulx.url1.url is malformed
return inlineError (data.crit_err_msgs.invalid_url);
end
serviceName(uri.host, args.nolink)
if args.date and args.date1 then -- Date argument
return inlineError (data.crit_err_msgs.conflicting, {origin.date, origin.date1});
end
date = args.date or args.date1;
date = date and date:gsub (' +', ' '); -- replace multiple spaces with a single space
if date and config.verifydates then
if '*' == date then
date = 'index';
ldf = 'iso'; -- set to default format
elseif 'mdy' == date then
date = nil; -- if date extracted from URL,
ldf = 'mdy'; -- then |date=mdy overrides iso
elseif 'dmy' == date then
date = nil; -- if date extracted from URL,
ldf = 'dmy'; -- then |date=dmy overrides iso
elseif 'ymd' == date then
date = nil; -- if date extracted from URL,
ldf = 'ymd'; -- then |date=ymd overrides iso
else
date, ldf = decode_date (date); -- get an iso format date from date and get date's original format
end
end
if 'wayback' == ulx.url1.service or 'locwebarchives' == ulx.url1.service or 'ukgwa' == ulx.url1.service then
if date then
if config.verifydates then
if ldf then
udate, msg = decodeWaybackDate (uri.path); -- get the url date in iso format and format of date in |date=; 'index' when wayback url date is *
if not udate then -- this is the only 'fatal' error return
return inlineError (data.crit_err_msgs[msg]);
end
if udate ~= date then -- date comparison using iso format dates
date = udate;
msg = table.concat ({
inlineRed (err_warn_msgs.mismatch, 'warning'), -- add warning message
msg, -- add message if there is one
});
end
end
end
else -- no |date=
udate, msg = decodeWaybackDate (uri.path);
if not udate then -- this is the only 'fatal' error return
return inlineError (data.crit_err_msgs[msg]);
end
if '' == udate then
date = nil; -- unset
else
date = udate;
end
end
elseif 'webcite' == ulx.url1.service then
if date then
if config.verifydates then
if ldf then
udate = decodeWebciteDate (uri.path); -- get the url date in iso format
if 'query' ~= udate then -- skip if query
if udate ~= date then -- date comparison using iso format dates
date = udate;
msg = table.concat ({
inlineRed (err_warn_msgs.mismatch, 'warning'),
});
end
end
end
end
else
date = decodeWebciteDate( uri.path, "iso" )
if date == "query" then
date = nil; -- unset
msg = inlineRed (err_warn_msgs.date_miss, 'warning');
elseif not date then -- invalid base62 string
date = inlineRed (err_warn_msgs.date1, 'error');
end
end
elseif 'archiveis' == ulx.url1.service then
if date then
if config.verifydates then
if ldf then
udate, msg = decodeArchiveisDate (uri.path) -- get the url date in iso format
if 'short link' ~= udate then -- skip if short link
if udate ~= date then -- date comparison using iso format dates
date = udate;
msg = table.concat ({
inlineRed (err_warn_msgs.mismatch, 'warning'), -- add warning message
msg, -- add message if there is one
});
end
end
end
end
else -- no |date=
udate, msg = decodeArchiveisDate( uri.path, "iso" )
if udate == "short link" then
date = nil; -- unset
msg = inlineRed (err_warn_msgs.date_miss, 'warning');
elseif '' == udate then
date = nil; -- unset
else
date = udate;
end
end
else -- some other service
if not date then
msg = inlineRed (err_warn_msgs.date_miss, 'warning');
end
end
if 'index' == date then
ulx.url1.date = date .. (msg or ''); -- create index + message (if there is one)
elseif date then
ulx.url1.date = makeDate (date, nil, nil, ldf) .. (msg or ''); -- create a date in the wiki's local language + message (if there is one)
else
ulx.url1.date = msg;
end
format = args.format; -- Format argument
if not format then
format = "none"
else
for k, v in pairs (data.format_vals) do -- |format= accepts two specific values loop through a table of those values
local found; -- declare a nil flag
for _, p in ipairs (v) do -- loop through local language variants
if format == p then -- when |format= value matches
format = k; -- use name from table key
found = true; -- declare found so that we can break out of outer for loop
break; -- break out of inner for loop
end
end
if found then
break;
end
end
if format == "addlpages" then
if not ulx.url1.date then
format = "none"
end
elseif format == "addlarchives" then
format = "addlarchives"
else
format = "none"
end
end
ulx.url1.format = format
if args.title and args.title1 then -- Title argument
return inlineError (data.crit_err_msgs.conflicting, {origin.title, origin.title1});
end
ulx.url1.title = args.title or args.title1;
local rend = createRendering()
if not rend then
return inlineError (data.crit_err_msgs.unknown);
end
return rend .. ((unnamed_params and inlineRed (err_warn_msgs.unnamed_params, 'warning')) or '') .. createTracking();
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {webarchive = webarchive};
509fpybw6991rhb29k46no643h4jgz2
Module:Webarchive/data
828
58440631
1088790286
1068211254
2022-05-20T04:09:18Z
GreenC
8931761
add ghost archive
Scribunto
text/plain
--[[--------------------------< C O N F I G U R A T I O N >----------------------------------------------------
global configuration settings
]]
local config = {
maxurls = 10, -- Max number of URLs allowed.
tname = 'Webarchive', -- name of calling template. Change if template rename.
verifydates = true, -- See documentation. Set false to disable.
}
--[[--------------------------< 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 that should not be included in citation error categories.
Note: Namespace names should use underscores instead of spaces.
]]
local uncategorized_namespaces = { -- same list as specified at [[Module:Citation/CS1/Configuration]]
['User']=true, ['Talk']=true, ['User_talk']=true, ['Wikipedia_talk']=true, ['File_talk']=true,
['Template_talk']=true, ['Help_talk']=true, ['Category_talk']=true, ['Portal_talk']=true,
['Book_talk']=true, ['Draft_talk']=true, ['Module_talk']=true,
['MediaWiki_talk']=true,
}
local uncategorized_subpages = {'/[Ss]andbox', '/[Tt]estcases'}; -- list of Lua patterns found in page names of pages we should not categorize
local excepted_pages = { -- these pages will be categorized if set true; set to nil to disable
['Module talk:Webarchive/testcases'] = true, -- test cases pages used during development
['Template:Webarchive/testcases/Production'] = true,
}
--[[--------------------------< C A T E G O R I E S >----------------------------------------------------------
this is a table of all categories supported by Module:Webarchive
]]
local categories = {
archiveis = 'Category:Webarchive template archiveis links',
error = 'Category:Webarchive template errors',
other = 'Category:Webarchive template other archives',
unknown = 'Category:Webarchive template unknown archives',
warning = 'Category:Webarchive template warnings',
wayback = 'Category:Webarchive template wayback links',
webcite = 'Category:Webarchive template webcite links',
}
--[[--------------------------< P R E F I X E S >--------------------------------------------------------------
used only with serviceName(), this table holds the two generic tail-text prefixes specified by services['<service name>'][1]
]]
local prefixes = {
at = 'at',
atthe = 'at the',
}
--[=[-------------------------< S E R V I C E S >--------------------------------------------------------------
this is a table of tables for archive services. Each service table has:
[1]=prefix; may be boolean true or false, or text string where:
true indicates that the prefix is taken from prefixes.atthe
false indicates that the prefix is taken from prefixes.at
'text string' is used in lieu of the typical 'at' or 'at the' prefix
[2]=wikilink target article that describes the service; set to nil if not used
[3]=wikilink label; the label in [[target|label]]; set to nil if not used; when there is not article ([2] is nil) use this to name the service; see wikiwix in the table
[4]=service ID; set to nil if not used
[5]=tracking category key from the categories table; set to nil if not used
[6]=postfix; text string to be appended at the end of the tail string - see webarchive.loc.gov in the table
]=]
local services = {
['archive.ec'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.fo'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.is'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.li'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.md'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.org'] = {true, 'Wayback Machine', nil, 'wayback', categories.wayback},
['archive.ph'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.today'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive.vn'] = {false, 'archive.today', nil, 'archiveis', categories.archiveis},
['archive-it.org'] = {false, 'Archive-It', nil, 'archiveit'},
['arquivo.pt'] = {true, nil, 'Portuguese Web Archive'},
['bibalex.org'] = {false, 'Bibliotheca Alexandrina#Internet Archive partnership', 'Bibliotheca Alexandrina'},
['collectionscanada'] = {true, 'Canadian Government Web Archive'},
['europarchive.org'] = {true, 'National Library of Ireland'},
['freezepage.com'] = {false, nil, 'Freezepage'},
['ghostarchive.org'] = {false, nil, 'Ghost Archive'},
['haw.nsk'] = {true, 'Croatian Web Archive (HAW)'},
['langzeitarchivierung.bib-bvb.de'] = {false, 'Bavarian State Library'},
['loc.gov'] = {true, 'Library of Congress'},
['nationalarchives.gov.uk'] = {true, 'UK Government Web Archive', nil, 'ukgwa'},
['nlb.gov.sg'] = {false, 'Web Archive Singapore'},
['parliament.uk'] = {true, 'UK Parliament\'s Web Archive'},
['perma.cc'] = {false, 'Perma.cc'},
['perma-archives.cc'] = {false, 'Perma.cc'},
['proni.gov'] = {true, 'Public Record Office of Northern Ireland'},
['screenshots.com'] = {false, nil, 'Screenshots'},
['stanford.edu'] = {true, 'Stanford University Libraries', 'Stanford Web Archive'},
['timetravel.mementoweb.org'] = {false, 'Memento Project'},
['uni-lj.si'] = {true, nil, 'Slovenian Web Archive'},
['veebiarhiiv.digar.ee'] = {true, nil, 'Estonian Web Archive'},
['vefsafn.is'] = {true, 'National and University Library of Iceland'},
['webarchive.bac-lac.gc.ca'] = {false, 'Library and Archives Canada'},
['webarchive.loc.gov'] = {true, 'Library of Congress', nil, 'locwebarchives', nil, 'Web Archives'},
['webarchive.nla.gov.au'] = {true, 'Australian Web Archive'},
['webarchive.org.uk'] = {true, 'UK Web Archive'},
['webcache.googleusercontent.com'] = {false, nil, 'Google Cache'},
['webcitation.org'] = {false, 'WebCite', nil, 'webcite', categories.webcite},
['webharvest.gov'] = {true, 'National Archives and Records Administration'},
['webrecorder.io'] = {false, 'webrecorder.io'},
['wikiwix.com'] = {false, nil, 'Wikiwix'},
['yorku.ca'] = {false, 'York University Libraries', 'York University Digital Library'},
}
--[[--------------------------< S T A T I C T E X T >--------------------------------------------------------
for internationalzation
]]
local s_text = {
addlarchives = 'Additional archives',
addlpages = 'Additional pages archived on', -- TODO why the there? replace with regular space?
Archive_index = 'Archive index',
Archived = 'Archived',
archived = 'archived',
archive = 'archive',
Page = 'Page',
}
--[[--------------------------< E R R _ W A R N _ M S G S >----------------------------------------------------
these tables hold error and warning message text
]]
local err_warn_msgs = {
date_err = '(Date error)', -- decodeWebciteDate, decodeWaybackDate, decodeArchiveisDate
date_miss = '(Date missing)', -- parseExtraArgs
ts_short = '(Timestamp date length)', -- decodeWaybackDate timestamp less than 8 digits
ts_date = '(Timestamp date invalid)', -- decodeWaybackDate timestamp not a valid date
unknown_url = '(Error: unknown archive URL)', -- serviceName
unnamed_params = '(Positional parameters ignored)',
--warnings
mismatch = '<sup>(Date mismatch)</sup>', -- webarchive
ts_len = '<sup>(Timestamp length)</sup>', -- decodeWaybackDate, decodeArchiveisDate timestamp not 14 digits
ts_cal = '<sup>(Calendar)</sup>', -- decodeWaybackDate timestamp has trailing splat
}
local crit_err_msgs = { -- critical error messages
conflicting = 'Conflicting |$1= and |$2=',
empty = 'Empty url',
-- iabot1 = 'https://web.http', -- TODO: these iabot bugs perportedly fixed; removing these causes lua script error
-- iabot2 = 'Invalid URL', -- at Template:Webarchive/testcases/Production; resolve that before deleting these messages
invalid_url = 'Invalid URL',
ts_nan = 'Timestamp not a number',
unknown = 'Unknown problem. Please report on template talk page',
}
--[[--------------------------< D A T E I N T E R N A T I O N A L I Z A T I O N >----------------------------
these tables hold data that is used when converting date formats from non-English languages (because mw.language.getContentLanguage:formatDate()
doesn't understand non-English month names)
]]
local month_num = { -- retain English language names even though they may not be strictly required on the local wiki
['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12,
['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12,
-- add local wiki month-names to number translation here
-- [''] = 1, [''] = 2, [''] = 3, [''] = 4, [''] = 5, [''] = 6, [''] = 7, [''] = 8, [''] = 9, [''] = 10, [''] = 11, [''] = 12,
};
-- when the local wiki uses non-western digits in dates, local wiki digits must be
-- translated to western digits; lua only understands western digits
local digits = { -- use this table to aid translation
-- [''] = 0, [''] = 1, [''] = 2, [''] = 3, [''] = 4, [''] = 5, [''] = 6, [''] = 7, [''] = 8, [''] = 9, -- fill these table indexes with local digits
enable = false -- set to true to enable local-digit to western-digit translation
};
--[[--------------------------< P A R A M E T E R I N T E R N A T I O N A L I Z A T I O N >------------------
this table holds tables of parameter names and their non-English aliases. In the enum_params table '#' is a single
character placeholder for 1 or more digit characters
parameter names in this table shall be lowercase
]]
local params = {
['url'] = {'url'},
['date'] = {'date', 'datum'},
['title'] = {'title', 'titel'},
['nolink'] = {'nolink'},
['format'] = {'format'}
}
local enum_params = {
['url#'] = {'url#'},
['date#'] = {'date#', 'datum#'},
['title#'] = {'title#', 'titel#'},
}
local format_vals = { -- |format= accepts two values; add local language variants here
['addlpages'] = {'addlpages'},
['addlarchives'] = {'addlarchives'},
}
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
categories = categories,
config = config,
crit_err_msgs = crit_err_msgs,
digits = digits,
enum_params = enum_params,
err_warn_msgs = err_warn_msgs,
excepted_pages = excepted_pages,
format_vals = format_vals,
month_num = month_num,
params = params,
prefixes = prefixes,
services = services,
s_text = s_text,
uncategorized_namespaces = uncategorized_namespaces,
uncategorized_subpages = uncategorized_subpages,
}
jf14rm1dib7bpwh1q20q3jf6p4gmikt
Module:Yesno
828
38665046
948473803
948472535
2020-04-01T06:27:55Z
MusikAnimal
14882394
Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
swdskn7svew8i9wuydn9uj5l3r2ghcs