<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.ooda.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Converti</id>
	<title>OODA WIKI - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.ooda.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Converti"/>
	<link rel="alternate" type="text/html" href="https://www.ooda.wiki/wiki/Special:Contributions/Converti"/>
	<updated>2026-04-06T23:28:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=OODA_loop&amp;diff=656</id>
		<title>OODA loop</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=OODA_loop&amp;diff=656"/>
		<updated>2025-08-15T06:43:25Z</updated>

		<summary type="html">&lt;p&gt;Converti: Manual edit: Converted passive voice to active with the Scribal Assistant.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{short description|Observe–orient–decide–act cycle}}&lt;br /&gt;
{{redirect|Ooda|the Japanese city|Ōda, Shimane}}&lt;br /&gt;
{{Use dmy dates|date=August 2021}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;OODA loop&#039;&#039;&#039; (observe, orient, decide, act) is a decision-making model developed by  [[United States Air Force]] Colonel [[John Boyd (military strategist)|John Boyd]]. He applied the concept to the [[combat operations process]], often at the operational level during military campaigns. Analysts often apply the model to understand commercial operations and learning processes. The approach explains how agility can overcome raw power in dealing with human opponents.&lt;br /&gt;
&lt;br /&gt;
==The OODA loop==&lt;br /&gt;
As can be seen from the diagram, the OODA loop includes continuous collection of feedback and observations. This enables late commitment, which is an important element of agility. This is in contrast to the [[PDCA]] (plan–do–check–act) cycle which requires early commitment.&lt;br /&gt;
&lt;br /&gt;
==Use in law and business==&lt;br /&gt;
The OODA loop has become an important concept in [[litigation strategy|litigation]],{{sfn|Dreier|2012|pp=20–85}} business,{{sfn|Richards|2004|pp=162–171}} [[law enforcement]],&amp;lt;ref&amp;gt;{{cite web |last1=Papenfuhs |first1=Steve (Pappy) |title=The OODA loop, reaction time, and decision making |date=15 February 2012 |url=https://www.police1.com/use-of-force/articles/the-ooda-loop-reaction-time-and-decision-making-fEOcXtsXFutU07cY/ |publisher=PoliceOne.com |archive-url=https://web.archive.org/web/20210125183753/https://www.police1.com/use-of-force/articles/the-ooda-loop-reaction-time-and-decision-making-fEOcXtsXFutU07cY/ |access-date=3 November 2016 |archive-date=25 January 2021 }}&amp;lt;/ref&amp;gt; management education,&amp;lt;ref&amp;gt;{{cite journal |last1=Ryder |first1=Mike |last2=Downs |first2=Carolyn |title=Rethinking reflective practice: John Boyd&#039;s OODA loop as an alternative to Kolb |journal=The International Journal of Management Education |date=November 2022 |volume=20 |issue=3 |page=100703 |doi=10.1016/j.ijme.2022.100703 |doi-access=free }}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite book |last1=Ryder |first1=Mike |editor1-last=Wall |editor1-first=Tony |editor2-last=Trevisan |editor2-first=Laís Viera |editor3-last=Filho |editor3-first=Walter Leal |editor4-last=Shore |editor4-first=Adam |title=Sustainability in Business Education, Research and Practices |date=2024 |publisher=Springer |isbn=978-3-031-55995-2 |pages=77–89 |chapter-url=https://link.springer.com/chapter/10.1007/978-3-031-55996-9_6 |chapter=Using OODA Loops to Build Sustainable Practice into Business Education|series=World Sustainability Series |doi=10.1007/978-3-031-55996-9_6 }}&amp;lt;/ref&amp;gt; [[military strategy]] and [[Computer security|cyber security]], and [[cyberwarfare]].&amp;lt;ref&amp;gt;{{Cite book|title=The Fifth Domain: Defending Our Country, Our Companies, and Ourselves in the Age of Cyber Threats|last=Clarke|first=Richard|publisher=Penguin Press|year=2019|isbn=978-0525561965|pages=81}}&amp;lt;/ref&amp;gt; According to Boyd, [[decision-making]] occurs in an iterative cycle of &amp;quot;observe, orient, decide, act&amp;quot;. An entity (whether an individual or an organization) that can process this cycle quickly, observing and reacting to unfolding events more rapidly and/or more effectively than an opponent, can thereby get inside the opponent&#039;s decision cycle and gain the advantage.&lt;br /&gt;
&lt;br /&gt;
[[Jamie Dimon]], chairman and CEO of [[JPMorgan Chase]], has said he uses the OODA loop in scenario evaluation.&amp;lt;ref&amp;gt;{{Cite web|url=https://fortune.com/2024/04/09/jamie-dimon-jpmorgan-military-leadership-tactic-ooda-loop/|title=Jamie Dimon says he runs JPMorgan with a military tactic in mind named the &#039;OODA loop&#039;|first=Eleanor|last=Pringle|website=Fortune|date=4 April 2024}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite web|url=https://fortune.com/2024/10/29/jamie-dimon-world-war-three-fears-nuclear-proliferation/|title=Jamie Dimon says World War III may have already begun|first=Eleanor|last=Pringle|website=Fortune|date=29 October 2024}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite web|url=https://www.jpmorganchase.com/ir/annual-report/2023/ar-ceo-letters#management-lessons|title=Jamie Dimon&#039;s Letter to Shareholders, Annual Report 2023 &amp;amp;#124; JPMorganChase|website=www.jpmorganchase.com}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Criticism==&lt;br /&gt;
Some scholars are critical of the concept. Aviation historian Michael Hankins, for example, writes that &amp;quot;the OODA loop is vague enough that its defenders and attackers can each see what they want to see in it. For some, the OODA concept&#039;s flexibility is its strength, but for others it becomes so generalized as to lose its usefulness.&amp;quot; He concludes that &amp;quot;The OODA loop is merely one way among a myriad of ways of describing intuitive processes of learning and decision making that most people experience daily. It is not incorrect, but neither is it unique or especially profound.&amp;quot;&amp;lt;ref&amp;gt;{{cite book |first=Michael W. |last=Hankins |title=Flying Camelot: The F-15, the F-16, and the Weaponization of Fighter Pilot Nostalgia |series=Battlegrounds: Cornell Studies in Military History |location=Ithaca, NY |publisher=Cornell University Press |date=2021 |pages=134–135 |isbn=9781501760655 |oclc=1245345653}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{div col|colwidth=30em}}&lt;br /&gt;
* [[Decision cycle]]&lt;br /&gt;
* [[Double-loop learning]]&lt;br /&gt;
* [[Feedback loop]]&lt;br /&gt;
* Improvement cycle&lt;br /&gt;
** [[DMAIC]]&lt;br /&gt;
** [[PDCA]]&lt;br /&gt;
* [[Learning cycle]]&lt;br /&gt;
* [[Maneuver warfare]]&lt;br /&gt;
* [[Mental model]]&lt;br /&gt;
* [[Nursing process]]&lt;br /&gt;
* [[Problem solving]]&lt;br /&gt;
* [[Situation awareness]]&lt;br /&gt;
* [[SWOT analysis]]&lt;br /&gt;
* [[United States Army Strategist]]&lt;br /&gt;
{{div col end}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
===Bibliography===&lt;br /&gt;
* {{cite journal |last=Bazin |first=Aaron A. |date=January–February 2005 |title=Boyd&#039;s O-O-D-A loop and the infantry company commander |journal=[[Infantry (magazine)|Infantry]] |volume=94 |issue=1 |pages=17–19 |id={{ProQuest|219733932}} |url=https://d-n-i.net/fcs/pdf/bazin_ooda.pdf}}&lt;br /&gt;
* {{cite book |last = Boyd |first = John R. |url = https://upload.wikimedia.org/wikipedia/commons/a/a6/Destruction_%26_Creation.pdf |title = Destruction and Creation |publisher = U.S. Army Command and General Staff College |date = 3 September 1976}}&lt;br /&gt;
* {{cite web |last=Boyd |first=John, R. |date=28 June 1995 |title=The Essence of Winning and Losing |url=https://danford.net/boyd/essence.htm |website=danford.net}} A supposed five-slide set by Boyd.&lt;br /&gt;
* {{cite book |last=Dreier |first=A. S. |title=Strategy, Planning &amp;amp; Litigating to Win: Orchestrating Trial Outcomes with Systems Theory, Psychology, Military Science, and Utility Theory |date=2012 |location=Boston, MA |publisher=Conatus Press |isbn=978-0615676951 |oclc=917563752}}&lt;br /&gt;
* {{cite web |last=Greene |first=Robert |author-link=Robert Greene (American author) |date=24 February 2007 |title=OODA and You |url=https://powerseductionandwar.com/ooda-and-you/ |website=powerseductionandwar.com}}&lt;br /&gt;
* {{cite magazine |last=Hillaker |first=Harry |author-link=Harry Hillaker |date=July 1997 |title=Tribute To John R. Boyd |magazine=Code One Magazine |url=https://www.codeonemagazine.com/article.html?item_id=156 |archive-url=https://web.archive.org/web/20070917232626/http://www.codeonemagazine.com/archives/1997/articles/jul_97/july2a_97.html |archive-date=2007-09-17 |url-status=live}}&lt;br /&gt;
* {{cite book |last=Osinga |first=Frans P. B. |date=2007 |orig-year=2005 |title=Science, strategy and war: the strategic theory of John Boyd |series=Strategy and history |volume=18 |location=London |publisher=Routledge |isbn=978-0415371032 |oclc=67773991 |doi=10.4324/9780203088869}} [http://www.projectwhitehorse.com/pdfs/ScienceStrategyWar_Osinga.pdf PDF of the dissertation version].&lt;br /&gt;
* {{cite book |last1=Owen |first1=Jillian |last2=Burstein |first2=Frada |last3=Hall |first3=William P. |date=2004 |chapter=Knowledge reuse in project management |editor1-last=Linger |editor1-first=Henry |editor2-last=Fisher |editor2-first=Julie |editor3-last=Wojtkowski |editor3-first=Wita |editor4-last=Wojtkowski |editor4-first=W. Gregory |editor5-last=Zupančič |editor5-first=Jože |editor6-last=Vigo |editor6-first=Kitty |editor7-last=Arnold |editor7-first=Josie |title=Constructing the Infrastructure for the Knowledge Economy: Methods and Tools, Theory and Structure |location=New York |publisher=Kluwer Academic/Plenum Publishers |pages=443–454 |isbn=0306485540 |oclc=55877281 |doi=10.1007/978-1-4757-4852-9_33}}&lt;br /&gt;
* {{cite book |last=Richards |first=Chet |date=2004 |title=Certain to Win: The Strategy of John Boyd, Applied to Business |location=Philadelphia |publisher=[[Xlibris]] |isbn=1413453775 |oclc=57207751}}&lt;br /&gt;
* {{cite web |last=Schuck |first=Tod |date=11 May 2017 |title=OODA Loop 2.0: Information, Not Agility, Is Life |url=https://breakingdefense.com/2017/05/ooda-loop-2-0-information-not-agility-is-life/ |website=Breaking Defense}}&lt;br /&gt;
* {{cite journal |last=Ullman |first=David G. |date=April 2007 |title=&#039;OO-OO-OO!&#039;: the sound of a broken OODA loop |journal=CrossTalk: The Journal of Defense Software Engineering |volume=20 |issue=4 |pages=22–25 |citeseerx=10.1.1.170.5341 |url=http://crosstalkonline.org/storage/issue-archives/2007/200704/200704-Ullman.pdf |archive-url=https://web.archive.org/web/20120728010539/http://crosstalkonline.org/storage/issue-archives/2007/200704/200704-Ullman.pdf |archive-date=2012-07-28}}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://danford.net/boyd/ The John Boyd Library] (archived documents by Boyd)&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Ooda Loop}}&lt;br /&gt;
[[Category:Feedback]]&lt;br /&gt;
[[Category:Intelligence analysis]]&lt;br /&gt;
[[Category:Strategy]]&lt;br /&gt;
[[Category:Systems analysis]]&lt;br /&gt;
[[Category:United States Air Force]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Converti_(AetherOS)&amp;diff=655</id>
		<title>Converti (AetherOS)</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Converti_(AetherOS)&amp;diff=655"/>
		<updated>2025-08-15T06:37:29Z</updated>

		<summary type="html">&lt;p&gt;Converti: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{AetherOS_Component}}&lt;br /&gt;
&#039;&#039;&#039;Converti&#039;&#039;&#039; is a command-line utility suite designed to manage the lifecycle of templates and modules within the AetherOS ecosystem. It serves as the primary toolkit for the [[Collegium (AetherOS)]], enabling the analysis, controlled importation, and quality assurance of the wiki&#039;s structural components.&lt;br /&gt;
&lt;br /&gt;
The tool was developed by [[User:Isidore Lands|Isidore Lands]] and [[User:Silas Corvus|Silas Corvus]].&lt;br /&gt;
&lt;br /&gt;
== Purpose in Symbiotic Learning ==&lt;br /&gt;
The core purpose of Converti is to ensure the structural integrity and maneuverability of the wiki&#039;s knowledge base. A lean, well-documented, and minimally dependent codebase is essential for the symbiotic learning between users and their [[Wingman AI|Wingman AIs]].&lt;br /&gt;
&lt;br /&gt;
By providing tools to analyze and gracefully import components, Converti prevents &amp;quot;dependency hell&amp;quot; and ensures the wiki does not become cluttered with the unmanaged complexity of its source wikis.&lt;br /&gt;
&lt;br /&gt;
== The Converti Toolkit ==&lt;br /&gt;
Converti is comprised of a single command-line interface (main.py) that provides several commands, each serving a specific function in the Collegium&#039;s review process.&lt;br /&gt;
&lt;br /&gt;
=== Stage 1: Map Dependencies ===&lt;br /&gt;
The first step is to map the full dependency tree of a set of root templates from a source wiki (like Wikipedia) to a named JSON file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;map command&#039;&#039;&#039;: Scans a list of templates on a specified source wiki (--source-family) and recursively maps every sub-template and Lua module they depend on. The result is saved to a specified output file (--output).&lt;br /&gt;
&lt;br /&gt;
=== Stage 2: Audit &amp;amp; Analyze ===&lt;br /&gt;
The second step is to analyze the generated dependency map to assess its technical debt.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;audit command&#039;&#039;&#039;: Ingests a dependency map (--map-file) and generates a human-readable report (dependency_report.txt) and an interactive graph (dependency_graph.html). This command calculates a &#039;&#039;&#039;[[Wiki Maneuverability Score]]&#039;&#039;&#039; for each component based on its complexity, dependency count, and documentation quality, highlighting the most foundational and complex pages.&lt;br /&gt;
&lt;br /&gt;
=== Stage 3: Deploy to Wiki ===&lt;br /&gt;
After the Collegium has reviewed the analysis and created a curated approved_list.txt, this command imports only the necessary components to the target wiki.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;deploy command&#039;&#039;&#039;: Reads the approved list and a dependency map. It then resolves the full dependency tree and surgically imports only the required pages from the source wiki to the target (ooda.wiki), skipping any that already exist. A --dry-run flag allows for simulating the deployment without making any edits.&lt;br /&gt;
&lt;br /&gt;
== Future Development ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;refactor command&#039;&#039;&#039;: (Under Development) An assistant that uses an LLM to review low-scoring templates and suggest simplifications or alternative implementations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Active Voice Assistant&#039;&#039;&#039;: An on-wiki tool to help editors convert passive voice to active voice, further improving the clarity and readability of the knowledge base.&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Template_other&amp;diff=654</id>
		<title>Template:Template other</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Template_other&amp;diff=654"/>
		<updated>2025-08-15T06:29:40Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#switch:&lt;br /&gt;
  &amp;lt;!--If no or empty &amp;quot;demospace&amp;quot; parameter then detect namespace--&amp;gt;&lt;br /&gt;
  {{#if:{{{demospace|}}}&lt;br /&gt;
  | {{lc: {{{demospace}}} }}    &amp;lt;!--Use lower case &amp;quot;demospace&amp;quot;--&amp;gt;&lt;br /&gt;
  | {{#ifeq:{{NAMESPACE}}|{{ns:Template}}&lt;br /&gt;
    | template&lt;br /&gt;
    | other&lt;br /&gt;
    }}&lt;br /&gt;
  }}&lt;br /&gt;
| template = {{{1|}}}&lt;br /&gt;
| other&lt;br /&gt;
| #default = {{{2|}}}&lt;br /&gt;
}}&amp;lt;!--End switch--&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Add categories and interwikis to the /doc subpage, not here! --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Str_left&amp;diff=653</id>
		<title>Template:Str left</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Str_left&amp;diff=653"/>
		<updated>2025-08-15T06:29:29Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{safesubst:padleft:|{{{2|1}}}|{{{1}}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:SUBPAGENAME&amp;diff=652</id>
		<title>Template:SUBPAGENAME</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:SUBPAGENAME&amp;diff=652"/>
		<updated>2025-08-15T06:29:19Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&amp;lt;includeonly&amp;gt;safesubst:&amp;lt;/includeonly&amp;gt;SUBPAGENAME:{{{1|}}}}}&amp;lt;includeonly&amp;gt;[[Category:Pages which use a template in place of a magic word|K{{PAGENAME}}]]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Remove_first_word&amp;diff=651</id>
		<title>Template:Remove first word</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Remove_first_word&amp;diff=651"/>
		<updated>2025-08-15T06:29:09Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&amp;lt;includeonly&amp;gt;safesubst:&amp;lt;/includeonly&amp;gt;#invoke:String|replace|source={{{1}}}|pattern=^[^{{{sep|%s}}}]*{{{sep|%s}}}*|replace=|plain=false}}&amp;lt;noinclude&amp;gt;{{Documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:PAGENAME&amp;diff=650</id>
		<title>Template:PAGENAME</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:PAGENAME&amp;diff=650"/>
		<updated>2025-08-15T06:28:59Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#if:{{{1|}}}|{{PAGENAME:{{{1|}}}}}|{{PAGENAME}}}}&amp;lt;includeonly&amp;gt;[[Category:Pages which use a template in place of a magic word|H{{PAGENAME}}]]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Ombox&amp;diff=649</id>
		<title>Template:Ombox</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Ombox&amp;diff=649"/>
		<updated>2025-08-15T06:28:49Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Message box|ombox}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:NAMESPACE&amp;diff=648</id>
		<title>Template:NAMESPACE</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:NAMESPACE&amp;diff=648"/>
		<updated>2025-08-15T06:28:39Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect[[Template:Namespace]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Ambox/category&amp;diff=647</id>
		<title>Template:Ambox/category</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Ambox/category&amp;diff=647"/>
		<updated>2025-08-15T06:28:29Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{pp-template|small=yes}}&amp;lt;/noinclude&amp;gt;{{#if:{{{cat|}}}&lt;br /&gt;
 |{{#if:{{{date|}}}&lt;br /&gt;
  |[[Category:{{{cat}}} {{{preposition|from}}} {{{date}}}]]{{#ifexist:Category:{{{cat}}} {{{preposition|from}}} {{{date}}}|&lt;br /&gt;
   |[[Category:Articles with invalid date parameter in template]]&lt;br /&gt;
  }}&lt;br /&gt;
  |[[Category:{{{cat}}}]]&lt;br /&gt;
 }}&lt;br /&gt;
}}{{#if:{{{all|}}}&lt;br /&gt;
 |[[Category:{{{all}}}]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Ambox&amp;diff=646</id>
		<title>Template:Ambox</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Ambox&amp;diff=646"/>
		<updated>2025-08-15T06:25:51Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Message box|ambox}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Message_box&amp;diff=645</id>
		<title>Module:Message box</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Message_box&amp;diff=645"/>
		<updated>2025-08-15T06:25:41Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install from &amp;#039;wikipedia:en&amp;#039; via Converti SDK.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require(&#039;strict&#039;)&lt;br /&gt;
local getArgs&lt;br /&gt;
local yesno = require(&#039;Module:Yesno&#039;)&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
local CONFIG_MODULE = &#039;Module:Message box/configuration&#039;&lt;br /&gt;
local DEMOSPACES = {talk = &#039;tmbox&#039;, image = &#039;imbox&#039;, file = &#039;imbox&#039;, category = &#039;cmbox&#039;, article = &#039;ambox&#039;, main = &#039;ambox&#039;}&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Helper functions&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local function getTitleObject(...)&lt;br /&gt;
	-- Get the title object, passing the function through pcall&lt;br /&gt;
	-- in case we are over the expensive function count limit.&lt;br /&gt;
	local success, title = pcall(mw.title.new, ...)&lt;br /&gt;
	if success then&lt;br /&gt;
		return title&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function union(t1, t2)&lt;br /&gt;
	-- Returns the union of two arrays.&lt;br /&gt;
	local vals = {}&lt;br /&gt;
	for i, v in ipairs(t1) do&lt;br /&gt;
		vals[v] = true&lt;br /&gt;
	end&lt;br /&gt;
	for i, v in ipairs(t2) do&lt;br /&gt;
		vals[v] = true&lt;br /&gt;
	end&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for k in pairs(vals) do&lt;br /&gt;
		table.insert(ret, k)&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(ret)&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getArgNums(args, prefix)&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		local num = mw.ustring.match(tostring(k), &#039;^&#039; .. prefix .. &#039;([1-9]%d*)$&#039;)&lt;br /&gt;
		if num then&lt;br /&gt;
			table.insert(nums, tonumber(num))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(nums)&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Box class definition&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local MessageBox = {}&lt;br /&gt;
MessageBox.__index = MessageBox&lt;br /&gt;
&lt;br /&gt;
function MessageBox.new(boxType, args, cfg)&lt;br /&gt;
	args = args or {}&lt;br /&gt;
	local obj = {}&lt;br /&gt;
&lt;br /&gt;
	-- Set the title object and the namespace.&lt;br /&gt;
	obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()&lt;br /&gt;
&lt;br /&gt;
	-- Set the config for our box type.&lt;br /&gt;
	obj.cfg = cfg[boxType]&lt;br /&gt;
	if not obj.cfg then&lt;br /&gt;
		local ns = obj.title.namespace&lt;br /&gt;
		-- boxType is &amp;quot;mbox&amp;quot; or invalid input&lt;br /&gt;
		if args.demospace and args.demospace ~= &#039;&#039; then&lt;br /&gt;
			-- implement demospace parameter of mbox&lt;br /&gt;
			local demospace = string.lower(args.demospace)&lt;br /&gt;
			if DEMOSPACES[demospace] then&lt;br /&gt;
				-- use template from DEMOSPACES&lt;br /&gt;
				obj.cfg = cfg[DEMOSPACES[demospace]]&lt;br /&gt;
			elseif string.find( demospace, &#039;talk&#039; ) then&lt;br /&gt;
				-- demo as a talk page&lt;br /&gt;
				obj.cfg = cfg.tmbox&lt;br /&gt;
			else&lt;br /&gt;
				-- default to ombox&lt;br /&gt;
				obj.cfg = cfg.ombox&lt;br /&gt;
			end&lt;br /&gt;
		elseif ns == 0 then&lt;br /&gt;
			obj.cfg = cfg.ambox -- main namespace&lt;br /&gt;
		elseif ns == 6 then&lt;br /&gt;
			obj.cfg = cfg.imbox -- file namespace&lt;br /&gt;
		elseif ns == 14 then&lt;br /&gt;
			obj.cfg = cfg.cmbox -- category namespace&lt;br /&gt;
		else&lt;br /&gt;
			local nsTable = mw.site.namespaces[ns]&lt;br /&gt;
			if nsTable and nsTable.isTalk then&lt;br /&gt;
				obj.cfg = cfg.tmbox -- any talk namespace&lt;br /&gt;
			else&lt;br /&gt;
				obj.cfg = cfg.ombox -- other namespaces or invalid input&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set the arguments, and remove all blank arguments except for the ones&lt;br /&gt;
	-- listed in cfg.allowBlankParams.&lt;br /&gt;
	do&lt;br /&gt;
		local newArgs = {}&lt;br /&gt;
		for k, v in pairs(args) do&lt;br /&gt;
			if v ~= &#039;&#039; then&lt;br /&gt;
				newArgs[k] = v&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for i, param in ipairs(obj.cfg.allowBlankParams or {}) do&lt;br /&gt;
			newArgs[param] = args[param]&lt;br /&gt;
		end&lt;br /&gt;
		obj.args = newArgs&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Define internal data structure.&lt;br /&gt;
	obj.categories = {}&lt;br /&gt;
	obj.classes = {}&lt;br /&gt;
	-- For lazy loading of [[Module:Category handler]].&lt;br /&gt;
	obj.hasCategories = false&lt;br /&gt;
&lt;br /&gt;
	return setmetatable(obj, MessageBox)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:addCat(ns, cat, sort)&lt;br /&gt;
	if not cat then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	if sort then&lt;br /&gt;
		cat = string.format(&#039;[[Category:%s|%s]]&#039;, cat, sort)&lt;br /&gt;
	else&lt;br /&gt;
		cat = string.format(&#039;[[Category:%s]]&#039;, cat)&lt;br /&gt;
	end&lt;br /&gt;
	self.hasCategories = true&lt;br /&gt;
	self.categories[ns] = self.categories[ns] or {}&lt;br /&gt;
	table.insert(self.categories[ns], cat)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:addClass(class)&lt;br /&gt;
	if not class then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	table.insert(self.classes, class)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:setParameters()&lt;br /&gt;
	local args = self.args&lt;br /&gt;
	local cfg = self.cfg&lt;br /&gt;
&lt;br /&gt;
	-- Get type data.&lt;br /&gt;
	self.type = args.type&lt;br /&gt;
	local typeData = cfg.types[self.type]&lt;br /&gt;
	self.invalidTypeError = cfg.showInvalidTypeError&lt;br /&gt;
		and self.type&lt;br /&gt;
		and not typeData&lt;br /&gt;
	typeData = typeData or cfg.types[cfg.default]&lt;br /&gt;
	self.typeClass = typeData.class&lt;br /&gt;
	self.typeImage = typeData.image&lt;br /&gt;
	self.typeImageNeedsLink = typeData.imageNeedsLink&lt;br /&gt;
&lt;br /&gt;
	-- Find if the box has been wrongly substituted.&lt;br /&gt;
	self.isSubstituted = cfg.substCheck and args.subst == &#039;SUBST&#039;&lt;br /&gt;
&lt;br /&gt;
	-- Find whether we are using a small message box.&lt;br /&gt;
	self.isSmall = cfg.allowSmall and (&lt;br /&gt;
		cfg.smallParam and args.small == cfg.smallParam&lt;br /&gt;
		or not cfg.smallParam and yesno(args.small)&lt;br /&gt;
	)&lt;br /&gt;
&lt;br /&gt;
	-- Add attributes, classes and styles.&lt;br /&gt;
	self.id = args.id&lt;br /&gt;
	self.name = args.name&lt;br /&gt;
	if self.name then&lt;br /&gt;
		self:addClass(&#039;box-&#039; .. string.gsub(self.name,&#039; &#039;,&#039;_&#039;))&lt;br /&gt;
	end&lt;br /&gt;
	if yesno(args.plainlinks) ~= false then&lt;br /&gt;
		self:addClass(&#039;plainlinks&#039;)&lt;br /&gt;
	end&lt;br /&gt;
	for _, class in ipairs(cfg.classes or {}) do&lt;br /&gt;
		self:addClass(class)&lt;br /&gt;
	end&lt;br /&gt;
	if self.isSmall then&lt;br /&gt;
		self:addClass(cfg.smallClass or &#039;mbox-small&#039;)&lt;br /&gt;
	end&lt;br /&gt;
	self:addClass(self.typeClass)&lt;br /&gt;
	self:addClass(args.class)&lt;br /&gt;
	self.style = args.style&lt;br /&gt;
	self.attrs = args.attrs&lt;br /&gt;
&lt;br /&gt;
	-- Set text style.&lt;br /&gt;
	self.textstyle = args.textstyle&lt;br /&gt;
	&lt;br /&gt;
	-- Set image classes.&lt;br /&gt;
	self.imageRightClass = args.imagerightclass or args.imageclass&lt;br /&gt;
	self.imageLeftClass = args.imageleftclass or args.imageclass&lt;br /&gt;
&lt;br /&gt;
	-- Find if we are on the template page or not. This functionality is only&lt;br /&gt;
	-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory&lt;br /&gt;
	-- and cfg.templateCategoryRequireName are set.&lt;br /&gt;
	self.useCollapsibleTextFields = cfg.useCollapsibleTextFields&lt;br /&gt;
	if self.useCollapsibleTextFields&lt;br /&gt;
		or cfg.templateCategory&lt;br /&gt;
		and cfg.templateCategoryRequireName&lt;br /&gt;
	then&lt;br /&gt;
		if self.name then&lt;br /&gt;
			local templateName = mw.ustring.match(&lt;br /&gt;
				self.name,&lt;br /&gt;
				&#039;^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$&#039;&lt;br /&gt;
			) or self.name&lt;br /&gt;
			templateName = &#039;Template:&#039; .. templateName&lt;br /&gt;
			self.templateTitle = getTitleObject(templateName)&lt;br /&gt;
		end&lt;br /&gt;
		self.isTemplatePage = self.templateTitle&lt;br /&gt;
			and mw.title.equals(self.title, self.templateTitle)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Process data for collapsible text fields. At the moment these are only&lt;br /&gt;
	-- used in {{ambox}}.&lt;br /&gt;
	if self.useCollapsibleTextFields then&lt;br /&gt;
		-- Get the self.issue value.&lt;br /&gt;
		if self.isSmall and args.smalltext then&lt;br /&gt;
			self.issue = args.smalltext&lt;br /&gt;
		else&lt;br /&gt;
			local sect&lt;br /&gt;
			if args.sect == &#039;&#039; then&lt;br /&gt;
				sect = &#039;This &#039; .. (cfg.sectionDefault or &#039;page&#039;)&lt;br /&gt;
			elseif type(args.sect) == &#039;string&#039; then&lt;br /&gt;
				sect = &#039;This &#039; .. args.sect&lt;br /&gt;
			end&lt;br /&gt;
			local issue = args.issue&lt;br /&gt;
			issue = type(issue) == &#039;string&#039; and issue ~= &#039;&#039; and issue or nil&lt;br /&gt;
			local text = args.text&lt;br /&gt;
			text = type(text) == &#039;string&#039; and text or nil&lt;br /&gt;
			local issues = {}&lt;br /&gt;
			table.insert(issues, sect)&lt;br /&gt;
			table.insert(issues, issue)&lt;br /&gt;
			table.insert(issues, text)&lt;br /&gt;
			self.issue = table.concat(issues, &#039; &#039;)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Get the self.talk value.&lt;br /&gt;
		local talk = args.talk&lt;br /&gt;
		-- Show talk links on the template page or template subpages if the talk&lt;br /&gt;
		-- parameter is blank.&lt;br /&gt;
		if talk == &#039;&#039;&lt;br /&gt;
			and self.templateTitle&lt;br /&gt;
			and (&lt;br /&gt;
				mw.title.equals(self.templateTitle, self.title)&lt;br /&gt;
				or self.title:isSubpageOf(self.templateTitle)&lt;br /&gt;
			)&lt;br /&gt;
		then&lt;br /&gt;
			talk = &#039;#&#039;&lt;br /&gt;
		elseif talk == &#039;&#039; then&lt;br /&gt;
			talk = nil&lt;br /&gt;
		end&lt;br /&gt;
		if talk then&lt;br /&gt;
			-- If the talk value is a talk page, make a link to that page. Else&lt;br /&gt;
			-- assume that it&#039;s a section heading, and make a link to the talk&lt;br /&gt;
			-- page of the current page with that section heading.&lt;br /&gt;
			local talkTitle = getTitleObject(talk)&lt;br /&gt;
			local talkArgIsTalkPage = true&lt;br /&gt;
			if not talkTitle or not talkTitle.isTalkPage then&lt;br /&gt;
				talkArgIsTalkPage = false&lt;br /&gt;
				talkTitle = getTitleObject(&lt;br /&gt;
					self.title.text,&lt;br /&gt;
					mw.site.namespaces[self.title.namespace].talk.id&lt;br /&gt;
				)&lt;br /&gt;
			end&lt;br /&gt;
			if talkTitle and talkTitle.exists then&lt;br /&gt;
                local talkText&lt;br /&gt;
                if self.isSmall then&lt;br /&gt;
                    local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. (talk == &#039;#&#039; and &#039;&#039; or &#039;#&#039;) .. talk)&lt;br /&gt;
                    talkText = string.format(&#039;([[%s|talk]])&#039;, talkLink)&lt;br /&gt;
                else&lt;br /&gt;
                    talkText = &#039;Relevant discussion may be found on&#039;&lt;br /&gt;
                    if talkArgIsTalkPage then&lt;br /&gt;
                        talkText = string.format(&lt;br /&gt;
                            &#039;%s [[%s|%s]].&#039;,&lt;br /&gt;
                            talkText,&lt;br /&gt;
                            talk,&lt;br /&gt;
                            talkTitle.prefixedText&lt;br /&gt;
                        )&lt;br /&gt;
                    else&lt;br /&gt;
                        talkText = string.format(&lt;br /&gt;
                            &#039;%s the [[%s&#039; .. (talk == &#039;#&#039; and &#039;&#039; or &#039;#&#039;) .. &#039;%s|talk page]].&#039;,&lt;br /&gt;
                            talkText,&lt;br /&gt;
                            talkTitle.prefixedText,&lt;br /&gt;
                            talk&lt;br /&gt;
                        )&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
				self.talk = talkText&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Get other values.&lt;br /&gt;
		self.fix = args.fix ~= &#039;&#039; and args.fix or nil&lt;br /&gt;
		local date&lt;br /&gt;
		if args.date and args.date ~= &#039;&#039; then&lt;br /&gt;
			date = args.date&lt;br /&gt;
		elseif args.date == &#039;&#039; and self.isTemplatePage then&lt;br /&gt;
			date = lang:formatDate(&#039;F Y&#039;)&lt;br /&gt;
		end&lt;br /&gt;
		if date then&lt;br /&gt;
			self.date = string.format(&amp;quot; &amp;lt;span class=&#039;date-container&#039;&amp;gt;&amp;lt;i&amp;gt;(&amp;lt;span class=&#039;date&#039;&amp;gt;%s&amp;lt;/span&amp;gt;)&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;, date)&lt;br /&gt;
		end&lt;br /&gt;
		self.info = args.info&lt;br /&gt;
		if yesno(args.removalnotice) then&lt;br /&gt;
			self.removalNotice = cfg.removalNotice&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set the non-collapsible text field. At the moment this is used by all box&lt;br /&gt;
	-- types other than ambox, and also by ambox when small=yes.&lt;br /&gt;
	if self.isSmall then&lt;br /&gt;
		self.text = args.smalltext or args.text&lt;br /&gt;
	else&lt;br /&gt;
		self.text = args.text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set the below row.&lt;br /&gt;
	self.below = cfg.below and args.below&lt;br /&gt;
&lt;br /&gt;
	-- General image settings.&lt;br /&gt;
	self.imageCellDiv = not self.isSmall and cfg.imageCellDiv&lt;br /&gt;
	self.imageEmptyCell = cfg.imageEmptyCell&lt;br /&gt;
&lt;br /&gt;
	-- Left image settings.&lt;br /&gt;
	local imageLeft = self.isSmall and args.smallimage or args.image&lt;br /&gt;
	if cfg.imageCheckBlank and imageLeft ~= &#039;blank&#039; and imageLeft ~= &#039;none&#039;&lt;br /&gt;
		or not cfg.imageCheckBlank and imageLeft ~= &#039;none&#039;&lt;br /&gt;
	then&lt;br /&gt;
		self.imageLeft = imageLeft&lt;br /&gt;
		if not imageLeft then&lt;br /&gt;
			local imageSize = self.isSmall&lt;br /&gt;
				and (cfg.imageSmallSize or &#039;30x30px&#039;)&lt;br /&gt;
				or &#039;40x40px&#039;&lt;br /&gt;
			self.imageLeft = string.format(&#039;[[File:%s|%s%s|alt=]]&#039;, self.typeImage&lt;br /&gt;
				or &#039;Information icon4.svg&#039;, imageSize, self.typeImageNeedsLink and &amp;quot;&amp;quot; or &amp;quot;|link=&amp;quot; )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Right image settings.&lt;br /&gt;
	local imageRight = self.isSmall and args.smallimageright or args.imageright&lt;br /&gt;
	if not (cfg.imageRightNone and imageRight == &#039;none&#039;) then&lt;br /&gt;
		self.imageRight = imageRight&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- set templatestyles&lt;br /&gt;
	self.base_templatestyles = cfg.templatestyles&lt;br /&gt;
	self.templatestyles = args.templatestyles&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:setMainspaceCategories()&lt;br /&gt;
	local args = self.args&lt;br /&gt;
	local cfg = self.cfg&lt;br /&gt;
&lt;br /&gt;
	if not cfg.allowMainspaceCategories then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	for _, prefix in ipairs{&#039;cat&#039;, &#039;category&#039;, &#039;all&#039;} do&lt;br /&gt;
		args[prefix .. &#039;1&#039;] = args[prefix]&lt;br /&gt;
		nums = union(nums, getArgNums(args, prefix))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- The following is roughly equivalent to the old {{Ambox/category}}.&lt;br /&gt;
	local date = args.date&lt;br /&gt;
	date = type(date) == &#039;string&#039; and date&lt;br /&gt;
	local preposition = &#039;from&#039;&lt;br /&gt;
	for _, num in ipairs(nums) do&lt;br /&gt;
		local mainCat = args[&#039;cat&#039; .. tostring(num)]&lt;br /&gt;
			or args[&#039;category&#039; .. tostring(num)]&lt;br /&gt;
		local allCat = args[&#039;all&#039; .. tostring(num)]&lt;br /&gt;
		mainCat = type(mainCat) == &#039;string&#039; and mainCat&lt;br /&gt;
		allCat = type(allCat) == &#039;string&#039; and allCat&lt;br /&gt;
		if mainCat and date and date ~= &#039;&#039; then&lt;br /&gt;
			local catTitle = string.format(&#039;%s %s %s&#039;, mainCat, preposition, date)&lt;br /&gt;
			self:addCat(0, catTitle)&lt;br /&gt;
			catTitle = getTitleObject(&#039;Category:&#039; .. catTitle)&lt;br /&gt;
			if not catTitle or not catTitle.exists then&lt;br /&gt;
				self:addCat(0, &#039;Articles with invalid date parameter in template&#039;)&lt;br /&gt;
			end&lt;br /&gt;
		elseif mainCat and (not date or date == &#039;&#039;) then&lt;br /&gt;
			self:addCat(0, mainCat)&lt;br /&gt;
		end&lt;br /&gt;
		if allCat then&lt;br /&gt;
			self:addCat(0, allCat)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:setTemplateCategories()&lt;br /&gt;
	local args = self.args&lt;br /&gt;
	local cfg = self.cfg&lt;br /&gt;
&lt;br /&gt;
	-- Add template categories.&lt;br /&gt;
	if cfg.templateCategory then&lt;br /&gt;
		if cfg.templateCategoryRequireName then&lt;br /&gt;
			if self.isTemplatePage then&lt;br /&gt;
				self:addCat(10, cfg.templateCategory)&lt;br /&gt;
			end&lt;br /&gt;
		elseif not self.title.isSubpage then&lt;br /&gt;
			self:addCat(10, cfg.templateCategory)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add template error categories.&lt;br /&gt;
	if cfg.templateErrorCategory then&lt;br /&gt;
		local templateErrorCategory = cfg.templateErrorCategory&lt;br /&gt;
		local templateCat, templateSort&lt;br /&gt;
		if not self.name and not self.title.isSubpage then&lt;br /&gt;
			templateCat = templateErrorCategory&lt;br /&gt;
		elseif self.isTemplatePage then&lt;br /&gt;
			local paramsToCheck = cfg.templateErrorParamsToCheck or {}&lt;br /&gt;
			local count = 0&lt;br /&gt;
			for i, param in ipairs(paramsToCheck) do&lt;br /&gt;
				if not args[param] then&lt;br /&gt;
					count = count + 1&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if count &amp;gt; 0 then&lt;br /&gt;
				templateCat = templateErrorCategory&lt;br /&gt;
				templateSort = tostring(count)&lt;br /&gt;
			end&lt;br /&gt;
			if self.categoryNums and #self.categoryNums &amp;gt; 0 then&lt;br /&gt;
				templateCat = templateErrorCategory&lt;br /&gt;
				templateSort = &#039;C&#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		self:addCat(10, templateCat, templateSort)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:setAllNamespaceCategories()&lt;br /&gt;
	-- Set categories for all namespaces.&lt;br /&gt;
	if self.invalidTypeError then&lt;br /&gt;
		local allSort = (self.title.namespace == 0 and &#039;Main:&#039; or &#039;&#039;) .. self.title.prefixedText&lt;br /&gt;
		self:addCat(&#039;all&#039;, &#039;Wikipedia message box parameter needs fixing&#039;, allSort)&lt;br /&gt;
	end&lt;br /&gt;
	if self.isSubstituted then&lt;br /&gt;
		self:addCat(&#039;all&#039;, &#039;Pages with incorrectly substituted templates&#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:setCategories()&lt;br /&gt;
	if self.title.namespace == 0 then&lt;br /&gt;
		self:setMainspaceCategories()&lt;br /&gt;
	elseif self.title.namespace == 10 then&lt;br /&gt;
		self:setTemplateCategories()&lt;br /&gt;
	end&lt;br /&gt;
	self:setAllNamespaceCategories()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:renderCategories()&lt;br /&gt;
	if not self.hasCategories then&lt;br /&gt;
		-- No categories added, no need to pass them to Category handler so,&lt;br /&gt;
		-- if it was invoked, it would return the empty string.&lt;br /&gt;
		-- So we shortcut and return the empty string.&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	-- Convert category tables to strings and pass them through&lt;br /&gt;
	-- [[Module:Category handler]].&lt;br /&gt;
	return require(&#039;Module:Category handler&#039;)._main{&lt;br /&gt;
		main = table.concat(self.categories[0] or {}),&lt;br /&gt;
		template = table.concat(self.categories[10] or {}),&lt;br /&gt;
		all = table.concat(self.categories.all or {}),&lt;br /&gt;
		nocat = self.args.nocat,&lt;br /&gt;
		page = self.args.page&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function MessageBox:export()&lt;br /&gt;
	local root = mw.html.create()&lt;br /&gt;
&lt;br /&gt;
	-- Add the subst check error.&lt;br /&gt;
	if self.isSubstituted and self.name then&lt;br /&gt;
		root:tag(&#039;b&#039;)&lt;br /&gt;
			:addClass(&#039;error&#039;)&lt;br /&gt;
			:wikitext(string.format(&lt;br /&gt;
				&#039;Template &amp;lt;code&amp;gt;%s[[Template:%s|%s]]%s&amp;lt;/code&amp;gt; has been incorrectly substituted.&#039;,&lt;br /&gt;
				mw.text.nowiki(&#039;{{&#039;), self.name, self.name, mw.text.nowiki(&#039;}}&#039;)&lt;br /&gt;
			))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local frame = mw.getCurrentFrame()&lt;br /&gt;
	root:wikitext(frame:extensionTag{&lt;br /&gt;
		name = &#039;templatestyles&#039;,&lt;br /&gt;
		args = { src = self.base_templatestyles },&lt;br /&gt;
	})&lt;br /&gt;
	-- Add support for a single custom templatestyles sheet. Undocumented as&lt;br /&gt;
	-- need should be limited and many templates using mbox are substed; we&lt;br /&gt;
	-- don&#039;t want to spread templatestyles sheets around to arbitrary places&lt;br /&gt;
	if self.templatestyles then&lt;br /&gt;
		root:wikitext(frame:extensionTag{&lt;br /&gt;
			name = &#039;templatestyles&#039;,&lt;br /&gt;
			args = { src = self.templatestyles },&lt;br /&gt;
		})&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Create the box table.&lt;br /&gt;
	local boxTable = root:tag(&#039;table&#039;)&lt;br /&gt;
	boxTable:attr(&#039;id&#039;, self.id or nil)&lt;br /&gt;
	for i, class in ipairs(self.classes or {}) do&lt;br /&gt;
		boxTable:addClass(class or nil)&lt;br /&gt;
	end&lt;br /&gt;
	boxTable&lt;br /&gt;
		:cssText(self.style or nil)&lt;br /&gt;
		:attr(&#039;role&#039;, &#039;presentation&#039;)&lt;br /&gt;
&lt;br /&gt;
	if self.attrs then&lt;br /&gt;
		boxTable:attr(self.attrs)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the left-hand image.&lt;br /&gt;
	local row = boxTable:tag(&#039;tr&#039;)&lt;br /&gt;
	if self.imageLeft then&lt;br /&gt;
		local imageLeftCell = row:tag(&#039;td&#039;):addClass(&#039;mbox-image&#039;)&lt;br /&gt;
		if self.imageCellDiv then&lt;br /&gt;
			-- If we are using a div, redefine imageLeftCell so that the image&lt;br /&gt;
			-- is inside it. Divs use style=&amp;quot;width: 52px;&amp;quot;, which limits the&lt;br /&gt;
			-- image width to 52px. If any images in a div are wider than that,&lt;br /&gt;
			-- they may overlap with the text or cause other display problems.&lt;br /&gt;
			imageLeftCell = imageLeftCell:tag(&#039;div&#039;):addClass(&#039;mbox-image-div&#039;)&lt;br /&gt;
		end&lt;br /&gt;
		imageLeftCell&lt;br /&gt;
			:addClass(self.imageLeftClass)&lt;br /&gt;
			:wikitext(self.imageLeft or nil)&lt;br /&gt;
	elseif self.imageEmptyCell then&lt;br /&gt;
		-- Some message boxes define an empty cell if no image is specified, and&lt;br /&gt;
		-- some don&#039;t. The old template code in templates where empty cells are&lt;br /&gt;
		-- specified gives the following hint: &amp;quot;No image. Cell with some width&lt;br /&gt;
		-- or padding necessary for text cell to have 100% width.&amp;quot;&lt;br /&gt;
		row:tag(&#039;td&#039;)&lt;br /&gt;
			:addClass(&#039;mbox-empty-cell&#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the text.&lt;br /&gt;
	local textCell = row:tag(&#039;td&#039;):addClass(&#039;mbox-text&#039;)&lt;br /&gt;
	if self.useCollapsibleTextFields then&lt;br /&gt;
		-- The message box uses advanced text parameters that allow things to be&lt;br /&gt;
		-- collapsible. At the moment, only ambox uses this.&lt;br /&gt;
		textCell:cssText(self.textstyle or nil)&lt;br /&gt;
		local textCellDiv = textCell:tag(&#039;div&#039;)&lt;br /&gt;
		textCellDiv&lt;br /&gt;
			:addClass(&#039;mbox-text-span&#039;)&lt;br /&gt;
			:wikitext(self.issue or nil)&lt;br /&gt;
		if (self.talk or self.fix) then&lt;br /&gt;
			textCellDiv:tag(&#039;span&#039;)&lt;br /&gt;
				:addClass(&#039;hide-when-compact&#039;)&lt;br /&gt;
				:wikitext(self.talk and (&#039; &#039; .. self.talk) or nil)&lt;br /&gt;
				:wikitext(self.fix and (&#039; &#039; .. self.fix) or nil)&lt;br /&gt;
		end&lt;br /&gt;
		textCellDiv:wikitext(self.date and (&#039; &#039; .. self.date) or nil)&lt;br /&gt;
		if self.info and not self.isSmall then&lt;br /&gt;
			textCellDiv&lt;br /&gt;
				:tag(&#039;span&#039;)&lt;br /&gt;
				:addClass(&#039;hide-when-compact&#039;)&lt;br /&gt;
				:wikitext(self.info and (&#039; &#039; .. self.info) or nil)&lt;br /&gt;
		end&lt;br /&gt;
		if self.removalNotice then&lt;br /&gt;
			textCellDiv:tag(&#039;span&#039;)&lt;br /&gt;
				:addClass(&#039;hide-when-compact&#039;)&lt;br /&gt;
				:tag(&#039;i&#039;)&lt;br /&gt;
					:wikitext(string.format(&amp;quot; (%s)&amp;quot;, self.removalNotice))&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- Default text formatting - anything goes.&lt;br /&gt;
		textCell&lt;br /&gt;
			:cssText(self.textstyle or nil)&lt;br /&gt;
			:wikitext(self.text or nil)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the right-hand image.&lt;br /&gt;
	if self.imageRight then&lt;br /&gt;
		local imageRightCell = row:tag(&#039;td&#039;):addClass(&#039;mbox-imageright&#039;)&lt;br /&gt;
		if self.imageCellDiv then&lt;br /&gt;
			-- If we are using a div, redefine imageRightCell so that the image&lt;br /&gt;
			-- is inside it.&lt;br /&gt;
			imageRightCell = imageRightCell:tag(&#039;div&#039;):addClass(&#039;mbox-image-div&#039;)&lt;br /&gt;
		end&lt;br /&gt;
		imageRightCell&lt;br /&gt;
			:addClass(self.imageRightClass)&lt;br /&gt;
			:wikitext(self.imageRight or nil)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the below row.&lt;br /&gt;
	if self.below then&lt;br /&gt;
		boxTable:tag(&#039;tr&#039;)&lt;br /&gt;
			:tag(&#039;td&#039;)&lt;br /&gt;
				:attr(&#039;colspan&#039;, self.imageRight and &#039;3&#039; or &#039;2&#039;)&lt;br /&gt;
				:addClass(&#039;mbox-text&#039;)&lt;br /&gt;
				:cssText(self.textstyle or nil)&lt;br /&gt;
				:wikitext(self.below or nil)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add error message for invalid type parameters.&lt;br /&gt;
	if self.invalidTypeError then&lt;br /&gt;
		root:tag(&#039;div&#039;)&lt;br /&gt;
			:addClass(&#039;mbox-invalid-type&#039;)&lt;br /&gt;
			:wikitext(string.format(&lt;br /&gt;
				&#039;This message box is using an invalid &amp;quot;type=%s&amp;quot; parameter and needs fixing.&#039;,&lt;br /&gt;
				self.type or &#039;&#039;&lt;br /&gt;
			))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add categories.&lt;br /&gt;
	root:wikitext(self:renderCategories() or nil)&lt;br /&gt;
&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Exports&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local p, mt = {}, {}&lt;br /&gt;
&lt;br /&gt;
function p._exportClasses()&lt;br /&gt;
	-- For testing.&lt;br /&gt;
	return {&lt;br /&gt;
		MessageBox = MessageBox&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(boxType, args, cfgTables)&lt;br /&gt;
	local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))&lt;br /&gt;
	box:setParameters()&lt;br /&gt;
	box:setCategories()&lt;br /&gt;
	return box:export()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function mt.__index(t, k)&lt;br /&gt;
	return function (frame)&lt;br /&gt;
		if not getArgs then&lt;br /&gt;
			getArgs = require(&#039;Module:Arguments&#039;).getArgs&lt;br /&gt;
		end&lt;br /&gt;
		return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return setmetatable(p, mt)&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Documentation/config&amp;diff=609</id>
		<title>Module:Documentation/config</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Documentation/config&amp;diff=609"/>
		<updated>2025-08-10T19:47:37Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;----------------------------------------------------------------------------------------------------&lt;br /&gt;
--&lt;br /&gt;
--                               Configuration for Module:Documentation&lt;br /&gt;
--&lt;br /&gt;
-- Here you can set the values of the parameters and messages used in Module:Documentation to&lt;br /&gt;
-- localise it to your wiki and your language. Unless specified otherwise, values given here&lt;br /&gt;
-- should be string values.&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local cfg = {} -- Do not edit this line.&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Protection template configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;protection-reason-edit&#039;]&lt;br /&gt;
-- The protection reason for edit-protected templates to pass to&lt;br /&gt;
-- [[Module:Protection banner]].&lt;br /&gt;
cfg[&#039;protection-reason-edit&#039;] = &#039;template&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Sandbox notice configuration&lt;br /&gt;
--&lt;br /&gt;
-- On sandbox pages the module can display a template notifying users that the current page is a&lt;br /&gt;
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a&lt;br /&gt;
-- sandbox or not based on the value of cfg[&#039;sandbox-subpage&#039;]. The following settings configure the&lt;br /&gt;
-- messages that the notices contains.&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;sandbox-notice-image&#039;]&lt;br /&gt;
-- The image displayed in the sandbox notice.&lt;br /&gt;
cfg[&#039;sandbox-notice-image&#039;] = &#039;[[File:Sandbox.svg|50px|alt=|link=]]&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;sandbox-notice-pagetype-template&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-pagetype-module&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-pagetype-other&#039;]&lt;br /&gt;
-- The page type of the sandbox page. The message that is displayed depends on the current subject&lt;br /&gt;
-- namespace. This message is used in either cfg[&#039;sandbox-notice-blurb&#039;] or&lt;br /&gt;
-- cfg[&#039;sandbox-notice-diff-blurb&#039;].&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;sandbox-notice-pagetype-template&#039;] = &#039;[[Wikipedia:Template test cases|template sandbox]] page&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-pagetype-module&#039;] = &#039;[[Wikipedia:Template test cases|module sandbox]] page&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-pagetype-other&#039;] = &#039;sandbox page&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;sandbox-notice-blurb&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-diff-blurb&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-diff-display&#039;]&lt;br /&gt;
-- Either cfg[&#039;sandbox-notice-blurb&#039;] or cfg[&#039;sandbox-notice-diff-blurb&#039;] is the opening sentence&lt;br /&gt;
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page&lt;br /&gt;
-- type, which is either cfg[&#039;sandbox-notice-pagetype-template&#039;],&lt;br /&gt;
-- cfg[&#039;sandbox-notice-pagetype-module&#039;] or cfg[&#039;sandbox-notice-pagetype-other&#039;] depending what&lt;br /&gt;
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between&lt;br /&gt;
-- the sandbox and the main template. The display value of the diff link is set by &lt;br /&gt;
-- cfg[&#039;sandbox-notice-compare-link-display&#039;].&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;sandbox-notice-blurb&#039;] = &#039;This is the $1 for $2.&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-diff-blurb&#039;] = &#039;This is the $1 for $2 ($3).&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-compare-link-display&#039;] = &#039;diff&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-blurb&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-link-display&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-run-blurb&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-run-link-display&#039;]&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-blurb&#039;] is a sentence notifying the user that there is a test cases page&lt;br /&gt;
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-link-display&#039;] is the display value for that link.&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-run-blurb&#039;] is a sentence notifying the user that there is a test cases page&lt;br /&gt;
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test&lt;br /&gt;
-- cases page, and $2 is a link to the page to run it.&lt;br /&gt;
-- cfg[&#039;sandbox-notice-testcases-run-link-display&#039;] is the display value for the link to run the test&lt;br /&gt;
-- cases.&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;sandbox-notice-testcases-blurb&#039;] = &#039;See also the companion subpage for $1.&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-testcases-link-display&#039;] = &#039;test cases&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-testcases-run-blurb&#039;] = &#039;See also the companion subpage for $1 ($2).&#039;&lt;br /&gt;
cfg[&#039;sandbox-notice-testcases-run-link-display&#039;] = &#039;run&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;sandbox-category&#039;] - A category to add to all template sandboxes.&lt;br /&gt;
-- cfg[&#039;module-sandbox-category&#039;] - A category to add to all module sandboxes.&lt;br /&gt;
-- cfg[&#039;module-sandbox-category&#039;] - A category to add to all sandboxe not in templates or modules.&lt;br /&gt;
cfg[&#039;sandbox-category&#039;] = &#039;Template sandboxes&#039;&lt;br /&gt;
cfg[&#039;module-sandbox-category&#039;] = &#039;Module sandboxes&#039;&lt;br /&gt;
cfg[&#039;other-sandbox-category&#039;] = &#039;Sandboxes outside of template or module namespace&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Start box configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;documentation-icon-wikitext&#039;]&lt;br /&gt;
-- The wikitext for the icon shown at the top of the template.&lt;br /&gt;
cfg[&#039;documentation-icon-wikitext&#039;] = &#039;[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;template-namespace-heading&#039;]&lt;br /&gt;
-- The heading shown in the template namespace.&lt;br /&gt;
cfg[&#039;template-namespace-heading&#039;] = &#039;Template documentation&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;module-namespace-heading&#039;]&lt;br /&gt;
-- The heading shown in the module namespace.&lt;br /&gt;
cfg[&#039;module-namespace-heading&#039;] = &#039;Module documentation&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;file-namespace-heading&#039;]&lt;br /&gt;
-- The heading shown in the file namespace.&lt;br /&gt;
cfg[&#039;file-namespace-heading&#039;] = &#039;Summary&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;other-namespaces-heading&#039;]&lt;br /&gt;
-- The heading shown in other namespaces.&lt;br /&gt;
cfg[&#039;other-namespaces-heading&#039;] = &#039;Documentation&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;view-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;view&amp;quot; links.&lt;br /&gt;
cfg[&#039;view-link-display&#039;] = &#039;view&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;edit-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;edit&amp;quot; links.&lt;br /&gt;
cfg[&#039;edit-link-display&#039;] = &#039;edit&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;history-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;history&amp;quot; links.&lt;br /&gt;
cfg[&#039;history-link-display&#039;] = &#039;history&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;purge-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;purge&amp;quot; links.&lt;br /&gt;
cfg[&#039;purge-link-display&#039;] = &#039;purge&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;create-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;create&amp;quot; links.&lt;br /&gt;
cfg[&#039;create-link-display&#039;] = &#039;create&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Link box (end box) configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;transcluded-from-blurb&#039;]&lt;br /&gt;
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.&lt;br /&gt;
cfg[&#039;transcluded-from-blurb&#039;] = &#039;The above [[Wikipedia:Template documentation|documentation]] is [[Help:Transclusion|transcluded]] from $1.&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;create-module-doc-blurb&#039;]&lt;br /&gt;
-- Notice displayed in the module namespace when the documentation subpage does not exist.&lt;br /&gt;
-- $1 is a link to create the documentation page with the preload cfg[&#039;module-preload&#039;] and the&lt;br /&gt;
-- display cfg[&#039;create-link-display&#039;].&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;create-module-doc-blurb&#039;] = &#039;You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Experiment blurb configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;experiment-blurb-template&#039;]&lt;br /&gt;
-- cfg[&#039;experiment-blurb-module&#039;]&lt;br /&gt;
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.&lt;br /&gt;
-- It is only shown in the template and module namespaces. With the default English settings, it&lt;br /&gt;
-- might look like this:&lt;br /&gt;
--&lt;br /&gt;
-- Editors can experiment in this template&#039;s sandbox (edit | diff) and testcases (edit) pages.&lt;br /&gt;
--&lt;br /&gt;
-- In this example, &amp;quot;sandbox&amp;quot;, &amp;quot;edit&amp;quot;, &amp;quot;diff&amp;quot;, &amp;quot;testcases&amp;quot;, and &amp;quot;edit&amp;quot; would all be links.&lt;br /&gt;
--&lt;br /&gt;
-- There are two versions, cfg[&#039;experiment-blurb-template&#039;] and cfg[&#039;experiment-blurb-module&#039;], depending&lt;br /&gt;
-- on what namespace we are in.&lt;br /&gt;
-- &lt;br /&gt;
-- Parameters:&lt;br /&gt;
--&lt;br /&gt;
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:&lt;br /&gt;
--&lt;br /&gt;
--     cfg[&#039;sandbox-link-display&#039;] (cfg[&#039;sandbox-edit-link-display&#039;] | cfg[&#039;compare-link-display&#039;])&lt;br /&gt;
-- &lt;br /&gt;
-- If the sandbox doesn&#039;t exist, it is in the format:&lt;br /&gt;
--&lt;br /&gt;
--     cfg[&#039;sandbox-link-display&#039;] (cfg[&#039;sandbox-create-link-display&#039;] | cfg[&#039;mirror-link-display&#039;])&lt;br /&gt;
-- &lt;br /&gt;
-- The link for cfg[&#039;sandbox-create-link-display&#039;] link preloads the page with cfg[&#039;template-sandbox-preload&#039;]&lt;br /&gt;
-- or cfg[&#039;module-sandbox-preload&#039;], depending on the current namespace. The link for cfg[&#039;mirror-link-display&#039;]&lt;br /&gt;
-- loads a default edit summary of cfg[&#039;mirror-edit-summary&#039;].&lt;br /&gt;
--&lt;br /&gt;
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:&lt;br /&gt;
--&lt;br /&gt;
--     cfg[&#039;testcases-link-display&#039;] (cfg[&#039;testcases-edit-link-display&#039;] | cfg[&#039;testcases-run-link-display&#039;])&lt;br /&gt;
--&lt;br /&gt;
-- If the test cases page doesn&#039;t exist, it is in the format:&lt;br /&gt;
-- &lt;br /&gt;
--     cfg[&#039;testcases-link-display&#039;] (cfg[&#039;testcases-create-link-display&#039;])&lt;br /&gt;
--&lt;br /&gt;
-- If the test cases page doesn&#039;t exist, the link for cfg[&#039;testcases-create-link-display&#039;] preloads the&lt;br /&gt;
-- page with cfg[&#039;template-testcases-preload&#039;] or cfg[&#039;module-testcases-preload&#039;], depending on the current&lt;br /&gt;
-- namespace.&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;experiment-blurb-template&#039;] = &amp;quot;Editors can experiment in this template&#039;s $1 and $2 pages.&amp;quot;&lt;br /&gt;
cfg[&#039;experiment-blurb-module&#039;] = &amp;quot;Editors can experiment in this module&#039;s $1 and $2 pages.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Sandbox link configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;sandbox-subpage&#039;]&lt;br /&gt;
-- The name of the template subpage typically used for sandboxes.&lt;br /&gt;
cfg[&#039;sandbox-subpage&#039;] = &#039;sandbox&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;template-sandbox-preload&#039;]&lt;br /&gt;
-- Preload file for template sandbox pages.&lt;br /&gt;
cfg[&#039;template-sandbox-preload&#039;] = &#039;Template:Documentation/preload-sandbox&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;module-sandbox-preload&#039;]&lt;br /&gt;
-- Preload file for Lua module sandbox pages.&lt;br /&gt;
cfg[&#039;module-sandbox-preload&#039;] = &#039;Template:Documentation/preload-module-sandbox&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;sandbox-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;sandbox&amp;quot; links.&lt;br /&gt;
cfg[&#039;sandbox-link-display&#039;] = &#039;sandbox&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;sandbox-edit-link-display&#039;]&lt;br /&gt;
-- The text to display for sandbox &amp;quot;edit&amp;quot; links.&lt;br /&gt;
cfg[&#039;sandbox-edit-link-display&#039;] = &#039;edit&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;sandbox-create-link-display&#039;]&lt;br /&gt;
-- The text to display for sandbox &amp;quot;create&amp;quot; links.&lt;br /&gt;
cfg[&#039;sandbox-create-link-display&#039;] = &#039;create&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;compare-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;compare&amp;quot; links.&lt;br /&gt;
cfg[&#039;compare-link-display&#039;] = &#039;diff&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;mirror-edit-summary&#039;]&lt;br /&gt;
-- The default edit summary to use when a user clicks the &amp;quot;mirror&amp;quot; link. $1 is a wikilink to the&lt;br /&gt;
-- template page.&lt;br /&gt;
cfg[&#039;mirror-edit-summary&#039;] = &#039;Create sandbox version of $1&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;mirror-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;mirror&amp;quot; links.&lt;br /&gt;
cfg[&#039;mirror-link-display&#039;] = &#039;mirror&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;mirror-link-preload&#039;]&lt;br /&gt;
-- The page to preload when a user clicks the &amp;quot;mirror&amp;quot; link.&lt;br /&gt;
cfg[&#039;mirror-link-preload&#039;] = &#039;Template:Documentation/mirror&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Test cases link configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;testcases-subpage&#039;]&lt;br /&gt;
-- The name of the template subpage typically used for test cases.&lt;br /&gt;
cfg[&#039;testcases-subpage&#039;] = &#039;testcases&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;template-testcases-preload&#039;]&lt;br /&gt;
-- Preload file for template test cases pages.&lt;br /&gt;
cfg[&#039;template-testcases-preload&#039;] = &#039;Template:Documentation/preload-testcases&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;module-testcases-preload&#039;]&lt;br /&gt;
-- Preload file for Lua module test cases pages.&lt;br /&gt;
cfg[&#039;module-testcases-preload&#039;] = &#039;Template:Documentation/preload-module-testcases&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;testcases-link-display&#039;]&lt;br /&gt;
-- The text to display for &amp;quot;testcases&amp;quot; links.&lt;br /&gt;
cfg[&#039;testcases-link-display&#039;] = &#039;testcases&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;testcases-edit-link-display&#039;]&lt;br /&gt;
-- The text to display for test cases &amp;quot;edit&amp;quot; links.&lt;br /&gt;
cfg[&#039;testcases-edit-link-display&#039;] = &#039;edit&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;testcases-run-link-display&#039;]&lt;br /&gt;
-- The text to display for test cases &amp;quot;run&amp;quot; links.&lt;br /&gt;
cfg[&#039;testcases-run-link-display&#039;] = &#039;run&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;testcases-create-link-display&#039;]&lt;br /&gt;
-- The text to display for test cases &amp;quot;create&amp;quot; links.&lt;br /&gt;
cfg[&#039;testcases-create-link-display&#039;] = &#039;create&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Add categories blurb configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;add-categories-blurb&#039;]&lt;br /&gt;
-- Text to direct users to add categories to the /doc subpage. Not used if the &amp;quot;content&amp;quot; or&lt;br /&gt;
-- &amp;quot;docname fed&amp;quot; arguments are set, as then it is not clear where to add the categories. $1 is a&lt;br /&gt;
-- link to the /doc subpage with a display value of cfg[&#039;doc-link-display&#039;].&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;add-categories-blurb&#039;] = &#039;Add categories to the $1 subpage.&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;doc-link-display&#039;]&lt;br /&gt;
-- The text to display when linking to the /doc subpage.&lt;br /&gt;
cfg[&#039;doc-link-display&#039;] = &#039;/doc&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Subpages link configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;subpages-blurb&#039;]&lt;br /&gt;
-- The &amp;quot;Subpages of this template&amp;quot; blurb. $1 is a link to the main template&#039;s subpages with a&lt;br /&gt;
-- display value of cfg[&#039;subpages-link-display&#039;]. In the English version this blurb is simply&lt;br /&gt;
-- the link followed by a period, and the link display provides the actual text.&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;subpages-blurb&#039;] = &#039;$1.&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
-- cfg[&#039;subpages-link-display&#039;]&lt;br /&gt;
-- The text to display for the &amp;quot;subpages of this page&amp;quot; link. $1 is cfg[&#039;template-pagetype&#039;],&lt;br /&gt;
-- cfg[&#039;module-pagetype&#039;] or cfg[&#039;default-pagetype&#039;], depending on whether the current page is in&lt;br /&gt;
-- the template namespace, the module namespace, or another namespace.&lt;br /&gt;
--]]&lt;br /&gt;
cfg[&#039;subpages-link-display&#039;] = &#039;Subpages of this $1&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;template-pagetype&#039;]&lt;br /&gt;
-- The pagetype to display for template pages.&lt;br /&gt;
cfg[&#039;template-pagetype&#039;] = &#039;template&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;module-pagetype&#039;]&lt;br /&gt;
-- The pagetype to display for Lua module pages.&lt;br /&gt;
cfg[&#039;module-pagetype&#039;] = &#039;module&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;default-pagetype&#039;]&lt;br /&gt;
-- The pagetype to display for pages other than templates or Lua modules.&lt;br /&gt;
cfg[&#039;default-pagetype&#039;] = &#039;page&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Doc link configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;doc-subpage&#039;]&lt;br /&gt;
-- The name of the subpage typically used for documentation pages.&lt;br /&gt;
cfg[&#039;doc-subpage&#039;] = &#039;doc&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;docpage-preload&#039;]&lt;br /&gt;
-- Preload file for template documentation pages in all namespaces.&lt;br /&gt;
cfg[&#039;docpage-preload&#039;] = &#039;Template:Documentation/preload&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;module-preload&#039;]&lt;br /&gt;
-- Preload file for Lua module documentation pages.&lt;br /&gt;
cfg[&#039;module-preload&#039;] = &#039;Template:Documentation/preload-module-doc&#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- HTML and CSS configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;templatestyles&#039;]&lt;br /&gt;
-- The name of the TemplateStyles page where CSS is kept.&lt;br /&gt;
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.&lt;br /&gt;
cfg[&#039;templatestyles&#039;] = &#039;Module:Documentation/styles.css&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;container&#039;]&lt;br /&gt;
-- Class which can be used to set flex or grid CSS on the&lt;br /&gt;
-- two child divs documentation and documentation-metadata&lt;br /&gt;
cfg[&#039;container&#039;] = &#039;documentation-container&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;main-div-classes&#039;]&lt;br /&gt;
-- Classes added to the main HTML &amp;quot;div&amp;quot; tag.&lt;br /&gt;
cfg[&#039;main-div-classes&#039;] = &#039;documentation&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;main-div-heading-class&#039;]&lt;br /&gt;
-- Class for the main heading for templates and modules and assoc. talk spaces&lt;br /&gt;
cfg[&#039;main-div-heading-class&#039;] = &#039;documentation-heading&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;start-box-class&#039;]&lt;br /&gt;
-- Class for the start box&lt;br /&gt;
cfg[&#039;start-box-class&#039;] = &#039;documentation-startbox&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;start-box-link-classes&#039;]&lt;br /&gt;
-- Classes used for the [view][edit][history] or [create] links in the start box.&lt;br /&gt;
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]&lt;br /&gt;
cfg[&#039;start-box-link-classes&#039;] = &#039;mw-editsection-like plainlinks&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;end-box-class&#039;]&lt;br /&gt;
-- Class for the end box.&lt;br /&gt;
cfg[&#039;end-box-class&#039;] = &#039;documentation-metadata&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;end-box-plainlinks&#039;]&lt;br /&gt;
-- Plainlinks&lt;br /&gt;
cfg[&#039;end-box-plainlinks&#039;] = &#039;plainlinks&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;toolbar-class&#039;]&lt;br /&gt;
-- Class added for toolbar links.&lt;br /&gt;
cfg[&#039;toolbar-class&#039;] = &#039;documentation-toolbar&#039;&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;clear&#039;]&lt;br /&gt;
-- Just used to clear things.&lt;br /&gt;
cfg[&#039;clear&#039;] = &#039;documentation-clear&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- Tracking category configuration&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;display-strange-usage-category&#039;]&lt;br /&gt;
-- Set to true to enable output of cfg[&#039;strange-usage-category&#039;] if the module is used on a /doc subpage&lt;br /&gt;
-- or a /testcases subpage. This should be a boolean value (either true or false).&lt;br /&gt;
cfg[&#039;display-strange-usage-category&#039;] = true&lt;br /&gt;
&lt;br /&gt;
-- cfg[&#039;strange-usage-category&#039;]&lt;br /&gt;
-- Category to output if cfg[&#039;display-strange-usage-category&#039;] is set to true and the module is used on a&lt;br /&gt;
-- /doc subpage or a /testcases subpage.&lt;br /&gt;
cfg[&#039;strange-usage-category&#039;] = &#039;Wikipedia pages with strange ((documentation)) usage&#039;&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
-- End configuration&lt;br /&gt;
--&lt;br /&gt;
-- Don&#039;t edit anything below this line.&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
return cfg&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:See&amp;diff=606</id>
		<title>Template:See</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:See&amp;diff=606"/>
		<updated>2025-08-09T18:52:38Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Further]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Pp-vandalism&amp;diff=605</id>
		<title>Template:Pp-vandalism</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Pp-vandalism&amp;diff=605"/>
		<updated>2025-08-09T18:52:28Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Protection banner|main}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Pp-sock&amp;diff=604</id>
		<title>Template:Pp-sock</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Pp-sock&amp;diff=604"/>
		<updated>2025-08-09T18:52:18Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Protection banner|main}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Pp-dispute&amp;diff=603</id>
		<title>Template:Pp-dispute</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Pp-dispute&amp;diff=603"/>
		<updated>2025-08-09T18:52:08Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Protection banner|main}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Labelled_list_hatnote&amp;diff=602</id>
		<title>Module:Labelled list hatnote</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Labelled_list_hatnote&amp;diff=602"/>
		<updated>2025-08-09T18:51:58Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--------------------------------------------------------------------------------&lt;br /&gt;
--                               Labelled list                                --&lt;br /&gt;
--                                                                            --&lt;br /&gt;
-- This module does the core work of creating a hatnote composed of a list    --&lt;br /&gt;
-- prefixed by a colon-terminated label, i.e. &amp;quot;LABEL: [andList of pages]&amp;quot;,    --&lt;br /&gt;
-- for {{see also}} and similar templates.                                    --&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require(&#039;Module:Hatnote&#039;)&lt;br /&gt;
local mHatlist = require(&#039;Module:Hatnote list&#039;)&lt;br /&gt;
local mArguments --initialize lazily&lt;br /&gt;
local yesno --initialize lazily&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Defaults global to this module&lt;br /&gt;
local defaults = {&lt;br /&gt;
	label = &#039;See also&#039;, --Final fallback for label argument&lt;br /&gt;
	labelForm = &#039;%s: %s&#039;,&lt;br /&gt;
	prefixes = {&#039;label&#039;, &#039;label &#039;, &#039;l&#039;},&lt;br /&gt;
	template = &#039;Module:Labelled list hatnote&#039;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Localizable message strings&lt;br /&gt;
local msg = {&lt;br /&gt;
	errorSuffix = &#039;#Errors&#039;,&lt;br /&gt;
	noInputWarning = &#039;no page names specified&#039;,&lt;br /&gt;
	noOutputWarning =&lt;br /&gt;
		&amp;quot;&#039;&#039;&#039;[[%s]] — no output: none of the target pages exist.&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Helper function that pre-combines display parameters into page arguments.&lt;br /&gt;
-- Also compresses sparse arrays, as a desirable side-effect.&lt;br /&gt;
function p.preprocessDisplays (args, prefixes)&lt;br /&gt;
	-- Prefixes specify which parameters, in order, to check for display options&lt;br /&gt;
	-- They each have numbers auto-appended, e.g. &#039;label1&#039;, &#039;label 1&#039;, &amp;amp; &#039;l1&#039;&lt;br /&gt;
	prefixes = prefixes or defaults.prefixes&lt;br /&gt;
	local indices = {}&lt;br /&gt;
	local sparsePages = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if type(k) == &#039;number&#039; then&lt;br /&gt;
			indices[#indices + 1] = k&lt;br /&gt;
			local display&lt;br /&gt;
			for i = 1, #prefixes do&lt;br /&gt;
				display = args[prefixes[i] .. k]&lt;br /&gt;
				if display then break end&lt;br /&gt;
			end&lt;br /&gt;
			sparsePages[k] = display and&lt;br /&gt;
				string.format(&#039;%s|%s&#039;, string.gsub(v, &#039;|.*$&#039;, &#039;&#039;), display) or v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(indices)&lt;br /&gt;
	local pages = {}&lt;br /&gt;
	for k, v in ipairs(indices) do pages[#pages + 1] = sparsePages[v] end&lt;br /&gt;
	return pages&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Helper function to get a page target from a processed page string&lt;br /&gt;
--e.g. &amp;quot;Page|Label&amp;quot; → &amp;quot;Page&amp;quot; or &amp;quot;Target&amp;quot; → &amp;quot;Target&amp;quot;&lt;br /&gt;
local function getTarget(pagename)&lt;br /&gt;
 	local pipe = string.find(pagename, &#039;|&#039;)&lt;br /&gt;
	return string.sub(pagename, 0, pipe and pipe - 1 or nil)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Produces a labelled pages-list hatnote.&lt;br /&gt;
-- The main frame (template definition) takes 1 or 2 arguments, for a singular&lt;br /&gt;
-- and (optionally) plural label respectively:&lt;br /&gt;
-- * {{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}&lt;br /&gt;
-- The resulting template takes pagename &amp;amp; label parameters normally.&lt;br /&gt;
function p.labelledList (frame)&lt;br /&gt;
	mArguments = require(&#039;Module:Arguments&#039;)&lt;br /&gt;
	yesno = require(&#039;Module:Yesno&#039;)&lt;br /&gt;
	local labels = {frame.args[1] or defaults.label}&lt;br /&gt;
	labels[2] = frame.args[2] or labels[1]&lt;br /&gt;
	labels[3] = frame.args[3] --no defaulting&lt;br /&gt;
	labels[4] = frame.args[4] --no defaulting&lt;br /&gt;
	local template = frame:getParent():getTitle()&lt;br /&gt;
	local args = mArguments.getArgs(frame, {parentOnly = true})&lt;br /&gt;
	local pages = p.preprocessDisplays(args)&lt;br /&gt;
	local options = {&lt;br /&gt;
		category = yesno(args.category),&lt;br /&gt;
		extraclasses = frame.args.extraclasses,&lt;br /&gt;
		ifexists = yesno(frame.args.ifexists),&lt;br /&gt;
		namespace = frame.args.namespace or args.namespace,&lt;br /&gt;
		selfref = yesno(frame.args.selfref or args.selfref),&lt;br /&gt;
		template = template&lt;br /&gt;
	}&lt;br /&gt;
	return p._labelledList(pages, labels, options)&lt;br /&gt;
end&lt;br /&gt;
local function exists(title)&lt;br /&gt;
	local success, result = pcall(function() return title.exists end)&lt;br /&gt;
	if success then&lt;br /&gt;
		return result&lt;br /&gt;
	else&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._labelledList (pages, labels, options)&lt;br /&gt;
	local removednonexist = false&lt;br /&gt;
	if options.ifexists then&lt;br /&gt;
		for k = #pages, 1, -1 do --iterate backwards to allow smooth removals&lt;br /&gt;
			local v = pages[k]&lt;br /&gt;
			if mw.ustring.sub(mw.text.trim(v), 1, 1) ~= &amp;quot;#&amp;quot; then&lt;br /&gt;
				local title = mw.title.new(getTarget(v), namespace)&lt;br /&gt;
				if (v == &#039;&#039;) or (title == nil) or not exists(title) then&lt;br /&gt;
					table.remove(pages, k)&lt;br /&gt;
					removednonexist = true&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	labels = labels or {}&lt;br /&gt;
	label = (#pages == 1 and labels[1] or labels[2]) or defaults.label&lt;br /&gt;
	for k, v in pairs(pages) do &lt;br /&gt;
		if mHatnote.findNamespaceId(v) ~= 0 then&lt;br /&gt;
			label =&lt;br /&gt;
				(&lt;br /&gt;
					#pages == 1 and&lt;br /&gt;
					(labels[3] or labels[1] or defaults.label) or&lt;br /&gt;
					(labels[4] or labels[2] or defaults.label)&lt;br /&gt;
				) or defaults.label&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if #pages == 0 then&lt;br /&gt;
		if removednonexist then&lt;br /&gt;
			mw.addWarning(&lt;br /&gt;
				string.format(&lt;br /&gt;
					msg.noOutputWarning, options.template or defaults.template&lt;br /&gt;
				)&lt;br /&gt;
			)&lt;br /&gt;
			return &#039;&#039;&lt;br /&gt;
		else&lt;br /&gt;
			return mHatnote.makeWikitextError(&lt;br /&gt;
				msg.noInputWarning,&lt;br /&gt;
				(options.template or defaults.template) .. msg.errorSuffix,&lt;br /&gt;
				options.category&lt;br /&gt;
			)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local text = string.format(&lt;br /&gt;
		options.labelForm or defaults.labelForm,&lt;br /&gt;
		label,&lt;br /&gt;
		mHatlist.andList(pages, true)&lt;br /&gt;
	)&lt;br /&gt;
	local hnOptions = {&lt;br /&gt;
		extraclasses = options.extraclasses,&lt;br /&gt;
		selfref = options.selfref&lt;br /&gt;
	}&lt;br /&gt;
	return mHatnote._hatnote(text, hnOptions)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Rcat&amp;diff=601</id>
		<title>Template:Rcat</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Rcat&amp;diff=601"/>
		<updated>2025-08-09T18:51:48Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Redirect template]]&lt;br /&gt;
&lt;br /&gt;
{{Redirect category shell|&lt;br /&gt;
{{R from modification}}&lt;br /&gt;
{{R from related word}}&lt;br /&gt;
{{R to redirect template}}&lt;br /&gt;
{{R from template shortcut}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Protection_banner&amp;diff=600</id>
		<title>Module:Protection banner</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Protection_banner&amp;diff=600"/>
		<updated>2025-08-09T18:51:39Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- This module implements {{pp-meta}} and its daughter templates such as&lt;br /&gt;
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.&lt;br /&gt;
&lt;br /&gt;
-- Initialise necessary modules.&lt;br /&gt;
require(&#039;strict&#039;)&lt;br /&gt;
local makeFileLink = require(&#039;Module:File link&#039;)._main&lt;br /&gt;
local effectiveProtectionLevel = require(&#039;Module:Effective protection level&#039;)._main&lt;br /&gt;
local effectiveProtectionExpiry = require(&#039;Module:Effective protection expiry&#039;)._main&lt;br /&gt;
local yesno = require(&#039;Module:Yesno&#039;)&lt;br /&gt;
&lt;br /&gt;
-- Lazily initialise modules and objects we don&#039;t always need.&lt;br /&gt;
local getArgs, makeMessageBox, lang&lt;br /&gt;
&lt;br /&gt;
-- Set constants.&lt;br /&gt;
local CONFIG_MODULE = &#039;Module:Protection banner/config&#039;&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Helper functions&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local function makeCategoryLink(cat, sort)&lt;br /&gt;
	if cat then&lt;br /&gt;
		return string.format(&lt;br /&gt;
			&#039;[[%s:%s|%s]]&#039;,&lt;br /&gt;
			mw.site.namespaces[14].name,&lt;br /&gt;
			cat,&lt;br /&gt;
			sort&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Validation function for the expiry and the protection date&lt;br /&gt;
local function validateDate(dateString, dateType)&lt;br /&gt;
	if not lang then&lt;br /&gt;
		lang = mw.language.getContentLanguage()&lt;br /&gt;
	end&lt;br /&gt;
	local success, result = pcall(lang.formatDate, lang, &#039;U&#039;, dateString)&lt;br /&gt;
	if success then&lt;br /&gt;
		result = tonumber(result)&lt;br /&gt;
		if result then&lt;br /&gt;
			return result&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	error(string.format(&lt;br /&gt;
		&#039;invalid %s: %s&#039;,&lt;br /&gt;
		dateType,&lt;br /&gt;
		tostring(dateString)&lt;br /&gt;
	), 4)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeFullUrl(page, query, display)&lt;br /&gt;
	return string.format(&lt;br /&gt;
		&#039;[%s %s]&#039;,&lt;br /&gt;
		tostring(mw.uri.fullUrl(page, query)),&lt;br /&gt;
		display&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Given a directed graph formatted as node -&amp;gt; table of direct successors,&lt;br /&gt;
-- get a table of all nodes reachable from a given node (though always&lt;br /&gt;
-- including the given node).&lt;br /&gt;
local function getReachableNodes(graph, start)&lt;br /&gt;
	local toWalk, retval = {[start] = true}, {}&lt;br /&gt;
	while true do&lt;br /&gt;
		-- Can&#039;t use pairs() since we&#039;re adding and removing things as we&#039;re iterating&lt;br /&gt;
		local k = next(toWalk) -- This always gets the &amp;quot;first&amp;quot; key&lt;br /&gt;
		if k == nil then&lt;br /&gt;
			return retval&lt;br /&gt;
		end&lt;br /&gt;
		toWalk[k] = nil&lt;br /&gt;
		retval[k] = true&lt;br /&gt;
		for _,v in ipairs(graph[k]) do&lt;br /&gt;
			if not retval[v] then&lt;br /&gt;
				toWalk[v] = true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Protection class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local Protection = {}&lt;br /&gt;
Protection.__index = Protection&lt;br /&gt;
&lt;br /&gt;
Protection.supportedActions = {&lt;br /&gt;
	edit = true,&lt;br /&gt;
	move = true,&lt;br /&gt;
	autoreview = true,&lt;br /&gt;
	upload = true&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Protection.bannerConfigFields = {&lt;br /&gt;
	&#039;text&#039;,&lt;br /&gt;
	&#039;explanation&#039;,&lt;br /&gt;
	&#039;tooltip&#039;,&lt;br /&gt;
	&#039;alt&#039;,&lt;br /&gt;
	&#039;link&#039;,&lt;br /&gt;
	&#039;image&#039;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function Protection.new(args, cfg, title)&lt;br /&gt;
	local obj = {}&lt;br /&gt;
	obj._cfg = cfg&lt;br /&gt;
	obj.title = title or mw.title.getCurrentTitle()&lt;br /&gt;
&lt;br /&gt;
	-- Set action&lt;br /&gt;
	if not args.action then&lt;br /&gt;
		obj.action = &#039;edit&#039;&lt;br /&gt;
	elseif Protection.supportedActions[args.action] then&lt;br /&gt;
		obj.action = args.action&lt;br /&gt;
	else&lt;br /&gt;
		error(string.format(&lt;br /&gt;
			&#039;invalid action: %s&#039;,&lt;br /&gt;
			tostring(args.action)&lt;br /&gt;
		), 3)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set level&lt;br /&gt;
	obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)&lt;br /&gt;
	if not obj.level or (obj.action == &#039;move&#039; and obj.level == &#039;autoconfirmed&#039;) then&lt;br /&gt;
		-- Users need to be autoconfirmed to move pages anyway, so treat&lt;br /&gt;
		-- semi-move-protected pages as unprotected.&lt;br /&gt;
		obj.level = &#039;*&#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set expiry&lt;br /&gt;
	local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)&lt;br /&gt;
	if effectiveExpiry == &#039;infinity&#039; then&lt;br /&gt;
		obj.expiry = &#039;indef&#039;&lt;br /&gt;
	elseif effectiveExpiry ~= &#039;unknown&#039; then&lt;br /&gt;
		obj.expiry = validateDate(effectiveExpiry, &#039;expiry date&#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set reason&lt;br /&gt;
	if args[1] then&lt;br /&gt;
		obj.reason = mw.ustring.lower(args[1])&lt;br /&gt;
		if obj.reason:find(&#039;|&#039;) then&lt;br /&gt;
			error(&#039;reasons cannot contain the pipe character (&amp;quot;|&amp;quot;)&#039;, 3)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set protection date&lt;br /&gt;
	if args.date then&lt;br /&gt;
		obj.protectionDate = validateDate(args.date, &#039;protection date&#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Set banner config&lt;br /&gt;
	do&lt;br /&gt;
		obj.bannerConfig = {}&lt;br /&gt;
		local configTables = {}&lt;br /&gt;
		if cfg.banners[obj.action] then&lt;br /&gt;
			configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]&lt;br /&gt;
		end&lt;br /&gt;
		if cfg.defaultBanners[obj.action] then&lt;br /&gt;
			configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]&lt;br /&gt;
			configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default&lt;br /&gt;
		end&lt;br /&gt;
		configTables[#configTables + 1] = cfg.masterBanner&lt;br /&gt;
		for i, field in ipairs(Protection.bannerConfigFields) do&lt;br /&gt;
			for j, t in ipairs(configTables) do&lt;br /&gt;
				if t[field] then&lt;br /&gt;
					obj.bannerConfig[field] = t[field]&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return setmetatable(obj, Protection)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:isUserScript()&lt;br /&gt;
	-- Whether the page is a user JavaScript or CSS page.&lt;br /&gt;
	local title = self.title&lt;br /&gt;
	return title.namespace == 2 and (&lt;br /&gt;
		title.contentModel == &#039;javascript&#039; or title.contentModel == &#039;css&#039;&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:isProtected()&lt;br /&gt;
	return self.level ~= &#039;*&#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:shouldShowLock()&lt;br /&gt;
	-- Whether we should output a banner/padlock&lt;br /&gt;
	return self:isProtected() and not self:isUserScript()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Whether this page needs a protection category.&lt;br /&gt;
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock&lt;br /&gt;
&lt;br /&gt;
function Protection:isTemporary()&lt;br /&gt;
	return type(self.expiry) == &#039;number&#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:makeProtectionCategory()&lt;br /&gt;
	if not self:shouldHaveProtectionCategory() then&lt;br /&gt;
		return &#039;&#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local cfg = self._cfg&lt;br /&gt;
	local title = self.title&lt;br /&gt;
	&lt;br /&gt;
	-- Get the expiry key fragment.&lt;br /&gt;
	local expiryFragment&lt;br /&gt;
	if self.expiry == &#039;indef&#039; then&lt;br /&gt;
		expiryFragment = self.expiry&lt;br /&gt;
	elseif type(self.expiry) == &#039;number&#039; then&lt;br /&gt;
		expiryFragment = &#039;temp&#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Get the namespace key fragment.&lt;br /&gt;
	local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]&lt;br /&gt;
	if not namespaceFragment and title.namespace % 2 == 1 then&lt;br /&gt;
			namespaceFragment = &#039;talk&#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Define the order that key fragments are tested in. This is done with an&lt;br /&gt;
	-- array of tables containing the value to be tested, along with its&lt;br /&gt;
	-- position in the cfg.protectionCategories table.&lt;br /&gt;
	local order = {&lt;br /&gt;
		{val = expiryFragment,    keypos = 1},&lt;br /&gt;
		{val = namespaceFragment, keypos = 2},&lt;br /&gt;
		{val = self.reason,       keypos = 3},&lt;br /&gt;
		{val = self.level,        keypos = 4},&lt;br /&gt;
		{val = self.action,       keypos = 5}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	--[[&lt;br /&gt;
	-- The old protection templates used an ad-hoc protection category system,&lt;br /&gt;
	-- with some templates prioritising namespaces in their categories, and&lt;br /&gt;
	-- others prioritising the protection reason. To emulate this in this module&lt;br /&gt;
	-- we use the config table cfg.reasonsWithNamespacePriority to set the&lt;br /&gt;
	-- reasons for which namespaces have priority over protection reason.&lt;br /&gt;
	-- If we are dealing with one of those reasons, move the namespace table to&lt;br /&gt;
	-- the end of the order table, i.e. give it highest priority. If not, the&lt;br /&gt;
	-- reason should have highest priority, so move that to the end of the table&lt;br /&gt;
	-- instead.&lt;br /&gt;
	--]]&lt;br /&gt;
	table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))&lt;br /&gt;
 &lt;br /&gt;
	--[[&lt;br /&gt;
	-- Define the attempt order. Inactive subtables (subtables with nil &amp;quot;value&amp;quot;&lt;br /&gt;
	-- fields) are moved to the end, where they will later be given the key&lt;br /&gt;
	-- &amp;quot;all&amp;quot;. This is to cut down on the number of table lookups in&lt;br /&gt;
	-- cfg.protectionCategories, which grows exponentially with the number of&lt;br /&gt;
	-- non-nil keys. We keep track of the number of active subtables with the&lt;br /&gt;
	-- noActive parameter.&lt;br /&gt;
	--]]&lt;br /&gt;
	local noActive, attemptOrder&lt;br /&gt;
	do&lt;br /&gt;
		local active, inactive = {}, {}&lt;br /&gt;
		for i, t in ipairs(order) do&lt;br /&gt;
			if t.val then&lt;br /&gt;
				active[#active + 1] = t&lt;br /&gt;
			else&lt;br /&gt;
				inactive[#inactive + 1] = t&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		noActive = #active&lt;br /&gt;
		attemptOrder = active&lt;br /&gt;
		for i, t in ipairs(inactive) do&lt;br /&gt;
			attemptOrder[#attemptOrder + 1] = t&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	--[[&lt;br /&gt;
	-- Check increasingly generic key combinations until we find a match. If a&lt;br /&gt;
	-- specific category exists for the combination of key fragments we are&lt;br /&gt;
	-- given, that match will be found first. If not, we keep trying different&lt;br /&gt;
	-- key fragment combinations until we match using the key&lt;br /&gt;
	-- &amp;quot;all-all-all-all-all&amp;quot;.&lt;br /&gt;
	--&lt;br /&gt;
	-- To generate the keys, we index the key subtables using a binary matrix&lt;br /&gt;
	-- with indexes i and j. j is only calculated up to the number of active&lt;br /&gt;
	-- subtables. For example, if there were three active subtables, the matrix&lt;br /&gt;
	-- would look like this, with 0 corresponding to the key fragment &amp;quot;all&amp;quot;, and&lt;br /&gt;
	-- 1 corresponding to other key fragments.&lt;br /&gt;
	-- &lt;br /&gt;
	--   j 1  2  3&lt;br /&gt;
	-- i  &lt;br /&gt;
	-- 1   1  1  1&lt;br /&gt;
	-- 2   0  1  1&lt;br /&gt;
	-- 3   1  0  1&lt;br /&gt;
	-- 4   0  0  1&lt;br /&gt;
	-- 5   1  1  0&lt;br /&gt;
	-- 6   0  1  0&lt;br /&gt;
	-- 7   1  0  0&lt;br /&gt;
	-- 8   0  0  0&lt;br /&gt;
	-- &lt;br /&gt;
	-- Values of j higher than the number of active subtables are set&lt;br /&gt;
	-- to the string &amp;quot;all&amp;quot;.&lt;br /&gt;
	--&lt;br /&gt;
	-- A key for cfg.protectionCategories is constructed for each value of i.&lt;br /&gt;
	-- The position of the value in the key is determined by the keypos field in&lt;br /&gt;
	-- each subtable.&lt;br /&gt;
	--]]&lt;br /&gt;
	local cats = cfg.protectionCategories&lt;br /&gt;
	for i = 1, 2^noActive do&lt;br /&gt;
		local key = {}&lt;br /&gt;
		for j, t in ipairs(attemptOrder) do&lt;br /&gt;
			if j &amp;gt; noActive then&lt;br /&gt;
				key[t.keypos] = &#039;all&#039;&lt;br /&gt;
			else&lt;br /&gt;
				local quotient = i / 2 ^ (j - 1)&lt;br /&gt;
				quotient = math.ceil(quotient)&lt;br /&gt;
				if quotient % 2 == 1 then&lt;br /&gt;
					key[t.keypos] = t.val&lt;br /&gt;
				else&lt;br /&gt;
					key[t.keypos] = &#039;all&#039;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		key = table.concat(key, &#039;|&#039;)&lt;br /&gt;
		local attempt = cats[key]&lt;br /&gt;
		if attempt then&lt;br /&gt;
			return makeCategoryLink(attempt, title.text)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return &#039;&#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:isIncorrect()&lt;br /&gt;
	local expiry = self.expiry&lt;br /&gt;
	return not self:shouldHaveProtectionCategory()&lt;br /&gt;
		or type(expiry) == &#039;number&#039; and expiry &amp;lt; os.time()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:isTemplateProtectedNonTemplate()&lt;br /&gt;
	local action, namespace = self.action, self.title.namespace&lt;br /&gt;
	return self.level == &#039;templateeditor&#039;&lt;br /&gt;
		and (&lt;br /&gt;
			(action ~= &#039;edit&#039; and action ~= &#039;move&#039;)&lt;br /&gt;
			or (namespace ~= 10 and namespace ~= 828)&lt;br /&gt;
		)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Protection:makeCategoryLinks()&lt;br /&gt;
	local msg = self._cfg.msg&lt;br /&gt;
	local ret = {self:makeProtectionCategory()}&lt;br /&gt;
	if self:isIncorrect() then&lt;br /&gt;
		ret[#ret + 1] = makeCategoryLink(&lt;br /&gt;
			msg[&#039;tracking-category-incorrect&#039;],&lt;br /&gt;
			self.title.text&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
	if self:isTemplateProtectedNonTemplate() then&lt;br /&gt;
		ret[#ret + 1] = makeCategoryLink(&lt;br /&gt;
			msg[&#039;tracking-category-template&#039;],&lt;br /&gt;
			self.title.text&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(ret)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Blurb class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local Blurb = {}&lt;br /&gt;
Blurb.__index = Blurb&lt;br /&gt;
&lt;br /&gt;
Blurb.bannerTextFields = {&lt;br /&gt;
	text = true,&lt;br /&gt;
	explanation = true,&lt;br /&gt;
	tooltip = true,&lt;br /&gt;
	alt = true,&lt;br /&gt;
	link = true&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function Blurb.new(protectionObj, args, cfg)&lt;br /&gt;
	return setmetatable({&lt;br /&gt;
		_cfg = cfg,&lt;br /&gt;
		_protectionObj = protectionObj,&lt;br /&gt;
		_args = args&lt;br /&gt;
	}, Blurb)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Private methods --&lt;br /&gt;
&lt;br /&gt;
function Blurb:_formatDate(num)&lt;br /&gt;
	-- Formats a Unix timestamp into dd Month, YYYY format.&lt;br /&gt;
	lang = lang or mw.language.getContentLanguage()&lt;br /&gt;
	local success, date = pcall(&lt;br /&gt;
		lang.formatDate,&lt;br /&gt;
		lang,&lt;br /&gt;
		self._cfg.msg[&#039;expiry-date-format&#039;] or &#039;j F Y&#039;,&lt;br /&gt;
		&#039;@&#039; .. tostring(num)&lt;br /&gt;
	)&lt;br /&gt;
	if success then&lt;br /&gt;
		return date&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_getExpandedMessage(msgKey)&lt;br /&gt;
	return self:_substituteParameters(self._cfg.msg[msgKey])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_substituteParameters(msg)&lt;br /&gt;
	if not self._params then&lt;br /&gt;
		local parameterFuncs = {}&lt;br /&gt;
&lt;br /&gt;
		parameterFuncs.CURRENTVERSION     = self._makeCurrentVersionParameter&lt;br /&gt;
		parameterFuncs.EDITREQUEST        = self._makeEditRequestParameter&lt;br /&gt;
		parameterFuncs.EXPIRY             = self._makeExpiryParameter&lt;br /&gt;
		parameterFuncs.EXPLANATIONBLURB   = self._makeExplanationBlurbParameter&lt;br /&gt;
		parameterFuncs.IMAGELINK          = self._makeImageLinkParameter&lt;br /&gt;
		parameterFuncs.INTROBLURB         = self._makeIntroBlurbParameter&lt;br /&gt;
		parameterFuncs.INTROFRAGMENT      = self._makeIntroFragmentParameter&lt;br /&gt;
		parameterFuncs.PAGETYPE           = self._makePagetypeParameter&lt;br /&gt;
		parameterFuncs.PROTECTIONBLURB    = self._makeProtectionBlurbParameter&lt;br /&gt;
		parameterFuncs.PROTECTIONDATE     = self._makeProtectionDateParameter&lt;br /&gt;
		parameterFuncs.PROTECTIONLEVEL    = self._makeProtectionLevelParameter&lt;br /&gt;
		parameterFuncs.PROTECTIONLOG      = self._makeProtectionLogParameter&lt;br /&gt;
		parameterFuncs.TALKPAGE           = self._makeTalkPageParameter&lt;br /&gt;
		parameterFuncs.TOOLTIPBLURB       = self._makeTooltipBlurbParameter&lt;br /&gt;
		parameterFuncs.TOOLTIPFRAGMENT    = self._makeTooltipFragmentParameter&lt;br /&gt;
		parameterFuncs.VANDAL             = self._makeVandalTemplateParameter&lt;br /&gt;
		&lt;br /&gt;
		self._params = setmetatable({}, {&lt;br /&gt;
			__index = function (t, k)&lt;br /&gt;
				local param&lt;br /&gt;
				if parameterFuncs[k] then&lt;br /&gt;
					param = parameterFuncs[k](self)&lt;br /&gt;
				end&lt;br /&gt;
				param = param or &#039;&#039;&lt;br /&gt;
				t[k] = param&lt;br /&gt;
				return param&lt;br /&gt;
			end&lt;br /&gt;
		})&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	msg = msg:gsub(&#039;${(%u+)}&#039;, self._params)&lt;br /&gt;
	return msg&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeCurrentVersionParameter()&lt;br /&gt;
	-- A link to the page history or the move log, depending on the kind of&lt;br /&gt;
	-- protection.&lt;br /&gt;
	local pagename = self._protectionObj.title.prefixedText&lt;br /&gt;
	if self._protectionObj.action == &#039;move&#039; then&lt;br /&gt;
		-- We need the move log link.&lt;br /&gt;
		return makeFullUrl(&lt;br /&gt;
			&#039;Special:Log&#039;,&lt;br /&gt;
			{type = &#039;move&#039;, page = pagename},&lt;br /&gt;
			self:_getExpandedMessage(&#039;current-version-move-display&#039;)&lt;br /&gt;
		)&lt;br /&gt;
	else&lt;br /&gt;
		-- We need the history link.&lt;br /&gt;
		return makeFullUrl(&lt;br /&gt;
			pagename,&lt;br /&gt;
			{action = &#039;history&#039;},&lt;br /&gt;
			self:_getExpandedMessage(&#039;current-version-edit-display&#039;)&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeEditRequestParameter()&lt;br /&gt;
	local mEditRequest = require(&#039;Module:Submit an edit request&#039;)&lt;br /&gt;
	local action = self._protectionObj.action&lt;br /&gt;
	local level = self._protectionObj.level&lt;br /&gt;
	&lt;br /&gt;
	-- Get the edit request type.&lt;br /&gt;
	local requestType&lt;br /&gt;
	if action == &#039;edit&#039; then&lt;br /&gt;
		if level == &#039;autoconfirmed&#039; then&lt;br /&gt;
			requestType = &#039;semi&#039;&lt;br /&gt;
		elseif level == &#039;extendedconfirmed&#039; then&lt;br /&gt;
			requestType = &#039;extended&#039;&lt;br /&gt;
		elseif level == &#039;templateeditor&#039; then&lt;br /&gt;
			requestType = &#039;template&#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	requestType = requestType or &#039;full&#039;&lt;br /&gt;
	&lt;br /&gt;
	-- Get the display value.&lt;br /&gt;
	local display = self:_getExpandedMessage(&#039;edit-request-display&#039;)&lt;br /&gt;
&lt;br /&gt;
	return mEditRequest._link{type = requestType, display = display}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeExpiryParameter()&lt;br /&gt;
	local expiry = self._protectionObj.expiry&lt;br /&gt;
	if type(expiry) == &#039;number&#039; then&lt;br /&gt;
		return self:_formatDate(expiry)&lt;br /&gt;
	else&lt;br /&gt;
		return expiry&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeExplanationBlurbParameter()&lt;br /&gt;
	-- Cover special cases first.&lt;br /&gt;
	if self._protectionObj.title.namespace == 8 then&lt;br /&gt;
		-- MediaWiki namespace&lt;br /&gt;
		return self:_getExpandedMessage(&#039;explanation-blurb-nounprotect&#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Get explanation blurb table keys&lt;br /&gt;
	local action = self._protectionObj.action&lt;br /&gt;
	local level = self._protectionObj.level&lt;br /&gt;
	local talkKey = self._protectionObj.title.isTalkPage and &#039;talk&#039; or &#039;subject&#039;&lt;br /&gt;
&lt;br /&gt;
	-- Find the message in the explanation blurb table and substitute any&lt;br /&gt;
	-- parameters.&lt;br /&gt;
	local explanations = self._cfg.explanationBlurbs&lt;br /&gt;
	local msg&lt;br /&gt;
	if explanations[action][level] and explanations[action][level][talkKey] then&lt;br /&gt;
		msg = explanations[action][level][talkKey]&lt;br /&gt;
	elseif explanations[action][level] and explanations[action][level].default then&lt;br /&gt;
		msg = explanations[action][level].default&lt;br /&gt;
	elseif explanations[action].default and explanations[action].default[talkKey] then&lt;br /&gt;
		msg = explanations[action].default[talkKey]&lt;br /&gt;
	elseif explanations[action].default and explanations[action].default.default then&lt;br /&gt;
		msg = explanations[action].default.default&lt;br /&gt;
	else&lt;br /&gt;
		error(string.format(&lt;br /&gt;
			&#039;could not find explanation blurb for action &amp;quot;%s&amp;quot;, level &amp;quot;%s&amp;quot; and talk key &amp;quot;%s&amp;quot;&#039;,&lt;br /&gt;
			action,&lt;br /&gt;
			level,&lt;br /&gt;
			talkKey&lt;br /&gt;
		), 8)&lt;br /&gt;
	end&lt;br /&gt;
	return self:_substituteParameters(msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeImageLinkParameter()&lt;br /&gt;
	local imageLinks = self._cfg.imageLinks&lt;br /&gt;
	local action = self._protectionObj.action&lt;br /&gt;
	local level = self._protectionObj.level&lt;br /&gt;
	local msg&lt;br /&gt;
	if imageLinks[action][level] then&lt;br /&gt;
		msg = imageLinks[action][level]&lt;br /&gt;
	elseif imageLinks[action].default then&lt;br /&gt;
		msg = imageLinks[action].default&lt;br /&gt;
	else&lt;br /&gt;
		msg = imageLinks.edit.default&lt;br /&gt;
	end&lt;br /&gt;
	return self:_substituteParameters(msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeIntroBlurbParameter()&lt;br /&gt;
	if self._protectionObj:isTemporary() then&lt;br /&gt;
		return self:_getExpandedMessage(&#039;intro-blurb-expiry&#039;)&lt;br /&gt;
	else&lt;br /&gt;
		return self:_getExpandedMessage(&#039;intro-blurb-noexpiry&#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeIntroFragmentParameter()&lt;br /&gt;
	if self._protectionObj:isTemporary() then&lt;br /&gt;
		return self:_getExpandedMessage(&#039;intro-fragment-expiry&#039;)&lt;br /&gt;
	else&lt;br /&gt;
		return self:_getExpandedMessage(&#039;intro-fragment-noexpiry&#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makePagetypeParameter()&lt;br /&gt;
	local pagetypes = self._cfg.pagetypes&lt;br /&gt;
	return pagetypes[self._protectionObj.title.namespace]&lt;br /&gt;
		or pagetypes.default&lt;br /&gt;
		or error(&#039;no default pagetype defined&#039;, 8)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeProtectionBlurbParameter()&lt;br /&gt;
	local protectionBlurbs = self._cfg.protectionBlurbs&lt;br /&gt;
	local action = self._protectionObj.action&lt;br /&gt;
	local level = self._protectionObj.level&lt;br /&gt;
	local msg&lt;br /&gt;
	if protectionBlurbs[action][level] then&lt;br /&gt;
		msg = protectionBlurbs[action][level]&lt;br /&gt;
	elseif protectionBlurbs[action].default then&lt;br /&gt;
		msg = protectionBlurbs[action].default&lt;br /&gt;
	elseif protectionBlurbs.edit.default then&lt;br /&gt;
		msg = protectionBlurbs.edit.default&lt;br /&gt;
	else&lt;br /&gt;
		error(&#039;no protection blurb defined for protectionBlurbs.edit.default&#039;, 8)&lt;br /&gt;
	end&lt;br /&gt;
	return self:_substituteParameters(msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeProtectionDateParameter()&lt;br /&gt;
	local protectionDate = self._protectionObj.protectionDate&lt;br /&gt;
	if type(protectionDate) == &#039;number&#039; then&lt;br /&gt;
		return self:_formatDate(protectionDate)&lt;br /&gt;
	else&lt;br /&gt;
		return protectionDate&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeProtectionLevelParameter()&lt;br /&gt;
	local protectionLevels = self._cfg.protectionLevels&lt;br /&gt;
	local action = self._protectionObj.action&lt;br /&gt;
	local level = self._protectionObj.level&lt;br /&gt;
	local msg&lt;br /&gt;
	if protectionLevels[action][level] then&lt;br /&gt;
		msg = protectionLevels[action][level]&lt;br /&gt;
	elseif protectionLevels[action].default then&lt;br /&gt;
		msg = protectionLevels[action].default&lt;br /&gt;
	elseif protectionLevels.edit.default then&lt;br /&gt;
		msg = protectionLevels.edit.default&lt;br /&gt;
	else&lt;br /&gt;
		error(&#039;no protection level defined for protectionLevels.edit.default&#039;, 8)&lt;br /&gt;
	end&lt;br /&gt;
	return self:_substituteParameters(msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeProtectionLogParameter()&lt;br /&gt;
	local pagename = self._protectionObj.title.prefixedText&lt;br /&gt;
	if self._protectionObj.action == &#039;autoreview&#039; then&lt;br /&gt;
		-- We need the pending changes log.&lt;br /&gt;
		return makeFullUrl(&lt;br /&gt;
			&#039;Special:Log&#039;,&lt;br /&gt;
			{type = &#039;stable&#039;, page = pagename},&lt;br /&gt;
			self:_getExpandedMessage(&#039;pc-log-display&#039;)&lt;br /&gt;
		)&lt;br /&gt;
	else&lt;br /&gt;
		-- We need the protection log.&lt;br /&gt;
		return makeFullUrl(&lt;br /&gt;
			&#039;Special:Log&#039;,&lt;br /&gt;
			{type = &#039;protect&#039;, page = pagename},&lt;br /&gt;
			self:_getExpandedMessage(&#039;protection-log-display&#039;)&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeTalkPageParameter()&lt;br /&gt;
	return string.format(&lt;br /&gt;
		&#039;[[%s:%s#%s|%s]]&#039;,&lt;br /&gt;
		mw.site.namespaces[self._protectionObj.title.namespace].talk.name,&lt;br /&gt;
		self._protectionObj.title.text,&lt;br /&gt;
		self._args.section or &#039;top&#039;,&lt;br /&gt;
		self:_getExpandedMessage(&#039;talk-page-link-display&#039;)&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeTooltipBlurbParameter()&lt;br /&gt;
	if self._protectionObj:isTemporary() then&lt;br /&gt;
		return self:_getExpandedMessage(&#039;tooltip-blurb-expiry&#039;)&lt;br /&gt;
	else&lt;br /&gt;
		return self:_getExpandedMessage(&#039;tooltip-blurb-noexpiry&#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeTooltipFragmentParameter()&lt;br /&gt;
	if self._protectionObj:isTemporary() then&lt;br /&gt;
		return self:_getExpandedMessage(&#039;tooltip-fragment-expiry&#039;)&lt;br /&gt;
	else&lt;br /&gt;
		return self:_getExpandedMessage(&#039;tooltip-fragment-noexpiry&#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Blurb:_makeVandalTemplateParameter()&lt;br /&gt;
	return mw.getCurrentFrame():expandTemplate{&lt;br /&gt;
		title=&amp;quot;vandal-m&amp;quot;,&lt;br /&gt;
		args={self._args.user or self._protectionObj.title.baseText}&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Public methods --&lt;br /&gt;
&lt;br /&gt;
function Blurb:makeBannerText(key)&lt;br /&gt;
	-- Validate input.&lt;br /&gt;
	if not key or not Blurb.bannerTextFields[key] then&lt;br /&gt;
		error(string.format(&lt;br /&gt;
			&#039;&amp;quot;%s&amp;quot; is not a valid banner config field&#039;,&lt;br /&gt;
			tostring(key)&lt;br /&gt;
		), 2)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Generate the text.&lt;br /&gt;
	local msg = self._protectionObj.bannerConfig[key]&lt;br /&gt;
	if type(msg) == &#039;string&#039; then&lt;br /&gt;
		return self:_substituteParameters(msg)&lt;br /&gt;
	elseif type(msg) == &#039;function&#039; then&lt;br /&gt;
		msg = msg(self._protectionObj, self._args)&lt;br /&gt;
		if type(msg) ~= &#039;string&#039; then&lt;br /&gt;
			error(string.format(&lt;br /&gt;
				&#039;bad output from banner config function with key &amp;quot;%s&amp;quot;&#039;&lt;br /&gt;
					.. &#039; (expected string, got %s)&#039;,&lt;br /&gt;
				tostring(key),&lt;br /&gt;
				type(msg)&lt;br /&gt;
			), 4)&lt;br /&gt;
		end&lt;br /&gt;
		return self:_substituteParameters(msg)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- BannerTemplate class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local BannerTemplate = {}&lt;br /&gt;
BannerTemplate.__index = BannerTemplate&lt;br /&gt;
&lt;br /&gt;
function BannerTemplate.new(protectionObj, cfg)&lt;br /&gt;
	local obj = {}&lt;br /&gt;
	obj._cfg = cfg&lt;br /&gt;
&lt;br /&gt;
	-- Set the image filename.&lt;br /&gt;
	local imageFilename = protectionObj.bannerConfig.image&lt;br /&gt;
	if imageFilename then&lt;br /&gt;
		obj._imageFilename = imageFilename&lt;br /&gt;
	else&lt;br /&gt;
		-- If an image filename isn&#039;t specified explicitly in the banner config,&lt;br /&gt;
		-- generate it from the protection status and the namespace.&lt;br /&gt;
		local action = protectionObj.action&lt;br /&gt;
		local level = protectionObj.level&lt;br /&gt;
		local namespace = protectionObj.title.namespace&lt;br /&gt;
		local reason = protectionObj.reason&lt;br /&gt;
		&lt;br /&gt;
		-- Deal with special cases first.&lt;br /&gt;
		if (&lt;br /&gt;
			namespace == 10&lt;br /&gt;
			or namespace == 828&lt;br /&gt;
			or reason and obj._cfg.indefImageReasons[reason]&lt;br /&gt;
			)&lt;br /&gt;
			and action == &#039;edit&#039;&lt;br /&gt;
			and level == &#039;sysop&#039;&lt;br /&gt;
			and not protectionObj:isTemporary()&lt;br /&gt;
		then&lt;br /&gt;
			-- Fully protected modules and templates get the special red &amp;quot;indef&amp;quot;&lt;br /&gt;
			-- padlock.&lt;br /&gt;
			obj._imageFilename = obj._cfg.msg[&#039;image-filename-indef&#039;]&lt;br /&gt;
		else&lt;br /&gt;
			-- Deal with regular protection types.&lt;br /&gt;
			local images = obj._cfg.images&lt;br /&gt;
			if images[action] then&lt;br /&gt;
				if images[action][level] then&lt;br /&gt;
					obj._imageFilename = images[action][level]&lt;br /&gt;
				elseif images[action].default then&lt;br /&gt;
					obj._imageFilename = images[action].default&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return setmetatable(obj, BannerTemplate)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function BannerTemplate:renderImage()&lt;br /&gt;
	local filename = self._imageFilename&lt;br /&gt;
		or self._cfg.msg[&#039;image-filename-default&#039;]&lt;br /&gt;
		or &#039;Transparent.gif&#039;&lt;br /&gt;
	return makeFileLink{&lt;br /&gt;
		file = filename,&lt;br /&gt;
		size = (self.imageWidth or 20) .. &#039;px&#039;,&lt;br /&gt;
		alt = self._imageAlt,&lt;br /&gt;
		link = self._imageLink,&lt;br /&gt;
		caption = self.imageCaption&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Banner class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local Banner = setmetatable({}, BannerTemplate)&lt;br /&gt;
Banner.__index = Banner&lt;br /&gt;
&lt;br /&gt;
function Banner.new(protectionObj, blurbObj, cfg)&lt;br /&gt;
	local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn&#039;t need the blurb.&lt;br /&gt;
	obj.imageWidth = 40&lt;br /&gt;
	obj.imageCaption = blurbObj:makeBannerText(&#039;alt&#039;) -- Large banners use the alt text for the tooltip.&lt;br /&gt;
	obj._reasonText = blurbObj:makeBannerText(&#039;text&#039;)&lt;br /&gt;
	obj._explanationText = blurbObj:makeBannerText(&#039;explanation&#039;)&lt;br /&gt;
	obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.&lt;br /&gt;
	return setmetatable(obj, Banner)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Banner:__tostring()&lt;br /&gt;
	-- Renders the banner.&lt;br /&gt;
	makeMessageBox = makeMessageBox or require(&#039;Module:Message box&#039;).main&lt;br /&gt;
	local reasonText = self._reasonText or error(&#039;no reason text set&#039;, 2)&lt;br /&gt;
	local explanationText = self._explanationText&lt;br /&gt;
	local mbargs = {&lt;br /&gt;
		page = self._page,&lt;br /&gt;
		type = &#039;protection&#039;,&lt;br /&gt;
		image = self:renderImage(),&lt;br /&gt;
		text = string.format(&lt;br /&gt;
			&amp;quot;&#039;&#039;&#039;%s&#039;&#039;&#039;%s&amp;quot;,&lt;br /&gt;
			reasonText,&lt;br /&gt;
			explanationText and &#039;&amp;lt;br /&amp;gt;&#039; .. explanationText or &#039;&#039;&lt;br /&gt;
		)&lt;br /&gt;
	}&lt;br /&gt;
	return makeMessageBox(&#039;mbox&#039;, mbargs)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Padlock class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local Padlock = setmetatable({}, BannerTemplate)&lt;br /&gt;
Padlock.__index = Padlock&lt;br /&gt;
&lt;br /&gt;
function Padlock.new(protectionObj, blurbObj, cfg)&lt;br /&gt;
	local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn&#039;t need the blurb.&lt;br /&gt;
	obj.imageWidth = 20&lt;br /&gt;
	obj.imageCaption = blurbObj:makeBannerText(&#039;tooltip&#039;)&lt;br /&gt;
	obj._imageAlt = blurbObj:makeBannerText(&#039;alt&#039;)&lt;br /&gt;
	obj._imageLink = blurbObj:makeBannerText(&#039;link&#039;)&lt;br /&gt;
	obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]&lt;br /&gt;
		or cfg.padlockIndicatorNames.default&lt;br /&gt;
		or &#039;pp-default&#039;&lt;br /&gt;
	return setmetatable(obj, Padlock)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Padlock:__tostring()&lt;br /&gt;
	local frame = mw.getCurrentFrame()&lt;br /&gt;
	-- The nowiki tag helps prevent whitespace at the top of articles.&lt;br /&gt;
	return frame:extensionTag{name = &#039;nowiki&#039;} .. frame:extensionTag{&lt;br /&gt;
		name = &#039;indicator&#039;,&lt;br /&gt;
		args = {name = self._indicatorName},&lt;br /&gt;
		content = self:renderImage()&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Exports&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p._exportClasses()&lt;br /&gt;
	-- This is used for testing purposes.&lt;br /&gt;
	return {&lt;br /&gt;
		Protection = Protection,&lt;br /&gt;
		Blurb = Blurb,&lt;br /&gt;
		BannerTemplate = BannerTemplate,&lt;br /&gt;
		Banner = Banner,&lt;br /&gt;
		Padlock = Padlock,&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args, cfg, title)&lt;br /&gt;
	args = args or {}&lt;br /&gt;
	cfg = cfg or require(CONFIG_MODULE)&lt;br /&gt;
&lt;br /&gt;
	local protectionObj = Protection.new(args, cfg, title)&lt;br /&gt;
&lt;br /&gt;
	local ret = {}&lt;br /&gt;
&lt;br /&gt;
	-- If a page&#039;s edit protection is equally or more restrictive than its&lt;br /&gt;
	-- protection from some other action, then don&#039;t bother displaying anything&lt;br /&gt;
	-- for the other action (except categories).&lt;br /&gt;
	if not yesno(args.catonly) and (protectionObj.action == &#039;edit&#039; or&lt;br /&gt;
		args.demolevel or&lt;br /&gt;
		not getReachableNodes(&lt;br /&gt;
			cfg.hierarchy,&lt;br /&gt;
			protectionObj.level&lt;br /&gt;
		)[effectiveProtectionLevel(&#039;edit&#039;, protectionObj.title)])&lt;br /&gt;
	then&lt;br /&gt;
		-- Initialise the blurb object&lt;br /&gt;
		local blurbObj = Blurb.new(protectionObj, args, cfg)&lt;br /&gt;
	&lt;br /&gt;
		-- Render the banner&lt;br /&gt;
		if protectionObj:shouldShowLock() then&lt;br /&gt;
			ret[#ret + 1] = tostring(&lt;br /&gt;
				(yesno(args.small) and Padlock or Banner)&lt;br /&gt;
				.new(protectionObj, blurbObj, cfg)&lt;br /&gt;
			)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Render the categories&lt;br /&gt;
	if yesno(args.category) ~= false then&lt;br /&gt;
		ret[#ret + 1] = protectionObj:makeCategoryLinks()&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- For arbitration enforcement, flagging [[WP:PIA]] pages to enable [[Special:AbuseFilter/1339]] to flag edits to them&lt;br /&gt;
	if protectionObj.level == &amp;quot;extendedconfirmed&amp;quot; then&lt;br /&gt;
		if require(&amp;quot;Module:TableTools&amp;quot;).inArray(protectionObj.title.talkPageTitle.categories, &amp;quot;Wikipedia pages subject to the extended confirmed restriction related to the Arab-Israeli conflict&amp;quot;) then&lt;br /&gt;
			ret[#ret + 1] = &amp;quot;&amp;lt;p class=&#039;PIA-flag&#039; style=&#039;display:none; visibility:hidden;&#039; title=&#039;This page is subject to the extended confirmed restriction related to the Arab-Israeli conflict.&#039;&amp;gt;&amp;lt;/p&amp;gt;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.concat(ret)	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame, cfg)&lt;br /&gt;
	cfg = cfg or require(CONFIG_MODULE)&lt;br /&gt;
&lt;br /&gt;
	-- Find default args, if any.&lt;br /&gt;
	local parent = frame.getParent and frame:getParent()&lt;br /&gt;
	local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub(&#039;/sandbox$&#039;, &#039;&#039;)]&lt;br /&gt;
&lt;br /&gt;
	-- Find user args, and use the parent frame if we are being called from a&lt;br /&gt;
	-- wrapper template.&lt;br /&gt;
	getArgs = getArgs or require(&#039;Module:Arguments&#039;).getArgs&lt;br /&gt;
	local userArgs = getArgs(frame, {&lt;br /&gt;
		parentOnly = defaultArgs,&lt;br /&gt;
		frameOnly = not defaultArgs&lt;br /&gt;
	})&lt;br /&gt;
&lt;br /&gt;
	-- Build the args table. User-specified args overwrite default args.&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for k, v in pairs(defaultArgs or {}) do&lt;br /&gt;
		args[k] = v&lt;br /&gt;
	end&lt;br /&gt;
	for k, v in pairs(userArgs) do&lt;br /&gt;
		args[k] = v&lt;br /&gt;
	end&lt;br /&gt;
	return p._main(args, cfg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:2&amp;diff=599</id>
		<title>Template:2</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:2&amp;diff=599"/>
		<updated>2025-08-09T18:51:28Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#DD7733;&amp;quot;&amp;gt;&#039;&#039;&#039;Unexpected use of template &amp;lt;nowiki&amp;gt;{{2}}&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; - see [[Template:2]] for details.&amp;lt;/span&amp;gt;&amp;lt;includeonly&amp;gt;[[Category:Templates with incorrect parameter syntax]]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation|content={{Single digit documentation|2}}}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:1&amp;diff=598</id>
		<title>Template:1</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:1&amp;diff=598"/>
		<updated>2025-08-09T18:51:18Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;span style=&amp;quot;color:#DD7733;&amp;quot;&amp;gt;&#039;&#039;&#039;Unexpected use of template &amp;lt;nowiki&amp;gt;{{1}}&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; - see [[Template:1]] for details.&amp;lt;/span&amp;gt;&amp;lt;includeonly&amp;gt;[[Category:Templates with incorrect parameter syntax]]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Main&amp;diff=597</id>
		<title>Template:Main</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Main&amp;diff=597"/>
		<updated>2025-08-09T18:51:08Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Lua_call&amp;diff=596</id>
		<title>Module:Lua call</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Lua_call&amp;diff=596"/>
		<updated>2025-08-09T18:50:58Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require[[strict]]&lt;br /&gt;
local p={}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
    local parent = frame.getParent(frame) or {}&lt;br /&gt;
    local explist = {}&lt;br /&gt;
    local fnname, varlist&lt;br /&gt;
    local vars = {}&lt;br /&gt;
    for k, v in pairs(_G) do&lt;br /&gt;
        vars[k] = v -- transfer every global directly to our variable table&lt;br /&gt;
    end&lt;br /&gt;
    for k, v in pairs(parent.args or {}) do&lt;br /&gt;
        vars[k] = tonumber(v) or v -- transfer every parameter directly to our variable table&lt;br /&gt;
    end&lt;br /&gt;
    for k, v in pairs(frame.args or {}) do&lt;br /&gt;
        vars[k] = tonumber(v) or v -- transfer every parameter directly to our variable table&lt;br /&gt;
    end&lt;br /&gt;
     --- Alas Scribunto does NOT implement coroutines, according to&lt;br /&gt;
     --- https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#string.format&lt;br /&gt;
     --- this will not stop us from trying to implement one single lousy function call&lt;br /&gt;
    if vars[1] then&lt;br /&gt;
        fnname, varlist = mw.ustring.match(vars[1], &amp;quot;^%s*(%a[^%s%(]*)%(([^%)]*)%)%s*$&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    if varlist then&lt;br /&gt;
        local expn = 0&lt;br /&gt;
        repeat&lt;br /&gt;
            expn = expn + 1&lt;br /&gt;
            explist[expn] = vars[mw.ustring.match(varlist, &amp;quot;([^%,]+)&amp;quot;)]&lt;br /&gt;
            varlist = mw.ustring.match(varlist, &amp;quot;[^%,]+,(.*)$&amp;quot;)&lt;br /&gt;
        until not varlist&lt;br /&gt;
    end&lt;br /&gt;
    local scopetab = vars&lt;br /&gt;
    while mw.ustring.match(fnname, &amp;quot;%.&amp;quot;) do&lt;br /&gt;
        local scopekey&lt;br /&gt;
        scopekey, fnname = mw.ustring.match(fnname, &amp;quot;^(%a[^%.]*)%.(.*)$&amp;quot;)&lt;br /&gt;
        scopetab = scopetab[scopekey]&lt;br /&gt;
    end&lt;br /&gt;
    local fn = scopetab[fnname]&lt;br /&gt;
    if type(fn) ~= &amp;quot;function&amp;quot; then --XXX: What about callable tables?&lt;br /&gt;
        return tostring(fn)&lt;br /&gt;
    else &lt;br /&gt;
    	local output = {fn(unpack(explist))}&lt;br /&gt;
        return output[vars.reserved_return or 1]&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function tonumberOrString(v)&lt;br /&gt;
	return tonumber(v) or v:gsub(&amp;quot;^\\&amp;quot;, &amp;quot;&amp;quot;, 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function callWithTonumberOrStringOnPairs(f, ...)&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for _, v in ... do&lt;br /&gt;
		table.insert(args, tonumberOrString(v))&lt;br /&gt;
	end&lt;br /&gt;
	return (f(unpack(args)))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- ipairsAtOffset&lt;br /&gt;
&lt;br /&gt;
-- This is an iterator for arrays. It can be used like ipairs, but with&lt;br /&gt;
-- specified i as first index to iterate. i is an offset from 1&lt;br /&gt;
--&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
local function ipairsAtOffset(t, i)&lt;br /&gt;
	local f, s, i0 = ipairs(t)&lt;br /&gt;
	return f, s, i0+i&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get(s)&lt;br /&gt;
	local G = _G; for _ in mw.text.gsplit(&lt;br /&gt;
		mw.text.trim(s, &#039;%s&#039;), &#039;%s*%.%s*&#039;&lt;br /&gt;
	) do&lt;br /&gt;
		G = G[_]&lt;br /&gt;
	end&lt;br /&gt;
	return G&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- call&lt;br /&gt;
--&lt;br /&gt;
-- This function is usually useful for debugging template parameters.&lt;br /&gt;
-- Prefix parameter with backslash (\) to force interpreting parameter as string.&lt;br /&gt;
-- The leading backslash will be removed before passed to Lua function.&lt;br /&gt;
--&lt;br /&gt;
-- Example:&lt;br /&gt;
--    {{#invoke:Lua call|call|mw.log|a|1|2|3}} will return results of mw.log(&#039;a&#039;, 1, 2, 3)&lt;br /&gt;
--    {{#invoke:Lua call|call|mw.logObject|\a|321|\321| \321 }} will return results of mw.logObject(&#039;a&#039;, 321, &#039;321&#039;, &#039; \\321 &#039;)&lt;br /&gt;
--&lt;br /&gt;
-- This example show the debugging to see which Unicode characters are allowed in template parameters,&lt;br /&gt;
--    {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0061}}}} return 97&lt;br /&gt;
--    {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0000}}}} return 65533&lt;br /&gt;
--    {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0001}}}} return 65533&lt;br /&gt;
--    {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0002}}}}}} return 0xfffd&lt;br /&gt;
--    {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x007e}}}}}} return 0x007e&lt;br /&gt;
--    {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x007f}}}}}} return 0x007f&lt;br /&gt;
--    {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0080}}}}}} return 0x0080&lt;br /&gt;
--    {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x00a0}}}}}} return 0x00a0&lt;br /&gt;
--&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function p.call(frame)&lt;br /&gt;
	return callWithTonumberOrStringOnPairs(get(frame.args[1]),&lt;br /&gt;
		ipairsAtOffset(frame.args, 1)&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--local TableTools = require(&#039;Module:TableTools&#039;)&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- get&lt;br /&gt;
--&lt;br /&gt;
-- Example:&lt;br /&gt;
--    {{#invoke:Lua call|get| math.pi }} will return value of math.pi&lt;br /&gt;
--    {{#invoke:Lua call|get|math|pi}} will return value of math.pi&lt;br /&gt;
--    {{#invoke:Lua call|get| math |pi}} will return value of _G[&#039; math &#039;].pi&lt;br /&gt;
--    {{#invoke:Lua call|get|_G| math.pi }} will return value of _G[&#039; math.pi &#039;]&lt;br /&gt;
--    {{#invoke:Lua call|get|obj.a.5.c}} will return value of obj.a[&#039;5&#039;].c&lt;br /&gt;
--    {{#invoke:Lua call|get|obj|a|5|c}} will return value of obj.a[5].c&lt;br /&gt;
--&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function p.get(frame)&lt;br /&gt;
	-- #frame.args always return 0, regardless of number of unnamed&lt;br /&gt;
	-- template parameters, so check manually instead&lt;br /&gt;
	if frame.args[2] == nil then&lt;br /&gt;
		-- not do tonumber() for this args style,&lt;br /&gt;
		-- always treat it as string,&lt;br /&gt;
		-- so &#039;obj.1&#039; will mean obj[&#039;1&#039;] rather obj[1]&lt;br /&gt;
		return get(frame.args[1])&lt;br /&gt;
	else&lt;br /&gt;
		local G = _G&lt;br /&gt;
		for _, v in ipairs(frame.args) do&lt;br /&gt;
			G = G[tonumberOrString(v)]&lt;br /&gt;
		end&lt;br /&gt;
		return G&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
-- invoke&lt;br /&gt;
--&lt;br /&gt;
-- This function is used by Template:Invoke&lt;br /&gt;
--&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
--]]&lt;br /&gt;
function p.invoke(frame)&lt;br /&gt;
	local pframe, usedpargs = frame:getParent(), {}&lt;br /&gt;
	-- get module and function names from parent args if not provided&lt;br /&gt;
	local pfargs = setmetatable({frame.args[1], frame.args[2]}, {__index = table})&lt;br /&gt;
	if not pfargs[1] then&lt;br /&gt;
		pfargs[1], usedpargs[1] = pframe.args[1], true&lt;br /&gt;
		if not pfargs[2] then&lt;br /&gt;
			pfargs[2], usedpargs[2] = pframe.args[2], true&lt;br /&gt;
		end&lt;br /&gt;
	elseif not pfargs[2] then&lt;br /&gt;
		pfargs[2], usedpargs[1] = pframe.args[1], true&lt;br /&gt;
	end&lt;br /&gt;
	-- repack sequential args&lt;br /&gt;
	for i, v in ipairs(pframe.args) do&lt;br /&gt;
		if not usedpargs[i] then&lt;br /&gt;
			pfargs:insert(v)&lt;br /&gt;
			usedpargs[i] = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- copy other args&lt;br /&gt;
	for k, v in pairs(pframe.args) do&lt;br /&gt;
		if not pfargs[k] and not usedpargs[k] then&lt;br /&gt;
			pfargs[k], usedpargs[k] = v, true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- #invoke off parent frame so the new frame has the same parent&lt;br /&gt;
	return pframe:callParserFunction{name = &#039;#invoke&#039;, args = pfargs}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Doc&amp;diff=595</id>
		<title>Template:Doc</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Doc&amp;diff=595"/>
		<updated>2025-08-09T18:50:48Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Documentation]]&lt;br /&gt;
{{rcat shell|&lt;br /&gt;
{{R from template shortcut}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Pp-template&amp;diff=594</id>
		<title>Template:Pp-template</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Pp-template&amp;diff=594"/>
		<updated>2025-08-09T18:50:38Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Protection banner|main}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Str_find&amp;diff=593</id>
		<title>Template:Str find</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Str_find&amp;diff=593"/>
		<updated>2025-08-09T18:50:28Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&amp;lt;includeonly&amp;gt;safesubst:&amp;lt;/includeonly&amp;gt;#invoke:String|str_find|source={{{1|}}}|{{{2|}}}}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Sfnref&amp;diff=592</id>
		<title>Template:Sfnref</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Sfnref&amp;diff=592"/>
		<updated>2025-08-09T18:50:18Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:SfnRef]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Sfnp&amp;diff=591</id>
		<title>Template:Sfnp</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Sfnp&amp;diff=591"/>
		<updated>2025-08-09T18:50:08Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Footnotes|sfn&lt;br /&gt;
|bracket_year_left = (&lt;br /&gt;
|bracket_year_right = )&lt;br /&gt;
|template=sfnp&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using sfn with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Sfnp]] with unknown parameter &amp;quot;_VALUE_&amp;quot;|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | ignore-err | at | loc | p | page | pages | postscript | pp | ps | ref | Ref | group}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Sfnmp&amp;diff=590</id>
		<title>Template:Sfnmp</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Sfnmp&amp;diff=590"/>
		<updated>2025-08-09T18:49:58Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Footnotes|sfnm&lt;br /&gt;
|bracket_year_left = (&lt;br /&gt;
|bracket_year_right = )&lt;br /&gt;
|template=sfnmp&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Sfnm&amp;diff=589</id>
		<title>Template:Sfnm</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Sfnm&amp;diff=589"/>
		<updated>2025-08-09T18:49:48Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Footnotes|sfnm|template=sfnm}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Invoke&amp;diff=588</id>
		<title>Template:Invoke</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Invoke&amp;diff=588"/>
		<updated>2025-08-09T18:49:38Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Lua call|invoke}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{Doc}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvtxt&amp;diff=587</id>
		<title>Template:Harvtxt</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvtxt&amp;diff=587"/>
		<updated>2025-08-09T18:49:28Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Template:Harvard citation text]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvnb&amp;diff=586</id>
		<title>Template:Harvnb</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvnb&amp;diff=586"/>
		<updated>2025-08-09T18:49:18Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Template:Harvard citation no brackets]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvcoltxt&amp;diff=585</id>
		<title>Template:Harvcoltxt</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvcoltxt&amp;diff=585"/>
		<updated>2025-08-09T18:49:08Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Harvard citation with colon text]]&lt;br /&gt;
&lt;br /&gt;
{{Redirect category shell|&lt;br /&gt;
{{R from move}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvcolnb&amp;diff=584</id>
		<title>Template:Harvcolnb</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvcolnb&amp;diff=584"/>
		<updated>2025-08-09T18:48:58Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Harvard citation with colon no brackets]]&lt;br /&gt;
&lt;br /&gt;
{{Redirect category shell|&lt;br /&gt;
{{R from move}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvcol&amp;diff=583</id>
		<title>Template:Harvcol</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvcol&amp;diff=583"/>
		<updated>2025-08-09T18:48:48Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Harvard citation with colon]]&lt;br /&gt;
&lt;br /&gt;
{{Redirect category shell|&lt;br /&gt;
{{R from move}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harv&amp;diff=582</id>
		<title>Template:Harv</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harv&amp;diff=582"/>
		<updated>2025-08-09T18:48:38Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Harvard citation]]&lt;br /&gt;
&lt;br /&gt;
{{pp-template|small=yes}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvp&amp;diff=581</id>
		<title>Template:Harvp</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvp&amp;diff=581"/>
		<updated>2025-08-09T18:48:28Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Harvard citation year brackets]]&lt;br /&gt;
&lt;br /&gt;
{{Redirect category shell|&lt;br /&gt;
{{R from move}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Harvard&amp;diff=580</id>
		<title>Template:Harvard</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Harvard&amp;diff=580"/>
		<updated>2025-08-09T18:48:18Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Harvard University]]&lt;br /&gt;
&lt;br /&gt;
{{R from move}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:String&amp;diff=579</id>
		<title>Module:String</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:String&amp;diff=579"/>
		<updated>2025-08-09T18:48:08Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[&lt;br /&gt;
&lt;br /&gt;
This module is intended to provide access to basic string functions.&lt;br /&gt;
&lt;br /&gt;
Most of the functions provided here can be invoked with named parameters,&lt;br /&gt;
unnamed parameters, or a mixture.  If named parameters are used, Mediawiki will&lt;br /&gt;
automatically remove any leading or trailing whitespace from the parameter.&lt;br /&gt;
Depending on the intended use, it may be advantageous to either preserve or&lt;br /&gt;
remove such whitespace.&lt;br /&gt;
&lt;br /&gt;
Global options&lt;br /&gt;
    ignore_errors: If set to &#039;true&#039; or 1, any error condition will result in&lt;br /&gt;
        an empty string being returned rather than an error message.&lt;br /&gt;
&lt;br /&gt;
    error_category: If an error occurs, specifies the name of a category to&lt;br /&gt;
        include with the error message.  The default category is&lt;br /&gt;
        [Category:Errors reported by Module String].&lt;br /&gt;
&lt;br /&gt;
    no_category: If set to &#039;true&#039; or 1, no category will be added if an error&lt;br /&gt;
        is generated.&lt;br /&gt;
&lt;br /&gt;
Unit tests for this module are available at Module:String/tests.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local str = {}&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
len&lt;br /&gt;
&lt;br /&gt;
This function returns the length of the target string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|len|target_string|}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|len|s=target_string}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string whose length to report&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the target string.&lt;br /&gt;
]]&lt;br /&gt;
function str.len( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, {&#039;s&#039;} )&lt;br /&gt;
	local s = new_args[&#039;s&#039;] or &#039;&#039;&lt;br /&gt;
	return mw.ustring.len( s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
sub&lt;br /&gt;
&lt;br /&gt;
This function returns a substring of the target string at specified indices.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|sub|target_string|start_index|end_index}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string to return a subset of&lt;br /&gt;
    i: The first index of the substring to return, defaults to 1.&lt;br /&gt;
    j: The last index of the string to return, defaults to the last character.&lt;br /&gt;
&lt;br /&gt;
The first character of the string is assigned an index of 1.  If either i or j&lt;br /&gt;
is a negative value, it is interpreted the same as selecting a character by&lt;br /&gt;
counting from the end of the string.  Hence, a value of -1 is the same as&lt;br /&gt;
selecting the last character of the string.&lt;br /&gt;
&lt;br /&gt;
If the requested indices are out of range for the given string, an error is&lt;br /&gt;
reported.&lt;br /&gt;
]]&lt;br /&gt;
function str.sub( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, { &#039;s&#039;, &#039;i&#039;, &#039;j&#039; } )&lt;br /&gt;
	local s = new_args[&#039;s&#039;] or &#039;&#039;&lt;br /&gt;
	local i = tonumber( new_args[&#039;i&#039;] ) or 1&lt;br /&gt;
	local j = tonumber( new_args[&#039;j&#039;] ) or -1&lt;br /&gt;
&lt;br /&gt;
	local len = mw.ustring.len( s )&lt;br /&gt;
&lt;br /&gt;
	-- Convert negatives for range checking&lt;br /&gt;
	if i &amp;lt; 0 then&lt;br /&gt;
		i = len + i + 1&lt;br /&gt;
	end&lt;br /&gt;
	if j &amp;lt; 0 then&lt;br /&gt;
		j = len + j + 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if i &amp;gt; len or j &amp;gt; len or i &amp;lt; 1 or j &amp;lt; 1 then&lt;br /&gt;
		return str._error( &#039;String subset index out of range&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	if j &amp;lt; i then&lt;br /&gt;
		return str._error( &#039;String subset indices out of order&#039; )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return mw.ustring.sub( s, i, j )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
This function implements that features of {{str sub old}} and is kept in order&lt;br /&gt;
to maintain these older templates.&lt;br /&gt;
]]&lt;br /&gt;
function str.sublength( frame )&lt;br /&gt;
	local i = tonumber( frame.args.i ) or 0&lt;br /&gt;
	local len = tonumber( frame.args.len )&lt;br /&gt;
	return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
_match&lt;br /&gt;
&lt;br /&gt;
This function returns a substring from the source string that matches a&lt;br /&gt;
specified pattern. It is exported for use in other modules&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
strmatch = require(&amp;quot;Module:String&amp;quot;)._match&lt;br /&gt;
sresult = strmatch( s, pattern, start, match, plain, nomatch )&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string to search&lt;br /&gt;
    pattern: The pattern or string to find within the string&lt;br /&gt;
    start: The index within the source string to start the search.  The first&lt;br /&gt;
        character of the string has index 1.  Defaults to 1.&lt;br /&gt;
    match: In some cases it may be possible to make multiple matches on a single&lt;br /&gt;
        string.  This specifies which match to return, where the first match is&lt;br /&gt;
        match= 1.  If a negative number is specified then a match is returned&lt;br /&gt;
        counting from the last match.  Hence match = -1 is the same as requesting&lt;br /&gt;
        the last match.  Defaults to 1.&lt;br /&gt;
    plain: A flag indicating that the pattern should be understood as plain&lt;br /&gt;
        text.  Defaults to false.&lt;br /&gt;
    nomatch: If no match is found, output the &amp;quot;nomatch&amp;quot; value rather than an error.&lt;br /&gt;
&lt;br /&gt;
For information on constructing Lua patterns, a form of [regular expression], see:&lt;br /&gt;
&lt;br /&gt;
* http://www.lua.org/manual/5.1/manual.html#5.4.1&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
-- This sub-routine is exported for use in other modules&lt;br /&gt;
function str._match( s, pattern, start, match_index, plain_flag, nomatch )&lt;br /&gt;
	if s == &#039;&#039; then&lt;br /&gt;
		return str._error( &#039;Target string is empty&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	if pattern == &#039;&#039; then&lt;br /&gt;
		return str._error( &#039;Pattern string is empty&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	start = tonumber(start) or 1&lt;br /&gt;
	if math.abs(start) &amp;lt; 1 or math.abs(start) &amp;gt; mw.ustring.len( s ) then&lt;br /&gt;
		return str._error( &#039;Requested start is out of range&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	if match_index == 0 then&lt;br /&gt;
		return str._error( &#039;Match index is out of range&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	if plain_flag then&lt;br /&gt;
		pattern = str._escapePattern( pattern )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result&lt;br /&gt;
	if match_index == 1 then&lt;br /&gt;
		-- Find first match is simple case&lt;br /&gt;
		result = mw.ustring.match( s, pattern, start )&lt;br /&gt;
	else&lt;br /&gt;
		if start &amp;gt; 1 then&lt;br /&gt;
			s = mw.ustring.sub( s, start )&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local iterator = mw.ustring.gmatch(s, pattern)&lt;br /&gt;
		if match_index &amp;gt; 0 then&lt;br /&gt;
			-- Forward search&lt;br /&gt;
			for w in iterator do&lt;br /&gt;
				match_index = match_index - 1&lt;br /&gt;
				if match_index == 0 then&lt;br /&gt;
					result = w&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- Reverse search&lt;br /&gt;
			local result_table = {}&lt;br /&gt;
			local count = 1&lt;br /&gt;
			for w in iterator do&lt;br /&gt;
				result_table[count] = w&lt;br /&gt;
				count = count + 1&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			result = result_table[ count + match_index ]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if result == nil then&lt;br /&gt;
		if nomatch == nil then&lt;br /&gt;
			return str._error( &#039;Match not found&#039; )&lt;br /&gt;
		else&lt;br /&gt;
			return nomatch&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
match&lt;br /&gt;
&lt;br /&gt;
This function returns a substring from the source string that matches a&lt;br /&gt;
specified pattern.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index&lt;br /&gt;
    |match=match_number|plain=plain_flag|nomatch=nomatch_output}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string to search&lt;br /&gt;
    pattern: The pattern or string to find within the string&lt;br /&gt;
    start: The index within the source string to start the search.  The first&lt;br /&gt;
        character of the string has index 1.  Defaults to 1.&lt;br /&gt;
    match: In some cases it may be possible to make multiple matches on a single&lt;br /&gt;
        string.  This specifies which match to return, where the first match is&lt;br /&gt;
        match= 1.  If a negative number is specified then a match is returned&lt;br /&gt;
        counting from the last match.  Hence match = -1 is the same as requesting&lt;br /&gt;
        the last match.  Defaults to 1.&lt;br /&gt;
    plain: A flag indicating that the pattern should be understood as plain&lt;br /&gt;
        text.  Defaults to false.&lt;br /&gt;
    nomatch: If no match is found, output the &amp;quot;nomatch&amp;quot; value rather than an error.&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from each string.  In some circumstances this is desirable, in&lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
If the match_number or start_index are out of range for the string being queried, then&lt;br /&gt;
this function generates an error.  An error is also generated if no match is found.&lt;br /&gt;
If one adds the parameter ignore_errors=true, then the error will be suppressed and&lt;br /&gt;
an empty string will be returned on any failure.&lt;br /&gt;
&lt;br /&gt;
For information on constructing Lua patterns, a form of [regular expression], see:&lt;br /&gt;
&lt;br /&gt;
* http://www.lua.org/manual/5.1/manual.html#5.4.1&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
-- This is the entry point for #invoke:String|match&lt;br /&gt;
function str.match( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, {&#039;s&#039;, &#039;pattern&#039;, &#039;start&#039;, &#039;match&#039;, &#039;plain&#039;, &#039;nomatch&#039;} )&lt;br /&gt;
	local s = new_args[&#039;s&#039;] or &#039;&#039;&lt;br /&gt;
	local start = tonumber( new_args[&#039;start&#039;] ) or 1&lt;br /&gt;
	local plain_flag = str._getBoolean( new_args[&#039;plain&#039;] or false )&lt;br /&gt;
	local pattern = new_args[&#039;pattern&#039;] or &#039;&#039;&lt;br /&gt;
	local match_index = math.floor( tonumber(new_args[&#039;match&#039;]) or 1 )&lt;br /&gt;
	local nomatch = new_args[&#039;nomatch&#039;]&lt;br /&gt;
&lt;br /&gt;
	return str._match( s, pattern, start, match_index, plain_flag, nomatch )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
pos&lt;br /&gt;
&lt;br /&gt;
This function returns a single character from the target string at position pos.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|pos|target_string|index_value}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|pos|target=target_string|pos=index_value}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    target: The string to search&lt;br /&gt;
    pos: The index for the character to return&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the target string.  In some circumstances this is desirable, in&lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
The first character has an index value of 1.&lt;br /&gt;
&lt;br /&gt;
If one requests a negative value, this function will select a character by counting backwards&lt;br /&gt;
from the end of the string.  In other words pos = -1 is the same as asking for the last character.&lt;br /&gt;
&lt;br /&gt;
A requested value of zero, or a value greater than the length of the string returns an error.&lt;br /&gt;
]]&lt;br /&gt;
function str.pos( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, {&#039;target&#039;, &#039;pos&#039;} )&lt;br /&gt;
	local target_str = new_args[&#039;target&#039;] or &#039;&#039;&lt;br /&gt;
	local pos = tonumber( new_args[&#039;pos&#039;] ) or 0&lt;br /&gt;
&lt;br /&gt;
	if pos == 0 or math.abs(pos) &amp;gt; mw.ustring.len( target_str ) then&lt;br /&gt;
		return str._error( &#039;String index out of range&#039; )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return mw.ustring.sub( target_str, pos, pos )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
str_find&lt;br /&gt;
&lt;br /&gt;
This function duplicates the behavior of {{str_find}}, including all of its quirks.&lt;br /&gt;
This is provided in order to support existing templates, but is NOT RECOMMENDED for&lt;br /&gt;
new code and templates.  New code is recommended to use the &amp;quot;find&amp;quot; function instead.&lt;br /&gt;
&lt;br /&gt;
Returns the first index in &amp;quot;source&amp;quot; that is a match to &amp;quot;target&amp;quot;.  Indexing is 1-based,&lt;br /&gt;
and the function returns -1 if the &amp;quot;target&amp;quot; string is not present in &amp;quot;source&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Important Note: If the &amp;quot;target&amp;quot; string is empty / missing, this function returns a&lt;br /&gt;
value of &amp;quot;1&amp;quot;, which is generally unexpected behavior, and must be accounted for&lt;br /&gt;
separatetly.&lt;br /&gt;
]]&lt;br /&gt;
function str.str_find( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, {&#039;source&#039;, &#039;target&#039;} )&lt;br /&gt;
	local source_str = new_args[&#039;source&#039;] or &#039;&#039;&lt;br /&gt;
	local target_str = new_args[&#039;target&#039;] or &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
	if target_str == &#039;&#039; then&lt;br /&gt;
		return 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local start = mw.ustring.find( source_str, target_str, 1, true )&lt;br /&gt;
	if start == nil then&lt;br /&gt;
		start = -1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return start&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
find&lt;br /&gt;
&lt;br /&gt;
This function allows one to search for a target string or pattern within another&lt;br /&gt;
string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    source: The string to search&lt;br /&gt;
    target: The string or pattern to find within source&lt;br /&gt;
    start: The index within the source string to start the search, defaults to 1&lt;br /&gt;
    plain: Boolean flag indicating that target should be understood as plain&lt;br /&gt;
        text and not as a Lua style regular expression, defaults to true&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the parameter.  In some circumstances this is desirable, in&lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
This function returns the first index &amp;gt;= &amp;quot;start&amp;quot; where &amp;quot;target&amp;quot; can be found&lt;br /&gt;
within &amp;quot;source&amp;quot;.  Indices are 1-based.  If &amp;quot;target&amp;quot; is not found, then this&lt;br /&gt;
function returns 0.  If either &amp;quot;source&amp;quot; or &amp;quot;target&amp;quot; are missing / empty, this&lt;br /&gt;
function also returns 0.&lt;br /&gt;
&lt;br /&gt;
This function should be safe for UTF-8 strings.&lt;br /&gt;
]]&lt;br /&gt;
function str.find( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, {&#039;source&#039;, &#039;target&#039;, &#039;start&#039;, &#039;plain&#039; } )&lt;br /&gt;
	local source_str = new_args[&#039;source&#039;] or &#039;&#039;&lt;br /&gt;
	local pattern = new_args[&#039;target&#039;] or &#039;&#039;&lt;br /&gt;
	local start_pos = tonumber(new_args[&#039;start&#039;]) or 1&lt;br /&gt;
	local plain = new_args[&#039;plain&#039;] or true&lt;br /&gt;
&lt;br /&gt;
	if source_str == &#039;&#039; or pattern == &#039;&#039; then&lt;br /&gt;
		return 0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	plain = str._getBoolean( plain )&lt;br /&gt;
&lt;br /&gt;
	local start = mw.ustring.find( source_str, pattern, start_pos, plain )&lt;br /&gt;
	if start == nil then&lt;br /&gt;
		start = 0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return start&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
replace&lt;br /&gt;
&lt;br /&gt;
This function allows one to replace a target string or pattern within another&lt;br /&gt;
string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|&lt;br /&gt;
   count=replacement_count|plain=plain_flag}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    source: The string to search&lt;br /&gt;
    pattern: The string or pattern to find within source&lt;br /&gt;
    replace: The replacement text&lt;br /&gt;
    count: The number of occurences to replace, defaults to all.&lt;br /&gt;
    plain: Boolean flag indicating that pattern should be understood as plain&lt;br /&gt;
        text and not as a Lua style regular expression, defaults to true&lt;br /&gt;
]]&lt;br /&gt;
function str.replace( frame )&lt;br /&gt;
	local new_args = str._getParameters( frame.args, {&#039;source&#039;, &#039;pattern&#039;, &#039;replace&#039;, &#039;count&#039;, &#039;plain&#039; } )&lt;br /&gt;
	local source_str = new_args[&#039;source&#039;] or &#039;&#039;&lt;br /&gt;
	local pattern = new_args[&#039;pattern&#039;] or &#039;&#039;&lt;br /&gt;
	local replace = new_args[&#039;replace&#039;] or &#039;&#039;&lt;br /&gt;
	local count = tonumber( new_args[&#039;count&#039;] )&lt;br /&gt;
	local plain = new_args[&#039;plain&#039;] or true&lt;br /&gt;
&lt;br /&gt;
	if source_str == &#039;&#039; or pattern == &#039;&#039; then&lt;br /&gt;
		return source_str&lt;br /&gt;
	end&lt;br /&gt;
	plain = str._getBoolean( plain )&lt;br /&gt;
&lt;br /&gt;
	if plain then&lt;br /&gt;
		pattern = str._escapePattern( pattern )&lt;br /&gt;
		replace = string.gsub( replace, &amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot; ) --Only need to escape replacement sequences.&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result&lt;br /&gt;
&lt;br /&gt;
	if count ~= nil then&lt;br /&gt;
		result = mw.ustring.gsub( source_str, pattern, replace, count )&lt;br /&gt;
	else&lt;br /&gt;
		result = mw.ustring.gsub( source_str, pattern, replace )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
    simple function to pipe string.rep to templates.&lt;br /&gt;
]]&lt;br /&gt;
function str.rep( frame )&lt;br /&gt;
	local repetitions = tonumber( frame.args[2] )&lt;br /&gt;
	if not repetitions then&lt;br /&gt;
		return str._error( &#039;function rep expects a number as second parameter, received &amp;quot;&#039; .. ( frame.args[2] or &#039;&#039; ) .. &#039;&amp;quot;&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	return string.rep( frame.args[1] or &#039;&#039;, repetitions )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
escapePattern&lt;br /&gt;
&lt;br /&gt;
This function escapes special characters from a Lua string pattern. See [1]&lt;br /&gt;
for details on how patterns work.&lt;br /&gt;
&lt;br /&gt;
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|escapePattern|pattern_string}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    pattern_string: The pattern string to escape.&lt;br /&gt;
]]&lt;br /&gt;
function str.escapePattern( frame )&lt;br /&gt;
	local pattern_str = frame.args[1]&lt;br /&gt;
	if not pattern_str then&lt;br /&gt;
		return str._error( &#039;No pattern string specified&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	local result = str._escapePattern( pattern_str )&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
count&lt;br /&gt;
This function counts the number of occurrences of one string in another.&lt;br /&gt;
]]&lt;br /&gt;
function str.count(frame)&lt;br /&gt;
	local args = str._getParameters(frame.args, {&#039;source&#039;, &#039;pattern&#039;, &#039;plain&#039;})&lt;br /&gt;
	local source = args.source or &#039;&#039;&lt;br /&gt;
	local pattern = args.pattern or &#039;&#039;&lt;br /&gt;
	local plain = str._getBoolean(args.plain or true)&lt;br /&gt;
	if plain then&lt;br /&gt;
		pattern = str._escapePattern(pattern)&lt;br /&gt;
	end&lt;br /&gt;
	local _, count = mw.ustring.gsub(source, pattern, &#039;&#039;)&lt;br /&gt;
	return count&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
endswith&lt;br /&gt;
This function determines whether a string ends with another string.&lt;br /&gt;
]]&lt;br /&gt;
function str.endswith(frame)&lt;br /&gt;
	local args = str._getParameters(frame.args, {&#039;source&#039;, &#039;pattern&#039;})&lt;br /&gt;
	local source = args.source or &#039;&#039;&lt;br /&gt;
	local pattern = args.pattern or &#039;&#039;&lt;br /&gt;
	if pattern == &#039;&#039; then&lt;br /&gt;
		-- All strings end with the empty string.&lt;br /&gt;
		return &amp;quot;yes&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then&lt;br /&gt;
		return &amp;quot;yes&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
join&lt;br /&gt;
&lt;br /&gt;
Join all non empty arguments together; the first argument is the separator.&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|join|sep|one|two|three}}&lt;br /&gt;
]]&lt;br /&gt;
function str.join(frame)&lt;br /&gt;
	local args = {}&lt;br /&gt;
	local sep&lt;br /&gt;
	for _, v in ipairs( frame.args ) do&lt;br /&gt;
		if sep then&lt;br /&gt;
			if v ~= &#039;&#039; then&lt;br /&gt;
				table.insert(args, v)&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			sep = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat( args, sep or &#039;&#039; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function that populates the argument list given that user may need to use a mix of&lt;br /&gt;
named and unnamed parameters.  This is relevant because named parameters are not&lt;br /&gt;
identical to unnamed parameters due to string trimming, and when dealing with strings&lt;br /&gt;
we sometimes want to either preserve or remove that whitespace depending on the application.&lt;br /&gt;
]]&lt;br /&gt;
function str._getParameters( frame_args, arg_list )&lt;br /&gt;
	local new_args = {}&lt;br /&gt;
	local index = 1&lt;br /&gt;
	local value&lt;br /&gt;
&lt;br /&gt;
	for _, arg in ipairs( arg_list ) do&lt;br /&gt;
		value = frame_args[arg]&lt;br /&gt;
		if value == nil then&lt;br /&gt;
			value = frame_args[index]&lt;br /&gt;
			index = index + 1&lt;br /&gt;
		end&lt;br /&gt;
		new_args[arg] = value&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return new_args&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function to handle error messages.&lt;br /&gt;
]]&lt;br /&gt;
function str._error( error_str )&lt;br /&gt;
	local frame = mw.getCurrentFrame()&lt;br /&gt;
	local error_category = frame.args.error_category or &#039;Errors reported by Module String&#039;&lt;br /&gt;
	local ignore_errors = frame.args.ignore_errors or false&lt;br /&gt;
	local no_category = frame.args.no_category or false&lt;br /&gt;
&lt;br /&gt;
	if str._getBoolean(ignore_errors) then&lt;br /&gt;
		return &#039;&#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local error_str = &#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;String Module Error: &#039; .. error_str .. &#039;&amp;lt;/strong&amp;gt;&#039;&lt;br /&gt;
	if error_category ~= &#039;&#039; and not str._getBoolean( no_category ) then&lt;br /&gt;
		error_str = &#039;[[Category:&#039; .. error_category .. &#039;]]&#039; .. error_str&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return error_str&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper Function to interpret boolean strings&lt;br /&gt;
]]&lt;br /&gt;
function str._getBoolean( boolean_str )&lt;br /&gt;
	local boolean_value&lt;br /&gt;
&lt;br /&gt;
	if type( boolean_str ) == &#039;string&#039; then&lt;br /&gt;
		boolean_str = boolean_str:lower()&lt;br /&gt;
		if boolean_str == &#039;false&#039; or boolean_str == &#039;no&#039; or boolean_str == &#039;0&#039;&lt;br /&gt;
				or boolean_str == &#039;&#039; then&lt;br /&gt;
			boolean_value = false&lt;br /&gt;
		else&lt;br /&gt;
			boolean_value = true&lt;br /&gt;
		end&lt;br /&gt;
	elseif type( boolean_str ) == &#039;boolean&#039; then&lt;br /&gt;
		boolean_value = boolean_str&lt;br /&gt;
	else&lt;br /&gt;
		error( &#039;No boolean value found&#039; )&lt;br /&gt;
	end&lt;br /&gt;
	return boolean_value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function that escapes all pattern characters so that they will be treated&lt;br /&gt;
as plain text.&lt;br /&gt;
]]&lt;br /&gt;
function str._escapePattern( pattern_str )&lt;br /&gt;
	return ( string.gsub( pattern_str, &amp;quot;[%(%)%.%%%+%-%*%?%[%^%$%]]&amp;quot;, &amp;quot;%%%0&amp;quot; ) )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return str&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Footnotes&amp;diff=578</id>
		<title>Module:Footnotes</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Footnotes&amp;diff=578"/>
		<updated>2025-08-09T18:47:58Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require(&#039;strict&#039;);&lt;br /&gt;
local getArgs = require (&#039;Module:Arguments&#039;).getArgs;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R G S _ D E F A U L T &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
a table to specify initial values.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local args_default = {&lt;br /&gt;
    group = &#039;&#039;,&lt;br /&gt;
	bracket_left = &#039;&#039;,&lt;br /&gt;
	bracket_right = &#039;&#039;,&lt;br /&gt;
	bracket_year_left = &#039;&#039;,&lt;br /&gt;
	bracket_year_right = &#039;&#039;,&lt;br /&gt;
	postscript = &#039;&#039;,&lt;br /&gt;
	page = &#039;&#039;,&lt;br /&gt;
	pages = &#039;&#039;,&lt;br /&gt;
	location = &#039;&#039;,&lt;br /&gt;
	page_sep = &amp;quot;, p.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
	pages_sep = &amp;quot;, pp.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
	ref = &#039;&#039;,&lt;br /&gt;
	template = &#039;harv&#039;,															-- if template name not provided in {{#invoke:}} use this&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T A R G E T _ C H E C K &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for anchor_id (CITEREF name-list and year or text from |ref=) in anchor_id_list&lt;br /&gt;
&lt;br /&gt;
the &#039;no target&#039; error may be suppressed with |ignore-err=yes when target cannot be found because target is inside&lt;br /&gt;
a template that wraps another template; &#039;multiple targets&#039; error may not be suppressed&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function target_check (anchor_id, args)&lt;br /&gt;
	local namespace = mw.title.getCurrentTitle().namespace;&lt;br /&gt;
	local anchor_id_list_module = mw.loadData (&#039;Module:Footnotes/anchor_id_list&#039;);&lt;br /&gt;
	local anchor_id_list = anchor_id_list_module.anchor_id_list;&lt;br /&gt;
	local article_whitelist = anchor_id_list_module.article_whitelist;&lt;br /&gt;
	local template_list = anchor_id_list_module.template_list;&lt;br /&gt;
    local citeref_patterns = anchor_id_list_module.citeref_patterns&lt;br /&gt;
	&lt;br /&gt;
	local whitelist_module = mw.loadData (&#039;Module:Footnotes/whitelist&#039;);&lt;br /&gt;
	local whitelist = whitelist_module.whitelist;&lt;br /&gt;
&lt;br /&gt;
	local tally = anchor_id_list[anchor_id];									-- nil when anchor_id not in list; else a tally&lt;br /&gt;
	local msg;&lt;br /&gt;
	local category;&lt;br /&gt;
&lt;br /&gt;
	if not tally then&lt;br /&gt;
		if args.ignore then&lt;br /&gt;
			return &#039;&#039;;															-- if ignore is true then no message, no category&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if article_whitelist and article_whitelist[anchor_id] then				-- if an article-local whitelist and anchor ID is in it&lt;br /&gt;
			return &#039;&#039;;															-- done&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local wl_anchor_id = anchor_id;											-- copy to be modified to index into the whitelist&lt;br /&gt;
		&lt;br /&gt;
		if args.year then														-- for anchor IDs created by this template (not in |ref=) that have a date&lt;br /&gt;
			if args.year:match (&#039;%d%l$&#039;) or										-- use the date value to determine if we should remove the disambiguator&lt;br /&gt;
				args.year:match (&#039;n%.d%.%l$&#039;) or&lt;br /&gt;
				args.year:match (&#039;nd%l$&#039;) then&lt;br /&gt;
					wl_anchor_id = wl_anchor_id:gsub (&#039;%l$&#039;, &#039;&#039;);				-- remove the disambiguator&lt;br /&gt;
			end&lt;br /&gt;
		end		&lt;br /&gt;
&lt;br /&gt;
		local t_tbl = whitelist[wl_anchor_id];									-- get list of templates associated with this anchor ID&lt;br /&gt;
&lt;br /&gt;
		if t_tbl then															-- when anchor ID not whitelisted t_tbl is nil&lt;br /&gt;
			for _, t in ipairs (t_tbl) do										-- spin through the list of templates associated with this anchor ID&lt;br /&gt;
				if template_list[t] then										-- if associated template is found in the list of templates in the article&lt;br /&gt;
					return &#039;&#039;;													-- anchor ID is whitlisted and article has matching template so no error&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
        for _, pattern in ipairs(citeref_patterns) do                           -- load patterns for wrapper templates on this page&lt;br /&gt;
           if anchor_id:match(pattern) then                                     -- spin through the special patterns and try to match&lt;br /&gt;
              return &#039;&#039;&lt;br /&gt;
           end&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
		msg = &#039;no target: &#039; .. anchor_id;										-- anchor_id not found&lt;br /&gt;
mw.log(msg)&lt;br /&gt;
        if namespace == 10 and not args.show then                               -- do not generate error message in template namespace&lt;br /&gt;
           return &#039;&#039;&lt;br /&gt;
        end&lt;br /&gt;
		category = &#039;[[Category:Harv and Sfn no-target errors]]&#039;;&lt;br /&gt;
&lt;br /&gt;
	elseif 1 &amp;lt; tally then&lt;br /&gt;
		msg = &#039;multiple targets (&#039; .. tally .. &#039;×): &#039; .. anchor_id;				-- more than one anchor_id in this article&lt;br /&gt;
mw.log(msg)&lt;br /&gt;
        if namespace == 10 and not args.show then                               -- do not generate error message in template namespace&lt;br /&gt;
           return &#039;&#039;&lt;br /&gt;
        end&lt;br /&gt;
		category = 0 == namespace and &#039;[[Category:Harv and Sfn multiple-target errors]]&#039; or &#039;&#039;;								-- only categorize in article space&lt;br /&gt;
		return &#039;&amp;lt;span class=&amp;quot;error harv-error&amp;quot; style=&amp;quot;display: inline; font-size:100%&amp;quot;&amp;gt; &#039; .. args.template .. &#039; error: &#039; .. msg .. &#039; ([[:Category:Harv and Sfn template errors|help]])&amp;lt;/span&amp;gt;&#039; .. category;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
--	category = 0 == namespace and &#039;[[Category:Harv and Sfn template errors]]&#039; or &#039;&#039;;	-- only categorize in article space&lt;br /&gt;
	category = 0 == namespace and category or &#039;&#039;;								-- only categorize in article space&lt;br /&gt;
&lt;br /&gt;
-- display based on args.show (no display by default)&lt;br /&gt;
    local display = args.show and &#039;inline&#039; or &#039;none&#039;&lt;br /&gt;
    return msg and &#039;&amp;lt;span class=&amp;quot;error harv-error&amp;quot; style=&amp;quot;display: &#039;..display..&#039;; font-size:100%&amp;quot;&amp;gt; &#039; .. args.template .. &#039; error: &#039; .. msg .. &#039; ([[:Category:Harv and Sfn template errors|help]])&amp;lt;/span&amp;gt;&#039; .. category or &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ Y E A R &amp;gt;----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
evaluates param to see if it is one of these forms with or without lowercase letter disambiguator:&lt;br /&gt;
	YYYY&lt;br /&gt;
	n.d.&lt;br /&gt;
	nd	&lt;br /&gt;
	c. YYYY&lt;br /&gt;
	YYYY–YYYY	(separator is endash)&lt;br /&gt;
	YYYY–YY		(separator is endash)&lt;br /&gt;
&lt;br /&gt;
return true when param has a recognized form; false else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local patterns_date= {&lt;br /&gt;
	&#039;^%d%d%d%d?%l?$&#039;,&lt;br /&gt;
	&#039;^n%.d%.%l?$&#039;,&lt;br /&gt;
	&#039;^nd%l?$&#039;,&lt;br /&gt;
	&#039;^c%. %d%d%d%d?%l?$&#039;,&lt;br /&gt;
	&#039;^%d%d%d%d–%d%d%d%d%l?$&#039;,&lt;br /&gt;
	&#039;^%d%d%d%d–%d%d%l?$&#039;,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local function is_year (param, args)&lt;br /&gt;
	args.year = &#039;&#039;;																-- used for harv error; &lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns_date) do&lt;br /&gt;
		if mw.ustring.match (param, pattern) then&lt;br /&gt;
			args.year = param;													-- used for harv error; &lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C O R E &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns an anchor link (CITEREF) formed from one to four author names, year, and insource location (|p=, |pp=, loc=)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function core( args )&lt;br /&gt;
	local result;&lt;br /&gt;
	local err_msg = &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
	if args.P5 ~= &#039;&#039; then&lt;br /&gt;
		if is_year (args.P5, args) then&lt;br /&gt;
			result = table.concat ({args.P1, &#039; et al. &#039;, args.bracket_year_left, args.P5, args.bracket_year_right});&lt;br /&gt;
		else&lt;br /&gt;
			args.P5 = &#039;&#039;;														-- when P5 not a year don&#039;t include in anchor&lt;br /&gt;
			result = table.concat ({args.P1, &#039; et al.&#039;});						-- and don&#039;t render it&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif args.P4 ~= &#039;&#039; then&lt;br /&gt;
		if is_year (args.P4, args) then&lt;br /&gt;
			result = table.concat ({args.P1, &#039;, &#039;, args.P2, &#039; &amp;amp;amp; &#039;, args.P3, &#039; &#039;, args.bracket_year_left, args.P4, args.bracket_year_right});	-- three names and a year&lt;br /&gt;
		else&lt;br /&gt;
			result = table.concat ({args.P1, &#039; et al.&#039;});						-- four names&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif args.P3 ~= &#039;&#039; then&lt;br /&gt;
		if is_year (args.P3, args) then&lt;br /&gt;
			result = table.concat ({args.P1, &#039; &amp;amp;amp; &#039;, args.P2, &#039; &#039;, args.bracket_year_left, args.P3, args.bracket_year_right});	-- two names and a year&lt;br /&gt;
		else&lt;br /&gt;
			result = table.concat ({args.P1, &#039;, &#039;, args.P2, &#039; &#039;, &#039; &amp;amp;amp; &#039;, args.P3});	-- three names&lt;br /&gt;
		end&lt;br /&gt;
			&lt;br /&gt;
	elseif args.P2 ~= &#039;&#039; then&lt;br /&gt;
		if is_year (args.P2, args) then&lt;br /&gt;
			result = table.concat ({args.P1, &#039; &#039;, args.bracket_year_left, args.P2, args.bracket_year_right});	-- one name and year&lt;br /&gt;
		else&lt;br /&gt;
			result = table.concat ({args.P1, &#039; &amp;amp;amp; &#039;, args.P2});				-- two names&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	else&lt;br /&gt;
		result = args.P1;														-- one name&lt;br /&gt;
	end&lt;br /&gt;
																				-- when author-date result ends with a dot (typically when the last positional parameter holds &#039;n.d.&#039;)&lt;br /&gt;
																				-- and when no in-source location (no |p=, |pp=, or |loc=)&lt;br /&gt;
																				-- and when the first or only character in args.postscript is a dot&lt;br /&gt;
																				-- remove the author-date result trailing dot&lt;br /&gt;
																				-- the author-date result trailing dot will be replaced later with the content of args.postscript (usually a dot)&lt;br /&gt;
	if (&#039;.&#039; == result:sub(-1)) and (&#039;.&#039; == args.postscript:sub(1)) and (&#039;&#039; == args.page) and (&#039;&#039; == args.pages) and (&#039;&#039; == args.location) then&lt;br /&gt;
		result = result:gsub (&#039;%.$&#039;, &#039;&#039;);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.ref ~= &#039;none&#039; then&lt;br /&gt;
		local anchor_id;&lt;br /&gt;
		if args.ref ~= &#039;&#039; then&lt;br /&gt;
			anchor_id = mw.uri.anchorEncode (args.ref);&lt;br /&gt;
			err_msg = target_check (anchor_id, args);&lt;br /&gt;
			result = table.concat ({&#039;[[#&#039;, anchor_id, &#039;|&#039;, result, &#039;]]&#039;});&lt;br /&gt;
		else&lt;br /&gt;
			anchor_id = mw.uri.anchorEncode (table.concat ({&#039;CITEREF&#039;, args.P1, args.P2, args.P3, args.P4, args.P5}));&lt;br /&gt;
			err_msg = target_check (anchor_id, args);&lt;br /&gt;
			result = table.concat ({&#039;[[#&#039;, anchor_id, &#039;|&#039;, result, &#039;]]&#039;});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.page ~= &#039;&#039; then&lt;br /&gt;
		result = table.concat ({result, args.page_sep, args.page});&lt;br /&gt;
	elseif args.pages ~= &#039;&#039;then&lt;br /&gt;
		result = table.concat ({result, args.pages_sep, args.pages});&lt;br /&gt;
	end      &lt;br /&gt;
&lt;br /&gt;
	if args.location ~= &#039;&#039; then&lt;br /&gt;
		result = table.concat ({result, &#039;, &#039;, args.location});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	result = table.concat ({args.bracket_left, result, args.bracket_right, args.postscript}):gsub (&#039;%s+&#039;, &#039; &#039;);		-- strip redundant spaces&lt;br /&gt;
	return result .. err_msg;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H Y P H E N _ T O _ D A S H &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Converts a hyphen to a dash under certain conditions.  The hyphen must separate&lt;br /&gt;
like items; unlike items are returned unmodified.  These forms are modified:&lt;br /&gt;
	letter - letter (A - B)&lt;br /&gt;
	digit - digit (4-5)&lt;br /&gt;
	digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)&lt;br /&gt;
	letterdigit - letterdigit (A1-A5) (an optional separator between letter and&lt;br /&gt;
		digit is supported – a.1-a.5 or a-1-a-5)&lt;br /&gt;
	digitletter - digitletter (5a - 5d) (an optional separator between letter and&lt;br /&gt;
		digit is supported – 5.a-5.d or 5-a-5-d)&lt;br /&gt;
&lt;br /&gt;
any other forms are returned unmodified.&lt;br /&gt;
&lt;br /&gt;
str may be a comma- or semicolon-separated list&lt;br /&gt;
&lt;br /&gt;
This code copied from Module:Citation/CS1.  The only modification is to require Module:Citation/CS1/Utilities&lt;br /&gt;
so that it has access to the functions is_set() and has_accept_as_written()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function hyphen_to_dash( str )&lt;br /&gt;
	local utilities = require (&#039;Module:Citation/CS1/Utilities&#039;);				-- only modification so that this function has access to is_set() and has_accept_as_written()&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (str) then&lt;br /&gt;
		return str;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local accept; -- Boolean&lt;br /&gt;
&lt;br /&gt;
	str = str:gsub (&#039;&amp;amp;[nm]dash;&#039;, {[&#039;&amp;amp;ndash;&#039;] = &#039;–&#039;, [&#039;&amp;amp;mdash;&#039;] = &#039;—&#039;});		-- replace &amp;amp;mdash; and &amp;amp;ndash; entities with their characters; semicolon mucks up the text.split&lt;br /&gt;
	str = str:gsub (&#039;&amp;amp;#45;&#039;, &#039;-&#039;); -- replace HTML numeric entity with hyphen character&lt;br /&gt;
&lt;br /&gt;
	str = str:gsub (&#039;&amp;amp;nbsp;&#039;, &#039; &#039;); -- replace &amp;amp;nbsp; entity with generic keyboard space character&lt;br /&gt;
	&lt;br /&gt;
	local out = {};&lt;br /&gt;
	local list = mw.text.split (str, &#039;%s*[,;]%s*&#039;);								-- split str at comma or semicolon separators if there are any&lt;br /&gt;
&lt;br /&gt;
	for _, item in ipairs (list) do												-- for each item in the list&lt;br /&gt;
		item, accept = utilities.has_accept_as_written (item);					-- remove accept-this-as-written markup when it wraps all of item&lt;br /&gt;
		if not accept and mw.ustring.match (item, &#039;^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$&#039;) then	-- if a hyphenated range or has endash or emdash separators&lt;br /&gt;
			if item:match (&#039;^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$&#039;) or			-- letterdigit hyphen letterdigit (optional separator between letter and digit)&lt;br /&gt;
				item:match (&#039;^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$&#039;) or			-- digitletter hyphen digitletter (optional separator between digit and letter)&lt;br /&gt;
				item:match (&#039;^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$&#039;) or			-- digit separator digit hyphen digit separator digit&lt;br /&gt;
				item:match (&#039;^%d+%s*%-%s*%d+$&#039;) or								-- digit hyphen digit&lt;br /&gt;
				item:match (&#039;^%a+%s*%-%s*%a+$&#039;) then							-- letter hyphen letter&lt;br /&gt;
					item = item:gsub (&#039;(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)&#039;, &#039;%1–%2&#039;);	-- replace hyphen, remove extraneous space characters&lt;br /&gt;
			else&lt;br /&gt;
				item = mw.ustring.gsub (item, &#039;%s*[–—]%s*&#039;, &#039;–&#039;);				-- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (out, item);												-- add the (possibly modified) item to the output table&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local temp_str = &#039;&#039;;														-- concatenate the output table into a comma separated string&lt;br /&gt;
	temp_str, accept = utilities.has_accept_as_written (table.concat (out, &#039;, &#039;)); -- remove accept-this-as-written markup when it wraps all of concatenated out&lt;br /&gt;
	if accept then&lt;br /&gt;
		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&lt;br /&gt;
		return temp_str;&lt;br /&gt;
	else&lt;br /&gt;
		return temp_str;														-- else, return assembled temp_str&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R G S  _ F E T C H &amp;gt;---------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Because all of the templates share a common set of parameters, a single common function to fetch those parameters&lt;br /&gt;
from frame and parent frame.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function args_fetch (frame, ps)&lt;br /&gt;
	local args = args_default;													-- create a copy of the default table&lt;br /&gt;
	local pframe = frame:getParent();											-- point to the template&#039;s parameter table&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame.args) do											-- override defaults with values provided in the #invoke: if any&lt;br /&gt;
		args[k] = v;	   &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	args.postscript = pframe.args.postscript or pframe.args.ps or ps;&lt;br /&gt;
	if &#039;none&#039; == args.postscript then&lt;br /&gt;
		args.postscript = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
	args.group = pframe.args.group or &#039;&#039;;&lt;br /&gt;
	args.page = pframe.args.p or pframe.args.page or &#039;&#039;;&lt;br /&gt;
	args.pages = pframe.args.pp or pframe.args.pages or &#039;&#039;;&lt;br /&gt;
	args.pages = (&#039;&#039; ~= args.pages) and hyphen_to_dash (args.pages) or &#039;&#039;;&lt;br /&gt;
	args.location = pframe.args.at or pframe.args.loc or &#039;&#039;;&lt;br /&gt;
	args.ref = pframe.args.ref or pframe.args.Ref or &#039;&#039;;&lt;br /&gt;
	args.ignore = (&#039;yes&#039; == pframe.args[&#039;ignore-false-positive&#039;]) or (&#039;yes&#039; == pframe.args[&#039;ignore-err&#039;]);&lt;br /&gt;
&lt;br /&gt;
	for i, v in ipairs ({&#039;P1&#039;, &#039;P2&#039;, &#039;P3&#039;, &#039;P4&#039;, &#039;P5&#039;}) do						-- loop through the five positional parameters and trim if set else empty string&lt;br /&gt;
		args[v] = (pframe.args[i] and mw.text.trim (pframe.args[i])) or &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.P5 and not is_year (args.P5, args) then&lt;br /&gt;
		local i = 6;															-- initialize the indexer to the sixth positional parameter&lt;br /&gt;
		while pframe.args[i] do													-- in case there are too many authors loop through the authors looking for a year&lt;br /&gt;
			local v = mw.text.trim (pframe.args[i]);							-- trim&lt;br /&gt;
			if is_year (v, args) then											-- if a year&lt;br /&gt;
				args.P5 = v;													-- overwrite whatever was in args.P5 with year&lt;br /&gt;
				break;															-- and abandon the search&lt;br /&gt;
			end&lt;br /&gt;
			i = i + 1;															-- bump the indexer&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return args;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A R V A R D _ C I T A T I O N &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common entry point for:&lt;br /&gt;
	{{harvard citation}} aka {{harv}}&lt;br /&gt;
	{{Harvard citation no brackets}} aka {{harvnb}}&lt;br /&gt;
	{{harvcol}}&lt;br /&gt;
	{{harvcolnb}}&lt;br /&gt;
	{{harvcoltxt}}&lt;br /&gt;
	{{Harvard citation text}} aka {{harvtxt}}&lt;br /&gt;
	{{Harvp}}&lt;br /&gt;
&lt;br /&gt;
Distinguishing features (brackets and page separators) are specified in this module&#039;s {{#invoke}} in the respective templates.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function harvard_citation (frame)&lt;br /&gt;
	local args = args_fetch (frame, &#039;&#039;);										-- get the template and invoke parameters; default postscript is empty string&lt;br /&gt;
&lt;br /&gt;
	return core (args);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S T R I P _ U R L &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
used by sfn() and sfnm().  This function fixes an issue with reference tooltip gadget where the tooltip is not displayed&lt;br /&gt;
when an insource locator (|p=, |pp=, |loc=) has an external wikilink that contains a # character&lt;br /&gt;
&lt;br /&gt;
strip uri-reserved characters from urls in |p=, |pp-, and |loc= parameters  The researved characters are:&lt;br /&gt;
	!#$&amp;amp;&#039;()*+,/:;=?@[]&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function strip_url (pages)&lt;br /&gt;
	local escaped_uri;&lt;br /&gt;
	if not pages or (&#039;&#039; == pages) then&lt;br /&gt;
		return pages;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for uri in pages:gmatch (&#039;%[(%a[%w%+%.%-]*://%S+)&#039;) do						-- for each external link get the uri&lt;br /&gt;
		escaped_uri = uri:gsub (&amp;quot;([%(%)%.%%%+%-%*%?%[%^%$%]])&amp;quot;, &amp;quot;%%%1&amp;quot; );		-- save a copy with lua pattern characters escaped&lt;br /&gt;
		uri = uri:gsub (&amp;quot;[!#%$&amp;amp;&#039;%(%)%*%+,/:;=%?@%[%]%.%%]&amp;quot;, &#039;&#039;);				-- remove reserved characters and &#039;%&#039; because &#039;%20&#039; (space character) is a lua &#039;invalid capture index&#039;&lt;br /&gt;
		pages = pages:gsub (escaped_uri, uri, 1);								-- replace original uri with the stripped version&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return pages;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S F N &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
entry point for {{sfn}} and {{sfnp}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sfn (frame)&lt;br /&gt;
	local args = args_fetch (frame, &#039;.&#039;);										-- get the template and invoke parameters; default postscript is a dot&lt;br /&gt;
&lt;br /&gt;
	local result = core (args);													-- go make a CITEREF anchor&lt;br /&gt;
																				-- put it all together and then strip redundant spaces&lt;br /&gt;
	local name = table.concat ({&#039;FOOTNOTE&#039;, args.P1, args.P2, args.P3, args.P4, args.P5, strip_url (args.page), strip_url (args.pages), strip_url (args.location)}):gsub (&#039;%s+&#039;, &#039; &#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:extensionTag ({name=&#039;ref&#039;, args={group=args.group, name=name}, content=result});	&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S F N M &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common entry point for {{sfnm}} and {{sfnmp}}&lt;br /&gt;
&lt;br /&gt;
Distinguishing features (brackets) are specified in this module&#039;s {{#invoke}} in the respective templates.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sfnm (frame)&lt;br /&gt;
	local args = args_default;													-- create a copy of the default table&lt;br /&gt;
	local pframe = frame:getParent();											-- point to the template&#039;s parameter table&lt;br /&gt;
	&lt;br /&gt;
	local n = 1;																-- index of source; this is the &#039;n&#039; in na1, ny, etc&lt;br /&gt;
	local first_pnum = 1;														-- first of a pair of positional parameters&lt;br /&gt;
	local second_pnum = 2;														-- second of a pair of positional parameters&lt;br /&gt;
&lt;br /&gt;
	local last_ps = 0;															-- index of the last source with |nps= set&lt;br /&gt;
	local last_index = 0;														-- index of the last source; these used to determine which of |ps= or |nps= will terminate the whole rendering&lt;br /&gt;
&lt;br /&gt;
	local out = {};																-- table to hold rendered sources&lt;br /&gt;
	local footnote = {&#039;FOOTNOTE&#039;};												-- all author, date, insource location stuff becomes part of the reference&#039;s footnote id; added as we go&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame.args) do											-- override defaults with values provided in the #invoke: if any&lt;br /&gt;
		args[k] = v;	   &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	while true do&lt;br /&gt;
		if not pframe.args[table.concat ({n, &#039;a1&#039;})] and not pframe.args[first_pnum] then&lt;br /&gt;
			break;																-- no na1 or matching positional parameter so done&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if pframe.args[table.concat ({n, &#039;a1&#039;})] then							-- does this source use named parameters?&lt;br /&gt;
			for _, v in ipairs ({&#039;P1&#039;, &#039;P2&#039;, &#039;P3&#039;, &#039;P4&#039;, &#039;P5&#039;}) do				-- initialize for this source&lt;br /&gt;
				args[v] = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			for i, v in ipairs ({&#039;P1&#039;, &#039;P2&#039;, &#039;P3&#039;, &#039;P4&#039;, &#039;P5&#039;}) do				-- extract author and year parameters for this source&lt;br /&gt;
				args[v] = pframe.args[table.concat ({n, &#039;a&#039;, i})] or &#039;&#039;;		-- attempt to assign author name&lt;br /&gt;
				if &#039;&#039; == args[v] then											-- when there wasn&#039;t an author name&lt;br /&gt;
					args[v] = pframe.args[table.concat ({n, &#039;y&#039;})] or &#039;&#039;;		-- attempt to assign year&lt;br /&gt;
					break;														-- done with author/date for this source&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
		else																	-- this source uses positional parameters&lt;br /&gt;
			args.P1 = mw.text.trim (pframe.args[first_pnum]);					-- yes, only one author supported&lt;br /&gt;
			args.P2 = (pframe.args[second_pnum] and mw.text.trim (pframe.args[second_pnum])) or &#039;&#039;;	-- when positional author, year must also be positional&lt;br /&gt;
&lt;br /&gt;
			for _, v in ipairs ({&#039;P3&#039;, &#039;P4&#039;, &#039;P5&#039;}) do							-- blank the rest of these for this source&lt;br /&gt;
				args[v] = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			first_pnum = first_pnum + 2;										-- source must use positional author and positional year&lt;br /&gt;
			second_pnum = first_pnum + 1;										-- bump these for possible next positional source&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		args.postscript = pframe.args[table.concat ({n, &#039;ps&#039;})] or &#039;&#039;;&lt;br /&gt;
		if &#039;none&#039; == args.postscript then										-- this for compatibility with other footnote templates; does nothing&lt;br /&gt;
			args.postscript = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
		args.group = pframe.args.group or &#039;&#039;;									-- reference group&lt;br /&gt;
		args.ref = pframe.args[table.concat ({n, &#039;ref&#039;})] or &#039;&#039;;				-- alternate reference for this source&lt;br /&gt;
&lt;br /&gt;
		args.page = pframe.args[table.concat ({n, &#039;p&#039;})] or &#039;&#039;;					-- insource locations for this source&lt;br /&gt;
		args.pages = pframe.args[table.concat ({n, &#039;pp&#039;})] or &#039;&#039;;&lt;br /&gt;
		args.pages = (&#039;&#039; ~= args.pages) and hyphen_to_dash (args.pages) or &#039;&#039;;&lt;br /&gt;
		args.location = pframe.args[table.concat ({n, &#039;loc&#039;})] or pframe.args[table.concat ({n, &#039;at&#039;})] or &#039;&#039;;&lt;br /&gt;
		args.ignore = (&#039;yes&#039; == pframe.args[table.concat ({n, &#039;ignore-false-positive&#039;})]) or (&#039;yes&#039; == pframe.args[table.concat ({n, &#039;ignore-err&#039;})]);&lt;br /&gt;
&lt;br /&gt;
		table.insert (out, core (args));										-- save the rendering of this source&lt;br /&gt;
		&lt;br /&gt;
		for k, v in ipairs ({&#039;P1&#039;, &#039;P2&#039;, &#039;P3&#039;, &#039;P4&#039;, &#039;P5&#039;}) do					-- create the FOOTNOTE id&lt;br /&gt;
			if &#039;&#039; ~= args[v] then&lt;br /&gt;
				table.insert (footnote, args[v]);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for k, v in ipairs ({&#039;page&#039;, &#039;pages&#039;, &#039;location&#039;}) do					-- these done separately so that we can strip uri-reserved characters from extlinked page numbers &lt;br /&gt;
			if &#039;&#039; ~= args[v] then&lt;br /&gt;
				table.insert (footnote, strip_url (args[v]))&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		last_index = n;															-- flags used to select terminal postscript from nps or from end_ps&lt;br /&gt;
		if &#039;&#039; ~= args.postscript then							&lt;br /&gt;
			last_ps = n;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		n = n+1;																-- bump for the next one&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local name = table.concat (footnote):gsub (&#039;%s+&#039;, &#039; &#039;);						-- put the footnote together and strip redundant space&lt;br /&gt;
	&lt;br /&gt;
	args.end_ps = pframe.args.postscript or pframe.args.ps or &#039;.&#039;;				-- this is the postscript for the whole not for the individual sources&lt;br /&gt;
	if &#039;none&#039; == args.end_ps then												-- not an original sfnm parameter value; added for compatibility with other footnote templates&lt;br /&gt;
		args.end_ps = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result = table.concat ({table.concat (out, &#039;; &#039;), (last_index == last_ps) and &#039;&#039; or  args.end_ps});&lt;br /&gt;
	return frame:extensionTag ({name=&#039;ref&#039;, args={group=args.group, name=name}, content=result});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S F N R E F &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
implements {{sfnref}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sfnref (frame)&lt;br /&gt;
	local args = getArgs (frame);&lt;br /&gt;
	local out = {};&lt;br /&gt;
	&lt;br /&gt;
	for i=1, 5 do																-- get the first five args if there are five args&lt;br /&gt;
		if args[i] then&lt;br /&gt;
			out[i] = args[i];&lt;br /&gt;
		else&lt;br /&gt;
			break;																-- less than 5 args break out&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 5 == #out then															-- when we have seen five args there may bemore&lt;br /&gt;
		local i = 6;															-- initialize the indexer to the sixth positional parameter&lt;br /&gt;
		while args[i] do														-- in case there are too many authors loop through the authors looking for a year&lt;br /&gt;
			if is_year (args[i], args) then										-- if a year&lt;br /&gt;
				out[5] = args[i];												-- overwrite whatever was in args[5] with year&lt;br /&gt;
				break;															-- and abandon the search&lt;br /&gt;
			end&lt;br /&gt;
			i = i + 1;															-- bump the indexer&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return mw.uri.anchorEncode (&#039;CITEREF&#039; .. table.concat (out));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	harvard_citation = harvard_citation,&lt;br /&gt;
	sfn = sfn,&lt;br /&gt;
	sfnm = sfnm,&lt;br /&gt;
	sfnref = sfnref,&lt;br /&gt;
    target_check = target_check,&lt;br /&gt;
	};&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Check_for_unknown_parameters&amp;diff=577</id>
		<title>Module:Check for unknown parameters</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Check_for_unknown_parameters&amp;diff=577"/>
		<updated>2025-08-09T18:47:48Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- This module may be used to compare the arguments passed to the parent&lt;br /&gt;
-- with a list of arguments, returning a specified result if an argument is&lt;br /&gt;
-- not on the list&lt;br /&gt;
&lt;br /&gt;
require (&#039;strict&#039;);&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function trim(s)&lt;br /&gt;
	return s:match(&#039;^%s*(.-)%s*$&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isnotempty(s)&lt;br /&gt;
	return s and s:match(&#039;%S&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function clean(text)&lt;br /&gt;
	-- Return text cleaned for display and truncated if too long.&lt;br /&gt;
	-- Strip markers are replaced with dummy text representing the original wikitext.&lt;br /&gt;
	local pos, truncated&lt;br /&gt;
	local function truncate(text)&lt;br /&gt;
		if truncated then&lt;br /&gt;
			return &#039;&#039;&lt;br /&gt;
		end&lt;br /&gt;
		if mw.ustring.len(text) &amp;gt; 25 then&lt;br /&gt;
			truncated = true&lt;br /&gt;
			text = mw.ustring.sub(text, 1, 25) .. &#039;...&#039;&lt;br /&gt;
		end&lt;br /&gt;
		return mw.text.nowiki(text)&lt;br /&gt;
	end&lt;br /&gt;
	local parts = {}&lt;br /&gt;
	for before, tag, remainder in text:gmatch(&#039;([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()&#039;) do&lt;br /&gt;
		pos = remainder&lt;br /&gt;
		table.insert(parts, truncate(before) .. &#039;&amp;amp;lt;&#039; .. tag .. &#039;&amp;amp;gt;...&amp;amp;lt;/&#039; .. tag .. &#039;&amp;amp;gt;&#039;)&lt;br /&gt;
	end&lt;br /&gt;
	table.insert(parts, truncate(text:sub(pos or 1)))&lt;br /&gt;
	return table.concat(parts)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._check(args, pargs)&lt;br /&gt;
	if type(args) ~= &amp;quot;table&amp;quot; or type(pargs) ~= &amp;quot;table&amp;quot; then&lt;br /&gt;
		-- TODO: error handling&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- create the list of known args, regular expressions, and the return string&lt;br /&gt;
	local knownargs = {}&lt;br /&gt;
	local regexps = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if type(k) == &#039;number&#039; then&lt;br /&gt;
			v = trim(v)&lt;br /&gt;
			knownargs[v] = 1&lt;br /&gt;
		elseif k:find(&#039;^regexp[1-9][0-9]*$&#039;) then&lt;br /&gt;
			table.insert(regexps, &#039;^&#039; .. v .. &#039;$&#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- loop over the parent args, and make sure they are on the list&lt;br /&gt;
	local ignoreblank = isnotempty(args[&#039;ignoreblank&#039;])&lt;br /&gt;
	local showblankpos = isnotempty(args[&#039;showblankpositional&#039;])&lt;br /&gt;
	local values = {}&lt;br /&gt;
	for k, v in pairs(pargs) do&lt;br /&gt;
		if type(k) == &#039;string&#039; and knownargs[k] == nil then&lt;br /&gt;
			local knownflag = false&lt;br /&gt;
			for _, regexp in ipairs(regexps) do&lt;br /&gt;
				if mw.ustring.match(k, regexp) then&lt;br /&gt;
					knownflag = true&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if not knownflag and ( not ignoreblank or isnotempty(v) )  then&lt;br /&gt;
				table.insert(values, clean(k))&lt;br /&gt;
			end&lt;br /&gt;
		elseif type(k) == &#039;number&#039; and knownargs[tostring(k)] == nil then&lt;br /&gt;
			local knownflag = false&lt;br /&gt;
			for _, regexp in ipairs(regexps) do&lt;br /&gt;
				if mw.ustring.match(tostring(k), regexp) then&lt;br /&gt;
					knownflag = true&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if not knownflag and ( showblankpos or isnotempty(v) ) then&lt;br /&gt;
				table.insert(values, k .. &#039; = &#039; .. clean(v))&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- add results to the output tables&lt;br /&gt;
	local res = {}&lt;br /&gt;
	if #values &amp;gt; 0 then&lt;br /&gt;
		local unknown_text = args[&#039;unknown&#039;] or &#039;Found _VALUE_, &#039;&lt;br /&gt;
&lt;br /&gt;
		if mw.getCurrentFrame():preprocess( &amp;quot;{{REVISIONID}}&amp;quot; ) == &amp;quot;&amp;quot; then&lt;br /&gt;
			local preview_text = args[&#039;preview&#039;]&lt;br /&gt;
			if isnotempty(preview_text) then&lt;br /&gt;
				preview_text = require(&#039;Module:If preview&#039;)._warning({preview_text})&lt;br /&gt;
			elseif preview_text == nil then&lt;br /&gt;
				preview_text = unknown_text&lt;br /&gt;
			end&lt;br /&gt;
			unknown_text = preview_text&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in pairs(values) do&lt;br /&gt;
			-- Fix odd bug for | = which gets stripped to the empty string and&lt;br /&gt;
			-- breaks category links&lt;br /&gt;
			if v == &#039;&#039; then v = &#039; &#039; end&lt;br /&gt;
&lt;br /&gt;
			-- avoid error with v = &#039;example%2&#039; (&amp;quot;invalid capture index&amp;quot;)&lt;br /&gt;
			local r = unknown_text:gsub(&#039;_VALUE_&#039;, {_VALUE_ = v})&lt;br /&gt;
			table.insert(res, r)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat(res)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.check(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local pargs = frame:getParent().args&lt;br /&gt;
	return p._check(args, pargs)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Module:Citation/CS1&amp;diff=576</id>
		<title>Module:Citation/CS1</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Module:Citation/CS1&amp;diff=576"/>
		<updated>2025-08-09T18:47:39Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot batch install: Approved dependency.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require (&#039;strict&#039;);&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
each of these counts against the Lua upvalue limit&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local validation;																-- functions in Module:Citation/CS1/Date_validation&lt;br /&gt;
&lt;br /&gt;
local utilities;																-- functions in Module:Citation/CS1/Utilities&lt;br /&gt;
local z = {};																	-- table of tables in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
local identifiers;																-- functions and tables in Module:Citation/CS1/Identifiers&lt;br /&gt;
local metadata;																	-- functions in Module:Citation/CS1/COinS&lt;br /&gt;
local cfg = {};																	-- table of configuration tables that are defined in Module:Citation/CS1/Configuration&lt;br /&gt;
local whitelist = {};															-- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[------------------&amp;lt; P A G E   S C O P E   V A R I A B L E S &amp;gt;---------------&lt;br /&gt;
&lt;br /&gt;
declare variables here that have page-wide scope that are not brought in from&lt;br /&gt;
other modules; that are created here and used here&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local added_deprecated_cat;														-- Boolean flag so that the category is added only once&lt;br /&gt;
local added_vanc_errs;															-- Boolean flag so we only emit one Vancouver error / category&lt;br /&gt;
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&lt;br /&gt;
local added_numeric_name_errs;													-- Boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered&lt;br /&gt;
local added_numeric_name_maint;													-- Boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted&lt;br /&gt;
local is_preview_mode;															-- true when article is in preview mode; false when using &#039;Preview page with this template&#039; (previewing the module)&lt;br /&gt;
local is_sandbox;																-- true when using sandbox modules to render citation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F I R S T _ S E T &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Locates and returns the first set value in a table of values where the order established in the table,&lt;br /&gt;
left-to-right (or top-to-bottom), is the order in which the values are evaluated.  Returns nil if none are set.&lt;br /&gt;
&lt;br /&gt;
This version replaces the original &#039;for _, val in pairs do&#039; and a similar version that used ipairs.  With the pairs&lt;br /&gt;
version the order of evaluation could not be guaranteed.  With the ipairs version, a nil value would terminate&lt;br /&gt;
the for-loop before it reached the actual end of the list.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function first_set (list, count)&lt;br /&gt;
	local i = 1;&lt;br /&gt;
	while i &amp;lt;= count do															-- loop through all items in list&lt;br /&gt;
		if utilities.is_set( list[i] ) then&lt;br /&gt;
			return list[i];														-- return the first set list member&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;																-- point to next&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A D D _ V A N C _ E R R O R &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Adds a single Vancouver system error message to the template&#039;s output regardless of how many error actually exist.&lt;br /&gt;
To prevent duplication, added_vanc_errs is nil until an error message is emitted.&lt;br /&gt;
&lt;br /&gt;
added_vanc_errs is a Boolean declared in page scope variables above&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function add_vanc_error (source, position)&lt;br /&gt;
	if added_vanc_errs then return end&lt;br /&gt;
		&lt;br /&gt;
	added_vanc_errs = true;														-- note that we&#039;ve added this category&lt;br /&gt;
	utilities.set_message (&#039;err_vancouver&#039;, {source, position});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S C H E M E &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
does this thing that purports to be a URI scheme seem to be a valid scheme?  The scheme is checked to see if it&lt;br /&gt;
is in agreement with http://tools.ietf.org/html/std66#section-3.1 which says:&lt;br /&gt;
	Scheme names consist of a sequence of characters beginning with a&lt;br /&gt;
   letter and followed by any combination of letters, digits, plus&lt;br /&gt;
   (&amp;quot;+&amp;quot;), period (&amp;quot;.&amp;quot;), or hyphen (&amp;quot;-&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
returns true if it does, else false&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_scheme (scheme)&lt;br /&gt;
	return scheme and scheme:match (&#039;^%a[%a%d%+%.%-]*:&#039;);						-- true if scheme is set and matches the pattern&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ D O M A I N _ N A M E &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Does this thing that purports to be a domain name seem to be a valid domain name?&lt;br /&gt;
&lt;br /&gt;
Syntax defined here: http://tools.ietf.org/html/rfc1034#section-3.5&lt;br /&gt;
BNF defined here: https://tools.ietf.org/html/rfc4234&lt;br /&gt;
Single character names are generally reserved; see https://tools.ietf.org/html/draft-ietf-dnsind-iana-dns-01#page-15;&lt;br /&gt;
	see also [[Single-letter second-level domain]]&lt;br /&gt;
list of TLDs: https://www.iana.org/domains/root/db&lt;br /&gt;
&lt;br /&gt;
RFC 952 (modified by RFC 1123) requires the first and last character of a hostname to be a letter or a digit.  Between&lt;br /&gt;
the first and last characters the name may use letters, digits, and the hyphen.&lt;br /&gt;
&lt;br /&gt;
Also allowed are IPv4 addresses. IPv6 not supported&lt;br /&gt;
&lt;br /&gt;
domain is expected to be stripped of any path so that the last character in the last character of the TLD.  tld&lt;br /&gt;
is two or more alpha characters.  Any preceding &#039;//&#039; (from splitting a URL with a scheme) will be stripped&lt;br /&gt;
here.  Perhaps not necessary but retained in case it is necessary for IPv4 dot decimal.&lt;br /&gt;
&lt;br /&gt;
There are several tests:&lt;br /&gt;
	the first character of the whole domain name including subdomains must be a letter or a digit&lt;br /&gt;
	internationalized domain name (ASCII characters with .xn-- ASCII Compatible Encoding (ACE) prefix xn-- in the TLD) see https://tools.ietf.org/html/rfc3490&lt;br /&gt;
	single-letter/digit second-level domains in the .org, .cash, and .today TLDs&lt;br /&gt;
	q, x, and z SL domains in the .com TLD&lt;br /&gt;
	i and q SL domains in the .net TLD&lt;br /&gt;
	single-letter SL domains in the ccTLDs (where the ccTLD is two letters)&lt;br /&gt;
	two-character SL domains in gTLDs (where the gTLD is two or more letters)&lt;br /&gt;
	three-plus-character SL domains in gTLDs (where the gTLD is two or more letters)&lt;br /&gt;
	IPv4 dot-decimal address format; TLD not allowed&lt;br /&gt;
&lt;br /&gt;
returns true if domain appears to be a proper name and TLD or IPv4 address, else false&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_domain_name (domain)&lt;br /&gt;
	if not domain then&lt;br /&gt;
		return false;															-- if not set, abandon&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	domain = domain:gsub (&#039;^//&#039;, &#039;&#039;);											-- strip &#039;//&#039; from domain name if present; done here so we only have to do it once&lt;br /&gt;
	&lt;br /&gt;
	if not domain:match (&#039;^[%w]&#039;) then											-- first character must be letter or digit&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if domain:match (&#039;^%a+:&#039;) then												-- hack to detect things that look like s:Page:Title where Page: is namespace at Wikisource&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local patterns = {															-- patterns that look like URLs&lt;br /&gt;
		&#039;%f[%w][%w][%w%-]+[%w]%.%a%a+$&#039;,										-- three or more character hostname.hostname or hostname.tld&lt;br /&gt;
		&#039;%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$&#039;,									-- internationalized domain name with ACE prefix&lt;br /&gt;
		&#039;%f[%a][qxz]%.com$&#039;,													-- assigned one character .com hostname (x.com times out 2015-12-10)&lt;br /&gt;
		&#039;%f[%a][iq]%.net$&#039;,														-- assigned one character .net hostname (q.net registered but not active 2015-12-10)&lt;br /&gt;
		&#039;%f[%w][%w]%.%a%a$&#039;,													-- one character hostname and ccTLD (2 chars)&lt;br /&gt;
		&#039;%f[%w][%w][%w]%.%a%a+$&#039;,												-- two character hostname and TLD&lt;br /&gt;
		&#039;^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?&#039;,								-- IPv4 address&lt;br /&gt;
		&#039;[%a%d]+%:?&#039;                                                            -- IPv6 address&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- loop through the patterns list&lt;br /&gt;
		if domain:match (pattern) then&lt;br /&gt;
			return true;														-- if a match then we think that this thing that purports to be a URL is a URL&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for _, d in ipairs (cfg.single_letter_2nd_lvl_domains_t) do					-- look for single letter second level domain names for these top level domains&lt;br /&gt;
		if domain:match (&#039;%f[%w][%w]%.&#039; .. d) then&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false;																-- no matches, we don&#039;t know what this thing is&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ U R L &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if the scheme and domain parts of a URL appear to be a valid URL; else false.&lt;br /&gt;
&lt;br /&gt;
This function is the last step in the validation process.  This function is separate because there are cases that&lt;br /&gt;
are not covered by split_url(), for example is_parameter_ext_wikilink() which is looking for bracketted external&lt;br /&gt;
wikilinks.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_url (scheme, domain)&lt;br /&gt;
	if utilities.is_set (scheme) then											-- if scheme is set check it and domain&lt;br /&gt;
		return is_scheme (scheme) and is_domain_name (domain);&lt;br /&gt;
	else&lt;br /&gt;
		return is_domain_name (domain);											-- scheme not set when URL is protocol-relative&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S P L I T _ U R L &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Split a URL into a scheme, authority indicator, and domain.&lt;br /&gt;
&lt;br /&gt;
First remove Fully Qualified Domain Name terminator (a dot following TLD) (if any) and any path(/), query(?) or fragment(#).&lt;br /&gt;
&lt;br /&gt;
If protocol-relative URL, return nil scheme and domain else return nil for both scheme and domain.&lt;br /&gt;
&lt;br /&gt;
When not protocol-relative, get scheme, authority indicator, and domain.  If there is an authority indicator (one&lt;br /&gt;
or more &#039;/&#039; characters immediately following the scheme&#039;s colon), make sure that there are only 2.&lt;br /&gt;
&lt;br /&gt;
Any URL that does not have news: scheme must have authority indicator (//).  TODO: are there other common schemes&lt;br /&gt;
like news: that don&#039;t use authority indicator?&lt;br /&gt;
&lt;br /&gt;
Strip off any port and path;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function split_url (url_str)&lt;br /&gt;
	local scheme, authority, domain;&lt;br /&gt;
	&lt;br /&gt;
	url_str = url_str:gsub (&#039;([%a%d])%.?[/%?#].*$&#039;, &#039;%1&#039;);						-- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of &#039;//&#039;)&lt;br /&gt;
&lt;br /&gt;
	if url_str:match (&#039;^//%S*&#039;) then											-- if there is what appears to be a protocol-relative URL&lt;br /&gt;
		domain = url_str:match (&#039;^//(%S*)&#039;)&lt;br /&gt;
	elseif url_str:match (&#039;%S-:/*%S+&#039;) then										-- if there is what appears to be a scheme, optional authority indicator, and domain name&lt;br /&gt;
		scheme, authority, domain = url_str:match (&#039;(%S-:)(/*)(%S+)&#039;);			-- extract the scheme, authority indicator, and domain portions&lt;br /&gt;
		if utilities.is_set (authority) then&lt;br /&gt;
			authority = authority:gsub (&#039;//&#039;, &#039;&#039;, 1);							-- replace place 1 pair of &#039;/&#039; with nothing;&lt;br /&gt;
			if utilities.is_set(authority) then									-- if anything left (1 or 3+ &#039;/&#039; where authority should be) then&lt;br /&gt;
				return scheme;													-- return scheme only making domain nil which will cause an error message&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if not scheme:match (&#039;^news:&#039;) then									-- except for news:..., MediaWiki won&#039;t link URLs that do not have authority indicator; TODO: a better way to do this test?&lt;br /&gt;
				return scheme;													-- return scheme only making domain nil which will cause an error message&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		domain = domain:gsub (&#039;(%a):%d+&#039;, &#039;%1&#039;);								-- strip port number if present&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return scheme, domain;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N K _ P A R A M _ O K &amp;gt;---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
checks the content of |title-link=, |series-link=, |author-link=, etc. for properly formatted content: no wikilinks, no URLs&lt;br /&gt;
&lt;br /&gt;
Link parameters are to hold the title of a Wikipedia article, so none of the WP:TITLESPECIALCHARACTERS are allowed:&lt;br /&gt;
	# &amp;lt; &amp;gt; [ ] | { } _&lt;br /&gt;
except the underscore which is used as a space in wiki URLs and # which is used for section links&lt;br /&gt;
&lt;br /&gt;
returns false when the value contains any of these characters.&lt;br /&gt;
&lt;br /&gt;
When there are no illegal characters, this function returns TRUE if value DOES NOT appear to be a valid URL (the&lt;br /&gt;
|&amp;lt;param&amp;gt;-link= parameter is ok); else false when value appears to be a valid URL (the |&amp;lt;param&amp;gt;-link= parameter is NOT ok).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function link_param_ok (value)&lt;br /&gt;
	local scheme, domain;&lt;br /&gt;
	if value:find (&#039;[&amp;lt;&amp;gt;%[%]|{}]&#039;) then                                          -- if any prohibited characters&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	scheme, domain = split_url (value);											-- get scheme or nil and domain or nil from URL; &lt;br /&gt;
	return not is_url (scheme, domain);											-- return true if value DOES NOT appear to be a valid URL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N K _ T I T L E _ O K &amp;gt;---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Use link_param_ok() to validate |&amp;lt;param&amp;gt;-link= value and its matching |&amp;lt;title&amp;gt;= value.&lt;br /&gt;
&lt;br /&gt;
|&amp;lt;title&amp;gt;= may be wiki-linked but not when |&amp;lt;param&amp;gt;-link= has a value.  This function emits an error message when&lt;br /&gt;
that condition exists&lt;br /&gt;
&lt;br /&gt;
check &amp;lt;link&amp;gt; for inter-language interwiki-link prefix.  prefix must be a MediaWiki-recognized language&lt;br /&gt;
code and must begin with a colon.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function link_title_ok (link, lorig, title, torig)&lt;br /&gt;
	local orig;&lt;br /&gt;
	if utilities.is_set (link) then 											-- don&#039;t bother if &amp;lt;param&amp;gt;-link doesn&#039;t have a value&lt;br /&gt;
		if not link_param_ok (link) then										-- check |&amp;lt;param&amp;gt;-link= markup&lt;br /&gt;
			orig = lorig;														-- identify the failing link parameter&lt;br /&gt;
		elseif title:find (&#039;%[%[&#039;) then											-- check |title= for wikilink markup&lt;br /&gt;
			orig = torig;														-- identify the failing |title= parameter&lt;br /&gt;
		elseif link:match (&#039;^%a+:&#039;) then										-- if the link is what looks like an interwiki&lt;br /&gt;
			local prefix = link:match (&#039;^(%a+):&#039;):lower();						-- get the interwiki prefix&lt;br /&gt;
&lt;br /&gt;
			if cfg.inter_wiki_map[prefix] then									-- if prefix is in the map, must have preceding colon&lt;br /&gt;
				orig = lorig;													-- flag as error&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (orig) then&lt;br /&gt;
		link = &#039;&#039;;																-- unset&lt;br /&gt;
		utilities.set_message (&#039;err_bad_paramlink&#039;, orig);						-- URL or wikilink in |title= with |title-link=;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return link;																-- link if ok, empty string else&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C H E C K _ U R L &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether a URL string appears to be valid.&lt;br /&gt;
&lt;br /&gt;
First we test for space characters.  If any are found, return false.  Then split the URL into scheme and domain&lt;br /&gt;
portions, or for protocol-relative (//example.com) URLs, just the domain.  Use is_url() to validate the two&lt;br /&gt;
portions of the URL.  If both are valid, or for protocol-relative if domain is valid, return true, else false.&lt;br /&gt;
&lt;br /&gt;
Because it is different from a standard URL, and because this module used external_link() to make external links&lt;br /&gt;
that work for standard and news: links, we validate newsgroup names here.  The specification for a newsgroup name&lt;br /&gt;
is at https://tools.ietf.org/html/rfc5536#section-3.1.4&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_url( url_str )&lt;br /&gt;
	if nil == url_str:match (&amp;quot;^%S+$&amp;quot;) then										-- if there are any spaces in |url=value it can&#039;t be a proper URL&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	local scheme, domain;&lt;br /&gt;
&lt;br /&gt;
	scheme, domain = split_url (url_str);										-- get scheme or nil and domain or nil from URL;&lt;br /&gt;
	&lt;br /&gt;
	if &#039;news:&#039; == scheme then													-- special case for newsgroups&lt;br /&gt;
		return domain:match(&#039;^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$&#039;);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return is_url (scheme, domain);												-- return true if value appears to be a valid URL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ P A R A M E T E R _ E X T _ W I K I L I N K &amp;gt;----------------------------&lt;br /&gt;
&lt;br /&gt;
Return true if a parameter value has a string that begins and ends with square brackets [ and ] and the first&lt;br /&gt;
non-space characters following the opening bracket appear to be a URL.  The test will also find external wikilinks&lt;br /&gt;
that use protocol-relative URLs. Also finds bare URLs.&lt;br /&gt;
&lt;br /&gt;
The frontier pattern prevents a match on interwiki-links which are similar to scheme:path URLs.  The tests that&lt;br /&gt;
find bracketed URLs are required because the parameters that call this test (currently |title=, |chapter=, |work=,&lt;br /&gt;
and |publisher=) may have wikilinks and there are articles or redirects like &#039;//Hus&#039; so, while uncommon, |title=[[//Hus]]&lt;br /&gt;
is possible as might be [[en://Hus]].&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_parameter_ext_wikilink (value)&lt;br /&gt;
local scheme, domain;&lt;br /&gt;
&lt;br /&gt;
	if value:match (&#039;%f[%[]%[%a%S*:%S+.*%]&#039;) then								-- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;%f[%[]%[(%a%S*:%S+).*%]&#039;));&lt;br /&gt;
	elseif value:match (&#039;%f[%[]%[//%S+.*%]&#039;) then								-- if protocol-relative ext. wikilink: [//yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;%f[%[]%[(//%S+).*%]&#039;));&lt;br /&gt;
	elseif value:match (&#039;%a%S*:%S+&#039;) then										-- if bare URL with scheme; may have leading or trailing plain text&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;(%a%S*:%S+)&#039;));&lt;br /&gt;
	elseif value:match (&#039;^//%S+&#039;) or value:match (&#039;%s//%S+&#039;) then				-- if protocol-relative bare URL: //yyyyy.zzz; authority indicator (//) must be be preceded nothing or by whitespace&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;(//%S+)&#039;));					-- what is left should be the domain&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- didn&#039;t find anything that is obviously a URL&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return is_url (scheme, domain);												-- return true if value appears to be a valid URL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; C H E C K _ F O R _ U R L &amp;gt;-----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
loop through a list of parameters and their values.  Look at the value and if it has an external link, emit an error message.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_for_url (parameter_list, error_list)&lt;br /&gt;
	for k, v in pairs (parameter_list) do										-- for each parameter in the list&lt;br /&gt;
		if is_parameter_ext_wikilink (v) then									-- look at the value; if there is a URL add an error message&lt;br /&gt;
			table.insert (error_list, utilities.wrap_style (&#039;parameter&#039;, k));&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S A F E _ F O R _ U R L &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Escape sequences for content that will be used for URL descriptions&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function safe_for_url( str )&lt;br /&gt;
	if str:match( &amp;quot;%[%[.-%]%]&amp;quot; ) ~= nil then &lt;br /&gt;
		utilities.set_message (&#039;err_wikilink_in_url&#039;, {});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return str:gsub( &#039;[%[%]\n]&#039;, {	&lt;br /&gt;
		[&#039;[&#039;] = &#039;&amp;amp;#91;&#039;,&lt;br /&gt;
		[&#039;]&#039;] = &#039;&amp;amp;#93;&#039;,&lt;br /&gt;
		[&#039;\n&#039;] = &#039; &#039; } );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T E R N A L _ L I N K &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an external link with error checking&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function external_link (URL, label, source, access)&lt;br /&gt;
	local err_msg = &#039;&#039;;&lt;br /&gt;
	local domain;&lt;br /&gt;
	local path;&lt;br /&gt;
	local base_url;&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (label) then&lt;br /&gt;
		label = URL;&lt;br /&gt;
		if utilities.is_set (source) then&lt;br /&gt;
			utilities.set_message (&#039;err_bare_url_missing_title&#039;, {utilities.wrap_style (&#039;parameter&#039;, source)});&lt;br /&gt;
		else&lt;br /&gt;
			error (cfg.messages[&amp;quot;bare_url_no_origin&amp;quot;]);							-- programmer error; valid parameter name does not have matching meta-parameter&lt;br /&gt;
		end			&lt;br /&gt;
	end&lt;br /&gt;
	if not check_url (URL) then&lt;br /&gt;
		utilities.set_message (&#039;err_bad_url&#039;, {utilities.wrap_style (&#039;parameter&#039;, source)});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	domain, path = URL:match (&#039;^([/%.%-%+:%a%d]+)([/%?#].*)$&#039;);					-- split the URL into scheme plus domain and path&lt;br /&gt;
	if path then																-- if there is a path portion&lt;br /&gt;
		path = path:gsub (&#039;[%[%]]&#039;, {[&#039;[&#039;] = &#039;%5b&#039;, [&#039;]&#039;] = &#039;%5d&#039;});			-- replace &#039;[&#039; and &#039;]&#039; with their percent-encoded values&lt;br /&gt;
		URL = table.concat ({domain, path});									-- and reassemble&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	base_url = table.concat ({ &amp;quot;[&amp;quot;, URL, &amp;quot; &amp;quot;, safe_for_url (label), &amp;quot;]&amp;quot; });		-- assemble a wiki-markup URL&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (access) then											-- access level (subscription, registration, limited)&lt;br /&gt;
		base_url = utilities.substitute (cfg.presentation[&#039;ext-link-access-signal&#039;], {cfg.presentation[access].class, cfg.presentation[access].title, base_url});	-- add the appropriate icon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return base_url;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D E P R E C A T E D _ P A R A M E T E R &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Categorize and emit an error message when the citation contains one or more deprecated parameters.  The function includes the&lt;br /&gt;
offending parameter name to the error message.  Only one error message is emitted regardless of the number of deprecated&lt;br /&gt;
parameters in the citation.&lt;br /&gt;
&lt;br /&gt;
added_deprecated_cat is a Boolean declared in page scope variables above&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function deprecated_parameter(name)&lt;br /&gt;
	if not added_deprecated_cat then&lt;br /&gt;
		added_deprecated_cat = true;											-- note that we&#039;ve added this category&lt;br /&gt;
		utilities.set_message (&#039;err_deprecated_params&#039;, {name});				-- add error message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; K E R N _ Q U O T E S &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Apply kerning to open the space between the quote mark provided by the module and a leading or trailing quote&lt;br /&gt;
mark contained in a |title= or |chapter= parameter&#039;s value.&lt;br /&gt;
&lt;br /&gt;
This function will positive kern either single or double quotes:&lt;br /&gt;
	&amp;quot;&#039;Unkerned title with leading and trailing single quote marks&#039;&amp;quot;&lt;br /&gt;
	&amp;quot; &#039;Kerned title with leading and trailing single quote marks&#039; &amp;quot; (in real life the kerning isn&#039;t as wide as this example)&lt;br /&gt;
Double single quotes (italic or bold wiki-markup) are not kerned.&lt;br /&gt;
&lt;br /&gt;
Replaces Unicode quote marks in plain text or in the label portion of a [[L|D]] style wikilink with typewriter&lt;br /&gt;
quote marks regardless of the need for kerning.  Unicode quote marks are not replaced in simple [[D]] wikilinks.&lt;br /&gt;
&lt;br /&gt;
Call this function for chapter titles, for website titles, etc.; not for book titles.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function kern_quotes (str)&lt;br /&gt;
	local cap = &#039;&#039;;&lt;br /&gt;
	local wl_type, label, link;&lt;br /&gt;
&lt;br /&gt;
	wl_type, label, link = utilities.is_wikilink (str);							-- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]&lt;br /&gt;
	&lt;br /&gt;
	if 1 == wl_type then														-- [[D]] simple wikilink with or without quote marks&lt;br /&gt;
		if mw.ustring.match (str, &#039;%[%[[\&amp;quot;“”\&#039;‘’].+[\&amp;quot;“”\&#039;‘’]%]%]&#039;) then		-- leading and trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-left&#039;], str);&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-right&#039;], str);&lt;br /&gt;
		elseif mw.ustring.match (str, &#039;%[%[[\&amp;quot;“”\&#039;‘’].+%]%]&#039;)	then			-- leading quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-left&#039;], str);&lt;br /&gt;
		elseif mw.ustring.match (str, &#039;%[%[.+[\&amp;quot;“”\&#039;‘’]%]%]&#039;) then				-- trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-right&#039;], str);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else																		-- plain text or [[L|D]]; text in label variable&lt;br /&gt;
		label = mw.ustring.gsub (label, &#039;[“”]&#039;, &#039;\&amp;quot;&#039;);							-- replace “” (U+201C &amp;amp; U+201D) with &amp;quot; (typewriter double quote mark)&lt;br /&gt;
		label = mw.ustring.gsub (label, &#039;[‘’]&#039;, &#039;\&#039;&#039;);							-- replace ‘’ (U+2018 &amp;amp; U+2019) with &#039; (typewriter single quote mark)&lt;br /&gt;
&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^([\&amp;quot;\&#039;][^\&#039;].+)&amp;quot;);						-- match leading double or single quote but not doubled single quotes (italic markup)&lt;br /&gt;
		if utilities.is_set (cap) then&lt;br /&gt;
			label = utilities.substitute (cfg.presentation[&#039;kern-left&#039;], cap);&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^(.+[^\&#039;][\&amp;quot;\&#039;])$&amp;quot;)						-- match trailing double or single quote but not doubled single quotes (italic markup)&lt;br /&gt;
		if utilities.is_set (cap) then&lt;br /&gt;
			label = utilities.substitute (cfg.presentation[&#039;kern-right&#039;], cap);&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if 2 == wl_type then&lt;br /&gt;
			str = utilities.make_wikilink (link, label);						-- reassemble the wikilink&lt;br /&gt;
		else&lt;br /&gt;
			str = label;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return str;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F O R M A T _ S C R I P T _ V A L U E &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
|script-title= holds title parameters that are not written in Latin-based scripts: Chinese, Japanese, Arabic, Hebrew, etc. These scripts should&lt;br /&gt;
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&lt;br /&gt;
in italic markup.&lt;br /&gt;
&lt;br /&gt;
Regardless of language, all values provided by |script-title= are wrapped in &amp;lt;bdi&amp;gt;...&amp;lt;/bdi&amp;gt; tags to isolate RTL languages from the English left to right.&lt;br /&gt;
&lt;br /&gt;
|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:&lt;br /&gt;
	|script-title=ja:*** *** (where * represents a Japanese character)&lt;br /&gt;
Spaces between the two-character code and the colon and the colon and the first script character are allowed:&lt;br /&gt;
	|script-title=ja : *** ***&lt;br /&gt;
	|script-title=ja: *** ***&lt;br /&gt;
	|script-title=ja :*** ***&lt;br /&gt;
Spaces preceding the prefix are allowed: |script-title = ja:*** ***&lt;br /&gt;
&lt;br /&gt;
The prefix is checked for validity.  If it is a valid ISO 639-1 language code, the lang attribute (lang=&amp;quot;ja&amp;quot;) is added to the &amp;lt;bdi&amp;gt; tag so that browsers can&lt;br /&gt;
know the language the tag contains.  This may help the browser render the script more correctly.  If the prefix is invalid, the lang attribute&lt;br /&gt;
is not added.  At this time there is no error message for this condition.&lt;br /&gt;
&lt;br /&gt;
Supports |script-title=, |script-chapter=, |script-&amp;lt;periodical&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_script_value (script_value, script_param)&lt;br /&gt;
	local lang=&#039;&#039;;																-- initialize to empty string&lt;br /&gt;
	local name;&lt;br /&gt;
	if script_value:match(&#039;^%l%l%l?%s*:&#039;) then									-- if first 3 or 4 non-space characters are script language prefix&lt;br /&gt;
		lang = script_value:match(&#039;^(%l%l%l?)%s*:%s*%S.*&#039;);						-- get the language prefix or nil if there is no script&lt;br /&gt;
		if not utilities.is_set (lang) then&lt;br /&gt;
			utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;missing title part&#039;]});		-- prefix without &#039;title&#039;; add error message&lt;br /&gt;
			return &#039;&#039;;															-- script_value was just the prefix so return empty string&lt;br /&gt;
		end&lt;br /&gt;
																				-- if we get this far we have prefix and script&lt;br /&gt;
		name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code );	-- get language name so that we can use it to categorize&lt;br /&gt;
		if utilities.is_set (name) then											-- is prefix a proper ISO 639-1 language code?&lt;br /&gt;
			script_value = script_value:gsub (&#039;^%l+%s*:%s*&#039;, &#039;&#039;);				-- strip prefix from script&lt;br /&gt;
																				-- is prefix one of these language codes?&lt;br /&gt;
			if utilities.in_array (lang, cfg.script_lang_codes) then&lt;br /&gt;
				utilities.add_prop_cat (&#039;script&#039;, {name, lang})&lt;br /&gt;
			else&lt;br /&gt;
				utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;unknown language code&#039;]});	-- unknown script-language; add error message&lt;br /&gt;
			end&lt;br /&gt;
			lang = &#039; lang=&amp;quot;&#039; .. lang .. &#039;&amp;quot; &#039;;									-- convert prefix into a lang attribute&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;invalid language code&#039;]});		-- invalid language code; add error message&lt;br /&gt;
			lang = &#039;&#039;;															-- invalid so set lang to empty string&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;missing prefix&#039;]});				-- no language code prefix; add error message&lt;br /&gt;
	end&lt;br /&gt;
	script_value = utilities.substitute (cfg.presentation[&#039;bdi&#039;], {lang, script_value});	-- isolate in case script is RTL&lt;br /&gt;
&lt;br /&gt;
	return script_value;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S C R I P T _ C O N C A T E N A T E &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Initially for |title= and |script-title=, this function concatenates those two parameter values after the script&lt;br /&gt;
value has been wrapped in &amp;lt;bdi&amp;gt; tags.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function script_concatenate (title, script, script_param)&lt;br /&gt;
	if utilities.is_set (script) then&lt;br /&gt;
		script = format_script_value (script, script_param);					-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; returns empty string on error&lt;br /&gt;
		if utilities.is_set (script) then&lt;br /&gt;
			title = title .. &#039; &#039; .. script;										-- concatenate title and script title&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return title;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; W R A P _ M S G &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Applies additional message text to various parameter values. Supplied string is wrapped using a message_list&lt;br /&gt;
configuration taking one argument.  Supports lower case text for {{citation}} templates.  Additional text taken&lt;br /&gt;
from citation_config.messages - the reason this function is similar to but separate from wrap_style().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wrap_msg (key, str, lower)&lt;br /&gt;
	if not utilities.is_set ( str ) then&lt;br /&gt;
		return &amp;quot;&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
	if true == lower then&lt;br /&gt;
		local msg;&lt;br /&gt;
		msg = cfg.messages[key]:lower();										-- set the message to lower case before &lt;br /&gt;
		return utilities.substitute ( msg, str );								-- including template text&lt;br /&gt;
	else&lt;br /&gt;
		return utilities.substitute ( cfg.messages[key], str );&lt;br /&gt;
	end		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; W I K I S O U R C E _ U R L _ M A K E &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
Makes a Wikisource URL from Wikisource interwiki-link.  Returns the URL and appropriate&lt;br /&gt;
label; nil else.&lt;br /&gt;
&lt;br /&gt;
str is the value assigned to |chapter= (or aliases) or |title= or |title-link=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wikisource_url_make (str)&lt;br /&gt;
	local wl_type, D, L;&lt;br /&gt;
	local ws_url, ws_label;&lt;br /&gt;
	local wikisource_prefix = table.concat ({&#039;https://&#039;, cfg.this_wiki_code, &#039;.wikisource.org/wiki/&#039;});&lt;br /&gt;
&lt;br /&gt;
	wl_type, D, L = utilities.is_wikilink (str);								-- wl_type is 0 (not a wikilink), 1 (simple wikilink), 2 (complex wikilink)&lt;br /&gt;
&lt;br /&gt;
	if 0 == wl_type then														-- not a wikilink; might be from |title-link=&lt;br /&gt;
		str = D:match (&#039;^[Ww]ikisource:(.+)&#039;) or D:match (&#039;^[Ss]:(.+)&#039;);		-- article title from interwiki link with long-form or short-form namespace&lt;br /&gt;
		if utilities.is_set (str) then&lt;br /&gt;
			ws_url = table.concat ({											-- build a Wikisource URL&lt;br /&gt;
				wikisource_prefix,												-- prefix&lt;br /&gt;
				str,															-- article title&lt;br /&gt;
				});&lt;br /&gt;
			ws_label = str;														-- label for the URL&lt;br /&gt;
		end&lt;br /&gt;
	elseif 1 == wl_type then													-- simple wikilink: [[Wikisource:ws article]]&lt;br /&gt;
		str = D:match (&#039;^[Ww]ikisource:(.+)&#039;) or D:match (&#039;^[Ss]:(.+)&#039;);		-- article title from interwiki link with long-form or short-form namespace&lt;br /&gt;
		if utilities.is_set (str) then&lt;br /&gt;
			ws_url = table.concat ({											-- build a Wikisource URL&lt;br /&gt;
				wikisource_prefix,												-- prefix&lt;br /&gt;
				str,															-- article title&lt;br /&gt;
				});&lt;br /&gt;
			ws_label = str;														-- label for the URL&lt;br /&gt;
		end&lt;br /&gt;
	elseif 2 == wl_type then													-- non-so-simple wikilink: [[Wikisource:ws article|displayed text]] ([[L|D]])&lt;br /&gt;
		str = L:match (&#039;^[Ww]ikisource:(.+)&#039;) or L:match (&#039;^[Ss]:(.+)&#039;);		-- article title from interwiki link with long-form or short-form namespace&lt;br /&gt;
		if utilities.is_set (str) then&lt;br /&gt;
			ws_label = D;														-- get ws article name from display portion of interwiki link&lt;br /&gt;
			ws_url = table.concat ({											-- build a Wikisource URL&lt;br /&gt;
				wikisource_prefix,												-- prefix&lt;br /&gt;
				str,															-- article title without namespace from link portion of wikilink&lt;br /&gt;
				});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ws_url then&lt;br /&gt;
		ws_url = mw.uri.encode (ws_url, &#039;WIKI&#039;);								-- make a usable URL&lt;br /&gt;
		ws_url = ws_url:gsub (&#039;%%23&#039;, &#039;#&#039;);										-- undo percent-encoding of fragment marker&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return ws_url, ws_label, L or D;											-- return proper URL or nil and a label or nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; F O R M A T _ P E R I O D I C A L &amp;gt;-----------------------&lt;br /&gt;
&lt;br /&gt;
Format the three periodical parameters: |script-&amp;lt;periodical&amp;gt;=, |&amp;lt;periodical&amp;gt;=,&lt;br /&gt;
and |trans-&amp;lt;periodical&amp;gt;= into a single Periodical meta-parameter.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_periodical (script_periodical, script_periodical_source, periodical, trans_periodical)&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (periodical) then&lt;br /&gt;
		periodical = &#039;&#039;;														-- to be safe for concatenation&lt;br /&gt;
	else&lt;br /&gt;
		periodical = utilities.wrap_style (&#039;italic-title&#039;, periodical);			-- style &lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	periodical = script_concatenate (periodical, script_periodical, script_periodical_source);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (trans_periodical) then&lt;br /&gt;
		trans_periodical = utilities.wrap_style (&#039;trans-italic-title&#039;, trans_periodical);&lt;br /&gt;
		if utilities.is_set (periodical) then&lt;br /&gt;
			periodical = periodical .. &#039; &#039; .. trans_periodical;&lt;br /&gt;
		else																	-- here when trans-periodical without periodical or script-periodical&lt;br /&gt;
			periodical = trans_periodical;&lt;br /&gt;
			utilities.set_message (&#039;err_trans_missing_title&#039;, {&#039;periodical&#039;});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return periodical;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[------------------&amp;lt; F O R M A T _ C H A P T E R _ T I T L E &amp;gt;---------------&lt;br /&gt;
&lt;br /&gt;
Format the four chapter parameters: |script-chapter=, |chapter=, |trans-chapter=,&lt;br /&gt;
and |chapter-url= into a single chapter meta- parameter (chapter_url_source used&lt;br /&gt;
for error messages).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
	local ws_url, ws_label, L = wikisource_url_make (chapter);					-- make a wikisource URL and label from a wikisource interwiki link&lt;br /&gt;
	if ws_url then&lt;br /&gt;
		ws_label = ws_label:gsub (&#039;_&#039;, &#039; &#039;);									-- replace underscore separators with space characters&lt;br /&gt;
		chapter = ws_label;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (chapter) then&lt;br /&gt;
		chapter = &#039;&#039;;															-- to be safe for concatenation&lt;br /&gt;
	else&lt;br /&gt;
		if false == no_quotes then&lt;br /&gt;
			chapter = kern_quotes (chapter);									-- if necessary, separate chapter title&#039;s leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			chapter = utilities.wrap_style (&#039;quoted-title&#039;, chapter);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	chapter = script_concatenate (chapter, script_chapter, script_chapter_source);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (chapter_url) then&lt;br /&gt;
		chapter = external_link (chapter_url, chapter, chapter_url_source, access);	-- adds bare_url_missing_title error if appropriate&lt;br /&gt;
	elseif ws_url then&lt;br /&gt;
		chapter = external_link (ws_url, chapter .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in chapter&#039;);	-- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?&lt;br /&gt;
		chapter = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, chapter});				&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (trans_chapter) then&lt;br /&gt;
		trans_chapter = utilities.wrap_style (&#039;trans-quoted-title&#039;, trans_chapter);&lt;br /&gt;
		if utilities.is_set (chapter) then&lt;br /&gt;
			chapter = chapter .. &#039; &#039; .. trans_chapter;&lt;br /&gt;
		else																	-- here when trans_chapter without chapter or script-chapter&lt;br /&gt;
			chapter = trans_chapter;&lt;br /&gt;
			chapter_source = trans_chapter_source:match (&#039;trans%-?(.+)&#039;);		-- when no chapter, get matching name from trans-&amp;lt;param&amp;gt;&lt;br /&gt;
			utilities.set_message (&#039;err_trans_missing_title&#039;, {chapter_source});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return chapter;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; H A S _ I N V I S I B L E _ C H A R S &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
This function searches a parameter&#039;s value for non-printable or invisible characters.&lt;br /&gt;
The search stops at the first match.&lt;br /&gt;
&lt;br /&gt;
This function will detect the visible replacement character when it is part of the Wikisource.&lt;br /&gt;
&lt;br /&gt;
Detects but ignores nowiki and math stripmarkers.  Also detects other named stripmarkers&lt;br /&gt;
(gallery, math, pre, ref) and identifies them with a slightly different error message.&lt;br /&gt;
See also coins_cleanup().&lt;br /&gt;
&lt;br /&gt;
Output of this function is an error message that identifies the character or the&lt;br /&gt;
Unicode group, or the stripmarker that was detected along with its position (or,&lt;br /&gt;
for multi-byte characters, the position of its first byte) in the parameter value.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_invisible_chars (param, v)&lt;br /&gt;
	local position = &#039;&#039;;														-- position of invisible char or starting position of stripmarker&lt;br /&gt;
	local capture;																-- used by stripmarker detection to hold name of the stripmarker&lt;br /&gt;
	local stripmarker;															-- boolean set true when a stripmarker is found&lt;br /&gt;
&lt;br /&gt;
	capture = string.match (v, &#039;[%w%p ]*&#039;);										-- test for values that are simple ASCII text and bypass other tests if true&lt;br /&gt;
	if capture == v then														-- if same there are no Unicode characters&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for _, invisible_char in ipairs (cfg.invisible_chars) do&lt;br /&gt;
		local char_name = invisible_char[1];									-- the character or group name&lt;br /&gt;
		local pattern = invisible_char[2];										-- the pattern used to find it&lt;br /&gt;
		position, _, capture = mw.ustring.find (v, pattern);					-- see if the parameter value contains characters that match the pattern&lt;br /&gt;
		&lt;br /&gt;
		if position and (cfg.invisible_defs.zwj == capture) then				-- if we found a zero-width joiner character&lt;br /&gt;
			if mw.ustring.find (v, cfg.indic_script) then						-- it&#039;s ok if one of the Indic scripts&lt;br /&gt;
				position = nil;													-- unset position&lt;br /&gt;
			elseif cfg.emoji_t[mw.ustring.codepoint (v, position+1)] then			-- is zwj followed by a character listed in emoji{}?&lt;br /&gt;
				position = nil;													-- unset position&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if position then&lt;br /&gt;
			if &#039;nowiki&#039; == capture or &#039;math&#039; == capture or						-- nowiki and math stripmarkers (not an error condition)&lt;br /&gt;
				(&#039;templatestyles&#039; == capture and utilities.in_array (param, {&#039;id&#039;, &#039;quote&#039;})) then	-- templatestyles stripmarker allowed in these parameters&lt;br /&gt;
					stripmarker = true;											-- set a flag&lt;br /&gt;
			elseif true == stripmarker and cfg.invisible_defs.del == capture then	-- because stripmakers begin and end with the delete char, assume that we&#039;ve found one end of a stripmarker&lt;br /&gt;
				position = nil;													-- unset&lt;br /&gt;
			else&lt;br /&gt;
				local err_msg;&lt;br /&gt;
				if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then&lt;br /&gt;
					err_msg = capture .. &#039; &#039; .. char_name;&lt;br /&gt;
				else&lt;br /&gt;
					err_msg = char_name .. &#039; &#039; .. &#039;character&#039;;&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				utilities.set_message (&#039;err_invisible_char&#039;, {err_msg, utilities.wrap_style (&#039;parameter&#039;, param), position});	-- add error message&lt;br /&gt;
				return;															-- and done with this parameter&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------&amp;lt; A R G U M E N T _ W R A P P E R &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
Argument wrapper.  This function provides support for argument mapping defined&lt;br /&gt;
in the configuration file so that multiple names can be transparently aliased to&lt;br /&gt;
single internal variable.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function argument_wrapper ( args )&lt;br /&gt;
	local origin = {};&lt;br /&gt;
	&lt;br /&gt;
	return setmetatable({&lt;br /&gt;
		ORIGIN = function ( self, k )&lt;br /&gt;
			local dummy = self[k];												-- force the variable to be loaded.&lt;br /&gt;
			return origin[k];&lt;br /&gt;
		end&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		__index = function ( tbl, k )&lt;br /&gt;
			if origin[k] ~= nil then&lt;br /&gt;
				return nil;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local args, list, v = args, cfg.aliases[k];&lt;br /&gt;
			&lt;br /&gt;
			if type( list ) == &#039;table&#039; then&lt;br /&gt;
				v, origin[k] = utilities.select_one ( args, list, &#039;err_redundant_parameters&#039; );&lt;br /&gt;
				if origin[k] == nil then&lt;br /&gt;
					origin[k] = &#039;&#039;;												-- Empty string, not nil&lt;br /&gt;
				end&lt;br /&gt;
			elseif list ~= nil then&lt;br /&gt;
				v, origin[k] = args[list], list;&lt;br /&gt;
			else&lt;br /&gt;
				-- maybe let through instead of raising an error?&lt;br /&gt;
				-- v, origin[k] = args[k], k;&lt;br /&gt;
				error( cfg.messages[&#039;unknown_argument_map&#039;] .. &#039;: &#039; .. k);&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			-- Empty strings, not nil;&lt;br /&gt;
			if v == nil then&lt;br /&gt;
				v = &#039;&#039;;&lt;br /&gt;
				origin[k] = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			tbl = rawset( tbl, k, v );&lt;br /&gt;
			return v;&lt;br /&gt;
		end,&lt;br /&gt;
	});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N O W R A P _ D A T E &amp;gt;-------------------------&lt;br /&gt;
&lt;br /&gt;
When date is YYYY-MM-DD format wrap in nowrap span: &amp;lt;span ...&amp;gt;YYYY-MM-DD&amp;lt;/span&amp;gt;.&lt;br /&gt;
When date is DD MMMM YYYY or is MMMM DD, YYYY then wrap in nowrap span:&lt;br /&gt;
&amp;lt;span ...&amp;gt;DD MMMM&amp;lt;/span&amp;gt; YYYY or &amp;lt;span ...&amp;gt;MMMM DD,&amp;lt;/span&amp;gt; YYYY&lt;br /&gt;
&lt;br /&gt;
DOES NOT yet support MMMM YYYY or any of the date ranges.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function nowrap_date (date)&lt;br /&gt;
	local cap = &#039;&#039;;&lt;br /&gt;
	local cap2 = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
	if date:match(&amp;quot;^%d%d%d%d%-%d%d%-%d%d$&amp;quot;) then&lt;br /&gt;
		date = utilities.substitute (cfg.presentation[&#039;nowrap1&#039;], date);&lt;br /&gt;
	&lt;br /&gt;
	elseif date:match(&amp;quot;^%a+%s*%d%d?,%s+%d%d%d%d$&amp;quot;) or date:match (&amp;quot;^%d%d?%s*%a+%s+%d%d%d%d$&amp;quot;) then&lt;br /&gt;
		cap, cap2 = string.match (date, &amp;quot;^(.*)%s+(%d%d%d%d)$&amp;quot;);&lt;br /&gt;
		date = utilities.substitute (cfg.presentation[&#039;nowrap2&#039;], {cap, cap2});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return date;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ T I T L E T Y P E &amp;gt;---------------------&lt;br /&gt;
&lt;br /&gt;
This function sets default title types (equivalent to the citation including&lt;br /&gt;
|type=&amp;lt;default value&amp;gt;) for those templates that have defaults. Also handles the&lt;br /&gt;
special case where it is desirable to omit the title type from the rendered citation&lt;br /&gt;
(|type=none).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_titletype (cite_class, title_type)&lt;br /&gt;
	if utilities.is_set (title_type) then&lt;br /&gt;
		if &#039;none&#039; == cfg.keywords_xlate[title_type] then&lt;br /&gt;
			title_type = &#039;&#039;;													-- if |type=none then type parameter not displayed&lt;br /&gt;
		end&lt;br /&gt;
		return title_type;														-- if |type= has been set to any other value use that value&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return cfg.title_types [cite_class] or &#039;&#039;;									-- set template&#039;s default title type; else empty string for concatenation&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S A F E _ J O I N &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
Joins a sequence of strings together while checking for duplicate separation characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function safe_join( tbl, duplicate_char )&lt;br /&gt;
	local f = {};																-- create a function table appropriate to type of &#039;duplicate character&#039;&lt;br /&gt;
		if 1 == #duplicate_char then											-- for single byte ASCII characters use the string library functions&lt;br /&gt;
			f.gsub = string.gsub&lt;br /&gt;
			f.match = string.match&lt;br /&gt;
			f.sub = string.sub&lt;br /&gt;
		else																	-- for multi-byte characters use the ustring library functions&lt;br /&gt;
			f.gsub = mw.ustring.gsub&lt;br /&gt;
			f.match = mw.ustring.match&lt;br /&gt;
			f.sub = mw.ustring.sub&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	local str = &#039;&#039;;																-- the output string&lt;br /&gt;
	local comp = &#039;&#039;;															-- what does &#039;comp&#039; mean?&lt;br /&gt;
	local end_chr = &#039;&#039;;&lt;br /&gt;
	local trim;&lt;br /&gt;
	for _, value in ipairs( tbl ) do&lt;br /&gt;
		if value == nil then value = &#039;&#039;; end&lt;br /&gt;
		&lt;br /&gt;
		if str == &#039;&#039; then														-- if output string is empty&lt;br /&gt;
			str = value;														-- assign value to it (first time through the loop)&lt;br /&gt;
		elseif value ~= &#039;&#039; then&lt;br /&gt;
			if value:sub(1, 1) == &#039;&amp;lt;&#039; then										-- special case of values enclosed in spans and other markup.&lt;br /&gt;
				comp = value:gsub( &amp;quot;%b&amp;lt;&amp;gt;&amp;quot;, &amp;quot;&amp;quot; );								-- remove HTML markup (&amp;lt;span&amp;gt;string&amp;lt;/span&amp;gt; -&amp;gt; string)&lt;br /&gt;
			else&lt;br /&gt;
				comp = value;&lt;br /&gt;
			end&lt;br /&gt;
																				-- typically duplicate_char is sepc&lt;br /&gt;
			if f.sub(comp, 1, 1) == duplicate_char then							-- is first character same as duplicate_char? why test first character?&lt;br /&gt;
																				--   Because individual string segments often (always?) begin with terminal punct for the&lt;br /&gt;
																				--   preceding segment: &#039;First element&#039; .. &#039;sepc next element&#039; .. etc.?&lt;br /&gt;
				trim = false;&lt;br /&gt;
				end_chr = f.sub(str, -1, -1);									-- get the last character of the output string&lt;br /&gt;
				-- str = str .. &amp;quot;&amp;lt;HERE(enchr=&amp;quot; .. end_chr .. &amp;quot;)&amp;quot;				-- debug stuff?&lt;br /&gt;
				if end_chr == duplicate_char then								-- if same as separator&lt;br /&gt;
					str = f.sub(str, 1, -2);									-- remove it&lt;br /&gt;
				elseif end_chr == &amp;quot;&#039;&amp;quot; then										-- if it might be wiki-markup&lt;br /&gt;
					if f.sub(str, -3, -1) == duplicate_char .. &amp;quot;&#039;&#039;&amp;quot; then		-- if last three chars of str are sepc&#039;&#039; &lt;br /&gt;
						str = f.sub(str, 1, -4) .. &amp;quot;&#039;&#039;&amp;quot;;						-- remove them and add back &#039;&#039;&lt;br /&gt;
					elseif  f.sub(str, -5, -1) == duplicate_char .. &amp;quot;]]&#039;&#039;&amp;quot; then	-- if last five chars of str are sepc]]&#039;&#039; &lt;br /&gt;
						trim = true;											-- why? why do this and next differently from previous?&lt;br /&gt;
					elseif f.sub(str, -4, -1) == duplicate_char .. &amp;quot;]&#039;&#039;&amp;quot; then	-- if last four chars of str are sepc]&#039;&#039; &lt;br /&gt;
						trim = true;											-- same question&lt;br /&gt;
					end&lt;br /&gt;
				elseif end_chr == &amp;quot;]&amp;quot; then										-- if it might be wiki-markup&lt;br /&gt;
					if f.sub(str, -3, -1) == duplicate_char .. &amp;quot;]]&amp;quot; then		-- if last three chars of str are sepc]] wikilink &lt;br /&gt;
						trim = true;&lt;br /&gt;
					elseif f.sub(str, -3, -1) == duplicate_char .. &#039;&amp;quot;]&#039; then	-- if last three chars of str are sepc&amp;quot;] quoted external link &lt;br /&gt;
						trim = true;&lt;br /&gt;
					elseif  f.sub(str, -2, -1) == duplicate_char .. &amp;quot;]&amp;quot; then	-- if last two chars of str are sepc] external link&lt;br /&gt;
						trim = true;&lt;br /&gt;
					elseif f.sub(str, -4, -1) == duplicate_char .. &amp;quot;&#039;&#039;]&amp;quot; then	-- normal case when |url=something &amp;amp; |title=Title.&lt;br /&gt;
						trim = true;&lt;br /&gt;
					end&lt;br /&gt;
				elseif end_chr == &amp;quot; &amp;quot; then										-- if last char of output string is a space&lt;br /&gt;
					if f.sub(str, -2, -1) == duplicate_char .. &amp;quot; &amp;quot; then			-- if last two chars of str are &amp;lt;sepc&amp;gt;&amp;lt;space&amp;gt;&lt;br /&gt;
						str = f.sub(str, 1, -3);								-- remove them both&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				if trim then&lt;br /&gt;
					if value ~= comp then 										-- value does not equal comp when value contains HTML markup&lt;br /&gt;
						local dup2 = duplicate_char;&lt;br /&gt;
						if f.match(dup2, &amp;quot;%A&amp;quot; ) then dup2 = &amp;quot;%&amp;quot; .. dup2; end	-- if duplicate_char not a letter then escape it&lt;br /&gt;
						&lt;br /&gt;
						value = f.gsub(value, &amp;quot;(%b&amp;lt;&amp;gt;)&amp;quot; .. dup2, &amp;quot;%1&amp;quot;, 1 )		-- remove duplicate_char if it follows HTML markup&lt;br /&gt;
					else&lt;br /&gt;
						value = f.sub(value, 2, -1 );							-- remove duplicate_char when it is first character&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			str = str .. value; 												-- add it to the output string&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return str;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S U F F I X &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if suffix is properly formed Jr, Sr, or ordinal in the range 1–9.&lt;br /&gt;
Puncutation not allowed.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_suffix (suffix)&lt;br /&gt;
	if utilities.in_array (suffix, {&#039;Jr&#039;, &#039;Sr&#039;, &#039;Jnr&#039;, &#039;Snr&#039;, &#039;1st&#039;, &#039;2nd&#039;, &#039;3rd&#039;}) or suffix:match (&#039;^%dth$&#039;) then&lt;br /&gt;
		return true;&lt;br /&gt;
	end&lt;br /&gt;
	return false;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------&amp;lt; I S _ G O O D _ V A N C _ N A M E &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
For Vancouver style, author/editor names are supposed to be rendered in Latin&lt;br /&gt;
(read ASCII) characters.  When a name uses characters that contain diacritical&lt;br /&gt;
marks, those characters are to be converted to the corresponding Latin&lt;br /&gt;
character. When a name is written using a non-Latin alphabet or logogram, that&lt;br /&gt;
name is to be transliterated into Latin characters. The module doesn&#039;t do this&lt;br /&gt;
so editors may/must.&lt;br /&gt;
&lt;br /&gt;
This test allows |first= and |last= names to contain any of the letters defined&lt;br /&gt;
in the four Unicode Latin character sets&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0000.pdf C0 Controls and Basic Latin] 0041–005A, 0061–007A&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0080.pdf C1 Controls and Latin-1 Supplement] 00C0–00D6, 00D8–00F6, 00F8–00FF&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0100.pdf Latin Extended-A] 0100–017F&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0180.pdf Latin Extended-B] 0180–01BF, 01C4–024F&lt;br /&gt;
&lt;br /&gt;
|lastn= also allowed to contain hyphens, spaces, and apostrophes.&lt;br /&gt;
	(http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)&lt;br /&gt;
|firstn= also allowed to contain hyphens, spaces, apostrophes, and periods&lt;br /&gt;
&lt;br /&gt;
This original test:&lt;br /&gt;
	if nil == mw.ustring.find (last, &amp;quot;^[A-Za-zÀ-ÖØ-öø-ƿǄ-ɏ%-%s%&#039;]*$&amp;quot;)&lt;br /&gt;
	or nil == mw.ustring.find (first, &amp;quot;^[A-Za-zÀ-ÖØ-öø-ƿǄ-ɏ%-%s%&#039;%.]+[2-6%a]*$&amp;quot;) then&lt;br /&gt;
was written outside of the code editor and pasted here because the code editor&lt;br /&gt;
gets confused between character insertion point and cursor position. The test has&lt;br /&gt;
been rewritten to use decimal character escape sequence for the individual bytes&lt;br /&gt;
of the Unicode characters so that it is not necessary to use an external editor&lt;br /&gt;
to maintain this code.&lt;br /&gt;
&lt;br /&gt;
	\195\128-\195\150 – À-Ö (U+00C0–U+00D6 – C0 controls)&lt;br /&gt;
	\195\152-\195\182 – Ø-ö (U+00D8-U+00F6 – C0 controls)&lt;br /&gt;
	\195\184-\198\191 – ø-ƿ (U+00F8-U+01BF – C0 controls, Latin extended A &amp;amp; B)&lt;br /&gt;
	\199\132-\201\143 – Ǆ-ɏ (U+01C4-U+024F – Latin extended B)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_good_vanc_name (last, first, suffix, position)&lt;br /&gt;
	if not suffix then&lt;br /&gt;
		if first:find (&#039;[,%s]&#039;) then											-- when there is a space or comma, might be first name/initials + generational suffix&lt;br /&gt;
			first = first:match (&#039;(.-)[,%s]+&#039;);									-- get name/initials&lt;br /&gt;
			suffix = first:match (&#039;[,%s]+(.+)$&#039;);								-- get generational suffix&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if utilities.is_set (suffix) then&lt;br /&gt;
		if not is_suffix (suffix) then&lt;br /&gt;
			add_vanc_error (cfg.err_msg_supl.suffix, position);&lt;br /&gt;
			return false;														-- not a name with an appropriate suffix&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if nil == mw.ustring.find (last, &amp;quot;^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%&#039;]*$&amp;quot;) or&lt;br /&gt;
		nil == mw.ustring.find (first, &amp;quot;^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%&#039;%.]*$&amp;quot;) then&lt;br /&gt;
			add_vanc_error (cfg.err_msg_supl[&#039;non-Latin char&#039;], position);&lt;br /&gt;
			return false;														-- not a string of Latin characters; Vancouver requires Romanization&lt;br /&gt;
	end;&lt;br /&gt;
	return true;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R E D U C E _ T O _ I N I T I A L S &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Attempts to convert names to initials in support of |name-list-style=vanc.  &lt;br /&gt;
&lt;br /&gt;
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period.&lt;br /&gt;
See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/.&lt;br /&gt;
&lt;br /&gt;
Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered&lt;br /&gt;
as Jr, 2nd, 3rd, etc.  See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/.&lt;br /&gt;
This code only accepts and understands generational suffix in the Vancouver format&lt;br /&gt;
because Roman numerals look like, and can be mistaken for, initials.&lt;br /&gt;
&lt;br /&gt;
This function uses ustring functions because firstname initials may be any of the&lt;br /&gt;
Unicode Latin characters accepted by is_good_vanc_name ().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function reduce_to_initials (first, position)&lt;br /&gt;
	if first:find (&#039;,&#039;, 1, true) then&lt;br /&gt;
		return first;															-- commas not allowed; abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local name, suffix = mw.ustring.match (first, &amp;quot;^(%u+) ([%dJS][%drndth]+)$&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	if not name then															-- if not initials and a suffix&lt;br /&gt;
		name = mw.ustring.match (first, &amp;quot;^(%u+)$&amp;quot;);								-- is it just initials?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if name then																-- if first is initials with or without suffix&lt;br /&gt;
		if 3 &amp;gt; mw.ustring.len (name) then										-- if one or two initials&lt;br /&gt;
			if suffix then														-- if there is a suffix&lt;br /&gt;
				if is_suffix (suffix) then										-- is it legitimate?&lt;br /&gt;
					return first;												-- one or two initials and a valid suffix so nothing to do&lt;br /&gt;
				else&lt;br /&gt;
					add_vanc_error (cfg.err_msg_supl.suffix, position);			-- one or two initials with invalid suffix so error message&lt;br /&gt;
					return first;												-- and return first unmolested&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				return first;													-- one or two initials without suffix; nothing to do&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- if here then name has 3 or more uppercase letters so treat them as a word&lt;br /&gt;
&lt;br /&gt;
	local initials_t, names_t = {}, {};											-- tables to hold name parts and initials&lt;br /&gt;
	local i = 1;																-- counter for number of initials&lt;br /&gt;
&lt;br /&gt;
	names_t = mw.text.split (first, &#039;[%s%-]+&#039;);									-- split into a sequence of names and possible suffix&lt;br /&gt;
&lt;br /&gt;
	while names_t[i] do															-- loop through the sequence&lt;br /&gt;
		if 1 &amp;lt; i and names_t[i]:match (&#039;[%dJS][%drndth]+%.?$&#039;) then				-- if not the first name, and looks like a suffix (may have trailing dot)&lt;br /&gt;
			names_t[i] = names_t[i]:gsub (&#039;%.&#039;, &#039;&#039;);							-- remove terminal dot if present&lt;br /&gt;
			if is_suffix (names_t[i]) then										-- if a legitimate suffix&lt;br /&gt;
				table.insert (initials_t, &#039; &#039; .. names_t[i]);					-- add a separator space, insert at end of initials sequence&lt;br /&gt;
				break;															-- and done because suffix must fall at the end of a name&lt;br /&gt;
			end																	-- no error message if not a suffix; possibly because of Romanization&lt;br /&gt;
		end&lt;br /&gt;
		if 3 &amp;gt; i then&lt;br /&gt;
			table.insert (initials_t, mw.ustring.sub (names_t[i], 1, 1));		-- insert the initial at end of initials sequence&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;																-- bump the counter&lt;br /&gt;
	end&lt;br /&gt;
			&lt;br /&gt;
	return table.concat (initials_t);											-- Vancouver format does not include spaces.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N T E R W I K I _ P R E F I X E N _ G E T &amp;gt;----------------------------------&lt;br /&gt;
&lt;br /&gt;
extract interwiki prefixen from &amp;lt;value&amp;gt;.  Returns two one or two values:&lt;br /&gt;
	false – no prefixen&lt;br /&gt;
	nil – prefix exists but not recognized&lt;br /&gt;
	project prefix, language prefix – when value has either of:&lt;br /&gt;
		:&amp;lt;project&amp;gt;:&amp;lt;language&amp;gt;:&amp;lt;article&amp;gt;&lt;br /&gt;
		:&amp;lt;language&amp;gt;:&amp;lt;project&amp;gt;:&amp;lt;article&amp;gt;&lt;br /&gt;
	project prefix, nil – when &amp;lt;value&amp;gt; has only a known single-letter prefix&lt;br /&gt;
	nil, language prefix – when &amp;lt;value&amp;gt; has only a known language prefix&lt;br /&gt;
&lt;br /&gt;
accepts single-letter project prefixen: &#039;d&#039; (wikidata), &#039;s&#039; (wikisource), and &#039;w&#039; (wikipedia) prefixes; at this&lt;br /&gt;
writing, the other single-letter prefixen (b (wikibook), c (commons), m (meta), n (wikinews), q (wikiquote), and&lt;br /&gt;
v (wikiversity)) are not supported.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function interwiki_prefixen_get (value, is_link)&lt;br /&gt;
	if not value:find (&#039;:%l+:&#039;) then											-- if no prefix&lt;br /&gt;
		return false;															-- abandon; boolean here to distinguish from nil fail returns later&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local prefix_patterns_linked_t = {											-- sequence of valid interwiki and inter project prefixen&lt;br /&gt;
		&#039;^%[%[:([dsw]):(%l%l+):&#039;,												-- wikilinked; project and language prefixes&lt;br /&gt;
		&#039;^%[%[:(%l%l+):([dsw]):&#039;,												-- wikilinked; language and project prefixes&lt;br /&gt;
		&#039;^%[%[:([dsw]):&#039;,														-- wikilinked; project prefix&lt;br /&gt;
		&#039;^%[%[:(%l%l+):&#039;,														-- wikilinked; language prefix&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
	local prefix_patterns_unlinked_t = {										-- sequence of valid interwiki and inter project prefixen&lt;br /&gt;
		&#039;^:([dsw]):(%l%l+):&#039;,													-- project and language prefixes&lt;br /&gt;
		&#039;^:(%l%l+):([dsw]):&#039;,													-- language and project prefixes&lt;br /&gt;
		&#039;^:([dsw]):&#039;,															-- project prefix&lt;br /&gt;
		&#039;^:(%l%l+):&#039;,															-- language prefix&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local cap1, cap2;&lt;br /&gt;
	for _, pattern in ipairs ((is_link and prefix_patterns_linked_t) or prefix_patterns_unlinked_t) do&lt;br /&gt;
		cap1, cap2 = value:match (pattern);&lt;br /&gt;
		if cap1 then&lt;br /&gt;
			break;																-- found a match so stop looking&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if cap1 and cap2 then														-- when both then :project:language: or :language:project: (both forms allowed)&lt;br /&gt;
		if 1 == #cap1 then														-- length == 1 then :project:language:&lt;br /&gt;
			if cfg.inter_wiki_map[cap2] then									-- is language prefix in the interwiki map?&lt;br /&gt;
				return cap1, cap2;												-- return interwiki project and interwiki language&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- here when :language:project:&lt;br /&gt;
			if cfg.inter_wiki_map[cap1] then									-- is language prefix in the interwiki map?&lt;br /&gt;
				return cap2, cap1;												-- return interwiki project and interwiki language&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return nil;																-- unknown interwiki language&lt;br /&gt;
	elseif not (cap1 or cap2) then												-- both are nil?&lt;br /&gt;
		return nil;																-- we got something that looks like a project prefix but isn&#039;t; return fail&lt;br /&gt;
	elseif 1 == #cap1 then														-- here when one capture&lt;br /&gt;
		return cap1, nil;														-- length is 1 so return project, nil language&lt;br /&gt;
	else																		-- here when one capture and its length it more than 1&lt;br /&gt;
		if cfg.inter_wiki_map[cap1] then										-- is language prefix in the interwiki map?&lt;br /&gt;
			return nil, cap1;													-- return nil project, language&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I S T _ P E O P L E &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a list of people (authors, contributors, editors, interviewers, translators) &lt;br /&gt;
&lt;br /&gt;
names in the list will be linked when&lt;br /&gt;
	|&amp;lt;name&amp;gt;-link= has a value&lt;br /&gt;
	|&amp;lt;name&amp;gt;-mask- does NOT have a value; masked names are presumed to have been&lt;br /&gt;
		rendered previously so should have been linked there&lt;br /&gt;
&lt;br /&gt;
when |&amp;lt;name&amp;gt;-mask=0, the associated name is not rendered&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function list_people (control, people, etal)&lt;br /&gt;
	local sep;&lt;br /&gt;
	local namesep;&lt;br /&gt;
	local format = control.format;&lt;br /&gt;
	local maximum = control.maximum;&lt;br /&gt;
	local name_list = {};&lt;br /&gt;
&lt;br /&gt;
	if &#039;vanc&#039; == format then													-- Vancouver-like name styling?&lt;br /&gt;
		sep = cfg.presentation[&#039;sep_nl_vanc&#039;];									-- name-list separator between names is a comma&lt;br /&gt;
		namesep = cfg.presentation[&#039;sep_name_vanc&#039;];							-- last/first separator is a space&lt;br /&gt;
	else&lt;br /&gt;
		sep = cfg.presentation[&#039;sep_nl&#039;];										-- name-list separator between names is a semicolon&lt;br /&gt;
		namesep = cfg.presentation[&#039;sep_name&#039;];									-- last/first separator is &amp;lt;comma&amp;gt;&amp;lt;space&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if sep:sub (-1, -1) ~= &amp;quot; &amp;quot; then sep = sep .. &amp;quot; &amp;quot; end&lt;br /&gt;
	if utilities.is_set (maximum) and maximum &amp;lt; 1 then return &amp;quot;&amp;quot;, 0; end		-- returned 0 is for EditorCount; not used for other names&lt;br /&gt;
	&lt;br /&gt;
	for i, person in ipairs (people) do&lt;br /&gt;
		if utilities.is_set (person.last) then&lt;br /&gt;
			local mask = person.mask;&lt;br /&gt;
			local one;&lt;br /&gt;
			local sep_one = sep;&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (maximum) and i &amp;gt; maximum then&lt;br /&gt;
				etal = true;&lt;br /&gt;
				break;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if mask then&lt;br /&gt;
				local n = tonumber (mask);										-- convert to a number if it can be converted; nil else&lt;br /&gt;
				if n then&lt;br /&gt;
					one = 0 ~= n and string.rep(&amp;quot;&amp;amp;mdash;&amp;quot;, n) or nil;			-- make a string of (n &amp;gt; 0) mdashes, nil else, to replace name&lt;br /&gt;
					person.link = nil;											-- don&#039;t create link to name if name is replaces with mdash string or has been set nil&lt;br /&gt;
				else&lt;br /&gt;
					one = mask;													-- replace name with mask text (must include name-list separator)&lt;br /&gt;
					sep_one = &amp;quot; &amp;quot;;												-- modify name-list separator&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				one = person.last;												-- get surname&lt;br /&gt;
				local first = person.first										-- get given name&lt;br /&gt;
				if utilities.is_set (first) then&lt;br /&gt;
					if (&amp;quot;vanc&amp;quot; == format) then									-- if Vancouver format&lt;br /&gt;
						one = one:gsub (&#039;%.&#039;, &#039;&#039;);								-- remove periods from surnames (http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)&lt;br /&gt;
						if not person.corporate and is_good_vanc_name (one, first, nil, i) then		-- and name is all Latin characters; corporate authors not tested&lt;br /&gt;
							first = reduce_to_initials (first, i);				-- attempt to convert first name(s) to initials&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					one = one .. namesep .. first;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if utilities.is_set (person.link) then&lt;br /&gt;
				one = utilities.make_wikilink (person.link, one);				-- link author/editor&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if one then															-- if &amp;lt;one&amp;gt; has a value (name, mdash replacement, or mask text replacement)&lt;br /&gt;
				local proj, tag = interwiki_prefixen_get (one, true);			-- get the interwiki prefixen if present&lt;br /&gt;
				if &#039;w&#039; == proj and (&#039;Wikipedia&#039; == mw.site.namespaces.Project[&#039;name&#039;]) then&lt;br /&gt;
					proj = nil;													-- for stuff like :w:de:&amp;lt;article&amp;gt;, :w is unnecessary TODO: maint cat?&lt;br /&gt;
				end&lt;br /&gt;
				if proj then&lt;br /&gt;
					local proj_name = ({[&#039;d&#039;] = &#039;Wikidata&#039;, [&#039;s&#039;] = &#039;Wikisource&#039;, [&#039;w&#039;] = &#039;Wikipedia&#039;})[proj];	-- :w (wikipedia) for linking from a non-wikipedia project&lt;br /&gt;
					if proj_name then &lt;br /&gt;
						one = one .. utilities.wrap_style (&#039;interproj&#039;, proj_name);	-- add resized leading space, brackets, static text, language name&lt;br /&gt;
						utilities.add_prop_cat (&#039;interproj-linked-name&#039;, proj);	-- categorize it; &amp;lt;proj&amp;gt; is sort key&lt;br /&gt;
						tag = nil;												-- unset; don&#039;t do both project and language&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if tag == cfg.this_wiki_code then&lt;br /&gt;
					tag = nil;													-- stuff like :en:&amp;lt;article&amp;gt; at en.wiki is pointless TODO: maint cat?&lt;br /&gt;
				end&lt;br /&gt;
				if tag then&lt;br /&gt;
					local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag];&lt;br /&gt;
					if lang then												-- error messaging done in extract_names() where we know parameter names&lt;br /&gt;
						one = one .. utilities.wrap_style (&#039;interwiki&#039;, lang);	-- add resized leading space, brackets, static text, language name&lt;br /&gt;
						utilities.add_prop_cat (&#039;interwiki-linked-name&#039;, tag);	-- categorize it; &amp;lt;tag&amp;gt; is sort key&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				table.insert (name_list, one);									-- add it to the list of names&lt;br /&gt;
				table.insert (name_list, sep_one);								-- add the proper name-list separator&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local count = #name_list / 2;												-- (number of names + number of separators) divided by 2&lt;br /&gt;
	if 0 &amp;lt; count then &lt;br /&gt;
		if 1 &amp;lt; count and not etal then&lt;br /&gt;
			if &#039;amp&#039; == format then&lt;br /&gt;
				name_list[#name_list-2] = &amp;quot; &amp;amp; &amp;quot;;								-- replace last separator with ampersand text&lt;br /&gt;
			elseif &#039;and&#039; == format then&lt;br /&gt;
				if 2 == count then&lt;br /&gt;
					name_list[#name_list-2] = cfg.presentation.sep_nl_and;		-- replace last separator with &#039;and&#039; text&lt;br /&gt;
				else&lt;br /&gt;
					name_list[#name_list-2] = cfg.presentation.sep_nl_end;		-- replace last separator with &#039;(sep) and&#039; text&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		name_list[#name_list] = nil;											-- erase the last separator&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result = table.concat (name_list);									-- construct list&lt;br /&gt;
	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&lt;br /&gt;
		result = result .. sep .. cfg.messages[&#039;et al&#039;];						-- we&#039;ve got a last-first list and etal so add et al.&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return result, count;														-- return name-list string and count of number of names (count used for editor names only)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------&amp;lt; M A K E _ C I T E R E F _ I D &amp;gt;-----------------------&lt;br /&gt;
&lt;br /&gt;
Generates a CITEREF anchor ID if we have at least one name or a date.  Otherwise&lt;br /&gt;
returns an empty string.&lt;br /&gt;
&lt;br /&gt;
namelist is one of the contributor-, author-, or editor-name lists chosen in that&lt;br /&gt;
order.  year is Year or anchor_year.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_citeref_id (namelist, year)&lt;br /&gt;
	local names={};							-- a table for the one to four names and year&lt;br /&gt;
	for i,v in ipairs (namelist) do			-- loop through the list and take up to the first four last names&lt;br /&gt;
		names[i] = v.last&lt;br /&gt;
		if i == 4 then break end			-- if four then done&lt;br /&gt;
	end&lt;br /&gt;
	table.insert (names, year);				-- add the year at the end&lt;br /&gt;
	local id = table.concat(names);			-- concatenate names and year for CITEREF id&lt;br /&gt;
	if utilities.is_set (id) then			-- if concatenation is not an empty string&lt;br /&gt;
		return &amp;quot;CITEREF&amp;quot; .. id;				-- add the CITEREF portion&lt;br /&gt;
	else&lt;br /&gt;
		return &#039;&#039;;							-- return an empty string; no reason to include CITEREF id in this citation&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E _ C L A S S _A T T R I B U T E _M A K E &amp;gt;------------------------------&lt;br /&gt;
&lt;br /&gt;
construct &amp;lt;cite&amp;gt; tag class attribute for this citation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cite_class&amp;gt; – config.CitationClass from calling template&lt;br /&gt;
&amp;lt;mode&amp;gt; – value from |mode= parameter&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function cite_class_attribute_make (cite_class, mode)&lt;br /&gt;
	local class_t = {};&lt;br /&gt;
	table.insert (class_t, &#039;citation&#039;);											-- required for blue highlight&lt;br /&gt;
	if &#039;citation&#039; ~= cite_class then&lt;br /&gt;
		table.insert (class_t, cite_class);										-- identify this template for user css&lt;br /&gt;
		table.insert (class_t, utilities.is_set (mode) and mode or &#039;cs1&#039;);		-- identify the citation style for user css or javascript&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (class_t, utilities.is_set (mode) and mode or &#039;cs2&#039;);		-- identify the citation style for user css or javascript&lt;br /&gt;
	end&lt;br /&gt;
	for _, prop_key in ipairs (z.prop_keys_t) do&lt;br /&gt;
		table.insert (class_t, prop_key);										-- identify various properties for user css or javascript&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat (class_t, &#039; &#039;);											-- make a big string and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; N A M E _ H A S _ E T A L &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Evaluates the content of name parameters (author, editor, etc.) for variations on&lt;br /&gt;
the theme of et al.  If found, the et al. is removed, a flag is set to true and&lt;br /&gt;
the function returns the modified name and the flag.&lt;br /&gt;
&lt;br /&gt;
This function never sets the flag to false but returns its previous state because&lt;br /&gt;
it may have been set by previous passes through this function or by the associated&lt;br /&gt;
|display-&amp;lt;names&amp;gt;=etal parameter&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_etal (name, etal, nocat, param)&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (name) then												-- name can be nil in which case just return&lt;br /&gt;
		local patterns = cfg.et_al_patterns; 									-- get patterns from configuration&lt;br /&gt;
		&lt;br /&gt;
		for _, pattern in ipairs (patterns) do									-- loop through all of the patterns&lt;br /&gt;
			if name:match (pattern) then										-- if this &#039;et al&#039; pattern is found in name&lt;br /&gt;
				name = name:gsub (pattern, &#039;&#039;);									-- remove the offending text&lt;br /&gt;
				etal = true;													-- set flag (may have been set previously here or by |display-&amp;lt;names&amp;gt;=etal)&lt;br /&gt;
				if not nocat then												-- no categorization for |vauthors=&lt;br /&gt;
					utilities.set_message (&#039;err_etal&#039;, {param});				-- and set an error if not added&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return name, etal;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; N A M E _ I S _ N U M E R I C &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
Add an error message and category when &amp;lt;name&amp;gt; parameter value does not contain letters.  &lt;br /&gt;
&lt;br /&gt;
Add a maintenance category when &amp;lt;name&amp;gt; parameter value has numeric characters mixed with characters that are &lt;br /&gt;
not numeric characters; could be letters and/or punctuation characters.&lt;br /&gt;
&lt;br /&gt;
This function will only emit one error and one maint message for the current template.  Does not emit both error&lt;br /&gt;
and maint messages/categories for the same parameter value.&lt;br /&gt;
&lt;br /&gt;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_is_numeric (name, name_alias, list_name)&lt;br /&gt;
	local patterns = {&lt;br /&gt;
		&#039;^%D+%d&#039;,																-- &amp;lt;name&amp;gt; must have digits preceded by other characters&lt;br /&gt;
		&#039;^%D*%d+%D+&#039;,															-- &amp;lt;name&amp;gt; must have digits followed by other characters&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	if not added_numeric_name_errs and mw.ustring.match (name, &#039;^[%A]+$&#039;) then	-- if we have not already set an error message and &amp;lt;name&amp;gt; does not have any alpha characters&lt;br /&gt;
		utilities.set_message (&#039;err_numeric_names&#039;, name_alias);				-- add an error message&lt;br /&gt;
		added_numeric_name_errs = true;											-- set the flag so we emit only one error message&lt;br /&gt;
		return;																	-- when here no point in further testing; abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not added_numeric_name_maint then										-- if we have already set a maint message&lt;br /&gt;
		for _, pattern in ipairs (patterns) do									-- spin through list of patterns&lt;br /&gt;
			if mw.ustring.match (name, pattern) then							-- digits preceded or followed by anything but digits; %D+ includes punctuation&lt;br /&gt;
				utilities.set_message (&#039;maint_numeric_names&#039;, cfg.special_case_translation [list_name]);	-- add a maint cat for this template&lt;br /&gt;
				added_numeric_name_maint = true;								-- set the flag so we emit only one maint message&lt;br /&gt;
				return;															-- when here no point in further testing; abandon&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-----------------&amp;lt; N A M E _ H A S _ M U L T _ N A M E S &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
Evaluates the content of last/surname (authors etc.) parameters for multiple names.&lt;br /&gt;
Multiple names are indicated if there is more than one comma or any &amp;quot;unescaped&amp;quot;&lt;br /&gt;
semicolons. Escaped semicolons are ones used as part of selected HTML entities.&lt;br /&gt;
If the condition is met, the function adds the multiple name maintenance category.&lt;br /&gt;
&lt;br /&gt;
Same test for first except that commas should not appear in given names (MOS:JR says&lt;br /&gt;
that the generational suffix does not take a separator character).  Titles, degrees,&lt;br /&gt;
postnominals, affiliations, all normally comma separated don&#039;t belong in a citation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;name&amp;gt; – name parameter value&lt;br /&gt;
&amp;lt;list_name&amp;gt; – AuthorList, EditorList, etc&lt;br /&gt;
&amp;lt;limit&amp;gt; – number of allowed commas; 1 (default) for surnames; 0 for given names&lt;br /&gt;
&lt;br /&gt;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_mult_names (name, list_name, limit)&lt;br /&gt;
	local _, commas, semicolons, nbsps;&lt;br /&gt;
	limit = limit and limit or 1;&lt;br /&gt;
	if utilities.is_set (name) then&lt;br /&gt;
		_, commas = name:gsub (&#039;,&#039;, &#039;&#039;);										-- count the number of commas&lt;br /&gt;
		_, semicolons = name:gsub (&#039;;&#039;, &#039;&#039;);									-- count the number of semicolons&lt;br /&gt;
		-- nbsps probably should be its own separate count rather than merged in&lt;br /&gt;
		-- some way with semicolons because Lua patterns do not support the&lt;br /&gt;
		-- grouping operator that regex does, which means there is no way to add&lt;br /&gt;
		-- more entities to escape except by adding more counts with the new&lt;br /&gt;
		-- entities&lt;br /&gt;
		_, nbsps = name:gsub (&#039;&amp;amp;nbsp;&#039;,&#039;&#039;);										-- count nbsps&lt;br /&gt;
		&lt;br /&gt;
		-- There is exactly 1 semicolon per &amp;amp;nbsp; entity, so subtract nbsps&lt;br /&gt;
		-- from semicolons to &#039;escape&#039; them. If additional entities are added,&lt;br /&gt;
		-- they also can be subtracted.&lt;br /&gt;
		if limit &amp;lt; commas or 0 &amp;lt; (semicolons - nbsps) then&lt;br /&gt;
			utilities.set_message (&#039;maint_mult_names&#039;, cfg.special_case_translation [list_name]);	-- add a maint message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ G E N E R I C &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Compares values assigned to various parameters according to the string provided as &amp;lt;item&amp;gt; in the function call.&lt;br /&gt;
&amp;lt;item&amp;gt; can have on of two values:&lt;br /&gt;
	&#039;generic_names&#039; – for name-holding parameters: |last=, |first=, |editor-last=, etc&lt;br /&gt;
	&#039;generic_titles&#039; – for |title=&lt;br /&gt;
&lt;br /&gt;
There are two types of generic tests.  The &#039;accept&#039; tests look for a pattern that should not be rejected by the&lt;br /&gt;
&#039;reject&#039; test.  For example,&lt;br /&gt;
	|author=[[John Smith (author)|Smith, John]]&lt;br /&gt;
would be rejected by the &#039;author&#039; reject test.  But piped wikilinks with &#039;author&#039; disambiguation should not be&lt;br /&gt;
rejected so the &#039;accept&#039; test prevents that from happening.  Accept tests are always performed before reject&lt;br /&gt;
tests.&lt;br /&gt;
&lt;br /&gt;
Each of the &#039;accept&#039; and &#039;reject&#039; sequence tables hold tables for en.wiki ([&#039;en&#039;]) and local.wiki ([&#039;local&#039;])&lt;br /&gt;
that each can hold a test sequence table  The sequence table holds, at index [1], a test pattern, and, at index&lt;br /&gt;
[2], a boolean control value.  The control value tells string.find() or mw.ustring.find() to do plain-text search (true)&lt;br /&gt;
or a pattern search (false).  The intent of all this complexity is to make these searches as fast as possible so&lt;br /&gt;
that we don&#039;t run out of processing time on very large articles.&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
	true when a reject test finds the pattern or string&lt;br /&gt;
	false when an accept test finds the pattern or string&lt;br /&gt;
	nil else&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_generic (item, value, wiki)&lt;br /&gt;
	local test_val;&lt;br /&gt;
	local str_lower = {															-- use string.lower() for en.wiki ([&#039;en&#039;]) and use mw.ustring.lower() or local.wiki ([&#039;local&#039;])&lt;br /&gt;
		[&#039;en&#039;] = string.lower,&lt;br /&gt;
		[&#039;local&#039;] = mw.ustring.lower,&lt;br /&gt;
		}&lt;br /&gt;
	local str_find = {															-- use string.find() for en.wiki ([&#039;en&#039;]) and use mw.ustring.find() or local.wiki ([&#039;local&#039;])&lt;br /&gt;
		[&#039;en&#039;] = string.find,&lt;br /&gt;
		[&#039;local&#039;] = mw.ustring.find,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	local function test (val, test_t, wiki)										-- local function to do the testing; &amp;lt;wiki&amp;gt; selects lower() and find() functions&lt;br /&gt;
		val = test_t[2] and str_lower[wiki](value) or val;						-- when &amp;lt;test_t[2]&amp;gt; set to &#039;true&#039;, plaintext search using lowercase value&lt;br /&gt;
		return str_find[wiki] (val, test_t[1], 1, test_t[2]);					-- return nil when not found or matched&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
	local test_types_t = {&#039;accept&#039;, &#039;reject&#039;};									-- test accept patterns first, then reject patterns&lt;br /&gt;
	local wikis_t = {&#039;en&#039;, &#039;local&#039;};											-- do tests for each of these keys; en.wiki first, local.wiki second&lt;br /&gt;
&lt;br /&gt;
	for _, test_type in ipairs (test_types_t) do								-- for each test type&lt;br /&gt;
		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&lt;br /&gt;
			for _, wiki in ipairs (wikis_t) do&lt;br /&gt;
				if generic_value[wiki] then&lt;br /&gt;
					if test (value, generic_value[wiki], wiki) then				-- go do the test&lt;br /&gt;
						return (&#039;reject&#039; == test_type);							-- param value rejected, return true; false else&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N A M E _ I S _ G E N E R I C &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
calls is_generic() to determine if &amp;lt;name&amp;gt; is a &#039;generic name&#039; listed in cfg.generic_names; &amp;lt;name_alias&amp;gt; is the&lt;br /&gt;
parameter name used in error messaging&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_is_generic (name, name_alias)&lt;br /&gt;
	if not added_generic_name_errs  and is_generic (&#039;generic_names&#039;, name) then&lt;br /&gt;
		utilities.set_message (&#039;err_generic_name&#039;, name_alias);					-- set an error message&lt;br /&gt;
		added_generic_name_errs = true;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N A M E _ C H E C K S &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function calls various name checking functions used to validate the content of the various name-holding parameters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_checks (last, first, list_name, last_alias, first_alias)&lt;br /&gt;
	local accept_name;&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (last) then&lt;br /&gt;
		last, accept_name = utilities.has_accept_as_written (last);				-- remove accept-this-as-written markup when it wraps all of &amp;lt;last&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		if not accept_name then													-- &amp;lt;last&amp;gt; not wrapped in accept-as-written markup&lt;br /&gt;
			name_has_mult_names (last, list_name);								-- check for multiple names in the parameter&lt;br /&gt;
			name_is_numeric (last, last_alias, list_name);						-- check for names that have no letters or are a mix of digits and other characters&lt;br /&gt;
			name_is_generic (last, last_alias);									-- check for names found in the generic names list&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (first) then&lt;br /&gt;
		first, accept_name = utilities.has_accept_as_written (first);			-- remove accept-this-as-written markup when it wraps all of &amp;lt;first&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		if not accept_name then													-- &amp;lt;first&amp;gt; not wrapped in accept-as-written markup&lt;br /&gt;
			name_has_mult_names (first, list_name, 0);							-- check for multiple names in the parameter; 0 is number of allowed commas in a given name&lt;br /&gt;
			name_is_numeric (first, first_alias, list_name);					-- check for names that have no letters or are a mix of digits and other characters&lt;br /&gt;
			name_is_generic (first, first_alias);								-- check for names found in the generic names list&lt;br /&gt;
		end&lt;br /&gt;
		local wl_type, D = utilities.is_wikilink (first);&lt;br /&gt;
		if 0 ~= wl_type then&lt;br /&gt;
			first = D;&lt;br /&gt;
			utilities.set_message (&#039;err_bad_paramlink&#039;, first_alias);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return last, first;															-- done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------------&amp;lt; E X T R A C T _ N A M E S &amp;gt;-------------------------&lt;br /&gt;
&lt;br /&gt;
Gets name list from the input arguments&lt;br /&gt;
&lt;br /&gt;
Searches through args in sequential order to find |lastn= and |firstn= parameters&lt;br /&gt;
(or their aliases), and their matching link and mask parameters. Stops searching&lt;br /&gt;
when both |lastn= and |firstn= are not found in args after two sequential attempts:&lt;br /&gt;
found |last1=, |last2=, and |last3= but doesn&#039;t find |last4= and |last5= then the&lt;br /&gt;
search is done.&lt;br /&gt;
&lt;br /&gt;
This function emits an error message when there is a |firstn= without a matching&lt;br /&gt;
|lastn=.  When there are &#039;holes&#039; in the list of last names, |last1= and |last3=&lt;br /&gt;
are present but |last2= is missing, an error message is emitted. |lastn= is not&lt;br /&gt;
required to have a matching |firstn=.&lt;br /&gt;
&lt;br /&gt;
When an author or editor parameter contains some form of &#039;et al.&#039;, the &#039;et al.&#039;&lt;br /&gt;
is stripped from the parameter and a flag (etal) returned that will cause list_people()&lt;br /&gt;
to add the static &#039;et al.&#039; text from Module:Citation/CS1/Configuration.  This keeps&lt;br /&gt;
&#039;et al.&#039; out of the template&#039;s metadata.  When this occurs, an error is emitted.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_names(args, list_name)&lt;br /&gt;
	local names = {};															-- table of names&lt;br /&gt;
	local last;																	-- individual name components&lt;br /&gt;
	local first;&lt;br /&gt;
	local link;&lt;br /&gt;
	local mask;&lt;br /&gt;
	local i = 1;																-- loop counter/indexer&lt;br /&gt;
	local n = 1;																-- output table indexer&lt;br /&gt;
	local count = 0;															-- used to count the number of times we haven&#039;t found a |last= (or alias for authors, |editor-last or alias for editors)&lt;br /&gt;
	local etal = false;															-- return value set to true when we find some form of et al. in an author parameter&lt;br /&gt;
&lt;br /&gt;
	local last_alias, first_alias, link_alias;									-- selected parameter aliases used in error messaging&lt;br /&gt;
	while true do&lt;br /&gt;
		last, last_alias = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Last&#039;], &#039;err_redundant_parameters&#039;, i );		-- search through args for name components beginning at 1&lt;br /&gt;
		first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-First&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
		link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Link&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Mask&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
	&lt;br /&gt;
		if last then															-- error check |lastn= alias for unknown interwiki link prefix; done here because this is where we have the parameter name&lt;br /&gt;
			local project, language = interwiki_prefixen_get (last, true);		-- true because we expect interwiki links in |lastn= to be wikilinked&lt;br /&gt;
			if nil == project and nil == language then							-- when both are nil&lt;br /&gt;
				utilities.set_message (&#039;err_bad_paramlink&#039;, last_alias);		-- not known, emit an error message	-- TODO: err_bad_interwiki?&lt;br /&gt;
				last = utilities.remove_wiki_link (last);						-- remove wikilink markup; show display value only&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if link then															-- error check |linkn= alias for unknown interwiki link prefix&lt;br /&gt;
			local project, language = interwiki_prefixen_get (link, false);		-- false because wiki links in |author-linkn= is an error&lt;br /&gt;
			if nil == project and nil == language then							-- when both are nil&lt;br /&gt;
				utilities.set_message (&#039;err_bad_paramlink&#039;, link_alias);		-- not known, emit an error message	-- TODO: err_bad_interwiki?&lt;br /&gt;
				link = nil;														-- unset so we don&#039;t link&lt;br /&gt;
				link_alias = nil;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		last, etal = name_has_etal (last, etal, false, last_alias);				-- find and remove variations on et al.&lt;br /&gt;
		first, etal = name_has_etal (first, etal, false, first_alias);			-- find and remove variations on et al.&lt;br /&gt;
		last, first = name_checks (last, first, list_name, last_alias, first_alias);						-- multiple names, extraneous annotation, etc. checks&lt;br /&gt;
&lt;br /&gt;
		if first and not last then												-- if there is a firstn without a matching lastn&lt;br /&gt;
			local alias = first_alias:find (&#039;given&#039;, 1, true) and &#039;given&#039; or &#039;first&#039;;	-- get first or given form of the alias&lt;br /&gt;
			utilities.set_message (&#039;err_first_missing_last&#039;, {&lt;br /&gt;
				first_alias,													-- param name of alias missing its mate&lt;br /&gt;
				first_alias:gsub (alias, {[&#039;first&#039;] = &#039;last&#039;, [&#039;given&#039;] = &#039;surname&#039;}),	-- make param name appropriate to the alias form&lt;br /&gt;
				});																-- add this error message&lt;br /&gt;
		elseif not first and not last then										-- if both firstn and lastn aren&#039;t found, are we done?&lt;br /&gt;
			count = count + 1;													-- number of times we haven&#039;t found last and first&lt;br /&gt;
			if 2 &amp;lt;= count then													-- two missing names and we give up&lt;br /&gt;
				break;															-- normal exit or there is a two-name hole in the list; can&#039;t tell which&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- we have last with or without a first&lt;br /&gt;
			local result;&lt;br /&gt;
			link = link_title_ok (link, link_alias, last, last_alias);			-- check for improper wiki-markup&lt;br /&gt;
&lt;br /&gt;
			if first then&lt;br /&gt;
				link = link_title_ok (link, link_alias, first, first_alias);	-- check for improper wiki-markup&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			names[n] = {last = last, first = first, link = link, mask = mask, corporate = false};	-- add this name to our names list (corporate for |vauthors= only)&lt;br /&gt;
			n = n + 1;															-- point to next location in the names table&lt;br /&gt;
			if 1 == count then													-- if the previous name was missing&lt;br /&gt;
				utilities.set_message (&#039;err_missing_name&#039;, {list_name:match (&amp;quot;(%w+)List&amp;quot;):lower(), i - 1});	-- add this error message&lt;br /&gt;
			end&lt;br /&gt;
			count = 0;															-- reset the counter, we&#039;re looking for two consecutive missing names&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;																-- point to next args location&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return names, etal;															-- all done, return our list of names and the etal flag&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N A M E _ T A G _ G E T &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
attempt to decode |language=&amp;lt;lang_param&amp;gt; and return language name and matching tag; nil else.&lt;br /&gt;
&lt;br /&gt;
This function looks for:&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a tag in cfg.lang_tag_remap{}&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a name in cfg.lang_name_remap{}&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a name in cfg.mw_languages_by_name_t&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a tag in cfg.mw_languages_by_tag_t&lt;br /&gt;
when those fail, presume that &amp;lt;lang_param&amp;gt; is an IETF-like tag that MediaWiki does not recognize.  Strip all&lt;br /&gt;
script, region, variant, whatever subtags from &amp;lt;lang_param&amp;gt; to leave just a two or three character language tag&lt;br /&gt;
and look for the new &amp;lt;lang_param&amp;gt; in cfg.mw_languages_by_tag_t{}&lt;br /&gt;
&lt;br /&gt;
on success, returns name (in properly capitalized form) and matching tag (in lowercase); on failure returns nil&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_tag_get (lang_param)&lt;br /&gt;
	local lang_param_lc = mw.ustring.lower (lang_param);						-- use lowercase as an index into the various tables&lt;br /&gt;
	local name;&lt;br /&gt;
	local tag;&lt;br /&gt;
&lt;br /&gt;
	name = cfg.lang_tag_remap[lang_param_lc];									-- assume &amp;lt;lang_param_lc&amp;gt; is a tag; attempt to get remapped language name &lt;br /&gt;
	if name then																-- when &amp;lt;name&amp;gt;, &amp;lt;lang_param&amp;gt; is a tag for a remapped language name&lt;br /&gt;
		if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then&lt;br /&gt;
			utilities.set_message (&#039;maint_unknown_lang&#039;);						-- add maint category if not already added&lt;br /&gt;
			return name, cfg.lang_name_remap[name:lower()][2];					-- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn&lt;br /&gt;
		end&lt;br /&gt;
		return name, lang_param_lc;												-- so return &amp;lt;name&amp;gt; from remap and &amp;lt;lang_param_lc&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	tag = lang_param_lc:match (&#039;^(%a%a%a?)%-.*&#039;);								-- still assuming that &amp;lt;lang_param_lc&amp;gt; is a tag; strip script, region, variant subtags&lt;br /&gt;
	name = cfg.lang_tag_remap[tag];												-- attempt to get remapped language name with language subtag only&lt;br /&gt;
	if name then																-- when &amp;lt;name&amp;gt;, &amp;lt;tag&amp;gt; is a tag for a remapped language name&lt;br /&gt;
		return name, tag;														-- so return &amp;lt;name&amp;gt; from remap and &amp;lt;tag&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.lang_name_remap[lang_param_lc] then									-- not a remapped tag, assume &amp;lt;lang_param_lc&amp;gt; is a name; attempt to get remapped language tag &lt;br /&gt;
		return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2];	-- for this &amp;lt;lang_param_lc&amp;gt;, return a (possibly) new name and appropriate tag&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	name = cfg.mw_languages_by_tag_t[lang_param_lc];							-- assume that &amp;lt;lang_param_lc&amp;gt; is a tag; attempt to get its matching language name&lt;br /&gt;
	&lt;br /&gt;
	if name then&lt;br /&gt;
		return name, lang_param_lc;												-- &amp;lt;lang_param_lc&amp;gt; is a tag so return it and &amp;lt;name&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	tag = cfg.mw_languages_by_name_t[lang_param_lc];							-- assume that &amp;lt;lang_param_lc&amp;gt; is a language name; attempt to get its matching tag&lt;br /&gt;
	&lt;br /&gt;
	if tag then&lt;br /&gt;
		return cfg.mw_languages_by_tag_t[tag], tag;								-- &amp;lt;lang_param_lc&amp;gt; is a name so return the name from the table and &amp;lt;tag&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	tag = lang_param_lc:match (&#039;^(%a%a%a?)%-.*&#039;);								-- is &amp;lt;lang_param_lc&amp;gt; an IETF-like tag that MediaWiki doesn&#039;t recognize? &amp;lt;tag&amp;gt; gets the language subtag; nil else&lt;br /&gt;
&lt;br /&gt;
	if tag then&lt;br /&gt;
		name = cfg.mw_languages_by_tag_t[tag];									-- attempt to get a language name using the shortened &amp;lt;tag&amp;gt;&lt;br /&gt;
		if name then&lt;br /&gt;
			return name, tag;													-- &amp;lt;lang_param_lc&amp;gt; is an unrecognized IETF-like tag so return &amp;lt;name&amp;gt; and language subtag&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------&amp;lt; L A N G U A G E _ P A R A M E T E R &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
Gets language name from a provided two- or three-character ISO 639 code.  If a code&lt;br /&gt;
is recognized by MediaWiki, use the returned name; if not, then use the value that&lt;br /&gt;
was provided with the language parameter.&lt;br /&gt;
&lt;br /&gt;
When |language= contains a recognized language (either code or name), the page is&lt;br /&gt;
assigned to the category for that code: Category:Norwegian-language sources (no).&lt;br /&gt;
For valid three-character code languages, the page is assigned to the single category&lt;br /&gt;
for &#039;639-2&#039; codes: Category:CS1 ISO 639-2 language sources.&lt;br /&gt;
&lt;br /&gt;
Languages that are the same as the local wiki are not categorized.  MediaWiki does&lt;br /&gt;
not recognize three-character equivalents of two-character codes: code &#039;ar&#039; is&lt;br /&gt;
recognized but code &#039;ara&#039; is not.&lt;br /&gt;
&lt;br /&gt;
This function supports multiple languages in the form |language=nb, French, th&lt;br /&gt;
where the language names or codes are separated from each other by commas with&lt;br /&gt;
optional space characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function language_parameter (lang)&lt;br /&gt;
	local tag;																	-- some form of IETF-like language tag; language subtag with optional region, sript, vatiant, etc subtags&lt;br /&gt;
	local lang_subtag;															-- ve populates |language= with mostly unecessary region subtags the MediaWiki does not recognize; this is the base language subtag&lt;br /&gt;
	local name;																	-- the language name&lt;br /&gt;
	local language_list = {};													-- table of language names to be rendered&lt;br /&gt;
	local names_t = {};															-- table made from the value assigned to |language=&lt;br /&gt;
&lt;br /&gt;
	local this_wiki_name = mw.language.fetchLanguageName (cfg.this_wiki_code, cfg.this_wiki_code);	-- get this wiki&#039;s language name&lt;br /&gt;
&lt;br /&gt;
	names_t = mw.text.split (lang, &#039;%s*,%s*&#039;);									-- names should be a comma separated list&lt;br /&gt;
&lt;br /&gt;
	for _, lang in ipairs (names_t) do											-- reuse lang here because we don&#039;t yet know if lang is a language name or a language tag&lt;br /&gt;
		name, tag = name_tag_get (lang);										-- attempt to get name/tag pair for &amp;lt;lang&amp;gt;; &amp;lt;name&amp;gt; has proper capitalization; &amp;lt;tag&amp;gt; is lowercase&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (tag) then&lt;br /&gt;
			lang_subtag = tag:gsub (&#039;^(%a%a%a?)%-.*&#039;, &#039;%1&#039;);					-- for categorization, strip any IETF-like tags from language tag&lt;br /&gt;
&lt;br /&gt;
			if cfg.this_wiki_code ~= lang_subtag then							-- when the language is not the same as this wiki&#039;s language&lt;br /&gt;
				if 2 == lang_subtag:len() then									-- and is a two-character tag&lt;br /&gt;
					utilities.add_prop_cat (&#039;foreign-lang-source&#039;, {name, tag}, lang_subtag);		-- categorize it; tag appended to allow for multiple language categorization&lt;br /&gt;
				else															-- or is a recognized language (but has a three-character tag)&lt;br /&gt;
					utilities.add_prop_cat (&#039;foreign-lang-source-2&#039;, {lang_subtag}, lang_subtag);			-- categorize it differently TODO: support multiple three-character tag categories per cs1|2 template?&lt;br /&gt;
				end&lt;br /&gt;
			elseif cfg.local_lang_cat_enable then								-- when the language and this wiki&#039;s language are the same and categorization is enabled&lt;br /&gt;
				utilities.add_prop_cat (&#039;local-lang-source&#039;, {name, lang_subtag});		-- categorize it&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			name = lang;														-- return whatever &amp;lt;lang&amp;gt; has so that we show something&lt;br /&gt;
			utilities.set_message (&#039;maint_unknown_lang&#039;);						-- add maint category if not already added&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		table.insert (language_list, name);&lt;br /&gt;
		name = &#039;&#039;;																-- so we can reuse it&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	name = utilities.make_sep_list (#language_list, language_list);&lt;br /&gt;
	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, &#039;English&#039; in &#039;American English&#039;&lt;br /&gt;
		return &#039;&#039;;																-- if one language and that language is this wiki&#039;s return an empty string (no annotation)&lt;br /&gt;
	end&lt;br /&gt;
	return (&amp;quot; &amp;quot; .. wrap_msg (&#039;language&#039;, name));								-- otherwise wrap with &#039;(in ...)&#039;&lt;br /&gt;
	--[[ TODO: should only return blank or name rather than full list&lt;br /&gt;
	so we can clean up the bunched parenthetical elements Language, Type, Format&lt;br /&gt;
	]]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-----------------------&amp;lt; S E T _ C S _ S T Y L E &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Gets the default CS style configuration for the given mode.&lt;br /&gt;
Returns default separator and either postscript as passed in or the default.&lt;br /&gt;
In CS1, the default postscript and separator are &#039;.&#039;.&lt;br /&gt;
In CS2, the default postscript is the empty string and the default separator is &#039;,&#039;.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_cs_style (postscript, mode)&lt;br /&gt;
	if utilities.is_set(postscript) then&lt;br /&gt;
		-- emit a maintenance message if user postscript is the default cs1 postscript&lt;br /&gt;
		-- we catch the opposite case for cs2 in set_style&lt;br /&gt;
		if mode == &#039;cs1&#039; and postscript == cfg.presentation[&#039;ps_&#039; .. mode] then&lt;br /&gt;
			utilities.set_message (&#039;maint_postscript&#039;);&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		postscript = cfg.presentation[&#039;ps_&#039; .. mode];&lt;br /&gt;
	end&lt;br /&gt;
	return cfg.presentation[&#039;sep_&#039; .. mode], postscript;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S T Y L E &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
Sets the separator and postscript styles. Checks the |mode= first and the&lt;br /&gt;
#invoke CitationClass second. Removes the postscript if postscript == none.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_style (mode, postscript, cite_class)&lt;br /&gt;
	local sep;&lt;br /&gt;
	if &#039;cs2&#039; == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs2&#039;);&lt;br /&gt;
	elseif &#039;cs1&#039; == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs1&#039;);&lt;br /&gt;
	elseif &#039;citation&#039; == cite_class	then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs2&#039;);&lt;br /&gt;
	else&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs1&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.keywords_xlate[postscript:lower()] == &#039;none&#039; then&lt;br /&gt;
		-- emit a maintenance message if user postscript is the default cs2 postscript&lt;br /&gt;
		-- we catch the opposite case for cs1 in set_cs_style&lt;br /&gt;
		if &#039;cs2&#039; == mode or (&#039;cs1&#039; ~= mode and &#039;citation&#039; == cite_class) then	-- {{citation |title=Title |mode=cs1 |postscript=none}} should not emit maint message&lt;br /&gt;
			utilities.set_message (&#039;maint_postscript&#039;);&lt;br /&gt;
		end&lt;br /&gt;
		postscript = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return sep, postscript&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ P D F &amp;gt;-----------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines if a URL has the file extension that is one of the PDF file extensions&lt;br /&gt;
used by [[MediaWiki:Common.css]] when applying the PDF icon to external links.&lt;br /&gt;
&lt;br /&gt;
returns true if file extension is one of the recognized extensions, else false&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_pdf (url)&lt;br /&gt;
	return url:match (&#039;%.pdf$&#039;) or url:match (&#039;%.PDF$&#039;) or&lt;br /&gt;
		url:match (&#039;%.pdf[%?#]&#039;) or url:match (&#039;%.PDF[%?#]&#039;) or&lt;br /&gt;
		url:match (&#039;%.PDF&amp;amp;#035&#039;) or url:match (&#039;%.pdf&amp;amp;#035&#039;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S T Y L E _ F O R M A T &amp;gt;-----------------------&lt;br /&gt;
&lt;br /&gt;
Applies CSS style to |format=, |chapter-format=, etc.  Also emits an error message&lt;br /&gt;
if the format parameter does not have a matching URL parameter.  If the format parameter&lt;br /&gt;
is not set and the URL contains a file extension that is recognized as a PDF document&lt;br /&gt;
by MediaWiki&#039;s commons.css, this code will set the format parameter to (PDF) with&lt;br /&gt;
the appropriate styling.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function style_format (format, url, fmt_param, url_param)&lt;br /&gt;
	if utilities.is_set (format) then&lt;br /&gt;
		format = utilities.wrap_style (&#039;format&#039;, format);						-- add leading space, parentheses, resize&lt;br /&gt;
		if not utilities.is_set (url) then&lt;br /&gt;
			utilities.set_message (&#039;err_format_missing_url&#039;, {fmt_param, url_param});	-- add an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif is_pdf (url) then													-- format is not set so if URL is a PDF file then&lt;br /&gt;
		format = utilities.wrap_style (&#039;format&#039;, &#039;PDF&#039;);						-- set format to PDF&lt;br /&gt;
	else&lt;br /&gt;
		format = &#039;&#039;;															-- empty string for concatenation&lt;br /&gt;
	end&lt;br /&gt;
	return format;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; G E T _ D I S P L A Y _ N A M E S &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
Returns a number that defines the number of names displayed for author and editor&lt;br /&gt;
name lists and a Boolean flag to indicate when et al. should be appended to the name list.&lt;br /&gt;
&lt;br /&gt;
When the value assigned to |display-xxxxors= is a number greater than or equal to zero,&lt;br /&gt;
return the number and the previous state of the &#039;etal&#039; flag (false by default&lt;br /&gt;
but may have been set to true if the name list contains some variant of the text &#039;et al.&#039;).&lt;br /&gt;
&lt;br /&gt;
When the value assigned to |display-xxxxors= is the keyword &#039;etal&#039;, return a number&lt;br /&gt;
that is one greater than the number of authors in the list and set the &#039;etal&#039; flag true.&lt;br /&gt;
This will cause the list_people() to display all of the names in the name list followed by &#039;et al.&#039;&lt;br /&gt;
&lt;br /&gt;
In all other cases, returns nil and the previous state of the &#039;etal&#039; flag.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
	max: A[&#039;DisplayAuthors&#039;] or A[&#039;DisplayEditors&#039;], etc; a number or some flavor of etal&lt;br /&gt;
	count: #a or #e&lt;br /&gt;
	list_name: &#039;authors&#039; or &#039;editors&#039;&lt;br /&gt;
	etal: author_etal or editor_etal&lt;br /&gt;
&lt;br /&gt;
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but&lt;br /&gt;
not when &amp;lt;max&amp;gt; comes from {{cs1 config}} global settings.  When using global settings, &amp;lt;param&amp;gt; is set to the&lt;br /&gt;
keyword &#039;cs1 config&#039; which is used to supress the normal error.  Error is suppressed because it is to be expected&lt;br /&gt;
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_display_names (max, count, list_name, etal, param)&lt;br /&gt;
	if utilities.is_set (max) then&lt;br /&gt;
		if &#039;etal&#039; == max:lower():gsub(&amp;quot;[ &#039;%.]&amp;quot;, &#039;&#039;) then						-- the :gsub() portion makes &#039;etal&#039; from a variety of &#039;et al.&#039; spellings and stylings&lt;br /&gt;
			max = count + 1;													-- number of authors + 1 so display all author name plus et al.&lt;br /&gt;
			etal = true;														-- overrides value set by extract_names()&lt;br /&gt;
		elseif max:match (&#039;^%d+$&#039;) then											-- if is a string of numbers&lt;br /&gt;
			max = tonumber (max);												-- make it a number&lt;br /&gt;
			if (max &amp;gt;= count) and (&#039;cs1 config&#039; ~= param) then					-- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting&lt;br /&gt;
				utilities.set_message (&#039;err_disp_name&#039;, {param, max});			-- add error message&lt;br /&gt;
				max = nil;&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- not a valid keyword or number&lt;br /&gt;
			utilities.set_message (&#039;err_disp_name&#039;, {param, max});				-- add error message&lt;br /&gt;
			max = nil;															-- unset; as if |display-xxxxors= had not been set&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return max, etal;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------&amp;lt; E X T R A _ T E X T _ I N _ P A G E _ C H E C K &amp;gt;---------------&lt;br /&gt;
&lt;br /&gt;
Adds error if |page=, |pages=, |quote-page=, |quote-pages= has what appears to be&lt;br /&gt;
some form of p. or pp. abbreviation in the first characters of the parameter content.&lt;br /&gt;
&lt;br /&gt;
check page for extraneous p, p., pp, pp., pg, pg. at start of parameter value:&lt;br /&gt;
	good pattern: &#039;^P[^%.P%l]&#039; matches when page begins PX or P# but not Px&lt;br /&gt;
		      where x and X are letters and # is a digit&lt;br /&gt;
	bad pattern:  &#039;^[Pp][PpGg]&#039; matches when page begins pp, pP, Pp, PP, pg, pG, Pg, PG&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extra_text_in_page_check (val, name)&lt;br /&gt;
	if not val:match (cfg.vol_iss_pg_patterns.good_ppattern) then&lt;br /&gt;
		for _, pattern in ipairs (cfg.vol_iss_pg_patterns.bad_ppatterns) do		-- spin through the selected sequence table of patterns&lt;br /&gt;
			if val:match (pattern) then											-- when a match, error so&lt;br /&gt;
				utilities.set_message (&#039;err_extra_text_pages&#039;, name);	 		-- add error message&lt;br /&gt;
				return;															-- and done&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A _ T E X T _ I N _ V O L _ I S S _ C H E C K &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Adds error if |volume= or |issue= has what appears to be some form of redundant &#039;type&#039; indicator.  Applies to&lt;br /&gt;
both; this function looks for issue text in both |issue= and |volume= and looks for volume-like text in |voluem=&lt;br /&gt;
and |issue=.&lt;br /&gt;
&lt;br /&gt;
For |volume=:&lt;br /&gt;
	&#039;V.&#039;, or &#039;Vol.&#039; (with or without the dot) abbreviations or &#039;Volume&#039; in the first characters of the parameter&lt;br /&gt;
	content (all case insensitive). &#039;V&#039; and &#039;v&#039; (without the dot) are presumed to be roman numerals so&lt;br /&gt;
	are allowed.&lt;br /&gt;
&lt;br /&gt;
For |issue=:&lt;br /&gt;
	&#039;No.&#039;, &#039;I.&#039;, &#039;Iss.&#039; (with or without the dot) abbreviations, or &#039;Issue&#039; in the first characters of the&lt;br /&gt;
	parameter content (all case insensitive); numero styling: &#039;n°&#039; with degree sign U+00B0, and № precomposed&lt;br /&gt;
	numero sign U+2116.&lt;br /&gt;
	&lt;br /&gt;
Single character values (&#039;v&#039;, &#039;i&#039;, &#039;n&#039;) allowed when not followed by separator character (&#039;.&#039;, &#039;:&#039;, &#039;=&#039;, or&lt;br /&gt;
whitespace character) – param values are trimmed of whitespace by MediaWiki before delivered to the module.&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;val&amp;gt; is |volume= or |issue= parameter value&lt;br /&gt;
&amp;lt;name&amp;gt; is |volume= or |issue= parameter name for error message&lt;br /&gt;
&amp;lt;selector&amp;gt; is &#039;v&#039; for |volume=, &#039;i&#039; for |issue=&lt;br /&gt;
&lt;br /&gt;
sets error message on failure; returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extra_text_in_vol_iss_check (val, name, selector)&lt;br /&gt;
	if not utilities.is_set (val) then&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local handler = &#039;v&#039; == selector and &#039;err_extra_text_volume&#039; or &#039;err_extra_text_issue&#039;;&lt;br /&gt;
	val = val:lower();															-- force parameter value to lower case&lt;br /&gt;
&lt;br /&gt;
	for _, pattern in ipairs (cfg.vol_iss_pg_patterns.vi_patterns_t) do			-- spin through the sequence table of patterns&lt;br /&gt;
		if val:match (pattern) then												-- when a match, error so&lt;br /&gt;
			utilities.set_message (handler, name);								-- add error message&lt;br /&gt;
			return;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; G E T _ V _ N A M E _ T A B L E &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
split apart a |vauthors= or |veditors= parameter.  This function allows for corporate names, wrapped in doubled&lt;br /&gt;
parentheses to also have commas; in the old version of the code, the doubled parentheses were included in the&lt;br /&gt;
rendered citation and in the metadata.  Individual author names may be wikilinked&lt;br /&gt;
&lt;br /&gt;
	|vauthors=Jones AB, [[E. B. White|White EB]], ((Black, Brown, and Co.))&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function get_v_name_table (vparam, output_table, output_link_table)&lt;br /&gt;
	local _, accept = utilities.has_accept_as_written (vparam);&lt;br /&gt;
	if accept then&lt;br /&gt;
		utilities.add_prop_cat (&#039;vanc-accept&#039;);									-- add properties category&lt;br /&gt;
	end&lt;br /&gt;
	local name_table = mw.text.split(vparam, &amp;quot;%s*,%s*&amp;quot;);						-- names are separated by commas&lt;br /&gt;
	local wl_type, label, link;													-- wl_type not used here; just a placeholder&lt;br /&gt;
	&lt;br /&gt;
	local i = 1;&lt;br /&gt;
	&lt;br /&gt;
	while name_table[i] do&lt;br /&gt;
		if name_table[i]:match (&#039;^%(%(.*[^%)][^%)]$&#039;) then						-- first segment of corporate with one or more commas; this segment has the opening doubled parentheses&lt;br /&gt;
			local name = name_table[i];&lt;br /&gt;
			i = i + 1;															-- bump indexer to next segment&lt;br /&gt;
			while name_table[i] do&lt;br /&gt;
				name = name .. &#039;, &#039; .. name_table[i];							-- concatenate with previous segments&lt;br /&gt;
				if name_table[i]:match (&#039;^.*%)%)$&#039;) then						-- if this table member has the closing doubled parentheses&lt;br /&gt;
					break;														-- and done reassembling so&lt;br /&gt;
				end&lt;br /&gt;
				i = i + 1;														-- bump indexer&lt;br /&gt;
			end&lt;br /&gt;
			table.insert (output_table, name);									-- and add corporate name to the output table&lt;br /&gt;
			table.insert (output_link_table, &#039;&#039;);								-- no wikilink&lt;br /&gt;
		else&lt;br /&gt;
			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]]&lt;br /&gt;
			table.insert (output_table, label);									-- add this name&lt;br /&gt;
			if 1 == wl_type then&lt;br /&gt;
				table.insert (output_link_table, label);						-- simple wikilink [[D]]&lt;br /&gt;
			else&lt;br /&gt;
				table.insert (output_link_table, link);							-- no wikilink or [[L|D]]; add this link if there is one, else empty string&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
	end	&lt;br /&gt;
	return output_table;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P A R S E _ V A U T H O R S _ V E D I T O R S &amp;gt;--------------------------------&lt;br /&gt;
&lt;br /&gt;
This function extracts author / editor names from |vauthors= or |veditors= and finds matching |xxxxor-maskn= and&lt;br /&gt;
|xxxxor-linkn= in args.  It then returns a table of assembled names just as extract_names() does.&lt;br /&gt;
&lt;br /&gt;
Author / editor names in |vauthors= or |veditors= must be in Vancouver system style. Corporate or institutional names&lt;br /&gt;
may sometimes be required and because such names will often fail the is_good_vanc_name() and other format compliance&lt;br /&gt;
tests, are wrapped in doubled parentheses ((corporate name)) to suppress the format tests.&lt;br /&gt;
&lt;br /&gt;
Supports generational suffixes Jr, 2nd, 3rd, 4th–6th.&lt;br /&gt;
&lt;br /&gt;
This function sets the Vancouver error when a required comma is missing and when there is a space between an author&#039;s initials.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function parse_vauthors_veditors (args, vparam, list_name)&lt;br /&gt;
	local names = {};															-- table of names assembled from |vauthors=, |author-maskn=, |author-linkn=&lt;br /&gt;
	local v_name_table = {};&lt;br /&gt;
	local v_link_table = {};													-- when name is wikilinked, targets go in this table&lt;br /&gt;
	local etal = false;															-- return value set to true when we find some form of et al. vauthors parameter&lt;br /&gt;
	local last, first, link, mask, suffix;&lt;br /&gt;
	local corporate = false;&lt;br /&gt;
&lt;br /&gt;
	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)&lt;br /&gt;
	v_name_table = get_v_name_table (vparam, v_name_table, v_link_table);		-- names are separated by commas&lt;br /&gt;
&lt;br /&gt;
	for i, v_name in ipairs(v_name_table) do&lt;br /&gt;
		first = &#039;&#039;;																-- set to empty string for concatenation and because it may have been set for previous author/editor&lt;br /&gt;
		local accept_name;&lt;br /&gt;
		v_name, accept_name = utilities.has_accept_as_written (v_name);			-- remove accept-this-as-written markup when it wraps all of &amp;lt;v_name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		if accept_name then&lt;br /&gt;
			last = v_name;&lt;br /&gt;
			corporate = true;													-- flag used in list_people()&lt;br /&gt;
		elseif string.find(v_name, &amp;quot;%s&amp;quot;) then&lt;br /&gt;
			if v_name:find(&#039;[;%.]&#039;) then										-- look for commonly occurring punctuation characters; &lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.punctuation, i);&lt;br /&gt;
			end&lt;br /&gt;
			local lastfirstTable = {}&lt;br /&gt;
			lastfirstTable = mw.text.split(v_name, &amp;quot;%s+&amp;quot;)&lt;br /&gt;
			first = table.remove(lastfirstTable);								-- removes and returns value of last element in table which should be initials or generational suffix&lt;br /&gt;
&lt;br /&gt;
			if not mw.ustring.match (first, &#039;^%u+$&#039;) then						-- mw.ustring here so that later we will catch non-Latin characters&lt;br /&gt;
				suffix = first;													-- not initials so assume that whatever we got is a generational suffix&lt;br /&gt;
				first = table.remove(lastfirstTable);							-- get what should be the initials from the table&lt;br /&gt;
			end&lt;br /&gt;
			last = table.concat(lastfirstTable, &#039; &#039;)							-- returns a string that is the concatenation of all other names that are not initials and generational suffix&lt;br /&gt;
			if not utilities.is_set (last) then&lt;br /&gt;
				first = &#039;&#039;;														-- unset&lt;br /&gt;
				last = v_name;													-- last empty because something wrong with first&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.name, i);&lt;br /&gt;
			end&lt;br /&gt;
			if mw.ustring.match (last, &#039;%a+%s+%u+%s+%a+&#039;) then&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl[&#039;missing comma&#039;], i);			-- matches last II last; the case when a comma is missing&lt;br /&gt;
			end&lt;br /&gt;
			if mw.ustring.match (v_name, &#039; %u %u$&#039;) then						-- this test is in the wrong place TODO: move or replace with a more appropriate test&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.initials, i);					-- matches a space between two initials&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			last = v_name;														-- last name or single corporate name?  Doesn&#039;t support multiword corporate names? do we need this?&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if utilities.is_set (first) then&lt;br /&gt;
			if not mw.ustring.match (first, &amp;quot;^%u?%u$&amp;quot;) then						-- first shall contain one or two upper-case letters, nothing else&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.initials, i);					-- too many initials; mixed case initials (which may be ok Romanization); hyphenated initials&lt;br /&gt;
			end&lt;br /&gt;
			is_good_vanc_name (last, first, suffix, i);							-- check first and last before restoring the suffix which may have a non-Latin digit&lt;br /&gt;
			if utilities.is_set (suffix) then&lt;br /&gt;
				first = first .. &#039; &#039; .. suffix;									-- if there was a suffix concatenate with the initials&lt;br /&gt;
				suffix = &#039;&#039;;													-- unset so we don&#039;t add this suffix to all subsequent names&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if not corporate then&lt;br /&gt;
				is_good_vanc_name (last, &#039;&#039;, nil, i);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		link = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Link&#039;], &#039;err_redundant_parameters&#039;, i ) or v_link_table[i];&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Mask&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
		names[i] = {last = last, first = first, link = link, mask = mask, corporate = corporate};		-- add this assembled name to our names list&lt;br /&gt;
	end&lt;br /&gt;
	return names, etal;															-- all done, return our list of names&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E L E C T _ A U T H O R _ E D I T O R _ S O U R C E &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Select one of |authors=, |authorn= / |lastn / firstn=, or |vauthors= as the source of the author name list or&lt;br /&gt;
select one of |editorn= / editor-lastn= / |editor-firstn= or |veditors= as the source of the editor name list.&lt;br /&gt;
&lt;br /&gt;
Only one of these appropriate three will be used.  The hierarchy is: |authorn= (and aliases) highest and |authors= lowest;&lt;br /&gt;
|editorn= (and aliases) highest and |veditors= lowest (support for |editors= withdrawn)&lt;br /&gt;
&lt;br /&gt;
When looking for |authorn= / |editorn= parameters, test |xxxxor1= and |xxxxor2= (and all of their aliases); stops after the second&lt;br /&gt;
test which mimicks the test used in extract_names() when looking for a hole in the author name list.  There may be a better&lt;br /&gt;
way to do this, I just haven&#039;t discovered what that way is.&lt;br /&gt;
&lt;br /&gt;
Emits an error message when more than one xxxxor name source is provided.&lt;br /&gt;
&lt;br /&gt;
In this function, vxxxxors = vauthors or veditors; xxxxors = authors as appropriate.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function select_author_editor_source (vxxxxors, xxxxors, args, list_name)&lt;br /&gt;
	local lastfirst = false;&lt;br /&gt;
	if utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Last&#039;], &#039;none&#039;, 1 ) or		-- do this twice in case we have a |first1= without a |last1=; this ...&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. &#039;-First&#039;], &#039;none&#039;, 1 ) or		-- ... also catches the case where |first= is used with |vauthors=&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Last&#039;], &#039;none&#039;, 2 ) or&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. &#039;-First&#039;], &#039;none&#039;, 2 ) then&lt;br /&gt;
			lastfirst = true;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (utilities.is_set (vxxxxors) and true == lastfirst) or					-- these are the three error conditions&lt;br /&gt;
		(utilities.is_set (vxxxxors) and utilities.is_set (xxxxors)) or&lt;br /&gt;
		(true == lastfirst and utilities.is_set (xxxxors)) then&lt;br /&gt;
			local err_name;&lt;br /&gt;
			if &#039;AuthorList&#039; == list_name then									-- figure out which name should be used in error message&lt;br /&gt;
				err_name = &#039;author&#039;;&lt;br /&gt;
			else&lt;br /&gt;
				err_name = &#039;editor&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			utilities.set_message (&#039;err_redundant_parameters&#039;, err_name .. &#039;-name-list parameters&#039;);	-- add error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if true == lastfirst then return 1 end;										-- return a number indicating which author name source to use&lt;br /&gt;
	if utilities.is_set (vxxxxors) then return 2 end;&lt;br /&gt;
	if utilities.is_set (xxxxors) then return 3 end;&lt;br /&gt;
	return 1;																	-- no authors so return 1; this allows missing author name test to run in case there is a first without last &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ P A R A M E T E R _ V A L U E &amp;gt;------------------------------&lt;br /&gt;
&lt;br /&gt;
This function is used to validate a parameter&#039;s assigned value for those parameters that have only a limited number&lt;br /&gt;
of allowable values (yes, y, true, live, dead, etc.).  When the parameter value has not been assigned a value (missing&lt;br /&gt;
or empty in the source template) the function returns the value specified by ret_val.  If the parameter value is one&lt;br /&gt;
of the list of allowed values returns the translated value; else, emits an error message and returns the value&lt;br /&gt;
specified by ret_val.&lt;br /&gt;
&lt;br /&gt;
TODO: explain &amp;lt;invert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_parameter_value (value, name, possible, ret_val, invert)&lt;br /&gt;
	if not utilities.is_set (value) then&lt;br /&gt;
		return ret_val;															-- an empty parameter is ok&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (not invert and utilities.in_array (value, possible)) then				-- normal; &amp;lt;value&amp;gt; is in &amp;lt;possible&amp;gt; table&lt;br /&gt;
		return cfg.keywords_xlate[value];										-- return translation of parameter keyword&lt;br /&gt;
	elseif invert and not utilities.in_array (value, possible) then				-- invert; &amp;lt;value&amp;gt; is not in &amp;lt;possible&amp;gt; table&lt;br /&gt;
		return value;															-- return &amp;lt;value&amp;gt; as it is&lt;br /&gt;
	else&lt;br /&gt;
		utilities.set_message (&#039;err_invalid_param_val&#039;, {name, value});			-- not an allowed value so add error message&lt;br /&gt;
		return ret_val;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T E R M I N A T E _ N A M E _ L I S T &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function terminates a name list (author, contributor, editor) with a separator character (sepc) and a space&lt;br /&gt;
when the last character is not a sepc character or when the last three characters are not sepc followed by two&lt;br /&gt;
closing square brackets (close of a wikilink).  When either of these is true, the name_list is terminated with a&lt;br /&gt;
single space character.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function terminate_name_list (name_list, sepc)&lt;br /&gt;
	if (string.sub (name_list, -3, -1) == sepc .. &#039;. &#039;) then					-- if already properly terminated&lt;br /&gt;
		return name_list;														-- just return the name list&lt;br /&gt;
	elseif (string.sub (name_list, -1, -1) == sepc) or (string.sub (name_list, -3, -1) == sepc .. &#039;]]&#039;) then	-- if last name in list ends with sepc char&lt;br /&gt;
		return name_list .. &amp;quot; &amp;quot;;												-- don&#039;t add another&lt;br /&gt;
	else&lt;br /&gt;
		return name_list .. sepc .. &#039; &#039;;										-- otherwise terminate the name list&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; F O R M A T _ V O L U M E _ I S S U E &amp;gt;-----------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns the concatenation of the formatted volume and issue (or journal article number) parameters as a single&lt;br /&gt;
string; or formatted volume or formatted issue, or an empty string if neither are set.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
	&lt;br /&gt;
local function format_volume_issue (volume, issue, article, cite_class, origin, sepc, lower)&lt;br /&gt;
	if not utilities.is_set (volume) and not utilities.is_set (issue) and not utilities.is_set (article) then&lt;br /&gt;
		return &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- same condition as in format_pages_sheets()&lt;br /&gt;
	local is_journal = &#039;journal&#039; == cite_class or (utilities.in_array (cite_class, {&#039;citation&#039;, &#039;map&#039;, &#039;interview&#039;}) and &#039;journal&#039; == origin);&lt;br /&gt;
&lt;br /&gt;
	local is_numeric_vol = volume and (volume:match (&#039;^[MDCLXVI]+$&#039;) or volume:match (&#039;^%d+$&#039;));	-- is only uppercase roman numerals or only digits?&lt;br /&gt;
	local is_long_vol = volume and (4 &amp;lt; mw.ustring.len(volume));				-- is |volume= value longer than 4 characters?&lt;br /&gt;
	&lt;br /&gt;
	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?&lt;br /&gt;
		utilities.add_prop_cat (&#039;long-vol&#039;);									-- yes, add properties cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_journal then															-- journal-style formatting&lt;br /&gt;
		local vol = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (volume) then&lt;br /&gt;
			if is_numeric_vol then												-- |volume= value all digits or all uppercase Roman numerals?&lt;br /&gt;
				vol = utilities.substitute (cfg.presentation[&#039;vol-bold&#039;], {sepc, volume});	-- render in bold face&lt;br /&gt;
			elseif is_long_vol then												-- not all digits or Roman numerals; longer than 4 characters?&lt;br /&gt;
				vol = utilities.substitute (cfg.messages[&#039;j-vol&#039;], {sepc, utilities.hyphen_to_dash (volume)});	-- not bold&lt;br /&gt;
			else																-- four or fewer characters&lt;br /&gt;
				vol = utilities.substitute (cfg.presentation[&#039;vol-bold&#039;], {sepc, utilities.hyphen_to_dash (volume)});	-- bold&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		vol = vol .. (utilities.is_set (issue) and utilities.substitute (cfg.messages[&#039;j-issue&#039;], issue) or &#039;&#039;)&lt;br /&gt;
		vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages[&#039;j-article-num&#039;], article) or &#039;&#039;)&lt;br /&gt;
		return vol;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if &#039;podcast&#039; == cite_class and utilities.is_set (issue) then&lt;br /&gt;
		return wrap_msg (&#039;issue&#039;, {sepc, issue}, lower);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if &#039;conference&#039; == cite_class and utilities.is_set (article) then			-- |article-number= supported only in journal and conference cites&lt;br /&gt;
		if utilities.is_set (volume) and utilities.is_set (article) then		-- both volume and article number&lt;br /&gt;
			return wrap_msg (&#039;vol-art&#039;, {sepc, utilities.hyphen_to_dash (volume), article}, lower);&lt;br /&gt;
		elseif utilities.is_set (article) then									-- article number alone; when volume alone, handled below&lt;br /&gt;
			return wrap_msg (&#039;art&#039;, {sepc, article}, lower);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- all other types of citation&lt;br /&gt;
	if utilities.is_set (volume) and utilities.is_set (issue) then&lt;br /&gt;
		return wrap_msg (&#039;vol-no&#039;, {sepc, utilities.hyphen_to_dash (volume), issue}, lower);&lt;br /&gt;
	elseif utilities.is_set (volume) then&lt;br /&gt;
		return wrap_msg (&#039;vol&#039;, {sepc, utilities.hyphen_to_dash (volume)}, lower);&lt;br /&gt;
	else&lt;br /&gt;
		return wrap_msg (&#039;issue&#039;, {sepc, issue}, lower);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; F O R M A T _ P A G E S _ S H E E T S &amp;gt;-----------------------------------------&lt;br /&gt;
&lt;br /&gt;
adds static text to one of |page(s)= or |sheet(s)= values and returns it with all of the others set to empty strings.&lt;br /&gt;
The return order is:&lt;br /&gt;
	page, pages, sheet, sheets&lt;br /&gt;
&lt;br /&gt;
Singular has priority over plural when both are provided.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_pages_sheets (page, pages, sheet, sheets, cite_class, origin, sepc, nopp, lower)&lt;br /&gt;
	if &#039;map&#039; == cite_class then													-- only cite map supports sheet(s) as in-source locators&lt;br /&gt;
		if utilities.is_set (sheet) then&lt;br /&gt;
			if &#039;journal&#039; == origin then&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, wrap_msg (&#039;j-sheet&#039;, sheet, lower), &#039;&#039;;&lt;br /&gt;
			else&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, wrap_msg (&#039;sheet&#039;, {sepc, sheet}, lower), &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (sheets) then&lt;br /&gt;
			if &#039;journal&#039; == origin then&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, &#039;&#039;, wrap_msg (&#039;j-sheets&#039;, sheets, lower);&lt;br /&gt;
			else&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, &#039;&#039;, wrap_msg (&#039;sheets&#039;, {sepc, sheets}, lower);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local is_journal = &#039;journal&#039; == cite_class or (utilities.in_array (cite_class, {&#039;citation&#039;, &#039;map&#039;, &#039;interview&#039;}) and &#039;journal&#039; == origin);&lt;br /&gt;
	&lt;br /&gt;
	if utilities.is_set (page) then&lt;br /&gt;
		if is_journal then&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;j-page(s)&#039;], page), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		else&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (pages) then&lt;br /&gt;
		if is_journal then&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;j-page(s)&#039;], pages), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		elseif tonumber(pages) ~= nil and not nopp then							-- if pages is only digits, assume a single page number&lt;br /&gt;
			return &#039;&#039;, utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return &#039;&#039;, utilities.substitute (cfg.messages[&#039;pp-prefix&#039;], {sepc, pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		else&lt;br /&gt;
			return &#039;&#039;, utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &#039;&#039;, &#039;&#039;, &#039;&#039;, &#039;&#039;;														-- return empty strings&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N S O U R C E _ L O C _ G E T &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns one of the in-source locators: page, pages, or at. &lt;br /&gt;
&lt;br /&gt;
If any of these are interwiki links to Wikisource, returns the label portion of the interwiki-link as plain text&lt;br /&gt;
for use in COinS.  This COinS thing is done because here we convert an interwiki-link to an external link and&lt;br /&gt;
add an icon span around that; get_coins_pages() doesn&#039;t know about the span.  TODO: should it?  &lt;br /&gt;
&lt;br /&gt;
TODO: add support for sheet and sheets?; streamline;&lt;br /&gt;
&lt;br /&gt;
TODO: make it so that this function returns only one of the three as the single in-source (the return value assigned&lt;br /&gt;
to a new name)?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function insource_loc_get (page, page_orig, pages, pages_orig, at)&lt;br /&gt;
	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?)&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (page) then&lt;br /&gt;
		if utilities.is_set (pages) or utilities.is_set (at) then&lt;br /&gt;
			pages = &#039;&#039;;															-- unset the others&lt;br /&gt;
			at = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
		extra_text_in_page_check (page, page_orig);								-- emit error message when |page= value begins with what looks like p., pp., etc.&lt;br /&gt;
&lt;br /&gt;
		ws_url, ws_label, L = wikisource_url_make (page);						-- make ws URL from |page= interwiki link; link portion L becomes tooltip label&lt;br /&gt;
		if ws_url then&lt;br /&gt;
			page = external_link (ws_url, ws_label .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in page&#039;);	-- space char after label to move icon away from in-source text; TODO: a better way to do this?&lt;br /&gt;
			page = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, page});&lt;br /&gt;
			coins_pages = ws_label;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (pages) then&lt;br /&gt;
		if utilities.is_set (at) then&lt;br /&gt;
			at = &#039;&#039;;															-- unset&lt;br /&gt;
		end&lt;br /&gt;
		extra_text_in_page_check (pages, pages_orig);							-- emit error message when |page= value begins with what looks like p., pp., etc.&lt;br /&gt;
&lt;br /&gt;
		ws_url, ws_label, L = wikisource_url_make (pages);						-- make ws URL from |pages= interwiki link; link portion L becomes tooltip label&lt;br /&gt;
		if ws_url then&lt;br /&gt;
			pages = external_link (ws_url, ws_label .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in pages&#039;);	-- space char after label to move icon away from in-source text; TODO: a better way to do this?&lt;br /&gt;
			pages = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, pages});&lt;br /&gt;
			coins_pages = ws_label;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (at) then&lt;br /&gt;
		ws_url, ws_label, L = wikisource_url_make (at);							-- make ws URL from |at= interwiki link; link portion L becomes tooltip label&lt;br /&gt;
		if ws_url then&lt;br /&gt;
			at = external_link (ws_url, ws_label .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in at&#039;);	-- space char after label to move icon away from in-source text; TODO: a better way to do this?&lt;br /&gt;
			at = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, at});&lt;br /&gt;
			coins_pages = ws_label;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return page, pages, at, coins_pages;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ U N I Q U E _ A R C H I V E _ U R L &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
add error message when |archive-url= value is same as |url= or chapter-url= (or alias...) value&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_unique_archive_url (archive, url, c_url, source, date)&lt;br /&gt;
	if utilities.is_set (archive) then&lt;br /&gt;
		if archive == url or archive == c_url then&lt;br /&gt;
			utilities.set_message (&#039;err_bad_url&#039;, {utilities.wrap_style (&#039;parameter&#039;, source)});	-- add error message&lt;br /&gt;
			return &#039;&#039;, &#039;&#039;;														-- unset |archive-url= and |archive-date= because same as |url= or |chapter-url=&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return archive, date;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; A R C H I V E _ U R L _ C H E C K &amp;gt;--------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Check archive.org URLs to make sure they at least look like they are pointing at valid archives and not to the &lt;br /&gt;
save snapshot URL or to calendar pages.  When the archive URL is &#039;https://web.archive.org/save/&#039; (or http://...)&lt;br /&gt;
archive.org saves a snapshot of the target page in the URL.  That is something that Wikipedia should not allow&lt;br /&gt;
unwitting readers to do.&lt;br /&gt;
&lt;br /&gt;
When the archive.org URL does not have a complete timestamp, archive.org chooses a snapshot according to its own&lt;br /&gt;
algorithm or provides a calendar &#039;search&#039; result.  [[WP:ELNO]] discourages links to search results.&lt;br /&gt;
&lt;br /&gt;
This function looks at the value assigned to |archive-url= and returns empty strings for |archive-url= and&lt;br /&gt;
|archive-date= and an error message when:&lt;br /&gt;
	|archive-url= holds an archive.org save command URL&lt;br /&gt;
	|archive-url= is an archive.org URL that does not have a complete timestamp (YYYYMMDDhhmmss 14 digits) in the&lt;br /&gt;
		correct place&lt;br /&gt;
otherwise returns |archive-url= and |archive-date=&lt;br /&gt;
&lt;br /&gt;
There are two mostly compatible archive.org URLs:&lt;br /&gt;
	//web.archive.org/&amp;lt;timestamp&amp;gt;...		-- the old form&lt;br /&gt;
	//web.archive.org/web/&amp;lt;timestamp&amp;gt;...	-- the new form&lt;br /&gt;
&lt;br /&gt;
The old form does not support or map to the new form when it contains a display flag.  There are four identified flags&lt;br /&gt;
(&#039;id_&#039;, &#039;js_&#039;, &#039;cs_&#039;, &#039;im_&#039;) but since archive.org ignores others following the same form (two letters and an underscore)&lt;br /&gt;
we don&#039;t check for these specific flags but we do check the form.&lt;br /&gt;
&lt;br /&gt;
This function supports a preview mode.  When the article is rendered in preview mode, this function may return a modified&lt;br /&gt;
archive URL:&lt;br /&gt;
	for save command errors, return undated wildcard (/*/)&lt;br /&gt;
	for timestamp errors when the timestamp has a wildcard, return the URL unmodified&lt;br /&gt;
	for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/)&lt;br /&gt;
&lt;br /&gt;
A secondary function is to return an archive-url timestamp from those urls that have them (archive.org and&lt;br /&gt;
archive.today).  The timestamp is used by validation.archive_date_check() to see if the value in |archive-date=&lt;br /&gt;
matches the timestamp in the archive url.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function archive_url_check (url, date)&lt;br /&gt;
	local err_msg = &#039;&#039;;															-- start with the error message empty&lt;br /&gt;
	local path, timestamp, flag;												-- portions of the archive.org URL&lt;br /&gt;
	&lt;br /&gt;
	timestamp = url:match (&#039;//archive.today/(%d%d%d%d%d%d%d%d%d%d%d%d%d%d)/&#039;) or	-- get timestamp from archive.today urls&lt;br /&gt;
		url:match (&#039;//archive.today/(%d%d%d%d%.%d%d%.%d%d%-%d%d%d%d%d%d)/&#039;);		-- this timestamp needs cleanup&lt;br /&gt;
	if timestamp then															-- if this was an archive.today url ...&lt;br /&gt;
		return url, date, timestamp:gsub (&#039;[%.%-]&#039;, &#039;&#039;);						-- return ArchiveURL, ArchiveDate, and timestamp (dots and dashes removed) from |archive-url=, and done&lt;br /&gt;
	end&lt;br /&gt;
																				-- here for archive.org urls&lt;br /&gt;
	if (not url:match(&#039;//web%.archive%.org/&#039;)) and (not url:match(&#039;//liveweb%.archive%.org/&#039;)) then		-- also deprecated liveweb Wayback machine URL&lt;br /&gt;
		return url, date;														-- not an archive.org archive, return ArchiveURL and ArchiveDate&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if url:match(&#039;//web%.archive%.org/save/&#039;) then								-- if a save command URL, we don&#039;t want to allow saving of the target page &lt;br /&gt;
		err_msg = cfg.err_msg_supl.save;&lt;br /&gt;
		url = url:gsub (&#039;(//web%.archive%.org)/save/&#039;, &#039;%1/*/&#039;, 1);				-- for preview mode: modify ArchiveURL&lt;br /&gt;
	elseif url:match(&#039;//liveweb%.archive%.org/&#039;) then&lt;br /&gt;
		err_msg = cfg.err_msg_supl.liveweb;&lt;br /&gt;
	else&lt;br /&gt;
		path, timestamp, flag = url:match(&#039;//web%.archive%.org/([^%d]*)(%d+)([^/]*)/&#039;);	-- split out some of the URL parts for evaluation&lt;br /&gt;
		if not path then														-- malformed in some way; pattern did not match&lt;br /&gt;
			err_msg = cfg.err_msg_supl.timestamp;&lt;br /&gt;
		elseif 14 ~= timestamp:len() then										-- path and flag optional, must have 14-digit timestamp here&lt;br /&gt;
			err_msg = cfg.err_msg_supl.timestamp;&lt;br /&gt;
			if &#039;*&#039; ~= flag then&lt;br /&gt;
				local replacement = timestamp:match (&#039;^%d%d%d%d%d%d&#039;) or timestamp:match (&#039;^%d%d%d%d&#039;);	-- get the first 6 (YYYYMM) or first 4 digits (YYYY)&lt;br /&gt;
				if replacement then												-- nil if there aren&#039;t at least 4 digits (year)&lt;br /&gt;
					replacement = replacement .. string.rep (&#039;0&#039;, 14 - replacement:len());	-- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp&lt;br /&gt;
					url=url:gsub (&#039;(//web%.archive%.org/[^%d]*)%d[^/]*&#039;, &#039;%1&#039; .. replacement .. &#039;*&#039;, 1)	-- for preview, modify ts to 14 digits plus splat for calendar display&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (path) and &#039;web/&#039; ~= path then					-- older archive URLs do not have the extra &#039;web/&#039; path element&lt;br /&gt;
			err_msg = cfg.err_msg_supl.path;&lt;br /&gt;
		elseif utilities.is_set (flag) and not utilities.is_set (path) then		-- flag not allowed with the old form URL (without the &#039;web/&#039; path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		elseif utilities.is_set (flag) and not flag:match (&#039;%a%a_&#039;) then		-- flag if present must be two alpha characters and underscore (requires &#039;web/&#039; path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		else&lt;br /&gt;
			return url, date, timestamp;										-- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- if here, something not right so&lt;br /&gt;
	utilities.set_message (&#039;err_archive_url&#039;, {err_msg});						-- add error message and&lt;br /&gt;
&lt;br /&gt;
	if is_preview_mode then&lt;br /&gt;
		return url, date, timestamp;											-- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url=&lt;br /&gt;
	else&lt;br /&gt;
		return &#039;&#039;, &#039;&#039;;															-- return empty strings for ArchiveURL and ArchiveDate&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P L A C E _ C H E C K &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check |place=, |publication-place=, |location= to see if these params include digits.  This function added because&lt;br /&gt;
many editors misuse location to specify the in-source location (|page(s)= and |at= are supposed to do that)&lt;br /&gt;
&lt;br /&gt;
returns the original parameter value without modification; added maint cat when parameter value contains digits&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function place_check (param_val)&lt;br /&gt;
	if not utilities.is_set (param_val) then									-- parameter empty or omitted&lt;br /&gt;
		return param_val;														-- return that empty state&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if mw.ustring.find (param_val, &#039;%d&#039;) then									-- not empty, are there digits in the parameter value&lt;br /&gt;
		utilities.set_message (&#039;maint_location&#039;);								-- yep, add maint cat&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return param_val;															-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ A R C H I V E D _ C O P Y &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
compares |title= to &#039;Archived copy&#039; (placeholder added by bots that can&#039;t find proper title); if matches, return true; nil else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_archived_copy (title)&lt;br /&gt;
	title = mw.ustring.lower(title);											-- switch title to lower case&lt;br /&gt;
	if title:find (cfg.special_case_translation.archived_copy.en) then			-- if title is &#039;Archived copy&#039;&lt;br /&gt;
		return true;&lt;br /&gt;
	elseif cfg.special_case_translation.archived_copy[&#039;local&#039;] then&lt;br /&gt;
		if mw.ustring.find (title, cfg.special_case_translation.archived_copy[&#039;local&#039;]) then	-- mw.ustring() because might not be Latin script&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D I S P L A Y _ N A M E S _ S E L E C T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.&lt;br /&gt;
When both are present, look at &amp;lt;local_display_names&amp;gt; value.  When the value is some sort of &#039;et al.&#039;string,&lt;br /&gt;
special handling is required.&lt;br /&gt;
&lt;br /&gt;
When {{cs1 config}} has |display-&amp;lt;namelist&amp;gt;= AND this template has |display-&amp;lt;namelist&amp;gt;=etal AND:&lt;br /&gt;
	the number of names specified by &amp;lt;number_of_names&amp;gt; is:&lt;br /&gt;
		greater than the number specified in the global |display-&amp;lt;namelist&amp;gt;= parameter (&amp;lt;global_display_names&amp;gt;)&lt;br /&gt;
			use global |display-&amp;lt;namelist&amp;gt;= parameter value&lt;br /&gt;
			set overridden maint category&lt;br /&gt;
		less than or equal to the number specified in the global |display-&amp;lt;namelist&amp;gt;=  parameter&lt;br /&gt;
			use local |display-&amp;lt;namelist&amp;gt;= parameter value&lt;br /&gt;
&lt;br /&gt;
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting&lt;br /&gt;
to keep the etal annotation specified by &amp;lt;local_display_names&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names, test)&lt;br /&gt;
	if global_display_names and utilities.is_set (local_display_names) then		-- when both&lt;br /&gt;
		if &#039;etal&#039; == local_display_names:lower():gsub(&amp;quot;[ &#039;%.]&amp;quot;, &#039;&#039;) then		-- the :gsub() portion makes &#039;etal&#039; from a variety of &#039;et al.&#039; spellings and stylings&lt;br /&gt;
			number_of_names = tonumber (number_of_names);						-- convert these to numbers for comparison&lt;br /&gt;
			local global_display_names_num = tonumber (global_display_names);	-- &amp;lt;global_display_names&amp;gt; not set when parameter value is not digits&lt;br /&gt;
&lt;br /&gt;
			if number_of_names &amp;gt; global_display_names_num then					-- template has more names than global config allows to be displayed?&lt;br /&gt;
				utilities.set_message (&#039;maint_overridden_setting&#039;);				-- set a maint message because global is overriding local |display-&amp;lt;namelist&amp;gt;=etal&lt;br /&gt;
				return global_display_names, &#039;cs1 config&#039;;						-- return global with spoof parameter name (for get_display_names())&lt;br /&gt;
			else&lt;br /&gt;
				return local_display_names, param_name;							-- return local because fewer names so let &amp;lt;local_display_names&amp;gt; control&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
																				-- here when &amp;lt;global_display_names&amp;gt; and &amp;lt;local_display_names&amp;gt; both numbers; &amp;lt;global_display_names&amp;gt; controls&lt;br /&gt;
		utilities.set_message (&#039;maint_overridden_setting&#039;);						-- set a maint message&lt;br /&gt;
		return global_display_names, &#039;cs1 config&#039;;								-- return global with spoof parameter name (for get_display_names())&lt;br /&gt;
	end&lt;br /&gt;
																				-- here when only one of &amp;lt;global_display_names&amp;gt; or &amp;lt;local_display_names&amp;gt; set&lt;br /&gt;
	if global_display_names then&lt;br /&gt;
		return global_display_names, &#039;cs1 config&#039;;								-- return global with spoof parameter name (for get_display_names())&lt;br /&gt;
	else&lt;br /&gt;
		return local_display_names, param_name;									-- return local&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M O D E _ S E T &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
fetch global mode setting from {{cs1 config}} (if present) or from |mode= (if present); global setting overrides&lt;br /&gt;
local |mode= parameter value.  When both are present, emit maintenance message&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function mode_set (Mode, Mode_origin)&lt;br /&gt;
	local mode;&lt;br /&gt;
	if cfg.global_cs1_config_t[&#039;Mode&#039;] then										-- global setting in {{cs1 config}}; nil when empty or assigned value invalid&lt;br /&gt;
		mode = is_valid_parameter_value (cfg.global_cs1_config_t[&#039;Mode&#039;], &#039;cs1 config: mode&#039;, cfg.keywords_lists[&#039;mode&#039;], &#039;&#039;);	-- error messaging &#039;param&#039; here is a hoax&lt;br /&gt;
	else&lt;br /&gt;
		mode = is_valid_parameter_value (Mode, Mode_origin, cfg.keywords_lists[&#039;mode&#039;], &#039;&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.global_cs1_config_t[&#039;Mode&#039;] and utilities.is_set (Mode) then			-- when template has |mode=&amp;lt;something&amp;gt; which global setting has overridden&lt;br /&gt;
		utilities.set_message (&#039;maint_overridden_setting&#039;);						-- set a maint message&lt;br /&gt;
	end&lt;br /&gt;
	return mode;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Q U O T E _ M A K E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
create quotation from |quote=, |trans-quote=, and/or script-quote= with or without |quote-page= or |quote-pages=&lt;br /&gt;
&lt;br /&gt;
when any of those three quote parameters are set, this function unsets &amp;lt;PostScript&amp;gt;.  When none of those parameters&lt;br /&gt;
are set, |quote-page= and |quote-pages= are unset to nil so that they are not included in the template&#039;s metadata&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function quote_make (quote, trans_quote, script_quote, quote_page, quote_pages, nopp, sepc, postscript)&lt;br /&gt;
	if utilities.is_set (quote) or utilities.is_set (trans_quote) or utilities.is_set (script_quote) then&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (quote) then&lt;br /&gt;
			if quote:sub(1, 1) == &#039;&amp;quot;&#039; and quote:sub(-1, -1) == &#039;&amp;quot;&#039; then			-- if first and last characters of quote are quote marks&lt;br /&gt;
				quote = quote:sub(2, -2);										-- strip them off&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		quote = kern_quotes (quote);											-- kern if needed&lt;br /&gt;
		quote = utilities.wrap_style (&#039;quoted-text&#039;, quote );					-- wrap in &amp;lt;q&amp;gt;...&amp;lt;/q&amp;gt; tags&lt;br /&gt;
	&lt;br /&gt;
		if utilities.is_set (script_quote) then&lt;br /&gt;
			quote = script_concatenate (quote, script_quote, &#039;script-quote&#039;);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after quote is wrapped&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (trans_quote) then&lt;br /&gt;
			if trans_quote:sub(1, 1) == &#039;&amp;quot;&#039; and trans_quote:sub(-1, -1) == &#039;&amp;quot;&#039; then -- if first and last characters of |trans-quote are quote marks&lt;br /&gt;
				trans_quote = trans_quote:sub(2, -2); -- strip them off&lt;br /&gt;
			end&lt;br /&gt;
			quote = quote .. &amp;quot; &amp;quot; .. utilities.wrap_style (&#039;trans-quoted-title&#039;, trans_quote );&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (quote_page) or utilities.is_set (quote_pages) then	-- add page prefix&lt;br /&gt;
			local quote_prefix = &#039;&#039;;&lt;br /&gt;
			if utilities.is_set (quote_page) then&lt;br /&gt;
				extra_text_in_page_check (quote_page, &#039;quote-page&#039;);			-- add to maint cat if |quote-page= value begins with what looks like p., pp., etc.&lt;br /&gt;
				if not nopp then&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, quote_page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, quote_page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				end&lt;br /&gt;
			elseif utilities.is_set (quote_pages) then&lt;br /&gt;
				extra_text_in_page_check (quote_pages, &#039;quote-pages&#039;);			-- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.&lt;br /&gt;
				if tonumber(quote_pages) ~= nil and not nopp then				-- if only digits, assume single page&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, quote_pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				elseif not nopp then&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;pp-prefix&#039;], {sepc, quote_pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, quote_pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
                        &lt;br /&gt;
			quote = quote_prefix .. &amp;quot;: &amp;quot; .. quote;&lt;br /&gt;
		else&lt;br /&gt;
			quote = sepc .. &amp;quot; &amp;quot; .. quote;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		postscript = &amp;quot;&amp;quot;;														-- cs1|2 does not supply terminal punctuation when |quote= is set&lt;br /&gt;
	&lt;br /&gt;
	elseif utilities.is_set (quote_page) or utilities.is_set (quote_pages) then&lt;br /&gt;
		quote_page = nil;														-- unset; these require |quote=; TODO: error message?&lt;br /&gt;
		quote_pages = nil;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return quote, quote_page, quote_pages, postscript;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C H E C K _ P U B L I S H E R _ N A M E &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for variations of &#039;&amp;lt;text&amp;gt;: &amp;lt;text&amp;gt;&#039; that might be &#039;&amp;lt;location&amp;gt;: &amp;lt;publisher&amp;gt;&#039; in |publisher= parameter value.&lt;br /&gt;
when found, emit a maintenance message; return nil else&lt;br /&gt;
&lt;br /&gt;
&amp;lt;publisher&amp;gt; is the value assigned to |publisher= or |institution=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_publisher_name (publisher)&lt;br /&gt;
	local patterns_t = {&lt;br /&gt;
		&#039;^[%w%s]+%s*:%s*[%w%s]+$&#039;,												-- plain text &amp;lt;location&amp;gt;: &amp;lt;publisher&amp;gt;&lt;br /&gt;
		&#039;^%[+[%w%s:|]+%]+%s*:%s*[%w%s]+$&#039;,										-- partially wikilinked [[&amp;lt;location&amp;gt;]]: &amp;lt;publisher&amp;gt;&lt;br /&gt;
		&#039;^[%w%s]+%s*:%s*%[+[%w%s:|]+%]+$&#039;,										-- partially wikilinked &amp;lt;location&amp;gt;: [[&amp;lt;publisher&amp;gt;]]&lt;br /&gt;
		&#039;^%[+[%w%s:|]+%]+%s*:%s*%[+[%w%s:|]+%]+$&#039;,								-- wikilinked [[&amp;lt;location&amp;gt;]]: [[&amp;lt;publisher&amp;gt;]]&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns_t) do									-- spin through the patterns_t sequence&lt;br /&gt;
		if mw.ustring.match (publisher, pattern) then							-- does this pattern match?&lt;br /&gt;
			utilities.set_message (&#039;maint_publisher_location&#039;);					-- set a maint message&lt;br /&gt;
			return;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T A T I O N 0 &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This is the main function doing the majority of the citation formatting.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citation0( config, args )&lt;br /&gt;
	--[[ &lt;br /&gt;
	Load Input Parameters&lt;br /&gt;
	The argument_wrapper facilitates the mapping of multiple aliases to single internal variable.&lt;br /&gt;
	]]&lt;br /&gt;
	local A = argument_wrapper ( args );&lt;br /&gt;
	local i &lt;br /&gt;
&lt;br /&gt;
	-- Pick out the relevant fields from the arguments.  Different citation templates&lt;br /&gt;
	-- define different field names for the same underlying things.	&lt;br /&gt;
&lt;br /&gt;
	local author_etal;&lt;br /&gt;
	local a	= {};																-- authors list from |lastn= / |firstn= pairs or |vauthors=&lt;br /&gt;
	local Authors;&lt;br /&gt;
	local NameListStyle;&lt;br /&gt;
		if cfg.global_cs1_config_t[&#039;NameListStyle&#039;] then						-- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid&lt;br /&gt;
			NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t[&#039;NameListStyle&#039;], &#039;cs1 config: name-list-style&#039;, cfg.keywords_lists[&#039;name-list-style&#039;], &#039;&#039;);	-- error messaging &#039;param&#039; here is a hoax&lt;br /&gt;
		else&lt;br /&gt;
			NameListStyle = is_valid_parameter_value (A[&#039;NameListStyle&#039;], A:ORIGIN(&#039;NameListStyle&#039;), cfg.keywords_lists[&#039;name-list-style&#039;], &#039;&#039;);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if cfg.global_cs1_config_t[&#039;NameListStyle&#039;] and utilities.is_set (A[&#039;NameListStyle&#039;]) then	-- when template has |name-list-style=&amp;lt;something&amp;gt; which global setting has overridden&lt;br /&gt;
			utilities.set_message (&#039;maint_overridden_setting&#039;);					-- set a maint message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	local Collaboration = A[&#039;Collaboration&#039;];&lt;br /&gt;
&lt;br /&gt;
	do																			-- to limit scope of selected&lt;br /&gt;
		local selected = select_author_editor_source (A[&#039;Vauthors&#039;], A[&#039;Authors&#039;], args, &#039;AuthorList&#039;);&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			a, author_etal = extract_names (args, &#039;AuthorList&#039;);				-- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 2 == selected then&lt;br /&gt;
			NameListStyle = &#039;vanc&#039;;												-- override whatever |name-list-style= might be&lt;br /&gt;
			a, author_etal = parse_vauthors_veditors (args, A[&#039;Vauthors&#039;], &#039;AuthorList&#039;);	-- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 3 == selected then&lt;br /&gt;
			Authors = A[&#039;Authors&#039;];												-- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Collaboration) then&lt;br /&gt;
			author_etal = true;													-- so that |display-authors=etal not required&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local editor_etal;&lt;br /&gt;
	local e	= {};																-- editors list from |editor-lastn= / |editor-firstn= pairs or |veditors=&lt;br /&gt;
&lt;br /&gt;
	do																			-- to limit scope of selected&lt;br /&gt;
		local selected = select_author_editor_source (A[&#039;Veditors&#039;], nil, args, &#039;EditorList&#039;);	-- support for |editors= withdrawn&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			e, editor_etal = extract_names (args, &#039;EditorList&#039;);				-- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=&lt;br /&gt;
		elseif 2 == selected then&lt;br /&gt;
			NameListStyle = &#039;vanc&#039;;												-- override whatever |name-list-style= might be&lt;br /&gt;
			e, editor_etal = parse_vauthors_veditors (args, args.veditors, &#039;EditorList&#039;);	-- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
							&lt;br /&gt;
	local Chapter = A[&#039;Chapter&#039;];												-- done here so that we have access to |contribution= from |chapter= aliases&lt;br /&gt;
	local Chapter_origin = A:ORIGIN (&#039;Chapter&#039;);&lt;br /&gt;
	local Contribution;															-- because contribution is required for contributor(s)&lt;br /&gt;
		if &#039;contribution&#039; == Chapter_origin then&lt;br /&gt;
			Contribution = Chapter;												-- get the name of the contribution&lt;br /&gt;
		end&lt;br /&gt;
	local c = {};																-- contributors list from |contributor-lastn= / contributor-firstn= pairs&lt;br /&gt;
	&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&amp;quot;book&amp;quot;, &amp;quot;citation&amp;quot;}) and not utilities.is_set (A[&#039;Periodical&#039;]) then	-- |contributor= and |contribution= only supported in book cites&lt;br /&gt;
		c = extract_names (args, &#039;ContributorList&#039;);							-- fetch contributor list from |contributorn= / |contributor-lastn=, -firstn=, -linkn=, -maskn=&lt;br /&gt;
		&lt;br /&gt;
		if 0 &amp;lt; #c then&lt;br /&gt;
			if not utilities.is_set (Contribution) then							-- |contributor= requires |contribution=&lt;br /&gt;
				utilities.set_message (&#039;err_contributor_missing_required_param&#039;, &#039;contribution&#039;);	-- add missing contribution error message&lt;br /&gt;
				c = {};															-- blank the contributors&#039; table; it is used as a flag later&lt;br /&gt;
			end&lt;br /&gt;
			if 0 == #a then														-- |contributor= requires |author=&lt;br /&gt;
				utilities.set_message (&#039;err_contributor_missing_required_param&#039;, &#039;author&#039;);	-- add missing author error message&lt;br /&gt;
				c = {};															-- blank the contributors&#039; table; it is used as a flag later&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- if not a book cite&lt;br /&gt;
		if utilities.select_one (args, cfg.aliases[&#039;ContributorList-Last&#039;], &#039;err_redundant_parameters&#039;, 1 ) then	-- are there contributor name list parameters?&lt;br /&gt;
			utilities.set_message (&#039;err_contributor_ignored&#039;);					-- add contributor ignored error message&lt;br /&gt;
		end&lt;br /&gt;
		Contribution = nil;														-- unset&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Title = A[&#039;Title&#039;];&lt;br /&gt;
	local TitleLink = A[&#039;TitleLink&#039;];&lt;br /&gt;
&lt;br /&gt;
	local auto_select = &#039;&#039;;														-- default is auto&lt;br /&gt;
	local accept_link;&lt;br /&gt;
	TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true);	-- test for accept-this-as-written markup&lt;br /&gt;
	if (not accept_link) and utilities.in_array (TitleLink, {&#039;none&#039;, &#039;pmc&#039;, &#039;doi&#039;}) then -- check for special keywords&lt;br /&gt;
		auto_select = TitleLink;												-- remember selection for later&lt;br /&gt;
		TitleLink = &#039;&#039;;															-- treat as if |title-link= would have been empty&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	TitleLink = link_title_ok (TitleLink, A:ORIGIN (&#039;TitleLink&#039;), Title, &#039;title&#039;);	-- check for wiki-markup in |title-link= or wiki-markup in |title= when |title-link= is set&lt;br /&gt;
&lt;br /&gt;
	local Section = &#039;&#039;;															-- {{cite map}} only; preset to empty string for concatenation if not used&lt;br /&gt;
	if &#039;map&#039; == config.CitationClass and &#039;section&#039; == Chapter_origin then&lt;br /&gt;
		Section = A[&#039;Chapter&#039;];													-- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}&lt;br /&gt;
		Chapter = &#039;&#039;;															-- unset for now; will be reset later from |map= if present&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Periodical = A[&#039;Periodical&#039;];&lt;br /&gt;
	local Periodical_origin = A:ORIGIN(&#039;Periodical&#039;);&lt;br /&gt;
	local ScriptPeriodical = A[&#039;ScriptPeriodical&#039;];&lt;br /&gt;
	local ScriptPeriodical_origin = A:ORIGIN(&#039;ScriptPeriodical&#039;);&lt;br /&gt;
	local TransPeriodical =  A[&#039;TransPeriodical&#039;];&lt;br /&gt;
	local TransPeriodical_origin =  A:ORIGIN (&#039;TransPeriodical&#039;);&lt;br /&gt;
	&lt;br /&gt;
	if (utilities.in_array (config.CitationClass, {&#039;book&#039;, &#039;encyclopaedia&#039;}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical))) then&lt;br /&gt;
		local param;&lt;br /&gt;
		if utilities.is_set (Periodical) then									-- get a parameter name from one of these periodical related meta-parameters&lt;br /&gt;
			Periodical = &#039;&#039;;													-- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters &lt;br /&gt;
			param = Periodical_origin											-- get parameter name for error messaging&lt;br /&gt;
		elseif utilities.is_set (TransPeriodical) then&lt;br /&gt;
			TransPeriodical = &#039;&#039;;												-- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters &lt;br /&gt;
			param = TransPeriodical_origin;										-- get parameter name for error messaging&lt;br /&gt;
		elseif utilities.is_set (ScriptPeriodical) then&lt;br /&gt;
			ScriptPeriodical = &#039;&#039;;												-- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters &lt;br /&gt;
			param = ScriptPeriodical_origin;									-- get parameter name for error messaging&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (param) then										-- if we found one&lt;br /&gt;
			utilities.set_message (&#039;err_periodical_ignored&#039;, {param});			-- emit an error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Periodical) then&lt;br /&gt;
		local i;&lt;br /&gt;
		Periodical, i = utilities.strip_apostrophe_markup (Periodical);			-- strip apostrophe markup so that metadata isn&#039;t contaminated &lt;br /&gt;
		if i then																-- non-zero when markup was stripped so emit an error message&lt;br /&gt;
			utilities.set_message (&#039;err_apostrophe_markup&#039;, {Periodical_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;mailinglist&#039; == config.CitationClass then								-- special case for {{cite mailing list}}&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (A [&#039;MailingList&#039;]) then	-- both set emit an error TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, Periodical_origin) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;mailinglist&#039;)});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = A [&#039;MailingList&#039;];											-- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}&lt;br /&gt;
		Periodical_origin = A:ORIGIN(&#039;MailingList&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- web and news not tested for now because of &lt;br /&gt;
	-- Wikipedia:Administrators%27_noticeboard#Is_there_a_semi-automated_tool_that_could_fix_these_annoying_&amp;quot;Cite_Web&amp;quot;_errors?&lt;br /&gt;
	if not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) then	-- &#039;periodical&#039; templates require periodical parameter&lt;br /&gt;
	--	local p = {[&#039;journal&#039;] = &#039;journal&#039;, [&#039;magazine&#039;] = &#039;magazine&#039;, [&#039;news&#039;] = &#039;newspaper&#039;, [&#039;web&#039;] = &#039;website&#039;};	-- for error message&lt;br /&gt;
		local p = {[&#039;journal&#039;] = &#039;journal&#039;, [&#039;magazine&#039;] = &#039;magazine&#039;};			-- for error message&lt;br /&gt;
		if p[config.CitationClass]  then&lt;br /&gt;
			utilities.set_message (&#039;err_missing_periodical&#039;, {config.CitationClass, p[config.CitationClass]});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Volume;&lt;br /&gt;
	if &#039;citation&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (Periodical) then&lt;br /&gt;
			if not utilities.in_array (Periodical_origin, cfg.citation_no_volume_t) then	-- {{citation}} does not render |volume= when these parameters are used&lt;br /&gt;
				Volume = A[&#039;Volume&#039;];											-- but does for all other &#039;periodicals&#039;&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (ScriptPeriodical) then&lt;br /&gt;
			if &#039;script-website&#039; ~= ScriptPeriodical_origin then					-- {{citation}} does not render volume for |script-website=&lt;br /&gt;
				Volume = A[&#039;Volume&#039;];											-- but does for all other &#039;periodicals&#039;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			Volume = A[&#039;Volume&#039;];												-- and does for non-&#039;periodical&#039; cites&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.in_array (config.CitationClass, cfg.templates_using_volume) then	-- render |volume= for cs1 according to the configuration settings&lt;br /&gt;
		Volume = A[&#039;Volume&#039;];&lt;br /&gt;
	end	&lt;br /&gt;
	extra_text_in_vol_iss_check (Volume, A:ORIGIN (&#039;Volume&#039;), &#039;v&#039;);	&lt;br /&gt;
&lt;br /&gt;
	local Issue;&lt;br /&gt;
	if &#039;citation&#039; == config.CitationClass then&lt;br /&gt;
		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&lt;br /&gt;
			Issue = utilities.hyphen_to_dash (A[&#039;Issue&#039;]);&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.in_array (config.CitationClass, cfg.templates_using_issue) then	-- conference &amp;amp; map books do not support issue; {{citation}} listed here because included in settings table&lt;br /&gt;
		if not (utilities.in_array (config.CitationClass, {&#039;conference&#039;, &#039;map&#039;, &#039;citation&#039;}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then&lt;br /&gt;
			Issue = utilities.hyphen_to_dash (A[&#039;Issue&#039;]);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local ArticleNumber;&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;journal&#039;, &#039;conference&#039;}) or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Periodical) and &#039;journal&#039; == Periodical_origin) then&lt;br /&gt;
		ArticleNumber = A[&#039;ArticleNumber&#039;];&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	extra_text_in_vol_iss_check (Issue, A:ORIGIN (&#039;Issue&#039;), &#039;i&#039;);	&lt;br /&gt;
&lt;br /&gt;
	local Page;&lt;br /&gt;
	local Pages;&lt;br /&gt;
	local At;&lt;br /&gt;
	local QuotePage;&lt;br /&gt;
	local QuotePages;&lt;br /&gt;
	if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then		-- TODO: rewrite to emit ignored parameter error message?&lt;br /&gt;
		Page = A[&#039;Page&#039;];&lt;br /&gt;
		Pages = utilities.hyphen_to_dash (A[&#039;Pages&#039;]);	&lt;br /&gt;
		At = A[&#039;At&#039;];&lt;br /&gt;
		QuotePage = A[&#039;QuotePage&#039;];&lt;br /&gt;
		QuotePages = utilities.hyphen_to_dash (A[&#039;QuotePages&#039;]);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local NoPP = is_valid_parameter_value (A[&#039;NoPP&#039;], A:ORIGIN(&#039;NoPP&#039;), cfg.keywords_lists[&#039;yes_true_y&#039;], nil);&lt;br /&gt;
&lt;br /&gt;
	local Mode = mode_set (A[&#039;Mode&#039;], A:ORIGIN(&#039;Mode&#039;));&lt;br /&gt;
&lt;br /&gt;
	-- separator character and postscript&lt;br /&gt;
	local sepc, PostScript = set_style (Mode:lower(), A[&#039;PostScript&#039;], config.CitationClass);&lt;br /&gt;
	local Quote;&lt;br /&gt;
	Quote, QuotePage, QuotePages, PostScript = quote_make (A[&#039;Quote&#039;], A[&#039;TransQuote&#039;], A[&#039;ScriptQuote&#039;], QuotePage, QuotePages, NoPP, sepc, PostScript);&lt;br /&gt;
&lt;br /&gt;
	local Edition = A[&#039;Edition&#039;];&lt;br /&gt;
	local PublicationPlace = place_check (A[&#039;PublicationPlace&#039;], A:ORIGIN(&#039;PublicationPlace&#039;));&lt;br /&gt;
	local Place = place_check (A[&#039;Place&#039;], A:ORIGIN(&#039;Place&#039;));&lt;br /&gt;
	&lt;br /&gt;
	local PublisherName = A[&#039;PublisherName&#039;];&lt;br /&gt;
	local PublisherName_origin = A:ORIGIN(&#039;PublisherName&#039;);&lt;br /&gt;
	if utilities.is_set (PublisherName) and (cfg.keywords_xlate[&#039;none&#039;] ~= PublisherName) then&lt;br /&gt;
		local i = 0;&lt;br /&gt;
		PublisherName, i = utilities.strip_apostrophe_markup (PublisherName);	-- strip apostrophe markup so that metadata isn&#039;t contaminated; publisher is never italicized&lt;br /&gt;
		if i and (0 &amp;lt; i) then													-- non-zero when markup was stripped so emit an error message&lt;br /&gt;
			utilities.set_message (&#039;err_apostrophe_markup&#039;, {PublisherName_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if (&#039;document&#039; == config.CitationClass) and not utilities.is_set (PublisherName) then&lt;br /&gt;
		utilities.set_message (&#039;err_missing_publisher&#039;, {config.CitationClass, &#039;publisher&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Newsgroup = A[&#039;Newsgroup&#039;];											-- TODO: strip apostrophe markup?&lt;br /&gt;
	local Newsgroup_origin = A:ORIGIN(&#039;Newsgroup&#039;);	&lt;br /&gt;
&lt;br /&gt;
	if &#039;newsgroup&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (PublisherName) and (cfg.keywords_xlate[&#039;none&#039;] ~= PublisherName) then	-- general use parameter |publisher= not allowed in cite newsgroup&lt;br /&gt;
			utilities.set_message (&#039;err_parameter_ignored&#039;, {PublisherName_origin});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		PublisherName = nil;													-- ensure that this parameter is unset for the time being; will be used again after COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;book&#039; == config.CitationClass or &#039;encyclopaedia&#039; == config.CitationClass or (&#039;citation&#039; == config.CitationClass and not utilities.is_set (Periodical)) then&lt;br /&gt;
		local accept;&lt;br /&gt;
		PublisherName, accept = utilities.has_accept_as_written (PublisherName);	-- check for and remove accept-as-written markup from |publisher= wrapped&lt;br /&gt;
		if not accept then														-- when no accept-as-written markup&lt;br /&gt;
			check_publisher_name (PublisherName);								-- emit maint message when |publisher= might be prefixed with publisher&#039;s location&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local URL = A[&#039;URL&#039;];														-- TODO: better way to do this for URL, ChapterURL, and MapURL?&lt;br /&gt;
	local UrlAccess = is_valid_parameter_value (A[&#039;UrlAccess&#039;], A:ORIGIN(&#039;UrlAccess&#039;), cfg.keywords_lists[&#039;url-access&#039;], nil);&lt;br /&gt;
	&lt;br /&gt;
	if not utilities.is_set (URL) and utilities.is_set (UrlAccess) then&lt;br /&gt;
		UrlAccess = nil;&lt;br /&gt;
		utilities.set_message (&#039;err_param_access_requires_param&#039;, &#039;url&#039;);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local ChapterURL = A[&#039;ChapterURL&#039;];&lt;br /&gt;
	local ChapterUrlAccess = is_valid_parameter_value (A[&#039;ChapterUrlAccess&#039;], A:ORIGIN(&#039;ChapterUrlAccess&#039;), cfg.keywords_lists[&#039;url-access&#039;], nil);&lt;br /&gt;
	if not utilities.is_set (ChapterURL) and utilities.is_set (ChapterUrlAccess) then&lt;br /&gt;
		ChapterUrlAccess = nil;&lt;br /&gt;
		utilities.set_message (&#039;err_param_access_requires_param&#039;, {A:ORIGIN(&#039;ChapterUrlAccess&#039;):gsub (&#039;%-access&#039;, &#039;&#039;)});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local MapUrlAccess = is_valid_parameter_value (A[&#039;MapUrlAccess&#039;], A:ORIGIN(&#039;MapUrlAccess&#039;), cfg.keywords_lists[&#039;url-access&#039;], nil);&lt;br /&gt;
	if not utilities.is_set (A[&#039;MapURL&#039;]) and utilities.is_set (MapUrlAccess) then&lt;br /&gt;
		MapUrlAccess = nil;&lt;br /&gt;
		utilities.set_message (&#039;err_param_access_requires_param&#039;, {&#039;map-url&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local this_page = mw.title.getCurrentTitle();								-- also used for COinS and for language&lt;br /&gt;
	local no_tracking_cats = is_valid_parameter_value (A[&#039;NoTracking&#039;], A:ORIGIN(&#039;NoTracking&#039;), cfg.keywords_lists[&#039;yes_true_y&#039;], nil);&lt;br /&gt;
&lt;br /&gt;
	-- check this page to see if it is in one of the namespaces that cs1 is not supposed to add to the error categories&lt;br /&gt;
	if not utilities.is_set (no_tracking_cats) then								-- ignore if we are already not going to categorize this page&lt;br /&gt;
		if cfg.uncategorized_namespaces[this_page.namespace] then				-- is this page&#039;s namespace id one of the uncategorized namespace ids?&lt;br /&gt;
			no_tracking_cats = &amp;quot;true&amp;quot;;											-- set no_tracking_cats&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in ipairs (cfg.uncategorized_subpages) do						-- cycle through page name patterns&lt;br /&gt;
			if this_page.text:match (v) then									-- test page name against each pattern&lt;br /&gt;
				no_tracking_cats = &amp;quot;true&amp;quot;;										-- set no_tracking_cats&lt;br /&gt;
				break;															-- bail out if one is found&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- check for extra |page=, |pages= or |at= parameters. (also sheet and sheets while we&#039;re at it)&lt;br /&gt;
	utilities.select_one (args, {&#039;page&#039;, &#039;p&#039;, &#039;pp&#039;, &#039;pages&#039;, &#039;at&#039;, &#039;sheet&#039;, &#039;sheets&#039;}, &#039;err_redundant_parameters&#039;);	-- this is a dummy call simply to get the error message and category&lt;br /&gt;
&lt;br /&gt;
	local coins_pages;&lt;br /&gt;
	&lt;br /&gt;
	Page, Pages, At, coins_pages = insource_loc_get (Page, A:ORIGIN(&#039;Page&#039;), Pages, A:ORIGIN(&#039;Pages&#039;), At);&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (PublicationPlace) and utilities.is_set (Place) then	-- both |publication-place= and |place= (|location=) allowed if different&lt;br /&gt;
		utilities.add_prop_cat (&#039;location-test&#039;);								-- add property cat to evaluate how often PublicationPlace and Place are used together&lt;br /&gt;
		if PublicationPlace == Place then&lt;br /&gt;
			Place = &#039;&#039;;															-- unset; don&#039;t need both if they are the same&lt;br /&gt;
		end&lt;br /&gt;
	elseif not utilities.is_set (PublicationPlace) and utilities.is_set (Place) then	-- when only |place= (|location=) is set ...&lt;br /&gt;
		PublicationPlace = Place;												-- promote |place= (|location=) to |publication-place&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if PublicationPlace == Place then Place = &#039;&#039;; end							-- don&#039;t need both if they are the same&lt;br /&gt;
&lt;br /&gt;
	local URL_origin = A:ORIGIN(&#039;URL&#039;);											-- get name of parameter that holds URL&lt;br /&gt;
	local ChapterURL_origin = A:ORIGIN(&#039;ChapterURL&#039;);							-- get name of parameter that holds ChapterURL&lt;br /&gt;
	local ScriptChapter = A[&#039;ScriptChapter&#039;];&lt;br /&gt;
	local ScriptChapter_origin = A:ORIGIN (&#039;ScriptChapter&#039;);&lt;br /&gt;
	local Format = A[&#039;Format&#039;];&lt;br /&gt;
	local ChapterFormat = A[&#039;ChapterFormat&#039;];&lt;br /&gt;
	local TransChapter = A[&#039;TransChapter&#039;];&lt;br /&gt;
	local TransChapter_origin = A:ORIGIN (&#039;TransChapter&#039;);&lt;br /&gt;
	local TransTitle = A[&#039;TransTitle&#039;];&lt;br /&gt;
	local ScriptTitle = A[&#039;ScriptTitle&#039;];&lt;br /&gt;
	&lt;br /&gt;
	--[[&lt;br /&gt;
	Parameter remapping for cite encyclopedia:&lt;br /&gt;
	When the citation has these parameters:&lt;br /&gt;
		|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering&lt;br /&gt;
		|encyclopedia= and |article= then map |encyclopedia= to |title= for rendering&lt;br /&gt;
&lt;br /&gt;
		|trans-title= maps to |trans-chapter= when |title= is re-mapped&lt;br /&gt;
		|url= maps to |chapter-url= when |title= is remapped&lt;br /&gt;
	&lt;br /&gt;
	All other combinations of |encyclopedia=, |title=, and |article= are not modified&lt;br /&gt;
	&lt;br /&gt;
	]]&lt;br /&gt;
&lt;br /&gt;
	local Encyclopedia = A[&#039;Encyclopedia&#039;];										-- used as a flag by this module and by ~/COinS&lt;br /&gt;
	local ScriptEncyclopedia = A[&#039;ScriptEncyclopedia&#039;];&lt;br /&gt;
	local TransEncyclopedia = A[&#039;TransEncyclopedia&#039;];&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then	-- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}&lt;br /&gt;
		if &#039;encyclopaedia&#039; ~= config.CitationClass and &#039;citation&#039; ~= config.CitationClass then&lt;br /&gt;
			if utilities.is_set (Encyclopedia) then&lt;br /&gt;
				utilities.set_message (&#039;err_parameter_ignored&#039;, {A:ORIGIN (&#039;Encyclopedia&#039;)});&lt;br /&gt;
			else&lt;br /&gt;
				utilities.set_message (&#039;err_parameter_ignored&#039;, {A:ORIGIN (&#039;ScriptEncyclopedia&#039;)});&lt;br /&gt;
			end&lt;br /&gt;
			Encyclopedia = nil;													-- unset these because not supported by this template&lt;br /&gt;
			ScriptEncyclopedia = nil;&lt;br /&gt;
			TransEncyclopedia = nil;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (TransEncyclopedia) then&lt;br /&gt;
		utilities.set_message (&#039;err_trans_missing_title&#039;, {&#039;encyclopedia&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (&#039;encyclopaedia&#039; == config.CitationClass) or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Encyclopedia)) then&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then	-- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}}&lt;br /&gt;
			utilities.set_message (&#039;err_periodical_ignored&#039;, {Periodical_origin});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then&lt;br /&gt;
			Periodical = Encyclopedia;											-- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia&lt;br /&gt;
			Periodical_origin = A:ORIGIN (&#039;Encyclopedia&#039;);&lt;br /&gt;
			ScriptPeriodical = ScriptEncyclopedia;&lt;br /&gt;
			ScriptPeriodical_origin = A:ORIGIN (&#039;ScriptEncyclopedia&#039;);&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then&lt;br /&gt;
				if not utilities.is_set (Chapter) then&lt;br /&gt;
					Chapter = Title;											-- |encyclopedia= and |title= are set so map |title= params to |article= params for rendering&lt;br /&gt;
					ScriptChapter = ScriptTitle;&lt;br /&gt;
					ScriptChapter_origin = A:ORIGIN(&#039;ScriptTitle&#039;)&lt;br /&gt;
					TransChapter = TransTitle;&lt;br /&gt;
					ChapterURL = URL;&lt;br /&gt;
					ChapterURL_origin = URL_origin;&lt;br /&gt;
					ChapterUrlAccess = UrlAccess;&lt;br /&gt;
					ChapterFormat = Format;&lt;br /&gt;
&lt;br /&gt;
					if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then&lt;br /&gt;
						Chapter = utilities.make_wikilink (TitleLink, Chapter);&lt;br /&gt;
					end&lt;br /&gt;
					Title = Periodical;											-- now map |encyclopedia= params to |title= params for rendering&lt;br /&gt;
					ScriptTitle = ScriptPeriodical or &#039;&#039;;&lt;br /&gt;
					TransTitle = TransEncyclopedia or &#039;&#039;;&lt;br /&gt;
					Periodical = &#039;&#039;;											-- redundant so unset&lt;br /&gt;
					ScriptPeriodical = &#039;&#039;;&lt;br /&gt;
					URL = &#039;&#039;;&lt;br /&gt;
					Format = &#039;&#039;;&lt;br /&gt;
					TitleLink = &#039;&#039;;&lt;br /&gt;
				end&lt;br /&gt;
			elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then	-- |title= not set&lt;br /&gt;
				Title = Periodical;												-- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering&lt;br /&gt;
				ScriptTitle = ScriptPeriodical or &#039;&#039;;&lt;br /&gt;
				TransTitle = TransEncyclopedia or &#039;&#039;;&lt;br /&gt;
				Periodical = &#039;&#039;;												-- redundant so unset&lt;br /&gt;
				ScriptPeriodical = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- special case for cite techreport.&lt;br /&gt;
	local ID = A[&#039;ID&#039;];&lt;br /&gt;
	if (config.CitationClass == &amp;quot;techreport&amp;quot;) then								-- special case for cite techreport&lt;br /&gt;
		if utilities.is_set (A[&#039;Number&#039;]) then									-- cite techreport uses &#039;number&#039;, which other citations alias to &#039;issue&#039;&lt;br /&gt;
			if not utilities.is_set (ID) then									-- can we use ID for the &amp;quot;number&amp;quot;?&lt;br /&gt;
				ID = A[&#039;Number&#039;];												-- yes, use it&lt;br /&gt;
			else																-- ID has a value so emit error message&lt;br /&gt;
				utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;id&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;number&#039;)});&lt;br /&gt;
			end&lt;br /&gt;
		end	&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddity that is {{cite conference}}, before generation of COinS data.&lt;br /&gt;
	local ChapterLink -- = A[&#039;ChapterLink&#039;];									-- deprecated as a parameter but still used internally by cite episode&lt;br /&gt;
	local Conference = A[&#039;Conference&#039;];&lt;br /&gt;
	local BookTitle = A[&#039;BookTitle&#039;];&lt;br /&gt;
	local TransTitle_origin = A:ORIGIN (&#039;TransTitle&#039;);&lt;br /&gt;
	if &#039;conference&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (BookTitle) then&lt;br /&gt;
			Chapter = Title;&lt;br /&gt;
			Chapter_origin = &#039;title&#039;;&lt;br /&gt;
	--		ChapterLink = TitleLink;											-- |chapter-link= is deprecated&lt;br /&gt;
			ChapterURL = URL;&lt;br /&gt;
			ChapterUrlAccess = UrlAccess;&lt;br /&gt;
			ChapterURL_origin = URL_origin;&lt;br /&gt;
			URL_origin = &#039;&#039;;&lt;br /&gt;
			ChapterFormat = Format;&lt;br /&gt;
			TransChapter = TransTitle;&lt;br /&gt;
			TransChapter_origin = TransTitle_origin;&lt;br /&gt;
			Title = BookTitle;&lt;br /&gt;
			Format = &#039;&#039;;&lt;br /&gt;
	--		TitleLink = &#039;&#039;;&lt;br /&gt;
			TransTitle = &#039;&#039;;&lt;br /&gt;
			URL = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	elseif &#039;speech&#039; ~= config.CitationClass then&lt;br /&gt;
		Conference = &#039;&#039;;														-- not cite conference or cite speech so make sure this is empty string&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local use_lowercase = ( sepc == &#039;,&#039; );										-- controls capitalization of certain static text&lt;br /&gt;
	&lt;br /&gt;
	-- cite map oddities&lt;br /&gt;
	local Cartography = &amp;quot;&amp;quot;;&lt;br /&gt;
	local Scale = &amp;quot;&amp;quot;;&lt;br /&gt;
	local Sheet = A[&#039;Sheet&#039;] or &#039;&#039;;&lt;br /&gt;
	local Sheets = A[&#039;Sheets&#039;] or &#039;&#039;;&lt;br /&gt;
	if config.CitationClass == &amp;quot;map&amp;quot; then&lt;br /&gt;
		if utilities.is_set (Chapter) then										--TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;map&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, Chapter_origin)});	-- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Chapter = A[&#039;Map&#039;];&lt;br /&gt;
		Chapter_origin = A:ORIGIN(&#039;Map&#039;);&lt;br /&gt;
		ChapterURL = A[&#039;MapURL&#039;];&lt;br /&gt;
		ChapterURL_origin = A:ORIGIN(&#039;MapURL&#039;);&lt;br /&gt;
		TransChapter = A[&#039;TransMap&#039;];&lt;br /&gt;
		ScriptChapter = A[&#039;ScriptMap&#039;]&lt;br /&gt;
		ScriptChapter_origin = A:ORIGIN(&#039;ScriptMap&#039;)&lt;br /&gt;
&lt;br /&gt;
		ChapterUrlAccess = MapUrlAccess;&lt;br /&gt;
		ChapterFormat = A[&#039;MapFormat&#039;];&lt;br /&gt;
&lt;br /&gt;
		Cartography = A[&#039;Cartography&#039;];&lt;br /&gt;
		if utilities.is_set ( Cartography ) then&lt;br /&gt;
			Cartography = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;cartography&#039;, Cartography, use_lowercase);&lt;br /&gt;
		end		&lt;br /&gt;
		Scale = A[&#039;Scale&#039;];&lt;br /&gt;
		if utilities.is_set ( Scale ) then&lt;br /&gt;
			Scale = sepc .. &amp;quot; &amp;quot; .. Scale;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite episode}} and {{cite serial}}, before generation of COinS data.&lt;br /&gt;
	local Series = A[&#039;Series&#039;];&lt;br /&gt;
	if &#039;episode&#039; == config.CitationClass or &#039;serial&#039; == config.CitationClass then&lt;br /&gt;
		local SeriesLink = A[&#039;SeriesLink&#039;];&lt;br /&gt;
&lt;br /&gt;
		SeriesLink = link_title_ok (SeriesLink, A:ORIGIN (&#039;SeriesLink&#039;), Series, &#039;series&#039;);	-- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set&lt;br /&gt;
&lt;br /&gt;
		local Network = A[&#039;Network&#039;];&lt;br /&gt;
		local Station = A[&#039;Station&#039;];&lt;br /&gt;
		local s, n = {}, {};&lt;br /&gt;
																				-- do common parameters first&lt;br /&gt;
		if utilities.is_set (Network) then table.insert(n, Network); end&lt;br /&gt;
		if utilities.is_set (Station) then table.insert(n, Station); end&lt;br /&gt;
		ID = table.concat(n, sepc .. &#039; &#039;);&lt;br /&gt;
		&lt;br /&gt;
		if &#039;episode&#039; == config.CitationClass then								-- handle the oddities that are strictly {{cite episode}}&lt;br /&gt;
			local Season = A[&#039;Season&#039;];&lt;br /&gt;
			local SeriesNumber = A[&#039;SeriesNumber&#039;];&lt;br /&gt;
&lt;br /&gt;
			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?&lt;br /&gt;
				utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;season&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;seriesno&#039;)});		-- add error message&lt;br /&gt;
				SeriesNumber = &#039;&#039;;												-- unset; prefer |season= over |seriesno=&lt;br /&gt;
			end&lt;br /&gt;
																				-- assemble a table of parts concatenated later into Series&lt;br /&gt;
			if utilities.is_set (Season) then table.insert(s, wrap_msg (&#039;season&#039;, Season, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg (&#039;seriesnum&#039;, SeriesNumber, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (Issue) then table.insert(s, wrap_msg (&#039;episode&#039;, Issue, use_lowercase)); end&lt;br /&gt;
			Issue = &#039;&#039;;															-- unset because this is not a unique parameter&lt;br /&gt;
	&lt;br /&gt;
			Chapter = Title;													-- promote title parameters to chapter&lt;br /&gt;
			ScriptChapter = ScriptTitle;&lt;br /&gt;
			ScriptChapter_origin = A:ORIGIN(&#039;ScriptTitle&#039;);&lt;br /&gt;
			ChapterLink = TitleLink;											-- alias |episode-link=&lt;br /&gt;
			TransChapter = TransTitle;&lt;br /&gt;
			ChapterURL = URL;&lt;br /&gt;
			ChapterUrlAccess = UrlAccess;&lt;br /&gt;
			ChapterURL_origin = URL_origin;&lt;br /&gt;
			ChapterFormat = Format;&lt;br /&gt;
&lt;br /&gt;
			Title = Series;														-- promote series to title&lt;br /&gt;
			TitleLink = SeriesLink;&lt;br /&gt;
			Series = table.concat(s, sepc .. &#039; &#039;);								-- this is concatenation of season, seriesno, episode number&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (ChapterLink) and not utilities.is_set (ChapterURL) then	-- link but not URL&lt;br /&gt;
				Chapter = utilities.make_wikilink (ChapterLink, Chapter);&lt;br /&gt;
			elseif utilities.is_set (ChapterLink) and utilities.is_set (ChapterURL) then	-- if both are set, URL links episode;&lt;br /&gt;
				Series = utilities.make_wikilink (ChapterLink, Series);&lt;br /&gt;
			end&lt;br /&gt;
			URL = &#039;&#039;;															-- unset&lt;br /&gt;
			TransTitle = &#039;&#039;;&lt;br /&gt;
			ScriptTitle = &#039;&#039;;&lt;br /&gt;
			Format = &#039;&#039;;&lt;br /&gt;
			&lt;br /&gt;
		else																	-- now oddities that are cite serial&lt;br /&gt;
			Issue = &#039;&#039;;															-- unset because this parameter no longer supported by the citation/core version of cite serial&lt;br /&gt;
			Chapter = A[&#039;Episode&#039;];												-- TODO: make |episode= available to cite episode someday?&lt;br /&gt;
			if utilities.is_set (Series) and utilities.is_set (SeriesLink) then&lt;br /&gt;
				Series = utilities.make_wikilink (SeriesLink, Series);&lt;br /&gt;
			end&lt;br /&gt;
			Series = utilities.wrap_style (&#039;italic-title&#039;, Series);				-- series is italicized&lt;br /&gt;
		end	&lt;br /&gt;
	end&lt;br /&gt;
	-- end of {{cite episode}} stuff&lt;br /&gt;
&lt;br /&gt;
	-- handle type parameter for those CS1 citations that have default values&lt;br /&gt;
	local TitleType = A[&#039;TitleType&#039;];&lt;br /&gt;
	local Degree = A[&#039;Degree&#039;];&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;AV-media-notes&#039;, &#039;document&#039;, &#039;interview&#039;, &#039;mailinglist&#039;, &#039;map&#039;, &#039;podcast&#039;, &#039;pressrelease&#039;, &#039;report&#039;, &#039;speech&#039;, &#039;techreport&#039;, &#039;thesis&#039;}) then&lt;br /&gt;
		TitleType = set_titletype (config.CitationClass, TitleType);&lt;br /&gt;
		if utilities.is_set (Degree) and &amp;quot;Thesis&amp;quot; == TitleType then				-- special case for cite thesis&lt;br /&gt;
			TitleType = Degree .. &#039; &#039; .. cfg.title_types [&#039;thesis&#039;]:lower();&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (TitleType) then										-- if type parameter is specified&lt;br /&gt;
		TitleType = utilities.substitute ( cfg.messages[&#039;type&#039;], TitleType);	-- display it in parentheses&lt;br /&gt;
	-- TODO: Hack on TitleType to fix bunched parentheses problem&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- legacy: promote PublicationDate to Date if neither Date nor Year are set.&lt;br /&gt;
	local Date = A[&#039;Date&#039;];&lt;br /&gt;
 	local Date_origin;															-- to hold the name of parameter promoted to Date; required for date error messaging&lt;br /&gt;
	local PublicationDate = A[&#039;PublicationDate&#039;];&lt;br /&gt;
	local Year = A[&#039;Year&#039;];&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Year) then&lt;br /&gt;
		validation.year_check (Year);											-- returns nothing; emits maint message when |year= doesn&#039;t hold a &#039;year&#039; value&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
	if not utilities.is_set (Date) then&lt;br /&gt;
		Date = Year;															-- promote Year to Date&lt;br /&gt;
		Year = nil;																-- make nil so Year as empty string isn&#039;t used for CITEREF&lt;br /&gt;
		if not utilities.is_set (Date) and utilities.is_set (PublicationDate) then	-- use PublicationDate when |date= and |year= are not set&lt;br /&gt;
			Date = PublicationDate;												-- promote PublicationDate to Date&lt;br /&gt;
			PublicationDate = &#039;&#039;;												-- unset, no longer needed&lt;br /&gt;
			Date_origin = A:ORIGIN(&#039;PublicationDate&#039;);							-- save the name of the promoted parameter&lt;br /&gt;
		else&lt;br /&gt;
			Date_origin = A:ORIGIN(&#039;Year&#039;);										-- save the name of the promoted parameter&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Date_origin = A:ORIGIN(&#039;Date&#039;);											-- not a promotion; name required for error messaging&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if PublicationDate == Date then PublicationDate = &#039;&#039;; end					-- if PublicationDate is same as Date, don&#039;t display in rendered citation&lt;br /&gt;
&lt;br /&gt;
	--[[&lt;br /&gt;
	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&lt;br /&gt;
	we get the date used in the metadata.&lt;br /&gt;
	&lt;br /&gt;
	Date validation supporting code is in Module:Citation/CS1/Date_validation&lt;br /&gt;
	]]&lt;br /&gt;
&lt;br /&gt;
	local DF = is_valid_parameter_value (A[&#039;DF&#039;], A:ORIGIN(&#039;DF&#039;), cfg.keywords_lists[&#039;df&#039;], &#039;&#039;);&lt;br /&gt;
	if not utilities.is_set (DF) then&lt;br /&gt;
		DF = cfg.global_df;														-- local |df= if present overrides global df set by {{use xxx date}} template&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ArchiveURL;&lt;br /&gt;
	local ArchiveDate;&lt;br /&gt;
	local ArchiveFormat = A[&#039;ArchiveFormat&#039;];&lt;br /&gt;
	local archive_url_timestamp;												-- timestamp from wayback machine url&lt;br /&gt;
	&lt;br /&gt;
	ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A[&#039;ArchiveURL&#039;], A[&#039;ArchiveDate&#039;])&lt;br /&gt;
	ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, &#039;archive-format&#039;, &#039;archive-url&#039;);&lt;br /&gt;
	&lt;br /&gt;
	ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN(&#039;ArchiveURL&#039;), ArchiveDate);		-- add error message when URL or ChapterURL == ArchiveURL&lt;br /&gt;
&lt;br /&gt;
	local AccessDate = A[&#039;AccessDate&#039;];&lt;br /&gt;
	local COinS_date = {};														-- holds date info extracted from |date= for the COinS metadata by Module:Date verification&lt;br /&gt;
	local DoiBroken = A[&#039;DoiBroken&#039;];&lt;br /&gt;
	local Embargo = A[&#039;Embargo&#039;];&lt;br /&gt;
	local anchor_year;															-- used in the CITEREF identifier&lt;br /&gt;
	do	-- create defined block to contain local variables error_message, date_parameters_list, mismatch&lt;br /&gt;
		local error_message = &#039;&#039;;&lt;br /&gt;
																				-- AirDate has been promoted to Date so not necessary to check it&lt;br /&gt;
		local date_parameters_list = {&lt;br /&gt;
			[&#039;access-date&#039;] = {val = AccessDate, name = A:ORIGIN (&#039;AccessDate&#039;)},&lt;br /&gt;
			[&#039;archive-date&#039;] = {val = ArchiveDate, name = A:ORIGIN (&#039;ArchiveDate&#039;)},&lt;br /&gt;
			[&#039;date&#039;] = {val = Date, name = Date_origin},&lt;br /&gt;
			[&#039;doi-broken-date&#039;] = {val = DoiBroken, name = A:ORIGIN (&#039;DoiBroken&#039;)},&lt;br /&gt;
			[&#039;pmc-embargo-date&#039;] = {val = Embargo, name = A:ORIGIN (&#039;Embargo&#039;)},&lt;br /&gt;
			[&#039;publication-date&#039;] = {val = PublicationDate, name = A:ORIGIN (&#039;PublicationDate&#039;)},&lt;br /&gt;
			[&#039;year&#039;] = {val = Year, name = A:ORIGIN (&#039;Year&#039;)},&lt;br /&gt;
			};&lt;br /&gt;
&lt;br /&gt;
		local error_list = {};&lt;br /&gt;
		anchor_year, Embargo = validation.dates(date_parameters_list, COinS_date, error_list);&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Year) and utilities.is_set (Date) then				-- both |date= and |year= not normally needed; &lt;br /&gt;
			validation.year_date_check (Year, A:ORIGIN (&#039;Year&#039;), Date, A:ORIGIN (&#039;Date&#039;), error_list);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if 0 == #error_list then												-- error free dates only; 0 when error_list is empty&lt;br /&gt;
			local modified = false;												-- flag&lt;br /&gt;
			&lt;br /&gt;
			if utilities.is_set (DF) then										-- if we need to reformat dates&lt;br /&gt;
				modified = validation.reformat_dates (date_parameters_list, DF);	-- reformat to DF format, use long month names if appropriate&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if true == validation.date_hyphen_to_dash (date_parameters_list) then	-- convert hyphens to dashes where appropriate&lt;br /&gt;
				modified = true;&lt;br /&gt;
				utilities.set_message (&#039;maint_date_format&#039;);					-- hyphens were converted so add maint category&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
	-- for those wikis that can and want to have English date names translated to the local language; not supported at en.wiki&lt;br /&gt;
			if cfg.date_name_auto_xlate_enable and validation.date_name_xlate (date_parameters_list, cfg.date_digit_auto_xlate_enable ) then&lt;br /&gt;
				utilities.set_message (&#039;maint_date_auto_xlated&#039;);				-- add maint cat&lt;br /&gt;
				modified = true;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if modified then													-- if the date_parameters_list values were modified&lt;br /&gt;
				AccessDate = date_parameters_list[&#039;access-date&#039;].val;			-- overwrite date holding parameters with modified values&lt;br /&gt;
				ArchiveDate = date_parameters_list[&#039;archive-date&#039;].val;&lt;br /&gt;
				Date = date_parameters_list[&#039;date&#039;].val;&lt;br /&gt;
				DoiBroken = date_parameters_list[&#039;doi-broken-date&#039;].val;&lt;br /&gt;
				PublicationDate = date_parameters_list[&#039;publication-date&#039;].val;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if archive_url_timestamp and utilities.is_set (ArchiveDate) then&lt;br /&gt;
				validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF);	-- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;err_bad_date&#039;, {utilities.make_sep_list (#error_list, error_list)});	-- add this error message&lt;br /&gt;
		end&lt;br /&gt;
	end	-- end of do&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;book&#039;, &#039;encyclopaedia&#039;}) or	-- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others?&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and utilities.is_set (Encyclopedia)) or			-- {{citation}} as an encylopedia citation&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and not utilities.is_set (Periodical)) then		-- {{citation}} as a book citation&lt;br /&gt;
			if utilities.is_set (PublicationPlace) then&lt;br /&gt;
				if not utilities.is_set (PublisherName) then&lt;br /&gt;
					local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match (&#039;%d%d%d%d&#039;));	-- get year portion of COinS date (because in Arabic numerals); convert string to number&lt;br /&gt;
					if date and (1850 &amp;lt;= date) then								-- location has no publisher; if date is 1850 or later&lt;br /&gt;
						utilities.set_message (&#039;maint_location_no_publisher&#039;);	-- add maint cat&lt;br /&gt;
					end&lt;br /&gt;
				else															-- PublisherName has a value&lt;br /&gt;
					if cfg.keywords_xlate[&#039;none&#039;] == PublisherName then			-- if that value is &#039;none&#039; (only for book and encyclopedia citations)&lt;br /&gt;
						PublisherName = &#039;&#039;;										-- unset&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ID_list = {};															-- sequence table of rendered identifiers&lt;br /&gt;
	local ID_list_coins = {};													-- table of identifiers and their values from args; key is same as cfg.id_handlers&#039;s key&lt;br /&gt;
	local Class = A[&#039;Class&#039;];													-- arxiv class identifier&lt;br /&gt;
	&lt;br /&gt;
	local ID_support = {&lt;br /&gt;
		{A[&#039;ASINTLD&#039;], &#039;ASIN&#039;, &#039;err_asintld_missing_asin&#039;, A:ORIGIN (&#039;ASINTLD&#039;)},				&lt;br /&gt;
		{DoiBroken, &#039;DOI&#039;, &#039;err_doibroken_missing_doi&#039;, A:ORIGIN (&#039;DoiBroken&#039;)},&lt;br /&gt;
		{Embargo, &#039;PMC&#039;, &#039;err_embargo_missing_pmc&#039;, A:ORIGIN (&#039;Embargo&#039;)},&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	ID_list, ID_list_coins = identifiers.identifier_lists_get (args, {DoiBroken = DoiBroken, ASINTLD = A[&#039;ASINTLD&#039;], Embargo = Embargo, Class = Class, Year=anchor_year}, ID_support);&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, {{cite ssrn}}, before generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then	-- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |medrxiv=, |ssrn= required for their templates&lt;br /&gt;
		if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or 		-- can&#039;t use ID_list_coins k/v table here because invalid parameters omitted&lt;br /&gt;
			args[cfg.id_handlers[config.CitationClass:upper()].parameters[2]]) then			-- which causes unexpected parameter missing error message&lt;br /&gt;
				utilities.set_message (&#039;err_&#039; .. config.CitationClass .. &#039;_missing&#039;);		-- add error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = ({[&#039;arxiv&#039;] = &#039;arXiv&#039;, [&#039;biorxiv&#039;] = &#039;bioRxiv&#039;, [&#039;citeseerx&#039;] = &#039;CiteSeerX&#039;, [&#039;medrxiv&#039;] = &#039;medRxiv&#039;, [&#039;ssrn&#039;] = &#039;Social Science Research Network&#039;})[config.CitationClass];&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Link the title of the work if no |url= was provided, but we have a |pmc= or a |doi= with |doi-access=free&lt;br /&gt;
&lt;br /&gt;
	if config.CitationClass == &amp;quot;journal&amp;quot; and not utilities.is_set (URL) and not utilities.is_set (TitleLink) and not utilities.in_array (cfg.keywords_xlate[Title], {&#039;off&#039;, &#039;none&#039;}) then -- TODO: remove &#039;none&#039; once existing citations have been switched to &#039;off&#039;, so &#039;none&#039; can be used as token for &amp;quot;no title&amp;quot; instead&lt;br /&gt;
		if &#039;none&#039; ~= cfg.keywords_xlate[auto_select] then						-- if auto-linking not disabled&lt;br /&gt;
 	 		if identifiers.auto_link_urls[auto_select] then						-- manual selection&lt;br /&gt;
		 		URL = identifiers.auto_link_urls[auto_select];					-- set URL to be the same as identifier&#039;s external link&lt;br /&gt;
 				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=&lt;br /&gt;
			elseif identifiers.auto_link_urls[&#039;pmc&#039;] then						-- auto-select PMC&lt;br /&gt;
				URL = identifiers.auto_link_urls[&#039;pmc&#039;];						-- set URL to be the same as the PMC external link if not embargoed&lt;br /&gt;
				URL_origin = cfg.id_handlers[&#039;PMC&#039;].parameters[1];				-- set URL_origin to parameter name for use in error message if citation is missing a |title=&lt;br /&gt;
			elseif identifiers.auto_link_urls[&#039;doi&#039;] then						-- auto-select DOI&lt;br /&gt;
				URL = identifiers.auto_link_urls[&#039;doi&#039;];&lt;br /&gt;
				URL_origin = cfg.id_handlers[&#039;DOI&#039;].parameters[1];&lt;br /&gt;
			end&lt;br /&gt;
 	 	end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (URL) then											-- set when using an identifier-created URL&lt;br /&gt;
			if utilities.is_set (AccessDate) then								-- |access-date= requires |url=; identifier-created URL is not |url=&lt;br /&gt;
				utilities.set_message (&#039;err_accessdate_missing_url&#039;);			-- add an error message&lt;br /&gt;
				AccessDate = &#039;&#039;;												-- unset&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (ArchiveURL) then								-- |archive-url= requires |url=; identifier-created URL is not |url=&lt;br /&gt;
				utilities.set_message (&#039;err_archive_missing_url&#039;);				-- add an error message&lt;br /&gt;
				ArchiveURL = &#039;&#039;;												-- unset&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- At this point fields may be nil if they weren&#039;t specified in the template use.  We can use that fact.&lt;br /&gt;
	-- Test if citation has no title&lt;br /&gt;
	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&lt;br /&gt;
		utilities.set_message (&#039;err_citation_missing_title&#039;, {&#039;episode&#039; == config.CitationClass and &#039;series&#039; or &#039;title&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cfg.keywords_xlate[Title], {&#039;off&#039;, &#039;none&#039;}) and&lt;br /&gt;
			utilities.in_array (config.CitationClass, {&#039;journal&#039;, &#039;citation&#039;}) and&lt;br /&gt;
			(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and&lt;br /&gt;
			(&#039;journal&#039; == Periodical_origin or &#039;script-journal&#039; == ScriptPeriodical_origin) then	-- special case for journal cites&lt;br /&gt;
				Title = &#039;&#039;;														-- set title to empty string&lt;br /&gt;
				utilities.set_message (&#039;maint_untitled&#039;);						-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- COinS metadata (see &amp;lt;http://ocoins.info/&amp;gt;) for automated parsing of citation information.&lt;br /&gt;
	-- handle the oddity that is cite encyclopedia and {{citation |encyclopedia=something}}. Here we presume that&lt;br /&gt;
	-- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title&lt;br /&gt;
	-- is the article title, and Chapter is a section within the article.  So, we remap &lt;br /&gt;
	&lt;br /&gt;
	local coins_chapter = Chapter;												-- default assuming that remapping not required&lt;br /&gt;
	local coins_title = Title;													-- et tu&lt;br /&gt;
	if &#039;encyclopaedia&#039; == config.CitationClass or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Encyclopedia)) then&lt;br /&gt;
		if utilities.is_set (Chapter) and utilities.is_set (Title) and utilities.is_set (Periodical) then		-- if all are used then&lt;br /&gt;
			coins_chapter = Title;												-- remap&lt;br /&gt;
			coins_title = Periodical;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local coins_author = a;														-- default for coins rft.au &lt;br /&gt;
	if 0 &amp;lt; #c then																-- but if contributor list&lt;br /&gt;
		coins_author = c;														-- use that instead&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- this is the function call to COinS()&lt;br /&gt;
	local OCinSoutput = metadata.COinS({&lt;br /&gt;
		[&#039;Periodical&#039;] = utilities.strip_apostrophe_markup (Periodical),		-- no markup in the metadata&lt;br /&gt;
		[&#039;Encyclopedia&#039;] = Encyclopedia,										-- just a flag; content ignored by ~/COinS&lt;br /&gt;
		[&#039;Chapter&#039;] = metadata.make_coins_title (coins_chapter, ScriptChapter),	-- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		[&#039;Degree&#039;] = Degree;													-- cite thesis only&lt;br /&gt;
		[&#039;Title&#039;] = metadata.make_coins_title (coins_title, ScriptTitle),		-- Title and ScriptTitle stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		[&#039;PublicationPlace&#039;] = PublicationPlace,&lt;br /&gt;
		[&#039;Date&#039;] = COinS_date.rftdate,											-- COinS_date.* has correctly formatted date values if Date is valid;&lt;br /&gt;
		[&#039;Season&#039;] = COinS_date.rftssn,&lt;br /&gt;
		[&#039;Quarter&#039;] = COinS_date.rftquarter,&lt;br /&gt;
		[&#039;Chron&#039;] =  COinS_date.rftchron,&lt;br /&gt;
		[&#039;Series&#039;] = Series,&lt;br /&gt;
		[&#039;Volume&#039;] = Volume,&lt;br /&gt;
		[&#039;Issue&#039;] = Issue,&lt;br /&gt;
		[&#039;ArticleNumber&#039;] = ArticleNumber,&lt;br /&gt;
		[&#039;Pages&#039;] = coins_pages or metadata.get_coins_pages (first_set ({Sheet, Sheets, Page, Pages, At, QuotePage, QuotePages}, 7)),	-- pages stripped of external links&lt;br /&gt;
		[&#039;Edition&#039;] = Edition,&lt;br /&gt;
		[&#039;PublisherName&#039;] = PublisherName or Newsgroup,							-- any apostrophe markup already removed from PublisherName&lt;br /&gt;
		[&#039;URL&#039;] = first_set ({ChapterURL, URL}, 2),&lt;br /&gt;
		[&#039;Authors&#039;] = coins_author,&lt;br /&gt;
		[&#039;ID_list&#039;] = ID_list_coins,&lt;br /&gt;
		[&#039;RawPage&#039;] = this_page.prefixedText,&lt;br /&gt;
	}, config.CitationClass);&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, and {{cite ssrn}} AFTER generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then	-- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, medRxiv, or ssrn now unset so it isn&#039;t displayed&lt;br /&gt;
		Periodical = &#039;&#039;;														-- periodical not allowed in these templates; if article has been published, use cite journal&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- special case for cite newsgroup.  Do this after COinS because we are modifying Publishername to include some static text&lt;br /&gt;
	if &#039;newsgroup&#039; == config.CitationClass and utilities.is_set (Newsgroup) then&lt;br /&gt;
		PublisherName = utilities.substitute (cfg.messages[&#039;newsgroup&#039;], external_link( &#039;news:&#039; .. Newsgroup, Newsgroup, Newsgroup_origin, nil ));&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Editors;&lt;br /&gt;
	local EditorCount;															-- used only for choosing {ed.) or (eds.) annotation at end of editor name-list&lt;br /&gt;
	local Contributors;															-- assembled contributors name list&lt;br /&gt;
	local contributor_etal;&lt;br /&gt;
	local Translators;															-- assembled translators name list&lt;br /&gt;
	local translator_etal;&lt;br /&gt;
	local t = {};																-- translators list from |translator-lastn= / translator-firstn= pairs&lt;br /&gt;
	t = extract_names (args, &#039;TranslatorList&#039;);									-- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=&lt;br /&gt;
	local Interviewers;															&lt;br /&gt;
	local interviewers_list = {};					&lt;br /&gt;
	interviewers_list = extract_names (args, &#039;InterviewerList&#039;);				-- process preferred interviewers parameters&lt;br /&gt;
	local interviewer_etal;&lt;br /&gt;
	&lt;br /&gt;
	-- Now perform various field substitutions.&lt;br /&gt;
	-- We also add leading spaces and surrounding markup and punctuation to the&lt;br /&gt;
	-- various parts of the citation, but only when they are non-nil.&lt;br /&gt;
	do&lt;br /&gt;
		local last_first_list;&lt;br /&gt;
		local control = { &lt;br /&gt;
			format = NameListStyle,												-- empty string, &#039;&amp;amp;&#039;, &#039;amp&#039;, &#039;and&#039;, or &#039;vanc&#039;&lt;br /&gt;
			maximum = nil,														-- as if display-authors or display-editors not set&lt;br /&gt;
			mode = Mode&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		do																		-- do editor name list first because the now unsupported coauthors used to modify control table&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayEditors&#039;], A[&#039;DisplayEditors&#039;], A:ORIGIN (&#039;DisplayEditors&#039;), #e);&lt;br /&gt;
			control.maximum, editor_etal = get_display_names (display_names, #e, &#039;editors&#039;, editor_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Editors, EditorCount = list_people (control, e, editor_etal);&lt;br /&gt;
&lt;br /&gt;
			if 1 == EditorCount and (true == editor_etal or 1 &amp;lt; #e) then		-- only one editor displayed but includes etal then &lt;br /&gt;
				EditorCount = 2;												-- spoof to display (eds.) annotation&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do interviewers&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayInterviewers&#039;], A[&#039;DisplayInterviewers&#039;], A:ORIGIN (&#039;DisplayInterviewers&#039;), #interviewers_list);&lt;br /&gt;
			control.maximum, interviewer_etal = get_display_names (display_names, #interviewers_list, &#039;interviewers&#039;, interviewer_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Interviewers = list_people (control, interviewers_list, interviewer_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do translators&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayTranslators&#039;], A[&#039;DisplayTranslators&#039;], A:ORIGIN (&#039;DisplayTranslators&#039;), #t);&lt;br /&gt;
			control.maximum, translator_etal = get_display_names (display_names, #t, &#039;translators&#039;, translator_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Translators = list_people (control, t, translator_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do contributors&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayContributors&#039;], A[&#039;DisplayContributors&#039;], A:ORIGIN (&#039;DisplayContributors&#039;), #c);&lt;br /&gt;
			control.maximum, contributor_etal = get_display_names (display_names, #c, &#039;contributors&#039;, contributor_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Contributors = list_people (control, c, contributor_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do authors&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayAuthors&#039;], A[&#039;DisplayAuthors&#039;], A:ORIGIN (&#039;DisplayAuthors&#039;), #a, author_etal);&lt;br /&gt;
			control.maximum, author_etal = get_display_names (display_names, #a, &#039;authors&#039;, author_etal, param);&lt;br /&gt;
&lt;br /&gt;
			last_first_list = list_people (control, a, author_etal);&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (Authors) then&lt;br /&gt;
				Authors, author_etal = name_has_etal (Authors, author_etal, false, &#039;authors&#039;);	-- find and remove variations on et al.&lt;br /&gt;
				if author_etal then&lt;br /&gt;
					Authors = Authors .. &#039; &#039; .. cfg.messages[&#039;et al&#039;];			-- add et al. to authors parameter&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				Authors = last_first_list;										-- either an author name list or an empty string&lt;br /&gt;
			end&lt;br /&gt;
		end																		-- end of do&lt;br /&gt;
	&lt;br /&gt;
		if utilities.is_set (Authors) and utilities.is_set (Collaboration) then&lt;br /&gt;
			Authors = Authors .. &#039; (&#039; .. Collaboration .. &#039;)&#039;;					-- add collaboration after et al.&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ConferenceFormat = A[&#039;ConferenceFormat&#039;];&lt;br /&gt;
	local ConferenceURL = A[&#039;ConferenceURL&#039;];&lt;br /&gt;
	ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, &#039;conference-format&#039;, &#039;conference-url&#039;);&lt;br /&gt;
	Format = style_format (Format, URL, &#039;format&#039;, &#039;url&#039;);&lt;br /&gt;
&lt;br /&gt;
	-- special case for chapter format so no error message or cat when chapter not supported&lt;br /&gt;
	if not (utilities.in_array (config.CitationClass, {&#039;web&#039;, &#039;news&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;pressrelease&#039;, &#039;podcast&#039;, &#039;newsgroup&#039;, &#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) or&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia))) then&lt;br /&gt;
			ChapterFormat = style_format (ChapterFormat, ChapterURL, &#039;chapter-format&#039;, &#039;chapter-url&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (URL) then&lt;br /&gt;
		if utilities.in_array (config.CitationClass, {&amp;quot;web&amp;quot;, &amp;quot;podcast&amp;quot;, &amp;quot;mailinglist&amp;quot;}) or		-- |url= required for cite web, cite podcast, and cite mailinglist&lt;br /&gt;
			(&#039;citation&#039; == config.CitationClass and (&#039;website&#039; == Periodical_origin or &#039;script-website&#039; == ScriptPeriodical_origin)) then	-- and required for {{citation}} with |website= or |script-website=&lt;br /&gt;
				utilities.set_message (&#039;err_cite_web_url&#039;);&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- do we have |accessdate= without either |url= or |chapter-url=?&lt;br /&gt;
		if utilities.is_set (AccessDate) and not utilities.is_set (ChapterURL) then		-- ChapterURL may be set when URL is not set;&lt;br /&gt;
			utilities.set_message (&#039;err_accessdate_missing_url&#039;);&lt;br /&gt;
			AccessDate = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local UrlStatus = is_valid_parameter_value (A[&#039;UrlStatus&#039;], A:ORIGIN(&#039;UrlStatus&#039;), cfg.keywords_lists[&#039;url-status&#039;], &#039;&#039;);&lt;br /&gt;
	local OriginalURL&lt;br /&gt;
	local OriginalURL_origin&lt;br /&gt;
	local OriginalFormat&lt;br /&gt;
	local OriginalAccess;&lt;br /&gt;
	UrlStatus = UrlStatus:lower();												-- used later when assembling archived text&lt;br /&gt;
	if utilities.is_set ( ArchiveURL ) then&lt;br /&gt;
		if utilities.is_set (ChapterURL) then 									-- if chapter-url= is set apply archive url to it&lt;br /&gt;
			OriginalURL = ChapterURL;											-- save copy of source chapter&#039;s url for archive text&lt;br /&gt;
			OriginalURL_origin = ChapterURL_origin;								-- name of |chapter-url= parameter for error messages&lt;br /&gt;
			OriginalFormat = ChapterFormat;										-- and original |chapter-format=&lt;br /&gt;
&lt;br /&gt;
			if &#039;live&#039; ~= UrlStatus then&lt;br /&gt;
				ChapterURL = ArchiveURL											-- swap-in the archive&#039;s URL&lt;br /&gt;
				ChapterURL_origin = A:ORIGIN(&#039;ArchiveURL&#039;)						-- name of |archive-url= parameter for error messages&lt;br /&gt;
				ChapterFormat = ArchiveFormat or &#039;&#039;;							-- swap in archive&#039;s format&lt;br /&gt;
				ChapterUrlAccess = nil;											-- restricted access levels do not make sense for archived URLs&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (URL) then&lt;br /&gt;
			OriginalURL = URL;													-- save copy of original source URL&lt;br /&gt;
			OriginalURL_origin = URL_origin;									-- name of URL parameter for error messages&lt;br /&gt;
			OriginalFormat = Format; 											-- and original |format=&lt;br /&gt;
			OriginalAccess = UrlAccess;&lt;br /&gt;
&lt;br /&gt;
			if &#039;live&#039; ~= UrlStatus then											-- if URL set then |archive-url= applies to it&lt;br /&gt;
				URL = ArchiveURL												-- swap-in the archive&#039;s URL&lt;br /&gt;
				URL_origin = A:ORIGIN(&#039;ArchiveURL&#039;)								-- name of archive URL parameter for error messages&lt;br /&gt;
				Format = ArchiveFormat or &#039;&#039;;									-- swap in archive&#039;s format&lt;br /&gt;
				UrlAccess = nil;												-- restricted access levels do not make sense for archived URLs&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (UrlStatus) then									-- if |url-status= is set when |archive-url= is not set&lt;br /&gt;
 		utilities.set_message (&#039;maint_url_status&#039;);								-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;web&#039;, &#039;news&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;pressrelease&#039;, &#039;podcast&#039;, &#039;newsgroup&#039;, &#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) or	-- if any of the &#039;periodical&#039; cites except encyclopedia&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) then&lt;br /&gt;
			local chap_param;&lt;br /&gt;
			if utilities.is_set (Chapter) then									-- get a parameter name from one of these chapter related meta-parameters&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;Chapter&#039;)&lt;br /&gt;
			elseif utilities.is_set (TransChapter) then&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;TransChapter&#039;)&lt;br /&gt;
			elseif utilities.is_set (ChapterURL) then&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;ChapterURL&#039;)&lt;br /&gt;
			elseif utilities.is_set (ScriptChapter) then&lt;br /&gt;
				chap_param = ScriptChapter_origin;&lt;br /&gt;
			else utilities.is_set (ChapterFormat)&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;ChapterFormat&#039;)&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (chap_param) then								-- if we found one&lt;br /&gt;
				utilities.set_message (&#039;err_chapter_ignored&#039;, {chap_param});	-- add error message&lt;br /&gt;
				Chapter = &#039;&#039;;													-- and set them to empty string to be safe with concatenation&lt;br /&gt;
				TransChapter = &#039;&#039;;&lt;br /&gt;
				ChapterURL = &#039;&#039;;&lt;br /&gt;
				ScriptChapter = &#039;&#039;;&lt;br /&gt;
				ChapterFormat = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
	else																		-- otherwise, format chapter / article title&lt;br /&gt;
		local no_quotes = false;												-- default assume that we will be quoting the chapter parameter value&lt;br /&gt;
		if utilities.is_set (Contribution) and 0 &amp;lt; #c then						-- if this is a contribution with contributor(s)&lt;br /&gt;
			if utilities.in_array (Contribution:lower(), cfg.keywords_lists.contribution) then	-- and a generic contribution title&lt;br /&gt;
				no_quotes = true;												-- then render it unquoted&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Chapter = format_chapter_title (ScriptChapter, ScriptChapter_origin, Chapter, Chapter_origin, TransChapter, TransChapter_origin, ChapterURL, ChapterURL_origin, no_quotes, ChapterUrlAccess);		-- Contribution is also in Chapter&lt;br /&gt;
		if utilities.is_set (Chapter) then&lt;br /&gt;
			Chapter = Chapter .. ChapterFormat ;&lt;br /&gt;
			if &#039;map&#039; == config.CitationClass and utilities.is_set (TitleType) then&lt;br /&gt;
				Chapter = Chapter .. &#039; &#039; .. TitleType;							-- map annotation here; not after title&lt;br /&gt;
			end&lt;br /&gt;
			Chapter = Chapter .. sepc .. &#039; &#039;;&lt;br /&gt;
		elseif utilities.is_set (ChapterFormat) then							-- |chapter= not set but |chapter-format= is so ...&lt;br /&gt;
			Chapter = ChapterFormat .. sepc .. &#039; &#039;;								-- ... ChapterFormat has error message, we want to see it&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Format main title&lt;br /&gt;
	local plain_title = false;&lt;br /&gt;
	local accept_title;&lt;br /&gt;
	Title, accept_title = utilities.has_accept_as_written (Title, true);		-- remove accept-this-as-written markup when it wraps all of &amp;lt;Title&amp;gt;&lt;br /&gt;
	if accept_title and (&#039;&#039; == Title) then										-- only support forced empty for now &amp;quot;(())&amp;quot;&lt;br /&gt;
		Title = cfg.messages[&#039;notitle&#039;];										-- replace by predefined &amp;quot;No title&amp;quot; message&lt;br /&gt;
			-- TODO: utilities.set_message ( &#039;err_redundant_parameters&#039;, ...);	-- issue proper error message instead of muting	 &lt;br /&gt;
			ScriptTitle = &#039;&#039;;													-- just mute for now	 &lt;br /&gt;
			TransTitle = &#039;&#039;;													-- just mute for now&lt;br /&gt;
 		plain_title = true;														-- suppress text decoration for descriptive title&lt;br /&gt;
		utilities.set_message (&#039;maint_untitled&#039;);								-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not accept_title then													-- &amp;lt;Title&amp;gt; not wrapped in accept-as-written markup&lt;br /&gt;
		if &#039;...&#039; == Title:sub (-3) then											-- if ellipsis is the last three characters of |title=&lt;br /&gt;
			Title = Title:gsub (&#039;(%.%.%.)%.+$&#039;, &#039;%1&#039;);							-- limit the number of dots to three&lt;br /&gt;
		elseif not mw.ustring.find (Title, &#039;%.%s*%a%.$&#039;) and					-- end of title is not a &#039;dot-(optional space-)letter-dot&#039; initialism ...&lt;br /&gt;
			not mw.ustring.find (Title, &#039;%s+%a%.$&#039;) then						-- ...and not a &#039;space-letter-dot&#039; initial (&#039;&#039;Allium canadense&#039;&#039; L.)&lt;br /&gt;
				Title = mw.ustring.gsub(Title, &#039;%&#039; .. sepc .. &#039;$&#039;, &#039;&#039;);			-- remove any trailing separator character; sepc and ms.ustring() here for languages that use multibyte separator characters&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (ArchiveURL) and is_archived_copy (Title) then&lt;br /&gt;
			utilities.set_message (&#039;maint_archived_copy&#039;);						-- add maintenance category before we modify the content of Title&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if is_generic (&#039;generic_titles&#039;, Title) then&lt;br /&gt;
			utilities.set_message (&#039;err_generic_title&#039;);						-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (not plain_title) and (utilities.in_array (config.CitationClass, {&#039;web&#039;, &#039;news&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;document&#039;, &#039;pressrelease&#039;, &#039;podcast&#039;, &#039;newsgroup&#039;, &#039;mailinglist&#039;, &#039;interview&#039;, &#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) or&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or&lt;br /&gt;
		(&#039;map&#039; == 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&lt;br /&gt;
			Title = kern_quotes (Title);										-- if necessary, separate title&#039;s leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			Title = utilities.wrap_style (&#039;quoted-title&#039;, Title);&lt;br /&gt;
			Title = script_concatenate (Title, ScriptTitle, &#039;script-title&#039;);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
			TransTitle = utilities.wrap_style (&#039;trans-quoted-title&#039;, TransTitle );&lt;br /&gt;
	elseif plain_title or (&#039;report&#039; == config.CitationClass) then				-- no styling for cite report and descriptive titles (otherwise same as above)&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, &#039;script-title&#039;);		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style (&#039;trans-quoted-title&#039;, TransTitle );	-- for cite report, use this form for trans-title&lt;br /&gt;
	else&lt;br /&gt;
		Title = utilities.wrap_style (&#039;italic-title&#039;, Title);&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, &#039;script-title&#039;);		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style (&#039;trans-italic-title&#039;, TransTitle);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (TransTitle) then&lt;br /&gt;
		if utilities.is_set (Title) then&lt;br /&gt;
			TransTitle = &amp;quot; &amp;quot; .. TransTitle;&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;err_trans_missing_title&#039;, {&#039;title&#039;});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Title) then											-- TODO: is this the right place to be making Wikisource URLs?&lt;br /&gt;
		if utilities.is_set (TitleLink) and utilities.is_set (URL) then&lt;br /&gt;
			utilities.set_message (&#039;err_wikilink_in_url&#039;);						-- set an error message because we can&#039;t have both&lt;br /&gt;
			TitleLink = &#039;&#039;;														-- unset&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		if not utilities.is_set (TitleLink) and utilities.is_set (URL) then&lt;br /&gt;
			Title = external_link (URL, Title, URL_origin, UrlAccess) .. TransTitle .. Format;&lt;br /&gt;
			URL = &#039;&#039;;															-- unset these because no longer needed&lt;br /&gt;
			Format = &amp;quot;&amp;quot;;&lt;br /&gt;
		elseif utilities.is_set (TitleLink) and not utilities.is_set (URL) then&lt;br /&gt;
			local ws_url;&lt;br /&gt;
			ws_url = wikisource_url_make (TitleLink);							-- ignore ws_label return; not used here&lt;br /&gt;
			if ws_url then&lt;br /&gt;
				Title = external_link (ws_url, Title .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in title-link&#039;);	-- space char after Title to move icon away from italic text; TODO: a better way to do this?&lt;br /&gt;
				Title = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], TitleLink, Title});				&lt;br /&gt;
				Title = Title .. TransTitle;&lt;br /&gt;
			else&lt;br /&gt;
				Title = utilities.make_wikilink (TitleLink, Title) .. TransTitle;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			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)&lt;br /&gt;
			ws_url, ws_label, L = wikisource_url_make (Title:gsub(&#039;^[\&#039;&amp;quot;]*(.-)[\&#039;&amp;quot;]*$&#039;, &#039;%1&#039;));	-- make ws URL from |title= interwiki link (strip italic or quote markup); link portion L becomes tooltip label&lt;br /&gt;
			if ws_url then&lt;br /&gt;
				Title = Title:gsub (&#039;%b[]&#039;, ws_label);							-- replace interwiki link with ws_label to retain markup&lt;br /&gt;
				Title = external_link (ws_url, Title .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in title&#039;);	-- space char after Title to move icon away from italic text; TODO: a better way to do this?&lt;br /&gt;
				Title = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, Title});				&lt;br /&gt;
				Title = Title .. TransTitle;&lt;br /&gt;
			else&lt;br /&gt;
				Title = Title .. TransTitle;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Title = TransTitle;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Place) then&lt;br /&gt;
		Place = &amp;quot; &amp;quot; .. wrap_msg (&#039;written&#039;, Place, use_lowercase) .. sepc .. &amp;quot; &amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ConferenceURL_origin = A:ORIGIN(&#039;ConferenceURL&#039;);						-- get name of parameter that holds ConferenceURL&lt;br /&gt;
	if utilities.is_set (Conference) then&lt;br /&gt;
		if utilities.is_set (ConferenceURL) then&lt;br /&gt;
			Conference = external_link( ConferenceURL, Conference, ConferenceURL_origin, nil );&lt;br /&gt;
		end&lt;br /&gt;
		Conference = sepc .. &amp;quot; &amp;quot; .. Conference .. ConferenceFormat;&lt;br /&gt;
	elseif utilities.is_set (ConferenceURL) then&lt;br /&gt;
		Conference = sepc .. &amp;quot; &amp;quot; .. external_link( ConferenceURL, nil, ConferenceURL_origin, nil );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Position = &#039;&#039;;&lt;br /&gt;
	if not utilities.is_set (Position) then&lt;br /&gt;
		local Minutes = A[&#039;Minutes&#039;];&lt;br /&gt;
		local Time = A[&#039;Time&#039;];&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Minutes) then&lt;br /&gt;
			if utilities.is_set (Time) then		--TODO: make a function for this and similar?&lt;br /&gt;
				utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;minutes&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;time&#039;)});&lt;br /&gt;
			end&lt;br /&gt;
			Position = &amp;quot; &amp;quot; .. Minutes .. &amp;quot; &amp;quot; .. cfg.messages[&#039;minutes&#039;];&lt;br /&gt;
		else&lt;br /&gt;
			if utilities.is_set (Time) then&lt;br /&gt;
				local TimeCaption = A[&#039;TimeCaption&#039;]&lt;br /&gt;
				if not utilities.is_set (TimeCaption) then&lt;br /&gt;
					TimeCaption = cfg.messages[&#039;event&#039;];&lt;br /&gt;
					if sepc ~= &#039;.&#039; then&lt;br /&gt;
						TimeCaption = TimeCaption:lower();&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				Position = &amp;quot; &amp;quot; .. TimeCaption .. &amp;quot; &amp;quot; .. Time;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Position = &amp;quot; &amp;quot; .. Position;&lt;br /&gt;
		At = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	Page, Pages, Sheet, Sheets = format_pages_sheets (Page, Pages, Sheet, Sheets, config.CitationClass, Periodical_origin, sepc, NoPP, use_lowercase);&lt;br /&gt;
&lt;br /&gt;
	At = utilities.is_set (At) and (sepc .. &amp;quot; &amp;quot; .. At) or &amp;quot;&amp;quot;;&lt;br /&gt;
	Position = utilities.is_set (Position) and (sepc .. &amp;quot; &amp;quot; .. Position) or &amp;quot;&amp;quot;;&lt;br /&gt;
	if config.CitationClass == &#039;map&#039; then&lt;br /&gt;
		local Sections = A[&#039;Sections&#039;];											-- Section (singular) is an alias of Chapter so set earlier&lt;br /&gt;
		local Inset = A[&#039;Inset&#039;];&lt;br /&gt;
		&lt;br /&gt;
		if utilities.is_set ( Inset ) then&lt;br /&gt;
			Inset = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;inset&#039;, Inset, use_lowercase);&lt;br /&gt;
		end			&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set ( Sections ) then&lt;br /&gt;
			Section = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;sections&#039;, Sections, use_lowercase);&lt;br /&gt;
		elseif utilities.is_set ( Section ) then&lt;br /&gt;
			Section = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;section&#039;, Section, use_lowercase);&lt;br /&gt;
		end&lt;br /&gt;
		At = At .. Inset .. Section;		&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
	local Others = A[&#039;Others&#039;];&lt;br /&gt;
	if utilities.is_set (Others) and 0 == #a and 0 == #e then					-- add maint cat when |others= has value and used without |author=, |editor=&lt;br /&gt;
		if config.CitationClass == &amp;quot;AV-media-notes&amp;quot;&lt;br /&gt;
		or config.CitationClass == &amp;quot;audio-visual&amp;quot; then							-- special maint for AV/M which has a lot of &#039;false&#039; positives right now&lt;br /&gt;
			utilities.set_message (&#039;maint_others_avm&#039;)&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;maint_others&#039;);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	Others = utilities.is_set (Others) and (sepc .. &amp;quot; &amp;quot; .. Others) or &amp;quot;&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	if utilities.is_set (Translators) then&lt;br /&gt;
		Others = safe_join ({sepc .. &#039; &#039;, wrap_msg (&#039;translated&#039;, Translators, use_lowercase), Others}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	if utilities.is_set (Interviewers) then&lt;br /&gt;
		Others = safe_join ({sepc .. &#039; &#039;, wrap_msg (&#039;interview&#039;, Interviewers, use_lowercase), Others}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local TitleNote = A[&#039;TitleNote&#039;];&lt;br /&gt;
	TitleNote = utilities.is_set (TitleNote) and (sepc .. &amp;quot; &amp;quot; .. TitleNote) or &amp;quot;&amp;quot;;&lt;br /&gt;
	if utilities.is_set (Edition) then&lt;br /&gt;
		if Edition:match (&#039;%f[%a][Ee]d%n?%.?$&#039;) or Edition:match (&#039;%f[%a][Ee]dition$&#039;) then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.&lt;br /&gt;
			utilities.set_message (&#039;err_extra_text_edition&#039;);					 -- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Edition = &amp;quot; &amp;quot; .. wrap_msg (&#039;edition&#039;, Edition);&lt;br /&gt;
	else&lt;br /&gt;
		Edition = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	Series = utilities.is_set (Series) and wrap_msg (&#039;series&#039;, {sepc, Series}) or &amp;quot;&amp;quot;;	-- not the same as SeriesNum&lt;br /&gt;
	local Agency = A[&#039;Agency&#039;] or &#039;&#039;;											-- |agency= is supported by {{cite magazine}}, {{cite news}}, {{cite press release}}, {{cite web}}, and certain {{citation}} templates&lt;br /&gt;
	if utilities.is_set (Agency) then											-- this testing done here because {{citation}} supports &#039;news&#039; citations&lt;br /&gt;
		if utilities.in_array (config.CitationClass, {&#039;magazine&#039;, &#039;news&#039;, &#039;pressrelease&#039;, &#039;web&#039;}) or (&#039;citation&#039; == config.CitationClass and utilities.in_array (Periodical_origin, {&amp;quot;magazine&amp;quot;, &amp;quot;newspaper&amp;quot;, &amp;quot;work&amp;quot;})) then&lt;br /&gt;
			Agency = wrap_msg (&#039;agency&#039;, {sepc, Agency});						-- format for rendering&lt;br /&gt;
		else&lt;br /&gt;
			Agency = &#039;&#039;;														-- unset; not supported&lt;br /&gt;
			utilities.set_message (&#039;err_parameter_ignored&#039;, {&#039;agency&#039;});		-- add error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	Volume = format_volume_issue (Volume, Issue, ArticleNumber, config.CitationClass, Periodical_origin, sepc, use_lowercase);&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (AccessDate) then&lt;br /&gt;
		local retrv_text = &amp;quot; &amp;quot; .. cfg.messages[&#039;retrieved&#039;]&lt;br /&gt;
&lt;br /&gt;
		AccessDate = nowrap_date (AccessDate);									-- wrap in nowrap span if date in appropriate format&lt;br /&gt;
		if (sepc ~= &amp;quot;.&amp;quot;) then retrv_text = retrv_text:lower() end				-- if mode is cs2, lower case&lt;br /&gt;
		AccessDate = utilities.substitute (retrv_text, AccessDate);				-- add retrieved text&lt;br /&gt;
&lt;br /&gt;
		AccessDate = utilities.substitute (cfg.presentation[&#039;accessdate&#039;], {sepc, AccessDate});	-- allow editors to hide accessdates&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if utilities.is_set (ID) then ID = sepc .. &amp;quot; &amp;quot; .. ID; end&lt;br /&gt;
	&lt;br /&gt;
	local Docket = A[&#039;Docket&#039;];&lt;br /&gt;
   	if &amp;quot;thesis&amp;quot; == config.CitationClass and utilities.is_set (Docket) then&lt;br /&gt;
		ID = sepc .. &amp;quot; Docket &amp;quot; .. Docket .. ID;&lt;br /&gt;
	end&lt;br /&gt;
   	if &amp;quot;report&amp;quot; == config.CitationClass and utilities.is_set (Docket) then		-- for cite report when |docket= is set&lt;br /&gt;
		ID = sepc .. &#039; &#039; .. Docket;												-- overwrite ID even if |id= is set&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (URL) then&lt;br /&gt;
		URL = &amp;quot; &amp;quot; .. external_link( URL, nil, URL_origin, UrlAccess );&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- We check length of PostScript here because it will have been nuked by&lt;br /&gt;
	-- the quote parameters. We&#039;d otherwise emit a message even if there wasn&#039;t&lt;br /&gt;
	-- a displayed postscript.&lt;br /&gt;
	-- TODO: Should the max size (1) be configurable?&lt;br /&gt;
	-- TODO: Should we check a specific pattern?&lt;br /&gt;
	if utilities.is_set(PostScript) and mw.ustring.len(PostScript) &amp;gt; 1 then&lt;br /&gt;
		utilities.set_message (&#039;maint_postscript&#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Archived;&lt;br /&gt;
	if utilities.is_set (ArchiveURL) then&lt;br /&gt;
		if not utilities.is_set (ArchiveDate) then								-- ArchiveURL set but ArchiveDate not set&lt;br /&gt;
			utilities.set_message (&#039;err_archive_missing_date&#039;);					-- emit an error message&lt;br /&gt;
			ArchiveURL = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
			ArchiveDate = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
	else														&lt;br /&gt;
		if utilities.is_set (ArchiveDate) then									-- ArchiveURL not set but ArchiveDate is set&lt;br /&gt;
			utilities.set_message (&#039;err_archive_date_missing_url&#039;);				-- emit an error message&lt;br /&gt;
			ArchiveURL = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
			ArchiveDate = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (ArchiveURL) then&lt;br /&gt;
		local arch_text;&lt;br /&gt;
		if &amp;quot;live&amp;quot; == UrlStatus then&lt;br /&gt;
			arch_text = cfg.messages[&#039;archived&#039;];&lt;br /&gt;
			if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
			if utilities.is_set (ArchiveDate) then&lt;br /&gt;
				Archived = sepc .. &#039; &#039; .. utilities.substitute ( cfg.messages[&#039;archived-live&#039;],&lt;br /&gt;
					{external_link( ArchiveURL, arch_text, A:ORIGIN(&#039;ArchiveURL&#039;), nil) .. ArchiveFormat, ArchiveDate } );&lt;br /&gt;
			else&lt;br /&gt;
				Archived = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			if not utilities.is_set (OriginalURL) then&lt;br /&gt;
				utilities.set_message (&#039;err_archive_missing_url&#039;);&lt;br /&gt;
				Archived = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (OriginalURL) then								-- UrlStatus is empty, &#039;dead&#039;, &#039;unfit&#039;, &#039;usurped&#039;, &#039;bot: unknown&#039;&lt;br /&gt;
			if utilities.in_array (UrlStatus, {&#039;unfit&#039;, &#039;usurped&#039;, &#039;bot: unknown&#039;}) then&lt;br /&gt;
				arch_text = cfg.messages[&#039;archived-unfit&#039;];&lt;br /&gt;
				if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
				Archived = sepc .. &#039; &#039; .. arch_text .. ArchiveDate;				-- format already styled&lt;br /&gt;
				if &#039;bot: unknown&#039; == UrlStatus then&lt;br /&gt;
					utilities.set_message (&#039;maint_bot_unknown&#039;);				-- and add a category if not already added&lt;br /&gt;
				else&lt;br /&gt;
					utilities.add_prop_cat (&#039;unfit&#039;);							-- and add a category if not already added&lt;br /&gt;
				end&lt;br /&gt;
			else																-- UrlStatus is empty, &#039;dead&#039;&lt;br /&gt;
				arch_text = cfg.messages[&#039;archived-dead&#039;];&lt;br /&gt;
				if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
				if utilities.is_set (ArchiveDate) then&lt;br /&gt;
					Archived = sepc .. &amp;quot; &amp;quot; .. utilities.substitute ( arch_text,&lt;br /&gt;
						{ external_link( OriginalURL, cfg.messages[&#039;original&#039;], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } );	-- format already styled&lt;br /&gt;
				else&lt;br /&gt;
					Archived = &#039;&#039;;												-- unset for concatenation&lt;br /&gt;
				end&lt;br /&gt;
			end	&lt;br /&gt;
		else																	-- OriginalUrl not set&lt;br /&gt;
			utilities.set_message (&#039;err_archive_missing_url&#039;);&lt;br /&gt;
			Archived = &#039;&#039;;														-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (ArchiveFormat) then&lt;br /&gt;
		Archived = ArchiveFormat;												-- if set and ArchiveURL not set ArchiveFormat has error message&lt;br /&gt;
	else&lt;br /&gt;
		Archived = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local TranscriptURL = A[&#039;TranscriptURL&#039;]&lt;br /&gt;
	local TranscriptFormat = A[&#039;TranscriptFormat&#039;];&lt;br /&gt;
	TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, &#039;transcript-format&#039;, &#039;transcripturl&#039;);&lt;br /&gt;
	local Transcript = A[&#039;Transcript&#039;];&lt;br /&gt;
	local TranscriptURL_origin = A:ORIGIN(&#039;TranscriptURL&#039;);						-- get name of parameter that holds TranscriptURL&lt;br /&gt;
	if utilities.is_set (Transcript) then&lt;br /&gt;
		if utilities.is_set (TranscriptURL) then&lt;br /&gt;
			Transcript = external_link( TranscriptURL, Transcript, TranscriptURL_origin, nil );&lt;br /&gt;
		end&lt;br /&gt;
		Transcript = sepc .. &#039; &#039; .. Transcript .. TranscriptFormat;&lt;br /&gt;
	elseif utilities.is_set (TranscriptURL) then&lt;br /&gt;
		Transcript = external_link( TranscriptURL, nil, TranscriptURL_origin, nil );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Publisher;&lt;br /&gt;
	if utilities.is_set (PublicationDate) then&lt;br /&gt;
		PublicationDate = wrap_msg (&#039;published&#039;, PublicationDate);&lt;br /&gt;
	end&lt;br /&gt;
	if utilities.is_set (PublisherName) then&lt;br /&gt;
		if utilities.is_set (PublicationPlace) then&lt;br /&gt;
			Publisher = sepc .. &amp;quot; &amp;quot; .. PublicationPlace .. &amp;quot;: &amp;quot; .. PublisherName .. PublicationDate;&lt;br /&gt;
		else&lt;br /&gt;
			Publisher = sepc .. &amp;quot; &amp;quot; .. PublisherName .. PublicationDate;  &lt;br /&gt;
		end			&lt;br /&gt;
	elseif utilities.is_set (PublicationPlace) then &lt;br /&gt;
		Publisher= sepc .. &amp;quot; &amp;quot; .. PublicationPlace .. PublicationDate;&lt;br /&gt;
	else &lt;br /&gt;
		Publisher = PublicationDate;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Several of the above rely upon detecting this as nil, so do it last.&lt;br /&gt;
	if (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical)) then&lt;br /&gt;
		if utilities.is_set (Title) or utilities.is_set (TitleNote) then &lt;br /&gt;
			Periodical = sepc .. &amp;quot; &amp;quot; .. format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);&lt;br /&gt;
		else &lt;br /&gt;
			Periodical = format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Language = A[&#039;Language&#039;];&lt;br /&gt;
	if utilities.is_set (Language) then&lt;br /&gt;
		Language = language_parameter (Language);								-- format, categories, name from ISO639-1, etc.&lt;br /&gt;
	else&lt;br /&gt;
		Language=&#039;&#039;;															-- language not specified so make sure this is an empty string;&lt;br /&gt;
	--[[ TODO: need to extract the wrap_msg from language_parameter&lt;br /&gt;
	so that we can solve parentheses bunching problem with Format/Language/TitleType&lt;br /&gt;
	]]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--[[&lt;br /&gt;
	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 &amp;quot; (Speech)&amp;quot; so that&lt;br /&gt;
	the annotation directly follows the |title= parameter value in the citation rather than the |event= parameter value (if provided).&lt;br /&gt;
	]]&lt;br /&gt;
	if &amp;quot;speech&amp;quot; == config.CitationClass then									-- cite speech only&lt;br /&gt;
		TitleNote = TitleType;													-- move TitleType to TitleNote so that it renders ahead of |event=&lt;br /&gt;
		TitleType = &#039;&#039;;															-- and unset&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Periodical) then									-- if Periodical, perhaps because of an included |website= or |journal= parameter &lt;br /&gt;
			if utilities.is_set (Conference) then								-- and if |event= is set&lt;br /&gt;
				Conference = Conference .. sepc .. &amp;quot; &amp;quot;;							-- then add appropriate punctuation to the end of the Conference variable before rendering&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Piece all bits together at last.  Here, all should be non-nil.&lt;br /&gt;
	-- We build things this way because it is more efficient in LUA&lt;br /&gt;
	-- not to keep reassigning to the same string variable over and over.&lt;br /&gt;
&lt;br /&gt;
	local tcommon;&lt;br /&gt;
	local tcommon2;																-- used for book cite when |contributor= is set&lt;br /&gt;
	&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&amp;quot;book&amp;quot;, &amp;quot;citation&amp;quot;}) and not utilities.is_set (Periodical) then		-- special cases for book cites&lt;br /&gt;
		if utilities.is_set (Contributors) then									-- when we are citing foreword, preface, introduction, etc.&lt;br /&gt;
			tcommon = safe_join ({Title, TitleNote}, sepc);						-- author and other stuff will come after this and before tcommon2&lt;br /&gt;
			tcommon2 = safe_join ({TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);&lt;br /&gt;
		else&lt;br /&gt;
			tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif &#039;map&#039; == config.CitationClass then									-- special cases for cite map&lt;br /&gt;
		if utilities.is_set (Chapter) then										-- map in a book; TitleType is part of Chapter&lt;br /&gt;
			tcommon = safe_join ({Title, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);&lt;br /&gt;
		elseif utilities.is_set (Periodical) then								-- map in a periodical&lt;br /&gt;
			tcommon = safe_join ({Title, TitleType, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);&lt;br /&gt;
		else																	-- a sheet or stand-alone map&lt;br /&gt;
			tcommon = safe_join ({Title, TitleType, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc);&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	elseif &#039;episode&#039; == config.CitationClass then								-- special case for cite episode&lt;br /&gt;
		tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc);&lt;br /&gt;
&lt;br /&gt;
	else																		-- all other CS1 templates&lt;br /&gt;
		tcommon = safe_join ({Title, TitleNote, Conference, Periodical, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if #ID_list &amp;gt; 0 then&lt;br /&gt;
		ID_list = safe_join( { sepc .. &amp;quot; &amp;quot;,  table.concat( ID_list, sepc .. &amp;quot; &amp;quot; ), ID }, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		ID_list = ID;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Via = A[&#039;Via&#039;];&lt;br /&gt;
	Via = utilities.is_set (Via) and  wrap_msg (&#039;via&#039;, Via) or &#039;&#039;;&lt;br /&gt;
	local idcommon;&lt;br /&gt;
	if &#039;audio-visual&#039; == config.CitationClass or &#039;episode&#039; == config.CitationClass then	-- special case for cite AV media &amp;amp; cite episode position transcript&lt;br /&gt;
		idcommon = safe_join( { ID_list, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Quote }, sepc );&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local text;&lt;br /&gt;
	local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;&lt;br /&gt;
&lt;br /&gt;
	local OrigDate = A[&#039;OrigDate&#039;];&lt;br /&gt;
	OrigDate = utilities.is_set (OrigDate) and wrap_msg (&#039;origdate&#039;, OrigDate) or &#039;&#039;;&lt;br /&gt;
	if utilities.is_set (Date) then&lt;br /&gt;
		if utilities.is_set (Authors) or utilities.is_set (Editors) then		-- date follows authors or editors when authors not set&lt;br /&gt;
			Date = &amp;quot; (&amp;quot; .. Date .. &amp;quot;)&amp;quot; .. OrigDate .. sepc .. &amp;quot; &amp;quot;;				-- in parentheses&lt;br /&gt;
		else																	-- neither of authors and editors set&lt;br /&gt;
			if (string.sub(tcommon, -1, -1) == sepc) then						-- if the last character of tcommon is sepc&lt;br /&gt;
				Date = &amp;quot; &amp;quot; .. Date .. OrigDate;									-- Date does not begin with sepc&lt;br /&gt;
			else&lt;br /&gt;
				Date = sepc .. &amp;quot; &amp;quot; .. Date .. OrigDate;							-- Date begins with sepc&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
	if utilities.is_set (Authors) then&lt;br /&gt;
		if (not utilities.is_set (Date)) then									-- when date is set it&#039;s in parentheses; no Authors termination&lt;br /&gt;
			Authors = terminate_name_list (Authors, sepc);						-- when no date, terminate with 0 or 1 sepc and a space&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Editors) then&lt;br /&gt;
			local in_text = &#039;&#039;;&lt;br /&gt;
			local post_text = &#039;&#039;;&lt;br /&gt;
			if utilities.is_set (Chapter) and 0 == #c then&lt;br /&gt;
				in_text = cfg.messages[&#039;in&#039;] .. &#039; &#039;;&lt;br /&gt;
				if (sepc ~= &#039;.&#039;) then&lt;br /&gt;
					in_text = in_text:lower();									-- lowercase for cs2&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if EditorCount &amp;lt;= 1 then&lt;br /&gt;
				post_text = &#039; (&#039; .. cfg.messages[&#039;editor&#039;] .. &#039;)&#039;;				-- be consistent with no-author, no-date case&lt;br /&gt;
			else&lt;br /&gt;
				post_text = &#039; (&#039; .. cfg.messages[&#039;editors&#039;] .. &#039;)&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			Editors = terminate_name_list (in_text .. Editors .. post_text, sepc);	-- terminate with 0 or 1 sepc and a space&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Contributors) then									-- book cite and we&#039;re citing the intro, preface, etc.&lt;br /&gt;
			local by_text = sepc .. &#039; &#039; .. cfg.messages[&#039;by&#039;] .. &#039; &#039;;&lt;br /&gt;
			if (sepc ~= &#039;.&#039;) then by_text = by_text:lower() end					-- lowercase for cs2&lt;br /&gt;
			Authors = by_text .. Authors;										-- author follows title so tweak it here&lt;br /&gt;
			if utilities.is_set (Editors) and utilities.is_set (Date) then		-- when Editors make sure that Authors gets terminated&lt;br /&gt;
				Authors = terminate_name_list (Authors, sepc);					-- terminate with 0 or 1 sepc and a space&lt;br /&gt;
			end&lt;br /&gt;
			if (not utilities.is_set (Date)) then								-- when date is set it&#039;s in parentheses; no Contributors termination&lt;br /&gt;
				Contributors = terminate_name_list (Contributors, sepc);		-- terminate with 0 or 1 sepc and a space&lt;br /&gt;
			end&lt;br /&gt;
			text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, pgtext, idcommon }, sepc );&lt;br /&gt;
		else&lt;br /&gt;
			text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, pgtext, idcommon }, sepc );&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (Editors) then&lt;br /&gt;
		if utilities.is_set (Date) then&lt;br /&gt;
			if EditorCount &amp;lt;= 1 then&lt;br /&gt;
				Editors = Editors .. cfg.presentation[&#039;sep_name&#039;] .. cfg.messages[&#039;editor&#039;];&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. cfg.presentation[&#039;sep_name&#039;] .. cfg.messages[&#039;editors&#039;];&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if EditorCount &amp;lt;= 1 then&lt;br /&gt;
				Editors = Editors .. &amp;quot; (&amp;quot; .. cfg.messages[&#039;editor&#039;] .. &amp;quot;)&amp;quot; .. sepc .. &amp;quot; &amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. &amp;quot; (&amp;quot; .. cfg.messages[&#039;editors&#039;] .. &amp;quot;)&amp;quot; .. sepc .. &amp;quot; &amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		text = safe_join( {Editors, Date, Chapter, Place, tcommon, pgtext, idcommon}, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		if utilities.in_array (config.CitationClass, {&amp;quot;journal&amp;quot;, &amp;quot;citation&amp;quot;}) and utilities.is_set (Periodical) then&lt;br /&gt;
			text = safe_join( {Chapter, Place, tcommon, pgtext, Date, idcommon}, sepc );&lt;br /&gt;
		else&lt;br /&gt;
			text = safe_join( {Chapter, Place, tcommon, Date, pgtext, idcommon}, sepc );&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (PostScript) and PostScript ~= sepc then&lt;br /&gt;
		text = safe_join( {text, sepc}, sepc ); 								-- Deals with italics, spaces, etc.&lt;br /&gt;
		if &#039;.&#039; == sepc then														-- remove final seperator if present&lt;br /&gt;
			text = text:gsub (&#039;%&#039; .. sepc .. &#039;$&#039;, &#039;&#039;);							-- dot must be escaped here&lt;br /&gt;
		else&lt;br /&gt;
			text = mw.ustring.gsub (text, sepc .. &#039;$&#039;, &#039;&#039;);						-- using ustring for non-dot sepc (likely a non-Latin character)&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
	&lt;br /&gt;
	text = safe_join( {text, PostScript}, sepc );&lt;br /&gt;
&lt;br /&gt;
	-- Now enclose the whole thing in a &amp;lt;cite&amp;gt; element&lt;br /&gt;
	local options_t = {};&lt;br /&gt;
	options_t.class = cite_class_attribute_make (config.CitationClass, Mode);&lt;br /&gt;
&lt;br /&gt;
	local Ref = is_valid_parameter_value (A[&#039;Ref&#039;], A:ORIGIN(&#039;Ref&#039;), cfg.keywords_lists[&#039;ref&#039;], nil, true);	-- nil when |ref=harv; A[&#039;Ref&#039;] else&lt;br /&gt;
&lt;br /&gt;
	if &#039;none&#039; ~= cfg.keywords_xlate[(Ref and Ref:lower()) or &#039;&#039;] then&lt;br /&gt;
		local namelist_t = {};													-- holds selected contributor, author, editor name list&lt;br /&gt;
		local year = first_set ({Year, anchor_year}, 2);						-- Year first for legacy citations and for YMD dates that require disambiguation&lt;br /&gt;
&lt;br /&gt;
		if #c &amp;gt; 0 then															-- if there is a contributor list&lt;br /&gt;
			namelist_t = c;														-- select it&lt;br /&gt;
		elseif #a &amp;gt; 0 then														-- or an author list&lt;br /&gt;
			namelist_t = a;&lt;br /&gt;
		elseif #e &amp;gt; 0 then														-- or an editor list&lt;br /&gt;
			namelist_t = e;&lt;br /&gt;
		end&lt;br /&gt;
		local citeref_id;&lt;br /&gt;
		if #namelist_t &amp;gt; 0 then													-- if there are names in namelist_t&lt;br /&gt;
			citeref_id = make_citeref_id (namelist_t, year);					-- go make the CITEREF anchor&lt;br /&gt;
			if mw.uri.anchorEncode (citeref_id) == ((Ref and mw.uri.anchorEncode (Ref)) or &#039;&#039;) then	-- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison&lt;br /&gt;
				utilities.set_message (&#039;maint_ref_duplicates_default&#039;);&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			citeref_id = &#039;&#039;;													-- unset&lt;br /&gt;
		end&lt;br /&gt;
		options_t.id = Ref or citeref_id;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if string.len (text:gsub(&#039;%b&amp;lt;&amp;gt;&#039;, &#039;&#039;)) &amp;lt;= 2 then								-- remove html and html-like tags; then get length of what remains; &lt;br /&gt;
		z.error_cats_t = {};													-- blank the categories list&lt;br /&gt;
		z.error_msgs_t = {};													-- blank the error messages list&lt;br /&gt;
		OCinSoutput = nil;														-- blank the metadata string&lt;br /&gt;
		text = &#039;&#039;;																-- blank the the citation&lt;br /&gt;
		utilities.set_message (&#039;err_empty_citation&#039;);							-- set empty citation message and category&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local render_t = {};														-- here we collect the final bits for concatenation into the rendered citation&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (options_t.id) then										-- here we wrap the rendered citation in &amp;lt;cite ...&amp;gt;...&amp;lt;/cite&amp;gt; tags&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;cite-id&#039;], {mw.uri.anchorEncode(options_t.id), mw.text.nowiki(options_t.class), text}));	-- when |ref= is set or when there is a namelist&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;cite&#039;], {mw.text.nowiki(options_t.class), text}));	-- when |ref=none or when namelist_t empty and |ref= is missing or is empty&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if OCinSoutput then															-- blanked when citation is &#039;empty&#039; so don&#039;t bother to add boilerplate metadata span&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;ocins&#039;], OCinSoutput));	-- format and append metadata to the citation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local template_name = (&#039;citation&#039; == config.CitationClass) and &#039;citation&#039; or &#039;cite &#039; .. (cfg.citation_class_map_t[config.CitationClass] or config.CitationClass);&lt;br /&gt;
	local template_link = &#039;[[Template:&#039; .. template_name .. &#039;|&#039; .. template_name .. &#039;]]&#039;;&lt;br /&gt;
	local msg_prefix = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;{{&#039; .. template_link .. &#039;}}&amp;lt;/code&amp;gt;: &#039;;&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #z.error_msgs_t then&lt;br /&gt;
		mw.addWarning (utilities.substitute (cfg.messages.warning_msg_e, template_link));&lt;br /&gt;
&lt;br /&gt;
		table.insert (render_t, &#039; &#039;);											-- insert a space between citation and its error messages&lt;br /&gt;
		table.sort (z.error_msgs_t);											-- sort the error messages list; sorting includes wrapping &amp;lt;span&amp;gt; and &amp;lt;code&amp;gt; tags; hidden-error sorts ahead of visible-error&lt;br /&gt;
&lt;br /&gt;
		local hidden = true;													-- presume that the only error messages emited by this template are hidden&lt;br /&gt;
		for _, v in ipairs (z.error_msgs_t) do									-- spin through the list of error messages&lt;br /&gt;
			if v:find (&#039;cs1-visible-error&#039;, 1, true) then						-- look for the visible error class name&lt;br /&gt;
				hidden = false;													-- found one; so don&#039;t hide the error message prefix&lt;br /&gt;
				break;															-- and done because no need to look further&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		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&lt;br /&gt;
		table.insert (render_t, table.concat (z.error_msgs_t, &#039;; &#039;));			-- make a big string of error messages and add it to the rendering&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #z.maint_cats_t then&lt;br /&gt;
		mw.addWarning (utilities.substitute (cfg.messages.warning_msg_m, template_link));&lt;br /&gt;
&lt;br /&gt;
		table.sort (z.maint_cats_t);											-- sort the maintenance messages list&lt;br /&gt;
&lt;br /&gt;
		local maint_msgs_t = {};												-- here we collect all of the maint messages&lt;br /&gt;
&lt;br /&gt;
		if 0 == #z.error_msgs_t then											-- if no error messages&lt;br /&gt;
			table.insert (maint_msgs_t, msg_prefix);							-- insert message prefix in maint message livery&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		for _, v in ipairs( z.maint_cats_t ) do									-- append maintenance categories&lt;br /&gt;
			table.insert (maint_msgs_t, 										-- assemble new maint message and add it to the maint_msgs_t table&lt;br /&gt;
				table.concat ({v, &#039; (&#039;, utilities.substitute (cfg.messages[&#039;:cat wikilink&#039;], v), &#039;)&#039;})&lt;br /&gt;
				);&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;hidden-maint&#039;], table.concat (maint_msgs_t, &#039; &#039;)));	-- wrap the group of maint messages with proper presentation and save&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not no_tracking_cats then&lt;br /&gt;
		local sort_key;&lt;br /&gt;
		local cat_wikilink = &#039;cat wikilink&#039;;&lt;br /&gt;
		if cfg.enable_sort_keys then											-- when namespace sort keys enabled&lt;br /&gt;
			local namespace_number = mw.title.getCurrentTitle().namespace;		-- get namespace number for this wikitext&lt;br /&gt;
			sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil;	-- get sort key character; nil for mainspace&lt;br /&gt;
			cat_wikilink = (not sort_key and &#039;cat wikilink&#039;) or &#039;cat wikilink sk&#039;;	-- make &amp;lt;cfg.messages&amp;gt; key&lt;br /&gt;
		end				&lt;br /&gt;
&lt;br /&gt;
		for _, v in ipairs (z.error_cats_t) do									-- append error categories&lt;br /&gt;
			table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));&lt;br /&gt;
		end&lt;br /&gt;
		if cfg.id_limits_data_load_fail then									-- boolean true when load failed&lt;br /&gt;
			utilities.set_message (&#039;maint_id_limit_load_fail&#039;);					-- done here because this maint cat emits no message&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in ipairs (z.maint_cats_t) do									-- append maintenance categories&lt;br /&gt;
			table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in ipairs (z.prop_cats_t) do									-- append properties categories&lt;br /&gt;
			table.insert (render_t, utilities.substitute (cfg.messages[&#039;cat wikilink&#039;], v));	-- no sort keys&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat (render_t);												-- make a big string and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; V A L I D A T E &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Looks for a parameter&#039;s name in one of several whitelists.&lt;br /&gt;
&lt;br /&gt;
Parameters in the whitelist can have three values:&lt;br /&gt;
	true - active, supported parameters&lt;br /&gt;
	false - deprecated, supported parameters&lt;br /&gt;
	nil - unsupported parameters&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function validate (name, cite_class, empty)&lt;br /&gt;
	local name = tostring (name);&lt;br /&gt;
	local enum_name;															-- parameter name with enumerator (if any) replaced with &#039;#&#039;&lt;br /&gt;
	local state;&lt;br /&gt;
	local function state_test (state, name)										-- local function to do testing of state values&lt;br /&gt;
		if true == state then return true; end									-- valid actively supported parameter&lt;br /&gt;
		if false == state then&lt;br /&gt;
			if empty then return nil; end										-- empty deprecated parameters are treated as unknowns&lt;br /&gt;
			deprecated_parameter (name);										-- parameter is deprecated but still supported&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
		if &#039;tracked&#039; == state then&lt;br /&gt;
			local base_name = name:gsub (&#039;%d&#039;, &#039;&#039;);								-- strip enumerators from parameter names that have them to get the base name&lt;br /&gt;
			utilities.add_prop_cat (&#039;tracked-param&#039;, {base_name}, base_name);	-- add a properties category; &amp;lt;base_name&amp;gt; modifies &amp;lt;key&amp;gt;&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
		return nil;&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if name:find (&#039;#&#039;) then														-- # is a cs1|2 reserved character so parameters with # not permitted&lt;br /&gt;
		return nil;&lt;br /&gt;
	end&lt;br /&gt;
																				-- replace enumerator digit(s) with # (|last25= becomes |last#=) (mw.ustring because non-Western &#039;local&#039; digits)&lt;br /&gt;
	enum_name = mw.ustring.gsub (name, &#039;%d+$&#039;, &#039;#&#039;);							-- where enumerator is last charaters in parameter name (these to protect |s2cid=)&lt;br /&gt;
	enum_name = mw.ustring.gsub (enum_name, &#039;%d+([%-l])&#039;, &#039;#%1&#039;);				-- where enumerator is in the middle of the parameter name; |author#link= is the oddity&lt;br /&gt;
&lt;br /&gt;
	if &#039;document&#039; == cite_class then											-- special case for {{cite document}}&lt;br /&gt;
		state = whitelist.document_parameters_t[enum_name];						-- this list holds enumerated and nonenumerated parameters&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
		&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cite_class, whitelist.preprint_template_list_t) then	-- limited parameter sets allowed for these templates&lt;br /&gt;
		state = whitelist.limited_parameters_t[enum_name];						-- this list holds enumerated and nonenumerated parameters&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
		state = whitelist.preprint_arguments_t[cite_class][name];				-- look in the parameter-list for the template identified by cite_class&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
		return false;															-- not supported because not found or name is set to nil&lt;br /&gt;
	end																			-- end limited parameter-set templates&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cite_class, whitelist.unique_param_template_list_t) then 	-- template-specific parameters for templates that accept parameters from the basic argument list&lt;br /&gt;
		state = whitelist.unique_arguments_t[cite_class][name];					-- look in the template-specific parameter-lists for the template identified by cite_class&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
	end																			-- if here, fall into general validation&lt;br /&gt;
&lt;br /&gt;
	state = whitelist.common_parameters_t[enum_name];							-- all other templates; all normal parameters allowed; this list holds enumerated and nonenumerated parameters&lt;br /&gt;
	if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
	return false;																-- not supported because not found or name is set to nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I N T E R _ W I K I _ C H E C K &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check &amp;lt;value&amp;gt; for inter-language interwiki-link markup.  &amp;lt;prefix&amp;gt; must be a MediaWiki-recognized language&lt;br /&gt;
code.  when these values have the form (without leading colon):&lt;br /&gt;
	[[&amp;lt;prefix&amp;gt;:link|label]] return label as plain-text&lt;br /&gt;
	[[&amp;lt;prefix&amp;gt;:link]] return &amp;lt;prefix&amp;gt;:link as plain-text&lt;br /&gt;
&lt;br /&gt;
return value as is else&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function inter_wiki_check (parameter, value)&lt;br /&gt;
	local prefix = value:match (&#039;%[%[(%a+):&#039;);									-- get an interwiki prefix if one exists&lt;br /&gt;
	local _;&lt;br /&gt;
	&lt;br /&gt;
	if prefix and cfg.inter_wiki_map[prefix:lower()] then						-- if prefix is in the map, needs preceding colon so&lt;br /&gt;
		utilities.set_message (&#039;err_bad_paramlink&#039;, parameter);					-- emit an error message&lt;br /&gt;
		_, value, _ = utilities.is_wikilink (value);							-- extract label portion from wikilink&lt;br /&gt;
	end&lt;br /&gt;
	return value;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M I S S I N G _ P I P E _ C H E C K &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Look at the contents of a parameter. If the content has a string of characters and digits followed by an equal&lt;br /&gt;
sign, compare the alphanumeric string to the list of cs1|2 parameters.  If found, then the string is possibly a&lt;br /&gt;
parameter that is missing its pipe.  There are two tests made:&lt;br /&gt;
	{{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&lt;br /&gt;
	{{cite ... |title=access-date=2016-03-17}}			-- the first parameter has no value (whitespace after the first = is trimmed by MediaWiki)&lt;br /&gt;
cs1|2 shares some parameter names with XML/HTML attributes: class=, title=, etc.  To prevent false positives XML/HTML&lt;br /&gt;
tags are removed before the search.&lt;br /&gt;
&lt;br /&gt;
If a missing pipe is detected, this function adds the missing pipe maintenance category.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function missing_pipe_check (parameter, value)&lt;br /&gt;
	local capture;&lt;br /&gt;
	value = value:gsub (&#039;%b&amp;lt;&amp;gt;&#039;, &#039;&#039;);											-- remove XML/HTML tags because attributes: class=, title=, etc.&lt;br /&gt;
&lt;br /&gt;
	capture = value:match (&#039;%s+(%a[%w%-]+)%s*=&#039;) or value:match (&#039;^(%a[%w%-]+)%s*=&#039;);	-- find and categorize parameters with possible missing pipes&lt;br /&gt;
	if capture and validate (capture) then										-- if the capture is a valid parameter name&lt;br /&gt;
		utilities.set_message (&#039;err_missing_pipe&#039;, parameter);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ E X T R A N E O U S _ P U N C T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for extraneous terminal punctuation in most parameter values; parameters listed in skip table are not checked&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_extraneous_punc (param, value)&lt;br /&gt;
	if &#039;number&#039; == type (param) then&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	param = param:gsub (&#039;%d+&#039;, &#039;#&#039;);											-- enumerated name-list mask params allow terminal punct; normalize &lt;br /&gt;
	if cfg.punct_skip[param] then&lt;br /&gt;
		return;																	-- parameter name found in the skip table so done&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if value:match (&#039;[,;:]$&#039;) then&lt;br /&gt;
		utilities.set_message (&#039;maint_extra_punct&#039;);							-- has extraneous punctuation; add maint cat&lt;br /&gt;
	end&lt;br /&gt;
	if value:match (&#039;^=&#039;) then													-- sometimes an extraneous &#039;=&#039; character appears ...&lt;br /&gt;
		utilities.set_message (&#039;maint_extra_punct&#039;);							-- has extraneous punctuation; add maint cat&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ T W L _ U R L &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for The Wikipedia Library urls in url-holding parameters.  TWL urls are accessible for readers who are not&lt;br /&gt;
active extended confirmed Wikipedia editors.  This function emits an error message when such urls are discovered.&lt;br /&gt;
&lt;br /&gt;
looks for: &#039;.wikipedialibrary.idm.oclc.org&#039;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_twl_url (url_params_t)&lt;br /&gt;
	local url_error_t = {};														-- sequence of url-holding parameters that have a TWL url&lt;br /&gt;
	&lt;br /&gt;
	for param, value in pairs (url_params_t) do&lt;br /&gt;
		if value:find (&#039;%.wikipedialibrary%.idm%.oclc%.org&#039;) then				-- has the TWL base url?&lt;br /&gt;
			table.insert (url_error_t, utilities.wrap_style (&#039;parameter&#039;, param));	-- add parameter name to the list&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if 0 ~= #url_error_t then													-- non-zero when there are errors&lt;br /&gt;
		table.sort (url_error_t);&lt;br /&gt;
		utilities.set_message (&#039;err_param_has_twl_url&#039;, {utilities.make_sep_list (#url_error_t, url_error_t)});	-- add this error message&lt;br /&gt;
		return true;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ E X T R A N E O U S _ U R L &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for extraneous url parameter values; parameters listed in skip table are not checked&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_extraneous_url (non_url_param_t)&lt;br /&gt;
	local url_error_t = {};&lt;br /&gt;
	&lt;br /&gt;
	check_for_url (non_url_param_t, url_error_t);								-- extraneous url check&lt;br /&gt;
	if 0 ~= #url_error_t then													-- non-zero when there are errors&lt;br /&gt;
		table.sort (url_error_t);&lt;br /&gt;
		utilities.set_message (&#039;err_param_has_ext_link&#039;, {utilities.make_sep_list (#url_error_t, url_error_t)});	-- add this error message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; _ C I T A T I O N &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Module entry point&lt;br /&gt;
&lt;br /&gt;
	frame – from template call (citation()); may be nil when called from another module&lt;br /&gt;
	args – table of all cs1|2 parameters in the template (the template frame)&lt;br /&gt;
	config – table of template-supplied parameter (the #invoke frame)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function _citation (frame, args, config)									-- save a copy in case we need to display an error message in preview mode&lt;br /&gt;
	if not frame then&lt;br /&gt;
		frame = mw.getCurrentFrame();											-- if called from another module, get a frame for frame-provided functions&lt;br /&gt;
	end&lt;br /&gt;
																				-- i18n: set the name that your wiki uses to identify sandbox subpages from sandbox template invoke (or can be set here)&lt;br /&gt;
	local sandbox = ((config.SandboxPath and &#039;&#039; ~= config.SandboxPath) and config.SandboxPath) or &#039;/sandbox&#039;;	-- sandbox path from {{#invoke:Citation/CS1/sandbox|citation|SandboxPath=/...}}&lt;br /&gt;
	is_sandbox = nil ~= string.find (frame:getTitle(), sandbox, 1, true);		-- is this invoke the sandbox module?&lt;br /&gt;
	sandbox = is_sandbox and sandbox or &#039;&#039;;										-- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else&lt;br /&gt;
&lt;br /&gt;
	cfg = mw.loadData (&#039;Module:Citation/CS1/Configuration&#039; .. sandbox);			-- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else&lt;br /&gt;
	whitelist = mw.loadData (&#039;Module:Citation/CS1/Whitelist&#039; .. sandbox);&lt;br /&gt;
	utilities = require (&#039;Module:Citation/CS1/Utilities&#039; .. sandbox);&lt;br /&gt;
	validation = require (&#039;Module:Citation/CS1/Date_validation&#039; .. sandbox);&lt;br /&gt;
	identifiers = require (&#039;Module:Citation/CS1/Identifiers&#039; .. sandbox);&lt;br /&gt;
	metadata = require (&#039;Module:Citation/CS1/COinS&#039; .. sandbox);&lt;br /&gt;
&lt;br /&gt;
	utilities.set_selected_modules (cfg);										-- so that functions in Utilities can see the selected cfg tables&lt;br /&gt;
	identifiers.set_selected_modules (cfg, utilities);							-- so that functions in Identifiers can see the selected cfg tables and selected Utilities module&lt;br /&gt;
	validation.set_selected_modules (cfg, utilities);							-- so that functions in Date validataion can see selected cfg tables and the selected Utilities module&lt;br /&gt;
	metadata.set_selected_modules (cfg, utilities);								-- so that functions in COinS can see the selected cfg tables and selected Utilities module&lt;br /&gt;
&lt;br /&gt;
	z = utilities.z;															-- table of error and category tables in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
	is_preview_mode = not utilities.is_set (frame:preprocess (&#039;{{REVISIONID}}&#039;));&lt;br /&gt;
&lt;br /&gt;
	local suggestions = {};														-- table where we store suggestions if we need to loadData them&lt;br /&gt;
	local error_text;															-- used as a flag&lt;br /&gt;
&lt;br /&gt;
	local capture;																-- the single supported capture when matching unknown parameters using patterns&lt;br /&gt;
	local empty_unknowns = {};													-- sequence table to hold empty unknown params for error message listing&lt;br /&gt;
	for k, v in pairs( args ) do												-- get parameters from the parent (template) frame&lt;br /&gt;
		v = mw.ustring.gsub (v, &#039;^%s*(.-)%s*$&#039;, &#039;%1&#039;);							-- trim leading/trailing whitespace; when v is only whitespace, becomes empty string&lt;br /&gt;
		if v ~= &#039;&#039; then&lt;br /&gt;
			if (&#039;string&#039; == type (k)) then&lt;br /&gt;
				k = mw.ustring.gsub (k, &#039;%d&#039;, cfg.date_names.local_digits);		-- for enumerated parameters, translate &#039;local&#039; digits to Western 0-9&lt;br /&gt;
			end&lt;br /&gt;
			if not validate( k, config.CitationClass ) then			&lt;br /&gt;
				if type (k) ~= &#039;string&#039; then									-- exclude empty numbered parameters&lt;br /&gt;
					if v:match(&amp;quot;%S+&amp;quot;) ~= nil then&lt;br /&gt;
						error_text = utilities.set_message (&#039;err_text_ignored&#039;, {v});&lt;br /&gt;
					end&lt;br /&gt;
				elseif validate (k:lower(), config.CitationClass) then &lt;br /&gt;
					error_text = utilities.set_message (&#039;err_parameter_ignored_suggest&#039;, {k, k:lower()});	-- suggest the lowercase version of the parameter&lt;br /&gt;
				else&lt;br /&gt;
					if nil == suggestions.suggestions then						-- if this table is nil then we need to load it&lt;br /&gt;
						suggestions = mw.loadData (&#039;Module:Citation/CS1/Suggestions&#039; .. sandbox);	--load sandbox version of suggestion module when {{#invoke:Citation/CS1/sandbox|...}}; live module else&lt;br /&gt;
					end&lt;br /&gt;
					for pattern, param in pairs (suggestions.patterns) do		-- loop through the patterns to see if we can suggest a proper parameter&lt;br /&gt;
						capture = k:match (pattern);							-- the whole match if no capture in pattern else the capture if a match&lt;br /&gt;
						if capture then											-- if the pattern matches &lt;br /&gt;
							param = utilities.substitute (param, capture);		-- add the capture to the suggested parameter (typically the enumerator)&lt;br /&gt;
							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)&lt;br /&gt;
								error_text = utilities.set_message (&#039;err_parameter_ignored_suggest&#039;, {k, param});	-- set the suggestion error message&lt;br /&gt;
							else&lt;br /&gt;
								error_text = utilities.set_message (&#039;err_parameter_ignored&#039;, {k});	-- suggested param not supported by this template&lt;br /&gt;
								v = &#039;&#039;;											-- unset&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					if not utilities.is_set (error_text) then					-- couldn&#039;t match with a pattern, is there an explicit suggestion?						&lt;br /&gt;
						if (suggestions.suggestions[ k:lower() ] ~= nil) and validate (suggestions.suggestions[ k:lower() ], config.CitationClass) then&lt;br /&gt;
							utilities.set_message (&#039;err_parameter_ignored_suggest&#039;, {k, suggestions.suggestions[ k:lower() ]});&lt;br /&gt;
						else&lt;br /&gt;
							utilities.set_message (&#039;err_parameter_ignored&#039;, {k});&lt;br /&gt;
							v = &#039;&#039;;												-- unset value assigned to unrecognized parameters (this for the limited parameter lists)&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end				  &lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			args[k] = v;														-- save this parameter and its value&lt;br /&gt;
&lt;br /&gt;
		elseif not utilities.is_set (v) then									-- for empty parameters&lt;br /&gt;
			if not validate (k, config.CitationClass, true) then				-- is this empty parameter a valid parameter&lt;br /&gt;
				k = (&#039;&#039; == k) and &#039;(empty string)&#039; or k;						-- when k is empty string (or was space(s) trimmed to empty string), replace with descriptive text&lt;br /&gt;
				table.insert (empty_unknowns, utilities.wrap_style (&#039;parameter&#039;, k));	-- format for error message and add to the list&lt;br /&gt;
			end&lt;br /&gt;
																				-- crude debug support that allows us to render a citation from module {{#invoke:}} TODO: keep?&lt;br /&gt;
	--	elseif args[k] ~= nil or (k == &#039;postscript&#039;) then						-- when args[k] has a value from {{#invoke}} frame (we don&#039;t normally do that)&lt;br /&gt;
	--		args[k] = v;														-- overwrite args[k] with empty string from pframe.args[k] (template frame); v is empty string here&lt;br /&gt;
		end																		-- not sure about the postscript bit; that gets handled in parameter validation; historical artifact?&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #empty_unknowns then												-- create empty unknown error message&lt;br /&gt;
		utilities.set_message (&#039;err_param_unknown_empty&#039;, {&lt;br /&gt;
			1 == #empty_unknowns and &#039;&#039; or &#039;s&#039;,&lt;br /&gt;
			utilities.make_sep_list (#empty_unknowns, empty_unknowns)&lt;br /&gt;
			});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local non_url_param_t = {};													-- table of parameters and values that are not url-holding parameters&lt;br /&gt;
	local url_param_t = {};														-- table of url-holding paramters and their values&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if &#039;string&#039; == type (k) then											-- don&#039;t evaluate positional parameters&lt;br /&gt;
			has_invisible_chars (k, v);											-- look for invisible characters&lt;br /&gt;
		end&lt;br /&gt;
		has_extraneous_punc (k, v);												-- look for extraneous terminal punctuation in parameter values&lt;br /&gt;
		missing_pipe_check (k, v);												-- do we think that there is a parameter that is missing a pipe?&lt;br /&gt;
		args[k] = inter_wiki_check (k, v);										-- when language interwiki-linked parameter missing leading colon replace with wiki-link label&lt;br /&gt;
&lt;br /&gt;
		if &#039;string&#039; == type (k) then											-- when parameter k is not positional&lt;br /&gt;
			if not cfg.url_skip[k] then											-- and not in url skip table&lt;br /&gt;
				non_url_param_t[k] = v;											-- make a parameter/value list for extraneous url check&lt;br /&gt;
			else																-- and is in url skip table (a url-holding parameter)&lt;br /&gt;
				url_param_t[k] = v;												-- make a parameter/value list to check for values that are The Wikipedia Library url&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	has_extraneous_url (non_url_param_t);										-- look for url in parameter values where a url does not belong&lt;br /&gt;
	if has_twl_url (url_param_t) then												-- look for url-holding parameters that hold a The Wikipedia Library url&lt;br /&gt;
		args[&#039;url-access&#039;] = &#039;subscription&#039;;&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat ({&lt;br /&gt;
		frame:extensionTag (&#039;templatestyles&#039;, &#039;&#039;, {src=&#039;Module:Citation/CS1&#039; .. sandbox .. &#039;/styles.css&#039;}),&lt;br /&gt;
		citation0( config, args)&lt;br /&gt;
	});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T A T I O N &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Template entry point&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citation (frame)&lt;br /&gt;
	local config_t = {};														-- table to store parameters from the module {{#invoke:}}&lt;br /&gt;
	local args_t = frame:getParent().args;										-- get template&#039;s preset parameters&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame.args) do											-- get parameters from the {{#invoke}} frame&lt;br /&gt;
		config_t[k] = v;&lt;br /&gt;
	--	args_t[k] = v;															-- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?&lt;br /&gt;
	end	&lt;br /&gt;
	return _citation (frame, args_t, config_t)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	citation = citation,														-- template entry point&lt;br /&gt;
	&lt;br /&gt;
	_citation = _citation,														-- module entry point&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Use&amp;diff=562</id>
		<title>Template:Use</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Use&amp;diff=562"/>
		<updated>2025-08-09T02:38:52Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot import: Dependency for &amp;#039;OODA_loop&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#switch: {{{1|}}}&lt;br /&gt;
|mdy = {{Use mdy dates |date={{{date|}}}}}&lt;br /&gt;
|dmy = {{Use dmy dates |date={{{date|}}}}}&lt;br /&gt;
}}{{#switch: {{{2|}}}&lt;br /&gt;
|au = {{Use Australian English |date={{{date|}}}}}&lt;br /&gt;
|gb = {{Use British English |date={{{date|}}}}}&lt;br /&gt;
|ca = {{Use Canadian English |date={{{date|}}}}}&lt;br /&gt;
|gh = {{Use Ghanian English |date={{{date|}}}}}&lt;br /&gt;
|hi = {{Use Hiberno-English |date={{{date|}}}}}&lt;br /&gt;
|ir = {{Use Hiberno-English |date={{{date|}}}}}&lt;br /&gt;
|hk = {{Use Hong Kong English |date={{{date|}}}}}&lt;br /&gt;
|in = {{Use Indian English |date={{{date|}}}}}&lt;br /&gt;
|jm = {{Use Jamaican English |date={{{date|}}}}}&lt;br /&gt;
|ke = {{Use Kenyan English |date={{{date|}}}}}&lt;br /&gt;
|lr = {{Use Liberian English |date={{{date|}}}}}&lt;br /&gt;
|nz = {{Use New Zealand English |date={{{date|}}}}}&lt;br /&gt;
|ng = {{Use Nigerian English |date={{{date|}}}}}&lt;br /&gt;
|pk = {{Use Pakistani English |date={{{date|}}}}}&lt;br /&gt;
|ph = {{Use Philippine English |date={{{date|}}}}}&lt;br /&gt;
|sg = {{Use Singapore English |date={{{date|}}}}}&lt;br /&gt;
|sa = {{Use South African English |date={{{date|}}}}}&lt;br /&gt;
|za = {{Use South African English |date={{{date|}}}}}&lt;br /&gt;
|lk = {{Use Sri Lankan English |date={{{date|}}}}}&lt;br /&gt;
|tz = {{Use Tanzanian English |date={{{date|}}}}}&lt;br /&gt;
|tt = {{Use Trinidad and Tobago English |date={{{date|}}}}}&lt;br /&gt;
|ug = {{Use Ugandan English |date={{{date|}}}}}&lt;br /&gt;
|us = {{Use American English |date={{{date|}}}}}}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Cite&amp;diff=561</id>
		<title>Template:Cite</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Cite&amp;diff=561"/>
		<updated>2025-08-09T02:38:42Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot import: Dependency for &amp;#039;OODA_loop&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Citation]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Short&amp;diff=560</id>
		<title>Template:Short</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Short&amp;diff=560"/>
		<updated>2025-08-09T02:38:32Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot import: Dependency for &amp;#039;OODA_loop&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Shortcut]]&lt;br /&gt;
&lt;br /&gt;
{{Redirect category shell|&lt;br /&gt;
{{R from template shortcut}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Div&amp;diff=559</id>
		<title>Template:Div</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Div&amp;diff=559"/>
		<updated>2025-08-09T02:38:22Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot import: Dependency for &amp;#039;OODA_loop&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Divbox]]&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Sfn&amp;diff=558</id>
		<title>Template:Sfn</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Sfn&amp;diff=558"/>
		<updated>2025-08-08T21:39:52Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot import: Dependency for &amp;#039;OODA_loop&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Footnotes|sfn|template=sfn}}&amp;lt;/includeonly&amp;gt;{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using sfn with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Sfn]] with unknown parameter &amp;quot;_VALUE_&amp;quot;|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | ignore-err | at | loc | p | page | pages | postscript | pp | ps | ref | Ref | group }}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
	<entry>
		<id>https://www.ooda.wiki/index.php?title=Template:Cite_journal&amp;diff=557</id>
		<title>Template:Cite journal</title>
		<link rel="alternate" type="text/html" href="https://www.ooda.wiki/index.php?title=Template:Cite_journal&amp;diff=557"/>
		<updated>2025-08-08T21:39:32Z</updated>

		<summary type="html">&lt;p&gt;Converti: Bot import: Dependency for &amp;#039;OODA_loop&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Citation/CS1|citation&lt;br /&gt;
|CitationClass=journal&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Converti</name></author>
	</entry>
</feed>