<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kidzsearch.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wikibase-admin</id>
	<title>KidzSearch Wiki - User's changes [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kidzsearch.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wikibase-admin"/>
	<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/wiki/Special:Contributions/Wikibase-admin"/>
	<updated>2026-06-13T22:13:34Z</updated>
	<subtitle>User's changes</subtitle>
	<generator>MediaWiki 1.35.8</generator>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304713</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304713"/>
		<updated>2023-05-24T06:22:56Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
/* Load an image header for every mobile page load. We can use siteNotice for this: */&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/w/siteImages/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;br /&gt;
&lt;br /&gt;
/* Other JS: */&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304712</id>
		<title>MediaWiki:Mobile.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304712"/>
		<updated>2023-05-24T06:20:41Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* CSS placed here will affect users of the mobile site */&lt;br /&gt;
&lt;br /&gt;
a.new, a.new:visited, a.new:hover {&lt;br /&gt;
    color: #000000!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.new {color: #000000!important;}&lt;br /&gt;
&lt;br /&gt;
mw-mf-main-menu-button {display:none;}&lt;br /&gt;
#page-actions {display: none;}&lt;br /&gt;
&lt;br /&gt;
/* commented out this line because it was causing the search icon to not be visible */&lt;br /&gt;
/* .header div:first-child { display: none; } */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
​.citation-comment {display: none;} /* hide all Citation Style 1 error messages */ &lt;br /&gt;
&lt;br /&gt;
#ca-nstab-main { display: none !important; }	&lt;br /&gt;
#ca-nstab-user { display: none !important; }	&lt;br /&gt;
#ca-talk { display: none !important; }	&lt;br /&gt;
#ca-view { display: none !important; }	&lt;br /&gt;
#ca-formedit { display: none !important; }	&lt;br /&gt;
#ca-watch { display: none !important; }	&lt;br /&gt;
#ca-unwatch { display: none !important; }	&lt;br /&gt;
#ca-move { display: none !important; }	&lt;br /&gt;
#ca-protect { display: none !important; }	&lt;br /&gt;
#ca-viewsource { display: none !important; } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.boilerplate.metadata.plainlinks&lt;br /&gt;
{&lt;br /&gt;
  display:none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
.mw-hidden-cats-ns-shown &lt;br /&gt;
{&lt;br /&gt;
display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.error&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#p-donation&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-templatestyles-doc&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body a.extiw, .mw-body a.extiw:active {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
wikit.new {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304706</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304706"/>
		<updated>2023-05-22T08:50:11Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/w/siteImages/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304705</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304705"/>
		<updated>2023-05-22T08:49:43Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img width=&amp;quot;80%&amp;quot; src=&amp;quot;/w/siteImages/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304704</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304704"/>
		<updated>2023-05-22T08:49:15Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img width=&amp;quot;80%&amp;quot; src=&amp;quot;w/siteImages/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304703</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304703"/>
		<updated>2023-05-22T08:48:22Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img width=&amp;quot;80%&amp;quot; src=&amp;quot;/siteImages/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304702</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304702"/>
		<updated>2023-05-22T08:47:22Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img width=&amp;quot;80%&amp;quot; src=&amp;quot;siteImages/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304701</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304701"/>
		<updated>2023-05-22T08:46:17Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img width=&amp;quot;100%&amp;quot; src=&amp;quot;https://wiki.kidzsearch.com/w/resources/assets/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304700</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304700"/>
		<updated>2023-05-22T08:45:25Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;div style=&amp;quot;padding: 10px;&amp;quot;&amp;gt;&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://wiki.kidzsearch.com/w/resources/assets/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304699</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304699"/>
		<updated>2023-05-22T08:44:20Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;a href=&amp;quot;https://www.kidzsearch.com&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://wiki.kidzsearch.com/w/resources/assets/mwiki.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304698</id>
		<title>MediaWiki:Mobile.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304698"/>
		<updated>2023-05-22T08:42:38Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* CSS placed here will affect users of the mobile site */&lt;br /&gt;
&lt;br /&gt;
a.new, a.new:visited, a.new:hover {&lt;br /&gt;
    color: #000000!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.new {color: #000000!important;}&lt;br /&gt;
&lt;br /&gt;
mw-mf-main-menu-button {display:none;}&lt;br /&gt;
#page-actions {display: none;}&lt;br /&gt;
&lt;br /&gt;
/* commented out this line because it was causing the search icon to not be visible */&lt;br /&gt;
/* .header div:first-child { display: none; } */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
​.citation-comment {display: none;} /* hide all Citation Style 1 error messages */ &lt;br /&gt;
&lt;br /&gt;
#ca-nstab-main { display: none !important; }	&lt;br /&gt;
#ca-nstab-user { display: none !important; }	&lt;br /&gt;
#ca-talk { display: none !important; }	&lt;br /&gt;
#ca-view { display: none !important; }	&lt;br /&gt;
#ca-formedit { display: none !important; }	&lt;br /&gt;
#ca-watch { display: none !important; }	&lt;br /&gt;
#ca-unwatch { display: none !important; }	&lt;br /&gt;
#ca-move { display: none !important; }	&lt;br /&gt;
#ca-protect { display: none !important; }	&lt;br /&gt;
#ca-viewsource { display: none !important; } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.boilerplate.metadata.plainlinks&lt;br /&gt;
{&lt;br /&gt;
  display:none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
.mw-hidden-cats-ns-shown &lt;br /&gt;
{&lt;br /&gt;
display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.error&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.mw-templatestyles-doc&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body a.extiw, .mw-body a.extiw:active {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
wikit.new {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304697</id>
		<title>MediaWiki:Mobile.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.js&amp;diff=5304697"/>
		<updated>2023-05-22T08:42:14Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Any JavaScript here will be loaded for users using the mobile site */&lt;br /&gt;
mw.loader.using('mobile.site.styles');&lt;br /&gt;
&lt;br /&gt;
document.getElementById('siteNotice').innerHTML = '&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;html data&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;';&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304696</id>
		<title>MediaWiki:Mobile.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304696"/>
		<updated>2023-05-22T08:40:45Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* CSS placed here will affect users of the mobile site */&lt;br /&gt;
&lt;br /&gt;
a.new, a.new:visited, a.new:hover {&lt;br /&gt;
    color: #000000!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#siteNotice {&lt;br /&gt;
	background-image: url('siteImages/wiki.png');&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.new {color: #000000!important;}&lt;br /&gt;
&lt;br /&gt;
mw-mf-main-menu-button {display:none;}&lt;br /&gt;
#page-actions {display: none;}&lt;br /&gt;
&lt;br /&gt;
/* commented out this line because it was causing the search icon to not be visible */&lt;br /&gt;
/* .header div:first-child { display: none; } */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
​.citation-comment {display: none;} /* hide all Citation Style 1 error messages */ &lt;br /&gt;
&lt;br /&gt;
#ca-nstab-main { display: none !important; }	&lt;br /&gt;
#ca-nstab-user { display: none !important; }	&lt;br /&gt;
#ca-talk { display: none !important; }	&lt;br /&gt;
#ca-view { display: none !important; }	&lt;br /&gt;
#ca-formedit { display: none !important; }	&lt;br /&gt;
#ca-watch { display: none !important; }	&lt;br /&gt;
#ca-unwatch { display: none !important; }	&lt;br /&gt;
#ca-move { display: none !important; }	&lt;br /&gt;
#ca-protect { display: none !important; }	&lt;br /&gt;
#ca-viewsource { display: none !important; } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.boilerplate.metadata.plainlinks&lt;br /&gt;
{&lt;br /&gt;
  display:none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
.mw-hidden-cats-ns-shown &lt;br /&gt;
{&lt;br /&gt;
display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.error&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.mw-templatestyles-doc&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body a.extiw, .mw-body a.extiw:active {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
wikit.new {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304695</id>
		<title>MediaWiki:Mobile.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304695"/>
		<updated>2023-05-22T07:14:43Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* CSS placed here will affect users of the mobile site */&lt;br /&gt;
&lt;br /&gt;
a.new, a.new:visited, a.new:hover {&lt;br /&gt;
    color: #000000!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.new {color: #000000!important;}&lt;br /&gt;
&lt;br /&gt;
mw-mf-main-menu-button {display:none;}&lt;br /&gt;
#page-actions {display: none;}&lt;br /&gt;
&lt;br /&gt;
/* commented out this line because it was causing the search icon to not be visible */&lt;br /&gt;
/* .header div:first-child { display: none; } */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
​.citation-comment {display: none;} /* hide all Citation Style 1 error messages */ &lt;br /&gt;
&lt;br /&gt;
#ca-nstab-main { display: none !important; }	&lt;br /&gt;
#ca-nstab-user { display: none !important; }	&lt;br /&gt;
#ca-talk { display: none !important; }	&lt;br /&gt;
#ca-view { display: none !important; }	&lt;br /&gt;
#ca-formedit { display: none !important; }	&lt;br /&gt;
#ca-watch { display: none !important; }	&lt;br /&gt;
#ca-unwatch { display: none !important; }	&lt;br /&gt;
#ca-move { display: none !important; }	&lt;br /&gt;
#ca-protect { display: none !important; }	&lt;br /&gt;
#ca-viewsource { display: none !important; } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.boilerplate.metadata.plainlinks&lt;br /&gt;
{&lt;br /&gt;
  display:none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
.mw-hidden-cats-ns-shown &lt;br /&gt;
{&lt;br /&gt;
display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.error&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.mw-templatestyles-doc&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body a.extiw, .mw-body a.extiw:active {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
wikit.new {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304694</id>
		<title>MediaWiki:Mobile.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Mobile.css&amp;diff=5304694"/>
		<updated>2023-05-22T06:56:41Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* CSS placed here will affect users of the mobile site */&lt;br /&gt;
&lt;br /&gt;
a.new, a.new:visited, a.new:hover {&lt;br /&gt;
    color: #000000!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.new {color: #000000!important;}&lt;br /&gt;
&lt;br /&gt;
mw-mf-main-menu-button {display:none;}&lt;br /&gt;
/* .header div:first-child { display: none; } */&lt;br /&gt;
#page-actions {display: none;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
​.citation-comment {display: none;} /* hide all Citation Style 1 error messages */ &lt;br /&gt;
&lt;br /&gt;
#ca-nstab-main { display: none !important; }	&lt;br /&gt;
#ca-nstab-user { display: none !important; }	&lt;br /&gt;
#ca-talk { display: none !important; }	&lt;br /&gt;
#ca-view { display: none !important; }	&lt;br /&gt;
#ca-formedit { display: none !important; }	&lt;br /&gt;
#ca-watch { display: none !important; }	&lt;br /&gt;
#ca-unwatch { display: none !important; }	&lt;br /&gt;
#ca-move { display: none !important; }	&lt;br /&gt;
#ca-protect { display: none !important; }	&lt;br /&gt;
#ca-viewsource { display: none !important; } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.boilerplate.metadata.plainlinks&lt;br /&gt;
{&lt;br /&gt;
  display:none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
.mw-hidden-cats-ns-shown &lt;br /&gt;
{&lt;br /&gt;
display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.error&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.mw-templatestyles-doc&lt;br /&gt;
{&lt;br /&gt;
  display: none!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body a.extiw, .mw-body a.extiw:active {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
wikit.new {&lt;br /&gt;
    color: #000!important;&lt;br /&gt;
            pointer-events: none!important; &lt;br /&gt;
            cursor: default!important; &lt;br /&gt;
            text-decoration: none!important; &lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Common.css&amp;diff=5304693</id>
		<title>MediaWiki:Common.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Common.css&amp;diff=5304693"/>
		<updated>2023-05-22T06:56:26Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Reset italic styling set by user agent */&lt;br /&gt;
cite,&lt;br /&gt;
dfn {&lt;br /&gt;
	font-style: inherit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Straight quote marks for &amp;lt;q&amp;gt; */&lt;br /&gt;
q {&lt;br /&gt;
	quotes: '&amp;quot;' '&amp;quot;' &amp;quot;'&amp;quot; &amp;quot;'&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Avoid collision of blockquote with floating elements by swapping margin and padding */&lt;br /&gt;
blockquote {&lt;br /&gt;
	overflow: hidden;&lt;br /&gt;
	margin: 1em 0;&lt;br /&gt;
	padding: 0 40px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Consistent size for &amp;lt;small&amp;gt;, &amp;lt;sub&amp;gt; and &amp;lt;sup&amp;gt; */&lt;br /&gt;
small {&lt;br /&gt;
	font-size: 85%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body-content sub,&lt;br /&gt;
.mw-body-content sup {&lt;br /&gt;
	font-size: 80%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Same spacing for indented and unindented paragraphs on talk pages */&lt;br /&gt;
.ns-talk .mw-body-content dd {&lt;br /&gt;
	margin-top: 0.4em;&lt;br /&gt;
	margin-bottom: 0.4em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Main page fixes */&lt;br /&gt;
#interwiki-completelist {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Reduce page jumps by hiding collapsed/dismissed content */&lt;br /&gt;
.client-js .mw-special-Watchlist #watchlist-message,&lt;br /&gt;
.client-js .collapsible:not( .mw-made-collapsible).collapsed &amp;gt; tbody &amp;gt; tr:not(:first-child),&lt;br /&gt;
&lt;br /&gt;
/* Hide charinsert base for those not using the gadget */&lt;br /&gt;
#editpage-specialchars {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Adds padding above Watchlist announcements where new recentchanges/watchlist filters are enabled */&lt;br /&gt;
.mw-rcfilters-enabled .mw-specialpage-summary {&lt;br /&gt;
	margin-top: 1em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Highlight linked elements (such as clicked references) in blue */&lt;br /&gt;
.citation:target {&lt;br /&gt;
	background-color: rgba(0, 127, 255, 0.133);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Styling for citations. Breaks long urls, etc., rather than overflowing box */&lt;br /&gt;
.citation {&lt;br /&gt;
	word-wrap: break-word;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Make the list of references smaller&lt;br /&gt;
 * Keep in sync with Template:Refbegin/styles.css&lt;br /&gt;
 * And Template:Reflist/styles.css&lt;br /&gt;
 */&lt;br /&gt;
ol.references {&lt;br /&gt;
	font-size: 90%;&lt;br /&gt;
	margin-bottom: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Style for horizontal lists (separator following item).&lt;br /&gt;
   @source mediawiki.org/wiki/Snippets/Horizontal_lists&lt;br /&gt;
   @revision 8 (2016-05-21)&lt;br /&gt;
   @author [[User:Edokter]]&lt;br /&gt;
 */&lt;br /&gt;
.hlist dl,&lt;br /&gt;
.hlist ol,&lt;br /&gt;
.hlist ul {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Display list items inline */&lt;br /&gt;
.hlist dd,&lt;br /&gt;
.hlist dt,&lt;br /&gt;
.hlist li {&lt;br /&gt;
	margin: 0; /* don't trust the note that says margin doesn't work with inline&lt;br /&gt;
				* removing margin: 0 makes dds have margins again */&lt;br /&gt;
	display: inline;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Display nested lists inline */&lt;br /&gt;
.hlist.inline,&lt;br /&gt;
.hlist.inline dl,&lt;br /&gt;
.hlist.inline ol,&lt;br /&gt;
.hlist.inline ul,&lt;br /&gt;
.hlist dl dl,&lt;br /&gt;
.hlist dl ol,&lt;br /&gt;
.hlist dl ul,&lt;br /&gt;
.hlist ol dl,&lt;br /&gt;
.hlist ol ol,&lt;br /&gt;
.hlist ol ul,&lt;br /&gt;
.hlist ul dl,&lt;br /&gt;
.hlist ul ol,&lt;br /&gt;
.hlist ul ul {&lt;br /&gt;
	display: inline;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide empty list items */&lt;br /&gt;
.hlist .mw-empty-li {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Generate interpuncts */&lt;br /&gt;
.hlist dt:after {&lt;br /&gt;
	content: &amp;quot;: &amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Note hlist style usage differs in Minerva and is defined in core as well!&lt;br /&gt;
 * Please check Minerva desktop (and Minerva.css) when changing&lt;br /&gt;
 * See https://phabricator.wikimedia.org/T213239&lt;br /&gt;
 */&lt;br /&gt;
.hlist dd:after,&lt;br /&gt;
.hlist li:after {&lt;br /&gt;
	content: &amp;quot; · &amp;quot;;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist dd:last-child:after,&lt;br /&gt;
.hlist dt:last-child:after,&lt;br /&gt;
.hlist li:last-child:after {&lt;br /&gt;
	content: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Add parentheses around nested lists */&lt;br /&gt;
.hlist dd dd:first-child:before,&lt;br /&gt;
.hlist dd dt:first-child:before,&lt;br /&gt;
.hlist dd li:first-child:before,&lt;br /&gt;
.hlist dt dd:first-child:before,&lt;br /&gt;
.hlist dt dt:first-child:before,&lt;br /&gt;
.hlist dt li:first-child:before,&lt;br /&gt;
.hlist li dd:first-child:before,&lt;br /&gt;
.hlist li dt:first-child:before,&lt;br /&gt;
.hlist li li:first-child:before {&lt;br /&gt;
	content: &amp;quot; (&amp;quot;;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist dd dd:last-child:after,&lt;br /&gt;
.hlist dd dt:last-child:after,&lt;br /&gt;
.hlist dd li:last-child:after,&lt;br /&gt;
.hlist dt dd:last-child:after,&lt;br /&gt;
.hlist dt dt:last-child:after,&lt;br /&gt;
.hlist dt li:last-child:after,&lt;br /&gt;
.hlist li dd:last-child:after,&lt;br /&gt;
.hlist li dt:last-child:after,&lt;br /&gt;
.hlist li li:last-child:after {&lt;br /&gt;
	content: &amp;quot;)&amp;quot;;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Put ordinals in front of ordered list items */&lt;br /&gt;
.hlist ol {&lt;br /&gt;
	counter-reset: listitem;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist ol &amp;gt; li {&lt;br /&gt;
	counter-increment: listitem;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist ol &amp;gt; li:before {&lt;br /&gt;
	content: &amp;quot; &amp;quot; counter(listitem) &amp;quot;\a0&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist dd ol &amp;gt; li:first-child:before,&lt;br /&gt;
.hlist dt ol &amp;gt; li:first-child:before,&lt;br /&gt;
.hlist li ol &amp;gt; li:first-child:before {&lt;br /&gt;
	content: &amp;quot; (&amp;quot; counter(listitem) &amp;quot;\a0&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Unbulleted lists */&lt;br /&gt;
.plainlist ol,&lt;br /&gt;
.plainlist ul {&lt;br /&gt;
	line-height: inherit;&lt;br /&gt;
	list-style: none none;&lt;br /&gt;
	margin: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.plainlist ol li,&lt;br /&gt;
.plainlist ul li {&lt;br /&gt;
	margin-bottom: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Default style for navigation boxes */&lt;br /&gt;
.navbox {                     /* Navbox container style */&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	clear: both;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	padding: 1px;&lt;br /&gt;
	margin: 1em auto 0;       /* Prevent preceding content from clinging to navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox .navbox {&lt;br /&gt;
	margin-top: 0;            /* No top margin for nested navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox + .navbox {&lt;br /&gt;
	margin-top: -1px;         /* Single pixel border between adjacent navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-inner,&lt;br /&gt;
.navbox-subgroup {&lt;br /&gt;
	width: 100%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-group,&lt;br /&gt;
.navbox-title,&lt;br /&gt;
.navbox-abovebelow {&lt;br /&gt;
	padding: 0.25em 1em;      /* Title, group and above/below styles */&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
th.navbox-group {             /* Group style */&lt;br /&gt;
	white-space: nowrap;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: right;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox,&lt;br /&gt;
.navbox-subgroup {&lt;br /&gt;
	background-color: #fdfdfd; /* Background color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-list {&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	border-color: #fdfdfd;    /* Must match background color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* cell spacing for navbox cells */&lt;br /&gt;
tr + tr &amp;gt; .navbox-abovebelow,&lt;br /&gt;
tr + tr &amp;gt; .navbox-group,&lt;br /&gt;
tr + tr &amp;gt; .navbox-image,&lt;br /&gt;
tr + tr &amp;gt; .navbox-list {    /* Borders above 2nd, 3rd, etc. rows */&lt;br /&gt;
	border-top: 2px solid #fdfdfd; /* Must match background color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox th,&lt;br /&gt;
.navbox-title {&lt;br /&gt;
	background-color: #ccccff;      /* Level 1 color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-abovebelow,&lt;br /&gt;
th.navbox-group,&lt;br /&gt;
.navbox-subgroup .navbox-title {&lt;br /&gt;
	background-color: #ddddff;      /* Level 2 color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-subgroup .navbox-group,&lt;br /&gt;
.navbox-subgroup .navbox-abovebelow {&lt;br /&gt;
	background-color: #e6e6ff;      /* Level 3 color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-even {&lt;br /&gt;
	background-color: #f7f7f7;      /* Even row striping */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-odd {&lt;br /&gt;
	background-color: transparent;  /* Odd row striping */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox .hlist td dl,&lt;br /&gt;
.navbox .hlist td ol,&lt;br /&gt;
.navbox .hlist td ul,&lt;br /&gt;
.navbox td.hlist dl,&lt;br /&gt;
.navbox td.hlist ol,&lt;br /&gt;
.navbox td.hlist ul {&lt;br /&gt;
	padding: 0.125em 0;       /* Adjust hlist padding in navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Styling for JQuery makeCollapsible, matching that of collapseButton */&lt;br /&gt;
.mw-parser-output .mw-collapsible-toggle {&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: right;&lt;br /&gt;
	padding-right: 0.2em;&lt;br /&gt;
	padding-left: 0.2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: left;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Infobox template style */&lt;br /&gt;
.infobox {&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	border-spacing: 3px;&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
	color: black;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 0.5em 0 0.5em 1em;&lt;br /&gt;
	padding: 0.2em;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	clear: right;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	width: 22em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox-subbox in a week or so as TemplateStyles version rolls out */&lt;br /&gt;
/* not strictly certain these styles are necessary&lt;br /&gt;
 * just replicating the module faithfully&lt;br /&gt;
 */&lt;br /&gt;
.infobox-subbox {&lt;br /&gt;
	padding: 0;&lt;br /&gt;
	border: none;&lt;br /&gt;
	margin: -3px;&lt;br /&gt;
	width: auto;&lt;br /&gt;
	min-width: 100%;&lt;br /&gt;
	font-size: 100%;&lt;br /&gt;
	clear: none;&lt;br /&gt;
	float: none;&lt;br /&gt;
	background-color: transparent;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.infobox-header,&lt;br /&gt;
.infobox-label,&lt;br /&gt;
.infobox-above,&lt;br /&gt;
.infobox-full-data,&lt;br /&gt;
.infobox-data,&lt;br /&gt;
.infobox-below,&lt;br /&gt;
.infobox-subheader,&lt;br /&gt;
.infobox-image,&lt;br /&gt;
.infobox-navbar,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox th,&lt;br /&gt;
.infobox td {&lt;br /&gt;
	vertical-align: top;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.infobox-label,&lt;br /&gt;
.infobox-data,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox th,&lt;br /&gt;
.infobox td {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox when element selectors above are removed */&lt;br /&gt;
.infobox .infobox-above,&lt;br /&gt;
.infobox .infobox-title,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox caption {&lt;br /&gt;
	font-size: 125%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.infobox-title,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox caption {&lt;br /&gt;
	padding: 0.2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox when element selectors above are removed */&lt;br /&gt;
.infobox .infobox-header,&lt;br /&gt;
.infobox .infobox-subheader,&lt;br /&gt;
.infobox .infobox-image,&lt;br /&gt;
.infobox .infobox-full-data,&lt;br /&gt;
.infobox .infobox-below {&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox when element selectors above are removed */&lt;br /&gt;
.infobox .infobox-navbar {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: right;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Normal font styling for wikitable row headers with scope=&amp;quot;row&amp;quot; tag */&lt;br /&gt;
.wikitable.plainrowheaders th[scope=row] {&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Lists in wikitable data cells are always left-aligned */&lt;br /&gt;
.wikitable td ul,&lt;br /&gt;
.wikitable td ol,&lt;br /&gt;
.wikitable td dl {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* ...unless they also use the hlist class */&lt;br /&gt;
.toc.hlist ul,&lt;br /&gt;
#toc.hlist ul {&lt;br /&gt;
	text-align: inherit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Fix for hieroglyphs specificity issue in infoboxes ([[phab:T43869]]) */&lt;br /&gt;
table.mw-hiero-table td {&lt;br /&gt;
	vertical-align: middle;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Change the external link icon to an Adobe icon for all PDF files */&lt;br /&gt;
.mw-parser-output a[href$=&amp;quot;.pdf&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.pdf?&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.pdf#&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href$=&amp;quot;.PDF&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.PDF?&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.PDF#&amp;quot;].external {&lt;br /&gt;
	background: url(&amp;quot;//upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif&amp;quot;) no-repeat right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding-right: 18px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Messagebox templates */&lt;br /&gt;
.messagebox {&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
	width: 80%;&lt;br /&gt;
	margin: 0 auto 1em auto;&lt;br /&gt;
	padding: .2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.merge {&lt;br /&gt;
	border: 1px solid #c0b8cc;&lt;br /&gt;
	background-color: #f0e5ff;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.cleanup {&lt;br /&gt;
	border: 1px solid #9f9fff;&lt;br /&gt;
	background-color: #efefff;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.standard-talk {&lt;br /&gt;
	border: 1px solid #c0c090;&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
	margin: 4px auto;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* For old WikiProject banners inside banner shells. */&lt;br /&gt;
.mbox-inside .standard-talk {&lt;br /&gt;
	border: 1px solid #c0c090;&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 2px 0;&lt;br /&gt;
	padding: 2px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.small {&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	font-size: 85%;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	clear: both;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 0 0 1em 1em;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.small-talk {&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	font-size: 85%;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	clear: both;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 0 0 1em 1em;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Cell sizes for ambox/tmbox/imbox/cmbox/ombox/fmbox/dmbox message boxes */&lt;br /&gt;
th.mbox-text, td.mbox-text {   /* The message body cell(s) */&lt;br /&gt;
	border: none;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 0.25em 0.9em;     /* 0.9em left/right */&lt;br /&gt;
	width: 100%;               /* Make all mboxes the same width regardless of text length */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.mbox-image {                /* The left image cell */&lt;br /&gt;
	border: none;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0 2px 0.9em;  /* 0.9em left, 0px right */&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.mbox-imageright {           /* The right image cell */&lt;br /&gt;
	border: none;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0.9em 2px 0;  /* 0px left, 0.9em right */&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.mbox-empty-cell {           /* An empty narrow cell */&lt;br /&gt;
	border: none;&lt;br /&gt;
	padding: 0;&lt;br /&gt;
	width: 1px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Article message box styles */&lt;br /&gt;
table.ambox {&lt;br /&gt;
	margin: 0 10%;                  /* 10% = Will not overlap with other elements */&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #36c;  /* Default &amp;quot;notice&amp;quot; blue */&lt;br /&gt;
	background-color: #fbfbfb;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox + table.ambox {      /* Single border between stacked boxes. */&lt;br /&gt;
	margin-top: -1px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ambox th.mbox-text,&lt;br /&gt;
.ambox td.mbox-text {            /* The message body cell(s) */&lt;br /&gt;
	padding: 0.25em 0.5em;       /* 0.5em left/right */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ambox td.mbox-image {           /* The left image cell */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0 2px 0.5em;    /* 0.5em left, 0px right */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ambox td.mbox-imageright {      /* The right image cell */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0.5em 2px 0;    /* 0px left, 0.5em right */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-notice {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #36c;       /* Blue */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-speedy {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;          /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-delete {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-content {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-style {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-move {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-protection {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #a2a9b1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Image message box styles */&lt;br /&gt;
table.imbox {&lt;br /&gt;
	margin: 4px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 3px solid #36c;    /* Default &amp;quot;notice&amp;quot; blue */&lt;br /&gt;
	background-color: #fbfbfb;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.imbox .mbox-text .imbox {  /* For imboxes inside imbox-text cells. */&lt;br /&gt;
	margin: 0 -0.5em;       /* 0.9 - 0.5 = 0.4em left/right.        */&lt;br /&gt;
	display: block;         /* Fix for webkit to force 100% width.  */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mbox-inside .imbox {       /* For imboxes inside other templates.  */&lt;br /&gt;
	margin: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-notice {&lt;br /&gt;
	border: 3px solid #36c;       /* Blue */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-speedy {&lt;br /&gt;
	border: 3px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-delete {&lt;br /&gt;
	border: 3px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-content {&lt;br /&gt;
	border: 3px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-style {&lt;br /&gt;
	border: 3px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-move {&lt;br /&gt;
	border: 3px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-protection {&lt;br /&gt;
	border: 3px solid #a2a9b1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-license {&lt;br /&gt;
	border: 3px solid #88a;       /* Dark gray */&lt;br /&gt;
	background-color: #f7f8ff;    /* Light gray */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-featured {&lt;br /&gt;
	border: 3px solid #cba135;    /* Brown-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Category message box styles */&lt;br /&gt;
table.cmbox {&lt;br /&gt;
	margin: 3px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	background-color: #dfe8ff;    /* Default &amp;quot;notice&amp;quot; blue */&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-notice {&lt;br /&gt;
	background-color: #d8e8ff;    /* Blue */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-speedy {&lt;br /&gt;
	margin-top: 4px;&lt;br /&gt;
	margin-bottom: 4px;&lt;br /&gt;
	border: 4px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #ffdbdb;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-delete {&lt;br /&gt;
	background-color: #ffdbdb;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-content {&lt;br /&gt;
	background-color: #ffe7ce;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-style {&lt;br /&gt;
	background-color: #fff9db;    /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-move {&lt;br /&gt;
	background-color: #e4d8ff;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-protection {&lt;br /&gt;
	background-color: #efefe1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Other pages message box styles */&lt;br /&gt;
table.ombox {&lt;br /&gt;
	margin: 4px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 1px solid #a2a9b1;    /* Default &amp;quot;notice&amp;quot; gray */&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-notice {&lt;br /&gt;
	border: 1px solid #a2a9b1;    /* Gray */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-speedy {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-delete {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-content {&lt;br /&gt;
	border: 1px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-style {&lt;br /&gt;
	border: 1px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-move {&lt;br /&gt;
	border: 1px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-protection {&lt;br /&gt;
	border: 2px solid #a2a9b1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Talk page message box styles */&lt;br /&gt;
table.tmbox {&lt;br /&gt;
	margin: 4px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 1px solid #c0c090;    /* Default &amp;quot;notice&amp;quot; gray-brown */&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
	min-width: 80%;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.tmbox.mbox-small {&lt;br /&gt;
	min-width: 0;                /* reset the min-width of tmbox above        */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mediawiki .mbox-inside .tmbox { /* For tmboxes inside other templates. The &amp;quot;mediawiki&amp;quot; class ensures that */&lt;br /&gt;
	margin: 2px 0;               /* this declaration overrides other styles (including mbox-small above)   */&lt;br /&gt;
	width: 100%;                 /* For Safari and Opera */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mbox-inside .tmbox.mbox-small { /* &amp;quot;small&amp;quot; tmboxes should not be small when  */&lt;br /&gt;
	line-height: 1.5em;          /* also &amp;quot;nested&amp;quot;, so reset styles that are   */&lt;br /&gt;
	font-size: 100%;             /* set in &amp;quot;mbox-small&amp;quot; above.                */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-speedy {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-delete {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-content {&lt;br /&gt;
	border: 2px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-style {&lt;br /&gt;
	border: 2px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-move {&lt;br /&gt;
	border: 2px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-protection,&lt;br /&gt;
table.tmbox-notice {&lt;br /&gt;
	border: 1px solid #c0c090;    /* Gray-brown */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Footer and header message box styles */&lt;br /&gt;
table.fmbox {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	margin: 0.2em 0;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	background-color: #f8f9fa;     /* Default &amp;quot;system&amp;quot; gray */&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.fmbox-system {&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.fmbox-warning {&lt;br /&gt;
	border: 1px solid #bb7070;  /* Dark pink */&lt;br /&gt;
	background-color: #ffdbdb;  /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.fmbox-editnotice {&lt;br /&gt;
	background-color: transparent;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Div based &amp;quot;warning&amp;quot; style fmbox messages. */&lt;br /&gt;
div.mw-warning-with-logexcerpt,&lt;br /&gt;
div.mw-lag-warn-high,&lt;br /&gt;
div.mw-cascadeprotectedwarning,&lt;br /&gt;
div#mw-protect-cascadeon,&lt;br /&gt;
div.titleblacklist-warning {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	margin: 0.2em 0;&lt;br /&gt;
	border: 1px solid #bb7070;&lt;br /&gt;
	background-color: #ffdbdb;&lt;br /&gt;
	padding: 0.25em 0.9em;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Use default color for partial block fmbox banner per [[Special:PermaLink/1028105567#pblock-style]] */&lt;br /&gt;
.mw-contributions-blocked-notice-partial .mw-warning-with-logexcerpt {&lt;br /&gt;
	border-color: #fc3;&lt;br /&gt;
	background-color: #fef6e7;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* These mbox-small classes must be placed after all other&lt;br /&gt;
   ambox/tmbox/ombox etc classes. &amp;quot;html body.mediawiki&amp;quot; is so&lt;br /&gt;
   they override &amp;quot;table.ambox + table.ambox&amp;quot; above. */&lt;br /&gt;
html body.mediawiki .mbox-small {   /* For the &amp;quot;small=yes&amp;quot; option. */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	clear: right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 4px 0 4px 1em;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
html body.mediawiki .mbox-small-left {   /* For the &amp;quot;small=left&amp;quot; option. */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 4px 1em 4px 0;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
	overflow: hidden;&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Style for compact ambox */&lt;br /&gt;
/* Hide the images */&lt;br /&gt;
.compact-ambox table .mbox-image,&lt;br /&gt;
.compact-ambox table .mbox-imageright,&lt;br /&gt;
.compact-ambox table .mbox-empty-cell {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove borders, backgrounds, padding, etc. */&lt;br /&gt;
.compact-ambox table.ambox {&lt;br /&gt;
	border: none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	background-color: transparent;&lt;br /&gt;
	margin: 0 0 0 1.6em !important;&lt;br /&gt;
	padding: 0 !important;&lt;br /&gt;
	width: auto;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
body.mediawiki .compact-ambox table.mbox-small-left {&lt;br /&gt;
	font-size: 100%;&lt;br /&gt;
	width: auto;&lt;br /&gt;
	margin: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Style the text cell as a list item and remove its padding */&lt;br /&gt;
.compact-ambox table .mbox-text {&lt;br /&gt;
	padding: 0 !important;&lt;br /&gt;
	margin: 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.compact-ambox table .mbox-text-span {&lt;br /&gt;
	display: list-item;&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	list-style-type: square;&lt;br /&gt;
	list-style-image: url(/w/skins/MonoBook/resources/images/bullet.svg);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Allow for hiding text in compact form */&lt;br /&gt;
.compact-ambox .hide-when-compact {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove underlines from certain links */&lt;br /&gt;
.nounderlines a,&lt;br /&gt;
.IPA a:link,&lt;br /&gt;
.IPA a:visited {&lt;br /&gt;
	text-decoration: none !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Prevent line breaks in silly places where desired (nowrap)&lt;br /&gt;
   and links when we don't want them to (nowraplinks a) */&lt;br /&gt;
.nowrap,&lt;br /&gt;
.nowraplinks a {&lt;br /&gt;
	white-space: nowrap;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* But allow wrapping where desired: */&lt;br /&gt;
.wrap,&lt;br /&gt;
.wraplinks a {&lt;br /&gt;
	white-space: normal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Increase the height of the image upload box */&lt;br /&gt;
#wpUploadDescription {&lt;br /&gt;
	height: 13em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Minimum thumb width */&lt;br /&gt;
.thumbinner {&lt;br /&gt;
	min-width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Prevent floating boxes from overlapping any category listings,&lt;br /&gt;
   file histories, edit previews, and edit [Show changes] views. */&lt;br /&gt;
#mw-subcategories,&lt;br /&gt;
#mw-pages,&lt;br /&gt;
#mw-category-media,&lt;br /&gt;
#filehistory,&lt;br /&gt;
#wikiPreview,&lt;br /&gt;
#wikiDiff {&lt;br /&gt;
	clear: both;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Selectively hide headers in WikiProject banners */&lt;br /&gt;
/* TemplateStyles */&lt;br /&gt;
.wpb .wpb-header {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.wpbs-inner .wpb .wpb-header {&lt;br /&gt;
	display: table-row;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.wpbs-inner .wpb-outside {&lt;br /&gt;
	display: none;             /* hide things that should only display outside shells */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Styling for Abuse Filter tags */&lt;br /&gt;
.mw-tag-markers {&lt;br /&gt;
	font-style: italic;&lt;br /&gt;
	font-size: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide stuff meant for accounts with special permissions. Made visible again in&lt;br /&gt;
   [[MediaWiki:Group-checkuser.css]], [[MediaWiki:Group-sysop.css]], [[MediaWiki:Group-abusefilter.css]],&lt;br /&gt;
   [[MediaWiki:Group-abusefilter-helper.css]], [[MediaWiki:Group-patroller.css]],&lt;br /&gt;
   [[MediaWiki:Group-templateeditor.css]], [[MediaWiki:Group-extendedmover.css]],&lt;br /&gt;
   [[MediaWiki:Group-extendedconfirmed.css]], and [[Mediawiki:Group-autoconfirmed.css]]. */&lt;br /&gt;
.checkuser-show,&lt;br /&gt;
.sysop-show,&lt;br /&gt;
.abusefilter-show,&lt;br /&gt;
.abusefilter-helper-show,&lt;br /&gt;
.patroller-show,&lt;br /&gt;
.templateeditor-show,&lt;br /&gt;
.extendedmover-show,&lt;br /&gt;
.extendedconfirmed-show,&lt;br /&gt;
.autoconfirmed-show,&lt;br /&gt;
.user-show {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide the redlink generated by {{Editnotice}},&lt;br /&gt;
   this overrides the &amp;quot;.sysop-show { display: none; }&amp;quot; above that applies&lt;br /&gt;
   to the same link as well. See [[phab:T45013]]&lt;br /&gt;
&lt;br /&gt;
   Hide the images in editnotices to keep them readable in VE view.&lt;br /&gt;
   Long term, editnotices should become a core feature so that they can be designed responsive. */&lt;br /&gt;
.ve-ui-mwNoticesPopupTool-item .editnotice-redlink,&lt;br /&gt;
.ve-ui-mwNoticesPopupTool-item .mbox-image,&lt;br /&gt;
.ve-ui-mwNoticesPopupTool-item .mbox-imageright {&lt;br /&gt;
	display: none !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove bullets when there are multiple edit page warnings */&lt;br /&gt;
ul.permissions-errors &amp;gt; li {&lt;br /&gt;
	list-style: none none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ul.permissions-errors {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* texhtml class for inline math (based on generic times-serif class) */&lt;br /&gt;
span.texhtml {&lt;br /&gt;
	font-family: &amp;quot;Nimbus Roman No9 L&amp;quot;, &amp;quot;Times New Roman&amp;quot;, Times, serif;&lt;br /&gt;
	font-size: 118%;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	white-space: nowrap;&lt;br /&gt;
	/* Force tabular and lining display for texhtml */&lt;br /&gt;
	-moz-font-feature-settings: &amp;quot;lnum&amp;quot;, &amp;quot;tnum&amp;quot;, &amp;quot;kern&amp;quot; 0;&lt;br /&gt;
	-webkit-font-feature-settings: &amp;quot;lnum&amp;quot;, &amp;quot;tnum&amp;quot;, &amp;quot;kern&amp;quot; 0;&lt;br /&gt;
	font-feature-settings: &amp;quot;lnum&amp;quot;, &amp;quot;tnum&amp;quot;, &amp;quot;kern&amp;quot; 0;&lt;br /&gt;
	font-variant-numeric: lining-nums tabular-nums;&lt;br /&gt;
	font-kerning: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
span.texhtml span.texhtml {&lt;br /&gt;
	font-size: 100%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
span.mwe-math-mathml-inline {&lt;br /&gt;
	font-size: 118%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Make &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; be left aligned with one space indent for &lt;br /&gt;
 * compatibility with style conventions&lt;br /&gt;
 */&lt;br /&gt;
.mwe-math-fallback-image-display,&lt;br /&gt;
.mwe-math-mathml-display {&lt;br /&gt;
	margin-left: 1.6em !important;&lt;br /&gt;
	margin-top: 0.6em;&lt;br /&gt;
	margin-bottom: 0.6em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mwe-math-mathml-display math {&lt;br /&gt;
	display: inline;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Work-around for [[phab:T25965]] / [[phab:T100106]] (Kaltura advertisement) */&lt;br /&gt;
.k-player .k-attribution {&lt;br /&gt;
	visibility: hidden;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Move 'play' button of video player to bottom left corner */&lt;br /&gt;
.PopUpMediaTransform a .play-btn-large {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	right: auto;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	left: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen {&lt;br /&gt;
	/* Gallery styles background changes are restricted to screen view.&lt;br /&gt;
	   In printing we should avoid applying backgrounds. */&lt;br /&gt;
	/* The backgrounds for galleries. */&lt;br /&gt;
	#content .gallerybox div.thumb {&lt;br /&gt;
		/* Light gray padding */&lt;br /&gt;
		background-color: #f8f9fa;&lt;br /&gt;
	}&lt;br /&gt;
	/* Put a chequered background behind images, only visible if they have transparency.&lt;br /&gt;
	   '.filehistory a img' and '#file img:hover' are handled by MediaWiki core (as of 1.19) */&lt;br /&gt;
	.gallerybox .thumb img {&lt;br /&gt;
		background: #fff url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat;&lt;br /&gt;
	}&lt;br /&gt;
	/* But not on articles, user pages, portals or with opt-out. */&lt;br /&gt;
	.ns-0 .gallerybox .thumb img,&lt;br /&gt;
	.ns-2 .gallerybox .thumb img,&lt;br /&gt;
	.ns-100 .gallerybox .thumb img,&lt;br /&gt;
	.nochecker .gallerybox .thumb img {&lt;br /&gt;
		background-image: none;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/* Display &amp;quot;From Wikipedia, the free encyclopedia&amp;quot; in skins that support it,&lt;br /&gt;
	   do not apply to print mode */&lt;br /&gt;
	#siteSub {&lt;br /&gt;
		display: block;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide FlaggedRevs notice UI when there are no pending changes */&lt;br /&gt;
.flaggedrevs_draft_synced,&lt;br /&gt;
.flaggedrevs_stable_synced,&lt;br /&gt;
/* &amp;quot;Temporary&amp;quot; to remove links in sidebar T255381 */&lt;br /&gt;
#t-upload,&lt;br /&gt;
/* Hide broken download box on Special:Book pending T285400 */&lt;br /&gt;
.mw-special-Book #coll-downloadbox {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Common.css&amp;diff=5304692</id>
		<title>MediaWiki:Common.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=MediaWiki:Common.css&amp;diff=5304692"/>
		<updated>2023-05-22T06:54:59Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* mobile search icon fix */&lt;br /&gt;
nav.minerva-user-navigation&amp;gt;div {&lt;br /&gt;
	display:block!important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Reset italic styling set by user agent */&lt;br /&gt;
cite,&lt;br /&gt;
dfn {&lt;br /&gt;
	font-style: inherit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Straight quote marks for &amp;lt;q&amp;gt; */&lt;br /&gt;
q {&lt;br /&gt;
	quotes: '&amp;quot;' '&amp;quot;' &amp;quot;'&amp;quot; &amp;quot;'&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Avoid collision of blockquote with floating elements by swapping margin and padding */&lt;br /&gt;
blockquote {&lt;br /&gt;
	overflow: hidden;&lt;br /&gt;
	margin: 1em 0;&lt;br /&gt;
	padding: 0 40px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Consistent size for &amp;lt;small&amp;gt;, &amp;lt;sub&amp;gt; and &amp;lt;sup&amp;gt; */&lt;br /&gt;
small {&lt;br /&gt;
	font-size: 85%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body-content sub,&lt;br /&gt;
.mw-body-content sup {&lt;br /&gt;
	font-size: 80%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Same spacing for indented and unindented paragraphs on talk pages */&lt;br /&gt;
.ns-talk .mw-body-content dd {&lt;br /&gt;
	margin-top: 0.4em;&lt;br /&gt;
	margin-bottom: 0.4em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Main page fixes */&lt;br /&gt;
#interwiki-completelist {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Reduce page jumps by hiding collapsed/dismissed content */&lt;br /&gt;
.client-js .mw-special-Watchlist #watchlist-message,&lt;br /&gt;
.client-js .collapsible:not( .mw-made-collapsible).collapsed &amp;gt; tbody &amp;gt; tr:not(:first-child),&lt;br /&gt;
&lt;br /&gt;
/* Hide charinsert base for those not using the gadget */&lt;br /&gt;
#editpage-specialchars {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Adds padding above Watchlist announcements where new recentchanges/watchlist filters are enabled */&lt;br /&gt;
.mw-rcfilters-enabled .mw-specialpage-summary {&lt;br /&gt;
	margin-top: 1em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Highlight linked elements (such as clicked references) in blue */&lt;br /&gt;
.citation:target {&lt;br /&gt;
	background-color: rgba(0, 127, 255, 0.133);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Styling for citations. Breaks long urls, etc., rather than overflowing box */&lt;br /&gt;
.citation {&lt;br /&gt;
	word-wrap: break-word;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Make the list of references smaller&lt;br /&gt;
 * Keep in sync with Template:Refbegin/styles.css&lt;br /&gt;
 * And Template:Reflist/styles.css&lt;br /&gt;
 */&lt;br /&gt;
ol.references {&lt;br /&gt;
	font-size: 90%;&lt;br /&gt;
	margin-bottom: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Style for horizontal lists (separator following item).&lt;br /&gt;
   @source mediawiki.org/wiki/Snippets/Horizontal_lists&lt;br /&gt;
   @revision 8 (2016-05-21)&lt;br /&gt;
   @author [[User:Edokter]]&lt;br /&gt;
 */&lt;br /&gt;
.hlist dl,&lt;br /&gt;
.hlist ol,&lt;br /&gt;
.hlist ul {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Display list items inline */&lt;br /&gt;
.hlist dd,&lt;br /&gt;
.hlist dt,&lt;br /&gt;
.hlist li {&lt;br /&gt;
	margin: 0; /* don't trust the note that says margin doesn't work with inline&lt;br /&gt;
				* removing margin: 0 makes dds have margins again */&lt;br /&gt;
	display: inline;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Display nested lists inline */&lt;br /&gt;
.hlist.inline,&lt;br /&gt;
.hlist.inline dl,&lt;br /&gt;
.hlist.inline ol,&lt;br /&gt;
.hlist.inline ul,&lt;br /&gt;
.hlist dl dl,&lt;br /&gt;
.hlist dl ol,&lt;br /&gt;
.hlist dl ul,&lt;br /&gt;
.hlist ol dl,&lt;br /&gt;
.hlist ol ol,&lt;br /&gt;
.hlist ol ul,&lt;br /&gt;
.hlist ul dl,&lt;br /&gt;
.hlist ul ol,&lt;br /&gt;
.hlist ul ul {&lt;br /&gt;
	display: inline;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide empty list items */&lt;br /&gt;
.hlist .mw-empty-li {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Generate interpuncts */&lt;br /&gt;
.hlist dt:after {&lt;br /&gt;
	content: &amp;quot;: &amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Note hlist style usage differs in Minerva and is defined in core as well!&lt;br /&gt;
 * Please check Minerva desktop (and Minerva.css) when changing&lt;br /&gt;
 * See https://phabricator.wikimedia.org/T213239&lt;br /&gt;
 */&lt;br /&gt;
.hlist dd:after,&lt;br /&gt;
.hlist li:after {&lt;br /&gt;
	content: &amp;quot; · &amp;quot;;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist dd:last-child:after,&lt;br /&gt;
.hlist dt:last-child:after,&lt;br /&gt;
.hlist li:last-child:after {&lt;br /&gt;
	content: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Add parentheses around nested lists */&lt;br /&gt;
.hlist dd dd:first-child:before,&lt;br /&gt;
.hlist dd dt:first-child:before,&lt;br /&gt;
.hlist dd li:first-child:before,&lt;br /&gt;
.hlist dt dd:first-child:before,&lt;br /&gt;
.hlist dt dt:first-child:before,&lt;br /&gt;
.hlist dt li:first-child:before,&lt;br /&gt;
.hlist li dd:first-child:before,&lt;br /&gt;
.hlist li dt:first-child:before,&lt;br /&gt;
.hlist li li:first-child:before {&lt;br /&gt;
	content: &amp;quot; (&amp;quot;;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist dd dd:last-child:after,&lt;br /&gt;
.hlist dd dt:last-child:after,&lt;br /&gt;
.hlist dd li:last-child:after,&lt;br /&gt;
.hlist dt dd:last-child:after,&lt;br /&gt;
.hlist dt dt:last-child:after,&lt;br /&gt;
.hlist dt li:last-child:after,&lt;br /&gt;
.hlist li dd:last-child:after,&lt;br /&gt;
.hlist li dt:last-child:after,&lt;br /&gt;
.hlist li li:last-child:after {&lt;br /&gt;
	content: &amp;quot;)&amp;quot;;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Put ordinals in front of ordered list items */&lt;br /&gt;
.hlist ol {&lt;br /&gt;
	counter-reset: listitem;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist ol &amp;gt; li {&lt;br /&gt;
	counter-increment: listitem;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist ol &amp;gt; li:before {&lt;br /&gt;
	content: &amp;quot; &amp;quot; counter(listitem) &amp;quot;\a0&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.hlist dd ol &amp;gt; li:first-child:before,&lt;br /&gt;
.hlist dt ol &amp;gt; li:first-child:before,&lt;br /&gt;
.hlist li ol &amp;gt; li:first-child:before {&lt;br /&gt;
	content: &amp;quot; (&amp;quot; counter(listitem) &amp;quot;\a0&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Unbulleted lists */&lt;br /&gt;
.plainlist ol,&lt;br /&gt;
.plainlist ul {&lt;br /&gt;
	line-height: inherit;&lt;br /&gt;
	list-style: none none;&lt;br /&gt;
	margin: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.plainlist ol li,&lt;br /&gt;
.plainlist ul li {&lt;br /&gt;
	margin-bottom: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Default style for navigation boxes */&lt;br /&gt;
.navbox {                     /* Navbox container style */&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	clear: both;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	padding: 1px;&lt;br /&gt;
	margin: 1em auto 0;       /* Prevent preceding content from clinging to navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox .navbox {&lt;br /&gt;
	margin-top: 0;            /* No top margin for nested navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox + .navbox {&lt;br /&gt;
	margin-top: -1px;         /* Single pixel border between adjacent navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-inner,&lt;br /&gt;
.navbox-subgroup {&lt;br /&gt;
	width: 100%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-group,&lt;br /&gt;
.navbox-title,&lt;br /&gt;
.navbox-abovebelow {&lt;br /&gt;
	padding: 0.25em 1em;      /* Title, group and above/below styles */&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
th.navbox-group {             /* Group style */&lt;br /&gt;
	white-space: nowrap;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: right;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox,&lt;br /&gt;
.navbox-subgroup {&lt;br /&gt;
	background-color: #fdfdfd; /* Background color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-list {&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	border-color: #fdfdfd;    /* Must match background color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* cell spacing for navbox cells */&lt;br /&gt;
tr + tr &amp;gt; .navbox-abovebelow,&lt;br /&gt;
tr + tr &amp;gt; .navbox-group,&lt;br /&gt;
tr + tr &amp;gt; .navbox-image,&lt;br /&gt;
tr + tr &amp;gt; .navbox-list {    /* Borders above 2nd, 3rd, etc. rows */&lt;br /&gt;
	border-top: 2px solid #fdfdfd; /* Must match background color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox th,&lt;br /&gt;
.navbox-title {&lt;br /&gt;
	background-color: #ccccff;      /* Level 1 color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-abovebelow,&lt;br /&gt;
th.navbox-group,&lt;br /&gt;
.navbox-subgroup .navbox-title {&lt;br /&gt;
	background-color: #ddddff;      /* Level 2 color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-subgroup .navbox-group,&lt;br /&gt;
.navbox-subgroup .navbox-abovebelow {&lt;br /&gt;
	background-color: #e6e6ff;      /* Level 3 color */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-even {&lt;br /&gt;
	background-color: #f7f7f7;      /* Even row striping */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox-odd {&lt;br /&gt;
	background-color: transparent;  /* Odd row striping */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbox .hlist td dl,&lt;br /&gt;
.navbox .hlist td ol,&lt;br /&gt;
.navbox .hlist td ul,&lt;br /&gt;
.navbox td.hlist dl,&lt;br /&gt;
.navbox td.hlist ol,&lt;br /&gt;
.navbox td.hlist ul {&lt;br /&gt;
	padding: 0.125em 0;       /* Adjust hlist padding in navboxes */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Styling for JQuery makeCollapsible, matching that of collapseButton */&lt;br /&gt;
.mw-parser-output .mw-collapsible-toggle {&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: right;&lt;br /&gt;
	padding-right: 0.2em;&lt;br /&gt;
	padding-left: 0.2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: left;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Infobox template style */&lt;br /&gt;
.infobox {&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	border-spacing: 3px;&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
	color: black;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 0.5em 0 0.5em 1em;&lt;br /&gt;
	padding: 0.2em;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	clear: right;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	width: 22em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox-subbox in a week or so as TemplateStyles version rolls out */&lt;br /&gt;
/* not strictly certain these styles are necessary&lt;br /&gt;
 * just replicating the module faithfully&lt;br /&gt;
 */&lt;br /&gt;
.infobox-subbox {&lt;br /&gt;
	padding: 0;&lt;br /&gt;
	border: none;&lt;br /&gt;
	margin: -3px;&lt;br /&gt;
	width: auto;&lt;br /&gt;
	min-width: 100%;&lt;br /&gt;
	font-size: 100%;&lt;br /&gt;
	clear: none;&lt;br /&gt;
	float: none;&lt;br /&gt;
	background-color: transparent;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.infobox-header,&lt;br /&gt;
.infobox-label,&lt;br /&gt;
.infobox-above,&lt;br /&gt;
.infobox-full-data,&lt;br /&gt;
.infobox-data,&lt;br /&gt;
.infobox-below,&lt;br /&gt;
.infobox-subheader,&lt;br /&gt;
.infobox-image,&lt;br /&gt;
.infobox-navbar,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox th,&lt;br /&gt;
.infobox td {&lt;br /&gt;
	vertical-align: top;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.infobox-label,&lt;br /&gt;
.infobox-data,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox th,&lt;br /&gt;
.infobox td {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox when element selectors above are removed */&lt;br /&gt;
.infobox .infobox-above,&lt;br /&gt;
.infobox .infobox-title,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox caption {&lt;br /&gt;
	font-size: 125%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.infobox-title,&lt;br /&gt;
/* Remove element selector when every .infobox thing is using the standard module/templates  */&lt;br /&gt;
.infobox caption {&lt;br /&gt;
	padding: 0.2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox when element selectors above are removed */&lt;br /&gt;
.infobox .infobox-header,&lt;br /&gt;
.infobox .infobox-subheader,&lt;br /&gt;
.infobox .infobox-image,&lt;br /&gt;
.infobox .infobox-full-data,&lt;br /&gt;
.infobox .infobox-below {&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove .infobox when element selectors above are removed */&lt;br /&gt;
.infobox .infobox-navbar {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: right;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Normal font styling for wikitable row headers with scope=&amp;quot;row&amp;quot; tag */&lt;br /&gt;
.wikitable.plainrowheaders th[scope=row] {&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Lists in wikitable data cells are always left-aligned */&lt;br /&gt;
.wikitable td ul,&lt;br /&gt;
.wikitable td ol,&lt;br /&gt;
.wikitable td dl {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* ...unless they also use the hlist class */&lt;br /&gt;
.toc.hlist ul,&lt;br /&gt;
#toc.hlist ul {&lt;br /&gt;
	text-align: inherit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Fix for hieroglyphs specificity issue in infoboxes ([[phab:T43869]]) */&lt;br /&gt;
table.mw-hiero-table td {&lt;br /&gt;
	vertical-align: middle;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Change the external link icon to an Adobe icon for all PDF files */&lt;br /&gt;
.mw-parser-output a[href$=&amp;quot;.pdf&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.pdf?&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.pdf#&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href$=&amp;quot;.PDF&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.PDF?&amp;quot;].external,&lt;br /&gt;
.mw-parser-output a[href*=&amp;quot;.PDF#&amp;quot;].external {&lt;br /&gt;
	background: url(&amp;quot;//upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif&amp;quot;) no-repeat right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding-right: 18px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Messagebox templates */&lt;br /&gt;
.messagebox {&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
	width: 80%;&lt;br /&gt;
	margin: 0 auto 1em auto;&lt;br /&gt;
	padding: .2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.merge {&lt;br /&gt;
	border: 1px solid #c0b8cc;&lt;br /&gt;
	background-color: #f0e5ff;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.cleanup {&lt;br /&gt;
	border: 1px solid #9f9fff;&lt;br /&gt;
	background-color: #efefff;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.standard-talk {&lt;br /&gt;
	border: 1px solid #c0c090;&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
	margin: 4px auto;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* For old WikiProject banners inside banner shells. */&lt;br /&gt;
.mbox-inside .standard-talk {&lt;br /&gt;
	border: 1px solid #c0c090;&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 2px 0;&lt;br /&gt;
	padding: 2px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.small {&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	font-size: 85%;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	clear: both;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 0 0 1em 1em;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.messagebox.small-talk {&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	font-size: 85%;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	clear: both;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 0 0 1em 1em;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Cell sizes for ambox/tmbox/imbox/cmbox/ombox/fmbox/dmbox message boxes */&lt;br /&gt;
th.mbox-text, td.mbox-text {   /* The message body cell(s) */&lt;br /&gt;
	border: none;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 0.25em 0.9em;     /* 0.9em left/right */&lt;br /&gt;
	width: 100%;               /* Make all mboxes the same width regardless of text length */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.mbox-image {                /* The left image cell */&lt;br /&gt;
	border: none;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0 2px 0.9em;  /* 0.9em left, 0px right */&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.mbox-imageright {           /* The right image cell */&lt;br /&gt;
	border: none;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0.9em 2px 0;  /* 0px left, 0.9em right */&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.mbox-empty-cell {           /* An empty narrow cell */&lt;br /&gt;
	border: none;&lt;br /&gt;
	padding: 0;&lt;br /&gt;
	width: 1px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Article message box styles */&lt;br /&gt;
table.ambox {&lt;br /&gt;
	margin: 0 10%;                  /* 10% = Will not overlap with other elements */&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #36c;  /* Default &amp;quot;notice&amp;quot; blue */&lt;br /&gt;
	background-color: #fbfbfb;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox + table.ambox {      /* Single border between stacked boxes. */&lt;br /&gt;
	margin-top: -1px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ambox th.mbox-text,&lt;br /&gt;
.ambox td.mbox-text {            /* The message body cell(s) */&lt;br /&gt;
	padding: 0.25em 0.5em;       /* 0.5em left/right */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ambox td.mbox-image {           /* The left image cell */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0 2px 0.5em;    /* 0.5em left, 0px right */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ambox td.mbox-imageright {      /* The right image cell */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	padding: 2px 0.5em 2px 0;    /* 0px left, 0.5em right */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-notice {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #36c;       /* Blue */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-speedy {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;          /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-delete {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-content {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-style {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-move {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ambox-protection {&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	border-left: 10px solid #a2a9b1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Image message box styles */&lt;br /&gt;
table.imbox {&lt;br /&gt;
	margin: 4px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 3px solid #36c;    /* Default &amp;quot;notice&amp;quot; blue */&lt;br /&gt;
	background-color: #fbfbfb;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.imbox .mbox-text .imbox {  /* For imboxes inside imbox-text cells. */&lt;br /&gt;
	margin: 0 -0.5em;       /* 0.9 - 0.5 = 0.4em left/right.        */&lt;br /&gt;
	display: block;         /* Fix for webkit to force 100% width.  */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mbox-inside .imbox {       /* For imboxes inside other templates.  */&lt;br /&gt;
	margin: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-notice {&lt;br /&gt;
	border: 3px solid #36c;       /* Blue */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-speedy {&lt;br /&gt;
	border: 3px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-delete {&lt;br /&gt;
	border: 3px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-content {&lt;br /&gt;
	border: 3px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-style {&lt;br /&gt;
	border: 3px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-move {&lt;br /&gt;
	border: 3px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-protection {&lt;br /&gt;
	border: 3px solid #a2a9b1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-license {&lt;br /&gt;
	border: 3px solid #88a;       /* Dark gray */&lt;br /&gt;
	background-color: #f7f8ff;    /* Light gray */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.imbox-featured {&lt;br /&gt;
	border: 3px solid #cba135;    /* Brown-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Category message box styles */&lt;br /&gt;
table.cmbox {&lt;br /&gt;
	margin: 3px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	background-color: #dfe8ff;    /* Default &amp;quot;notice&amp;quot; blue */&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-notice {&lt;br /&gt;
	background-color: #d8e8ff;    /* Blue */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-speedy {&lt;br /&gt;
	margin-top: 4px;&lt;br /&gt;
	margin-bottom: 4px;&lt;br /&gt;
	border: 4px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #ffdbdb;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-delete {&lt;br /&gt;
	background-color: #ffdbdb;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-content {&lt;br /&gt;
	background-color: #ffe7ce;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-style {&lt;br /&gt;
	background-color: #fff9db;    /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-move {&lt;br /&gt;
	background-color: #e4d8ff;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.cmbox-protection {&lt;br /&gt;
	background-color: #efefe1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Other pages message box styles */&lt;br /&gt;
table.ombox {&lt;br /&gt;
	margin: 4px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 1px solid #a2a9b1;    /* Default &amp;quot;notice&amp;quot; gray */&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-notice {&lt;br /&gt;
	border: 1px solid #a2a9b1;    /* Gray */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-speedy {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-delete {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-content {&lt;br /&gt;
	border: 1px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-style {&lt;br /&gt;
	border: 1px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-move {&lt;br /&gt;
	border: 1px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.ombox-protection {&lt;br /&gt;
	border: 2px solid #a2a9b1;    /* Gray-gold */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Talk page message box styles */&lt;br /&gt;
table.tmbox {&lt;br /&gt;
	margin: 4px 10%;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	border: 1px solid #c0c090;    /* Default &amp;quot;notice&amp;quot; gray-brown */&lt;br /&gt;
	background-color: #f8eaba;&lt;br /&gt;
	min-width: 80%;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.tmbox.mbox-small {&lt;br /&gt;
	min-width: 0;                /* reset the min-width of tmbox above        */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mediawiki .mbox-inside .tmbox { /* For tmboxes inside other templates. The &amp;quot;mediawiki&amp;quot; class ensures that */&lt;br /&gt;
	margin: 2px 0;               /* this declaration overrides other styles (including mbox-small above)   */&lt;br /&gt;
	width: 100%;                 /* For Safari and Opera */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mbox-inside .tmbox.mbox-small { /* &amp;quot;small&amp;quot; tmboxes should not be small when  */&lt;br /&gt;
	line-height: 1.5em;          /* also &amp;quot;nested&amp;quot;, so reset styles that are   */&lt;br /&gt;
	font-size: 100%;             /* set in &amp;quot;mbox-small&amp;quot; above.                */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-speedy {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
	background-color: #fee7e6;    /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-delete {&lt;br /&gt;
	border: 2px solid #b32424;    /* Red */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-content {&lt;br /&gt;
	border: 2px solid #f28500;    /* Orange */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-style {&lt;br /&gt;
	border: 2px solid #fc3;       /* Yellow */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-move {&lt;br /&gt;
	border: 2px solid #9932cc;    /* Purple */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.tmbox-protection,&lt;br /&gt;
table.tmbox-notice {&lt;br /&gt;
	border: 1px solid #c0c090;    /* Gray-brown */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Footer and header message box styles */&lt;br /&gt;
table.fmbox {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	margin: 0.2em 0;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	border: 1px solid #a2a9b1;&lt;br /&gt;
	background-color: #f8f9fa;     /* Default &amp;quot;system&amp;quot; gray */&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.fmbox-system {&lt;br /&gt;
	background-color: #f8f9fa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.fmbox-warning {&lt;br /&gt;
	border: 1px solid #bb7070;  /* Dark pink */&lt;br /&gt;
	background-color: #ffdbdb;  /* Pink */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
table.fmbox-editnotice {&lt;br /&gt;
	background-color: transparent;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Div based &amp;quot;warning&amp;quot; style fmbox messages. */&lt;br /&gt;
div.mw-warning-with-logexcerpt,&lt;br /&gt;
div.mw-lag-warn-high,&lt;br /&gt;
div.mw-cascadeprotectedwarning,&lt;br /&gt;
div#mw-protect-cascadeon,&lt;br /&gt;
div.titleblacklist-warning {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	margin: 0.2em 0;&lt;br /&gt;
	border: 1px solid #bb7070;&lt;br /&gt;
	background-color: #ffdbdb;&lt;br /&gt;
	padding: 0.25em 0.9em;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Use default color for partial block fmbox banner per [[Special:PermaLink/1028105567#pblock-style]] */&lt;br /&gt;
.mw-contributions-blocked-notice-partial .mw-warning-with-logexcerpt {&lt;br /&gt;
	border-color: #fc3;&lt;br /&gt;
	background-color: #fef6e7;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* These mbox-small classes must be placed after all other&lt;br /&gt;
   ambox/tmbox/ombox etc classes. &amp;quot;html body.mediawiki&amp;quot; is so&lt;br /&gt;
   they override &amp;quot;table.ambox + table.ambox&amp;quot; above. */&lt;br /&gt;
html body.mediawiki .mbox-small {   /* For the &amp;quot;small=yes&amp;quot; option. */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	clear: right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	float: right;&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 4px 0 4px 1em;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
html body.mediawiki .mbox-small-left {   /* For the &amp;quot;small=left&amp;quot; option. */&lt;br /&gt;
	/* @noflip */&lt;br /&gt;
	margin: 4px 1em 4px 0;&lt;br /&gt;
	box-sizing: border-box;&lt;br /&gt;
	overflow: hidden;&lt;br /&gt;
	width: 238px;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	font-size: 88%;&lt;br /&gt;
	line-height: 1.25em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Style for compact ambox */&lt;br /&gt;
/* Hide the images */&lt;br /&gt;
.compact-ambox table .mbox-image,&lt;br /&gt;
.compact-ambox table .mbox-imageright,&lt;br /&gt;
.compact-ambox table .mbox-empty-cell {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove borders, backgrounds, padding, etc. */&lt;br /&gt;
.compact-ambox table.ambox {&lt;br /&gt;
	border: none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	background-color: transparent;&lt;br /&gt;
	margin: 0 0 0 1.6em !important;&lt;br /&gt;
	padding: 0 !important;&lt;br /&gt;
	width: auto;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
body.mediawiki .compact-ambox table.mbox-small-left {&lt;br /&gt;
	font-size: 100%;&lt;br /&gt;
	width: auto;&lt;br /&gt;
	margin: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Style the text cell as a list item and remove its padding */&lt;br /&gt;
.compact-ambox table .mbox-text {&lt;br /&gt;
	padding: 0 !important;&lt;br /&gt;
	margin: 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.compact-ambox table .mbox-text-span {&lt;br /&gt;
	display: list-item;&lt;br /&gt;
	line-height: 1.5em;&lt;br /&gt;
	list-style-type: square;&lt;br /&gt;
	list-style-image: url(/w/skins/MonoBook/resources/images/bullet.svg);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Allow for hiding text in compact form */&lt;br /&gt;
.compact-ambox .hide-when-compact {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove underlines from certain links */&lt;br /&gt;
.nounderlines a,&lt;br /&gt;
.IPA a:link,&lt;br /&gt;
.IPA a:visited {&lt;br /&gt;
	text-decoration: none !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Prevent line breaks in silly places where desired (nowrap)&lt;br /&gt;
   and links when we don't want them to (nowraplinks a) */&lt;br /&gt;
.nowrap,&lt;br /&gt;
.nowraplinks a {&lt;br /&gt;
	white-space: nowrap;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* But allow wrapping where desired: */&lt;br /&gt;
.wrap,&lt;br /&gt;
.wraplinks a {&lt;br /&gt;
	white-space: normal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Increase the height of the image upload box */&lt;br /&gt;
#wpUploadDescription {&lt;br /&gt;
	height: 13em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Minimum thumb width */&lt;br /&gt;
.thumbinner {&lt;br /&gt;
	min-width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Prevent floating boxes from overlapping any category listings,&lt;br /&gt;
   file histories, edit previews, and edit [Show changes] views. */&lt;br /&gt;
#mw-subcategories,&lt;br /&gt;
#mw-pages,&lt;br /&gt;
#mw-category-media,&lt;br /&gt;
#filehistory,&lt;br /&gt;
#wikiPreview,&lt;br /&gt;
#wikiDiff {&lt;br /&gt;
	clear: both;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Selectively hide headers in WikiProject banners */&lt;br /&gt;
/* TemplateStyles */&lt;br /&gt;
.wpb .wpb-header {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.wpbs-inner .wpb .wpb-header {&lt;br /&gt;
	display: table-row;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.wpbs-inner .wpb-outside {&lt;br /&gt;
	display: none;             /* hide things that should only display outside shells */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Styling for Abuse Filter tags */&lt;br /&gt;
.mw-tag-markers {&lt;br /&gt;
	font-style: italic;&lt;br /&gt;
	font-size: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide stuff meant for accounts with special permissions. Made visible again in&lt;br /&gt;
   [[MediaWiki:Group-checkuser.css]], [[MediaWiki:Group-sysop.css]], [[MediaWiki:Group-abusefilter.css]],&lt;br /&gt;
   [[MediaWiki:Group-abusefilter-helper.css]], [[MediaWiki:Group-patroller.css]],&lt;br /&gt;
   [[MediaWiki:Group-templateeditor.css]], [[MediaWiki:Group-extendedmover.css]],&lt;br /&gt;
   [[MediaWiki:Group-extendedconfirmed.css]], and [[Mediawiki:Group-autoconfirmed.css]]. */&lt;br /&gt;
.checkuser-show,&lt;br /&gt;
.sysop-show,&lt;br /&gt;
.abusefilter-show,&lt;br /&gt;
.abusefilter-helper-show,&lt;br /&gt;
.patroller-show,&lt;br /&gt;
.templateeditor-show,&lt;br /&gt;
.extendedmover-show,&lt;br /&gt;
.extendedconfirmed-show,&lt;br /&gt;
.autoconfirmed-show,&lt;br /&gt;
.user-show {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide the redlink generated by {{Editnotice}},&lt;br /&gt;
   this overrides the &amp;quot;.sysop-show { display: none; }&amp;quot; above that applies&lt;br /&gt;
   to the same link as well. See [[phab:T45013]]&lt;br /&gt;
&lt;br /&gt;
   Hide the images in editnotices to keep them readable in VE view.&lt;br /&gt;
   Long term, editnotices should become a core feature so that they can be designed responsive. */&lt;br /&gt;
.ve-ui-mwNoticesPopupTool-item .editnotice-redlink,&lt;br /&gt;
.ve-ui-mwNoticesPopupTool-item .mbox-image,&lt;br /&gt;
.ve-ui-mwNoticesPopupTool-item .mbox-imageright {&lt;br /&gt;
	display: none !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Remove bullets when there are multiple edit page warnings */&lt;br /&gt;
ul.permissions-errors &amp;gt; li {&lt;br /&gt;
	list-style: none none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ul.permissions-errors {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* texhtml class for inline math (based on generic times-serif class) */&lt;br /&gt;
span.texhtml {&lt;br /&gt;
	font-family: &amp;quot;Nimbus Roman No9 L&amp;quot;, &amp;quot;Times New Roman&amp;quot;, Times, serif;&lt;br /&gt;
	font-size: 118%;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	white-space: nowrap;&lt;br /&gt;
	/* Force tabular and lining display for texhtml */&lt;br /&gt;
	-moz-font-feature-settings: &amp;quot;lnum&amp;quot;, &amp;quot;tnum&amp;quot;, &amp;quot;kern&amp;quot; 0;&lt;br /&gt;
	-webkit-font-feature-settings: &amp;quot;lnum&amp;quot;, &amp;quot;tnum&amp;quot;, &amp;quot;kern&amp;quot; 0;&lt;br /&gt;
	font-feature-settings: &amp;quot;lnum&amp;quot;, &amp;quot;tnum&amp;quot;, &amp;quot;kern&amp;quot; 0;&lt;br /&gt;
	font-variant-numeric: lining-nums tabular-nums;&lt;br /&gt;
	font-kerning: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
span.texhtml span.texhtml {&lt;br /&gt;
	font-size: 100%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
span.mwe-math-mathml-inline {&lt;br /&gt;
	font-size: 118%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Make &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; be left aligned with one space indent for &lt;br /&gt;
 * compatibility with style conventions&lt;br /&gt;
 */&lt;br /&gt;
.mwe-math-fallback-image-display,&lt;br /&gt;
.mwe-math-mathml-display {&lt;br /&gt;
	margin-left: 1.6em !important;&lt;br /&gt;
	margin-top: 0.6em;&lt;br /&gt;
	margin-bottom: 0.6em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mwe-math-mathml-display math {&lt;br /&gt;
	display: inline;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Work-around for [[phab:T25965]] / [[phab:T100106]] (Kaltura advertisement) */&lt;br /&gt;
.k-player .k-attribution {&lt;br /&gt;
	visibility: hidden;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Move 'play' button of video player to bottom left corner */&lt;br /&gt;
.PopUpMediaTransform a .play-btn-large {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	right: auto;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	left: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen {&lt;br /&gt;
	/* Gallery styles background changes are restricted to screen view.&lt;br /&gt;
	   In printing we should avoid applying backgrounds. */&lt;br /&gt;
	/* The backgrounds for galleries. */&lt;br /&gt;
	#content .gallerybox div.thumb {&lt;br /&gt;
		/* Light gray padding */&lt;br /&gt;
		background-color: #f8f9fa;&lt;br /&gt;
	}&lt;br /&gt;
	/* Put a chequered background behind images, only visible if they have transparency.&lt;br /&gt;
	   '.filehistory a img' and '#file img:hover' are handled by MediaWiki core (as of 1.19) */&lt;br /&gt;
	.gallerybox .thumb img {&lt;br /&gt;
		background: #fff url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat;&lt;br /&gt;
	}&lt;br /&gt;
	/* But not on articles, user pages, portals or with opt-out. */&lt;br /&gt;
	.ns-0 .gallerybox .thumb img,&lt;br /&gt;
	.ns-2 .gallerybox .thumb img,&lt;br /&gt;
	.ns-100 .gallerybox .thumb img,&lt;br /&gt;
	.nochecker .gallerybox .thumb img {&lt;br /&gt;
		background-image: none;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/* Display &amp;quot;From Wikipedia, the free encyclopedia&amp;quot; in skins that support it,&lt;br /&gt;
	   do not apply to print mode */&lt;br /&gt;
	#siteSub {&lt;br /&gt;
		display: block;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Hide FlaggedRevs notice UI when there are no pending changes */&lt;br /&gt;
.flaggedrevs_draft_synced,&lt;br /&gt;
.flaggedrevs_stable_synced,&lt;br /&gt;
/* &amp;quot;Temporary&amp;quot; to remove links in sidebar T255381 */&lt;br /&gt;
#t-upload,&lt;br /&gt;
/* Hide broken download box on Special:Book pending T285400 */&lt;br /&gt;
.mw-special-Book #coll-downloadbox {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Video_game_wikidata/doc&amp;diff=5304691</id>
		<title>Module:Video game wikidata/doc</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Video_game_wikidata/doc&amp;diff=5304691"/>
		<updated>2023-05-19T12:27:22Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Created page with &amp;quot;{{Module rating |alpha&amp;lt;!-- Values:  pre-alpha • alpha • beta • release • protected  --  If a rating not needed/relevant, delete this template call --&amp;gt;}} &amp;lt;!-- Please pl...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Module rating |alpha&amp;lt;!-- Values:  pre-alpha • alpha • beta • release • protected  --  If a rating not needed/relevant, delete this template call --&amp;gt;}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
== Usage ==&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{PAGENAME}}|''getSystemAlias''|&amp;lt;numeric-id&amp;gt;}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{PAGENAME}}|''getSystemID''|&amp;lt;alias&amp;gt;}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{PAGENAME}}|''getAggregatorAlias''|&amp;lt;numeric-id&amp;gt;}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{PAGENAME}}|''getAggregatorID''|&amp;lt;alias&amp;gt;}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{PAGENAME}}|''getReviewerAlias''|&amp;lt;numeric-id&amp;gt;}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{PAGENAME}}|''getReviewerID''|&amp;lt;alias&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox | |&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Modules using data from Wikidata]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Video_game_wikidata&amp;diff=5304690</id>
		<title>Module:Video game wikidata</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Video_game_wikidata&amp;diff=5304690"/>
		<updated>2023-05-19T12:26:19Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Replaced content with &amp;quot;local p = {}  function p.getSystemAlias(numericId) 	return &amp;quot;&amp;quot; end  function p.getSystemID(system) 	return &amp;quot;&amp;quot; end  function p.getAggregatorAlias(numericId) 	return &amp;quot;&amp;quot; end...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.getSystemAlias(numericId)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getSystemID(system)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getAggregatorAlias(numericId)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getAggregatorID(system)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getReviewerAlias(numericId)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getReviewerID(system)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.setReviewer(iReviewer)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setDateFormat(iDf)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setSystemFormat(iSf)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setUpdateLinkStyle(iStyle)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setGame(iGame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setSystem(iSystem)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setGenerateReferences(iGenRefs)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setShowSystem(iShowSystem)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setShowUpdateLink(iShowUpdateLink)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getUpdateLink()&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getSitelink()&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getLabel()&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getParts()&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getEarliestPublicationDate()&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.printReviewScores(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:WikidataIB&amp;diff=5304689</id>
		<title>Module:WikidataIB</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:WikidataIB&amp;diff=5304689"/>
		<updated>2023-05-19T12:15:22Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Public functions&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- _getValue makes the functionality of getValue available to other modules&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;&lt;br /&gt;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p._getValue = function(args)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getValue is used to get the value(s) of a property&lt;br /&gt;
-- The property ID is passed as the first unnamed parameter and is required.&lt;br /&gt;
-- A locally supplied parameter may optionaly be supplied as the second unnamed parameter.&lt;br /&gt;
-- The function will now also return qualifiers if parameter qual is supplied&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;&lt;br /&gt;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getPreferredValue is used to get a value,&lt;br /&gt;
-- (or a comma separated list of them if multiple values exist).&lt;br /&gt;
-- If preferred ranks are set, it will return those values, otherwise values with normal ranks&lt;br /&gt;
-- now redundant to getValue with |rank=best&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: p.getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput;&lt;br /&gt;
-- parseParam; sourced; labelOrId; i18n.latestdatequalifier; format_Date;&lt;br /&gt;
-- makeOrdinal; roundto; decimalPrecision; decimalToDMS;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getPreferredValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getCoords is used to get coordinates for display in an infobox&lt;br /&gt;
-- whitelist and blacklist are implemented&lt;br /&gt;
-- optional 'display' parameter is allowed, defaults to nil - was &amp;quot;inline, title&amp;quot;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: setRanks(); parseInput(); decimalPrecision();&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getCoords = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getQualifierValue is used to get a formatted value of a qualifier&lt;br /&gt;
--&lt;br /&gt;
-- The call needs:	a property (the unnamed parameter or 1=)&lt;br /&gt;
-- 					a target value for that property (pval=)&lt;br /&gt;
--					a qualifier for that target value (qual=)&lt;br /&gt;
-- The usual whitelisting and blacklisting of the property is implemented&lt;br /&gt;
-- The boolean onlysourced= parameter can be set to return nothing&lt;br /&gt;
-- when the property is unsourced (or only sourced to Wikipedia)&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam(); setRanks(); parseInput(); sourced();&lt;br /&gt;
-- propertyvalueandquals(); assembleoutput();&lt;br /&gt;
-- labelOrId(); i18n.latestdatequalifier(); format_Date();&lt;br /&gt;
-- findLang(); makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS();&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getQualifierValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getSumOfParts scans the property 'has part' (P527) for values matching a list.&lt;br /&gt;
-- The list is passed in parameter vlist.&lt;br /&gt;
-- It consists of a string of Qids separated by spaces or any usual punctuation.&lt;br /&gt;
-- If the matched values have a qualifier 'quantity' (P1114), those quantities are summed.&lt;br /&gt;
-- The sum is returned as a number or nothing if zero.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _getsumofparts;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getSumOfParts = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getValueByQual gets the value of a property which has a qualifier with a given entity value&lt;br /&gt;
-- The call needs:&lt;br /&gt;
--					a property ID (the unnamed parameter or 1=Pxxx)&lt;br /&gt;
--					the ID of a qualifier for that property (qualID=Pyyy)&lt;br /&gt;
--					either the Wikibase-entity ID of a value for that qualifier (qvalue=Qzzz)&lt;br /&gt;
--					or a string value for that qualifier (qvalue=abc123)&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced;&lt;br /&gt;
-- assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getValueByQual = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getValueByLang gets the value of a property which has a qualifier P407&lt;br /&gt;
-- (&amp;quot;language of work or name&amp;quot;) whose value has the given language code&lt;br /&gt;
-- The call needs:&lt;br /&gt;
--					a property ID (the unnamed parameter or 1=Pxxx)&lt;br /&gt;
--					the MediaWiki language code to match the language (lang=xx[-yy])&lt;br /&gt;
--					(if no code is supplied, it uses the default language)&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced; assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getValueByLang = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getValueByRefSource gets the value of a property which has a reference &amp;quot;stated in&amp;quot; (P248)&lt;br /&gt;
-- whose value has the given entity-ID.&lt;br /&gt;
-- The call needs:&lt;br /&gt;
--					a property ID (the unnamed parameter or 1=Pxxx)&lt;br /&gt;
--					the entity ID of a value to match where the reference is stated in (match=Qzzz)&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getValueByRefSource = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getPropertyIDs takes most of the usual parameters.&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.&lt;br /&gt;
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.&lt;br /&gt;
-- Otherwise it returns nothing.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p._getPropertyIDs = function(args)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getPropertyIDs = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getQualifierIDs takes most of the usual parameters.&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.&lt;br /&gt;
-- It takes a property-id as the first unnamed parameter, and an optional parameter qlist&lt;br /&gt;
-- which is a list of qualifier property-ids to search for (default is &amp;quot;ALL&amp;quot;)&lt;br /&gt;
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.&lt;br /&gt;
-- Otherwise it returns nothing.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getQualifierIDs = function(frame)&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getPropOfProp takes two propertyIDs: prop1 and prop2 (as well as the usual parameters)&lt;br /&gt;
-- If the value(s) of prop1 are of type &amp;quot;wikibase-item&amp;quot; then it returns the value(s) of prop2&lt;br /&gt;
-- of each of those wikibase-items.&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p._getPropOfProp = function(args)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getPropOfProp = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAwardCat takes most of the usual parameters. If the item has values of P166 (award received),&lt;br /&gt;
-- then it examines each of those awards for P2517 (category for recipients of this award).&lt;br /&gt;
-- If it exists, it returns the corresponding category,&lt;br /&gt;
-- with the item's P734 (family name) as sort key, or no sort key if there is no family name.&lt;br /&gt;
-- The sort key may be overridden by the parameter |sortkey (alias |sk).&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getAwardCat = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getIntersectCat takes most of the usual parameters.&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented&lt;br /&gt;
-- It takes two properties, |prop1 and |prop2 (e.g. occupation and country of citizenship)&lt;br /&gt;
-- Each property's value is a wiki-base entity&lt;br /&gt;
-- For each value of the first parameter (ranks implemented) it fetches the value's main category&lt;br /&gt;
-- and then each value of the second parameter (possibly substituting a simpler description)&lt;br /&gt;
-- then it returns all of the categories representing the intersection of those properties,&lt;br /&gt;
-- (e.g. Category:Actors from Canada). A joining term may be supplied (e.g. |join=from).&lt;br /&gt;
-- The item's P734 (family name) is the sort key, or no sort key if there is no family name.&lt;br /&gt;
-- The sort key may be overridden by the parameter |sortkey (alias |sk).&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getIntersectCat = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- qualsToTable takes most of the usual parameters.&lt;br /&gt;
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.&lt;br /&gt;
-- A qid may be given, and the first unnamed parameter is the property ID, which is of type wikibase item.&lt;br /&gt;
-- It takes a list of qualifier property IDs as |quals=&lt;br /&gt;
-- For a given qid and property, it creates the rows of an html table,&lt;br /&gt;
-- each row being a value of the property (optionally only if the property matches the value in |pval= )&lt;br /&gt;
-- each cell being the first value of the qualifier corresponding to the list in |quals&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; setRanks; parseInput; sourced;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.qualsToTable = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getGlobe takes an optional qid of a Wikidata entity passed as |qid=&lt;br /&gt;
-- otherwise it uses the linked item for the current page.&lt;br /&gt;
-- If returns the Qid of the globe used in P625 (coordinate location),&lt;br /&gt;
-- or nil if there isn't one.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getGlobe = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getCommonsLink takes an optional qid of a Wikidata entity passed as |qid=&lt;br /&gt;
-- It returns one of the following in order of preference:&lt;br /&gt;
-- the Commons sitelink of the linked Wikidata item;&lt;br /&gt;
-- the Commons sitelink of the topic's main category of the linked Wikidata item;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _getCommonslink(); _getSitelink(); parseParam()&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getCommonsLink = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getSitelink takes the qid of a Wikidata entity passed as |qid=&lt;br /&gt;
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink&lt;br /&gt;
-- If the parameter is blank, then it uses the local wiki.&lt;br /&gt;
-- If there is a sitelink to an article available, it returns the plain text link to the article&lt;br /&gt;
-- If there is no sitelink, it returns nil.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getSiteLink = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=&lt;br /&gt;
-- If there is a sitelink to an article on the local Wiki, it returns a link to the article&lt;br /&gt;
-- with the Wikidata label as the displayed text.&lt;br /&gt;
-- If there is no sitelink, it returns the label as plain text.&lt;br /&gt;
-- If there is no label in the local language, it displays the qid instead.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getLink = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=&lt;br /&gt;
-- It returns the Wikidata label for the local language as plain text.&lt;br /&gt;
-- If there is no label in the local language, it displays the qid instead.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getLabel = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- label has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=&lt;br /&gt;
-- if no qid is supplied, it uses the qid associated with the current page.&lt;br /&gt;
-- It returns the Wikidata label for the local language as plain text.&lt;br /&gt;
-- If there is no label in the local language, it returns nil.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.label = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAT (Article Title)&lt;br /&gt;
-- has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=&lt;br /&gt;
-- If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text.&lt;br /&gt;
-- If there is no sitelink or qid supplied, it returns nothing.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getAT = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getDescription has the qid of a Wikidata entity passed as |qid=&lt;br /&gt;
-- (it defaults to the associated qid of the current article if omitted)&lt;br /&gt;
-- and a local parameter passed as the first unnamed parameter.&lt;br /&gt;
-- Any local parameter passed (other than &amp;quot;Wikidata&amp;quot; or &amp;quot;none&amp;quot;) becomes the return value.&lt;br /&gt;
-- It returns the article description for the Wikidata entity if the local parameter is &amp;quot;Wikidata&amp;quot;.&lt;br /&gt;
-- Nothing is returned if the description doesn't exist or &amp;quot;none&amp;quot; is passed as the local parameter.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getDescription = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAliases has the qid of a Wikidata entity passed as |qid=&lt;br /&gt;
-- (it defaults to the associated qid of the current article if omitted)&lt;br /&gt;
-- and a local parameter passed as the first unnamed parameter.&lt;br /&gt;
-- It implements blacklisting and whitelisting with a field name of &amp;quot;alias&amp;quot; by default.&lt;br /&gt;
-- Any local parameter passed becomes the return value.&lt;br /&gt;
-- Otherwise it returns the aliases for the Wikidata entity with the usual list options.&lt;br /&gt;
-- Nothing is returned if the aliases do not exist.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: findLang(); assembleoutput()&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getAliases = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- pageId returns the page id (entity ID, Qnnn) of the current page&lt;br /&gt;
-- returns nothing if the page is not connected to Wikidata&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.pageId = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- formatDate is a wrapper to export the private function format_Date&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: format_Date();&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.formatDate = function(frame)&lt;br /&gt;
	return format_Date(frame.args[1], frame.args.df, frame.args.bc)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- location is a wrapper to export the private function _location&lt;br /&gt;
-- it takes the entity-id as qid or the first unnamed parameter&lt;br /&gt;
-- optional boolean parameter first toggles the display of the first item&lt;br /&gt;
-- optional boolean parameter skip toggles the display to skip to the last item&lt;br /&gt;
-- parameter debug=&amp;lt;y/n&amp;gt; (default 'n') adds error msg if not a location&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _location();&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.location = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- checkBlacklist implements a test to check whether a named field is allowed&lt;br /&gt;
-- returns true if the field is not blacklisted (i.e. allowed)&lt;br /&gt;
-- returns false if the field is blacklisted (i.e. disallowed)&lt;br /&gt;
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Joe |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}&lt;br /&gt;
-- displays &amp;quot;blacklisted&amp;quot;&lt;br /&gt;
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Jim |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}&lt;br /&gt;
-- displays &amp;quot;not blacklisted&amp;quot;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.checkBlacklist = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags&lt;br /&gt;
-- otherwise it returns the argument unchanged (including leading/trailing space).&lt;br /&gt;
-- If the argument may contain &amp;quot;=&amp;quot;, then it must be called explicitly:&lt;br /&gt;
-- |1=arg&lt;br /&gt;
-- (In that case, leading and trailing spaces are trimmed)&lt;br /&gt;
-- It finds use in infoboxes where it can replace tests like:&lt;br /&gt;
-- {{#if: {{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}} | &amp;lt;span class=&amp;quot;xxx&amp;quot;&amp;gt;{{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}}&amp;lt;/span&amp;gt; | }}&lt;br /&gt;
-- with a form that uses just a single call to Wikidata:&lt;br /&gt;
-- {{#invoke |WikidataIB |emptyor |1= &amp;lt;span class=&amp;quot;xxx&amp;quot;&amp;gt;{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}&amp;lt;/span&amp;gt; }}&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.emptyor = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- labelorid is a public function to expose the output of labelOrId()&lt;br /&gt;
-- Pass the Q-number as |qid= or as an unnamed parameter.&lt;br /&gt;
-- It returns the Wikidata label for that entity or the qid if no label exists.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: labelOrId&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.labelorid = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getLang returns the MediaWiki language code of the current content.&lt;br /&gt;
-- If optional parameter |style=full, it returns the language name.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getLang = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getItemLangCode takes a qid parameter (using the current page's qid if blank)&lt;br /&gt;
-- If the item for that qid has property country (P17) it looks at the first preferred value&lt;br /&gt;
-- If the country has an official language (P37), it looks at the first preferred value&lt;br /&gt;
-- If that official language has a language code (P424), it returns the first preferred value&lt;br /&gt;
-- Otherwise it returns nothing.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: _getItemLangCode()&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getItemLangCode = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- findLanguage exports the local findLang() function&lt;br /&gt;
-- It takes an optional language code and returns, in order of preference:&lt;br /&gt;
-- the code if a known language;&lt;br /&gt;
-- the user's language, if set;&lt;br /&gt;
-- the server's content language.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: findLang&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.findLanguage = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getQid returns the qid, if supplied&lt;br /&gt;
-- failing that, the Wikidata entity ID of the &amp;quot;category's main topic (P301)&amp;quot;, if it exists&lt;br /&gt;
-- failing that, the Wikidata entity ID associated with the current page, if it exists&lt;br /&gt;
-- otherwise, nothing&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getQid = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- followQid takes four optional parameters: qid, props, list and all.&lt;br /&gt;
-- If qid is not given, it uses the qid for the connected page&lt;br /&gt;
-- or returns nil if there isn't one.&lt;br /&gt;
-- props is a list of properties, separated by punctuation.&lt;br /&gt;
-- If props is given, the Wikidata item for the qid is examined for each property in turn.&lt;br /&gt;
-- If that property contains a value that is another Wikibase-item, that item's qid is returned,&lt;br /&gt;
-- and the search terminates, unless |all=y when all of the qids are returned, separated by spaces.&lt;br /&gt;
-- If |list= is set to a template, the qids are passed as arguments to the template.&lt;br /&gt;
-- If props is not given, the qid is returned.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam()&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p._followQid = function(args)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.followQid = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- globalSiteID returns the globalSiteID for the current wiki&lt;br /&gt;
-- e.g. returns &amp;quot;enwiki&amp;quot; for the English Wikipedia, &amp;quot;enwikisource&amp;quot; for English Wikisource, etc.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.globalSiteID = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- siteID returns the root of the globalSiteID&lt;br /&gt;
-- e.g. &amp;quot;en&amp;quot; for &amp;quot;enwiki&amp;quot;, &amp;quot;enwikisource&amp;quot;, etc.&lt;br /&gt;
-- treats &amp;quot;en-gb&amp;quot; as &amp;quot;en&amp;quot;, etc.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.siteID = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- projID returns the code used to link to the reader's language's project&lt;br /&gt;
-- e.g &amp;quot;en&amp;quot; for [[:en:WikidataIB]]&lt;br /&gt;
-- treats &amp;quot;en-gb&amp;quot; as &amp;quot;en&amp;quot;, etc.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.projID = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- formatNumber formats a number according to the the supplied language code (&amp;quot;|lang=&amp;quot;)&lt;br /&gt;
-- or the default language if not supplied.&lt;br /&gt;
-- The number is the first unnamed parameter or &amp;quot;|num=&amp;quot;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: findLang()&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.formatNumber = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- examine dumps the property (the unnamed parameter or pid)&lt;br /&gt;
-- from the item given by the parameter 'qid' (or the other unnamed parameter)&lt;br /&gt;
-- or from the item corresponding to the current page if qid is not supplied.&lt;br /&gt;
-- e.g. {{#invoke:WikidataIB |examine |pid=P26 |qid=Q42}}&lt;br /&gt;
-- or {{#invoke:WikidataIB |examine |P26 |Q42}} or any combination of these&lt;br /&gt;
-- or {{#invoke:WikidataIB |examine |P26}} for the current page.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.examine = function( frame )&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- checkvalue looks for 'val' as a wikibase-item value of a property (the unnamed parameter or pid)&lt;br /&gt;
-- from the item given by the parameter 'qid'&lt;br /&gt;
-- or from the Wikidata item associated with the current page if qid is not supplied.&lt;br /&gt;
-- It only checks ranks that are requested (preferred and normal by default)&lt;br /&gt;
-- If property is not supplied, then P31 (instance of) is assumed.&lt;br /&gt;
-- It returns val if found or nothing if not found.&lt;br /&gt;
-- e.g. {{#invoke:WikidataIB |checkvalue |val=Q5 |pid=P31 |qid=Q42}}&lt;br /&gt;
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31 |qid=Q42}}&lt;br /&gt;
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |qid=Q42}}&lt;br /&gt;
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31}} for the current page.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.checkvalue = function( frame )&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- url2 takes a parameter url= that is a proper url and formats it for use in an infobox.&lt;br /&gt;
-- If no parameter is supplied, it returns nothing.&lt;br /&gt;
-- This is the equivalent of Template:URL&lt;br /&gt;
-- but it keeps the &amp;quot;edit at Wikidata&amp;quot; pen icon out of the microformat.&lt;br /&gt;
-- Usually it will take its url parameter directly from a Wikidata call:&lt;br /&gt;
-- e.g. {{#invoke:WikidataIB |url2 |url={{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.url2 = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getWebsite fetches the Official website (P856) and formats it for use in an infobox.&lt;br /&gt;
-- This is similar to Template:Official website but with a url displayed,&lt;br /&gt;
-- and it adds the &amp;quot;edit at Wikidata&amp;quot; pen icon beyond the microformat if enabled.&lt;br /&gt;
-- A local value will override the Wikidata value. &amp;quot;NONE&amp;quot; returns nothing.&lt;br /&gt;
-- e.g. {{#invoke:WikidataIB |getWebsite |qid= |noicon= |lang= |url= }}&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: findLang(); parseParam();&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getWebsite = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAllLabels fetches the set of labels and formats it for display as wikitext.&lt;br /&gt;
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getAllLabels = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAllDescriptions fetches the set of descriptions and formats it for display as wikitext.&lt;br /&gt;
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getAllDescriptions = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAllAliases fetches the set of aliases and formats it for display as wikitext.&lt;br /&gt;
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.getAllAliases = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- showNoLinks displays the article titles that should not be linked.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
p.showNoLinks = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- checkValidity checks whether the first unnamed parameter represents a valid entity-id,&lt;br /&gt;
-- that is, something like Q1235 or P123.&lt;br /&gt;
-- It returns the strings &amp;quot;true&amp;quot; or &amp;quot;false&amp;quot;.&lt;br /&gt;
-- Change false to nil to return &amp;quot;true&amp;quot; or &amp;quot;&amp;quot; (easier to test with #if:).&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: none&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
function p.checkValidity(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getEntityFromTitle returns the Entity-ID (Q-number) for a given title.&lt;br /&gt;
-- Modification of Module:ResolveEntityId&lt;br /&gt;
-- The title is the first unnamed parameter.&lt;br /&gt;
-- The site parameter determines the site/language for the title. Defaults to current wiki.&lt;br /&gt;
-- The showdab parameter determines whether dab pages should return the Q-number or nil. Defaults to true.&lt;br /&gt;
-- Returns the Q-number or nil if it does not exist.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
function p.getEntityFromTitle(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getDatePrecision returns the number representing the precision of the first best date value&lt;br /&gt;
-- for the given property.&lt;br /&gt;
-- It takes the qid and property ID&lt;br /&gt;
-- The meanings are given at https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times&lt;br /&gt;
-- 0 = 1 billion years .. 6 = millennium, 7 = century, 8 = decade, 9 = year, 10 = month, 11 = day&lt;br /&gt;
-- Returns 0 (or the second unnamed parameter) if the Wikidata does not exist.&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Dependencies: parseParam; sourced;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
function p.getDatePrecision(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Wikidata&amp;diff=5304688</id>
		<title>Module:Wikidata</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Wikidata&amp;diff=5304688"/>
		<updated>2023-05-19T12:09:43Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Retain API but remove functionality&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- vim: set noexpandtab ft=lua ts=4 sw=4:&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.descriptionIn(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.labelIn(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get a value, or a comma separated list of them if multiple values exist&lt;br /&gt;
p.getValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Same as above, but uses the short name property for label if available.&lt;br /&gt;
p.getValueShortName = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get a value, or a comma separated list of them if multiple values exist&lt;br /&gt;
-- from an arbitrary entry by using its QID.&lt;br /&gt;
-- Use : {{#invoke:Wikidata|getValueFromID|&amp;lt;ID&amp;gt;|&amp;lt;Property&amp;gt;|FETCH_WIKIDATA}}&lt;br /&gt;
-- E.g.: {{#invoke:Wikidata|getValueFromID|Q151973|P26|FETCH_WIKIDATA}} - to fetch value of 'spouse' (P26) from 'Richard Burton' (Q151973)&lt;br /&gt;
-- Please use sparingly - this is an *expensive call*.&lt;br /&gt;
p.getValueFromID = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
local function getQualifier(frame, outputHook) &lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
p.getQualifierValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get a value like 'male' (for property p21) which won't be linked and numbers without the thousand separators&lt;br /&gt;
p.getRawValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get the unit name for the numeric value returned by getRawValue&lt;br /&gt;
p.getUnits = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get the unit's QID to use with the numeric value returned by getRawValue&lt;br /&gt;
p.getUnitID = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getRawQualifierValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get a date value for date_of_birth (P569), etc. which won't be linked&lt;br /&gt;
-- Dates and times are stored in ISO 8601 format (sort of).&lt;br /&gt;
-- At present the local formatDate(date, precision, timezone) function doesn't handle timezone&lt;br /&gt;
-- So I'll just supply &amp;quot;Z&amp;quot; in the call to formatDate below:&lt;br /&gt;
p.getDateValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
p.getQualifierDateValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to fetch all of the images with a particular property, e.g. image (P18), Gene Atlas Image (P692), etc.&lt;br /&gt;
-- Parameters are | propertyID | value / FETCH_WIKIDATA / nil | separator (default=space) | size (default=frameless)&lt;br /&gt;
-- It will return a standard wiki-markup [[File:Filename | size]] for each image with a selectable size and separator (which may be html)&lt;br /&gt;
-- e.g. {{#invoke:Wikidata|getImages|P18|FETCH_WIKIDATA}}&lt;br /&gt;
-- e.g. {{#invoke:Wikidata|getImages|P18|FETCH_WIKIDATA|&amp;lt;br&amp;gt;|250px}}&lt;br /&gt;
-- If a property is chosen that is not of type &amp;quot;commonsMedia&amp;quot;, it will return empty text.&lt;br /&gt;
p.getImages = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get the TA98 (Terminologia Anatomica first edition 1998) values like 'A01.1.00.005' (property P1323)&lt;br /&gt;
-- which are then linked to http://www.unifr.ch/ifaa/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/01.1.00.005%20Entity%20TA98%20EN.htm&lt;br /&gt;
-- uses the newer mw.wikibase calls instead of directly using the snaks&lt;br /&gt;
-- formatPropertyValues returns a table with the P1323 values concatenated with &amp;quot;, &amp;quot; so we have to split them out into a table in order to construct the return string&lt;br /&gt;
p.getTAValue = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
This is used to return an image legend from Wikidata&lt;br /&gt;
image is property P18&lt;br /&gt;
image legend is property P2096&lt;br /&gt;
&lt;br /&gt;
Call as {{#invoke:Wikidata |getImageLegend | &amp;lt;PARAMETER&amp;gt; | lang=&amp;lt;ISO-639code&amp;gt; |id=&amp;lt;QID&amp;gt;}}&lt;br /&gt;
Returns PARAMETER, unless it is equal to &amp;quot;FETCH_WIKIDATA&amp;quot;, from Item QID (expensive call)&lt;br /&gt;
If QID is omitted or blank, the current article is used (not an expensive call)&lt;br /&gt;
If lang is omitted, it uses the local wiki language, otherwise it uses the provided ISO-639 language code&lt;br /&gt;
ISO-639: https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html#wp1252447&lt;br /&gt;
&lt;br /&gt;
Ranks are: 'preferred' &amp;gt; 'normal'&lt;br /&gt;
This returns the label from the first image with 'preferred' rank&lt;br /&gt;
Or the label from the first image with 'normal' rank if preferred returns nothing&lt;br /&gt;
Ranks: https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
p.getImageLegend = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is used to get the QIDs of all of the values of a property, as a comma separated list if multiple values exist&lt;br /&gt;
-- Usage: {{#invoke:Wikidata |getPropertyIDs |&amp;lt;PropertyID&amp;gt; |FETCH_WIKIDATA}}&lt;br /&gt;
-- Usage: {{#invoke:Wikidata |getPropertyIDs |&amp;lt;PropertyID&amp;gt; |&amp;lt;InputParameter&amp;gt; |qid=&amp;lt;QID&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
p.getPropertyIDs = function(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- returns the page id (Q...) of the current page or nothing of the page is not connected to Wikidata&lt;br /&gt;
function p.pageId(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.claim(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- look into entity object&lt;br /&gt;
function p.ViewSomething(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- getting sitelink of a given wiki&lt;br /&gt;
-- get sitelink of current item if qid not supplied&lt;br /&gt;
function p.getSiteLink(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.Dump(frame)&lt;br /&gt;
	return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Video_game_wikidata&amp;diff=5304687</id>
		<title>Module:Video game wikidata</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Video_game_wikidata&amp;diff=5304687"/>
		<updated>2023-05-19T11:55:21Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Created page with &amp;quot;local Date = require('Module:Date')._Date local yesno = require('Module:Yesno')  local p = {}  -- Local variables. local reviewer = nil; local df = &amp;quot;mdy&amp;quot;; local entity = nil;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local Date = require('Module:Date')._Date&lt;br /&gt;
local yesno = require('Module:Yesno')&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Local variables.&lt;br /&gt;
local reviewer = nil;&lt;br /&gt;
local df = &amp;quot;mdy&amp;quot;;&lt;br /&gt;
local entity = nil;&lt;br /&gt;
local genRefs = true;&lt;br /&gt;
local showSystem = true;&lt;br /&gt;
local showUpdateLink = true;&lt;br /&gt;
local system = nil;&lt;br /&gt;
local systemId = nil;&lt;br /&gt;
local systemFormat = &amp;quot;colon&amp;quot;;&lt;br /&gt;
local updateLinkStyle = nil;&lt;br /&gt;
local entities = {};&lt;br /&gt;
&lt;br /&gt;
-- Translation table for converting numeric-IDs to shorthand aliases.&lt;br /&gt;
local systemAliases = {&lt;br /&gt;
	[10677] = 'PS1',&lt;br /&gt;
	[1323662] = 'PS1', -- Placeholder, this is actually the series but could be mistakenly used for PS1.&lt;br /&gt;
	[10680] = 'PS2',&lt;br /&gt;
	[10683] = 'PS3',&lt;br /&gt;
	[5014725] = 'PS4',&lt;br /&gt;
	[16338] = 'PC',&lt;br /&gt;
	[8079] = 'Wii',&lt;br /&gt;
	[56942] = 'WiiU',&lt;br /&gt;
	[132020] = 'XBOX',&lt;br /&gt;
	[48263] = 'X360',&lt;br /&gt;
	[13361286] = 'XONE',&lt;br /&gt;
	[203597] = '3DS',&lt;br /&gt;
	[188808] = 'PSV',&lt;br /&gt;
	[170323] = 'DS', -- Sometimes has been NDS&lt;br /&gt;
	[170325] = 'PSP',&lt;br /&gt;
	[48493] = 'IOS', -- iOS, iPhone, iPad&lt;br /&gt;
	[94] = 'AND', -- Android&lt;br /&gt;
	[186437] = 'GB',&lt;br /&gt;
	[188642] = 'GBA',&lt;br /&gt;
	[203992] = 'GBC',&lt;br /&gt;
	[184198] = 'DC',&lt;br /&gt;
	[200912] = 'SAT',&lt;br /&gt;
	[172742] = 'NES',&lt;br /&gt;
	[183259] = 'SNES',&lt;br /&gt;
	[184839] = 'N64',&lt;br /&gt;
	[182172] = 'GC', -- Sometimes has been NGC&lt;br /&gt;
	[19610114] = 'NS' -- Nintendo Switch&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Translation table for converting system aliases to QIDs&lt;br /&gt;
local systemIDs = {&lt;br /&gt;
	['PS1'] = 10677,&lt;br /&gt;
	['PS2'] = 10680,&lt;br /&gt;
	['PS3'] = 10683,&lt;br /&gt;
	['PS4'] = 5014725,&lt;br /&gt;
	['PC'] = 16338,&lt;br /&gt;
	['WII'] = 8079,&lt;br /&gt;
	['WIIU'] = 56942,&lt;br /&gt;
	['XBOX'] = 132020,&lt;br /&gt;
	['X360'] = 48263,&lt;br /&gt;
	['XONE'] = 13361286,&lt;br /&gt;
	['3DS'] = 203597,&lt;br /&gt;
	['PSV'] = 188808,&lt;br /&gt;
	['DS'] = 170323,&lt;br /&gt;
	['NDS'] = 170323,&lt;br /&gt;
	['PSP'] = 170325,&lt;br /&gt;
	['IOS'] = 48493,&lt;br /&gt;
	['AND'] = 94,&lt;br /&gt;
	['GB'] = 186437,&lt;br /&gt;
	['GBA'] = 188642,&lt;br /&gt;
	['GBC'] = 203992,&lt;br /&gt;
	['DC'] = 184198,&lt;br /&gt;
	['SAT'] = 200912,&lt;br /&gt;
	['NES'] = 172742,&lt;br /&gt;
	['SNES'] = 183259,&lt;br /&gt;
	['N64'] = 184839,&lt;br /&gt;
	['GC'] = 182172,&lt;br /&gt;
	['NGC'] = 182172,&lt;br /&gt;
	['NS'] = 19610114&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- List of accepted aggregator arguments and their related QID.&lt;br /&gt;
local aggregatorAliases = {&lt;br /&gt;
    [150248] = 'MC',&lt;br /&gt;
    [40160] = 'GR',&lt;br /&gt;
    [21039459] = 'OC'&lt;br /&gt;
}   &lt;br /&gt;
&lt;br /&gt;
-- List of accepted aggregator arguments and their related QID.&lt;br /&gt;
local aggregatorIDs = {&lt;br /&gt;
    ['MC'] = 150248,&lt;br /&gt;
    ['GR'] = 40160,&lt;br /&gt;
    ['OC'] = 21039459&lt;br /&gt;
}   &lt;br /&gt;
&lt;br /&gt;
-- List of accepted reviewer arguments and their related QID.&lt;br /&gt;
local reviewerAliases = {&lt;br /&gt;
	[591573] = 'FAM',&lt;br /&gt;
	[207708] = 'IGN'&lt;br /&gt;
}   &lt;br /&gt;
&lt;br /&gt;
-- List of accepted reviewer arguments and their related QID.&lt;br /&gt;
local reviewerIDs = {&lt;br /&gt;
	['FAM'] = 591573,&lt;br /&gt;
	['IGN'] = 207708&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
local function sortByPlatform(a,b) &lt;br /&gt;
	local platformA = nil;&lt;br /&gt;
	local platformB = nil;&lt;br /&gt;
	if(a['qualifiers']['P400'] ~= nil and b['qualifiers']['P400'][1] ~= nil) then&lt;br /&gt;
		platformA = p.getSystemAlias(a['qualifiers']['P400'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
		if(platformA == nil) then&lt;br /&gt;
			platformA = mw.wikibase.label('Q'..a['qualifiers']['P400'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
		end;&lt;br /&gt;
	end;&lt;br /&gt;
	if(b['qualifiers']['P400'] ~= nil and b['qualifiers']['P400'][1] ~= nil) then&lt;br /&gt;
		platformB = p.getSystemAlias(b['qualifiers']['P400'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
		if(platformB == nil) then&lt;br /&gt;
			platformB = mw.wikibase.label('Q'..b['qualifiers']['P400'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
		end;&lt;br /&gt;
	end;		&lt;br /&gt;
		&lt;br /&gt;
	return platformA &amp;lt; platformB&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
local function buildCite(reference) &lt;br /&gt;
	local referenceUrl = nil;&lt;br /&gt;
	local cite = nil;&lt;br /&gt;
	&lt;br /&gt;
	if(reference['snaks']['P854'] ~= nil and reference['snaks']['P854'][1] ~= nil) then&lt;br /&gt;
		referenceUrl = reference['snaks']['P854'][1]['datavalue']['value'];	&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	if(referenceUrl ~= nil and referenceUrl ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		cite = &amp;quot;{{cite web|url=&amp;quot;..referenceUrl;&lt;br /&gt;
			&lt;br /&gt;
		local pubdate = nil;&lt;br /&gt;
		local accessdate = nil;&lt;br /&gt;
		local publisher = nil;&lt;br /&gt;
		local work = nil;&lt;br /&gt;
		local title = nil;&lt;br /&gt;
		local archiveUrl = nil;&lt;br /&gt;
		local archiveDate = nil;&lt;br /&gt;
		local authors = {};&lt;br /&gt;
&lt;br /&gt;
		if(reference['snaks']['P577'] ~= nil and reference['snaks']['P577'][1] ~= nil) then&lt;br /&gt;
			pubdate = reference['snaks']['P577'][1]['datavalue']['value']['time'];&lt;br /&gt;
		end;&lt;br /&gt;
		if(reference['snaks']['P813'] ~= nil and reference['snaks']['P813'][1] ~= nil) then&lt;br /&gt;
			accessdate = reference['snaks']['P813'][1]['datavalue']['value']['time'];&lt;br /&gt;
		end;&lt;br /&gt;
		if(reference['snaks']['P123'] ~= nil and reference['snaks']['P123'][1] ~= nil) then&lt;br /&gt;
			publisher = mw.wikibase.label('Q'..reference['snaks']['P123'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
		end;&lt;br /&gt;
		if(reference['snaks']['P1433'] ~= nil and reference['snaks']['P1433'][1] ~= nil) then&lt;br /&gt;
			work = mw.wikibase.label('Q'..reference['snaks']['P1433'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
		end;			&lt;br /&gt;
		if(reference['snaks']['P1476'] ~= nil and reference['snaks']['P1476'][1] ~= nil) then&lt;br /&gt;
			title = reference['snaks']['P1476'][1]['datavalue']['value']['text'];&lt;br /&gt;
		end;&lt;br /&gt;
		if(reference['snaks']['P1065'] ~= nil and reference['snaks']['P1065'][1] ~= nil) then&lt;br /&gt;
			archiveUrl = reference['snaks']['P1065'][1]['datavalue']['value'];&lt;br /&gt;
		end;&lt;br /&gt;
		if(reference['snaks']['P2960'] ~= nil and reference['snaks']['P2960'][1] ~= nil) then&lt;br /&gt;
			archiveDate = reference['snaks']['P2960'][1]['datavalue']['value']['time'];&lt;br /&gt;
		end;	&lt;br /&gt;
		if(reference['snaks']['P50'] ~= nil and #reference['snaks']['P50'] &amp;gt; 0) then&lt;br /&gt;
			for i,authorDat in pairs(reference['snaks']['P50']) do&lt;br /&gt;
				local authorQid = 'Q'..authorDat['datavalue']['value']['numeric-id'];&lt;br /&gt;
				if(entities[authorQid] == nil) then&lt;br /&gt;
					entities[authorQid] = mw.wikibase.getEntity(authorQid);&lt;br /&gt;
				end;&lt;br /&gt;
				&lt;br /&gt;
				local author = {};&lt;br /&gt;
				author['fullname'] = mw.wikibase.label(authorQid); -- Default to label&lt;br /&gt;
				author['first'] = nil;&lt;br /&gt;
				author['last'] = nil;&lt;br /&gt;
				&lt;br /&gt;
				if(entities[authorQid]['claims']['P735'] ~= nil and entities[authorQid]['claims']['P735'][1] ~= nil) then&lt;br /&gt;
					author['first'] = mw.wikibase.label('Q'..entities[authorQid]['claims']['P735'][1]['mainsnak']['datavalue']['value']['numeric-id']);&lt;br /&gt;
				end;&lt;br /&gt;
				if(entities[authorQid]['claims']['P734'] ~= nil and entities[authorQid]['claims']['P734'][1] ~= nil) then&lt;br /&gt;
					author['last'] = mw.wikibase.label('Q'..entities[authorQid]['claims']['P734'][1]['mainsnak']['datavalue']['value']['numeric-id']);&lt;br /&gt;
				end;&lt;br /&gt;
				&lt;br /&gt;
				table.insert(authors, author);&lt;br /&gt;
			end;&lt;br /&gt;
		end;			&lt;br /&gt;
		&lt;br /&gt;
		if(title ~= nil and title ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
			cite = cite .. &amp;quot;|title=&amp;quot;..title;&lt;br /&gt;
		end;&lt;br /&gt;
		if(publisher ~= nil and publisher ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
			cite = cite .. &amp;quot;|publisher=&amp;quot;..publisher;&lt;br /&gt;
		end;&lt;br /&gt;
		if(work ~= nil and work ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
			cite = cite .. &amp;quot;|work=&amp;quot;..work;&lt;br /&gt;
		end;		&lt;br /&gt;
		if(pubdate ~= nil and pubdate ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
			local pubdateText = Date(pubdate):text(df);&lt;br /&gt;
&lt;br /&gt;
			cite = cite .. &amp;quot;|date=&amp;quot;..pubdateText;&lt;br /&gt;
		end;		&lt;br /&gt;
		if(accessdate ~= nil and accessdate ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
			local accessdateText = Date(accessdate):text(df);&lt;br /&gt;
&lt;br /&gt;
			cite = cite .. &amp;quot;|accessdate=&amp;quot;..accessdateText;&lt;br /&gt;
		end;&lt;br /&gt;
		if(archiveUrl ~= nil and archiveUrl ~= &amp;quot;&amp;quot; and archiveDate ~= nil and archiveDate ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		    local archivedateText = Date(archiveDate):text(df);&lt;br /&gt;
			cite = cite .. &amp;quot;|archiveurl=&amp;quot;..archiveUrl;&lt;br /&gt;
			cite = cite .. &amp;quot;|archivedate=&amp;quot;..archivedateText;&lt;br /&gt;
		end;		&lt;br /&gt;
		if(#authors &amp;gt; 0) then&lt;br /&gt;
			for i,author in pairs(authors) do&lt;br /&gt;
				if(author['first'] ~= nil and author['last'] ~= nil and author['first'] ~= &amp;quot;&amp;quot; and author['last'] ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
					if(#authors == 1) then&lt;br /&gt;
						cite = cite ..&amp;quot;|last=&amp;quot;..author['last']..&amp;quot;|first=&amp;quot;..author['first'];&lt;br /&gt;
					else&lt;br /&gt;
						cite = cite ..&amp;quot;|last&amp;quot;..i..&amp;quot;=&amp;quot;..author['last']..&amp;quot;|first&amp;quot;..i..&amp;quot;=&amp;quot;..author['first'];&lt;br /&gt;
					end;&lt;br /&gt;
				else&lt;br /&gt;
					if(#authors == 1) then&lt;br /&gt;
						cite = cite ..&amp;quot;|author=&amp;quot;..author['fullname'];&lt;br /&gt;
					else&lt;br /&gt;
						cite = cite ..&amp;quot;|author&amp;quot;..i..&amp;quot;=&amp;quot;..author['fullname'];&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;
		cite = cite..'}}';	&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	return cite;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
local function printReviewRow(frame, reviewscore)&lt;br /&gt;
	local score = nil;&lt;br /&gt;
&lt;br /&gt;
	if(reviewscore['mainsnak']['datavalue'] ~= nil and reviewscore['mainsnak']['datavalue']['value'] ~= nil) then&lt;br /&gt;
		score = reviewscore['mainsnak']['datavalue']['value'];&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;;&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	local ret = &amp;quot;&amp;quot;&lt;br /&gt;
	local system = nil;&lt;br /&gt;
	local reference = nil;	&lt;br /&gt;
&lt;br /&gt;
	if(reviewscore['qualifiers']['P400'] ~= nil and reviewscore['qualifiers']['P400'][1] ~= nil) then&lt;br /&gt;
		system = p.getSystemAlias(reviewscore['qualifiers']['P400'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
	end	&lt;br /&gt;
	if(system ~= nil and system ~= &amp;quot;&amp;quot; and showSystem) then&lt;br /&gt;
		if(systemFormat == &amp;quot;para&amp;quot;) then&lt;br /&gt;
			ret = ret..&amp;quot;(&amp;quot;..system..&amp;quot;) &amp;quot;;&lt;br /&gt;
		else&lt;br /&gt;
			ret = ret..system..&amp;quot;: &amp;quot;;&lt;br /&gt;
		end;&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	ret = ret..score;&lt;br /&gt;
&lt;br /&gt;
	if(reviewscore['references'] ~= nil and reviewscore['references'][1] ~= nil and genRefs) then&lt;br /&gt;
		local cite = buildCite(reviewscore['references'][1]);&lt;br /&gt;
		&lt;br /&gt;
		if(cite ~= nil) then&lt;br /&gt;
			local scoreBy = p.getAggregatorAlias(reviewscore['qualifiers']['P447'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
			if(scoreBy == nil) then&lt;br /&gt;
				scoreBy = p.getReviewerAlias(reviewscore['qualifiers']['P447'][1]['datavalue']['value']['numeric-id']);&lt;br /&gt;
			end;&lt;br /&gt;
&lt;br /&gt;
			local name = entity:getLabel()..'-'..scoreBy;&lt;br /&gt;
			if(system ~= nil and system ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
				name = name..system;&lt;br /&gt;
			end;&lt;br /&gt;
&lt;br /&gt;
			cite = frame:extensionTag{ name = &amp;quot;ref&amp;quot;, args = {name=name}, content=cite };&lt;br /&gt;
			ret = ret..cite;&lt;br /&gt;
		end;&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	return ret..&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getSystemAlias(numericId)&lt;br /&gt;
	return systemAliases[numericId];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getSystemID(system)&lt;br /&gt;
	return systemIDs[system];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getAggregatorAlias(numericId)&lt;br /&gt;
	return aggregatorAliases[numericId];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getAggregatorID(system)&lt;br /&gt;
	return aggregatorIDs[system];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getReviewerAlias(numericId)&lt;br /&gt;
	return reviewerAliases[numericId];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getReviewerID(system)&lt;br /&gt;
	return reviewerIDs[system];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.setReviewer(iReviewer)&lt;br /&gt;
	-- No reviewer, stop. Must have reviewer at least.&lt;br /&gt;
	if(iReviewer == nil or iReviewer == &amp;quot;&amp;quot;) then&lt;br /&gt;
		return &amp;quot;Missing reviewer&amp;quot;;&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	-- See if supplied reviewer is in the aggregator table.&lt;br /&gt;
	iReviewer = string.upper(iReviewer)&lt;br /&gt;
	reviewer = p.getAggregatorID(iReviewer);&lt;br /&gt;
	if(reviewer == nil or reviewer == &amp;quot;&amp;quot;) then&lt;br /&gt;
		-- No? Maybe in the reviewer table.&lt;br /&gt;
		reviewer = p.getReviewerID(iReviewer);&lt;br /&gt;
		if(reviewer == nil or reviewer == &amp;quot;&amp;quot;) then&lt;br /&gt;
			return &amp;quot;Invalid reviewer&amp;quot;;&lt;br /&gt;
		end;&lt;br /&gt;
	end;	&lt;br /&gt;
&lt;br /&gt;
	return nil;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setDateFormat(iDf)&lt;br /&gt;
	-- Check for a date format parameter. Default to mdy if missing.&lt;br /&gt;
	if(iDf ~= nil and iDf ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		df = string.lower(iDf);&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setSystemFormat(iSf)&lt;br /&gt;
	if(iSf ~= nil and iSf ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		systemFormat = string.lower(iSf);&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setUpdateLinkStyle(iStyle)&lt;br /&gt;
	if(iStyle ~= nil and iStyle ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		updateLinkStyle = string.lower(iStyle);&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setGame(iGame)&lt;br /&gt;
	-- Check for a game parameter. If missing, default to current article.&lt;br /&gt;
	if(iGame ~= nil and iGame ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		if(entities[iGame] == nil and mw.wikibase ~= nil) then&lt;br /&gt;
 			entities[iGame] = mw.wikibase.getEntity(iGame);&lt;br /&gt;
		end;&lt;br /&gt;
		&lt;br /&gt;
		entity = entities[iGame]&lt;br /&gt;
	else&lt;br /&gt;
		-- Need to research if we can determine the entity's ID before retrieving it.&lt;br /&gt;
		if(mw.wikibase ~= nil) then&lt;br /&gt;
			entity = mw.wikibase.getEntity();&lt;br /&gt;
			if(entity ~= nil) then&lt;br /&gt;
				entities[entity['id']] = entity;&lt;br /&gt;
			end;&lt;br /&gt;
		end;&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	if(entity == nil) then&lt;br /&gt;
		return &amp;quot;No matching wikidata entity found&amp;quot;;&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	return nil;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setSystem(iSystem)&lt;br /&gt;
	-- Check for system parameter, and resolve it's QID if possible.&lt;br /&gt;
	if(iSystem ~= nil and iSystem ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		system = string.upper(iSystem);&lt;br /&gt;
		systemId = p.getSystemID(system);&lt;br /&gt;
	elseif(not showSystem) then&lt;br /&gt;
		-- If no system was specified, force showSystem on.&lt;br /&gt;
		showSystem = true;&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setGenerateReferences(iGenRefs)&lt;br /&gt;
	-- Reference suppression.&lt;br /&gt;
	if(iGenRefs ~= nil and iGenRefs ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		genRefs = yesno(iGenRefs, true);&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setShowSystem(iShowSystem)&lt;br /&gt;
	-- Suppression of system aliases in front of score, i.e. (XBOX) xx/100.&lt;br /&gt;
	if(iShowSystem ~= nil and iShowSystem ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		showSystem = yesno(iShowSystem, false);&lt;br /&gt;
	end;&lt;br /&gt;
	if(system == nil or system == '') then&lt;br /&gt;
		-- If no system was specified, force showSystem on.&lt;br /&gt;
		showSystem = true;&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.setShowUpdateLink(iShowUpdateLink)&lt;br /&gt;
	-- Suppression of update link to Wikidata at the end of the score, i.e. (XBOX) xx/100[+].&lt;br /&gt;
	if(iShowUpdateLink ~= nil and iShowUpdateLink ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		showUpdateLink = yesno(iShowUpdateLink, false);&lt;br /&gt;
	end;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getUpdateLink()&lt;br /&gt;
	if(updateLinkStyle == &amp;quot;pen&amp;quot;) then&lt;br /&gt;
		return &amp;quot;[[File:Blue pencil.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/&amp;quot;..entity['id']..&amp;quot;?uselang=&amp;quot;..mw.language.getContentLanguage().code..&amp;quot;#P444|Edit this on Wikidata]]&amp;quot;;&lt;br /&gt;
	elseif(updateLinkStyle == &amp;quot;noSub&amp;quot;) then&lt;br /&gt;
		return '[[d:'..entity['id']..'#P444|&amp;amp;#91;±&amp;amp;#93;]]';&lt;br /&gt;
	elseif(updateLinkStyle == &amp;quot;text and pen&amp;quot;) then&lt;br /&gt;
		return '&amp;lt;span style=&amp;quot;position: relative;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;position: absolute; right: 0;&amp;quot;&amp;gt;[[File:Blue pencil.svg|10px|baseline|link=|alt=]]&amp;lt;/span&amp;gt;[[d:'..entity['id']..'#P444|&amp;lt;span style=&amp;quot;position: relative; padding-right: 14px;&amp;quot;&amp;gt;Edit on Wikidata&amp;lt;/span&amp;gt;]]&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	return '&amp;lt;sub&amp;gt;[[d:'..entity['id']..'#P444|&amp;amp;#91;±&amp;amp;#93;]]&amp;lt;/sub&amp;gt;';&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getSitelink()&lt;br /&gt;
	return mw.wikibase.sitelink(entity['id']);&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getLabel()&lt;br /&gt;
	return mw.wikibase.label(entity['id']);&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getParts()&lt;br /&gt;
	local ret = {};	&lt;br /&gt;
	&lt;br /&gt;
	-- Loop all of &amp;quot;has Part&amp;quot; for this title&lt;br /&gt;
	local parts = entity['claims']['P527'];	&lt;br /&gt;
	if(parts) then&lt;br /&gt;
		for i,part in pairs(parts) do&lt;br /&gt;
			table.insert(ret,&amp;quot;Q&amp;quot;..part['mainsnak']['datavalue']['value']['numeric-id']);&lt;br /&gt;
		end;		&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	return ret;	&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.getEarliestPublicationDate()&lt;br /&gt;
	local ret = {};&lt;br /&gt;
	&lt;br /&gt;
	local pubDates = entity['claims']['P577'];	&lt;br /&gt;
	if(pubDates) then&lt;br /&gt;
		for i,pubDate in pairs(pubDates) do&lt;br /&gt;
			local timestamp = pubDate['mainsnak']['datavalue']['value']['time'];&lt;br /&gt;
			local accessdate = Date(timestamp);	&lt;br /&gt;
			table.insert(ret,accessdate);&lt;br /&gt;
		end;		&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	if(#ret &amp;lt; 1) then&lt;br /&gt;
		return nil;&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	table.sort(ret);&lt;br /&gt;
	&lt;br /&gt;
	return ret[1];&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
function p.printReviewScores(frame)&lt;br /&gt;
	local ret = &amp;quot;&amp;quot;;	&lt;br /&gt;
	&lt;br /&gt;
	-- Loop all of &amp;quot;review scores&amp;quot; for this title&lt;br /&gt;
	local reviewscores = entity['claims']['P444'];	&lt;br /&gt;
	if(reviewscores) then&lt;br /&gt;
		-- Find reviews that qualify for printing and insert into array.&lt;br /&gt;
		local reviewsToPrint = {}&lt;br /&gt;
    	for i,review in pairs(reviewscores) do&lt;br /&gt;
    		if(review['qualifiers'] ~= nil) then&lt;br /&gt;
				local scoreBy = nil &lt;br /&gt;
				if(review['qualifiers']['P447'] ~= nil and review['qualifiers']['P447'][1] ~= nil) then&lt;br /&gt;
					scoreBy = review['qualifiers']['P447'][1]['datavalue']['value']['numeric-id'];&lt;br /&gt;
				end;&lt;br /&gt;
				if(scoreBy == reviewer) then&lt;br /&gt;
					-- If template specified a system, we need to check for the specific system and only output that one.&lt;br /&gt;
					if(system == nil or system == &amp;quot;&amp;quot;) then&lt;br /&gt;
						-- No system specified, so output each one found.&lt;br /&gt;
						table.insert(reviewsToPrint,review);&lt;br /&gt;
					else&lt;br /&gt;
						-- Get platform if it exists.&lt;br /&gt;
						if(review['qualifiers']['P400'] ~= nil and review['qualifiers']['P400'][1] ~= nil) then&lt;br /&gt;
							-- Try to match based on QID.&lt;br /&gt;
							local reviewSysId = review['qualifiers']['P400'][1]['datavalue']['value']['numeric-id'];&lt;br /&gt;
							if(systemId == reviewSysId) then&lt;br /&gt;
								table.insert(reviewsToPrint,review);&lt;br /&gt;
							else &lt;br /&gt;
								-- If that failed, try to match based on label.&lt;br /&gt;
								local systemName = mw.wikibase.label('Q'..reviewSysId);&lt;br /&gt;
								if(systemName ~= nil and string.upper(systemName) == system) then&lt;br /&gt;
									table.insert(reviewsToPrint,review);&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;
		end;&lt;br /&gt;
	&lt;br /&gt;
		-- Sort the array by platform label.&lt;br /&gt;
    	table.sort(reviewsToPrint, sortByPlatform);&lt;br /&gt;
    	&lt;br /&gt;
    	-- If a system was not specified, showSystem has defaulted to true. If this title only has one platform and one review, we will turn it off.&lt;br /&gt;
    	-- Note: If the title has zero or more platforms defined, we leave showSystem on. We are unable to determine if this is a single-platform game.&lt;br /&gt;
    	--if((system == nil or system == &amp;quot;&amp;quot;) and #reviewsToPrint == 1 and entity['claims']['P400'] ~= nil and #entity['claims']['P400'] == 1) then&lt;br /&gt;
    	-- Simplifying this based on discussion at [Template:Video game reviews]. If there's only one review, don't display system unless explicitly requested.&lt;br /&gt;
    	if((system == nil or system == &amp;quot;&amp;quot;) and #reviewsToPrint == 1) then&lt;br /&gt;
    		showSystem = false;&lt;br /&gt;
    	end;&lt;br /&gt;
&lt;br /&gt;
		-- Print the reviews&lt;br /&gt;
    	for i,review in ipairs(reviewsToPrint) do&lt;br /&gt;
    		ret = ret .. printReviewRow(frame, review);&lt;br /&gt;
		end;&lt;br /&gt;
	end;&lt;br /&gt;
&lt;br /&gt;
	if(ret ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		ret = string.sub(ret, 1, -7);&lt;br /&gt;
	elseif(not showUpdateLink) then&lt;br /&gt;
		ret = nil;&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	-- Add edit link at end if showUpdateLink is on.&lt;br /&gt;
	if(showUpdateLink) then &lt;br /&gt;
		ret = ret .. p.getUpdateLink();&lt;br /&gt;
	end;	&lt;br /&gt;
&lt;br /&gt;
	return ret;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Official_website&amp;diff=5304686</id>
		<title>Module:Official website</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Official_website&amp;diff=5304686"/>
		<updated>2023-05-19T11:48:54Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Replaced content with &amp;quot;local p = {}  function p.main(frame) 	return '' end  return p&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:EditAtWikidata&amp;diff=5304685</id>
		<title>Module:EditAtWikidata</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:EditAtWikidata&amp;diff=5304685"/>
		<updated>2023-05-19T11:47:41Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- Module to display an icon with a tooltip such as &amp;quot;Edit this at Wikidata&amp;quot;.&lt;br /&gt;
-- Icon will be linked to the Wikidata entry for the article where this is placed.&lt;br /&gt;
-- This message is only displayed if a local_parameter is not supplied&lt;br /&gt;
-- i.e. when called from a template, it can be coded not to display the message&lt;br /&gt;
-- when a local parameter is in use, preventing the value form Wikidata being fetched.&lt;br /&gt;
-- The qid of a Wikidata entry can optionally be supplied for testing outside the article.&lt;br /&gt;
-- Usage:&lt;br /&gt;
-- {{#invoke:EditAtWikidata|showMessage|local_parameter}}&lt;br /&gt;
-- {{#invoke:EditAtWikidata|showMessage|qid=&amp;lt;ArticleID&amp;gt;|local_parameter}}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local i18n =&lt;br /&gt;
{&lt;br /&gt;
	[&amp;quot;message&amp;quot;] = &amp;quot;Edit this at Wikidata&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
p.showMessage = function(frame)&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar/candidate&amp;diff=5304684</id>
		<title>Template:Taxonbar/candidate</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar/candidate&amp;diff=5304684"/>
		<updated>2023-05-19T11:44:43Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Undid revision 5304670 by Wikibase-admin (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Taxonbar/candidate|check}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Authority_control&amp;diff=5304683</id>
		<title>Module:Authority control</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Authority_control&amp;diff=5304683"/>
		<updated>2023-05-19T11:44:11Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[==========================================================================]]&lt;br /&gt;
--[[                                   Main                                   ]]&lt;br /&gt;
--[[==========================================================================]]&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.authorityControl(frame)&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.makelink = function(conf,val,nextid,qid)&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:Authority_control&amp;diff=5304682</id>
		<title>Template:Authority control</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:Authority_control&amp;diff=5304682"/>
		<updated>2023-05-19T11:43:43Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Undid revision 5304668 by Wikibase-admin (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Authority control|authorityControl}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar&amp;diff=5304681</id>
		<title>Template:Taxonbar</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar&amp;diff=5304681"/>
		<updated>2023-05-19T11:42:11Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Undid revision 5304669 by Wikibase-admin (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Taxonbar|authorityControlTaxon}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Roman&amp;diff=5304680</id>
		<title>Module:Roman</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Roman&amp;diff=5304680"/>
		<updated>2023-05-19T11:06:27Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Created page with &amp;quot;-- This module implements {{Roman}}. requirestrict  local p = {}  -- This function implements the {{overline}} template. local function overline(s)     return mw.ustring.f...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- This module implements {{Roman}}.&lt;br /&gt;
require[[strict]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- This function implements the {{overline}} template.&lt;br /&gt;
local function overline(s)&lt;br /&gt;
    return mw.ustring.format( '&amp;lt;span style=&amp;quot;text-decoration:overline;&amp;quot;&amp;gt;%s&amp;lt;/span&amp;gt;', s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Gets the Roman numerals for a given numeral table. Returns both the string of&lt;br /&gt;
-- numerals and the value of the number after it is finished being processed.&lt;br /&gt;
local function getLetters(num, t)&lt;br /&gt;
    local ret = {}&lt;br /&gt;
    for _, v in ipairs(t) do&lt;br /&gt;
        local val, letter = unpack(v)&lt;br /&gt;
        while num &amp;gt;= val do&lt;br /&gt;
            num = num - val&lt;br /&gt;
            table.insert(ret, letter)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return table.concat(ret), num&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The main control flow of the module.&lt;br /&gt;
local function _main(args)&lt;br /&gt;
    -- Get input and exit displaying nothing if the input is empty.&lt;br /&gt;
    if args[1] == nil then return end&lt;br /&gt;
    local num = tonumber(args[1])&lt;br /&gt;
    if not num or num &amp;lt; 0 or num == math.huge then&lt;br /&gt;
    	error('Invalid number ' .. args[1], 2)&lt;br /&gt;
    elseif num == 0 then&lt;br /&gt;
        return 'N'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Return a message for numbers too big to be expressed in Roman numerals.&lt;br /&gt;
    if num &amp;gt;= 5000000 then&lt;br /&gt;
        return args[2] or 'N/A'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local ret = ''&lt;br /&gt;
    -- Find the Roman numerals for the large part of numbers.&lt;br /&gt;
    -- 23 April 2016 - tweaked to &amp;gt;= 4000 to accept big Roman 'IV'&lt;br /&gt;
    -- The if statement is not strictly necessary, but makes the algorithm &lt;br /&gt;
    -- more efficient for smaller numbers.&lt;br /&gt;
    if num &amp;gt;= 4000 then&lt;br /&gt;
        local bigRomans = {&lt;br /&gt;
            { 1000000, 'M' },&lt;br /&gt;
            { 900000, 'CM' }, { 500000, 'D' }, { 400000, 'CD' }, { 100000, 'C' },&lt;br /&gt;
            {  90000, 'XC' }, {  50000, 'L' }, {  40000, 'XL' }, {  10000, 'X' },&lt;br /&gt;
            {   9000, 'IX' }, {   5000, 'V' }, {   4000, 'IV' },&lt;br /&gt;
        }&lt;br /&gt;
        local bigLetters&lt;br /&gt;
        bigLetters, num = getLetters(num, bigRomans)&lt;br /&gt;
        ret = overline(bigLetters)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Find the Roman numerals for numbers less than the big Roman threshold.&lt;br /&gt;
    local smallRomans = {&lt;br /&gt;
        { 1000, 'M' },&lt;br /&gt;
        { 900, 'CM' }, { 500, 'D' }, { 400, 'CD' }, { 100, 'C' },&lt;br /&gt;
        {  90, 'XC' }, {  50, 'L' }, {  40, 'XL' }, {  10, 'X' },&lt;br /&gt;
        {   9, 'IX' }, {   5, 'V' }, {   4, 'IV' }, {   1, 'I' }&lt;br /&gt;
    }&lt;br /&gt;
    local smallLetters = getLetters( num, smallRomans )&lt;br /&gt;
    ret = ret .. smallLetters&lt;br /&gt;
&lt;br /&gt;
    if args.fraction == 'yes' then&lt;br /&gt;
        -- Find the Roman numerals for the fractional parts of numbers.&lt;br /&gt;
        -- If num is not a whole number, add half of 1/1728 (the smallest unit) to equate to rounding.&lt;br /&gt;
        -- Ensure we're not less than the smallest unit or larger than 1 - smallest unit&lt;br /&gt;
        -- to avoid getting two &amp;quot;half&amp;quot; symbols or no symbols at all&lt;br /&gt;
        num = num - math.floor(num)&lt;br /&gt;
        if num ~= 0 then&lt;br /&gt;
            num = math.max(1.1/1728, math.min(1727.1/1728, num + 1/3456))&lt;br /&gt;
        end&lt;br /&gt;
        local fractionalRomans = {&lt;br /&gt;
            { 1/2, 'S' }, { 5/12, &amp;quot;''':'''•''':'''&amp;quot; }, { 1/3, &amp;quot;'''::'''&amp;quot; },&lt;br /&gt;
            { 1/4, &amp;quot;''':'''•&amp;quot; }, { 1/6, &amp;quot;''':'''&amp;quot; }, { 1/12, '•' },&lt;br /&gt;
            { 1/24, 'Є' }, { 1/36, 'ƧƧ' }, { 1/48, 'Ɔ' }, { 1/72, 'Ƨ' }, { 1/144, '&amp;lt;s&amp;gt;Ƨ&amp;lt;/s&amp;gt;' },&lt;br /&gt;
            { 1/288, '℈' }, { 1/1728, '»' },&lt;br /&gt;
        }&lt;br /&gt;
        local fractionalLetters = getLetters(num, fractionalRomans)&lt;br /&gt;
        &lt;br /&gt;
        ret = ret .. fractionalLetters&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
    -- If called via #invoke, use the args passed into the invoking&lt;br /&gt;
    -- template, or the args passed to #invoke if any exist. Otherwise&lt;br /&gt;
    -- assume args are being passed directly in from the debug console&lt;br /&gt;
    -- or from another Lua module.&lt;br /&gt;
    local origArgs&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        origArgs = frame:getParent().args&lt;br /&gt;
        for k, v in pairs(frame.args) do&lt;br /&gt;
            origArgs = frame.args&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        origArgs = frame&lt;br /&gt;
    end&lt;br /&gt;
    -- Trim whitespace and remove blank arguments.&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs(origArgs) do&lt;br /&gt;
        if type( v ) == 'string' then&lt;br /&gt;
            v = mw.text.trim(v)&lt;br /&gt;
        end&lt;br /&gt;
        if v ~= '' then&lt;br /&gt;
            args[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- exit if not given anything&lt;br /&gt;
    if args == nil or args == {} then return end&lt;br /&gt;
    -- Given mathematical expression, simplify to a number&lt;br /&gt;
    if type(args[1]) == 'string' then&lt;br /&gt;
        local success, result = pcall(mw.ext.ParserFunctions.expr, args[1])&lt;br /&gt;
        if success then&lt;br /&gt;
            args[1] = result&lt;br /&gt;
        end -- else, pass to _main routine and try to let Lua's tonumber handle it&lt;br /&gt;
    end&lt;br /&gt;
    return _main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1&amp;diff=5304679</id>
		<title>Module:Citation/CS1</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1&amp;diff=5304679"/>
		<updated>2023-05-19T10:30:17Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require('strict');&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 Frame;																	-- holds the module's frame table&lt;br /&gt;
local is_preview_mode;															-- true when article is in preview mode; false when using 'Preview page with this template' (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 'for _, val in pairs do' 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'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've added this category&lt;br /&gt;
	utilities.set_message ('err_vancouver', {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 ('^%a[%a%d%+%.%-]*:');						-- 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 '//' (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 ('^//', '');											-- strip '//' 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 ('^[%w]') 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 ('^%a+:') 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;
		'%f[%w][%w][%w%-]+[%w]%.%a%a+$',										-- three or more character hostname.hostname or hostname.tld&lt;br /&gt;
		'%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$',									-- internationalized domain name with ACE prefix&lt;br /&gt;
		'%f[%a][qxz]%.com$',													-- assigned one character .com hostname (x.com times out 2015-12-10)&lt;br /&gt;
		'%f[%a][iq]%.net$',														-- assigned one character .net hostname (q.net registered but not active 2015-12-10)&lt;br /&gt;
		'%f[%w][%w]%.%a%a$',													-- one character hostname and ccTLD (2 chars)&lt;br /&gt;
		'%f[%w][%w][%w]%.%a%a+$',												-- two character hostname and TLD&lt;br /&gt;
		'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?',								-- IPv4 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 ('%f[%w][%w]%.' .. d) then&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false;																-- no matches, we don'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 '/' characters immediately following the scheme'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'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 ('([%a%d])%.?[/%?#].*$', '%1');						-- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of '//')&lt;br /&gt;
&lt;br /&gt;
	if url_str:match ('^//%S*') then											-- if there is what appears to be a protocol-relative URL&lt;br /&gt;
		domain = url_str:match ('^//(%S*)')&lt;br /&gt;
	elseif url_str:match ('%S-:/*%S+') 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 ('(%S-:)(/*)(%S+)');			-- extract the scheme, authority indicator, and domain portions&lt;br /&gt;
		if utilities.is_set (authority) then&lt;br /&gt;
			authority = authority:gsub ('//', '', 1);							-- replace place 1 pair of '/' with nothing;&lt;br /&gt;
			if utilities.is_set(authority) then									-- if anything left (1 or 3+ '/' 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 ('^news:') then									-- except for news:..., MediaWiki won'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 ('(%a):%d+', '%1');								-- 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 ('[&amp;lt;&amp;gt;%[%]|{}]') 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't bother if &amp;lt;param&amp;gt;-link doesn'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 ('%[%[') then											-- check |title= for wikilink markup&lt;br /&gt;
			orig = torig;														-- identify the failing |title= parameter&lt;br /&gt;
		elseif link:match ('^%a+:') then										-- if the link is what looks like an interwiki&lt;br /&gt;
			local prefix = link:match ('^(%a+):'):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 = '';																-- unset&lt;br /&gt;
		utilities.set_message ('err_bad_paramlink', 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'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 'news:' == scheme then													-- special case for newsgroups&lt;br /&gt;
		return domain:match('^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$');&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 '//Hus' 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 ('%f[%[]%[%a%S*:%S+.*%]') then								-- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match ('%f[%[]%[(%a%S*:%S+).*%]'));&lt;br /&gt;
	elseif value:match ('%f[%[]%[//%S+.*%]') then								-- if protocol-relative ext. wikilink: [//yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match ('%f[%[]%[(//%S+).*%]'));&lt;br /&gt;
	elseif value:match ('%a%S*:%S+') then										-- if bare URL with scheme; may have leading or trailing plain text&lt;br /&gt;
		scheme, domain = split_url (value:match ('(%a%S*:%S+)'));&lt;br /&gt;
	elseif value:match ('//%S+') then											-- if protocol-relative bare URL: //yyyyy.zzz; may have leading or trailing plain text&lt;br /&gt;
		scheme, domain = split_url (value:match ('(//%S+)'));					-- what is left should be the domain&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- didn'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 ('parameter', 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 ('err_wikilink_in_url', {});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return str:gsub( '[%[%]\n]', {	&lt;br /&gt;
		['['] = '&amp;amp;#91;',&lt;br /&gt;
		[']'] = '&amp;amp;#93;',&lt;br /&gt;
		['\n'] = ' ' } );&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 = '';&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 ('err_bare_url_missing_title', {utilities.wrap_style ('parameter', 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 ('err_bad_url', {utilities.wrap_style ('parameter', source)});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	domain, path = URL:match ('^([/%.%-%+:%a%d]+)([/%?#].*)$');					-- 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 ('[%[%]]', {['['] = '%5b', [']'] = '%5d'});			-- replace '[' and ']' 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['ext-link-access-signal'], {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've added this category&lt;br /&gt;
		utilities.set_message ('err_deprecated_params', {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's value.&lt;br /&gt;
&lt;br /&gt;
This function will positive kern either single or double quotes:&lt;br /&gt;
	&amp;quot;'Unkerned title with leading and trailing single quote marks'&amp;quot;&lt;br /&gt;
	&amp;quot; 'Kerned title with leading and trailing single quote marks' &amp;quot; (in real life the kerning isn'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 = '';&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, '%[%[[\&amp;quot;“”\'‘’].+[\&amp;quot;“”\'‘’]%]%]') then		-- leading and trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-left'], str);&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-right'], str);&lt;br /&gt;
		elseif mw.ustring.match (str, '%[%[[\&amp;quot;“”\'‘’].+%]%]')	then			-- leading quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-left'], str);&lt;br /&gt;
		elseif mw.ustring.match (str, '%[%[.+[\&amp;quot;“”\'‘’]%]%]') then				-- trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-right'], 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, '[“”]', '\&amp;quot;');							-- replace “” (U+201C &amp;amp; U+201D) with &amp;quot; (typewriter double quote mark)&lt;br /&gt;
		label = mw.ustring.gsub (label, '[‘’]', '\'');							-- replace ‘’ (U+2018 &amp;amp; U+2019) with ' (typewriter single quote mark)&lt;br /&gt;
&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^([\&amp;quot;\'][^\'].+)&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['kern-left'], cap);&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^(.+[^\'][\&amp;quot;\'])$&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['kern-right'], 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='';																-- initialize to empty string&lt;br /&gt;
	local name;&lt;br /&gt;
	if script_value:match('^%l%l%l?%s*:') then									-- if first 3 or 4 non-space characters are script language prefix&lt;br /&gt;
		lang = script_value:match('^(%l%l%l?)%s*:%s*%S.*');						-- 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 ('err_script_parameter', {script_param, cfg.err_msg_supl['missing title part']});		-- prefix without 'title'; add error message&lt;br /&gt;
			return '';															-- 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_code_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 ('^%l+%s*:%s*', '');				-- 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 ('script', {name, lang})&lt;br /&gt;
			else&lt;br /&gt;
				utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['unknown language code']});	-- unknown script-language; add error message&lt;br /&gt;
			end&lt;br /&gt;
			lang = ' lang=&amp;quot;' .. lang .. '&amp;quot; ';									-- convert prefix into a lang attribute&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['invalid language code']});		-- invalid language code; add error message&lt;br /&gt;
			lang = '';															-- invalid so set lang to empty string&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing prefix']});				-- no language code prefix; add error message&lt;br /&gt;
	end&lt;br /&gt;
	script_value = utilities.substitute (cfg.presentation['bdi'], {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 .. ' ' .. 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 ({'https://', cfg.this_wiki_code, '.wikisource.org/wiki/'});&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 ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)');		-- 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 ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)');		-- 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 ('^[Ww]ikisource:(.+)') or L:match ('^[Ss]:(.+)');		-- 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, 'WIKI');								-- make a usable URL&lt;br /&gt;
		ws_url = ws_url:gsub ('%%23', '#');										-- 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 = '';														-- to be safe for concatenation&lt;br /&gt;
	else&lt;br /&gt;
		periodical = utilities.wrap_style ('italic-title', 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 ('trans-italic-title', trans_periodical);&lt;br /&gt;
		if utilities.is_set (periodical) then&lt;br /&gt;
			periodical = periodical .. ' ' .. 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 ('err_trans_missing_title', {'periodical'});&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 ('_', ' ');									-- 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 = '';															-- 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's leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			chapter = utilities.wrap_style ('quoted-title', 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 .. '&amp;amp;nbsp;', 'ws link in chapter');	-- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?&lt;br /&gt;
		chapter = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 ('trans-quoted-title', trans_chapter);&lt;br /&gt;
		if utilities.is_set (chapter) then&lt;br /&gt;
			chapter = chapter .. ' ' .. 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 ('trans%-?(.+)');		-- when no chapter, get matching name from trans-&amp;lt;param&amp;gt;&lt;br /&gt;
			utilities.set_message ('err_trans_missing_title', {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'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 = '';														-- 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, '[%w%p ]*');										-- 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'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 'nowiki' == capture or 'math' == capture or						-- nowiki and math stripmarkers (not an error condition)&lt;br /&gt;
				('templatestyles' == capture and utilities.in_array (param, {'id', 'quote'})) 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'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 .. ' ' .. char_name;&lt;br /&gt;
				else&lt;br /&gt;
					err_msg = char_name .. ' ' .. 'character';&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				utilities.set_message ('err_invisible_char', {err_msg, utilities.wrap_style ('parameter', 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 ) == 'table' then&lt;br /&gt;
				v, origin[k] = utilities.select_one ( args, list, 'err_redundant_parameters' );&lt;br /&gt;
				if origin[k] == nil then&lt;br /&gt;
					origin[k] = '';												-- 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['unknown_argument_map'] .. ': ' .. 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 = '';&lt;br /&gt;
				origin[k] = '';&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 = '';&lt;br /&gt;
	local cap2 = '';&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['nowrap1'], 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['nowrap2'], {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 'none' == cfg.keywords_xlate[title_type] then&lt;br /&gt;
			title_type = '';													-- 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 '';									-- set template'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 'duplicate character'&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 = '';																-- the output string&lt;br /&gt;
	local comp = '';															-- what does 'comp' mean?&lt;br /&gt;
	local end_chr = '';&lt;br /&gt;
	local trim;&lt;br /&gt;
	for _, value in ipairs( tbl ) do&lt;br /&gt;
		if value == nil then value = ''; end&lt;br /&gt;
		&lt;br /&gt;
		if str == '' 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 ~= '' then&lt;br /&gt;
			if value:sub(1, 1) == '&amp;lt;' 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: 'First element' .. 'sepc next element' .. 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;'&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'' &lt;br /&gt;
						str = f.sub(str, 1, -4) .. &amp;quot;''&amp;quot;;						-- remove them and add back ''&lt;br /&gt;
					elseif  f.sub(str, -5, -1) == duplicate_char .. &amp;quot;]]''&amp;quot; then	-- if last five chars of str are sepc]]'' &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;]''&amp;quot; then	-- if last four chars of str are sepc]'' &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 .. '&amp;quot;]' 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;'']&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, {'Jr', 'Sr', 'Jnr', 'Snr', '1st', '2nd', '3rd'}) or suffix:match ('^%dth$') 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'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%']*$&amp;quot;)&lt;br /&gt;
	or nil == mw.ustring.find (first, &amp;quot;^[A-Za-zÀ-ÖØ-öø-ƿǄ-ɏ%-%s%'%.]+[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 ('[,%s]') then											-- when there is a space or comma, might be first name/initials + generational suffix&lt;br /&gt;
			first = first:match ('(.-)[,%s]+');									-- get name/initials&lt;br /&gt;
			suffix = first:match ('[,%s]+(.+)$');								-- 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%-%s%']*$&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%-%s%'%.]*$&amp;quot;) then&lt;br /&gt;
			add_vanc_error (cfg.err_msg_supl['non-Latin char'], 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;
	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, names = {}, {};												-- 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 = mw.text.split (first, '[%s,]+');									-- split into a table of names and possible suffix&lt;br /&gt;
&lt;br /&gt;
	while names[i] do															-- loop through the table&lt;br /&gt;
		if 1 &amp;lt; i and names[i]:match ('[%dJS][%drndth]+%.?$') then				-- if not the first name, and looks like a suffix (may have trailing dot)&lt;br /&gt;
			names[i] = names[i]:gsub ('%.', '');								-- remove terminal dot if present&lt;br /&gt;
			if is_suffix (names[i]) then										-- if a legitimate suffix&lt;br /&gt;
				table.insert (initials, ' ' .. names[i]);						-- add a separator space, insert at end of initials table&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, mw.ustring.sub(names[i], 1, 1));			-- insert the initial at end of initials table&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)												-- 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: 'd' (wikidata), 's' (wikisource), and 'w' (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 (':%l+:') 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;
		'^%[%[:([dsw]):(%l%l+):',												-- wikilinked; project and language prefixes&lt;br /&gt;
		'^%[%[:(%l%l+):([dsw]):',												-- wikilinked; language and project prefixes&lt;br /&gt;
		'^%[%[:([dsw]):',														-- wikilinked; project prefix&lt;br /&gt;
		'^%[%[:(%l%l+):',														-- 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;
		'^:([dsw]):(%l%l+):',													-- project and language prefixes&lt;br /&gt;
		'^:(%l%l+):([dsw]):',													-- language and project prefixes&lt;br /&gt;
		'^:([dsw]):',															-- project prefix&lt;br /&gt;
		'^:(%l%l+):',															-- 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'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 'vanc' == format then													-- Vancouver-like name styling?&lt;br /&gt;
		sep = cfg.presentation['sep_nl_vanc'];									-- name-list separator between names is a comma&lt;br /&gt;
		namesep = cfg.presentation['sep_name_vanc'];							-- last/first separator is a space&lt;br /&gt;
	else&lt;br /&gt;
		sep = cfg.presentation['sep_nl'];										-- name-list separator between names is a semicolon&lt;br /&gt;
		namesep = cfg.presentation['sep_name'];									-- 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'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 ('%.', '');								-- 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;
&lt;br /&gt;
				if 'w' == proj and ('Wikipedia' == mw.site.namespaces.Project['name']) 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;
					proj = ({['d'] = 'Wikidata', ['s'] = 'Wikisource', ['w'] = 'Wikipedia'})[proj];	-- :w (wikipedia) for linking from a non-wikipedia project&lt;br /&gt;
					if proj then &lt;br /&gt;
						one = one .. utilities.wrap_style ('interproj', proj);	-- add resized leading space, brackets, static text, language name&lt;br /&gt;
						tag = nil;												-- unset; don'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_code_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 ('interwiki', lang);	-- add resized leading space, brackets, static text, language name&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 'amp' == 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 'and' == 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 'and' text&lt;br /&gt;
				else&lt;br /&gt;
					name_list[#name_list-2] = cfg.presentation.sep_nl_end;		-- replace last separator with '(sep) and' 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['et al'];					-- we'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 '';							-- 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, 'citation');											-- required for blue highlight&lt;br /&gt;
	if 'citation' ~= 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 'cs1');		-- 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 'cs2');		-- 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, ' ');											-- 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 'et al' pattern is found in name&lt;br /&gt;
				name = name:gsub (pattern, '');									-- 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 ('err_etal', {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 maint cat when name parameter value does not contain letters.  Does not catch&lt;br /&gt;
mixed alphanumeric names so |last=A. Green (1922-1987) does not get caught in the&lt;br /&gt;
current version of this test but |first=(1888) is caught.&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, list_name)&lt;br /&gt;
	if utilities.is_set (name) then&lt;br /&gt;
		if mw.ustring.match (name, '^[%A]+$') then								-- when name does not contain any letters&lt;br /&gt;
			utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]);	-- add a maint cat for this template&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;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_mult_names (name, list_name)&lt;br /&gt;
	local _, commas, semicolons, nbsps;&lt;br /&gt;
	if utilities.is_set (name) then&lt;br /&gt;
		_, commas = name:gsub (',', '');										-- count the number of commas&lt;br /&gt;
		_, semicolons = name:gsub (';', '');									-- 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 ('&amp;amp;nbsp;','');										-- 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 'escape' them. If additional entities are added,&lt;br /&gt;
		-- they also can be subtracted.&lt;br /&gt;
		if 1 &amp;lt; commas or 0 &amp;lt; (semicolons - nbsps) then&lt;br /&gt;
			utilities.set_message ('maint_mult_names', 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;
	'generic_names' – for name-holding parameters: |last=, |first=, |editor-last=, etc&lt;br /&gt;
	'generic_titles' – for |title=&lt;br /&gt;
&lt;br /&gt;
There are two types of generic tests.  The 'accept' tests look for a pattern that should not be rejected by the&lt;br /&gt;
'reject' test.  For example,&lt;br /&gt;
	|author=[[John Smith (author)|Smith, John]]&lt;br /&gt;
would be rejected by the 'author' reject test.  But piped wikilinks with 'author' disambiguation should not be&lt;br /&gt;
rejected so the 'accept' 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 'accept' and 'reject' sequence tables hold tables for en.wiki (['en']) and local.wiki (['local'])&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'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 (['en']) and use mw.ustring.lower() or local.wiki (['local'])&lt;br /&gt;
		['en'] = string.lower,&lt;br /&gt;
		['local'] = mw.ustring.lower,&lt;br /&gt;
		}&lt;br /&gt;
	local str_find = {															-- use string.find() for en.wiki (['en']) and use mw.ustring.find() or local.wiki (['local'])&lt;br /&gt;
		['en'] = string.find,&lt;br /&gt;
		['local'] = 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 'true', 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 = {'accept', 'reject'};									-- test accept patterns first, then reject patterns&lt;br /&gt;
	local wikis_t = {'en', 'local'};											-- 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 ('reject' == 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 'generic name' 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 ('generic_names', name) then&lt;br /&gt;
		utilities.set_message ('err_generic_name', 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 (last only)&lt;br /&gt;
			name_is_numeric (last, list_name);									-- check for names that are composed of digits and punctuation&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_is_numeric (first, list_name);									-- check for names that are composed of digits and punctuation&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 ('err_bad_paramlink', 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'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 'holes' 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 'et al.', the 'et al.'&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 'et al.' text from Module:Citation/CS1/Configuration.  This keeps&lt;br /&gt;
'et al.' out of the template'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'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 .. '-Last'], 'err_redundant_parameters', i );		-- search through args for name components beginning at 1&lt;br /&gt;
		first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'err_redundant_parameters', i );&lt;br /&gt;
		link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i );&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', 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 ('err_bad_paramlink', 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 ('err_bad_paramlink', link_alias);		-- not known, emit an error message	-- TODO: err_bad_interwiki?&lt;br /&gt;
				link = nil;														-- unset so we don'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 ('given', 1, true) and 'given' or 'first';	-- get first or given form of the alias&lt;br /&gt;
			utilities.set_message ('err_first_missing_last', {&lt;br /&gt;
				first_alias,													-- param name of alias missing its mate&lt;br /&gt;
				first_alias:gsub (alias, {['first'] = 'last', ['given'] = 'surname'}),	-- 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't found, are we done?&lt;br /&gt;
			count = count + 1;													-- number of times we haven'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'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 ('err_missing_name', {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'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_code_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_code_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;
		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 ('^(%a%a%a?)%-.*');								-- still assuming that &amp;lt;lang_param_lc&amp;gt; is a tag; strip script, region, variant subtags&lt;br /&gt;
	name = cfg.lang_code_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 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;
	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;
	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 = lang_param_lc:match ('^(%a%a%a?)%-.*');								-- is &amp;lt;lang_param_lc&amp;gt; an IETF-like tag that MediaWiki doesn'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 '639-2' 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 'ar' is&lt;br /&gt;
recognized but code 'ara' 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's language name&lt;br /&gt;
&lt;br /&gt;
	names_t = mw.text.split (lang, '%s*,%s*');									-- 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'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 ('^(%a%a%a?)%-.*', '%1');					-- 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's language&lt;br /&gt;
				if 2 == lang_subtag:len() then									-- and is a two-character tag&lt;br /&gt;
					utilities.add_prop_cat ('foreign-lang-source', {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 ('foreign-lang-source-2', {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's language are the same and categorization is enabled&lt;br /&gt;
				utilities.add_prop_cat ('local-lang-source', {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 ('maint_unknown_lang');						-- 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 = '';																-- 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, 'English' in 'American English'&lt;br /&gt;
		return '';																-- if one language and that language is this wiki's return an empty string (no annotation)&lt;br /&gt;
	end&lt;br /&gt;
	return (&amp;quot; &amp;quot; .. wrap_msg ('language', name));								-- otherwise wrap with '(in ...)'&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 '.'.&lt;br /&gt;
In CS2, the default postscript is the empty string and the default separator is ','.&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 == 'cs1' and postscript == cfg.presentation['ps_' .. mode] then&lt;br /&gt;
			utilities.set_message ('maint_postscript');&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		postscript = cfg.presentation['ps_' .. mode];&lt;br /&gt;
	end&lt;br /&gt;
	return cfg.presentation['sep_' .. 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 'cs2' == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs2');&lt;br /&gt;
	elseif 'cs1' == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs1');&lt;br /&gt;
	elseif 'citation' == cite_class	then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs2');&lt;br /&gt;
	else&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs1');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.keywords_xlate[postscript:lower()] == 'none' 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 'cs2' == mode or 'citation' == cite_class then&lt;br /&gt;
			utilities.set_message ('maint_postscript');&lt;br /&gt;
		end&lt;br /&gt;
		postscript = '';&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 ('%.pdf$') or url:match ('%.PDF$') or&lt;br /&gt;
		url:match ('%.pdf[%?#]') or url:match ('%.PDF[%?#]') or&lt;br /&gt;
		url:match ('%.PDF&amp;amp;#035') or url:match ('%.pdf&amp;amp;#035');&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'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 ('format', format);						-- add leading space, parentheses, resize&lt;br /&gt;
		if not utilities.is_set (url) then&lt;br /&gt;
			utilities.set_message ('err_format_missing_url', {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 ('format', 'PDF');						-- set format to PDF&lt;br /&gt;
	else&lt;br /&gt;
		format = '';															-- 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 'etal' flag (false by default&lt;br /&gt;
but may have been set to true if the name list contains some variant of the text 'et al.').&lt;br /&gt;
&lt;br /&gt;
When the value assigned to |display-xxxxors= is the keyword 'etal', return a number&lt;br /&gt;
that is one greater than the number of authors in the list and set the 'etal' flag true.&lt;br /&gt;
This will cause the list_people() to display all of the names in the name list followed by 'et al.'&lt;br /&gt;
&lt;br /&gt;
In all other cases, returns nil and the previous state of the 'etal' flag.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
	max: A['DisplayAuthors'] or A['DisplayEditors']; a number or some flavor of etal&lt;br /&gt;
	count: #a or #e&lt;br /&gt;
	list_name: 'authors' or 'editors'&lt;br /&gt;
	etal: author_etal or editor_etal&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 'etal' == max:lower():gsub(&amp;quot;[ '%.]&amp;quot;, '') then						-- the :gsub() portion makes 'etal' from a variety of 'et al.' 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 ('^%d+$') 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 then												-- if |display-xxxxors= value greater than or equal to number of authors/editors&lt;br /&gt;
				utilities.set_message ('err_disp_name', {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 ('err_disp_name', {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: '^P[^%.P%l]' 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:  '^[Pp][PpGg]' 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 ('err_extra_text_pages', 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 'type' indicator.&lt;br /&gt;
&lt;br /&gt;
For |volume=:&lt;br /&gt;
	'V.', or 'Vol.' (with or without the dot) abbreviations or 'Volume' in the first characters of the parameter&lt;br /&gt;
	content (all case insensitive). 'V' and 'v' (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;
	'No.', 'I.', 'Iss.' (with or without the dot) abbreviations, or 'Issue' in the first characters of the&lt;br /&gt;
	parameter content (all case insensitive).&lt;br /&gt;
	&lt;br /&gt;
Single character values ('v', 'i', 'n') allowed when not followed by separator character ('.', ':', '=', 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 'v' for |volume=, 'i' 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 patterns = 'v' == selector and cfg.vol_iss_pg_patterns.vpatterns or cfg.vol_iss_pg_patterns.ipatterns;&lt;br /&gt;
&lt;br /&gt;
	local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';&lt;br /&gt;
	val = val:lower();															-- force parameter value to lower case&lt;br /&gt;
	for _, pattern in ipairs (patterns) 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 (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 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 ('^%(%(.*[^%)][^%)]$') 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 .. ', ' .. name_table[i];							-- concatenate with previous segments&lt;br /&gt;
				if name_table[i]:match ('^.*%)%)$') 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, '');								-- 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'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 = '';																-- 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('[;%.]') 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, '^%u+$') 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, ' ')							-- 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 = '';														-- 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, '%a+%s+%u+%s+%a+') then&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl['missing comma'], 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, ' %u %u$') 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'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 .. ' ' .. suffix;									-- if there was a suffix concatenate with the initials&lt;br /&gt;
				suffix = '';													-- unset so we don'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, '', 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 .. '-Link'], 'err_redundant_parameters', i ) or v_link_table[i];&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', 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'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 .. '-Last'], 'none', 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 .. '-First'], 'none', 1 ) or		-- ... also catches the case where |first= is used with |vauthors=&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 2 ) or&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 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 'AuthorList' == list_name then									-- figure out which name should be used in error message&lt;br /&gt;
				err_name = 'author';&lt;br /&gt;
			else&lt;br /&gt;
				err_name = 'editor';&lt;br /&gt;
			end&lt;br /&gt;
			utilities.set_message ('err_redundant_parameters', err_name .. '-name-list parameters');	-- 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'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 ('err_invalid_param_val', {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 .. '. ') 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 .. ']]') then	-- if last name in list ends with sepc char&lt;br /&gt;
		return name_list .. &amp;quot; &amp;quot;;												-- don't add another&lt;br /&gt;
	else&lt;br /&gt;
		return name_list .. sepc .. ' ';										-- 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 '';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- same condition as in format_pages_sheets()&lt;br /&gt;
	local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);&lt;br /&gt;
&lt;br /&gt;
	local is_numeric_vol = volume and (volume:match ('^[MDCLXVI]+$') or volume:match ('^%d+$'));	-- 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 ('long-vol');									-- 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 = '';&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['vol-bold'], {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['j-vol'], {sepc, utilities.hyphen_to_dash (volume)});	-- not bold&lt;br /&gt;
			else																-- four or fewer characters&lt;br /&gt;
				vol = utilities.substitute (cfg.presentation['vol-bold'], {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['j-issue'], issue) or '')&lt;br /&gt;
		vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages['j-article-num'], article) or '')&lt;br /&gt;
		return vol;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 'podcast' == cite_class and utilities.is_set (issue) then&lt;br /&gt;
		return wrap_msg ('issue', {sepc, issue}, lower);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 'conference' == 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 ('vol-art', {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 ('art', {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 ('vol-no', {sepc, utilities.hyphen_to_dash (volume), issue}, lower);&lt;br /&gt;
	elseif utilities.is_set (volume) then&lt;br /&gt;
		return wrap_msg ('vol', {sepc, utilities.hyphen_to_dash (volume)}, lower);&lt;br /&gt;
	else&lt;br /&gt;
		return wrap_msg ('issue', {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 'map' == 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 'journal' == origin then&lt;br /&gt;
				return '', '', wrap_msg ('j-sheet', sheet, lower), '';&lt;br /&gt;
			else&lt;br /&gt;
				return '', '', wrap_msg ('sheet', {sepc, sheet}, lower), '';&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (sheets) then&lt;br /&gt;
			if 'journal' == origin then&lt;br /&gt;
				return '', '', '', wrap_msg ('j-sheets', sheets, lower);&lt;br /&gt;
			else&lt;br /&gt;
				return '', '', '', wrap_msg ('sheets', {sepc, sheets}, lower);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == 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['j-page(s)'], page), '', '', '';&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return utilities.substitute (cfg.messages['p-prefix'], {sepc, page}), '', '', '';&lt;br /&gt;
		else&lt;br /&gt;
			return utilities.substitute (cfg.messages['nopp'], {sepc, page}), '', '', '';&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['j-page(s)'], pages), '', '', '';&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 '', utilities.substitute (cfg.messages['p-prefix'], {sepc, pages}), '', '';&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return '', utilities.substitute (cfg.messages['pp-prefix'], {sepc, pages}), '', '';&lt;br /&gt;
		else&lt;br /&gt;
			return '', utilities.substitute (cfg.messages['nopp'], {sepc, pages}), '', '';&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return '', '', '', '';														-- 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'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 = '';															-- unset the others&lt;br /&gt;
			at = '';&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 .. '&amp;amp;nbsp;', 'ws link in page');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 = '';															-- 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 .. '&amp;amp;nbsp;', 'ws link in pages');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 .. '&amp;amp;nbsp;', 'ws link in at');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 ('err_bad_url', {utilities.wrap_style ('parameter', source)});	-- add error message&lt;br /&gt;
			return '', '';														-- 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 'https://web.archive.org/save/' (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 'search' 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;
('id_', 'js_', 'cs_', 'im_') but since archive.org ignores others following the same form (two letters and an underscore)&lt;br /&gt;
we don'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;
]=]&lt;br /&gt;
&lt;br /&gt;
local function archive_url_check (url, date)&lt;br /&gt;
	local err_msg = '';															-- 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;
	if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) 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('//web%.archive%.org/save/') then								-- if a save command URL, we don'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 ('(//web%.archive%.org)/save/', '%1/*/', 1);				-- for preview mode: modify ArchiveURL&lt;br /&gt;
	elseif url:match('//liveweb%.archive%.org/') then&lt;br /&gt;
		err_msg = cfg.err_msg_supl.liveweb;&lt;br /&gt;
	else&lt;br /&gt;
		path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/');	-- 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 '*' ~= flag then&lt;br /&gt;
				local replacement = timestamp:match ('^%d%d%d%d%d%d') or timestamp:match ('^%d%d%d%d');	-- get the first 6 (YYYYMM) or first 4 digits (YYYY)&lt;br /&gt;
				if replacement then												-- nil if there aren't at least 4 digits (year)&lt;br /&gt;
					replacement = replacement .. string.rep ('0', 14 - replacement:len());	-- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp&lt;br /&gt;
					url=url:gsub ('(//web%.archive%.org/[^%d]*)%d[^/]*', '%1' .. replacement .. '*', 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 'web/' ~= path then					-- older archive URLs do not have the extra 'web/' 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 'web/' path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		elseif utilities.is_set (flag) and not flag:match ('%a%a_') then		-- flag if present must be two alpha characters and underscore (requires 'web/' path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		else&lt;br /&gt;
			return url, date;													-- return ArchiveURL and ArchiveDate&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- if here, something not right so&lt;br /&gt;
	utilities.set_message ('err_archive_url', {err_msg});						-- add error message and&lt;br /&gt;
&lt;br /&gt;
	if is_preview_mode then&lt;br /&gt;
		return url, date;														-- preview mode so return ArchiveURL and ArchiveDate&lt;br /&gt;
	else&lt;br /&gt;
		return '', '';															-- 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, '%d') then									-- not empty, are there digits in the parameter value&lt;br /&gt;
		utilities.set_message ('maint_location');								-- 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 'Archived copy' (placeholder added by bots that can'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 'Archived copy'&lt;br /&gt;
		return true;&lt;br /&gt;
	elseif cfg.special_case_translation.archived_copy['local'] then&lt;br /&gt;
		if mw.ustring.find (title, cfg.special_case_translation.archived_copy['local']) 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; 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 = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');&lt;br /&gt;
	local Collaboration = A['Collaboration'];&lt;br /&gt;
&lt;br /&gt;
	do																			-- to limit scope of selected&lt;br /&gt;
		local selected = select_author_editor_source (A['Vauthors'], A['Authors'], args, 'AuthorList');&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			a, author_etal = extract_names (args, 'AuthorList');				-- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 2 == selected then&lt;br /&gt;
			NameListStyle = 'vanc';												-- override whatever |name-list-style= might be&lt;br /&gt;
			a, author_etal = parse_vauthors_veditors (args, args.vauthors, 'AuthorList');	-- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 3 == selected then&lt;br /&gt;
			Authors = A['Authors'];												-- use content of |authors=&lt;br /&gt;
			if 'authors' == A:ORIGIN('Authors') then							-- but add a maint cat if the parameter is |authors=&lt;br /&gt;
				utilities.set_message ('maint_authors');						-- because use of this parameter is discouraged; what to do about the aliases is a TODO:&lt;br /&gt;
			end&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['Veditors'], nil, args, 'EditorList');	-- support for |editors= withdrawn&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			e, editor_etal = extract_names (args, 'EditorList');				-- 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 = 'vanc';												-- override whatever |name-list-style= might be&lt;br /&gt;
			e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList');	-- 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['Chapter'];												-- done here so that we have access to |contribution= from |chapter= aliases&lt;br /&gt;
	local Chapter_origin = A:ORIGIN ('Chapter');&lt;br /&gt;
	local Contribution;															-- because contribution is required for contributor(s)&lt;br /&gt;
		if 'contribution' == 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['Periodical']) then	-- |contributor= and |contribution= only supported in book cites&lt;br /&gt;
		c = extract_names (args, 'ContributorList');							-- 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 ('err_contributor_missing_required_param', 'contribution');	-- add missing contribution error message&lt;br /&gt;
				c = {};															-- blank the contributors' 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 ('err_contributor_missing_required_param', 'author');	-- add missing author error message&lt;br /&gt;
				c = {};															-- blank the contributors' 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['ContributorList-Last'], 'err_redundant_parameters', 1 ) then	-- are there contributor name list parameters?&lt;br /&gt;
			utilities.set_message ('err_contributor_ignored');					-- 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['Title'];&lt;br /&gt;
	local TitleLink = A['TitleLink'];&lt;br /&gt;
&lt;br /&gt;
	local auto_select = ''; -- 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, {'none', 'pmc', 'doi'}) then -- check for special keywords&lt;br /&gt;
		auto_select = TitleLink;												-- remember selection for later&lt;br /&gt;
		TitleLink = '';															-- 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 ('TitleLink'), Title, 'title');	-- 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 = '';															-- {{cite map}} only; preset to empty string for concatenation if not used&lt;br /&gt;
	if 'map' == config.CitationClass and 'section' == Chapter_origin then&lt;br /&gt;
		Section = A['Chapter'];													-- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}&lt;br /&gt;
		Chapter = '';															-- unset for now; will be reset later from |map= if present&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Periodical = A['Periodical'];&lt;br /&gt;
	local Periodical_origin = '';&lt;br /&gt;
	if utilities.is_set (Periodical) then&lt;br /&gt;
		Periodical_origin = A:ORIGIN('Periodical');								-- get the name of the periodical parameter&lt;br /&gt;
		local i;&lt;br /&gt;
		Periodical, i = utilities.strip_apostrophe_markup (Periodical);			-- strip apostrophe markup so that metadata isn'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 ('err_apostrophe_markup', {Periodical_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 'mailinglist' == config.CitationClass then								-- special case for {{cite mailing list}}&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (A ['MailingList']) then	-- both set emit an error TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', Periodical_origin) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'mailinglist')});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = A ['MailingList'];											-- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}&lt;br /&gt;
		Periodical_origin = A:ORIGIN('MailingList');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ScriptPeriodical = A['ScriptPeriodical'];&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	-- 'periodical' templates require periodical parameter&lt;br /&gt;
	--	local p = {['journal'] = 'journal', ['magazine'] = 'magazine', ['news'] = 'newspaper', ['web'] = 'website'};	-- for error message&lt;br /&gt;
		local p = {['journal'] = 'journal', ['magazine'] = 'magazine'};			-- for error message&lt;br /&gt;
		if p[config.CitationClass]  then&lt;br /&gt;
			utilities.set_message ('err_missing_periodical', {config.CitationClass, p[config.CitationClass]});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Volume;&lt;br /&gt;
	local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');&lt;br /&gt;
	if 'citation' == 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['Volume'];											-- but does for all other 'periodicals'&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (ScriptPeriodical) then&lt;br /&gt;
			if 'script-website' ~= ScriptPeriodical_origin then					-- {{citation}} does not render volume for |script-website=&lt;br /&gt;
				Volume = A['Volume'];											-- but does for all other 'periodicals'&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			Volume = A['Volume'];												-- and does for non-'periodical' 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['Volume'];&lt;br /&gt;
	end	&lt;br /&gt;
	extra_text_in_vol_iss_check (Volume, A:ORIGIN ('Volume'), 'v');	&lt;br /&gt;
&lt;br /&gt;
	local Issue;&lt;br /&gt;
	if 'citation' == 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['Issue']);&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, {'conference', 'map', 'citation'}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then&lt;br /&gt;
			Issue = utilities.hyphen_to_dash (A['Issue']);&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, {'journal', 'conference'}) or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then&lt;br /&gt;
		ArticleNumber = A['ArticleNumber'];&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');	&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['Page'];&lt;br /&gt;
		Pages = utilities.hyphen_to_dash (A['Pages']);	&lt;br /&gt;
		At = A['At'];&lt;br /&gt;
		QuotePage = A['QuotePage'];&lt;br /&gt;
		QuotePages = utilities.hyphen_to_dash (A['QuotePages']);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Edition = A['Edition'];&lt;br /&gt;
	local PublicationPlace = place_check (A['PublicationPlace'], A:ORIGIN('PublicationPlace'));&lt;br /&gt;
	local Place = place_check (A['Place'], A:ORIGIN('Place'));&lt;br /&gt;
	&lt;br /&gt;
	local PublisherName = A['PublisherName'];&lt;br /&gt;
	local PublisherName_origin = A:ORIGIN('PublisherName');&lt;br /&gt;
	if utilities.is_set (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't contaminated; publisher is never italicized&lt;br /&gt;
		if i then																-- non-zero when markup was stripped so emit an error message&lt;br /&gt;
			utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Newsgroup = A['Newsgroup'];											-- TODO: strip apostrophe markup?&lt;br /&gt;
	local Newsgroup_origin = A:ORIGIN('Newsgroup');	&lt;br /&gt;
&lt;br /&gt;
	if 'newsgroup' == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (PublisherName) then								-- general use parameter |publisher= not allowed in cite newsgroup&lt;br /&gt;
			utilities.set_message ('err_parameter_ignored', {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;
	local URL = A['URL'];														-- TODO: better way to do this for URL, ChapterURL, and MapURL?&lt;br /&gt;
	local UrlAccess = is_valid_parameter_value (A['UrlAccess'], A:ORIGIN('UrlAccess'), cfg.keywords_lists['url-access'], 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 ('err_param_access_requires_param', 'url');&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local ChapterURL = A['ChapterURL'];&lt;br /&gt;
	local ChapterUrlAccess = is_valid_parameter_value (A['ChapterUrlAccess'], A:ORIGIN('ChapterUrlAccess'), cfg.keywords_lists['url-access'], 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 ('err_param_access_requires_param', {A:ORIGIN('ChapterUrlAccess'):gsub ('%-access', '')});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local MapUrlAccess = is_valid_parameter_value (A['MapUrlAccess'], A:ORIGIN('MapUrlAccess'), cfg.keywords_lists['url-access'], nil);&lt;br /&gt;
	if not utilities.is_set (A['MapURL']) and utilities.is_set (MapUrlAccess) then&lt;br /&gt;
		MapUrlAccess = nil;&lt;br /&gt;
		utilities.set_message ('err_param_access_requires_param', {'map-url'});&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['NoTracking'], A:ORIGIN('NoTracking'), cfg.keywords_lists['yes_true_y'], 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'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're at it)&lt;br /&gt;
	utilities.select_one (args, {'page', 'p', 'pp', 'pages', 'at', 'sheet', 'sheets'}, 'err_redundant_parameters');	-- this is a dummy call simply to get the error message and category&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('Page'), Pages, A:ORIGIN('Pages'), At);&lt;br /&gt;
&lt;br /&gt;
	local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);&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 ('location-test');								-- add property cat to evaluate how often PublicationPlace and Place are used together&lt;br /&gt;
		if PublicationPlace == Place then&lt;br /&gt;
			Place = '';															-- unset; don'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 = ''; end							-- don't need both if they are the same&lt;br /&gt;
	&lt;br /&gt;
	local URL_origin = A:ORIGIN('URL');											-- get name of parameter that holds URL&lt;br /&gt;
	local ChapterURL_origin = A:ORIGIN('ChapterURL');							-- get name of parameter that holds ChapterURL&lt;br /&gt;
	local ScriptChapter = A['ScriptChapter'];&lt;br /&gt;
	local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');&lt;br /&gt;
	local Format = A['Format'];&lt;br /&gt;
	local ChapterFormat = A['ChapterFormat'];&lt;br /&gt;
	local TransChapter = A['TransChapter'];&lt;br /&gt;
	local TransChapter_origin = A:ORIGIN ('TransChapter');&lt;br /&gt;
	local TransTitle = A['TransTitle'];&lt;br /&gt;
	local ScriptTitle = A['ScriptTitle'];&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=&lt;br /&gt;
		|encyclopedia= and |article= then map |encyclopedia= to |title=&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['Encyclopedia'];										-- used as a flag by this module and by ~/COinS&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Encyclopedia) then										-- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}&lt;br /&gt;
		if 'encyclopaedia' ~= config.CitationClass and 'citation' ~= config.CitationClass then&lt;br /&gt;
			utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});&lt;br /&gt;
			Encyclopedia = nil;													-- unset because not supported by this template&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then	-- when both set emit an error TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', A:ORIGIN ('Encyclopedia')) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Periodical_origin)});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Encyclopedia) then&lt;br /&gt;
			Periodical = Encyclopedia;											-- error or no, set Periodical to Encyclopedia; allow periodical without encyclopedia&lt;br /&gt;
			Periodical_origin = A:ORIGIN ('Encyclopedia');&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Periodical) then									-- Periodical is set when |encyclopedia= is set&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= to |article= and |encyclopedia= to |title=&lt;br /&gt;
					ScriptChapter = ScriptTitle;&lt;br /&gt;
					ScriptChapter_origin = A:ORIGIN('ScriptTitle')&lt;br /&gt;
					TransChapter = TransTitle;&lt;br /&gt;
					ChapterURL = URL;&lt;br /&gt;
					ChapterURL_origin = URL_origin;&lt;br /&gt;
&lt;br /&gt;
					ChapterUrlAccess = UrlAccess;&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;&lt;br /&gt;
					ChapterFormat = Format;&lt;br /&gt;
					Periodical = '';											-- redundant so unset&lt;br /&gt;
					TransTitle = '';&lt;br /&gt;
					URL = '';&lt;br /&gt;
					Format = '';&lt;br /&gt;
					TitleLink = '';&lt;br /&gt;
					ScriptTitle = '';&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=&lt;br /&gt;
				Periodical = '';												-- redundant so unset&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['ID'];&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['Number']) then									-- cite techreport uses 'number', which other citations alias to 'issue'&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['Number'];												-- yes, use it&lt;br /&gt;
			else																-- ID has a value so emit error message&lt;br /&gt;
				utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'id') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'number')});&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['ChapterLink'];									-- deprecated as a parameter but still used internally by cite episode&lt;br /&gt;
	local Conference = A['Conference'];&lt;br /&gt;
	local BookTitle = A['BookTitle'];&lt;br /&gt;
	local TransTitle_origin = A:ORIGIN ('TransTitle');&lt;br /&gt;
	if 'conference' == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (BookTitle) then&lt;br /&gt;
			Chapter = Title;&lt;br /&gt;
			Chapter_origin = 'title';&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 = '';&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 = '';&lt;br /&gt;
	--		TitleLink = '';&lt;br /&gt;
			TransTitle = '';&lt;br /&gt;
			URL = '';&lt;br /&gt;
		end&lt;br /&gt;
	elseif 'speech' ~= config.CitationClass then&lt;br /&gt;
		Conference = '';														-- not cite conference or cite speech so make sure this is empty string&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- CS1/2 mode&lt;br /&gt;
	local Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], '');&lt;br /&gt;
	-- separator character and postscript&lt;br /&gt;
	local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);&lt;br /&gt;
	-- controls capitalization of certain static text&lt;br /&gt;
	local use_lowercase = ( sepc == ',' );&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['Sheet'] or '';&lt;br /&gt;
	local Sheets = A['Sheets'] or '';&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 ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'map') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Chapter_origin)});	-- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Chapter = A['Map'];&lt;br /&gt;
		Chapter_origin = A:ORIGIN('Map');&lt;br /&gt;
		ChapterURL = A['MapURL'];&lt;br /&gt;
		ChapterURL_origin = A:ORIGIN('MapURL');&lt;br /&gt;
		TransChapter = A['TransMap'];&lt;br /&gt;
		ScriptChapter = A['ScriptMap']&lt;br /&gt;
		ScriptChapter_origin = A:ORIGIN('ScriptMap')&lt;br /&gt;
&lt;br /&gt;
		ChapterUrlAccess = MapUrlAccess;&lt;br /&gt;
		ChapterFormat = A['MapFormat'];&lt;br /&gt;
&lt;br /&gt;
		Cartography = A['Cartography'];&lt;br /&gt;
		if utilities.is_set ( Cartography ) then&lt;br /&gt;
			Cartography = sepc .. &amp;quot; &amp;quot; .. wrap_msg ('cartography', Cartography, use_lowercase);&lt;br /&gt;
		end		&lt;br /&gt;
		Scale = A['Scale'];&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['Series'];&lt;br /&gt;
	if 'episode' == config.CitationClass or 'serial' == config.CitationClass then&lt;br /&gt;
		local SeriesLink = A['SeriesLink'];&lt;br /&gt;
&lt;br /&gt;
		SeriesLink = link_title_ok (SeriesLink, A:ORIGIN ('SeriesLink'), Series, 'series');	-- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set&lt;br /&gt;
&lt;br /&gt;
		local Network = A['Network'];&lt;br /&gt;
		local Station = A['Station'];&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 .. ' ');&lt;br /&gt;
		&lt;br /&gt;
		if 'episode' == config.CitationClass then								-- handle the oddities that are strictly {{cite episode}}&lt;br /&gt;
			local Season = A['Season'];&lt;br /&gt;
			local SeriesNumber = A['SeriesNumber'];&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 ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'season') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'seriesno')});		-- add error message&lt;br /&gt;
				SeriesNumber = '';												-- 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 ('season', Season, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg ('seriesnum', SeriesNumber, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (Issue) then table.insert(s, wrap_msg ('episode', Issue, use_lowercase)); end&lt;br /&gt;
			Issue = '';															-- 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('ScriptTitle');&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 .. ' ');								-- 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 = '';															-- unset&lt;br /&gt;
			TransTitle = '';&lt;br /&gt;
			ScriptTitle = '';&lt;br /&gt;
			Format = '';&lt;br /&gt;
			&lt;br /&gt;
		else																	-- now oddities that are cite serial&lt;br /&gt;
			Issue = '';															-- unset because this parameter no longer supported by the citation/core version of cite serial&lt;br /&gt;
			Chapter = A['Episode'];												-- 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 ('italic-title', 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['TitleType'];&lt;br /&gt;
	local Degree = A['Degree'];&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {'AV-media-notes', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) 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 .. ' ' .. cfg.title_types ['thesis']: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['type'], 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['Date'];&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['PublicationDate'];&lt;br /&gt;
	local Year = A['Year'];&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'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 = '';												-- unset, no longer needed&lt;br /&gt;
			Date_origin = A:ORIGIN('PublicationDate');							-- save the name of the promoted parameter&lt;br /&gt;
		else&lt;br /&gt;
			Date_origin = A:ORIGIN('Year');										-- save the name of the promoted parameter&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Date_origin = A:ORIGIN('Date');											-- not a promotion; name required for error messaging&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if PublicationDate == Date then PublicationDate = ''; end					-- if PublicationDate is same as Date, don'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['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');&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['ArchiveFormat'];&lt;br /&gt;
&lt;br /&gt;
	ArchiveURL, ArchiveDate = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])&lt;br /&gt;
	ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url');&lt;br /&gt;
	&lt;br /&gt;
	ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate);		-- add error message when URL or ChapterURL == ArchiveURL&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	local AccessDate = A['AccessDate'];&lt;br /&gt;
	local LayDate = A['LayDate'];&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['DoiBroken'];&lt;br /&gt;
	local Embargo = A['Embargo'];&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 = '';&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;
			['access-date'] = {val = AccessDate, name = A:ORIGIN ('AccessDate')},&lt;br /&gt;
			['archive-date'] = {val = ArchiveDate, name = A:ORIGIN ('ArchiveDate')},&lt;br /&gt;
			['date'] = {val = Date, name = Date_origin},&lt;br /&gt;
			['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},&lt;br /&gt;
			['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},&lt;br /&gt;
			['lay-date'] = {val = LayDate, name = A:ORIGIN ('LayDate')},&lt;br /&gt;
			['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},&lt;br /&gt;
			['year'] = {val = Year, name = A:ORIGIN ('Year')},&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;
-- start temporary Julian / Gregorian calendar uncertainty categorization&lt;br /&gt;
		if COinS_date.inter_cal_cat then&lt;br /&gt;
			utilities.add_prop_cat ('jul-greg-uncertainty');&lt;br /&gt;
		end&lt;br /&gt;
-- end temporary Julian / Gregorian calendar uncertainty categorization&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 ('Year'), Date, A:ORIGIN ('Date'), 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 ('maint_date_format');					-- 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 ('maint_date_auto_xlated');				-- 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['access-date'].val;			-- overwrite date holding parameters with modified values&lt;br /&gt;
				ArchiveDate = date_parameters_list['archive-date'].val;&lt;br /&gt;
				Date = date_parameters_list['date'].val;&lt;br /&gt;
				DoiBroken = date_parameters_list['doi-broken-date'].val;&lt;br /&gt;
				LayDate = date_parameters_list['lay-date'].val;&lt;br /&gt;
				PublicationDate = date_parameters_list['publication-date'].val;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message ('err_bad_date', {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;
	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's key&lt;br /&gt;
	local Class = A['Class'];													-- arxiv class identifier&lt;br /&gt;
	&lt;br /&gt;
	local ID_support = {&lt;br /&gt;
		{A['ASINTLD'], 'ASIN', 'err_asintld_missing_asin', A:ORIGIN ('ASINTLD')},				&lt;br /&gt;
		{DoiBroken, 'DOI', 'err_doibroken_missing_doi', A:ORIGIN ('DoiBroken')},&lt;br /&gt;
		{Embargo, 'PMC', 'err_embargo_missing_pmc', A:ORIGIN ('Embargo')},&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	ID_list, ID_list_coins = identifiers.identifier_lists_get (args, {DoiBroken = DoiBroken, ASINTLD = A['ASINTLD'], Embargo = Embargo, Class = Class}, ID_support);&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite ssrn}}, before generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list) then	-- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |ssrn= required for their templates&lt;br /&gt;
		if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or 	-- can'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 ('err_' .. config.CitationClass .. '_missing');	-- add error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['ssrn'] = 'Social Science Research Network'})[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], {'off', 'none'}) then -- TODO: remove 'none' once existing citations have been switched to 'off', so 'none' can be used as token for &amp;quot;no title&amp;quot; instead&lt;br /&gt;
		if 'none' ~= 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'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['pmc'] then						-- auto-select PMC&lt;br /&gt;
				URL = identifiers.auto_link_urls['pmc'];						-- set URL to be the same as the PMC external link if not embargoed&lt;br /&gt;
				URL_origin = cfg.id_handlers['PMC'].parameters[1];				-- set URL_origin to parameter name for use in error message if citation is missing a |title=&lt;br /&gt;
			elseif identifiers.auto_link_urls['doi'] then						-- auto-select DOI&lt;br /&gt;
				URL = identifiers.auto_link_urls['doi'];&lt;br /&gt;
				URL_origin = cfg.id_handlers['DOI'].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 ('err_accessdate_missing_url');			-- add an error message&lt;br /&gt;
				AccessDate = '';												-- 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 ('err_archive_missing_url');				-- add an error message&lt;br /&gt;
				ArchiveURL = '';												-- 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'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 ('err_citation_missing_title', {'episode' == config.CitationClass and 'series' or 'title'});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) and&lt;br /&gt;
			utilities.in_array (config.CitationClass, {'journal', 'citation'}) and&lt;br /&gt;
			(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and&lt;br /&gt;
			('journal' == Periodical_origin or 'script-journal' == ScriptPeriodical_origin) then	-- special case for journal cites&lt;br /&gt;
				Title = '';														-- set title to empty string&lt;br /&gt;
				utilities.set_message ('maint_untitled');						-- 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 'encyclopaedia' == config.CitationClass or ('citation' == 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;
		['Periodical'] = utilities.strip_apostrophe_markup (Periodical),		-- no markup in the metadata&lt;br /&gt;
		['Encyclopedia'] = Encyclopedia,										-- just a flag; content ignored by ~/COinS&lt;br /&gt;
		['Chapter'] = metadata.make_coins_title (coins_chapter, ScriptChapter),	-- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		['Degree'] = Degree;													-- cite thesis only&lt;br /&gt;
		['Title'] = metadata.make_coins_title (coins_title, ScriptTitle),		-- Title and ScriptTitle stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		['PublicationPlace'] = PublicationPlace,&lt;br /&gt;
		['Date'] = COinS_date.rftdate,											-- COinS_date has correctly formatted date if Date is valid;&lt;br /&gt;
		['Season'] = COinS_date.rftssn,&lt;br /&gt;
		['Quarter'] = COinS_date.rftquarter,&lt;br /&gt;
		['Chron'] =  COinS_date.rftchron or (not COinS_date.rftdate and Date) or '',	-- chron but if not set and invalid date format use Date; keep this last bit?&lt;br /&gt;
		['Series'] = Series,&lt;br /&gt;
		['Volume'] = Volume,&lt;br /&gt;
		['Issue'] = Issue,&lt;br /&gt;
		['ArticleNumber'] = ArticleNumber,&lt;br /&gt;
		['Pages'] = 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;
		['Edition'] = Edition,&lt;br /&gt;
		['PublisherName'] = PublisherName or Newsgroup,							-- any apostrophe markup already removed from PublisherName&lt;br /&gt;
		['URL'] = first_set ({ChapterURL, URL}, 2),&lt;br /&gt;
		['Authors'] = coins_author,&lt;br /&gt;
		['ID_list'] = ID_list_coins,&lt;br /&gt;
		['RawPage'] = 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}}, and {{cite ssrn}} AFTER generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list) then	-- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, or ssrn now unset so it isn't displayed&lt;br /&gt;
		Periodical = '';														-- 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 'newsgroup' == config.CitationClass and utilities.is_set (Newsgroup) then&lt;br /&gt;
		PublisherName = utilities.substitute (cfg.messages['newsgroup'], external_link( 'news:' .. 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, 'TranslatorList');									-- 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, 'InterviewerList');				-- 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 or 'vanc'&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;
			control.maximum , editor_etal = get_display_names (A['DisplayEditors'], #e, 'editors', editor_etal, A:ORIGIN ('DisplayEditors'));&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;
			control.maximum, interviewer_etal = get_display_names (A['DisplayInterviewers'], #interviewers_list, 'interviewers', interviewer_etal, A:ORIGIN ('DisplayInterviewers'));&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;
			control.maximum, translator_etal = get_display_names (A['DisplayTranslators'], #t, 'translators', translator_etal, A:ORIGIN ('DisplayTranslators'));&lt;br /&gt;
			Translators = list_people (control, t, translator_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do contributors&lt;br /&gt;
			control.maximum, contributor_etal = get_display_names (A['DisplayContributors'], #c, 'contributors', contributor_etal, A:ORIGIN ('DisplayContributors'));&lt;br /&gt;
			Contributors = list_people (control, c, contributor_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do authors&lt;br /&gt;
			control.maximum, author_etal = get_display_names (A['DisplayAuthors'], #a, 'authors', author_etal, A:ORIGIN ('DisplayAuthors'));&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, 'authors');	-- find and remove variations on et al.&lt;br /&gt;
				if author_etal then&lt;br /&gt;
					Authors = Authors .. ' ' .. cfg.messages['et al'];			-- 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 .. ' (' .. Collaboration .. ')';					-- 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['ConferenceFormat'];&lt;br /&gt;
	local ConferenceURL = A['ConferenceURL'];&lt;br /&gt;
	ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, 'conference-format', 'conference-url');&lt;br /&gt;
	Format = style_format (Format, URL, 'format', 'url');&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, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'ssrn'}) or&lt;br /&gt;
		('citation' == 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, 'chapter-format', 'chapter-url');&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;
			('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then	-- and required for {{citation}} with |website= or |script-website=&lt;br /&gt;
				utilities.set_message ('err_cite_web_url');&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 ('err_accessdate_missing_url');&lt;br /&gt;
			AccessDate = '';&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local UrlStatus = is_valid_parameter_value (A['UrlStatus'], A:ORIGIN('UrlStatus'), cfg.keywords_lists['url-status'], '');&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'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 'live' ~= UrlStatus then&lt;br /&gt;
				ChapterURL = ArchiveURL											-- swap-in the archive's URL&lt;br /&gt;
				ChapterURL_origin = A:ORIGIN('ArchiveURL')						-- name of |archive-url= parameter for error messages&lt;br /&gt;
				ChapterFormat = ArchiveFormat or '';							-- swap in archive'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 'live' ~= UrlStatus then											-- if URL set then |archive-url= applies to it&lt;br /&gt;
				URL = ArchiveURL												-- swap-in the archive's URL&lt;br /&gt;
				URL_origin = A:ORIGIN('ArchiveURL')								-- name of archive URL parameter for error messages&lt;br /&gt;
				Format = ArchiveFormat or '';									-- swap in archive'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 ('maint_url_status');								-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'ssrn'}) or	-- if any of the 'periodical' cites except encyclopedia&lt;br /&gt;
		('citation' == 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 ('Chapter')&lt;br /&gt;
			elseif utilities.is_set (TransChapter) then&lt;br /&gt;
				chap_param = A:ORIGIN ('TransChapter')&lt;br /&gt;
			elseif utilities.is_set (ChapterURL) then&lt;br /&gt;
				chap_param = A:ORIGIN ('ChapterURL')&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 ('ChapterFormat')&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 ('err_chapter_ignored', {chap_param});	-- add error message&lt;br /&gt;
				Chapter = '';													-- and set them to empty string to be safe with concatenation&lt;br /&gt;
				TransChapter = '';&lt;br /&gt;
				ChapterURL = '';&lt;br /&gt;
				ScriptChapter = '';&lt;br /&gt;
				ChapterFormat = '';&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 'map' == config.CitationClass and utilities.is_set (TitleType) then&lt;br /&gt;
				Chapter = Chapter .. ' ' .. TitleType;							-- map annotation here; not after title&lt;br /&gt;
			end&lt;br /&gt;
			Chapter = Chapter .. sepc .. ' ';&lt;br /&gt;
		elseif utilities.is_set (ChapterFormat) then							-- |chapter= not set but |chapter-format= is so ...&lt;br /&gt;
			Chapter = ChapterFormat .. sepc .. ' ';								-- ... 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 ('' == Title) then										-- only support forced empty for now &amp;quot;(())&amp;quot;&lt;br /&gt;
		Title = cfg.messages['notitle'];										-- replace by predefined &amp;quot;No title&amp;quot; message&lt;br /&gt;
			-- TODO: utilities.set_message ( 'err_redundant_parameters', ...);	-- issue proper error message instead of muting	 &lt;br /&gt;
			ScriptTitle = '';													-- just mute for now	 &lt;br /&gt;
			TransTitle = '';													-- just mute for now&lt;br /&gt;
 		plain_title = true;														-- suppress text decoration for descriptive title&lt;br /&gt;
		utilities.set_message ('maint_untitled');								-- 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 '...' == Title:sub (-3) then											-- if ellipsis is the last three characters of |title=&lt;br /&gt;
			Title = Title:gsub ('(%.%.%.)%.+$', '%1');							-- limit the number of dots to three&lt;br /&gt;
		elseif not mw.ustring.find (Title, '%.%s*%a%.$') and					-- end of title is not a 'dot-(optional space-)letter-dot' initialism ...&lt;br /&gt;
			not mw.ustring.find (Title, '%s+%a%.$') then						-- ...and not a 'space-letter-dot' initial (''Allium canadense'' L.)&lt;br /&gt;
				Title = mw.ustring.gsub(Title, '%' .. sepc .. '$', '');			-- 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 ('maint_archived_copy');						-- add maintenance category before we modify the content of Title&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if is_generic ('generic_titles', Title) then&lt;br /&gt;
			utilities.set_message ('err_generic_title');						-- 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, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', 'ssrn'}) or&lt;br /&gt;
		('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or&lt;br /&gt;
		('map' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then		-- special case for cite map when the map is in a periodical treat as an article&lt;br /&gt;
			Title = kern_quotes (Title);										-- if necessary, separate title's leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			Title = utilities.wrap_style ('quoted-title', Title);&lt;br /&gt;
			Title = script_concatenate (Title, ScriptTitle, 'script-title');	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
			TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );&lt;br /&gt;
	elseif plain_title or ('report' == config.CitationClass) then				-- no styling for cite report and descriptive titles (otherwise same as above)&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, 'script-title');		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );	-- for cite report, use this form for trans-title&lt;br /&gt;
	else&lt;br /&gt;
		Title = utilities.wrap_style ('italic-title', Title);&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, 'script-title');		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style ('trans-italic-title', 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 ('err_trans_missing_title', {'title'});&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 ('err_wikilink_in_url');						-- set an error message because we can't have both&lt;br /&gt;
			TitleLink = '';														-- 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 = '';															-- 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 .. '&amp;amp;nbsp;', 'ws link in title-link');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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('^[\'&amp;quot;]*(.-)[\'&amp;quot;]*$', '%1'));	-- 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 ('%b[]', ws_label);							-- replace interwiki link with ws_label to retain markup&lt;br /&gt;
				Title = external_link (ws_url, Title .. '&amp;amp;nbsp;', 'ws link in title');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 ('written', Place, use_lowercase) .. sepc .. &amp;quot; &amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ConferenceURL_origin = A:ORIGIN('ConferenceURL');						-- 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 = '';&lt;br /&gt;
	if not utilities.is_set (Position) then&lt;br /&gt;
		local Minutes = A['Minutes'];&lt;br /&gt;
		local Time = A['Time'];&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 ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'minutes') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'time')});&lt;br /&gt;
			end&lt;br /&gt;
			Position = &amp;quot; &amp;quot; .. Minutes .. &amp;quot; &amp;quot; .. cfg.messages['minutes'];&lt;br /&gt;
		else&lt;br /&gt;
			if utilities.is_set (Time) then&lt;br /&gt;
				local TimeCaption = A['TimeCaption']&lt;br /&gt;
				if not utilities.is_set (TimeCaption) then&lt;br /&gt;
					TimeCaption = cfg.messages['event'];&lt;br /&gt;
					if sepc ~= '.' 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 = '';&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 == 'map' then&lt;br /&gt;
		local Sections = A['Sections'];											-- Section (singular) is an alias of Chapter so set earlier&lt;br /&gt;
		local Inset = A['Inset'];&lt;br /&gt;
		&lt;br /&gt;
		if utilities.is_set ( Inset ) then&lt;br /&gt;
			Inset = sepc .. &amp;quot; &amp;quot; .. wrap_msg ('inset', 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 ('sections', Sections, use_lowercase);&lt;br /&gt;
		elseif utilities.is_set ( Section ) then&lt;br /&gt;
			Section = sepc .. &amp;quot; &amp;quot; .. wrap_msg ('section', 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['Others'];&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 'false' positives right now&lt;br /&gt;
			utilities.set_message ('maint_others_avm')&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message ('maint_others');&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 .. ' ', wrap_msg ('translated', 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 .. ' ', wrap_msg ('interview', Interviewers, use_lowercase), Others}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local TitleNote = A['TitleNote'];&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 ('%f[%a][Ee]d%n?%.?$') or Edition:match ('%f[%a][Ee]dition$') then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.&lt;br /&gt;
			utilities.set_message ('err_extra_text_edition');					 -- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Edition = &amp;quot; &amp;quot; .. wrap_msg ('edition', Edition);&lt;br /&gt;
	else&lt;br /&gt;
		Edition = '';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	Series = utilities.is_set (Series) and wrap_msg ('series', {sepc, Series}) or &amp;quot;&amp;quot;;	-- not the same as SeriesNum&lt;br /&gt;
	local Agency = A['Agency'];&lt;br /&gt;
	Agency = utilities.is_set (Agency) and wrap_msg ('agency', {sepc, Agency}) or &amp;quot;&amp;quot;;&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['retrieved']&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['accessdate'], {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['Docket'];&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 .. ' ' .. 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;
	local Quote = A['Quote'];&lt;br /&gt;
	local TransQuote = A['TransQuote'];&lt;br /&gt;
	local ScriptQuote = A['ScriptQuote'];&lt;br /&gt;
	if utilities.is_set (Quote) or utilities.is_set (TransQuote) or utilities.is_set (ScriptQuote) then&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Quote) then&lt;br /&gt;
			if Quote:sub(1, 1) == '&amp;quot;' and Quote:sub(-1, -1) == '&amp;quot;' 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 ('quoted-text', Quote );					-- wrap in &amp;lt;q&amp;gt;...&amp;lt;/q&amp;gt; tags&lt;br /&gt;
	&lt;br /&gt;
		if utilities.is_set (ScriptQuote) then&lt;br /&gt;
			Quote = script_concatenate (Quote, ScriptQuote, 'script-quote');	-- &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 (TransQuote) then&lt;br /&gt;
			if TransQuote:sub(1, 1) == '&amp;quot;' and TransQuote:sub(-1, -1) == '&amp;quot;' then -- if first and last characters of |trans-quote are quote marks&lt;br /&gt;
				TransQuote = TransQuote:sub(2, -2); -- strip them off&lt;br /&gt;
			end&lt;br /&gt;
			Quote = Quote .. &amp;quot; &amp;quot; .. utilities.wrap_style ('trans-quoted-title', TransQuote );&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (QuotePage) or utilities.is_set (QuotePages) then	-- add page prefix&lt;br /&gt;
			local quote_prefix = '';&lt;br /&gt;
			if utilities.is_set (QuotePage) then&lt;br /&gt;
				extra_text_in_page_check (QuotePage, 'quote-page');				-- 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['p-prefix'], {sepc, QuotePage}), '', '', '';&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePage}), '', '', '';&lt;br /&gt;
				end&lt;br /&gt;
			elseif utilities.is_set (QuotePages) then&lt;br /&gt;
				extra_text_in_page_check (QuotePages, 'quote-pages');			-- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.&lt;br /&gt;
				if tonumber(QuotePages) ~= nil and not NoPP then				-- if only digits, assume single page&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePages}), '', '';&lt;br /&gt;
				elseif not NoPP then&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, QuotePages}), '', '';&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePages}), '', '';&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;
	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'd otherwise emit a message even if there wasn'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 ('maint_postscript')&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Archived;&lt;br /&gt;
	if utilities.is_set (ArchiveURL) then&lt;br /&gt;
		local arch_text;&lt;br /&gt;
		if not utilities.is_set (ArchiveDate) then&lt;br /&gt;
			utilities.set_message ('err_archive_missing_date');&lt;br /&gt;
			ArchiveDate = '';													-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
		if &amp;quot;live&amp;quot; == UrlStatus then&lt;br /&gt;
			arch_text = cfg.messages['archived'];&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 .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],&lt;br /&gt;
					{external_link( ArchiveURL, arch_text, A:ORIGIN('ArchiveURL'), nil) .. ArchiveFormat, ArchiveDate } );&lt;br /&gt;
			else&lt;br /&gt;
				Archived = '';&lt;br /&gt;
			end&lt;br /&gt;
			if not utilities.is_set (OriginalURL) then&lt;br /&gt;
				utilities.set_message ('err_archive_missing_url');&lt;br /&gt;
				Archived = '';													-- empty string for concatenation&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (OriginalURL) then								-- UrlStatus is empty, 'dead', 'unfit', 'usurped', 'bot: unknown'&lt;br /&gt;
			if utilities.in_array (UrlStatus, {'unfit', 'usurped', 'bot: unknown'}) then&lt;br /&gt;
				arch_text = cfg.messages['archived-unfit'];&lt;br /&gt;
				if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
				Archived = sepc .. ' ' .. arch_text .. ArchiveDate;				-- format already styled&lt;br /&gt;
				if 'bot: unknown' == UrlStatus then&lt;br /&gt;
					utilities.set_message ('maint_bot_unknown');				-- and add a category if not already added&lt;br /&gt;
				else&lt;br /&gt;
					utilities.set_message ('maint_unfit');						-- and add a category if not already added&lt;br /&gt;
				end&lt;br /&gt;
			else																-- UrlStatus is empty, 'dead'&lt;br /&gt;
				arch_text = cfg.messages['archived-dead'];&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['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } );	-- format already styled&lt;br /&gt;
				else&lt;br /&gt;
					Archived = '';												-- unset for concatenation&lt;br /&gt;
				end&lt;br /&gt;
			end	&lt;br /&gt;
		else																	-- OriginalUrl not set&lt;br /&gt;
			arch_text = cfg.messages['archived-missing'];&lt;br /&gt;
			if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
			utilities.set_message ('err_archive_missing_url');&lt;br /&gt;
			Archived = '';														-- 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 = '';&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Lay = '';&lt;br /&gt;
	local LaySource = A['LaySource'];&lt;br /&gt;
	local LayURL = A['LayURL'];&lt;br /&gt;
	local LayFormat = A['LayFormat'];&lt;br /&gt;
	LayFormat = style_format (LayFormat, LayURL, 'lay-format', 'lay-url');&lt;br /&gt;
	if utilities.is_set (LayURL) then&lt;br /&gt;
		if utilities.is_set (LayDate) then LayDate = &amp;quot; (&amp;quot; .. LayDate .. &amp;quot;)&amp;quot; end&lt;br /&gt;
		if utilities.is_set (LaySource) then &lt;br /&gt;
			LaySource = &amp;quot; &amp;amp;ndash; ''&amp;quot; .. utilities.safe_for_italics (LaySource) .. &amp;quot;''&amp;quot;;&lt;br /&gt;
		else&lt;br /&gt;
			LaySource = &amp;quot;&amp;quot;;&lt;br /&gt;
		end&lt;br /&gt;
		if sepc == '.' then&lt;br /&gt;
			Lay = sepc .. &amp;quot; &amp;quot; .. external_link( LayURL, cfg.messages['lay summary'], A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate&lt;br /&gt;
		else&lt;br /&gt;
			Lay = sepc .. &amp;quot; &amp;quot; .. external_link( LayURL, cfg.messages['lay summary']:lower(), A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate&lt;br /&gt;
		end			&lt;br /&gt;
	elseif utilities.is_set (LayFormat) then									-- Test if |lay-format= is given without giving a |lay-url=&lt;br /&gt;
		Lay = sepc .. LayFormat;												-- if set and LayURL not set, then LayFormat has error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local TranscriptURL = A['TranscriptURL']&lt;br /&gt;
	local TranscriptFormat = A['TranscriptFormat'];&lt;br /&gt;
	TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, 'transcript-format', 'transcripturl');&lt;br /&gt;
	local Transcript = A['Transcript'];&lt;br /&gt;
	local TranscriptURL_origin = A:ORIGIN('TranscriptURL');						-- 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 .. ' ' .. 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 ('published', 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;
	local TransPeriodical =  A['TransPeriodical'];&lt;br /&gt;
	local TransPeriodical_origin =  A:ORIGIN ('TransPeriodical');&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['Language'];&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='';															-- 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 = '';															-- 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;journal&amp;quot;, &amp;quot;citation&amp;quot;}) and utilities.is_set (Periodical) then&lt;br /&gt;
		if not (utilities.is_set (Authors) or utilities.is_set (Editors)) then&lt;br /&gt;
			Others = Others:gsub ('^' .. sepc .. ' ', '');						-- when no authors and no editors, strip leading sepc and space&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Others) then Others = safe_join ({Others, sepc .. &amp;quot; &amp;quot;}, sepc) end		-- add terminal punctuation &amp;amp; space; check for dup sepc; TODO why do we need to do this here?&lt;br /&gt;
		tcommon = safe_join( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume}, sepc );&lt;br /&gt;
	elseif 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( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );&lt;br /&gt;
		else&lt;br /&gt;
			tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif 'map' == 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, Format, 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, Format, 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, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc );&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	elseif 'episode' == 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, Format, TitleType, Series, Language, &lt;br /&gt;
			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['Via'];&lt;br /&gt;
	Via = utilities.is_set (Via) and  wrap_msg ('via', Via) or '';&lt;br /&gt;
	local idcommon;&lt;br /&gt;
	if 'audio-visual' == config.CitationClass or 'episode' == 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, Lay, Quote }, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Lay, 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['OrigDate'];&lt;br /&gt;
	OrigDate = utilities.is_set (OrigDate) and wrap_msg ('origdate', OrigDate) or '';&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'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 = &amp;quot; &amp;quot;;&lt;br /&gt;
			local post_text = &amp;quot;&amp;quot;;&lt;br /&gt;
			if utilities.is_set (Chapter) and 0 == #c then&lt;br /&gt;
				in_text = in_text .. cfg.messages['in'] .. &amp;quot; &amp;quot;&lt;br /&gt;
				if (sepc ~= '.') 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 = &amp;quot; (&amp;quot; .. cfg.messages['editor'] .. &amp;quot;)&amp;quot;;				-- be consistent with no-author, no-date case&lt;br /&gt;
			else&lt;br /&gt;
				post_text = &amp;quot; (&amp;quot; .. cfg.messages['editors'] .. &amp;quot;)&amp;quot;;&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're citing the intro, preface, etc.&lt;br /&gt;
			local by_text = sepc .. ' ' .. cfg.messages['by'] .. ' ';&lt;br /&gt;
			if (sepc ~= '.') 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'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['sep_name'] .. cfg.messages['editor'];&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editors'];&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['editor'] .. &amp;quot;)&amp;quot; .. sepc .. &amp;quot; &amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. &amp;quot; (&amp;quot; .. cfg.messages['editors'] .. &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;
		text = text:sub(1, -sepc:len() - 1);&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&lt;br /&gt;
	if A['Ref'] ~= 'harv' then&lt;br /&gt;
		Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true);	-- nil when |ref=harv; A['Ref'] else&lt;br /&gt;
	else&lt;br /&gt;
		Ref = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] 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 '') then	-- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison&lt;br /&gt;
				utilities.set_message ('maint_ref_duplicates_default');&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			citeref_id = '';													-- 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('%b&amp;lt;&amp;gt;', '')) &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 = '';																-- blank the the citation&lt;br /&gt;
		utilities.set_message ('err_empty_citation');							-- 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['cite-id'], {mw.uri.anchorEncode(options_t.id), mw.text.nowiki(options_t.class), text}));	-- when |ref= is set or when there is a namelist&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation['cite'], {mw.text.nowiki(options_t.class), text}));	-- when |ref=none or when namelist_t empty and |ref= is missing or is empty&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if OCinSoutput then															-- blanked when citation is 'empty' so don't bother to add boilerplate metadata span&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation['ocins'], OCinSoutput));	-- format and append metadata to the citation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local template_name = ('citation' == config.CitationClass) and 'citation' or 'cite ' .. (cfg.citation_class_map_t[config.CitationClass] or config.CitationClass);&lt;br /&gt;
	local template_link = '[[Template:' .. template_name .. '|' .. template_name .. ']]';&lt;br /&gt;
	local msg_prefix = '&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;{{' .. template_link .. '}}&amp;lt;/code&amp;gt;: ';&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, ' ');											-- 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 ('cs1-visible-error', 1, true) then						-- look for the visible error class name&lt;br /&gt;
				hidden = false;													-- found one; so don'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, '; '));			-- 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, ' (', utilities.substitute (cfg.messages[':cat wikilink'], v), ')'})&lt;br /&gt;
				);&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation['hidden-maint'], table.concat (maint_msgs_t, ' ')));	-- wrap the group of maint messages with proper presentation and save&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not no_tracking_cats then&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));&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));&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['cat wikilink'], v));&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'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;															-- for enumerated parameters, is name with enumerator replaced with '#'&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 'tracked' == state then&lt;br /&gt;
			local base_name = name:gsub ('%d', '');								-- strip enumerators from parameter names that have them to get the base name&lt;br /&gt;
			utilities.add_prop_cat ('tracked-param', {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 ('#') then														-- # is a cs1|2 reserved character so parameters with # not permitted&lt;br /&gt;
		return nil;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cite_class, whitelist.preprint_template_list ) then	-- limited parameter sets allowed for these templates&lt;br /&gt;
		state = whitelist.limited_basic_arguments[name];&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
		state = whitelist.preprint_arguments[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;
																				-- limited enumerated parameters list&lt;br /&gt;
		enum_name = name:gsub(&amp;quot;%d+&amp;quot;, &amp;quot;#&amp;quot; );										-- replace digit(s) with # (last25 becomes last#) (mw.ustring because non-Western 'local' digits)&lt;br /&gt;
		state = whitelist.limited_numbered_arguments[enum_name];&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) then 	-- experiment for template-specific parameters for templates that accept parameters from the basic argument list&lt;br /&gt;
		state = whitelist.unique_arguments[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.basic_arguments[name];									-- all other templates; all normal parameters allowed&lt;br /&gt;
	if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
																				-- all enumerated parameters allowed&lt;br /&gt;
	enum_name = name:gsub(&amp;quot;%d+&amp;quot;, &amp;quot;#&amp;quot; );											-- replace digit(s) with # (last25 becomes last#) (mw.ustring because non-Western 'local' digits)&lt;br /&gt;
	state = whitelist.numbered_arguments[enum_name];&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 ('%[%[(%a+):');									-- 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 ('err_bad_paramlink', 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 ('%b&amp;lt;&amp;gt;', '');											-- remove XML/HTML tags because attributes: class=, title=, etc.&lt;br /&gt;
&lt;br /&gt;
	capture = value:match ('%s+(%a[%w%-]+)%s*=') or value:match ('^(%a[%w%-]+)%s*=');	-- 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 ('err_missing_pipe', 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 'number' == type (param) then&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	param = param:gsub ('%d+', '#');											-- 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 ('[,;:]$') then&lt;br /&gt;
		utilities.set_message ('maint_extra_punct');							-- has extraneous punctuation; add maint cat&lt;br /&gt;
	end&lt;br /&gt;
	if value:match ('^=') then													-- sometimes an extraneous '=' character appears ...&lt;br /&gt;
		utilities.set_message ('maint_extra_punct');							-- 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 _ 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 (url_param_t)&lt;br /&gt;
	local url_error_t = {};&lt;br /&gt;
	&lt;br /&gt;
	check_for_url (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 ('err_param_has_ext_link', {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;
This is used by templates such as {{cite book}} to create the actual citation text.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citation(frame)&lt;br /&gt;
	Frame = frame;																-- save a copy in case we need to display an error message in preview mode&lt;br /&gt;
&lt;br /&gt;
	local config = {};															-- table to store parameters from the module {{#invoke:}}&lt;br /&gt;
	for k, v in pairs( frame.args ) do											-- get parameters from the {{#invoke}} frame&lt;br /&gt;
		config[k] = v;&lt;br /&gt;
	--	args[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;
																				-- 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 '' ~= config.SandboxPath) and config.SandboxPath) or '/sandbox';	-- 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 '';										-- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else&lt;br /&gt;
&lt;br /&gt;
	local pframe = frame:getParent()&lt;br /&gt;
	local styles;&lt;br /&gt;
	&lt;br /&gt;
	cfg = mw.loadData ('Module:Citation/CS1/Configuration' .. sandbox);			-- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else&lt;br /&gt;
	whitelist = mw.loadData ('Module:Citation/CS1/Whitelist' .. sandbox);&lt;br /&gt;
	utilities = require ('Module:Citation/CS1/Utilities' .. sandbox);&lt;br /&gt;
	validation = require ('Module:Citation/CS1/Date_validation' .. sandbox);&lt;br /&gt;
	identifiers = require ('Module:Citation/CS1/Identifiers' .. sandbox);&lt;br /&gt;
	metadata = require ('Module:Citation/CS1/COinS' .. sandbox);&lt;br /&gt;
	styles = 'Module:Citation/CS1' .. sandbox .. '/styles.css';&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 ('{{REVISIONID}}'));&lt;br /&gt;
&lt;br /&gt;
	local args = {};															-- table where we store all of the template's arguments&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( pframe.args ) do											-- get parameters from the parent (template) frame&lt;br /&gt;
		v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1');							-- trim leading/trailing whitespace; when v is only whitespace, becomes empty string&lt;br /&gt;
		if v ~= '' then&lt;br /&gt;
			if ('string' == type (k)) then&lt;br /&gt;
				k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits);		-- for enumerated parameters, translate 'local' 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) ~= 'string' 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 ('err_text_ignored', {v});&lt;br /&gt;
					end&lt;br /&gt;
				elseif validate (k:lower(), config.CitationClass) then &lt;br /&gt;
					error_text = utilities.set_message ('err_parameter_ignored_suggest', {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 ('Module:Citation/CS1/Suggestions' .. 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 ('err_parameter_ignored_suggest', {k, param});	-- set the suggestion error message&lt;br /&gt;
							else&lt;br /&gt;
								error_text = utilities.set_message ('err_parameter_ignored', {k});	-- suggested param not supported by this template&lt;br /&gt;
								v = '';											-- 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'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 ('err_parameter_ignored_suggest', {k, suggestions.suggestions[ k:lower() ]});&lt;br /&gt;
						else&lt;br /&gt;
							utilities.set_message ('err_parameter_ignored', {k});&lt;br /&gt;
							v = '';												-- 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 = ('' == k) and '(empty string)' 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 ('parameter', 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 == 'postscript') then						-- when args[k] has a value from {{#invoke}} frame (we don'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 ('err_param_unknown_empty', {&lt;br /&gt;
			1 == #empty_unknowns and '' or 's',&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 url_param_t = {};&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if 'string' == type (k) then											-- don'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 'string' == type (k) and not cfg.url_skip[k] then					-- when parameter k is not positional and not in url skip table&lt;br /&gt;
			url_param_t[k] = v;													-- make a parameter/value list for extraneous url check&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	has_extraneous_url (url_param_t);											-- look for url in parameter values where a url does not belong&lt;br /&gt;
&lt;br /&gt;
	return table.concat ({&lt;br /&gt;
		frame:extensionTag ('templatestyles', '', {src=styles}),&lt;br /&gt;
		citation0( config, args)&lt;br /&gt;
	});&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 {citation = citation};&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1&amp;diff=5304678</id>
		<title>Module:Citation/CS1</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1&amp;diff=5304678"/>
		<updated>2023-05-19T10:29:36Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require('strict');&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 Frame;																	-- holds the module's frame table&lt;br /&gt;
local is_preview_mode;															-- true when article is in preview mode; false when using 'Preview page with this template' (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 'for _, val in pairs do' 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'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've added this category&lt;br /&gt;
	utilities.set_message ('err_vancouver', {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 ('^%a[%a%d%+%.%-]*:');						-- 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 '//' (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 ('^//', '');											-- strip '//' 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 ('^[%w]') 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 ('^%a+:') 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;
		'%f[%w][%w][%w%-]+[%w]%.%a%a+$',										-- three or more character hostname.hostname or hostname.tld&lt;br /&gt;
		'%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$',									-- internationalized domain name with ACE prefix&lt;br /&gt;
		'%f[%a][qxz]%.com$',													-- assigned one character .com hostname (x.com times out 2015-12-10)&lt;br /&gt;
		'%f[%a][iq]%.net$',														-- assigned one character .net hostname (q.net registered but not active 2015-12-10)&lt;br /&gt;
		'%f[%w][%w]%.%a%a$',													-- one character hostname and ccTLD (2 chars)&lt;br /&gt;
		'%f[%w][%w][%w]%.%a%a+$',												-- two character hostname and TLD&lt;br /&gt;
		'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?',								-- IPv4 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 ('%f[%w][%w]%.' .. d) then&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false;																-- no matches, we don'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 '/' characters immediately following the scheme'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'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 ('([%a%d])%.?[/%?#].*$', '%1');						-- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of '//')&lt;br /&gt;
&lt;br /&gt;
	if url_str:match ('^//%S*') then											-- if there is what appears to be a protocol-relative URL&lt;br /&gt;
		domain = url_str:match ('^//(%S*)')&lt;br /&gt;
	elseif url_str:match ('%S-:/*%S+') 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 ('(%S-:)(/*)(%S+)');			-- extract the scheme, authority indicator, and domain portions&lt;br /&gt;
		if utilities.is_set (authority) then&lt;br /&gt;
			authority = authority:gsub ('//', '', 1);							-- replace place 1 pair of '/' with nothing;&lt;br /&gt;
			if utilities.is_set(authority) then									-- if anything left (1 or 3+ '/' 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 ('^news:') then									-- except for news:..., MediaWiki won'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 ('(%a):%d+', '%1');								-- 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 ('[&amp;lt;&amp;gt;%[%]|{}]') 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't bother if &amp;lt;param&amp;gt;-link doesn'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 ('%[%[') then											-- check |title= for wikilink markup&lt;br /&gt;
			orig = torig;														-- identify the failing |title= parameter&lt;br /&gt;
		elseif link:match ('^%a+:') then										-- if the link is what looks like an interwiki&lt;br /&gt;
			local prefix = link:match ('^(%a+):'):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 = '';																-- unset&lt;br /&gt;
		utilities.set_message ('err_bad_paramlink', 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'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 'news:' == scheme then													-- special case for newsgroups&lt;br /&gt;
		return domain:match('^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$');&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 '//Hus' 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 ('%f[%[]%[%a%S*:%S+.*%]') then								-- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match ('%f[%[]%[(%a%S*:%S+).*%]'));&lt;br /&gt;
	elseif value:match ('%f[%[]%[//%S+.*%]') then								-- if protocol-relative ext. wikilink: [//yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match ('%f[%[]%[(//%S+).*%]'));&lt;br /&gt;
	elseif value:match ('%a%S*:%S+') then										-- if bare URL with scheme; may have leading or trailing plain text&lt;br /&gt;
		scheme, domain = split_url (value:match ('(%a%S*:%S+)'));&lt;br /&gt;
	elseif value:match ('//%S+') then											-- if protocol-relative bare URL: //yyyyy.zzz; may have leading or trailing plain text&lt;br /&gt;
		scheme, domain = split_url (value:match ('(//%S+)'));					-- what is left should be the domain&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- didn'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 ('parameter', 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 ('err_wikilink_in_url', {});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return str:gsub( '[%[%]\n]', {	&lt;br /&gt;
		['['] = '&amp;amp;#91;',&lt;br /&gt;
		[']'] = '&amp;amp;#93;',&lt;br /&gt;
		['\n'] = ' ' } );&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 = '';&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 ('err_bare_url_missing_title', {utilities.wrap_style ('parameter', 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 ('err_bad_url', {utilities.wrap_style ('parameter', source)});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	domain, path = URL:match ('^([/%.%-%+:%a%d]+)([/%?#].*)$');					-- 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 ('[%[%]]', {['['] = '%5b', [']'] = '%5d'});			-- replace '[' and ']' 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['ext-link-access-signal'], {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've added this category&lt;br /&gt;
		utilities.set_message ('err_deprecated_params', {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's value.&lt;br /&gt;
&lt;br /&gt;
This function will positive kern either single or double quotes:&lt;br /&gt;
	&amp;quot;'Unkerned title with leading and trailing single quote marks'&amp;quot;&lt;br /&gt;
	&amp;quot; 'Kerned title with leading and trailing single quote marks' &amp;quot; (in real life the kerning isn'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 = '';&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, '%[%[[\&amp;quot;“”\'‘’].+[\&amp;quot;“”\'‘’]%]%]') then		-- leading and trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-left'], str);&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-right'], str);&lt;br /&gt;
		elseif mw.ustring.match (str, '%[%[[\&amp;quot;“”\'‘’].+%]%]')	then			-- leading quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-left'], str);&lt;br /&gt;
		elseif mw.ustring.match (str, '%[%[.+[\&amp;quot;“”\'‘’]%]%]') then				-- trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation['kern-right'], 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, '[“”]', '\&amp;quot;');							-- replace “” (U+201C &amp;amp; U+201D) with &amp;quot; (typewriter double quote mark)&lt;br /&gt;
		label = mw.ustring.gsub (label, '[‘’]', '\'');							-- replace ‘’ (U+2018 &amp;amp; U+2019) with ' (typewriter single quote mark)&lt;br /&gt;
&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^([\&amp;quot;\'][^\'].+)&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['kern-left'], cap);&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^(.+[^\'][\&amp;quot;\'])$&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['kern-right'], 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='';																-- initialize to empty string&lt;br /&gt;
	local name;&lt;br /&gt;
	if script_value:match('^%l%l%l?%s*:') then									-- if first 3 or 4 non-space characters are script language prefix&lt;br /&gt;
		lang = script_value:match('^(%l%l%l?)%s*:%s*%S.*');						-- 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 ('err_script_parameter', {script_param, cfg.err_msg_supl['missing title part']});		-- prefix without 'title'; add error message&lt;br /&gt;
			return '';															-- 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_code_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 ('^%l+%s*:%s*', '');				-- 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 ('script', {name, lang})&lt;br /&gt;
			else&lt;br /&gt;
				utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['unknown language code']});	-- unknown script-language; add error message&lt;br /&gt;
			end&lt;br /&gt;
			lang = ' lang=&amp;quot;' .. lang .. '&amp;quot; ';									-- convert prefix into a lang attribute&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['invalid language code']});		-- invalid language code; add error message&lt;br /&gt;
			lang = '';															-- invalid so set lang to empty string&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing prefix']});				-- no language code prefix; add error message&lt;br /&gt;
	end&lt;br /&gt;
	script_value = utilities.substitute (cfg.presentation['bdi'], {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 .. ' ' .. 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 ({'https://', cfg.this_wiki_code, '.wikisource.org/wiki/'});&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 ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)');		-- 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 ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)');		-- 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 ('^[Ww]ikisource:(.+)') or L:match ('^[Ss]:(.+)');		-- 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, 'WIKI');								-- make a usable URL&lt;br /&gt;
		ws_url = ws_url:gsub ('%%23', '#');										-- 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 = '';														-- to be safe for concatenation&lt;br /&gt;
	else&lt;br /&gt;
		periodical = utilities.wrap_style ('italic-title', 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 ('trans-italic-title', trans_periodical);&lt;br /&gt;
		if utilities.is_set (periodical) then&lt;br /&gt;
			periodical = periodical .. ' ' .. 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 ('err_trans_missing_title', {'periodical'});&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 ('_', ' ');									-- 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 = '';															-- 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's leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			chapter = utilities.wrap_style ('quoted-title', 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 .. '&amp;amp;nbsp;', 'ws link in chapter');	-- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?&lt;br /&gt;
		chapter = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 ('trans-quoted-title', trans_chapter);&lt;br /&gt;
		if utilities.is_set (chapter) then&lt;br /&gt;
			chapter = chapter .. ' ' .. 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 ('trans%-?(.+)');		-- when no chapter, get matching name from trans-&amp;lt;param&amp;gt;&lt;br /&gt;
			utilities.set_message ('err_trans_missing_title', {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'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 = '';														-- 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, '[%w%p ]*');										-- 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'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 'nowiki' == capture or 'math' == capture or						-- nowiki and math stripmarkers (not an error condition)&lt;br /&gt;
				('templatestyles' == capture and utilities.in_array (param, {'id', 'quote'})) 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'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 .. ' ' .. char_name;&lt;br /&gt;
				else&lt;br /&gt;
					err_msg = char_name .. ' ' .. 'character';&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				utilities.set_message ('err_invisible_char', {err_msg, utilities.wrap_style ('parameter', 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 ) == 'table' then&lt;br /&gt;
				v, origin[k] = utilities.select_one ( args, list, 'err_redundant_parameters' );&lt;br /&gt;
				if origin[k] == nil then&lt;br /&gt;
					origin[k] = '';												-- 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['unknown_argument_map'] .. ': ' .. 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 = '';&lt;br /&gt;
				origin[k] = '';&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 = '';&lt;br /&gt;
	local cap2 = '';&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['nowrap1'], 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['nowrap2'], {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 'none' == cfg.keywords_xlate[title_type] then&lt;br /&gt;
			title_type = '';													-- 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 '';									-- set template'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 'duplicate character'&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 = '';																-- the output string&lt;br /&gt;
	local comp = '';															-- what does 'comp' mean?&lt;br /&gt;
	local end_chr = '';&lt;br /&gt;
	local trim;&lt;br /&gt;
	for _, value in ipairs( tbl ) do&lt;br /&gt;
		if value == nil then value = ''; end&lt;br /&gt;
		&lt;br /&gt;
		if str == '' 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 ~= '' then&lt;br /&gt;
			if value:sub(1, 1) == '&amp;lt;' 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: 'First element' .. 'sepc next element' .. 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;'&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'' &lt;br /&gt;
						str = f.sub(str, 1, -4) .. &amp;quot;''&amp;quot;;						-- remove them and add back ''&lt;br /&gt;
					elseif  f.sub(str, -5, -1) == duplicate_char .. &amp;quot;]]''&amp;quot; then	-- if last five chars of str are sepc]]'' &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;]''&amp;quot; then	-- if last four chars of str are sepc]'' &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 .. '&amp;quot;]' 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;'']&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, {'Jr', 'Sr', 'Jnr', 'Snr', '1st', '2nd', '3rd'}) or suffix:match ('^%dth$') 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'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%']*$&amp;quot;)&lt;br /&gt;
	or nil == mw.ustring.find (first, &amp;quot;^[A-Za-zÀ-ÖØ-öø-ƿǄ-ɏ%-%s%'%.]+[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 ('[,%s]') then											-- when there is a space or comma, might be first name/initials + generational suffix&lt;br /&gt;
			first = first:match ('(.-)[,%s]+');									-- get name/initials&lt;br /&gt;
			suffix = first:match ('[,%s]+(.+)$');								-- 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%-%s%']*$&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%-%s%'%.]*$&amp;quot;) then&lt;br /&gt;
			add_vanc_error (cfg.err_msg_supl['non-Latin char'], 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;
	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, names = {}, {};												-- 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 = mw.text.split (first, '[%s,]+');									-- split into a table of names and possible suffix&lt;br /&gt;
&lt;br /&gt;
	while names[i] do															-- loop through the table&lt;br /&gt;
		if 1 &amp;lt; i and names[i]:match ('[%dJS][%drndth]+%.?$') then				-- if not the first name, and looks like a suffix (may have trailing dot)&lt;br /&gt;
			names[i] = names[i]:gsub ('%.', '');								-- remove terminal dot if present&lt;br /&gt;
			if is_suffix (names[i]) then										-- if a legitimate suffix&lt;br /&gt;
				table.insert (initials, ' ' .. names[i]);						-- add a separator space, insert at end of initials table&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, mw.ustring.sub(names[i], 1, 1));			-- insert the initial at end of initials table&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)												-- 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: 'd' (wikidata), 's' (wikisource), and 'w' (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 (':%l+:') 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;
		'^%[%[:([dsw]):(%l%l+):',												-- wikilinked; project and language prefixes&lt;br /&gt;
		'^%[%[:(%l%l+):([dsw]):',												-- wikilinked; language and project prefixes&lt;br /&gt;
		'^%[%[:([dsw]):',														-- wikilinked; project prefix&lt;br /&gt;
		'^%[%[:(%l%l+):',														-- 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;
		'^:([dsw]):(%l%l+):',													-- project and language prefixes&lt;br /&gt;
		'^:(%l%l+):([dsw]):',													-- language and project prefixes&lt;br /&gt;
		'^:([dsw]):',															-- project prefix&lt;br /&gt;
		'^:(%l%l+):',															-- 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'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 'vanc' == format then													-- Vancouver-like name styling?&lt;br /&gt;
		sep = cfg.presentation['sep_nl_vanc'];									-- name-list separator between names is a comma&lt;br /&gt;
		namesep = cfg.presentation['sep_name_vanc'];							-- last/first separator is a space&lt;br /&gt;
	else&lt;br /&gt;
		sep = cfg.presentation['sep_nl'];										-- name-list separator between names is a semicolon&lt;br /&gt;
		namesep = cfg.presentation['sep_name'];									-- 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'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 ('%.', '');								-- 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;
&lt;br /&gt;
				if 'w' == proj and ('Wikipedia' == mw.site.namespaces.Project['name']) 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;
					proj = ({['d'] = 'Wikidata', ['s'] = 'Wikisource', ['w'] = 'Wikipedia'})[proj];	-- :w (wikipedia) for linking from a non-wikipedia project&lt;br /&gt;
					if proj then &lt;br /&gt;
						one = one .. utilities.wrap_style ('interproj', proj);	-- add resized leading space, brackets, static text, language name&lt;br /&gt;
						tag = nil;												-- unset; don'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_code_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 ('interwiki', lang);	-- add resized leading space, brackets, static text, language name&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 'amp' == 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 'and' == 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 'and' text&lt;br /&gt;
				else&lt;br /&gt;
					name_list[#name_list-2] = cfg.presentation.sep_nl_end;		-- replace last separator with '(sep) and' 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['et al'];					-- we'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 '';							-- 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, 'citation');											-- required for blue highlight&lt;br /&gt;
	if 'citation' ~= 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 'cs1');		-- 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 'cs2');		-- 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, ' ');											-- 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 'et al' pattern is found in name&lt;br /&gt;
				name = name:gsub (pattern, '');									-- 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 ('err_etal', {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 maint cat when name parameter value does not contain letters.  Does not catch&lt;br /&gt;
mixed alphanumeric names so |last=A. Green (1922-1987) does not get caught in the&lt;br /&gt;
current version of this test but |first=(1888) is caught.&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, list_name)&lt;br /&gt;
	if utilities.is_set (name) then&lt;br /&gt;
		if mw.ustring.match (name, '^[%A]+$') then								-- when name does not contain any letters&lt;br /&gt;
			utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]);	-- add a maint cat for this template&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;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_mult_names (name, list_name)&lt;br /&gt;
	local _, commas, semicolons, nbsps;&lt;br /&gt;
	if utilities.is_set (name) then&lt;br /&gt;
		_, commas = name:gsub (',', '');										-- count the number of commas&lt;br /&gt;
		_, semicolons = name:gsub (';', '');									-- 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 ('&amp;amp;nbsp;','');										-- 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 'escape' them. If additional entities are added,&lt;br /&gt;
		-- they also can be subtracted.&lt;br /&gt;
		if 1 &amp;lt; commas or 0 &amp;lt; (semicolons - nbsps) then&lt;br /&gt;
			utilities.set_message ('maint_mult_names', 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;
	'generic_names' – for name-holding parameters: |last=, |first=, |editor-last=, etc&lt;br /&gt;
	'generic_titles' – for |title=&lt;br /&gt;
&lt;br /&gt;
There are two types of generic tests.  The 'accept' tests look for a pattern that should not be rejected by the&lt;br /&gt;
'reject' test.  For example,&lt;br /&gt;
	|author=[[John Smith (author)|Smith, John]]&lt;br /&gt;
would be rejected by the 'author' reject test.  But piped wikilinks with 'author' disambiguation should not be&lt;br /&gt;
rejected so the 'accept' 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 'accept' and 'reject' sequence tables hold tables for en.wiki (['en']) and local.wiki (['local'])&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'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 (['en']) and use mw.ustring.lower() or local.wiki (['local'])&lt;br /&gt;
		['en'] = string.lower,&lt;br /&gt;
		['local'] = mw.ustring.lower,&lt;br /&gt;
		}&lt;br /&gt;
	local str_find = {															-- use string.find() for en.wiki (['en']) and use mw.ustring.find() or local.wiki (['local'])&lt;br /&gt;
		['en'] = string.find,&lt;br /&gt;
		['local'] = 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 'true', 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 = {'accept', 'reject'};									-- test accept patterns first, then reject patterns&lt;br /&gt;
	local wikis_t = {'en', 'local'};											-- 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 ('reject' == 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 'generic name' 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 ('generic_names', name) then&lt;br /&gt;
		utilities.set_message ('err_generic_name', 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 (last only)&lt;br /&gt;
			name_is_numeric (last, list_name);									-- check for names that are composed of digits and punctuation&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_is_numeric (first, list_name);									-- check for names that are composed of digits and punctuation&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 ('err_bad_paramlink', 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'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 'holes' 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 'et al.', the 'et al.'&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 'et al.' text from Module:Citation/CS1/Configuration.  This keeps&lt;br /&gt;
'et al.' out of the template'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'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 .. '-Last'], 'err_redundant_parameters', i );		-- search through args for name components beginning at 1&lt;br /&gt;
		first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'err_redundant_parameters', i );&lt;br /&gt;
		link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i );&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', 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 ('err_bad_paramlink', 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 ('err_bad_paramlink', link_alias);		-- not known, emit an error message	-- TODO: err_bad_interwiki?&lt;br /&gt;
				link = nil;														-- unset so we don'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 ('given', 1, true) and 'given' or 'first';	-- get first or given form of the alias&lt;br /&gt;
			utilities.set_message ('err_first_missing_last', {&lt;br /&gt;
				first_alias,													-- param name of alias missing its mate&lt;br /&gt;
				first_alias:gsub (alias, {['first'] = 'last', ['given'] = 'surname'}),	-- 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't found, are we done?&lt;br /&gt;
			count = count + 1;													-- number of times we haven'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'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 ('err_missing_name', {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'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_code_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_code_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;
		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 ('^(%a%a%a?)%-.*');								-- still assuming that &amp;lt;lang_param_lc&amp;gt; is a tag; strip script, region, variant subtags&lt;br /&gt;
	name = cfg.lang_code_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 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;
	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;
	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 = lang_param_lc:match ('^(%a%a%a?)%-.*');								-- is &amp;lt;lang_param_lc&amp;gt; an IETF-like tag that MediaWiki doesn'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 '639-2' 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 'ar' is&lt;br /&gt;
recognized but code 'ara' 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's language name&lt;br /&gt;
&lt;br /&gt;
	names_t = mw.text.split (lang, '%s*,%s*');									-- 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'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 ('^(%a%a%a?)%-.*', '%1');					-- 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's language&lt;br /&gt;
				if 2 == lang_subtag:len() then									-- and is a two-character tag&lt;br /&gt;
					utilities.add_prop_cat ('foreign-lang-source', {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 ('foreign-lang-source-2', {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's language are the same and categorization is enabled&lt;br /&gt;
				utilities.add_prop_cat ('local-lang-source', {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 ('maint_unknown_lang');						-- 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 = '';																-- 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, 'English' in 'American English'&lt;br /&gt;
		return '';																-- if one language and that language is this wiki's return an empty string (no annotation)&lt;br /&gt;
	end&lt;br /&gt;
	return (&amp;quot; &amp;quot; .. wrap_msg ('language', name));								-- otherwise wrap with '(in ...)'&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 '.'.&lt;br /&gt;
In CS2, the default postscript is the empty string and the default separator is ','.&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 == 'cs1' and postscript == cfg.presentation['ps_' .. mode] then&lt;br /&gt;
			utilities.set_message ('maint_postscript');&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		postscript = cfg.presentation['ps_' .. mode];&lt;br /&gt;
	end&lt;br /&gt;
	return cfg.presentation['sep_' .. 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 'cs2' == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs2');&lt;br /&gt;
	elseif 'cs1' == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs1');&lt;br /&gt;
	elseif 'citation' == cite_class	then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs2');&lt;br /&gt;
	else&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, 'cs1');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.keywords_xlate[postscript:lower()] == 'none' 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 'cs2' == mode or 'citation' == cite_class then&lt;br /&gt;
			utilities.set_message ('maint_postscript');&lt;br /&gt;
		end&lt;br /&gt;
		postscript = '';&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 ('%.pdf$') or url:match ('%.PDF$') or&lt;br /&gt;
		url:match ('%.pdf[%?#]') or url:match ('%.PDF[%?#]') or&lt;br /&gt;
		url:match ('%.PDF&amp;amp;#035') or url:match ('%.pdf&amp;amp;#035');&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'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 ('format', format);						-- add leading space, parentheses, resize&lt;br /&gt;
		if not utilities.is_set (url) then&lt;br /&gt;
			utilities.set_message ('err_format_missing_url', {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 ('format', 'PDF');						-- set format to PDF&lt;br /&gt;
	else&lt;br /&gt;
		format = '';															-- 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 'etal' flag (false by default&lt;br /&gt;
but may have been set to true if the name list contains some variant of the text 'et al.').&lt;br /&gt;
&lt;br /&gt;
When the value assigned to |display-xxxxors= is the keyword 'etal', return a number&lt;br /&gt;
that is one greater than the number of authors in the list and set the 'etal' flag true.&lt;br /&gt;
This will cause the list_people() to display all of the names in the name list followed by 'et al.'&lt;br /&gt;
&lt;br /&gt;
In all other cases, returns nil and the previous state of the 'etal' flag.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
	max: A['DisplayAuthors'] or A['DisplayEditors']; a number or some flavor of etal&lt;br /&gt;
	count: #a or #e&lt;br /&gt;
	list_name: 'authors' or 'editors'&lt;br /&gt;
	etal: author_etal or editor_etal&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 'etal' == max:lower():gsub(&amp;quot;[ '%.]&amp;quot;, '') then						-- the :gsub() portion makes 'etal' from a variety of 'et al.' 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 ('^%d+$') 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 then												-- if |display-xxxxors= value greater than or equal to number of authors/editors&lt;br /&gt;
				utilities.set_message ('err_disp_name', {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 ('err_disp_name', {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: '^P[^%.P%l]' 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:  '^[Pp][PpGg]' 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 ('err_extra_text_pages', 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 'type' indicator.&lt;br /&gt;
&lt;br /&gt;
For |volume=:&lt;br /&gt;
	'V.', or 'Vol.' (with or without the dot) abbreviations or 'Volume' in the first characters of the parameter&lt;br /&gt;
	content (all case insensitive). 'V' and 'v' (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;
	'No.', 'I.', 'Iss.' (with or without the dot) abbreviations, or 'Issue' in the first characters of the&lt;br /&gt;
	parameter content (all case insensitive).&lt;br /&gt;
	&lt;br /&gt;
Single character values ('v', 'i', 'n') allowed when not followed by separator character ('.', ':', '=', 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 'v' for |volume=, 'i' 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 patterns = 'v' == selector and cfg.vol_iss_pg_patterns.vpatterns or cfg.vol_iss_pg_patterns.ipatterns;&lt;br /&gt;
&lt;br /&gt;
	local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';&lt;br /&gt;
	val = val:lower();															-- force parameter value to lower case&lt;br /&gt;
	for _, pattern in ipairs (patterns) 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 (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 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 ('^%(%(.*[^%)][^%)]$') 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 .. ', ' .. name_table[i];							-- concatenate with previous segments&lt;br /&gt;
				if name_table[i]:match ('^.*%)%)$') 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, '');								-- 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'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 = '';																-- 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('[;%.]') 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, '^%u+$') 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, ' ')							-- 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 = '';														-- 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, '%a+%s+%u+%s+%a+') then&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl['missing comma'], 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, ' %u %u$') 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'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 .. ' ' .. suffix;									-- if there was a suffix concatenate with the initials&lt;br /&gt;
				suffix = '';													-- unset so we don'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, '', 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 .. '-Link'], 'err_redundant_parameters', i ) or v_link_table[i];&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', 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'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 .. '-Last'], 'none', 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 .. '-First'], 'none', 1 ) or		-- ... also catches the case where |first= is used with |vauthors=&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 2 ) or&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 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 'AuthorList' == list_name then									-- figure out which name should be used in error message&lt;br /&gt;
				err_name = 'author';&lt;br /&gt;
			else&lt;br /&gt;
				err_name = 'editor';&lt;br /&gt;
			end&lt;br /&gt;
			utilities.set_message ('err_redundant_parameters', err_name .. '-name-list parameters');	-- 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'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 ('err_invalid_param_val', {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 .. '. ') 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 .. ']]') then	-- if last name in list ends with sepc char&lt;br /&gt;
		return name_list .. &amp;quot; &amp;quot;;												-- don't add another&lt;br /&gt;
	else&lt;br /&gt;
		return name_list .. sepc .. ' ';										-- 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 '';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- same condition as in format_pages_sheets()&lt;br /&gt;
	local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);&lt;br /&gt;
&lt;br /&gt;
	local is_numeric_vol = volume and (volume:match ('^[MDCLXVI]+$') or volume:match ('^%d+$'));	-- 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 ('long-vol');									-- 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 = '';&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['vol-bold'], {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['j-vol'], {sepc, utilities.hyphen_to_dash (volume)});	-- not bold&lt;br /&gt;
			else																-- four or fewer characters&lt;br /&gt;
				vol = utilities.substitute (cfg.presentation['vol-bold'], {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['j-issue'], issue) or '')&lt;br /&gt;
		vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages['j-article-num'], article) or '')&lt;br /&gt;
		return vol;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 'podcast' == cite_class and utilities.is_set (issue) then&lt;br /&gt;
		return wrap_msg ('issue', {sepc, issue}, lower);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 'conference' == 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 ('vol-art', {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 ('art', {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 ('vol-no', {sepc, utilities.hyphen_to_dash (volume), issue}, lower);&lt;br /&gt;
	elseif utilities.is_set (volume) then&lt;br /&gt;
		return wrap_msg ('vol', {sepc, utilities.hyphen_to_dash (volume)}, lower);&lt;br /&gt;
	else&lt;br /&gt;
		return wrap_msg ('issue', {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 'map' == 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 'journal' == origin then&lt;br /&gt;
				return '', '', wrap_msg ('j-sheet', sheet, lower), '';&lt;br /&gt;
			else&lt;br /&gt;
				return '', '', wrap_msg ('sheet', {sepc, sheet}, lower), '';&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (sheets) then&lt;br /&gt;
			if 'journal' == origin then&lt;br /&gt;
				return '', '', '', wrap_msg ('j-sheets', sheets, lower);&lt;br /&gt;
			else&lt;br /&gt;
				return '', '', '', wrap_msg ('sheets', {sepc, sheets}, lower);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == 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['j-page(s)'], page), '', '', '';&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return utilities.substitute (cfg.messages['p-prefix'], {sepc, page}), '', '', '';&lt;br /&gt;
		else&lt;br /&gt;
			return utilities.substitute (cfg.messages['nopp'], {sepc, page}), '', '', '';&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['j-page(s)'], pages), '', '', '';&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 '', utilities.substitute (cfg.messages['p-prefix'], {sepc, pages}), '', '';&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return '', utilities.substitute (cfg.messages['pp-prefix'], {sepc, pages}), '', '';&lt;br /&gt;
		else&lt;br /&gt;
			return '', utilities.substitute (cfg.messages['nopp'], {sepc, pages}), '', '';&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return '', '', '', '';														-- 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'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 = '';															-- unset the others&lt;br /&gt;
			at = '';&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 .. '&amp;amp;nbsp;', 'ws link in page');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 = '';															-- 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 .. '&amp;amp;nbsp;', 'ws link in pages');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 .. '&amp;amp;nbsp;', 'ws link in at');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 ('err_bad_url', {utilities.wrap_style ('parameter', source)});	-- add error message&lt;br /&gt;
			return '', '';														-- 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 'https://web.archive.org/save/' (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 'search' 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;
('id_', 'js_', 'cs_', 'im_') but since archive.org ignores others following the same form (two letters and an underscore)&lt;br /&gt;
we don'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;
]=]&lt;br /&gt;
&lt;br /&gt;
local function archive_url_check (url, date)&lt;br /&gt;
	local err_msg = '';															-- 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;
	if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) 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('//web%.archive%.org/save/') then								-- if a save command URL, we don'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 ('(//web%.archive%.org)/save/', '%1/*/', 1);				-- for preview mode: modify ArchiveURL&lt;br /&gt;
	elseif url:match('//liveweb%.archive%.org/') then&lt;br /&gt;
		err_msg = cfg.err_msg_supl.liveweb;&lt;br /&gt;
	else&lt;br /&gt;
		path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/');	-- 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 '*' ~= flag then&lt;br /&gt;
				local replacement = timestamp:match ('^%d%d%d%d%d%d') or timestamp:match ('^%d%d%d%d');	-- get the first 6 (YYYYMM) or first 4 digits (YYYY)&lt;br /&gt;
				if replacement then												-- nil if there aren't at least 4 digits (year)&lt;br /&gt;
					replacement = replacement .. string.rep ('0', 14 - replacement:len());	-- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp&lt;br /&gt;
					url=url:gsub ('(//web%.archive%.org/[^%d]*)%d[^/]*', '%1' .. replacement .. '*', 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 'web/' ~= path then					-- older archive URLs do not have the extra 'web/' 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 'web/' path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		elseif utilities.is_set (flag) and not flag:match ('%a%a_') then		-- flag if present must be two alpha characters and underscore (requires 'web/' path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		else&lt;br /&gt;
			return url, date;													-- return ArchiveURL and ArchiveDate&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- if here, something not right so&lt;br /&gt;
	utilities.set_message ('err_archive_url', {err_msg});						-- add error message and&lt;br /&gt;
&lt;br /&gt;
	if is_preview_mode then&lt;br /&gt;
		return url, date;														-- preview mode so return ArchiveURL and ArchiveDate&lt;br /&gt;
	else&lt;br /&gt;
		return '', '';															-- 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, '%d') then									-- not empty, are there digits in the parameter value&lt;br /&gt;
		utilities.set_message ('maint_location');								-- 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 'Archived copy' (placeholder added by bots that can'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 'Archived copy'&lt;br /&gt;
		return true;&lt;br /&gt;
	elseif cfg.special_case_translation.archived_copy['local'] then&lt;br /&gt;
		if mw.ustring.find (title, cfg.special_case_translation.archived_copy['local']) 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; 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 = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');&lt;br /&gt;
	local Collaboration = A['Collaboration'];&lt;br /&gt;
&lt;br /&gt;
	do																			-- to limit scope of selected&lt;br /&gt;
		local selected = select_author_editor_source (A['Vauthors'], A['Authors'], args, 'AuthorList');&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			a, author_etal = extract_names (args, 'AuthorList');				-- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 2 == selected then&lt;br /&gt;
			NameListStyle = 'vanc';												-- override whatever |name-list-style= might be&lt;br /&gt;
			a, author_etal = parse_vauthors_veditors (args, args.vauthors, 'AuthorList');	-- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 3 == selected then&lt;br /&gt;
			Authors = A['Authors'];												-- use content of |authors=&lt;br /&gt;
			if 'authors' == A:ORIGIN('Authors') then							-- but add a maint cat if the parameter is |authors=&lt;br /&gt;
				utilities.set_message ('maint_authors');						-- because use of this parameter is discouraged; what to do about the aliases is a TODO:&lt;br /&gt;
			end&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['Veditors'], nil, args, 'EditorList');	-- support for |editors= withdrawn&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			e, editor_etal = extract_names (args, 'EditorList');				-- 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 = 'vanc';												-- override whatever |name-list-style= might be&lt;br /&gt;
			e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList');	-- 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['Chapter'];												-- done here so that we have access to |contribution= from |chapter= aliases&lt;br /&gt;
	local Chapter_origin = A:ORIGIN ('Chapter');&lt;br /&gt;
	local Contribution;															-- because contribution is required for contributor(s)&lt;br /&gt;
		if 'contribution' == 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['Periodical']) then	-- |contributor= and |contribution= only supported in book cites&lt;br /&gt;
		c = extract_names (args, 'ContributorList');							-- 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 ('err_contributor_missing_required_param', 'contribution');	-- add missing contribution error message&lt;br /&gt;
				c = {};															-- blank the contributors' 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 ('err_contributor_missing_required_param', 'author');	-- add missing author error message&lt;br /&gt;
				c = {};															-- blank the contributors' 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['ContributorList-Last'], 'err_redundant_parameters', 1 ) then	-- are there contributor name list parameters?&lt;br /&gt;
			utilities.set_message ('err_contributor_ignored');					-- 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['Title'];&lt;br /&gt;
	local TitleLink = A['TitleLink'];&lt;br /&gt;
&lt;br /&gt;
	local auto_select = ''; -- 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, {'none', 'pmc', 'doi'}) then -- check for special keywords&lt;br /&gt;
		auto_select = TitleLink;												-- remember selection for later&lt;br /&gt;
		TitleLink = '';															-- 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 ('TitleLink'), Title, 'title');	-- 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 = '';															-- {{cite map}} only; preset to empty string for concatenation if not used&lt;br /&gt;
	if 'map' == config.CitationClass and 'section' == Chapter_origin then&lt;br /&gt;
		Section = A['Chapter'];													-- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}&lt;br /&gt;
		Chapter = '';															-- unset for now; will be reset later from |map= if present&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Periodical = A['Periodical'];&lt;br /&gt;
	local Periodical_origin = '';&lt;br /&gt;
	if utilities.is_set (Periodical) then&lt;br /&gt;
		Periodical_origin = A:ORIGIN('Periodical');								-- get the name of the periodical parameter&lt;br /&gt;
		local i;&lt;br /&gt;
		Periodical, i = utilities.strip_apostrophe_markup (Periodical);			-- strip apostrophe markup so that metadata isn'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 ('err_apostrophe_markup', {Periodical_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 'mailinglist' == config.CitationClass then								-- special case for {{cite mailing list}}&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (A ['MailingList']) then	-- both set emit an error TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', Periodical_origin) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'mailinglist')});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = A ['MailingList'];											-- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}&lt;br /&gt;
		Periodical_origin = A:ORIGIN('MailingList');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ScriptPeriodical = A['ScriptPeriodical'];&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	-- 'periodical' templates require periodical parameter&lt;br /&gt;
	--	local p = {['journal'] = 'journal', ['magazine'] = 'magazine', ['news'] = 'newspaper', ['web'] = 'website'};	-- for error message&lt;br /&gt;
		local p = {['journal'] = 'journal', ['magazine'] = 'magazine'};			-- for error message&lt;br /&gt;
		if p[config.CitationClass]  then&lt;br /&gt;
			utilities.set_message ('err_missing_periodical', {config.CitationClass, p[config.CitationClass]});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Volume;&lt;br /&gt;
	local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');&lt;br /&gt;
	if 'citation' == 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['Volume'];											-- but does for all other 'periodicals'&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (ScriptPeriodical) then&lt;br /&gt;
			if 'script-website' ~= ScriptPeriodical_origin then					-- {{citation}} does not render volume for |script-website=&lt;br /&gt;
				Volume = A['Volume'];											-- but does for all other 'periodicals'&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			Volume = A['Volume'];												-- and does for non-'periodical' 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['Volume'];&lt;br /&gt;
	end	&lt;br /&gt;
	extra_text_in_vol_iss_check (Volume, A:ORIGIN ('Volume'), 'v');	&lt;br /&gt;
&lt;br /&gt;
	local Issue;&lt;br /&gt;
	if 'citation' == 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['Issue']);&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, {'conference', 'map', 'citation'}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then&lt;br /&gt;
			Issue = utilities.hyphen_to_dash (A['Issue']);&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, {'journal', 'conference'}) or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then&lt;br /&gt;
		ArticleNumber = A['ArticleNumber'];&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');	&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['Page'];&lt;br /&gt;
		Pages = utilities.hyphen_to_dash (A['Pages']);	&lt;br /&gt;
		At = A['At'];&lt;br /&gt;
		QuotePage = A['QuotePage'];&lt;br /&gt;
		QuotePages = utilities.hyphen_to_dash (A['QuotePages']);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Edition = A['Edition'];&lt;br /&gt;
	local PublicationPlace = place_check (A['PublicationPlace'], A:ORIGIN('PublicationPlace'));&lt;br /&gt;
	local Place = place_check (A['Place'], A:ORIGIN('Place'));&lt;br /&gt;
	&lt;br /&gt;
	local PublisherName = A['PublisherName'];&lt;br /&gt;
	local PublisherName_origin = A:ORIGIN('PublisherName');&lt;br /&gt;
	if utilities.is_set (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't contaminated; publisher is never italicized&lt;br /&gt;
		if i then																-- non-zero when markup was stripped so emit an error message&lt;br /&gt;
			utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Newsgroup = A['Newsgroup'];											-- TODO: strip apostrophe markup?&lt;br /&gt;
	local Newsgroup_origin = A:ORIGIN('Newsgroup');	&lt;br /&gt;
&lt;br /&gt;
	if 'newsgroup' == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (PublisherName) then								-- general use parameter |publisher= not allowed in cite newsgroup&lt;br /&gt;
			utilities.set_message ('err_parameter_ignored', {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;
	local URL = A['URL'];														-- TODO: better way to do this for URL, ChapterURL, and MapURL?&lt;br /&gt;
	local UrlAccess = is_valid_parameter_value (A['UrlAccess'], A:ORIGIN('UrlAccess'), cfg.keywords_lists['url-access'], 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 ('err_param_access_requires_param', 'url');&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local ChapterURL = A['ChapterURL'];&lt;br /&gt;
	local ChapterUrlAccess = is_valid_parameter_value (A['ChapterUrlAccess'], A:ORIGIN('ChapterUrlAccess'), cfg.keywords_lists['url-access'], 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 ('err_param_access_requires_param', {A:ORIGIN('ChapterUrlAccess'):gsub ('%-access', '')});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local MapUrlAccess = is_valid_parameter_value (A['MapUrlAccess'], A:ORIGIN('MapUrlAccess'), cfg.keywords_lists['url-access'], nil);&lt;br /&gt;
	if not utilities.is_set (A['MapURL']) and utilities.is_set (MapUrlAccess) then&lt;br /&gt;
		MapUrlAccess = nil;&lt;br /&gt;
		utilities.set_message ('err_param_access_requires_param', {'map-url'});&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['NoTracking'], A:ORIGIN('NoTracking'), cfg.keywords_lists['yes_true_y'], 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'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're at it)&lt;br /&gt;
	utilities.select_one (args, {'page', 'p', 'pp', 'pages', 'at', 'sheet', 'sheets'}, 'err_redundant_parameters');	-- this is a dummy call simply to get the error message and category&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('Page'), Pages, A:ORIGIN('Pages'), At);&lt;br /&gt;
&lt;br /&gt;
	local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);&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 ('location-test');								-- add property cat to evaluate how often PublicationPlace and Place are used together&lt;br /&gt;
		if PublicationPlace == Place then&lt;br /&gt;
			Place = '';															-- unset; don'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 = ''; end							-- don't need both if they are the same&lt;br /&gt;
	&lt;br /&gt;
	local URL_origin = A:ORIGIN('URL');											-- get name of parameter that holds URL&lt;br /&gt;
	local ChapterURL_origin = A:ORIGIN('ChapterURL');							-- get name of parameter that holds ChapterURL&lt;br /&gt;
	local ScriptChapter = A['ScriptChapter'];&lt;br /&gt;
	local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');&lt;br /&gt;
	local Format = A['Format'];&lt;br /&gt;
	local ChapterFormat = A['ChapterFormat'];&lt;br /&gt;
	local TransChapter = A['TransChapter'];&lt;br /&gt;
	local TransChapter_origin = A:ORIGIN ('TransChapter');&lt;br /&gt;
	local TransTitle = A['TransTitle'];&lt;br /&gt;
	local ScriptTitle = A['ScriptTitle'];&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=&lt;br /&gt;
		|encyclopedia= and |article= then map |encyclopedia= to |title=&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['Encyclopedia'];										-- used as a flag by this module and by ~/COinS&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Encyclopedia) then										-- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}&lt;br /&gt;
		if 'encyclopaedia' ~= config.CitationClass and 'citation' ~= config.CitationClass then&lt;br /&gt;
			utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});&lt;br /&gt;
			Encyclopedia = nil;													-- unset because not supported by this template&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then	-- when both set emit an error TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', A:ORIGIN ('Encyclopedia')) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Periodical_origin)});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Encyclopedia) then&lt;br /&gt;
			Periodical = Encyclopedia;											-- error or no, set Periodical to Encyclopedia; allow periodical without encyclopedia&lt;br /&gt;
			Periodical_origin = A:ORIGIN ('Encyclopedia');&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Periodical) then									-- Periodical is set when |encyclopedia= is set&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= to |article= and |encyclopedia= to |title=&lt;br /&gt;
					ScriptChapter = ScriptTitle;&lt;br /&gt;
					ScriptChapter_origin = A:ORIGIN('ScriptTitle')&lt;br /&gt;
					TransChapter = TransTitle;&lt;br /&gt;
					ChapterURL = URL;&lt;br /&gt;
					ChapterURL_origin = URL_origin;&lt;br /&gt;
&lt;br /&gt;
					ChapterUrlAccess = UrlAccess;&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;&lt;br /&gt;
					ChapterFormat = Format;&lt;br /&gt;
					Periodical = '';											-- redundant so unset&lt;br /&gt;
					TransTitle = '';&lt;br /&gt;
					URL = '';&lt;br /&gt;
					Format = '';&lt;br /&gt;
					TitleLink = '';&lt;br /&gt;
					ScriptTitle = '';&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=&lt;br /&gt;
				Periodical = '';												-- redundant so unset&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['ID'];&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['Number']) then									-- cite techreport uses 'number', which other citations alias to 'issue'&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['Number'];												-- yes, use it&lt;br /&gt;
			else																-- ID has a value so emit error message&lt;br /&gt;
				utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'id') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'number')});&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['ChapterLink'];									-- deprecated as a parameter but still used internally by cite episode&lt;br /&gt;
	local Conference = A['Conference'];&lt;br /&gt;
	local BookTitle = A['BookTitle'];&lt;br /&gt;
	local TransTitle_origin = A:ORIGIN ('TransTitle');&lt;br /&gt;
	if 'conference' == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (BookTitle) then&lt;br /&gt;
			Chapter = Title;&lt;br /&gt;
			Chapter_origin = 'title';&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 = '';&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 = '';&lt;br /&gt;
	--		TitleLink = '';&lt;br /&gt;
			TransTitle = '';&lt;br /&gt;
			URL = '';&lt;br /&gt;
		end&lt;br /&gt;
	elseif 'speech' ~= config.CitationClass then&lt;br /&gt;
		Conference = '';														-- not cite conference or cite speech so make sure this is empty string&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- CS1/2 mode&lt;br /&gt;
	local Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], '');&lt;br /&gt;
	-- separator character and postscript&lt;br /&gt;
	local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);&lt;br /&gt;
	-- controls capitalization of certain static text&lt;br /&gt;
	local use_lowercase = ( sepc == ',' );&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['Sheet'] or '';&lt;br /&gt;
	local Sheets = A['Sheets'] or '';&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 ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'map') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Chapter_origin)});	-- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Chapter = A['Map'];&lt;br /&gt;
		Chapter_origin = A:ORIGIN('Map');&lt;br /&gt;
		ChapterURL = A['MapURL'];&lt;br /&gt;
		ChapterURL_origin = A:ORIGIN('MapURL');&lt;br /&gt;
		TransChapter = A['TransMap'];&lt;br /&gt;
		ScriptChapter = A['ScriptMap']&lt;br /&gt;
		ScriptChapter_origin = A:ORIGIN('ScriptMap')&lt;br /&gt;
&lt;br /&gt;
		ChapterUrlAccess = MapUrlAccess;&lt;br /&gt;
		ChapterFormat = A['MapFormat'];&lt;br /&gt;
&lt;br /&gt;
		Cartography = A['Cartography'];&lt;br /&gt;
		if utilities.is_set ( Cartography ) then&lt;br /&gt;
			Cartography = sepc .. &amp;quot; &amp;quot; .. wrap_msg ('cartography', Cartography, use_lowercase);&lt;br /&gt;
		end		&lt;br /&gt;
		Scale = A['Scale'];&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['Series'];&lt;br /&gt;
	if 'episode' == config.CitationClass or 'serial' == config.CitationClass then&lt;br /&gt;
		local SeriesLink = A['SeriesLink'];&lt;br /&gt;
&lt;br /&gt;
		SeriesLink = link_title_ok (SeriesLink, A:ORIGIN ('SeriesLink'), Series, 'series');	-- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set&lt;br /&gt;
&lt;br /&gt;
		local Network = A['Network'];&lt;br /&gt;
		local Station = A['Station'];&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 .. ' ');&lt;br /&gt;
		&lt;br /&gt;
		if 'episode' == config.CitationClass then								-- handle the oddities that are strictly {{cite episode}}&lt;br /&gt;
			local Season = A['Season'];&lt;br /&gt;
			local SeriesNumber = A['SeriesNumber'];&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 ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'season') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'seriesno')});		-- add error message&lt;br /&gt;
				SeriesNumber = '';												-- 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 ('season', Season, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg ('seriesnum', SeriesNumber, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (Issue) then table.insert(s, wrap_msg ('episode', Issue, use_lowercase)); end&lt;br /&gt;
			Issue = '';															-- 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('ScriptTitle');&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 .. ' ');								-- 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 = '';															-- unset&lt;br /&gt;
			TransTitle = '';&lt;br /&gt;
			ScriptTitle = '';&lt;br /&gt;
			Format = '';&lt;br /&gt;
			&lt;br /&gt;
		else																	-- now oddities that are cite serial&lt;br /&gt;
			Issue = '';															-- unset because this parameter no longer supported by the citation/core version of cite serial&lt;br /&gt;
			Chapter = A['Episode'];												-- 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 ('italic-title', 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['TitleType'];&lt;br /&gt;
	local Degree = A['Degree'];&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {'AV-media-notes', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) 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 .. ' ' .. cfg.title_types ['thesis']: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['type'], 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['Date'];&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['PublicationDate'];&lt;br /&gt;
	local Year = A['Year'];&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'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 = '';												-- unset, no longer needed&lt;br /&gt;
			Date_origin = A:ORIGIN('PublicationDate');							-- save the name of the promoted parameter&lt;br /&gt;
		else&lt;br /&gt;
			Date_origin = A:ORIGIN('Year');										-- save the name of the promoted parameter&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Date_origin = A:ORIGIN('Date');											-- not a promotion; name required for error messaging&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if PublicationDate == Date then PublicationDate = ''; end					-- if PublicationDate is same as Date, don'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['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');&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['ArchiveFormat'];&lt;br /&gt;
&lt;br /&gt;
	ArchiveURL, ArchiveDate = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])&lt;br /&gt;
	ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url');&lt;br /&gt;
	&lt;br /&gt;
	ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate);		-- add error message when URL or ChapterURL == ArchiveURL&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	local AccessDate = A['AccessDate'];&lt;br /&gt;
	local LayDate = A['LayDate'];&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['DoiBroken'];&lt;br /&gt;
	local Embargo = A['Embargo'];&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 = '';&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;
			['access-date'] = {val = AccessDate, name = A:ORIGIN ('AccessDate')},&lt;br /&gt;
			['archive-date'] = {val = ArchiveDate, name = A:ORIGIN ('ArchiveDate')},&lt;br /&gt;
			['date'] = {val = Date, name = Date_origin},&lt;br /&gt;
			['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},&lt;br /&gt;
			['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},&lt;br /&gt;
			['lay-date'] = {val = LayDate, name = A:ORIGIN ('LayDate')},&lt;br /&gt;
			['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},&lt;br /&gt;
			['year'] = {val = Year, name = A:ORIGIN ('Year')},&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;
-- start temporary Julian / Gregorian calendar uncertainty categorization&lt;br /&gt;
		if COinS_date.inter_cal_cat then&lt;br /&gt;
			utilities.add_prop_cat ('jul-greg-uncertainty');&lt;br /&gt;
		end&lt;br /&gt;
-- end temporary Julian / Gregorian calendar uncertainty categorization&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 ('Year'), Date, A:ORIGIN ('Date'), 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 ('maint_date_format');					-- 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 ('maint_date_auto_xlated');				-- 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['access-date'].val;			-- overwrite date holding parameters with modified values&lt;br /&gt;
				ArchiveDate = date_parameters_list['archive-date'].val;&lt;br /&gt;
				Date = date_parameters_list['date'].val;&lt;br /&gt;
				DoiBroken = date_parameters_list['doi-broken-date'].val;&lt;br /&gt;
				LayDate = date_parameters_list['lay-date'].val;&lt;br /&gt;
				PublicationDate = date_parameters_list['publication-date'].val;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message ('err_bad_date', {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;
	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's key&lt;br /&gt;
	local Class = A['Class'];													-- arxiv class identifier&lt;br /&gt;
	&lt;br /&gt;
	local ID_support = {&lt;br /&gt;
		{A['ASINTLD'], 'ASIN', 'err_asintld_missing_asin', A:ORIGIN ('ASINTLD')},				&lt;br /&gt;
		{DoiBroken, 'DOI', 'err_doibroken_missing_doi', A:ORIGIN ('DoiBroken')},&lt;br /&gt;
		{Embargo, 'PMC', 'err_embargo_missing_pmc', A:ORIGIN ('Embargo')},&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	ID_list, ID_list_coins = identifiers.identifier_lists_get (args, {DoiBroken = DoiBroken, ASINTLD = A['ASINTLD'], Embargo = Embargo, Class = Class}, ID_support);&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite ssrn}}, before generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list) then	-- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |ssrn= required for their templates&lt;br /&gt;
		if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or 	-- can'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 ('err_' .. config.CitationClass .. '_missing');	-- add error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['ssrn'] = 'Social Science Research Network'})[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], {'off', 'none'}) then -- TODO: remove 'none' once existing citations have been switched to 'off', so 'none' can be used as token for &amp;quot;no title&amp;quot; instead&lt;br /&gt;
		if 'none' ~= 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'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['pmc'] then						-- auto-select PMC&lt;br /&gt;
				URL = identifiers.auto_link_urls['pmc'];						-- set URL to be the same as the PMC external link if not embargoed&lt;br /&gt;
				URL_origin = cfg.id_handlers['PMC'].parameters[1];				-- set URL_origin to parameter name for use in error message if citation is missing a |title=&lt;br /&gt;
			elseif identifiers.auto_link_urls['doi'] then						-- auto-select DOI&lt;br /&gt;
				URL = identifiers.auto_link_urls['doi'];&lt;br /&gt;
				URL_origin = cfg.id_handlers['DOI'].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 ('err_accessdate_missing_url');			-- add an error message&lt;br /&gt;
				AccessDate = '';												-- 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 ('err_archive_missing_url');				-- add an error message&lt;br /&gt;
				ArchiveURL = '';												-- 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'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 ('err_citation_missing_title', {'episode' == config.CitationClass and 'series' or 'title'});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) and&lt;br /&gt;
			utilities.in_array (config.CitationClass, {'journal', 'citation'}) and&lt;br /&gt;
			(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and&lt;br /&gt;
			('journal' == Periodical_origin or 'script-journal' == ScriptPeriodical_origin) then	-- special case for journal cites&lt;br /&gt;
				Title = '';														-- set title to empty string&lt;br /&gt;
				utilities.set_message ('maint_untitled');						-- 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 'encyclopaedia' == config.CitationClass or ('citation' == 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;
		['Periodical'] = utilities.strip_apostrophe_markup (Periodical),		-- no markup in the metadata&lt;br /&gt;
		['Encyclopedia'] = Encyclopedia,										-- just a flag; content ignored by ~/COinS&lt;br /&gt;
		['Chapter'] = metadata.make_coins_title (coins_chapter, ScriptChapter),	-- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		['Degree'] = Degree;													-- cite thesis only&lt;br /&gt;
		['Title'] = metadata.make_coins_title (coins_title, ScriptTitle),		-- Title and ScriptTitle stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		['PublicationPlace'] = PublicationPlace,&lt;br /&gt;
		['Date'] = COinS_date.rftdate,											-- COinS_date has correctly formatted date if Date is valid;&lt;br /&gt;
		['Season'] = COinS_date.rftssn,&lt;br /&gt;
		['Quarter'] = COinS_date.rftquarter,&lt;br /&gt;
		['Chron'] =  COinS_date.rftchron or (not COinS_date.rftdate and Date) or '',	-- chron but if not set and invalid date format use Date; keep this last bit?&lt;br /&gt;
		['Series'] = Series,&lt;br /&gt;
		['Volume'] = Volume,&lt;br /&gt;
		['Issue'] = Issue,&lt;br /&gt;
		['ArticleNumber'] = ArticleNumber,&lt;br /&gt;
		['Pages'] = 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;
		['Edition'] = Edition,&lt;br /&gt;
		['PublisherName'] = PublisherName or Newsgroup,							-- any apostrophe markup already removed from PublisherName&lt;br /&gt;
		['URL'] = first_set ({ChapterURL, URL}, 2),&lt;br /&gt;
		['Authors'] = coins_author,&lt;br /&gt;
		['ID_list'] = ID_list_coins,&lt;br /&gt;
		['RawPage'] = 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}}, and {{cite ssrn}} AFTER generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list) then	-- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, or ssrn now unset so it isn't displayed&lt;br /&gt;
		Periodical = '';														-- 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 'newsgroup' == config.CitationClass and utilities.is_set (Newsgroup) then&lt;br /&gt;
		PublisherName = utilities.substitute (cfg.messages['newsgroup'], external_link( 'news:' .. 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, 'TranslatorList');									-- 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, 'InterviewerList');				-- 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 or 'vanc'&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;
			control.maximum , editor_etal = get_display_names (A['DisplayEditors'], #e, 'editors', editor_etal, A:ORIGIN ('DisplayEditors'));&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;
			control.maximum, interviewer_etal = get_display_names (A['DisplayInterviewers'], #interviewers_list, 'interviewers', interviewer_etal, A:ORIGIN ('DisplayInterviewers'));&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;
			control.maximum, translator_etal = get_display_names (A['DisplayTranslators'], #t, 'translators', translator_etal, A:ORIGIN ('DisplayTranslators'));&lt;br /&gt;
			Translators = list_people (control, t, translator_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do contributors&lt;br /&gt;
			control.maximum, contributor_etal = get_display_names (A['DisplayContributors'], #c, 'contributors', contributor_etal, A:ORIGIN ('DisplayContributors'));&lt;br /&gt;
			Contributors = list_people (control, c, contributor_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do authors&lt;br /&gt;
			control.maximum, author_etal = get_display_names (A['DisplayAuthors'], #a, 'authors', author_etal, A:ORIGIN ('DisplayAuthors'));&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, 'authors');	-- find and remove variations on et al.&lt;br /&gt;
				if author_etal then&lt;br /&gt;
					Authors = Authors .. ' ' .. cfg.messages['et al'];			-- 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 .. ' (' .. Collaboration .. ')';					-- 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['ConferenceFormat'];&lt;br /&gt;
	local ConferenceURL = A['ConferenceURL'];&lt;br /&gt;
	ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, 'conference-format', 'conference-url');&lt;br /&gt;
	Format = style_format (Format, URL, 'format', 'url');&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, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'ssrn'}) or&lt;br /&gt;
		('citation' == 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, 'chapter-format', 'chapter-url');&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;
			('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then	-- and required for {{citation}} with |website= or |script-website=&lt;br /&gt;
				utilities.set_message ('err_cite_web_url');&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 ('err_accessdate_missing_url');&lt;br /&gt;
			AccessDate = '';&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local UrlStatus = is_valid_parameter_value (A['UrlStatus'], A:ORIGIN('UrlStatus'), cfg.keywords_lists['url-status'], '');&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'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 'live' ~= UrlStatus then&lt;br /&gt;
				ChapterURL = ArchiveURL											-- swap-in the archive's URL&lt;br /&gt;
				ChapterURL_origin = A:ORIGIN('ArchiveURL')						-- name of |archive-url= parameter for error messages&lt;br /&gt;
				ChapterFormat = ArchiveFormat or '';							-- swap in archive'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 'live' ~= UrlStatus then											-- if URL set then |archive-url= applies to it&lt;br /&gt;
				URL = ArchiveURL												-- swap-in the archive's URL&lt;br /&gt;
				URL_origin = A:ORIGIN('ArchiveURL')								-- name of archive URL parameter for error messages&lt;br /&gt;
				Format = ArchiveFormat or '';									-- swap in archive'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 ('maint_url_status');								-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'ssrn'}) or	-- if any of the 'periodical' cites except encyclopedia&lt;br /&gt;
		('citation' == 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 ('Chapter')&lt;br /&gt;
			elseif utilities.is_set (TransChapter) then&lt;br /&gt;
				chap_param = A:ORIGIN ('TransChapter')&lt;br /&gt;
			elseif utilities.is_set (ChapterURL) then&lt;br /&gt;
				chap_param = A:ORIGIN ('ChapterURL')&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 ('ChapterFormat')&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 ('err_chapter_ignored', {chap_param});	-- add error message&lt;br /&gt;
				Chapter = '';													-- and set them to empty string to be safe with concatenation&lt;br /&gt;
				TransChapter = '';&lt;br /&gt;
				ChapterURL = '';&lt;br /&gt;
				ScriptChapter = '';&lt;br /&gt;
				ChapterFormat = '';&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 'map' == config.CitationClass and utilities.is_set (TitleType) then&lt;br /&gt;
				Chapter = Chapter .. ' ' .. TitleType;							-- map annotation here; not after title&lt;br /&gt;
			end&lt;br /&gt;
			Chapter = Chapter .. sepc .. ' ';&lt;br /&gt;
		elseif utilities.is_set (ChapterFormat) then							-- |chapter= not set but |chapter-format= is so ...&lt;br /&gt;
			Chapter = ChapterFormat .. sepc .. ' ';								-- ... 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 ('' == Title) then										-- only support forced empty for now &amp;quot;(())&amp;quot;&lt;br /&gt;
		Title = cfg.messages['notitle'];										-- replace by predefined &amp;quot;No title&amp;quot; message&lt;br /&gt;
			-- TODO: utilities.set_message ( 'err_redundant_parameters', ...);	-- issue proper error message instead of muting	 &lt;br /&gt;
			ScriptTitle = '';													-- just mute for now	 &lt;br /&gt;
			TransTitle = '';													-- just mute for now&lt;br /&gt;
 		plain_title = true;														-- suppress text decoration for descriptive title&lt;br /&gt;
		utilities.set_message ('maint_untitled');								-- 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 '...' == Title:sub (-3) then											-- if ellipsis is the last three characters of |title=&lt;br /&gt;
			Title = Title:gsub ('(%.%.%.)%.+$', '%1');							-- limit the number of dots to three&lt;br /&gt;
		elseif not mw.ustring.find (Title, '%.%s*%a%.$') and					-- end of title is not a 'dot-(optional space-)letter-dot' initialism ...&lt;br /&gt;
			not mw.ustring.find (Title, '%s+%a%.$') then						-- ...and not a 'space-letter-dot' initial (''Allium canadense'' L.)&lt;br /&gt;
				Title = mw.ustring.gsub(Title, '%' .. sepc .. '$', '');			-- 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 ('maint_archived_copy');						-- add maintenance category before we modify the content of Title&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if is_generic ('generic_titles', Title) then&lt;br /&gt;
			utilities.set_message ('err_generic_title');						-- 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, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', 'ssrn'}) or&lt;br /&gt;
		('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or&lt;br /&gt;
		('map' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then		-- special case for cite map when the map is in a periodical treat as an article&lt;br /&gt;
			Title = kern_quotes (Title);										-- if necessary, separate title's leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			Title = utilities.wrap_style ('quoted-title', Title);&lt;br /&gt;
			Title = script_concatenate (Title, ScriptTitle, 'script-title');	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
			TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );&lt;br /&gt;
	elseif plain_title or ('report' == config.CitationClass) then				-- no styling for cite report and descriptive titles (otherwise same as above)&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, 'script-title');		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );	-- for cite report, use this form for trans-title&lt;br /&gt;
	else&lt;br /&gt;
		Title = utilities.wrap_style ('italic-title', Title);&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, 'script-title');		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style ('trans-italic-title', 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 ('err_trans_missing_title', {'title'});&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 ('err_wikilink_in_url');						-- set an error message because we can't have both&lt;br /&gt;
			TitleLink = '';														-- 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 = '';															-- 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 .. '&amp;amp;nbsp;', 'ws link in title-link');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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('^[\'&amp;quot;]*(.-)[\'&amp;quot;]*$', '%1'));	-- 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 ('%b[]', ws_label);							-- replace interwiki link with ws_label to retain markup&lt;br /&gt;
				Title = external_link (ws_url, Title .. '&amp;amp;nbsp;', 'ws link in title');	-- 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['interwiki-icon'], {cfg.presentation['class-wikisource'], 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 ('written', Place, use_lowercase) .. sepc .. &amp;quot; &amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ConferenceURL_origin = A:ORIGIN('ConferenceURL');						-- 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 = '';&lt;br /&gt;
	if not utilities.is_set (Position) then&lt;br /&gt;
		local Minutes = A['Minutes'];&lt;br /&gt;
		local Time = A['Time'];&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 ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'minutes') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'time')});&lt;br /&gt;
			end&lt;br /&gt;
			Position = &amp;quot; &amp;quot; .. Minutes .. &amp;quot; &amp;quot; .. cfg.messages['minutes'];&lt;br /&gt;
		else&lt;br /&gt;
			if utilities.is_set (Time) then&lt;br /&gt;
				local TimeCaption = A['TimeCaption']&lt;br /&gt;
				if not utilities.is_set (TimeCaption) then&lt;br /&gt;
					TimeCaption = cfg.messages['event'];&lt;br /&gt;
					if sepc ~= '.' 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 = '';&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 == 'map' then&lt;br /&gt;
		local Sections = A['Sections'];											-- Section (singular) is an alias of Chapter so set earlier&lt;br /&gt;
		local Inset = A['Inset'];&lt;br /&gt;
		&lt;br /&gt;
		if utilities.is_set ( Inset ) then&lt;br /&gt;
			Inset = sepc .. &amp;quot; &amp;quot; .. wrap_msg ('inset', 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 ('sections', Sections, use_lowercase);&lt;br /&gt;
		elseif utilities.is_set ( Section ) then&lt;br /&gt;
			Section = sepc .. &amp;quot; &amp;quot; .. wrap_msg ('section', 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['Others'];&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 'false' positives right now&lt;br /&gt;
			utilities.set_message ('maint_others_avm')&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message ('maint_others');&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 .. ' ', wrap_msg ('translated', 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 .. ' ', wrap_msg ('interview', Interviewers, use_lowercase), Others}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local TitleNote = A['TitleNote'];&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 ('%f[%a][Ee]d%n?%.?$') or Edition:match ('%f[%a][Ee]dition$') then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.&lt;br /&gt;
			utilities.set_message ('err_extra_text_edition');					 -- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Edition = &amp;quot; &amp;quot; .. wrap_msg ('edition', Edition);&lt;br /&gt;
	else&lt;br /&gt;
		Edition = '';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	Series = utilities.is_set (Series) and wrap_msg ('series', {sepc, Series}) or &amp;quot;&amp;quot;;	-- not the same as SeriesNum&lt;br /&gt;
	local Agency = A['Agency'];&lt;br /&gt;
	Agency = utilities.is_set (Agency) and wrap_msg ('agency', {sepc, Agency}) or &amp;quot;&amp;quot;;&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['retrieved']&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['accessdate'], {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['Docket'];&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 .. ' ' .. 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;
	local Quote = A['Quote'];&lt;br /&gt;
	local TransQuote = A['TransQuote'];&lt;br /&gt;
	local ScriptQuote = A['ScriptQuote'];&lt;br /&gt;
	if utilities.is_set (Quote) or utilities.is_set (TransQuote) or utilities.is_set (ScriptQuote) then&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Quote) then&lt;br /&gt;
			if Quote:sub(1, 1) == '&amp;quot;' and Quote:sub(-1, -1) == '&amp;quot;' 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 ('quoted-text', Quote );					-- wrap in &amp;lt;q&amp;gt;...&amp;lt;/q&amp;gt; tags&lt;br /&gt;
	&lt;br /&gt;
		if utilities.is_set (ScriptQuote) then&lt;br /&gt;
			Quote = script_concatenate (Quote, ScriptQuote, 'script-quote');	-- &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 (TransQuote) then&lt;br /&gt;
			if TransQuote:sub(1, 1) == '&amp;quot;' and TransQuote:sub(-1, -1) == '&amp;quot;' then -- if first and last characters of |trans-quote are quote marks&lt;br /&gt;
				TransQuote = TransQuote:sub(2, -2); -- strip them off&lt;br /&gt;
			end&lt;br /&gt;
			Quote = Quote .. &amp;quot; &amp;quot; .. utilities.wrap_style ('trans-quoted-title', TransQuote );&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (QuotePage) or utilities.is_set (QuotePages) then	-- add page prefix&lt;br /&gt;
			local quote_prefix = '';&lt;br /&gt;
			if utilities.is_set (QuotePage) then&lt;br /&gt;
				extra_text_in_page_check (QuotePage, 'quote-page');				-- 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['p-prefix'], {sepc, QuotePage}), '', '', '';&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePage}), '', '', '';&lt;br /&gt;
				end&lt;br /&gt;
			elseif utilities.is_set (QuotePages) then&lt;br /&gt;
				extra_text_in_page_check (QuotePages, 'quote-pages');			-- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.&lt;br /&gt;
				if tonumber(QuotePages) ~= nil and not NoPP then				-- if only digits, assume single page&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, QuotePages}), '', '';&lt;br /&gt;
				elseif not NoPP then&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, QuotePages}), '', '';&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, QuotePages}), '', '';&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;
	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'd otherwise emit a message even if there wasn'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 ('maint_postscript')&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Archived;&lt;br /&gt;
	if utilities.is_set (ArchiveURL) then&lt;br /&gt;
		local arch_text;&lt;br /&gt;
		if not utilities.is_set (ArchiveDate) then&lt;br /&gt;
			utilities.set_message ('err_archive_missing_date');&lt;br /&gt;
			ArchiveDate = '';													-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
		if &amp;quot;live&amp;quot; == UrlStatus then&lt;br /&gt;
			arch_text = cfg.messages['archived'];&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 .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],&lt;br /&gt;
					{external_link( ArchiveURL, arch_text, A:ORIGIN('ArchiveURL'), nil) .. ArchiveFormat, ArchiveDate } );&lt;br /&gt;
			else&lt;br /&gt;
				Archived = '';&lt;br /&gt;
			end&lt;br /&gt;
			if not utilities.is_set (OriginalURL) then&lt;br /&gt;
				utilities.set_message ('err_archive_missing_url');&lt;br /&gt;
				Archived = '';													-- empty string for concatenation&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (OriginalURL) then								-- UrlStatus is empty, 'dead', 'unfit', 'usurped', 'bot: unknown'&lt;br /&gt;
			if utilities.in_array (UrlStatus, {'unfit', 'usurped', 'bot: unknown'}) then&lt;br /&gt;
				arch_text = cfg.messages['archived-unfit'];&lt;br /&gt;
				if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
				Archived = sepc .. ' ' .. arch_text .. ArchiveDate;				-- format already styled&lt;br /&gt;
				if 'bot: unknown' == UrlStatus then&lt;br /&gt;
					utilities.set_message ('maint_bot_unknown');				-- and add a category if not already added&lt;br /&gt;
				else&lt;br /&gt;
					utilities.set_message ('maint_unfit');						-- and add a category if not already added&lt;br /&gt;
				end&lt;br /&gt;
			else																-- UrlStatus is empty, 'dead'&lt;br /&gt;
				arch_text = cfg.messages['archived-dead'];&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['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } );	-- format already styled&lt;br /&gt;
				else&lt;br /&gt;
					Archived = '';												-- unset for concatenation&lt;br /&gt;
				end&lt;br /&gt;
			end	&lt;br /&gt;
		else																	-- OriginalUrl not set&lt;br /&gt;
			arch_text = cfg.messages['archived-missing'];&lt;br /&gt;
			if sepc ~= &amp;quot;.&amp;quot; then arch_text = arch_text:lower() end&lt;br /&gt;
			utilities.set_message ('err_archive_missing_url');&lt;br /&gt;
			Archived = '';														-- 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 = '';&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Lay = '';&lt;br /&gt;
	local LaySource = A['LaySource'];&lt;br /&gt;
	local LayURL = A['LayURL'];&lt;br /&gt;
	local LayFormat = A['LayFormat'];&lt;br /&gt;
	LayFormat = style_format (LayFormat, LayURL, 'lay-format', 'lay-url');&lt;br /&gt;
	if utilities.is_set (LayURL) then&lt;br /&gt;
		if utilities.is_set (LayDate) then LayDate = &amp;quot; (&amp;quot; .. LayDate .. &amp;quot;)&amp;quot; end&lt;br /&gt;
		if utilities.is_set (LaySource) then &lt;br /&gt;
			LaySource = &amp;quot; &amp;amp;ndash; ''&amp;quot; .. utilities.safe_for_italics (LaySource) .. &amp;quot;''&amp;quot;;&lt;br /&gt;
		else&lt;br /&gt;
			LaySource = &amp;quot;&amp;quot;;&lt;br /&gt;
		end&lt;br /&gt;
		if sepc == '.' then&lt;br /&gt;
			Lay = sepc .. &amp;quot; &amp;quot; .. external_link( LayURL, cfg.messages['lay summary'], A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate&lt;br /&gt;
		else&lt;br /&gt;
			Lay = sepc .. &amp;quot; &amp;quot; .. external_link( LayURL, cfg.messages['lay summary']:lower(), A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate&lt;br /&gt;
		end			&lt;br /&gt;
	elseif utilities.is_set (LayFormat) then									-- Test if |lay-format= is given without giving a |lay-url=&lt;br /&gt;
		Lay = sepc .. LayFormat;												-- if set and LayURL not set, then LayFormat has error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local TranscriptURL = A['TranscriptURL']&lt;br /&gt;
	local TranscriptFormat = A['TranscriptFormat'];&lt;br /&gt;
	TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, 'transcript-format', 'transcripturl');&lt;br /&gt;
	local Transcript = A['Transcript'];&lt;br /&gt;
	local TranscriptURL_origin = A:ORIGIN('TranscriptURL');						-- 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 .. ' ' .. 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 ('published', 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;
	local TransPeriodical =  A['TransPeriodical'];&lt;br /&gt;
	local TransPeriodical_origin =  A:ORIGIN ('TransPeriodical');&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['Language'];&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='';															-- 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 = '';															-- 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;journal&amp;quot;, &amp;quot;citation&amp;quot;}) and utilities.is_set (Periodical) then&lt;br /&gt;
		if not (utilities.is_set (Authors) or utilities.is_set (Editors)) then&lt;br /&gt;
			Others = Others:gsub ('^' .. sepc .. ' ', '');						-- when no authors and no editors, strip leading sepc and space&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Others) then Others = safe_join ({Others, sepc .. &amp;quot; &amp;quot;}, sepc) end		-- add terminal punctuation &amp;amp; space; check for dup sepc; TODO why do we need to do this here?&lt;br /&gt;
		tcommon = safe_join( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume}, sepc );&lt;br /&gt;
	elseif 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( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );&lt;br /&gt;
		else&lt;br /&gt;
			tcommon = safe_join( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif 'map' == 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, Format, 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, Format, 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, Format, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc );&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	elseif 'episode' == 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, Format, TitleType, Series, Language, &lt;br /&gt;
			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['Via'];&lt;br /&gt;
	Via = utilities.is_set (Via) and  wrap_msg ('via', Via) or '';&lt;br /&gt;
	local idcommon;&lt;br /&gt;
	if 'audio-visual' == config.CitationClass or 'episode' == 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, Lay, Quote }, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Lay, 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['OrigDate'];&lt;br /&gt;
	OrigDate = utilities.is_set (OrigDate) and wrap_msg ('origdate', OrigDate) or '';&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'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 = &amp;quot; &amp;quot;;&lt;br /&gt;
			local post_text = &amp;quot;&amp;quot;;&lt;br /&gt;
			if utilities.is_set (Chapter) and 0 == #c then&lt;br /&gt;
				in_text = in_text .. cfg.messages['in'] .. &amp;quot; &amp;quot;&lt;br /&gt;
				if (sepc ~= '.') 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 = &amp;quot; (&amp;quot; .. cfg.messages['editor'] .. &amp;quot;)&amp;quot;;				-- be consistent with no-author, no-date case&lt;br /&gt;
			else&lt;br /&gt;
				post_text = &amp;quot; (&amp;quot; .. cfg.messages['editors'] .. &amp;quot;)&amp;quot;;&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're citing the intro, preface, etc.&lt;br /&gt;
			local by_text = sepc .. ' ' .. cfg.messages['by'] .. ' ';&lt;br /&gt;
			if (sepc ~= '.') 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'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['sep_name'] .. cfg.messages['editor'];&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editors'];&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['editor'] .. &amp;quot;)&amp;quot; .. sepc .. &amp;quot; &amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. &amp;quot; (&amp;quot; .. cfg.messages['editors'] .. &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;
		text = text:sub(1, -sepc:len() - 1);&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;
	if A['Ref'] ~= 'harv' then&lt;br /&gt;
		local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true);	-- nil when |ref=harv; A['Ref'] else&lt;br /&gt;
	else&lt;br /&gt;
		local Ref = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] 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 '') then	-- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison&lt;br /&gt;
				utilities.set_message ('maint_ref_duplicates_default');&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			citeref_id = '';													-- 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('%b&amp;lt;&amp;gt;', '')) &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 = '';																-- blank the the citation&lt;br /&gt;
		utilities.set_message ('err_empty_citation');							-- 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['cite-id'], {mw.uri.anchorEncode(options_t.id), mw.text.nowiki(options_t.class), text}));	-- when |ref= is set or when there is a namelist&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation['cite'], {mw.text.nowiki(options_t.class), text}));	-- when |ref=none or when namelist_t empty and |ref= is missing or is empty&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if OCinSoutput then															-- blanked when citation is 'empty' so don't bother to add boilerplate metadata span&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation['ocins'], OCinSoutput));	-- format and append metadata to the citation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local template_name = ('citation' == config.CitationClass) and 'citation' or 'cite ' .. (cfg.citation_class_map_t[config.CitationClass] or config.CitationClass);&lt;br /&gt;
	local template_link = '[[Template:' .. template_name .. '|' .. template_name .. ']]';&lt;br /&gt;
	local msg_prefix = '&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;{{' .. template_link .. '}}&amp;lt;/code&amp;gt;: ';&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, ' ');											-- 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 ('cs1-visible-error', 1, true) then						-- look for the visible error class name&lt;br /&gt;
				hidden = false;													-- found one; so don'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, '; '));			-- 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, ' (', utilities.substitute (cfg.messages[':cat wikilink'], v), ')'})&lt;br /&gt;
				);&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation['hidden-maint'], table.concat (maint_msgs_t, ' ')));	-- wrap the group of maint messages with proper presentation and save&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not no_tracking_cats then&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));&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));&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['cat wikilink'], v));&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'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;															-- for enumerated parameters, is name with enumerator replaced with '#'&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 'tracked' == state then&lt;br /&gt;
			local base_name = name:gsub ('%d', '');								-- strip enumerators from parameter names that have them to get the base name&lt;br /&gt;
			utilities.add_prop_cat ('tracked-param', {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 ('#') then														-- # is a cs1|2 reserved character so parameters with # not permitted&lt;br /&gt;
		return nil;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cite_class, whitelist.preprint_template_list ) then	-- limited parameter sets allowed for these templates&lt;br /&gt;
		state = whitelist.limited_basic_arguments[name];&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
		state = whitelist.preprint_arguments[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;
																				-- limited enumerated parameters list&lt;br /&gt;
		enum_name = name:gsub(&amp;quot;%d+&amp;quot;, &amp;quot;#&amp;quot; );										-- replace digit(s) with # (last25 becomes last#) (mw.ustring because non-Western 'local' digits)&lt;br /&gt;
		state = whitelist.limited_numbered_arguments[enum_name];&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) then 	-- experiment for template-specific parameters for templates that accept parameters from the basic argument list&lt;br /&gt;
		state = whitelist.unique_arguments[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.basic_arguments[name];									-- all other templates; all normal parameters allowed&lt;br /&gt;
	if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
																				-- all enumerated parameters allowed&lt;br /&gt;
	enum_name = name:gsub(&amp;quot;%d+&amp;quot;, &amp;quot;#&amp;quot; );											-- replace digit(s) with # (last25 becomes last#) (mw.ustring because non-Western 'local' digits)&lt;br /&gt;
	state = whitelist.numbered_arguments[enum_name];&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 ('%[%[(%a+):');									-- 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 ('err_bad_paramlink', 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 ('%b&amp;lt;&amp;gt;', '');											-- remove XML/HTML tags because attributes: class=, title=, etc.&lt;br /&gt;
&lt;br /&gt;
	capture = value:match ('%s+(%a[%w%-]+)%s*=') or value:match ('^(%a[%w%-]+)%s*=');	-- 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 ('err_missing_pipe', 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 'number' == type (param) then&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	param = param:gsub ('%d+', '#');											-- 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 ('[,;:]$') then&lt;br /&gt;
		utilities.set_message ('maint_extra_punct');							-- has extraneous punctuation; add maint cat&lt;br /&gt;
	end&lt;br /&gt;
	if value:match ('^=') then													-- sometimes an extraneous '=' character appears ...&lt;br /&gt;
		utilities.set_message ('maint_extra_punct');							-- 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 _ 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 (url_param_t)&lt;br /&gt;
	local url_error_t = {};&lt;br /&gt;
	&lt;br /&gt;
	check_for_url (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 ('err_param_has_ext_link', {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;
This is used by templates such as {{cite book}} to create the actual citation text.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citation(frame)&lt;br /&gt;
	Frame = frame;																-- save a copy in case we need to display an error message in preview mode&lt;br /&gt;
&lt;br /&gt;
	local config = {};															-- table to store parameters from the module {{#invoke:}}&lt;br /&gt;
	for k, v in pairs( frame.args ) do											-- get parameters from the {{#invoke}} frame&lt;br /&gt;
		config[k] = v;&lt;br /&gt;
	--	args[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;
																				-- 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 '' ~= config.SandboxPath) and config.SandboxPath) or '/sandbox';	-- 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 '';										-- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else&lt;br /&gt;
&lt;br /&gt;
	local pframe = frame:getParent()&lt;br /&gt;
	local styles;&lt;br /&gt;
	&lt;br /&gt;
	cfg = mw.loadData ('Module:Citation/CS1/Configuration' .. sandbox);			-- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else&lt;br /&gt;
	whitelist = mw.loadData ('Module:Citation/CS1/Whitelist' .. sandbox);&lt;br /&gt;
	utilities = require ('Module:Citation/CS1/Utilities' .. sandbox);&lt;br /&gt;
	validation = require ('Module:Citation/CS1/Date_validation' .. sandbox);&lt;br /&gt;
	identifiers = require ('Module:Citation/CS1/Identifiers' .. sandbox);&lt;br /&gt;
	metadata = require ('Module:Citation/CS1/COinS' .. sandbox);&lt;br /&gt;
	styles = 'Module:Citation/CS1' .. sandbox .. '/styles.css';&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 ('{{REVISIONID}}'));&lt;br /&gt;
&lt;br /&gt;
	local args = {};															-- table where we store all of the template's arguments&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( pframe.args ) do											-- get parameters from the parent (template) frame&lt;br /&gt;
		v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1');							-- trim leading/trailing whitespace; when v is only whitespace, becomes empty string&lt;br /&gt;
		if v ~= '' then&lt;br /&gt;
			if ('string' == type (k)) then&lt;br /&gt;
				k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits);		-- for enumerated parameters, translate 'local' 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) ~= 'string' 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 ('err_text_ignored', {v});&lt;br /&gt;
					end&lt;br /&gt;
				elseif validate (k:lower(), config.CitationClass) then &lt;br /&gt;
					error_text = utilities.set_message ('err_parameter_ignored_suggest', {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 ('Module:Citation/CS1/Suggestions' .. 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 ('err_parameter_ignored_suggest', {k, param});	-- set the suggestion error message&lt;br /&gt;
							else&lt;br /&gt;
								error_text = utilities.set_message ('err_parameter_ignored', {k});	-- suggested param not supported by this template&lt;br /&gt;
								v = '';											-- 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'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 ('err_parameter_ignored_suggest', {k, suggestions.suggestions[ k:lower() ]});&lt;br /&gt;
						else&lt;br /&gt;
							utilities.set_message ('err_parameter_ignored', {k});&lt;br /&gt;
							v = '';												-- 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 = ('' == k) and '(empty string)' 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 ('parameter', 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 == 'postscript') then						-- when args[k] has a value from {{#invoke}} frame (we don'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 ('err_param_unknown_empty', {&lt;br /&gt;
			1 == #empty_unknowns and '' or 's',&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 url_param_t = {};&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if 'string' == type (k) then											-- don'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 'string' == type (k) and not cfg.url_skip[k] then					-- when parameter k is not positional and not in url skip table&lt;br /&gt;
			url_param_t[k] = v;													-- make a parameter/value list for extraneous url check&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	has_extraneous_url (url_param_t);											-- look for url in parameter values where a url does not belong&lt;br /&gt;
&lt;br /&gt;
	return table.concat ({&lt;br /&gt;
		frame:extensionTag ('templatestyles', '', {src=styles}),&lt;br /&gt;
		citation0( config, args)&lt;br /&gt;
	});&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 {citation = citation};&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Taxonbar&amp;diff=5304677</id>
		<title>Module:Taxonbar</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Taxonbar&amp;diff=5304677"/>
		<updated>2023-05-19T10:19:06Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Replaced content with &amp;quot;local p = {}  --========================================================================== --[[                                   Main...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
--[[==========================================================================]]&lt;br /&gt;
--[[                                   Main                                   ]]&lt;br /&gt;
--[[==========================================================================]]&lt;br /&gt;
&lt;br /&gt;
function p.authorityControlTaxon( frame )&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Authority_control&amp;diff=5304676</id>
		<title>Module:Authority control</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Authority_control&amp;diff=5304676"/>
		<updated>2023-05-19T10:07:56Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Replaced content with &amp;quot;--========================================================================== --                                   Main                                    --[[=====...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[==========================================================================]]&lt;br /&gt;
--[[                                   Main                                   ]]&lt;br /&gt;
--[[==========================================================================]]&lt;br /&gt;
function p.authorityControl(frame)&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.makelink = function(conf,val,nextid,qid)&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Taxonbar/candidate&amp;diff=5304675</id>
		<title>Module:Taxonbar/candidate</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Taxonbar/candidate&amp;diff=5304675"/>
		<updated>2023-05-19T10:06:13Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Remove links to Wikidata&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.check(frame)&lt;br /&gt;
	return ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1/Identifiers&amp;diff=5304674</id>
		<title>Module:Citation/CS1/Identifiers</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1/Identifiers&amp;diff=5304674"/>
		<updated>2023-05-19T10:04:38Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Remove references to Wikidata&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
&lt;br /&gt;
local has_accept_as_written, is_set, in_array, set_message, select_one,			-- functions in Module:Citation/CS1/Utilities&lt;br /&gt;
		substitute, make_wikilink;&lt;br /&gt;
&lt;br /&gt;
local z;																		-- table of tables defined in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
local cfg;																		-- table of configuration tables that are defined in Module:Citation/CS1/Configuration&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 other modules; that are created here and used here&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local auto_link_urls = {};														-- holds identifier URLs for those identifiers that can auto-link |title=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; H E L P E R   F U N C T I O N S &amp;gt;&amp;gt;============================================&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N K _ L A B E L _ M A K E &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common function to create identifier link label from handler table&lt;br /&gt;
&lt;br /&gt;
returns the first available of&lt;br /&gt;
	1. redirect from local wiki's handler table (if enabled)&lt;br /&gt;
	2. label specified in the local wiki's handler table&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function link_label_make (handler)&lt;br /&gt;
	return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or handler.link;&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 _ I D &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a wiki-style external link&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function external_link_id (options)&lt;br /&gt;
	local url_string = options.id;&lt;br /&gt;
	local ext_link;&lt;br /&gt;
	local this_wiki_code = cfg.this_wiki_code;									-- Wikipedia subdomain; 'en' for en.wikipedia.org&lt;br /&gt;
&lt;br /&gt;
	if options.encode == true or options.encode == nil then&lt;br /&gt;
		url_string = mw.uri.encode (url_string, 'PATH');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if options.auto_link and is_set (options.access) then&lt;br /&gt;
		auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or &amp;quot;&amp;quot;, mw.text.nowiki (options.id));&lt;br /&gt;
	if is_set (options.access) then&lt;br /&gt;
		ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link});	-- add the free-to-read / paywall lock&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat	({&lt;br /&gt;
		make_wikilink (link_label_make (options), options.label),				-- redirect, or locally specified link (in that order)&lt;br /&gt;
		options.separator or '&amp;amp;nbsp;',&lt;br /&gt;
		ext_link&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N T E R N A L _ L I N K _ I D &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a wiki-style internal link&lt;br /&gt;
&lt;br /&gt;
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),&lt;br /&gt;
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,&lt;br /&gt;
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function internal_link_id (options)&lt;br /&gt;
	local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits);	-- translate 'local' digits to Western 0-9&lt;br /&gt;
&lt;br /&gt;
	return table.concat (&lt;br /&gt;
		{&lt;br /&gt;
		make_wikilink (link_label_make (options), options.label),				-- wiki-link the identifier label&lt;br /&gt;
		options.separator or '&amp;amp;nbsp;',											-- add the separator&lt;br /&gt;
		make_wikilink (&lt;br /&gt;
			table.concat (&lt;br /&gt;
				{&lt;br /&gt;
				options.prefix,&lt;br /&gt;
				id,																-- translated to Western digits&lt;br /&gt;
				options.suffix or ''&lt;br /&gt;
				}),&lt;br /&gt;
			substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)})	-- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis&lt;br /&gt;
			);																	-- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ E M B A R G O E D &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against&lt;br /&gt;
today's date.  If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns&lt;br /&gt;
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_embargoed (embargo)&lt;br /&gt;
	if is_set (embargo) then&lt;br /&gt;
		local lang = mw.getContentLanguage();&lt;br /&gt;
		local good1, embargo_date, todays_date;&lt;br /&gt;
		good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);&lt;br /&gt;
		todays_date = lang:formatDate ('U');&lt;br /&gt;
	&lt;br /&gt;
		if good1 then															-- if embargo date is a good date&lt;br /&gt;
			if tonumber (embargo_date) &amp;gt;= tonumber (todays_date) then			-- is embargo date is in the future?&lt;br /&gt;
				return embargo;													-- still embargoed&lt;br /&gt;
			else&lt;br /&gt;
				set_message ('maint_pmc_embargo');								-- embargo has expired; add main cat&lt;br /&gt;
				return '';														-- unset because embargo has expired&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return '';																	-- |pmc-embargo-date= not set return empty string&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ V A L I D _ B I O R X I V _ D A T E &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if:&lt;br /&gt;
	2019-12-11T00:00Z &amp;lt;= biorxiv_date &amp;lt; today + 2 days&lt;br /&gt;
	&lt;br /&gt;
The dated form of biorxiv identifier has a start date of 2019-12-11.  The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400&lt;br /&gt;
&lt;br /&gt;
biorxiv_date is the date provided in those |biorxiv= parameter values that are dated at time 00:00:00 UTC&lt;br /&gt;
today is the current date at time 00:00:00 UTC plus 48 hours&lt;br /&gt;
	if today is 2015-01-01T00:00:00 then&lt;br /&gt;
		adding 24 hours gives 2015-01-02T00:00:00 – one second more than today&lt;br /&gt;
		adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow&lt;br /&gt;
&lt;br /&gt;
This function does not work if it is fed month names for languages other than English.  Wikimedia #time: parser&lt;br /&gt;
apparently doesn't understand non-English date month names. This function will always return false when the date&lt;br /&gt;
contains a non-English month name because good1 is false after the call to lang_object.formatDate().  To get&lt;br /&gt;
around that call this function with date parts and create a YYYY-MM-DD format date.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_biorxiv_date (y, m, d)&lt;br /&gt;
	local biorxiv_date = table.concat ({y, m, d}, '-');							-- make ymd date&lt;br /&gt;
	local good1, good2;&lt;br /&gt;
	local biorxiv_ts, tomorrow_ts;												-- to hold Unix timestamps representing the dates&lt;br /&gt;
	local lang_object = mw.getContentLanguage();&lt;br /&gt;
&lt;br /&gt;
	good1, biorxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', biorxiv_date);		-- convert biorxiv_date value to Unix timestamp &lt;br /&gt;
	good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' );	-- today midnight + 2 days is one second more than all day tomorrow&lt;br /&gt;
	&lt;br /&gt;
	if good1 and good2 then														-- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand&lt;br /&gt;
		biorxiv_ts = tonumber (biorxiv_ts) or lang_object:parseFormattedNumber (biorxiv_ts);	-- convert to numbers for the comparison;&lt;br /&gt;
		tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- one or both failed to convert to Unix timestamp&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return ((1576022400 &amp;lt;= biorxiv_ts) and (biorxiv_ts &amp;lt; tomorrow_ts))			-- 2012-12-11T00:00Z &amp;lt;= biorxiv_date &amp;lt; tomorrow's date&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; IS _ V A L I D _ I S X N &amp;gt;-----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.&lt;br /&gt;
ISBN-13 is checked in isbn().&lt;br /&gt;
&lt;br /&gt;
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length&lt;br /&gt;
and stripped of dashes, spaces and other non-ISxN characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_isxn (isxn_str, len)&lt;br /&gt;
	local temp = 0;&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, len) };										-- make a table of byte values '0' → 0x30 .. '9' → 0x39, 'X' → 0x58&lt;br /&gt;
	len = len + 1;																-- adjust to be a loop counter&lt;br /&gt;
	for i, v in ipairs (isxn_str) do											-- loop through all of the bytes and calculate the checksum&lt;br /&gt;
		if v == string.byte (&amp;quot;X&amp;quot; ) then											-- if checkdigit is X (compares the byte value of 'X' which is 0x58)&lt;br /&gt;
			temp = temp + 10 * (len - i);										-- it represents 10 decimal&lt;br /&gt;
		else&lt;br /&gt;
			temp = temp + tonumber (string.char (v) )*(len-i);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 11 == 0;														-- returns true if calculation result is zero&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; IS _ V A L I D _ I S X N _ 1 3 &amp;gt;-----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.&lt;br /&gt;
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length&lt;br /&gt;
and stripped of dashes, spaces and other non-ISxN-13 characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_isxn_13 (isxn_str)&lt;br /&gt;
	local temp=0;&lt;br /&gt;
	&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, 13) };										-- make a table of byte values '0' → 0x30 .. '9' → 0x39&lt;br /&gt;
	for i, v in ipairs (isxn_str) do&lt;br /&gt;
		temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) );			-- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 10 == 0;														-- sum modulo 10 is zero when ISBN-13/ISMN is correct&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N O R M A L I Z E _ L C C N &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)&lt;br /&gt;
1. Remove all blanks.&lt;br /&gt;
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.&lt;br /&gt;
3. If there is a hyphen in the string:&lt;br /&gt;
	a. Remove it.&lt;br /&gt;
	b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):&lt;br /&gt;
		1. All these characters should be digits, and there should be six or less. (not done in this function)&lt;br /&gt;
		2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.&lt;br /&gt;
&lt;br /&gt;
Returns a normalized LCCN for lccn() to validate.  There is no error checking (step 3.b.1) performed in this function.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function normalize_lccn (lccn)&lt;br /&gt;
	lccn = lccn:gsub (&amp;quot;%s&amp;quot;, &amp;quot;&amp;quot;);												-- 1. strip whitespace&lt;br /&gt;
&lt;br /&gt;
	if nil ~= string.find (lccn, '/') then&lt;br /&gt;
		lccn = lccn:match (&amp;quot;(.-)/&amp;quot;);											-- 2. remove forward slash and all character to the right of it&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local prefix&lt;br /&gt;
	local suffix&lt;br /&gt;
	prefix, suffix = lccn:match (&amp;quot;(.+)%-(.+)&amp;quot;);									-- 3.a remove hyphen by splitting the string into prefix and suffix&lt;br /&gt;
&lt;br /&gt;
	if nil ~= suffix then														-- if there was a hyphen&lt;br /&gt;
		suffix = string.rep(&amp;quot;0&amp;quot;, 6-string.len (suffix)) .. suffix;				-- 3.b.2 left fill the suffix with 0s if suffix length less than 6&lt;br /&gt;
		lccn = prefix..suffix;													-- reassemble the LCCN&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return lccn;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; I D E N T I F I E R   F U N C T I O N S &amp;gt;&amp;gt;====================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R X I V &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
See: https://arxiv.org/help/arxiv_identifier&lt;br /&gt;
&lt;br /&gt;
format and error check arXiv identifier.  There are three valid forms of the identifier:&lt;br /&gt;
the first form, valid only between date codes 9107 and 0703, is:&lt;br /&gt;
	arXiv:&amp;lt;archive&amp;gt;.&amp;lt;class&amp;gt;/&amp;lt;date code&amp;gt;&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;archive&amp;gt; is a string of alpha characters - may be hyphenated; no other punctuation&lt;br /&gt;
	&amp;lt;class&amp;gt; is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form&lt;br /&gt;
	&amp;lt;date code&amp;gt; is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01&lt;br /&gt;
		first digit of YY for this form can only 9 and 0&lt;br /&gt;
	&amp;lt;number&amp;gt; is a three-digit number&lt;br /&gt;
	&amp;lt;version&amp;gt; is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)&lt;br /&gt;
	&lt;br /&gt;
the second form, valid from April 2007 through December 2014 is:&lt;br /&gt;
	arXiv:&amp;lt;date code&amp;gt;.&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;date code&amp;gt; is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01&lt;br /&gt;
	&amp;lt;number&amp;gt; is a four-digit number&lt;br /&gt;
	&amp;lt;version&amp;gt; is a 1 or more digit number preceded with a lowercase v; no spaces&lt;br /&gt;
&lt;br /&gt;
the third form, valid from January 2015 is:&lt;br /&gt;
	arXiv:&amp;lt;date code&amp;gt;.&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;date code&amp;gt; and &amp;lt;version&amp;gt; are as defined for 0704-1412&lt;br /&gt;
	&amp;lt;number&amp;gt; is a five-digit number&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function arxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local class = options.Class;												-- TODO: lowercase?&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local year, month, version;&lt;br /&gt;
	local err_msg = false;														-- assume no error message&lt;br /&gt;
	local text;																	-- output text&lt;br /&gt;
	&lt;br /&gt;
	if id:match(&amp;quot;^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$&amp;quot;) then	-- test for the 9107-0703 format with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((not (90 &amp;lt; year or 8 &amp;gt; year)) or (1 &amp;gt; month or 12 &amp;lt; month)) or		-- if invalid year or invalid month&lt;br /&gt;
			((91 == year and 7 &amp;gt; month) or (7 == year and 3 &amp;lt; month)) then		-- if years ok, are starting and ending months ok?&lt;br /&gt;
				err_msg = true;													-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%dv%d+$&amp;quot;) then	-- test for the 0704-1412 with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((7 &amp;gt; year) or (14 &amp;lt; year) or (1 &amp;gt; month or 12 &amp;lt; month)) or			-- is year invalid or is month invalid? (doesn't test for future years)&lt;br /&gt;
			((7 == year) and (4 &amp;gt; month)) then									-- when year is 07, is month invalid (before April)?&lt;br /&gt;
				err_msg = true;													-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d%dv%d+$&amp;quot;) then	-- test for the 1501- format with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((15 &amp;gt; year) or (1 &amp;gt; month or 12 &amp;lt; month)) then						-- is year invalid or is month invalid? (doesn't test for future years)&lt;br /&gt;
			err_msg = true;														-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		err_msg = true;															-- not a recognized format; flag for error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		options.coins_list_t['ARXIV'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local err_msg_t = {};&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		set_message ('err_bad_arxiv');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});&lt;br /&gt;
&lt;br /&gt;
	if is_set (class) then&lt;br /&gt;
		if id:match ('^%d+') then&lt;br /&gt;
			text = table.concat ({text, ' [[//arxiv.org/archive/', class, ' ', class, ']]'});	-- external link within square brackets, not wikilink&lt;br /&gt;
		else&lt;br /&gt;
			set_message ('err_class_ignored');&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B I B C O D E &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validates (sort of) and formats a bibcode ID.&lt;br /&gt;
&lt;br /&gt;
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes&lt;br /&gt;
&lt;br /&gt;
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters&lt;br /&gt;
and first four digits must be a year.  This function makes these tests:&lt;br /&gt;
	length must be 19 characters&lt;br /&gt;
	characters in position&lt;br /&gt;
		1–4 must be digits and must represent a year in the range of 1000 – next year&lt;br /&gt;
		5 must be a letter&lt;br /&gt;
		6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &amp;amp;. )&lt;br /&gt;
		9–18 must be letter, digit, or dot&lt;br /&gt;
		19 must be a letter or dot&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function bibcode (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_type;&lt;br /&gt;
	local err_msg = '';&lt;br /&gt;
	local year;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = access});&lt;br /&gt;
	&lt;br /&gt;
	if 19 ~= id:len() then&lt;br /&gt;
		err_type = cfg.err_msg_supl.length;&lt;br /&gt;
	else&lt;br /&gt;
		year = id:match (&amp;quot;^(%d%d%d%d)[%a][%w&amp;amp;%.][%w&amp;amp;%.][%w&amp;amp;%.][%w.]+[%a%.]$&amp;quot;);&lt;br /&gt;
		if not year then														-- if nil then no pattern match&lt;br /&gt;
			err_type = cfg.err_msg_supl.value;									-- so value error&lt;br /&gt;
		else&lt;br /&gt;
			local next_year = tonumber (os.date ('%Y')) + 1;					-- get the current year as a number and add one for next year&lt;br /&gt;
			year = tonumber (year);												-- convert year portion of bibcode to a number&lt;br /&gt;
			if (1000 &amp;gt; year) or (year &amp;gt; next_year) then&lt;br /&gt;
				err_type = cfg.err_msg_supl.year;								-- year out of bounds&lt;br /&gt;
			end&lt;br /&gt;
			if id:find('&amp;amp;%.') then&lt;br /&gt;
				err_type = cfg.err_msg_supl.journal;							-- journal abbreviation must not have '&amp;amp;.' (if it does it's missing a letter)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (err_type) then													-- if there was an error detected&lt;br /&gt;
		set_message ('err_bad_bibcode', {err_type});&lt;br /&gt;
		options.coins_list_t['BIBCODE'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B I O R X I V &amp;gt;-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format bioRxiv ID and do simple error checking.  Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly&lt;br /&gt;
6 digits.  After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd. &lt;br /&gt;
date and suffixed with an optional version identifier.&lt;br /&gt;
&lt;br /&gt;
The bioRxiv ID is the string of characters:&lt;br /&gt;
	https://doi.org/10.1101/078733 -&amp;gt; 10.1101/078733&lt;br /&gt;
or a date followed by a six-digit number followed by an optional version indicator 'v' and one or more digits:&lt;br /&gt;
	https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -&amp;gt; 10.1101/2019.12.11.123456v2&lt;br /&gt;
	&lt;br /&gt;
see https://www.biorxiv.org/about-biorxiv&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function biorxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_msg = true;														-- flag; assume that there will be an error&lt;br /&gt;
	&lt;br /&gt;
	local patterns = {&lt;br /&gt;
		'^10.1101/%d%d%d%d%d%d$',												-- simple 6-digit identifier (before 2019-12-11)&lt;br /&gt;
		'^10.1101/(20[1-9]%d)%.([01]%d)%.([0-3]%d)%.%d%d%d%d%d%dv%d+$',			-- y.m.d. date + 6-digit identifier + version (after 2019-12-11)&lt;br /&gt;
		'^10.1101/(20[1-9]%d)%.([01]%d)%.([0-3]%d)%.%d%d%d%d%d%d$',				-- y.m.d. date + 6-digit identifier (after 2019-12-11)&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- spin through the patterns looking for a match&lt;br /&gt;
		if id:match (pattern) then&lt;br /&gt;
			local y, m, d = id:match (pattern);									-- found a match, attempt to get year, month and date from the identifier&lt;br /&gt;
&lt;br /&gt;
			if m then															-- m is nil when id is the six-digit form&lt;br /&gt;
				if not is_valid_biorxiv_date (y, m, d) then						-- validate the encoded date; TODO: don't ignore leap-year and actual month lengths ({{#time:}} is a poor date validator)&lt;br /&gt;
					break;														-- date fail; break out early so we don't unset the error message&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			err_msg = nil;														-- we found a match so unset the error message&lt;br /&gt;
			break;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- err_cat remains set here when no match&lt;br /&gt;
&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		options.coins_list_t['BIORXIV'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		set_message ('err_bad_biorxiv');										-- and set the error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator,&lt;br /&gt;
			encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E S E E R X &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
CiteSeerX use their own notion of &amp;quot;doi&amp;quot; (not to be confused with the identifiers resolved via doi.org).&lt;br /&gt;
&lt;br /&gt;
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citeseerx (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local matched;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = handler.access});&lt;br /&gt;
	&lt;br /&gt;
	matched = id:match (&amp;quot;^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$&amp;quot;);&lt;br /&gt;
	if not matched then&lt;br /&gt;
		set_message ('err_bad_citeseerx' );&lt;br /&gt;
		options.coins_list_t['CITESEERX'] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D O I &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a DOI and checks for DOI errors.&lt;br /&gt;
&lt;br /&gt;
DOI names contain two parts: prefix and suffix separated by a forward slash.&lt;br /&gt;
	Prefix: directory indicator '10.' followed by a registrant code&lt;br /&gt;
	Suffix: character string of any length chosen by the registrant&lt;br /&gt;
&lt;br /&gt;
This function checks a DOI name for: prefix/suffix.  If the DOI name contains spaces or endashes, or, if it ends&lt;br /&gt;
with a period or a comma, this function will emit a bad_doi error message.&lt;br /&gt;
&lt;br /&gt;
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,&lt;br /&gt;
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely&lt;br /&gt;
if ever used in DOI names.&lt;br /&gt;
&lt;br /&gt;
https://www.doi.org/doi_handbook/2_Numbering.html				-- 2.2 Syntax of a DOI name&lt;br /&gt;
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2			-- 2.2.2 DOI prefix&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function doi (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local inactive = options.DoiBroken&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
&lt;br /&gt;
	local text;&lt;br /&gt;
	if is_set (inactive) then&lt;br /&gt;
		local inactive_year = inactive:match(&amp;quot;%d%d%d%d&amp;quot;) or '';					-- try to get the year portion from the inactive date&lt;br /&gt;
		local inactive_month, good;&lt;br /&gt;
&lt;br /&gt;
		if is_set (inactive_year) then&lt;br /&gt;
			if 4 &amp;lt; inactive:len() then											-- inactive date has more than just a year (could be anything)&lt;br /&gt;
				local lang_obj = mw.getContentLanguage();						-- get a language object for this wiki&lt;br /&gt;
				good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive);	-- try to get the month name from the inactive date&lt;br /&gt;
				if not good then&lt;br /&gt;
					inactive_month = nil;										-- something went wrong so make sure this is unset&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			inactive_year = nil;												-- |doi-broken-date= has something but it isn't a date&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if is_set (inactive_year) and is_set (inactive_month) then&lt;br /&gt;
			set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '});&lt;br /&gt;
		elseif is_set (inactive_year) then&lt;br /&gt;
			set_message ('maint_doi_inactive_dated', {inactive_year, '', ''});&lt;br /&gt;
		else&lt;br /&gt;
			set_message ('maint_doi_inactive');&lt;br /&gt;
		end&lt;br /&gt;
		inactive = &amp;quot; (&amp;quot; .. cfg.messages['inactive'] .. ' ' .. inactive .. ')';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local registrant = mw.ustring.match (id, '^10%.([^/]+)/[^%s–]-[^%.,]$');	-- registrant set when DOI has the proper basic form&lt;br /&gt;
&lt;br /&gt;
	local registrant_err_patterns = {											-- these patterns are for code ranges that are not supported &lt;br /&gt;
		'^[^1-3]%d%d%d%d%.%d%d*$',												-- 5 digits with subcode (0xxxx, 40000+); accepts: 10000–39999&lt;br /&gt;
		'^[^1-5]%d%d%d%d$',														-- 5 digits without subcode (0xxxx, 60000+); accepts: 10000–59999&lt;br /&gt;
		'^[^1-9]%d%d%d%.%d%d*$',												-- 4 digits with subcode (0xxx); accepts: 1000–9999&lt;br /&gt;
		'^[^1-9]%d%d%d$',														-- 4 digits without subcode (0xxx); accepts: 1000–9999&lt;br /&gt;
		'^%d%d%d%d%d%d+',														-- 6 or more digits&lt;br /&gt;
		'^%d%d?%d?$',															-- less than 4 digits without subcode (3 digits with subcode is legitimate)&lt;br /&gt;
		'^%d%d?%.[%d%.]+',														-- 1 or 2 digits with subcode&lt;br /&gt;
		'^5555$',																-- test registrant will never resolve&lt;br /&gt;
		'[^%d%.]',																-- any character that isn't a digit or a dot&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	if not ignore_invalid then&lt;br /&gt;
		if registrant then														-- when DOI has proper form&lt;br /&gt;
			for i, pattern in ipairs (registrant_err_patterns) do				-- spin through error patterns&lt;br /&gt;
				if registrant:match (pattern) then								-- to validate registrant codes&lt;br /&gt;
					err_flag = set_message ('err_bad_doi');						-- when found, mark this DOI as bad&lt;br /&gt;
					break;														-- and done&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			err_flag = set_message ('err_bad_doi');								-- invalid directory or malformed&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('maint_doi_ignore');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_flag then&lt;br /&gt;
		options.coins_list_t['DOI'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,&lt;br /&gt;
		auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and 'doi' or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored&lt;br /&gt;
		}) .. (inactive or '');&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H D L &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats an HDL with minor error checking.&lt;br /&gt;
&lt;br /&gt;
HDL names contain two parts: prefix and suffix separated by a forward slash.&lt;br /&gt;
	Prefix: character string using any character in the UCS-2 character set except '/'&lt;br /&gt;
	Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant&lt;br /&gt;
&lt;br /&gt;
This function checks a HDL name for: prefix/suffix.  If the HDL name contains spaces, endashes, or, if it ends&lt;br /&gt;
with a period or a comma, this function will emit a bad_hdl error message.&lt;br /&gt;
&lt;br /&gt;
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and&lt;br /&gt;
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely&lt;br /&gt;
if ever used in HDLs.&lt;br /&gt;
&lt;br /&gt;
Query string parameters are named here: https://www.handle.net/proxy_servlet.html.  query strings are not displayed&lt;br /&gt;
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we&lt;br /&gt;
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function hdl (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local query_params = {														-- list of known query parameters from https://www.handle.net/proxy_servlet.html&lt;br /&gt;
		'noredirect',&lt;br /&gt;
		'ignore_aliases',&lt;br /&gt;
		'auth',&lt;br /&gt;
		'cert',&lt;br /&gt;
		'index',&lt;br /&gt;
		'type',&lt;br /&gt;
		'urlappend',&lt;br /&gt;
		'locatt',&lt;br /&gt;
		'action',&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local hdl, suffix, param = id:match ('(.-)(%?(%a+).+)$');					-- look for query string&lt;br /&gt;
	local found;&lt;br /&gt;
&lt;br /&gt;
	if hdl then																	-- when there are query strings, this is the handle identifier portion&lt;br /&gt;
		for _, q in ipairs (query_params) do									-- spin through the list of query parameters&lt;br /&gt;
			if param:match ('^' .. q) then										-- if the query string begins with one of the parameters&lt;br /&gt;
				found = true;													-- announce a find&lt;br /&gt;
				break;															-- and stop looking&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if found then&lt;br /&gt;
		id = hdl;																-- found so replace id with the handle portion; this will be URL-encoded, suffix will not&lt;br /&gt;
	else&lt;br /&gt;
		suffix = '';															-- make sure suffix is empty string for concatenation else&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})&lt;br /&gt;
&lt;br /&gt;
	if nil == id:match(&amp;quot;^[^%s–]-/[^%s–]-[^%.,]$&amp;quot;) then							-- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma&lt;br /&gt;
		set_message ('err_bad_hdl' );&lt;br /&gt;
		options.coins_list_t['HDL'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S B N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether an ISBN string is valid&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function isbn (options)&lt;br /&gt;
	local isbn_str = options.id;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	local function return_result (check, err_type)								-- local function to handle the various returns&lt;br /&gt;
		local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
						prefix = handler.prefix, id = isbn_str, separator = handler.separator});&lt;br /&gt;
		if ignore_invalid then													-- if ignoring ISBN errors&lt;br /&gt;
			set_message ('maint_isbn_ignore');									-- add a maint category even when there is no error&lt;br /&gt;
		else																	-- here when not ignoring&lt;br /&gt;
			if not check then													-- and there is an error&lt;br /&gt;
				options.coins_list_t['ISBN'] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
				set_message ('err_bad_isbn', err_type);							-- set an error message&lt;br /&gt;
				return ISBN;										 			-- return id text&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return ISBN;															-- return id text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if nil ~= isbn_str:match ('[^%s-0-9X]') then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.char);					-- fail if isbn_str contains anything but digits, hyphens, or the uppercase X&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local id = isbn_str:gsub ('[%s-]', '');										-- remove hyphens and whitespace&lt;br /&gt;
&lt;br /&gt;
	local len = id:len();&lt;br /&gt;
 &lt;br /&gt;
	if len ~= 10 and len ~= 13 then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.length);					-- fail if incorrect length&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if len == 10 then&lt;br /&gt;
		if id:match ('^%d*X?$') == nil then										-- fail if isbn_str has 'X' anywhere but last position&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.form);									&lt;br /&gt;
		end&lt;br /&gt;
		if not is_valid_isxn (id, 10) then										-- test isbn-10 for numerical validity&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.check);				-- fail if isbn-10 is not numerically valid&lt;br /&gt;
		end&lt;br /&gt;
		if id:find ('^63[01]') then												-- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.group);				-- fail if isbn-10 begins with 630/1&lt;br /&gt;
		end&lt;br /&gt;
		return return_result (true, cfg.err_msg_supl.check);					-- pass if isbn-10 is numerically valid&lt;br /&gt;
	else&lt;br /&gt;
		if id:match ('^%d+$') == nil then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.char);				-- fail if ISBN-13 is not all digits&lt;br /&gt;
		end&lt;br /&gt;
		if id:match ('^97[89]%d*$') == nil then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.prefix);				-- fail when ISBN-13 does not begin with 978 or 979&lt;br /&gt;
		end&lt;br /&gt;
		if id:match ('^9790') then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.group);				-- group identifier '0' is reserved to ISMN&lt;br /&gt;
		end&lt;br /&gt;
		return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A S I N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a link to Amazon.  Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha&lt;br /&gt;
characters.  If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit&lt;br /&gt;
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.&lt;br /&gt;
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.&lt;br /&gt;
&lt;br /&gt;
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these&lt;br /&gt;
do not cause this function to emit the maint_asin message&lt;br /&gt;
&lt;br /&gt;
This function is positioned here because it calls isbn()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function asin (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local domain = options.ASINTLD;&lt;br /&gt;
	&lt;br /&gt;
	local err_flag;&lt;br /&gt;
&lt;br /&gt;
	if not id:match(&amp;quot;^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$&amp;quot;) then&lt;br /&gt;
		err_flag = set_message ('err_bad_asin');								-- ASIN is not a mix of 10 uppercase alpha and numeric characters&lt;br /&gt;
	else&lt;br /&gt;
		if id:match(&amp;quot;^%d%d%d%d%d%d%d%d%d[%dX]$&amp;quot;) then							-- if 10-digit numeric (or 9 digits with terminal X)&lt;br /&gt;
			if is_valid_isxn (id, 10) then										-- see if ASIN value is or validates as ISBN-10&lt;br /&gt;
				if not id:find ('^63[01]') then									-- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier&lt;br /&gt;
					err_flag = set_message ('err_bad_asin');					-- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn &lt;br /&gt;
				end&lt;br /&gt;
			elseif not is_set (err_flag) then&lt;br /&gt;
				err_flag = set_message ('err_bad_asin');						-- ASIN is not ISBN-10&lt;br /&gt;
			end&lt;br /&gt;
		elseif not id:match(&amp;quot;^%u[%d%u]+$&amp;quot;) then&lt;br /&gt;
			err_flag = set_message ('err_bad_asin');							-- asin doesn't begin with uppercase alpha&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if (not is_set (domain)) or in_array (domain, {'us'}) then					-- default: United States&lt;br /&gt;
		domain = &amp;quot;com&amp;quot;;&lt;br /&gt;
	elseif in_array (domain, {'jp', 'uk'}) then									-- Japan, United Kingdom&lt;br /&gt;
		domain = &amp;quot;co.&amp;quot; .. domain;&lt;br /&gt;
	elseif in_array (domain, {'z.cn'}) then 									-- China&lt;br /&gt;
		domain = &amp;quot;cn&amp;quot;;&lt;br /&gt;
	elseif in_array (domain, {'au', 'br', 'mx', 'sg', 'tr'}) then				-- Australia, Brazil, Mexico, Singapore, Turkey&lt;br /&gt;
		domain = &amp;quot;com.&amp;quot; .. domain;&lt;br /&gt;
	elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'es', 'fr', 'in', 'it', 'nl', 'pl', 'sa', 'se', 'co.jp', 'co.uk', 'com', 'com.au', 'com.br', 'com.mx', 'com.sg', 'com.tr'}) then -- Arabic Emirates, Canada, China, Germany, Spain, France, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don't maintain local ASINs for them)&lt;br /&gt;
		err_flag = set_message ('err_bad_asin_tld');							-- unsupported asin-tld value&lt;br /&gt;
	end&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t['ASIN'] = handler.prefix .. domain .. &amp;quot;/dp/&amp;quot; .. id;	-- asin for coins&lt;br /&gt;
	else&lt;br /&gt;
		options.coins_list_t['ASIN'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix .. domain .. &amp;quot;/dp/&amp;quot;,&lt;br /&gt;
		id = id, encode = handler.encode, separator = handler.separator})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S M N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether an ISMN string is valid.  Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the&lt;br /&gt;
same check digit calculations.  See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf&lt;br /&gt;
section 2, pages 9–12.&lt;br /&gt;
&lt;br /&gt;
ismn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)&lt;br /&gt;
or an identifier registered at info-uri.info (info:)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ismn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local text;&lt;br /&gt;
	local valid_ismn = true;&lt;br /&gt;
	local id_copy;&lt;br /&gt;
&lt;br /&gt;
	id_copy = id;																-- save a copy because this testing is destructive&lt;br /&gt;
	id = id:gsub ('[%s-]', '');													-- remove hyphens and white space&lt;br /&gt;
&lt;br /&gt;
	if 13 ~= id:len() or id:match (&amp;quot;^9790%d*$&amp;quot; ) == nil then					-- ISMN must be 13 digits and begin with 9790&lt;br /&gt;
		valid_ismn = false;&lt;br /&gt;
	else&lt;br /&gt;
		valid_ismn=is_valid_isxn_13 (id);										-- validate ISMN&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--	text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,		-- use this (or external version) when there is some place to link to&lt;br /&gt;
	--		prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
&lt;br /&gt;
	text = table.concat (														-- because no place to link to yet&lt;br /&gt;
		{&lt;br /&gt;
		make_wikilink (link_label_make (handler), handler.label),&lt;br /&gt;
		handler.separator,&lt;br /&gt;
		id_copy&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	if false == valid_ismn then&lt;br /&gt;
		options.coins_list_t['ISMN'] = nil;										-- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS&lt;br /&gt;
		set_message ('err_bad_ismn');											-- create an error message if the ISMN is invalid&lt;br /&gt;
	end &lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S S N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format an ISSN.  This code fixes the case where an editor has included an ISSN in the citation but&lt;br /&gt;
has separated the two groups of four digits with a space.  When that condition occurred, the resulting link looked&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
	|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327]	-- can't have spaces in an external link&lt;br /&gt;
	&lt;br /&gt;
This code now prevents that by inserting a hyphen at the ISSN midpoint.  It also validates the ISSN for length&lt;br /&gt;
and makes sure that the checkdigit agrees with the calculated value.  Incorrect length (8 digits), characters&lt;br /&gt;
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message.  The&lt;br /&gt;
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function issn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
&lt;br /&gt;
	local issn_copy = id;														-- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate&lt;br /&gt;
	local text;&lt;br /&gt;
	local valid_issn = true;&lt;br /&gt;
&lt;br /&gt;
	id = id:gsub ('[%s-]', '');													-- remove hyphens and whitespace&lt;br /&gt;
&lt;br /&gt;
	if 8 ~= id:len() or nil == id:match (&amp;quot;^%d*X?$&amp;quot; ) then						-- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position&lt;br /&gt;
		valid_issn = false;														-- wrong length or improper character&lt;br /&gt;
	else&lt;br /&gt;
		valid_issn = is_valid_isxn (id, 8);										-- validate ISSN&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if true == valid_issn then&lt;br /&gt;
		id = string.sub (id, 1, 4 ) .. &amp;quot;-&amp;quot; .. string.sub (id, 5 );				-- if valid, display correctly formatted version&lt;br /&gt;
	else&lt;br /&gt;
		id = issn_copy;															-- if not valid, show the invalid ISSN with error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
&lt;br /&gt;
	if ignore_invalid then&lt;br /&gt;
		set_message ('maint_issn_ignore');&lt;br /&gt;
	else&lt;br /&gt;
		if false == valid_issn then&lt;br /&gt;
			options.coins_list_t['ISSN'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
			set_message ('err_bad_issn', (options.hkey == 'EISSN') and 'e' or '');	-- create an error message if the ISSN is invalid&lt;br /&gt;
		end &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; J F M &amp;gt;-----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A numerical identifier in the form nn.nnnn.nn&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function jfm (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match ('^[Jj][Ff][Mm](.*)$');									-- identifier with jfm prefix; extract identifier&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message ('maint_jfm_format');&lt;br /&gt;
	else																		-- plain number without JFM prefix&lt;br /&gt;
		id_num = id;															-- if here id does not have prefix&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if id_num and id_num:match('^%d%d%.%d%d%d%d%.%d%d$') then&lt;br /&gt;
		id = id_num;															-- jfm matches pattern&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('err_bad_jfm' );											-- set an error message&lt;br /&gt;
		options.coins_list_t['JFM'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; J S T O R &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format a JSTOR with some error checking&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function jstor (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:find ('[Jj][Ss][Tt][Oo][Rr]') or id:find ('^https?://') or id:find ('%s') then&lt;br /&gt;
		set_message ('err_bad_jstor');											-- set an error message&lt;br /&gt;
		options.coins_list_t['JSTOR'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L C C N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format LCCN link and do simple error checking.  LCCN is a character string 8-12 characters long. The length of&lt;br /&gt;
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.&lt;br /&gt;
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html&lt;br /&gt;
&lt;br /&gt;
length = 8 then all digits&lt;br /&gt;
length = 9 then lccn[1] is lowercase alpha&lt;br /&gt;
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits&lt;br /&gt;
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits&lt;br /&gt;
length = 12 then lccn[1] and lccn[2] are both lowercase alpha&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function lccn (options)&lt;br /&gt;
	local lccn = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;																-- presume that LCCN is valid&lt;br /&gt;
	local id = lccn;															-- local copy of the LCCN&lt;br /&gt;
&lt;br /&gt;
	id = normalize_lccn (id);													-- get canonical form (no whitespace, hyphens, forward slashes)&lt;br /&gt;
	local len = id:len();														-- get the length of the LCCN&lt;br /&gt;
&lt;br /&gt;
	if 8 == len then&lt;br /&gt;
		if id:match(&amp;quot;[^%d]&amp;quot;) then												-- if LCCN has anything but digits (nil if only digits)&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 9 == len then														-- LCCN should be adddddddd&lt;br /&gt;
		if nil == id:match(&amp;quot;%l%d%d%d%d%d%d%d%d&amp;quot;) then							-- does it match our pattern?&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 10 == len then														-- LCCN should be aadddddddd or dddddddddd&lt;br /&gt;
		if id:match(&amp;quot;[^%d]&amp;quot;) then												-- if LCCN has anything but digits (nil if only digits) ...&lt;br /&gt;
			if nil == id:match(&amp;quot;^%l%l%d%d%d%d%d%d%d%d&amp;quot;) then					-- ... see if it matches our pattern&lt;br /&gt;
				err_flag = set_message ('err_bad_lccn');						-- no match, set an error message&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif 11 == len then														-- LCCN should be aaadddddddd or adddddddddd&lt;br /&gt;
		if not (id:match(&amp;quot;^%l%l%l%d%d%d%d%d%d%d%d&amp;quot;) or id:match(&amp;quot;^%l%d%d%d%d%d%d%d%d%d%d&amp;quot;)) then	-- see if it matches one of our patterns&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- no match, set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 12 == len then														-- LCCN should be aadddddddddd&lt;br /&gt;
		if not id:match(&amp;quot;^%l%l%d%d%d%d%d%d%d%d%d%d&amp;quot;) then						-- see if it matches our pattern&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- no match, set an error message&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		err_flag = set_message ('err_bad_lccn');								-- wrong length, set an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) and nil ~= lccn:find ('%s') then&lt;br /&gt;
		err_flag = set_message ('err_bad_lccn');								-- lccn contains a space, set an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t['LCCN'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = lccn, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M R &amp;gt;--------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function mr (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local id_len;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match ('^[Mm][Rr](%d+)$');										-- identifier with mr prefix&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message ('maint_mr_format');										-- add maint cat&lt;br /&gt;
	else																		-- plain number without mr prefix&lt;br /&gt;
		id_num = id:match ('^%d+$');											-- if here id is all digits&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	id_len = id_num and id_num:len() or 0;&lt;br /&gt;
	if (7 &amp;gt;= id_len) and (0 ~= id_len) then&lt;br /&gt;
		id = string.rep ('0', 7-id_len) .. id_num;								-- zero-fill leading digits&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('err_bad_mr');												-- set an error message&lt;br /&gt;
		options.coins_list_t['MR'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O C L C &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format an OCLC ID.  https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}&lt;br /&gt;
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function oclc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local number;&lt;br /&gt;
&lt;br /&gt;
	if id:match('^ocm%d%d%d%d%d%d%d%d$') then									-- ocm prefix and 8 digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match('ocm(%d+)');											-- get the number&lt;br /&gt;
	elseif id:match('^ocn%d%d%d%d%d%d%d%d%d$') then								-- ocn prefix and 9 digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match('ocn(%d+)');											-- get the number&lt;br /&gt;
	elseif id:match('^on%d%d%d%d%d%d%d%d%d%d+$') then							-- on prefix and 10 or more digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match('^on(%d%d%d%d%d%d%d%d%d%d+)$');						-- get the number&lt;br /&gt;
	elseif id:match('^%(OCoLC%)[1-9]%d*$') then									-- (OCoLC) prefix and variable number digits; no leading zeros; 035 field&lt;br /&gt;
		number = id:match('%(OCoLC%)([1-9]%d*)');								-- get the number&lt;br /&gt;
		if 9 &amp;lt; number:len() then&lt;br /&gt;
			number = nil;														-- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers&lt;br /&gt;
		end&lt;br /&gt;
	elseif id:match('^%d+$') then												-- no prefix&lt;br /&gt;
		number = id;															-- get the number&lt;br /&gt;
		if 10 &amp;lt; number:len() then&lt;br /&gt;
			number = nil;														-- constrain to 1 to 10 digits; change this when OCLC issues 11-digit numbers&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if number then																-- proper format&lt;br /&gt;
		id = number;															-- exclude prefix, if any, from external link&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('err_bad_oclc')											-- add an error message if the id is malformed&lt;br /&gt;
		options.coins_list_t['OCLC'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O P E N L I B R A R Y &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats an OpenLibrary link, and checks for associated errors.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function openlibrary (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ident, code = id:gsub('^OL', ''):match(&amp;quot;^(%d+([AMW]))$&amp;quot;);				-- strip optional OL prefix followed immediately by digits followed by 'A', 'M', or 'W';&lt;br /&gt;
	local err_flag;&lt;br /&gt;
	local prefix = {															-- these are appended to the handler.prefix according to code&lt;br /&gt;
		['A']='authors/OL',&lt;br /&gt;
		['M']='books/OL',&lt;br /&gt;
		['W']='works/OL',&lt;br /&gt;
		['X']='OL'																-- not a code; spoof when 'code' in id is invalid&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
	if not ident then&lt;br /&gt;
		code = 'X';																-- no code or id completely invalid&lt;br /&gt;
		ident = id;																-- copy id to ident so that we display the flawed identifier&lt;br /&gt;
		err_flag = set_message ('err_bad_ol');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t['OL'] = handler.prefix .. prefix[code] .. ident;	-- experiment for ol coins&lt;br /&gt;
	else&lt;br /&gt;
		options.coins_list_t['OL'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix .. prefix[code],&lt;br /&gt;
		id = ident, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O S T I &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;&lt;br /&gt;
the value in test_limit will need to be updated periodically as more OSTIs are issued.&lt;br /&gt;
&lt;br /&gt;
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function osti (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if OSTI has anything but digits&lt;br /&gt;
		set_message ('err_bad_osti');											-- set an error message&lt;br /&gt;
		options.coins_list_t['OSTI'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- OSTI is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1018 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then						-- if OSTI is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_osti');										-- set an error message&lt;br /&gt;
			options.coins_list_t['OSTI'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P M C &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format a PMC, do simple error checking, and check for embargoed articles.&lt;br /&gt;
&lt;br /&gt;
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not&lt;br /&gt;
be linked to the article.  If the embargo date is today or in the past, or if it is empty or omitted, then the&lt;br /&gt;
PMC identifier is linked to the article through the link at cfg.id_handlers['PMC'].prefix.&lt;br /&gt;
&lt;br /&gt;
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation&lt;br /&gt;
has |pmc=&amp;lt;value&amp;gt; but does not have a |url= then |title= is linked with the PMC link.  Function is_embargoed ()&lt;br /&gt;
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
PMCs are sequential numbers beginning at 1 and counting up.  This code checks the PMC to see that it contains only digits and is less&lt;br /&gt;
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function pmc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local embargo = options.Embargo;											-- TODO: lowercase?&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match ('^[Pp][Mm][Cc](%d+)$');									-- identifier with PMC prefix&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message ('maint_pmc_format');&lt;br /&gt;
	else																		-- plain number without PMC prefix&lt;br /&gt;
		id_num = id:match ('^%d+$');											-- if here id is all digits&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if PMC is outside test limit boundaries&lt;br /&gt;
			err_flag = set_message ('err_bad_pmc');								-- set an error message&lt;br /&gt;
		else&lt;br /&gt;
			id = tostring (id_num);												-- make sure id is a string&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		err_flag = set_message ('err_bad_pmc');									-- set an error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (embargo) and is_set (is_embargoed (embargo)) then				-- is PMC is still embargoed?&lt;br /&gt;
		text = table.concat (													-- still embargoed so no external link&lt;br /&gt;
			{&lt;br /&gt;
			make_wikilink (link_label_make (handler), handler.label),&lt;br /&gt;
			handler.separator,&lt;br /&gt;
			id,&lt;br /&gt;
			});&lt;br /&gt;
	else&lt;br /&gt;
		text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,	-- no embargo date or embargo has expired, ok to link to article&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,&lt;br /&gt;
			auto_link = not err_flag and 'pmc' or nil							-- do not auto-link when PMC has error&lt;br /&gt;
			});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_flag then&lt;br /&gt;
		options.coins_list_t['PMC'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P M I D &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format PMID and do simple error checking.  PMIDs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable&lt;br /&gt;
test_limit will need to be updated periodically as more PMIDs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function pmid (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if PMID has anything but digits&lt;br /&gt;
		set_message ('err_bad_pmid');											-- set an error message&lt;br /&gt;
		options.coins_list_t['PMID'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- PMID is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if PMID is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_pmid');										-- set an error message&lt;br /&gt;
			options.coins_list_t['PMID'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R F C &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;&lt;br /&gt;
the value in test_limit will need to be updated periodically as more RFCs are issued.&lt;br /&gt;
&lt;br /&gt;
An index of all RFCs is here: https://tools.ietf.org/rfc/&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function rfc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if RFC has anything but digits&lt;br /&gt;
		set_message ('err_bad_rfc');											-- set an error message&lt;br /&gt;
		options.coins_list_t['RFC'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- RFC is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if RFC is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_rfc');										-- set an error message&lt;br /&gt;
			options.coins_list_t['RFC'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S 2 C I D &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an S2CID, do simple error checking&lt;br /&gt;
&lt;br /&gt;
S2CIDs are sequential numbers beginning at 1 and counting up.  This code checks the S2CID to see that it is only&lt;br /&gt;
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically&lt;br /&gt;
as more S2CIDs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function s2cid (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
	&lt;br /&gt;
	id_num = id:match ('^[1-9]%d*$');											-- id must be all digits; must not begin with 0; no open access flag&lt;br /&gt;
&lt;br /&gt;
 	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if handler.id_limit &amp;lt; id_num then										-- if S2CID is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_s2cid');										-- set an error message&lt;br /&gt;
			options.coins_list_t['S2CID'] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		set_message ('err_bad_s2cid');											-- set an error message&lt;br /&gt;
		options.coins_list_t['S2CID'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S B N &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional '0' to make 10 digits&lt;br /&gt;
&lt;br /&gt;
sbn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)&lt;br /&gt;
or an identifier registered at info-uri.info (info:)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sbn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local function return_result (check, err_type)								-- local function to handle the various returns&lt;br /&gt;
		local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
						prefix = handler.prefix, id = id, separator = handler.separator});&lt;br /&gt;
		if not ignore_invalid then												-- if not ignoring SBN errors&lt;br /&gt;
			if not check then&lt;br /&gt;
				options.coins_list_t['SBN'] = nil;								-- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS&lt;br /&gt;
				set_message ('err_bad_sbn', {err_type});						-- display an error message&lt;br /&gt;
				return SBN; &lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			set_message ('maint_isbn_ignore');									-- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)&lt;br /&gt;
		end&lt;br /&gt;
		return SBN;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if id:match ('[^%s-0-9X]') then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.char);					-- fail if SBN contains anything but digits, hyphens, or the uppercase X&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ident = id:gsub ('[%s-]', '');										-- remove hyphens and whitespace; they interfere with the rest of the tests&lt;br /&gt;
&lt;br /&gt;
	if  9 ~= ident:len() then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.length);					-- fail if incorrect length&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ident:match ('^%d*X?$') == nil then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.form);					-- fail if SBN has 'X' anywhere but last position&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return return_result (is_valid_isxn ('0' .. ident, 10), cfg.err_msg_supl.check);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S S R N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an SSRN, do simple error checking&lt;br /&gt;
&lt;br /&gt;
SSRNs are sequential numbers beginning at 100? and counting up.  This code checks the SSRN to see that it is&lt;br /&gt;
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need&lt;br /&gt;
to be updated periodically as more SSRNs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ssrn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
	&lt;br /&gt;
	id_num = id:match ('^%d+$');												-- id must be all digits&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if 100 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then						-- if SSRN is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_ssrn');										-- set an error message&lt;br /&gt;
			options.coins_list_t['SSRN'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		set_message ('err_bad_ssrn');											-- set an error message&lt;br /&gt;
		options.coins_list_t['SSRN'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U S E N E T _ I D &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format a usenet message id.  Simple error checking, looks for 'id-left@id-right' not enclosed in&lt;br /&gt;
'&amp;lt;' and/or '&amp;gt;' angle brackets.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function usenet_id (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
 &lt;br /&gt;
	if not id:match('^.+@.+$') or not id:match('^[^&amp;lt;].*[^&amp;gt;]$') then				-- doesn't have '@' or has one or first or last character is '&amp;lt; or '&amp;gt;'&lt;br /&gt;
		set_message ('err_bad_usenet_id')										-- add an error message if the message id is invalid&lt;br /&gt;
		options.coins_list_t['USENETID'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end &lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Z B L &amp;gt;-----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional&lt;br /&gt;
&lt;br /&gt;
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/&lt;br /&gt;
&lt;br /&gt;
temporary format is apparently eight digits.  Anything else is an error&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function zbl (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match('^%d%d%d%d%d%d%d%d$') then										-- is this identifier using temporary format?&lt;br /&gt;
		set_message ('maint_zbl');												-- yes, add maint cat&lt;br /&gt;
	elseif not id:match('^%d?%d?%d?%d%.%d%d%d%d%d$') then						-- not temporary, is it normal format?&lt;br /&gt;
		set_message ('err_bad_zbl');											-- no, set an error message&lt;br /&gt;
		options.coins_list_t['ZBL'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; I N T E R F A C E   F U N C T I O N S &amp;gt;&amp;gt;==========================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A C T _ I D S &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for&lt;br /&gt;
any of the parameters listed in each cfg.id_handlers['...'].parameters.  If found, adds the parameter and value to&lt;br /&gt;
the identifier list.  Emits redundant error message if more than one alias exists in args&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_ids (args)&lt;br /&gt;
	local id_list = {};															-- list of identifiers found in args&lt;br /&gt;
	for k, v in pairs (cfg.id_handlers) do										-- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers['ISBN'], v is a table&lt;br /&gt;
		v = select_one (args, v.parameters, 'err_redundant_parameters' );		-- v.parameters is a table of aliases for k; here we pick one from args if present&lt;br /&gt;
		if is_set (v) then id_list[k] = v; end									-- if found in args, add identifier to our list&lt;br /&gt;
	end&lt;br /&gt;
	return id_list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A C T _ I D _ A C C E S S _ L E V E L S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access&lt;br /&gt;
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.&lt;br /&gt;
&lt;br /&gt;
returns a table of k/v pairs where k is same as the identifier's key in cfg.id_handlers and v is the assigned (valid) keyword&lt;br /&gt;
&lt;br /&gt;
access-level values must match the case used in cfg.keywords_lists['id-access'] (lowercase unless there is some special reason for something else)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_id_access_levels (args, id_list)&lt;br /&gt;
	local id_accesses_list = {};&lt;br /&gt;
	for k, v in pairs (cfg.id_handlers) do&lt;br /&gt;
		local access_param = v.custom_access;									-- name of identifier's access-level parameter&lt;br /&gt;
		if is_set (access_param) then&lt;br /&gt;
			local access_level = args[access_param];							-- get the assigned value if there is one&lt;br /&gt;
			if is_set (access_level) then&lt;br /&gt;
				if not in_array (access_level, cfg.keywords_lists['id-access']) then	-- exact match required&lt;br /&gt;
					set_message ('err_invalid_param_val', {access_param, access_level});	&lt;br /&gt;
					access_level = nil;											-- invalid so unset&lt;br /&gt;
				end&lt;br /&gt;
				if not is_set (id_list[k]) then									-- identifier access-level must have a matching identifier&lt;br /&gt;
					set_message ('err_param_access_requires_param', {k:lower()});	-- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message&lt;br /&gt;
				end&lt;br /&gt;
				id_accesses_list[k] = cfg.keywords_xlate[access_level];			-- get translated keyword&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return id_accesses_list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B U I L D _ I D _ L I S T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
render the identifiers into a sorted sequence table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID_list_coins_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value&lt;br /&gt;
&amp;lt;options_t&amp;gt; is a table of various k/v option pairs provided in the call to new_build_id_list();&lt;br /&gt;
	modified by	this function and passed to all identifier rendering functions&lt;br /&gt;
&amp;lt;access_levels_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)&lt;br /&gt;
&lt;br /&gt;
returns a sequence table of sorted (by hkey - 'handler' key) rendered identifier strings&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)&lt;br /&gt;
	local ID_list_t = {};&lt;br /&gt;
	local accept;&lt;br /&gt;
	local func_map = {															--function map points to functions associated with hkey identifier&lt;br /&gt;
		['ARXIV'] = arxiv,&lt;br /&gt;
		['ASIN'] = asin,&lt;br /&gt;
		['BIBCODE'] = bibcode,&lt;br /&gt;
		['BIORXIV'] = biorxiv,&lt;br /&gt;
		['CITESEERX'] = citeseerx,&lt;br /&gt;
		['DOI'] = doi,&lt;br /&gt;
		['EISSN'] = issn,&lt;br /&gt;
		['HDL'] = hdl,&lt;br /&gt;
		['ISBN'] = isbn,&lt;br /&gt;
		['ISMN'] = ismn,&lt;br /&gt;
		['ISSN'] = issn,&lt;br /&gt;
		['JFM'] = jfm,&lt;br /&gt;
		['JSTOR'] = jstor,&lt;br /&gt;
		['LCCN'] = lccn,&lt;br /&gt;
		['MR'] = mr,&lt;br /&gt;
		['OCLC'] = oclc,&lt;br /&gt;
		['OL'] = openlibrary,&lt;br /&gt;
		['OSTI'] = osti,&lt;br /&gt;
		['PMC'] = pmc,&lt;br /&gt;
		['PMID'] = pmid,&lt;br /&gt;
		['RFC']  = rfc,&lt;br /&gt;
		['S2CID'] = s2cid,&lt;br /&gt;
		['SBN'] = sbn,&lt;br /&gt;
		['SSRN'] = ssrn,&lt;br /&gt;
		['USENETID'] = usenet_id,&lt;br /&gt;
		['ZBL'] = zbl,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	for hkey, v in pairs (ID_list_coins_t) do&lt;br /&gt;
		v, accept = has_accept_as_written (v);									-- remove accept-as-written markup if present; accept is boolean true when markup removed; false else&lt;br /&gt;
																				-- every function gets the options table with value v and accept boolean&lt;br /&gt;
		options_t.hkey = hkey;													-- ~/Configuration handler key&lt;br /&gt;
		options_t.id = v;														-- add that identifier value to the options table&lt;br /&gt;
		options_t.accept = accept;												-- add the accept boolean flag&lt;br /&gt;
		options_t.access = access_levels_t[hkey];								-- add the access level for those that have an |&amp;lt;identifier-access= parameter&lt;br /&gt;
		options_t.handler = cfg.id_handlers[hkey];&lt;br /&gt;
		options_t.coins_list_t = ID_list_coins_t;								-- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's metadata&lt;br /&gt;
		options_t.coins_list_t[hkey] = v;										-- id value without accept-as-written markup for metadata&lt;br /&gt;
		&lt;br /&gt;
		if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists['id-access']) then&lt;br /&gt;
			error (cfg.messages['unknown_ID_access'] .. options_t.handler.access);	-- here when handler access key set to a value not listed in list of allowed id access keywords&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if func_map[hkey] then&lt;br /&gt;
			local id_text = func_map[hkey] (options_t);							-- call the function to get identifier text and any error message&lt;br /&gt;
			table.insert (ID_list_t, {hkey, id_text});							-- add identifier text to the output sequence table&lt;br /&gt;
		else&lt;br /&gt;
			error (cfg.messages['unknown_ID_key'] .. hkey);						-- here when func_map doesn't have a function for hkey&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function comp (a, b)													-- used by following table.sort()&lt;br /&gt;
		return a[1]:lower() &amp;lt; b[1]:lower();										-- sort by hkey&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.sort (ID_list_t, comp);												-- sequence table of tables sort	&lt;br /&gt;
	for k, v in ipairs (ID_list_t) do											-- convert sequence table of tables to simple sequence table of strings&lt;br /&gt;
		ID_list_t[k] = v[2];													-- v[2] is the identifier rendering from the call to the various functions in func_map{}&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return ID_list_t;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O P T I O N S _ C H E C K &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check that certain option parameters have their associated identifier parameters with values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID_list_coins_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value&lt;br /&gt;
&amp;lt;ID_support_t&amp;gt; is a sequence table of tables created in citation0() where each subtable has four elements:&lt;br /&gt;
	[1] is the support parameter's assigned value; empty string if not set&lt;br /&gt;
	[2] is a text string same as key in cfg.id_handlers&lt;br /&gt;
	[3] is cfg.error_conditions key used to create error message&lt;br /&gt;
	[4] is original ID support parameter name used to create error message&lt;br /&gt;
	&lt;br /&gt;
returns nothing; on error emits an appropriate error message&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function options_check (ID_list_coins_t, ID_support_t)&lt;br /&gt;
	for _, v in ipairs (ID_support_t) do&lt;br /&gt;
		if is_set (v[1]) and not ID_list_coins_t[v[2]] then						-- when support parameter has a value but matching identifier parameter is missing or empty&lt;br /&gt;
			set_message (v[3], (v[4]));											-- emit the appropriate error 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 D E N T I F I E R _ L I S T S _ G E T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the&lt;br /&gt;
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered&lt;br /&gt;
citation.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function identifier_lists_get (args_t, options_t, ID_support_t)&lt;br /&gt;
	local ID_list_coins_t = extract_ids (args_t);										-- get a table of identifiers and their values for use locally and for use in COinS&lt;br /&gt;
	options_check (ID_list_coins_t, ID_support_t);										-- ID support parameters must have matching identifier parameters &lt;br /&gt;
	local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t);		-- get a table of identifier access levels&lt;br /&gt;
	local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t);	-- get a sequence table of rendered identifier strings&lt;br /&gt;
&lt;br /&gt;
	return ID_list_t, ID_list_coins_t;											-- return the tables&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S E L E C T E D _ M O D U L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)&lt;br /&gt;
	cfg = cfg_table_ptr;&lt;br /&gt;
&lt;br /&gt;
	has_accept_as_written = utilities_page_ptr.has_accept_as_written;			-- import functions from select Module:Citation/CS1/Utilities module&lt;br /&gt;
	is_set = utilities_page_ptr.is_set;								&lt;br /&gt;
	in_array = utilities_page_ptr.in_array;&lt;br /&gt;
	set_message = utilities_page_ptr.set_message;&lt;br /&gt;
	select_one = utilities_page_ptr.select_one;&lt;br /&gt;
	substitute = utilities_page_ptr.substitute;&lt;br /&gt;
	make_wikilink = utilities_page_ptr.make_wikilink;&lt;br /&gt;
&lt;br /&gt;
	z = utilities_page_ptr.z;													-- table of tables in Module:Citation/CS1/Utilities&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;
	auto_link_urls = auto_link_urls,											-- table of identifier URLs to be used when auto-linking |title=&lt;br /&gt;
	&lt;br /&gt;
	identifier_lists_get = identifier_lists_get,								-- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels&lt;br /&gt;
	is_embargoed = is_embargoed;&lt;br /&gt;
	set_selected_modules = set_selected_modules;&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Infobox_road/map&amp;diff=5304673</id>
		<title>Module:Infobox road/map</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Infobox_road/map&amp;diff=5304673"/>
		<updated>2023-05-19T10:01:49Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local mapsizes = {[&amp;quot;DEU&amp;quot;] = &amp;quot;200&amp;quot;, [&amp;quot;USA&amp;quot;] = &amp;quot;290x172&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
function p.map(frame)&lt;br /&gt;
    local pframe = frame:getParent()&lt;br /&gt;
    local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself&lt;br /&gt;
    local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template&lt;br /&gt;
    &lt;br /&gt;
    local map_custom = args.map_custom or ''&lt;br /&gt;
    local map = args.map or ''&lt;br /&gt;
    if map_custom == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        return '&amp;lt;span style=&amp;quot;white-space:nowrap;&amp;quot;&amp;gt;' .. map .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
    end&lt;br /&gt;
    if map == '' then&lt;br /&gt;
        return &amp;quot;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    local filecode = &amp;quot;[[File:&amp;quot; .. map .. &amp;quot;|&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    local countrymod = require&amp;quot;Module:Infobox road/meta/mask/country&amp;quot;&lt;br /&gt;
    local countryarg = args.country&lt;br /&gt;
    local state = args.state or args.province&lt;br /&gt;
    local country = ''&lt;br /&gt;
    if countryarg and state then&lt;br /&gt;
        country = countrymod._country(state, countryarg)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local mapsize = mapsizes[country] or '290'&lt;br /&gt;
    local alt = args.map_alt or ''&lt;br /&gt;
    filecode = filecode .. mapsize .. 'px|alt=' .. alt .. ']]'&lt;br /&gt;
    return filecode&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Wd&amp;diff=5304672</id>
		<title>Module:Wd</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Wd&amp;diff=5304672"/>
		<updated>2023-05-19T10:00:36Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Replaced content with &amp;quot;-- Original module located at :en:Module:Wd and :en:Module:Wd/i18n.  local p = {}  -- main function that is supposed to be used by wrapper templates function p.mai...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]].&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- main function that is supposed to be used by wrapper templates&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Coordinates&amp;diff=5304671</id>
		<title>Module:Coordinates</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Coordinates&amp;diff=5304671"/>
		<updated>2023-05-19T09:54:14Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Edit module to remove links to Wikidata&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[&lt;br /&gt;
This module is intended to replace the functionality of {{Coord}} and related&lt;br /&gt;
templates.  It provides several methods, including&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | coord }} : General function formatting and displaying&lt;br /&gt;
coordinate values.&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal&lt;br /&gt;
degree values to DMS format.&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format&lt;br /&gt;
to decimal degree format.&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | link }} : Export the link used to reach the tools&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
require('strict')&lt;br /&gt;
&lt;br /&gt;
local math_mod = require(&amp;quot;Module:Math&amp;quot;)&lt;br /&gt;
local coordinates = {};&lt;br /&gt;
&lt;br /&gt;
local current_page = mw.title.getCurrentTitle()&lt;br /&gt;
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );&lt;br /&gt;
local coord_link = '//geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '&amp;amp;params='&lt;br /&gt;
local templatestyles = 'Module:Coordinates/styles.css'&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, replacement for {{coord/display/title}} ]]&lt;br /&gt;
local function displaytitle(s, notes)&lt;br /&gt;
	local l = &amp;quot;[[Geographic coordinate system|Coordinates]]: &amp;quot; .. s&lt;br /&gt;
	local co = '&amp;lt;span id=&amp;quot;coordinates&amp;quot;&amp;gt;' .. l .. notes .. '&amp;lt;/span&amp;gt;';&lt;br /&gt;
	return '&amp;lt;span style=&amp;quot;font-size: small;&amp;quot;&amp;gt;' .. co .. '&amp;lt;/span&amp;gt;';&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, Replacement for {{coord/display/inline}} ]]&lt;br /&gt;
local function displayinline(s, notes)&lt;br /&gt;
	return s .. notes&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, used in detecting DMS formatting ]]&lt;br /&gt;
local function dmsTest(first, second)&lt;br /&gt;
	if type(first) ~= 'string' or type(second) ~= 'string' then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	local s = (first .. second):upper()&lt;br /&gt;
	return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]&lt;br /&gt;
local function makeInvokeFunc(funcName)&lt;br /&gt;
	return function (frame)&lt;br /&gt;
		local args = require('Module:Arguments').getArgs(frame, {&lt;br /&gt;
			wrappers = 'Template:Coord'&lt;br /&gt;
		})&lt;br /&gt;
		return coordinates[funcName](args, frame)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, handle optional args. ]]&lt;br /&gt;
local function optionalArg(arg, supplement)&lt;br /&gt;
	return arg and arg .. supplement or ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Formats any error messages generated for display&lt;br /&gt;
]]&lt;br /&gt;
local function errorPrinter(errors)&lt;br /&gt;
	local result = &amp;quot;&amp;quot;&lt;br /&gt;
	for i,v in ipairs(errors) do&lt;br /&gt;
		local errorHTML = '&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Coordinates: ' .. v[2] .. '&amp;lt;/strong&amp;gt;'&lt;br /&gt;
		result = result .. errorHTML .. &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Determine the required CSS class to display coordinates&lt;br /&gt;
&lt;br /&gt;
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself&lt;br /&gt;
default is the mode as specificied by the user when calling the {{coord}} template&lt;br /&gt;
mode is the display mode (dec or dms) that we will need to determine the css class for&lt;br /&gt;
]]&lt;br /&gt;
local function displayDefault(default, mode)&lt;br /&gt;
	if default == &amp;quot;&amp;quot; then&lt;br /&gt;
		default = &amp;quot;dec&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if default == mode then&lt;br /&gt;
		return &amp;quot;geo-default&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;geo-nondefault&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
specPrinter&lt;br /&gt;
&lt;br /&gt;
Output formatter.  Takes the structure generated by either parseDec&lt;br /&gt;
or parseDMS and formats it for inclusion on Wikipedia.&lt;br /&gt;
]]&lt;br /&gt;
local function specPrinter(args, coordinateSpec)&lt;br /&gt;
	local uriComponents = coordinateSpec[&amp;quot;param&amp;quot;]&lt;br /&gt;
	if uriComponents == &amp;quot;&amp;quot; then&lt;br /&gt;
		-- RETURN error, should never be empty or nil&lt;br /&gt;
		return &amp;quot;ERROR param was empty&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	if args[&amp;quot;name&amp;quot;] then&lt;br /&gt;
		uriComponents = uriComponents .. &amp;quot;&amp;amp;title=&amp;quot; .. mw.uri.encode(coordinateSpec[&amp;quot;name&amp;quot;])&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local geodmshtml = '&amp;lt;span class=&amp;quot;geo-dms&amp;quot; title=&amp;quot;Maps, aerial photos, and other data for this location&amp;quot;&amp;gt;'&lt;br /&gt;
			.. '&amp;lt;span class=&amp;quot;latitude&amp;quot;&amp;gt;' .. coordinateSpec[&amp;quot;dms-lat&amp;quot;] .. '&amp;lt;/span&amp;gt; '&lt;br /&gt;
			.. '&amp;lt;span class=&amp;quot;longitude&amp;quot;&amp;gt;' ..coordinateSpec[&amp;quot;dms-long&amp;quot;] .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
			.. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	local lat = tonumber( coordinateSpec[&amp;quot;dec-lat&amp;quot;] ) or 0&lt;br /&gt;
	local geodeclat&lt;br /&gt;
	if lat &amp;lt; 0 then&lt;br /&gt;
		-- FIXME this breaks the pre-existing precision&lt;br /&gt;
		geodeclat = tostring(coordinateSpec[&amp;quot;dec-lat&amp;quot;]):sub(2) .. &amp;quot;°S&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		geodeclat = (coordinateSpec[&amp;quot;dec-lat&amp;quot;] or 0) .. &amp;quot;°N&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local long = tonumber( coordinateSpec[&amp;quot;dec-long&amp;quot;] ) or 0&lt;br /&gt;
	local geodeclong&lt;br /&gt;
	if long &amp;lt; 0 then&lt;br /&gt;
		-- FIXME does not handle unicode minus&lt;br /&gt;
		geodeclong = tostring(coordinateSpec[&amp;quot;dec-long&amp;quot;]):sub(2) .. &amp;quot;°W&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		geodeclong = (coordinateSpec[&amp;quot;dec-long&amp;quot;] or 0) .. &amp;quot;°E&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local geodechtml = '&amp;lt;span class=&amp;quot;geo-dec&amp;quot; title=&amp;quot;Maps, aerial photos, and other data for this location&amp;quot;&amp;gt;'&lt;br /&gt;
			.. geodeclat .. ' '&lt;br /&gt;
			.. geodeclong&lt;br /&gt;
			.. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	local geonumhtml = '&amp;lt;span class=&amp;quot;geo&amp;quot;&amp;gt;'&lt;br /&gt;
			.. coordinateSpec[&amp;quot;dec-lat&amp;quot;] .. '; '&lt;br /&gt;
			.. coordinateSpec[&amp;quot;dec-long&amp;quot;]&lt;br /&gt;
			.. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	local inner = '&amp;lt;span class=&amp;quot;' .. displayDefault(coordinateSpec[&amp;quot;default&amp;quot;], &amp;quot;dms&amp;quot; ) .. '&amp;quot;&amp;gt;' .. geodmshtml .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
				.. '&amp;lt;span class=&amp;quot;geo-multi-punct&amp;quot;&amp;gt;&amp;amp;#xfeff; / &amp;amp;#xfeff;&amp;lt;/span&amp;gt;'&lt;br /&gt;
				.. '&amp;lt;span class=&amp;quot;' .. displayDefault(coordinateSpec[&amp;quot;default&amp;quot;], &amp;quot;dec&amp;quot; ) .. '&amp;quot;&amp;gt;';&lt;br /&gt;
&lt;br /&gt;
	if not args[&amp;quot;name&amp;quot;] then&lt;br /&gt;
		inner = inner .. geodechtml&lt;br /&gt;
				.. '&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; / ' .. geonumhtml .. '&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
	else&lt;br /&gt;
		inner = inner .. '&amp;lt;span class=&amp;quot;vcard&amp;quot;&amp;gt;' .. geodechtml&lt;br /&gt;
				.. '&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; / ' .. geonumhtml .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
				.. '&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; (&amp;lt;span class=&amp;quot;fn org&amp;quot;&amp;gt;'&lt;br /&gt;
				.. args[&amp;quot;name&amp;quot;] .. '&amp;lt;/span&amp;gt;)&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = templatestyles} }&lt;br /&gt;
	       .. '&amp;lt;span class=&amp;quot;plainlinks nourlexpansion&amp;quot;&amp;gt;'&lt;br /&gt;
	       .. '[' .. coord_link .. uriComponents .. ' ' .. inner .. ']'&lt;br /&gt;
	       .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, convert decimal to degrees ]]&lt;br /&gt;
local function convert_dec2dms_d(coordinate)&lt;br /&gt;
	local d = math_mod._round( coordinate, 0 ) .. &amp;quot;°&amp;quot;&lt;br /&gt;
	return d .. &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, convert decimal to degrees and minutes ]]&lt;br /&gt;
local function convert_dec2dms_dm(coordinate)&lt;br /&gt;
	coordinate = math_mod._round( coordinate * 60, 0 );&lt;br /&gt;
	local m = coordinate % 60;&lt;br /&gt;
	coordinate = math.floor( (coordinate - m) / 60 );&lt;br /&gt;
	local d = coordinate % 360 ..&amp;quot;°&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	return d .. string.format( &amp;quot;%02d′&amp;quot;, m )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]&lt;br /&gt;
local function convert_dec2dms_dms(coordinate)&lt;br /&gt;
	coordinate = math_mod._round( coordinate * 60 * 60, 0 );&lt;br /&gt;
	local s = coordinate % 60&lt;br /&gt;
	coordinate = math.floor( (coordinate - s) / 60 );&lt;br /&gt;
	local m = coordinate % 60&lt;br /&gt;
	coordinate = math.floor( (coordinate - m) / 60 );&lt;br /&gt;
	local d = coordinate % 360 ..&amp;quot;°&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	return d .. string.format( &amp;quot;%02d′&amp;quot;, m ) .. string.format( &amp;quot;%02d″&amp;quot;, s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function, convert decimal latitude or longitude to&lt;br /&gt;
degrees, minutes, and seconds format based on the specified precision.&lt;br /&gt;
]]&lt;br /&gt;
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)&lt;br /&gt;
	local coord = tonumber(coordinate)&lt;br /&gt;
	local postfix&lt;br /&gt;
	if coord &amp;gt;= 0 then&lt;br /&gt;
		postfix = firstPostfix&lt;br /&gt;
	else&lt;br /&gt;
		postfix = secondPostfix&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	precision = precision:lower();&lt;br /&gt;
	if precision == &amp;quot;dms&amp;quot; then&lt;br /&gt;
		return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;&lt;br /&gt;
	elseif precision == &amp;quot;dm&amp;quot; then&lt;br /&gt;
		return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;&lt;br /&gt;
	elseif precision == &amp;quot;d&amp;quot; then&lt;br /&gt;
		return convert_dec2dms_d( math.abs( coord ) ) .. postfix;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Convert DMS format into a N or E decimal coordinate&lt;br /&gt;
]]&lt;br /&gt;
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)&lt;br /&gt;
	local degrees = tonumber(degrees_str)&lt;br /&gt;
	local minutes = tonumber(minutes_str) or 0&lt;br /&gt;
	local seconds = tonumber(seconds_str) or 0&lt;br /&gt;
&lt;br /&gt;
	local factor = 1&lt;br /&gt;
	if direction == &amp;quot;S&amp;quot; or direction == &amp;quot;W&amp;quot; then&lt;br /&gt;
		factor = -1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local precision = 0&lt;br /&gt;
	if seconds_str then&lt;br /&gt;
		precision = 5 + math.max( math_mod._precision(seconds_str), 0 );&lt;br /&gt;
	elseif minutes_str and minutes_str ~= '' then&lt;br /&gt;
		precision = 3 + math.max( math_mod._precision(minutes_str), 0 );&lt;br /&gt;
	else&lt;br /&gt;
		precision = math.max( math_mod._precision(degrees_str), 0 );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local decimal = factor * (degrees+(minutes+seconds/60)/60)&lt;br /&gt;
	return string.format( &amp;quot;%.&amp;quot; .. precision .. &amp;quot;f&amp;quot;, decimal ) -- not tonumber since this whole thing is string based.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Checks input values to for out of range errors.&lt;br /&gt;
]]&lt;br /&gt;
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )&lt;br /&gt;
	local errors = {};&lt;br /&gt;
	lat_d = tonumber( lat_d ) or 0;&lt;br /&gt;
	lat_m = tonumber( lat_m ) or 0;&lt;br /&gt;
	lat_s = tonumber( lat_s ) or 0;&lt;br /&gt;
	long_d = tonumber( long_d ) or 0;&lt;br /&gt;
	long_m = tonumber( long_m ) or 0;&lt;br /&gt;
	long_s = tonumber( long_s ) or 0;&lt;br /&gt;
&lt;br /&gt;
	if strong then&lt;br /&gt;
		if lat_d &amp;lt; 0 then&lt;br /&gt;
			table.insert(errors, {source, &amp;quot;latitude degrees &amp;lt; 0 with hemisphere flag&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
		if long_d &amp;lt; 0 then&lt;br /&gt;
			table.insert(errors, {source, &amp;quot;longitude degrees &amp;lt; 0 with hemisphere flag&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
		--[[&lt;br /&gt;
		#coordinates is inconsistent about whether this is an error.  If globe: is&lt;br /&gt;
		specified, it won't error on this condition, but otherwise it will.&lt;br /&gt;
&lt;br /&gt;
		For not simply disable this check.&lt;br /&gt;
&lt;br /&gt;
		if long_d &amp;gt; 180 then&lt;br /&gt;
			table.insert(errors, {source, &amp;quot;longitude degrees &amp;gt; 180 with hemisphere flag&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
		]]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if lat_d &amp;gt; 90 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude degrees &amp;gt; 90&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_d &amp;lt; -90 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude degrees &amp;lt; -90&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_m &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude minutes &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_m &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude minutes &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_s &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude seconds &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_s &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude seconds &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_d &amp;gt;= 360 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude degrees &amp;gt;= 360&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_d &amp;lt;= -360 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude degrees &amp;lt;= -360&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_m &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude minutes &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_m &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude minutes &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_s &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude seconds &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_s &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude seconds &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return errors;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
parseDec&lt;br /&gt;
&lt;br /&gt;
Transforms decimal format latitude and longitude into the&lt;br /&gt;
structure to be used in displaying coordinates&lt;br /&gt;
]]&lt;br /&gt;
local function parseDec( lat, long, format )&lt;br /&gt;
	local coordinateSpec = {}&lt;br /&gt;
	local errors = {}&lt;br /&gt;
&lt;br /&gt;
	if not long then&lt;br /&gt;
		return nil, {{&amp;quot;parseDec&amp;quot;, &amp;quot;Missing longitude&amp;quot;}}&lt;br /&gt;
	elseif not tonumber(long) then&lt;br /&gt;
		return nil, {{&amp;quot;parseDec&amp;quot;, &amp;quot;Longitude could not be parsed as a number: &amp;quot; .. long}}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-lat&amp;quot;]  = lat;&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-long&amp;quot;] = long;&lt;br /&gt;
&lt;br /&gt;
	local mode = coordinates.determineMode( lat, long );&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-lat&amp;quot;]  = convert_dec2dms( lat, &amp;quot;N&amp;quot;, &amp;quot;S&amp;quot;, mode)  -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-long&amp;quot;] = convert_dec2dms( long, &amp;quot;E&amp;quot;, &amp;quot;W&amp;quot;, mode)  -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}&lt;br /&gt;
&lt;br /&gt;
	if format then&lt;br /&gt;
		coordinateSpec.default = format&lt;br /&gt;
	else&lt;br /&gt;
		coordinateSpec.default = &amp;quot;dec&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return coordinateSpec, errors&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
parseDMS&lt;br /&gt;
&lt;br /&gt;
Transforms degrees, minutes, seconds format latitude and longitude&lt;br /&gt;
into the a structure to be used in displaying coordinates&lt;br /&gt;
]]&lt;br /&gt;
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )&lt;br /&gt;
	local coordinateSpec, errors, backward = {}, {}&lt;br /&gt;
&lt;br /&gt;
	lat_f = lat_f:upper();&lt;br /&gt;
	long_f = long_f:upper();&lt;br /&gt;
&lt;br /&gt;
	-- Check if specified backward&lt;br /&gt;
	if lat_f == 'E' or lat_f == 'W' then&lt;br /&gt;
		lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );&lt;br /&gt;
	if not long_d then&lt;br /&gt;
		return nil, {{&amp;quot;parseDMS&amp;quot;, &amp;quot;Missing longitude&amp;quot; }}&lt;br /&gt;
	elseif not tonumber(long_d) then&lt;br /&gt;
		return nil, {{&amp;quot;parseDMS&amp;quot;, &amp;quot;Longitude could not be parsed as a number:&amp;quot; .. long_d }}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then&lt;br /&gt;
		if math_mod._precision( lat_d ) &amp;gt; 0 or math_mod._precision( long_d ) &amp;gt; 0 then&lt;br /&gt;
			if lat_f:upper() == 'S' then&lt;br /&gt;
				lat_d = '-' .. lat_d;&lt;br /&gt;
			end&lt;br /&gt;
			if long_f:upper() == 'W' then&lt;br /&gt;
				long_d = '-' .. long_d;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			return parseDec( lat_d, long_d, format );&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-lat&amp;quot;]  = lat_d..&amp;quot;°&amp;quot;..optionalArg(lat_m,&amp;quot;′&amp;quot;) .. optionalArg(lat_s,&amp;quot;″&amp;quot;) .. lat_f&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-long&amp;quot;] = long_d..&amp;quot;°&amp;quot;..optionalArg(long_m,&amp;quot;′&amp;quot;) .. optionalArg(long_s,&amp;quot;″&amp;quot;) .. long_f&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-lat&amp;quot;]  = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-long&amp;quot;] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}&lt;br /&gt;
&lt;br /&gt;
	if format then&lt;br /&gt;
		coordinateSpec.default = format&lt;br /&gt;
	else&lt;br /&gt;
		coordinateSpec.default = &amp;quot;dms&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return coordinateSpec, errors, backward&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Check the input arguments for coord to determine the kind of data being provided&lt;br /&gt;
and then make the necessary processing.&lt;br /&gt;
]]&lt;br /&gt;
local function formatTest(args)&lt;br /&gt;
	local result, errors&lt;br /&gt;
	local backward, primary = false, false&lt;br /&gt;
&lt;br /&gt;
	local function getParam(args, lim)&lt;br /&gt;
		local ret = {}&lt;br /&gt;
		for i = 1, lim do&lt;br /&gt;
			ret[i] = args[i] or ''&lt;br /&gt;
		end&lt;br /&gt;
		return table.concat(ret, '_')&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not args[1] then&lt;br /&gt;
		-- no lat logic&lt;br /&gt;
		return errorPrinter( {{&amp;quot;formatTest&amp;quot;, &amp;quot;Missing latitude&amp;quot;}} )&lt;br /&gt;
	elseif not tonumber(args[1]) then&lt;br /&gt;
		-- bad lat logic&lt;br /&gt;
		return errorPrinter( {{&amp;quot;formatTest&amp;quot;, &amp;quot;Unable to parse latitude as a number:&amp;quot; .. args[1]}} )&lt;br /&gt;
	elseif not args[4] and not args[5] and not args[6] then&lt;br /&gt;
		-- dec logic&lt;br /&gt;
		result, errors = parseDec(args[1], args[2], args.format)&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors);&lt;br /&gt;
		end&lt;br /&gt;
		-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation&lt;br /&gt;
		-- wikiminiatlas doesn't support D;D notation&lt;br /&gt;
		-- #coordinates parserfunction doesn't support negative decimals with NSWE&lt;br /&gt;
		result.param = table.concat({&lt;br /&gt;
			math.abs(tonumber(args[1])),&lt;br /&gt;
			((tonumber(args[1]) or 0) &amp;lt; 0) and 'S' or 'N',&lt;br /&gt;
			math.abs(tonumber(args[2])),&lt;br /&gt;
			((tonumber(args[2]) or 0) &amp;lt; 0) and 'W' or 'E',&lt;br /&gt;
			args[3] or ''}, '_')&lt;br /&gt;
	elseif dmsTest(args[4], args[8]) then&lt;br /&gt;
		-- dms logic&lt;br /&gt;
		result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],&lt;br /&gt;
			args[5], args[6], args[7], args[8], args.format)&lt;br /&gt;
		if args[10] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Extra unexpected parameters'})&lt;br /&gt;
		end&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors)&lt;br /&gt;
		end&lt;br /&gt;
		result.param = getParam(args, 9)&lt;br /&gt;
	elseif dmsTest(args[3], args[6]) then&lt;br /&gt;
		-- dm logic&lt;br /&gt;
		result, errors, backward = parseDMS(args[1], args[2], nil, args[3],&lt;br /&gt;
			args[4], args[5], nil, args[6], args['format'])&lt;br /&gt;
		if args[8] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Extra unexpected parameters'})&lt;br /&gt;
		end&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors)&lt;br /&gt;
		end&lt;br /&gt;
		result.param = getParam(args, 7)&lt;br /&gt;
	elseif dmsTest(args[2], args[4]) then&lt;br /&gt;
		-- d logic&lt;br /&gt;
		result, errors, backward = parseDMS(args[1], nil, nil, args[2],&lt;br /&gt;
			args[3], nil, nil, args[4], args.format)&lt;br /&gt;
		if args[6] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Extra unexpected parameters'})&lt;br /&gt;
		end&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors)&lt;br /&gt;
		end&lt;br /&gt;
		result.param = getParam(args, 5)&lt;br /&gt;
	else&lt;br /&gt;
		-- Error&lt;br /&gt;
		return errorPrinter({{&amp;quot;formatTest&amp;quot;, &amp;quot;Unknown argument format&amp;quot;}}) .. '[[Category:Pages with malformed coordinate tags]]'&lt;br /&gt;
	end&lt;br /&gt;
	result.name = args.name&lt;br /&gt;
&lt;br /&gt;
	local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}&lt;br /&gt;
	for _, v in ipairs(extra_param) do&lt;br /&gt;
		if args[v] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Parameter: &amp;quot;' .. v .. '=&amp;quot; should be &amp;quot;' .. v .. ':&amp;quot;' })&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ret = specPrinter(args, result)&lt;br /&gt;
	if #errors &amp;gt; 0 then&lt;br /&gt;
		ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'&lt;br /&gt;
	end&lt;br /&gt;
	return ret, backward&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
link&lt;br /&gt;
&lt;br /&gt;
Simple function to export the coordinates link for other uses.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | link }}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.link(frame)&lt;br /&gt;
	return coord_link;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
dec2dms&lt;br /&gt;
&lt;br /&gt;
Wrapper to allow templates to call dec2dms directly.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |&lt;br /&gt;
		negative_suffix | precision }}&lt;br /&gt;
&lt;br /&gt;
decimal_coordinate is converted to DMS format.  If positive, the positive_suffix&lt;br /&gt;
is appended (typical N or E), if negative, the negative suffix is appended.  The&lt;br /&gt;
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail&lt;br /&gt;
to use.&lt;br /&gt;
]]&lt;br /&gt;
coordinates.dec2dms = makeInvokeFunc('_dec2dms')&lt;br /&gt;
function coordinates._dec2dms(args)&lt;br /&gt;
	local coordinate = args[1]&lt;br /&gt;
	local firstPostfix = args[2] or ''&lt;br /&gt;
	local secondPostfix = args[3] or ''&lt;br /&gt;
	local precision = args[4] or ''&lt;br /&gt;
&lt;br /&gt;
	return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function to determine whether to use D, DM, or DMS&lt;br /&gt;
format depending on the precision of the decimal input.&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.determineMode( value1, value2 )&lt;br /&gt;
	local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );&lt;br /&gt;
	if precision &amp;lt;= 0 then&lt;br /&gt;
		return 'd'&lt;br /&gt;
	elseif precision &amp;lt;= 2 then&lt;br /&gt;
		return 'dm';&lt;br /&gt;
	else&lt;br /&gt;
		return 'dms';&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
dms2dec&lt;br /&gt;
&lt;br /&gt;
Wrapper to allow templates to call dms2dec directly.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | dms2dec | direction_flag | degrees |&lt;br /&gt;
		minutes | seconds }}&lt;br /&gt;
&lt;br /&gt;
Converts DMS values specified as degrees, minutes, seconds too decimal format.&lt;br /&gt;
direction_flag is one of N, S, E, W, and determines whether the output is&lt;br /&gt;
positive (i.e. N and E) or negative (i.e. S and W).&lt;br /&gt;
]]&lt;br /&gt;
coordinates.dms2dec = makeInvokeFunc('_dms2dec')&lt;br /&gt;
function coordinates._dms2dec(args)&lt;br /&gt;
	local direction = args[1]&lt;br /&gt;
	local degrees = args[2]&lt;br /&gt;
	local minutes = args[3]&lt;br /&gt;
	local seconds = args[4]&lt;br /&gt;
&lt;br /&gt;
	return convert_dms2dec(direction, degrees, minutes, seconds)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
coord&lt;br /&gt;
&lt;br /&gt;
Main entry point for Lua function to replace {{coord}}&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | coord }}&lt;br /&gt;
	{{#invoke:Coordinates | coord | lat | long }}&lt;br /&gt;
	{{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}&lt;br /&gt;
	...&lt;br /&gt;
&lt;br /&gt;
	Refer to {{coord}} documentation page for many additional parameters and&lt;br /&gt;
	configuration options.&lt;br /&gt;
&lt;br /&gt;
Note: This function provides the visual display elements of {{coord}}.  In&lt;br /&gt;
order to load coordinates into the database, the {{#coordinates:}} parser&lt;br /&gt;
function must also be called, this is done automatically in the Lua&lt;br /&gt;
version of {{coord}}.&lt;br /&gt;
]]&lt;br /&gt;
coordinates.coord = makeInvokeFunc('_coord')&lt;br /&gt;
function coordinates._coord(args)&lt;br /&gt;
	if not tonumber(args[1]) and not args[2] then&lt;br /&gt;
		args[3] = args[1]; args[1] = nil&lt;br /&gt;
&lt;br /&gt;
		local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision&lt;br /&gt;
		args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude&lt;br /&gt;
		args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude&lt;br /&gt;
		if precision then&lt;br /&gt;
			precision = -math_mod._round(math.log(precision)/math.log(10),0)&lt;br /&gt;
			args[1] = math_mod._round(args[1],precision)&lt;br /&gt;
			args[2] = math_mod._round(args[2],precision)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local contents, backward = formatTest(args)&lt;br /&gt;
	local Notes = args.notes or ''&lt;br /&gt;
	local Display = args.display and args.display:lower() or 'inline'&lt;br /&gt;
&lt;br /&gt;
	local function isInline(s)&lt;br /&gt;
		-- Finds whether coordinates are displayed inline.&lt;br /&gt;
		return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'&lt;br /&gt;
	end&lt;br /&gt;
	local function isInTitle(s)&lt;br /&gt;
		-- Finds whether coordinates are displayed in the title.&lt;br /&gt;
		return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function coord_wrapper(in_args)&lt;br /&gt;
		-- Calls the parser function {{#coordinates:}}.&lt;br /&gt;
		return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local text = ''&lt;br /&gt;
	if isInline(Display) then&lt;br /&gt;
		text = text .. displayinline(contents, Notes)&lt;br /&gt;
	end&lt;br /&gt;
	if isInTitle(Display) then&lt;br /&gt;
		text = text&lt;br /&gt;
			.. displaytitle(contents, Notes)&lt;br /&gt;
	end&lt;br /&gt;
	if not args.nosave then&lt;br /&gt;
		local page_title, count = mw.title.getCurrentTitle(), 1&lt;br /&gt;
		if backward then&lt;br /&gt;
			local tmp = {}&lt;br /&gt;
			while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end&lt;br /&gt;
			tmp.count = count; count = 2*(count-1)&lt;br /&gt;
			while count &amp;gt;= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end&lt;br /&gt;
			for i, v in ipairs(tmp) do args[i] = v end&lt;br /&gt;
		else&lt;br /&gt;
			while count &amp;lt;= 9 do args[count] = (args[count] or ''); count = count+1 end&lt;br /&gt;
		end&lt;br /&gt;
		if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end&lt;br /&gt;
		args.notes, args.format, args.display = nil&lt;br /&gt;
		text = text .. coord_wrapper(args)&lt;br /&gt;
	end&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
coord2text&lt;br /&gt;
&lt;br /&gt;
Extracts a single value from a transclusion of {{Coord}}.&lt;br /&gt;
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
    {{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}&lt;br /&gt;
&lt;br /&gt;
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.coord2text(frame)&lt;br /&gt;
	if frame.args[1] == '' or frame.args[2] == '' or not frame.args[2] then return nil end&lt;br /&gt;
	frame.args[2] = mw.text.trim(frame.args[2])&lt;br /&gt;
	if frame.args[2] == 'lat' or frame.args[2] == 'long' then&lt;br /&gt;
		local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')&lt;br /&gt;
		if frame.args[2] == 'lat' then&lt;br /&gt;
			result, negative = result[1], 'S'&lt;br /&gt;
		else&lt;br /&gt;
			result, negative = result[2], 'W'&lt;br /&gt;
		end&lt;br /&gt;
		result = mw.text.split(result, '°')&lt;br /&gt;
		if result[2] == negative then result[1] = '-'..result[1] end&lt;br /&gt;
		return result[1]&lt;br /&gt;
	else&lt;br /&gt;
		return mw.ustring.match(frame.args[1], 'params=.-_'..frame.args[2]..':(.-)[ _]')&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
coordinsert&lt;br /&gt;
&lt;br /&gt;
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.&lt;br /&gt;
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
    {{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}&lt;br /&gt;
&lt;br /&gt;
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.coordinsert(frame)&lt;br /&gt;
	for i, v in ipairs(frame.args) do&lt;br /&gt;
		if i ~= 1 then&lt;br /&gt;
			if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then&lt;br /&gt;
				frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if frame.args.name then&lt;br /&gt;
		if not mw.ustring.find(frame.args[1], '&amp;lt;span class=&amp;quot;vcard&amp;quot;&amp;gt;') then&lt;br /&gt;
			local namestr = frame.args.name&lt;br /&gt;
			frame.args[1] = mw.ustring.gsub(frame.args[1],&lt;br /&gt;
				'(&amp;lt;span class=&amp;quot;geo%-default&amp;quot;&amp;gt;)(&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;/span&amp;gt;&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;)(&amp;lt;/span&amp;gt;)',&lt;br /&gt;
				'%1&amp;lt;span class=&amp;quot;vcard&amp;quot;&amp;gt;%2&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; (&amp;lt;span class=&amp;quot;fn org&amp;quot;&amp;gt;' .. namestr .. '&amp;lt;/span&amp;gt;)&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;%3')&lt;br /&gt;
			frame.args[1] = mw.ustring.gsub(frame.args[1], '(&amp;amp;params=[^&amp;amp;&amp;quot;&amp;lt;&amp;gt;%[%] ]*) ', '%1&amp;amp;title=' .. mw.uri.encode(namestr) .. ' ')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return frame.args[1]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return coordinates&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar/candidate&amp;diff=5304670</id>
		<title>Template:Taxonbar/candidate</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar/candidate&amp;diff=5304670"/>
		<updated>2023-05-19T09:51:50Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Wikidata disabled}}&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar&amp;diff=5304669</id>
		<title>Template:Taxonbar</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:Taxonbar&amp;diff=5304669"/>
		<updated>2023-05-19T09:50:50Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Wikidata disabled}}&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:Authority_control&amp;diff=5304668</id>
		<title>Template:Authority control</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:Authority_control&amp;diff=5304668"/>
		<updated>2023-05-19T09:48:28Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Wikidata disabled}}&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Netherlands&amp;diff=5304666</id>
		<title>Netherlands</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Netherlands&amp;diff=5304666"/>
		<updated>2023-05-11T12:20:54Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox country&lt;br /&gt;
| conventional_long_name = Netherlands&amp;lt;!--Do not change to Kingdom of the Netherlands; it has its own article.--&amp;gt;&lt;br /&gt;
| native_name            = {{native name|nl|Nederland}}&amp;lt;!--Do not change to Kingdom of the Netherlands; it has its own article.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| image_flag             = Flag of the Netherlands.svg&lt;br /&gt;
| image_coat             = State coat of arms of the Netherlands.svg&lt;br /&gt;
| coa_size               = 110&lt;br /&gt;
| national_motto         = {{native name|fr|&amp;quot;[[Je maintiendrai]]&amp;quot;|nolink=on}} &amp;lt;br&amp;gt;&amp;quot;I will maintain&amp;quot;&lt;br /&gt;
| national_anthem        = {{native name|nl|&amp;quot;[[Wilhelmus|Wilhelmus van Nassouwe]]&amp;quot;|nolink=on}} &amp;lt;br&amp;gt;&amp;quot;William of Nassau&amp;quot;{{brk|2}}{{center|[[File:United States Navy Band - Het Wilhelmus.ogg|Het Wilhelmus]]}}&lt;br /&gt;
| image_map              = EU-Netherlands.svg&lt;br /&gt;
| map_caption            = {{map caption |countryprefix=the European part of the |location_color=dark green |region=[[Europe]] | region_color=dark grey |subregion=the [[European Union]] | subregion_color=green}}&lt;br /&gt;
| image_map2             = BES islands location map.svg&lt;br /&gt;
| map_caption2           = {{map caption |countryprefix=the |country=[[Caribbean Netherlands|Caribbean municipalities]] |location_color=green}}&lt;br /&gt;
| image_map3             = Netherlands-CIA WFB Map-10-10-10.png&lt;br /&gt;
| capital                = [[Amsterdam]]{{efn|name=central_cities|Amsterdam is the constitutional capital, while the government and the royal family are seated in The Hague.}}&lt;br /&gt;
| largest_city           = capital&lt;br /&gt;
| coordinates            = {{coord|52|22|N|4|53|E|type:city}}&lt;br /&gt;
| admin_center           = [[The Hague]]{{efn|name=central_cities}}&lt;br /&gt;
| admin_center_type      = Government seat&lt;br /&gt;
| official_languages     = [[Dutch language|Dutch]]&lt;br /&gt;
| languages_type         = Co-official languages&lt;br /&gt;
| languages              = {{unbulleted list|[[English language|English]]|[[Papiamentu]]|[[West Frisian language|West Frisian]]}} &lt;br /&gt;
| languages2_type        = {{nobold|Recognized regional languages}}&lt;br /&gt;
| languages2             = {{unbulleted list|[[French language|French]]|[[Dutch Low Saxon]]|[[Limburgish language|Limburgish]]|[[German language|German]]|[[Sinte Romani]]|[[Yiddish]]}}&lt;br /&gt;
| ethnic_groups          = {{plainlist|class=nowrap|&lt;br /&gt;
* 77.39% [[Dutch people|Dutch]]&lt;br /&gt;
* 9.88% Other Europeans&lt;br /&gt;
* 2.34% [[Turks in the Netherlands|Turks]]&lt;br /&gt;
* 2.29% [[Dutch-Moroccans|Moroccans]]&lt;br /&gt;
* {{allow wrap|2.13% [[Moluccans]] and other [[Indonesians]]}}&lt;br /&gt;
* 2.05% [[Surinamese people in the Netherlands|Surinamese]]&lt;br /&gt;
* 0.90% [[Dutch Caribbean]]&lt;br /&gt;
* 0.23% Other [[Americas|Americans]]&lt;br /&gt;
* 2.80% [[Demography of the Netherlands|Other]]}}&lt;br /&gt;
| ethnic_groups_year     = 2017&lt;br /&gt;
| ethnic_groups_ref      = &amp;lt;ref&amp;gt;[http://statline.cbs.nl/StatWeb/publication/?DM=SLNL&amp;amp;PA=37325&amp;amp;D1=0&amp;amp;D2=0&amp;amp;D3=0&amp;amp;D4=0&amp;amp;D5=a&amp;amp;D6=l&amp;amp;VW=T Official CBS website containing all Dutch demographic statistics]. Cbs.nl. Retrieved on 4 July 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| religion               = {{ublist |item_style=white-space:nowrap;&lt;br /&gt;
  |50.1% [[Irreligion|No religion]]&lt;br /&gt;
  |43.8% [[Christianity]]&lt;br /&gt;
  |—23.7% [[Catholic Church in the Netherlands|Catholicism]]&lt;br /&gt;
  |—18.1% [[Protestantism]]&lt;br /&gt;
  |—2.0% Other [[List of Christian denominations|Christian]]&lt;br /&gt;
  |4.9% [[Islam in the Netherlands|Islam]]&lt;br /&gt;
  |1.2% [[Religion in the Netherlands|Others]]&lt;br /&gt;
  }}&lt;br /&gt;
| religion_year          = 2016&lt;br /&gt;
| religion_ref           = &amp;lt;ref name=&amp;quot;cbs2016&amp;quot;&amp;gt;{{Cite web|url=https://www.cbs.nl/nl-nl/nieuws/2016/51/helft-nederlanders-is-kerkelijk-of-religieus|title=Helft Nederlanders is kerkelijk of religieus|last=CBS|website=www.cbs.nl|language=nl-NL|access-date=17 October 2017}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| demonym                = Dutch&lt;br /&gt;
| membership             = [[Kingdom of the Netherlands]]&lt;br /&gt;
| membership_type        = Sovereign state&lt;br /&gt;
| government_type        = [[Unitary state|Unitary]] [[Parliamentary system|parliamentary]] [[constitutional monarchy]]&lt;br /&gt;
| leader_title1          = [[List of monarchs of the Netherlands|Monarch]]&lt;br /&gt;
| leader_title2          = [[Prime Minister of the Netherlands|Prime Minister]]&lt;br /&gt;
| leader_title3          = [[Deputy Prime Minister of the Netherlands|Deputy Prime Ministers]]&lt;br /&gt;
| leader_title4          = [[Vice-President of the Council of State (Netherlands)|Vice President of the Council of State]]&lt;br /&gt;
| leader_name1           = [[Willem-Alexander of the Netherlands|Willem-Alexander]]&lt;br /&gt;
| leader_name2           = [[Mark Rutte]]&lt;br /&gt;
| leader_name3           = {{ubl|[[Hugo de Jonge]]|[[Kajsa Ollongren]]|[[Carola Schouten]]}}&lt;br /&gt;
| leader_name4           = [[Thom de Graaf]]&lt;br /&gt;
| legislature            = [[States General of the Netherlands|States General]]&lt;br /&gt;
| upper_house            = [[Senate (Netherlands)|Senate]]&lt;br /&gt;
| lower_house            = [[House of Representatives (Netherlands)|House&amp;amp;nbsp;of&amp;amp;nbsp;Representatives]]&lt;br /&gt;
| sovereignty_type       = Independence {{nobold|from [[Habsburg Spain]]}}&lt;br /&gt;
| established_event1     = [[Act of Abjuration|Proclaimed]]&lt;br /&gt;
| established_event2     = [[Peace of Münster|Recognised]]&lt;br /&gt;
| established_event3     = Kingdom established&lt;br /&gt;
| established_event4     = [[Liberation Day (Netherlands)|Liberation Day]]&lt;br /&gt;
| established_event5     = [[United Nations Charter|UN admission]]&lt;br /&gt;
| established_event6     = [[Charter for the Kingdom of the Netherlands|Charter]]&lt;br /&gt;
| established_event7     = [[Caribbean Netherlands|Caribbean incorporation]]&lt;br /&gt;
| established_date1      = 26 July 1581&lt;br /&gt;
| established_date2      = 30 January 1648&lt;br /&gt;
| established_date3      = 16 March 1815&lt;br /&gt;
| established_date4      = 5 May 1945&lt;br /&gt;
| established_date5      = 10 December 1945&lt;br /&gt;
| established_date6      = 15 December 1954&lt;br /&gt;
| established_date7      = 10 October 2010&lt;br /&gt;
| area_km2               = 41865&amp;lt;ref name=&amp;quot;auto2&amp;quot;&amp;gt;{{Cite web|url=http://www.waarstaatjeprovincie.nl/Paginas/Ruimtelijke%20ordening/Oppervlakte.aspx|title=Oppervlakte}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;auto2-additional&amp;quot;&amp;gt;{{Cite web|url=http://onderwerpen/caribische-deel-van-het-koninkrijk/vraag-en-antwoord/waaruit-bestaat-het-koninkrijk-der-nederlanden|title=Waaruit bestaat het Koninkrijk der Nederlanden? – Rijksoverheid.nl|first=Ministerie van Algemene|last=Zaken|date=19 May 2015|website=onderwerpen}}{{Dead link|date=January 2021 |bot=InternetArchiveBot |fix-attempted=yes }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| area_rank              = 131st&lt;br /&gt;
| area_sq_mi             = &lt;br /&gt;
| percent_water          = 10.32 (as of 2015)&amp;lt;ref&amp;gt;{{cite web|title=Surface water and surface water change|access-date=2020-10-11|publisher=[[Organisation for Economic Co-operation and Development]] (OECD)|url=https://stats.oecd.org/Index.aspx?DataSetCode=SURFACE_WATER#}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| population_estimate    = 17,418,808 {{increase}}&amp;lt;ref name=&amp;quot;auto&amp;quot;&amp;gt;{{Cite web|url=https://opendata.cbs.nl/statline/#/CBS/nl/dataset/37230ned/table|title=CBS Statline|website=opendata.cbs.nl}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| population_estimate_year = 2020&lt;br /&gt;
| population_estimate_rank = 68th&lt;br /&gt;
| population_density_km2 = 521&lt;br /&gt;
| population_density_rank = 16th&lt;br /&gt;
| population_density_sq_mi = &lt;br /&gt;
| GDP_PPP                = $1.004 trillion&amp;lt;ref name=imf2&amp;gt;{{cite web|url = https://www.imf.org/external/pubs/ft/weo/2019/01/weodata/weorept.aspx?pr.x=90&amp;amp;pr.y=17&amp;amp;sy=2019&amp;amp;ey=2019&amp;amp;scsm=1&amp;amp;ssd=1&amp;amp;sort=country&amp;amp;ds=.&amp;amp;br=1&amp;amp;c=138&amp;amp;s=NGDPD%2CPPPGDP%2CNGDPDPC%2CPPPPC&amp;amp;grp=0&amp;amp;a=|title = Netherlands|date = April 2019|publisher = International Monetary Fund }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| GDP_PPP_year           = 2019&lt;br /&gt;
| GDP_PPP_rank           = 28th&lt;br /&gt;
| GDP_PPP_per_capita     = $58,255&amp;lt;ref name=imf2/&amp;gt;&lt;br /&gt;
| GDP_PPP_per_capita_rank = 13th&lt;br /&gt;
| GDP_nominal            = $914 billion&amp;lt;ref name=imf2/&amp;gt;&lt;br /&gt;
| GDP_nominal_year       = 2019&lt;br /&gt;
| GDP_nominal_rank       = 17th&lt;br /&gt;
| GDP_nominal_per_capita = $53,016&amp;lt;ref name=imf2/&amp;gt;&lt;br /&gt;
| GDP_nominal_per_capita_rank = 13th&lt;br /&gt;
| Gini                   = 26.6&amp;lt;!--number only--&amp;gt;&lt;br /&gt;
| Gini_year              = 2019&lt;br /&gt;
| Gini_change            = decrease&lt;br /&gt;
| Gini_ref               = &amp;lt;ref name=eurogini&amp;gt;{{cite web |url=https://ec.europa.eu/eurostat/tgm/table.do?tab=table&amp;amp;init=1&amp;amp;language=en&amp;amp;pcode=tessi190&amp;amp;plugin=1 |title=Gini coefficient of equivalised disposable income – EU-SILC survey |publisher=[[Eurostat]] |website=ec.europa.eu/eurostat |access-date=9 July 2020}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| Gini_rank              = 15th&lt;br /&gt;
| HDI                    = 0.933&amp;lt;!--number only--&amp;gt;&lt;br /&gt;
| HDI_year               = 2018&amp;lt;!-- Please use the year to which the data refers, not the publication year--&amp;gt;&lt;br /&gt;
| HDI_change             = increase&lt;br /&gt;
| HDI_ref                = &amp;lt;ref name=&amp;quot;UNHDR&amp;quot;&amp;gt;{{cite web|url=http://hdr.undp.org/en/content/2019-human-development-index-ranking|title=Human Development Report 2019|language=en|publisher=[[United Nations Development Programme]]|date=10 December 2019|accessdate=10 December 2019|format=PDF|archive-date=23 May 2020|archive-url=https://web.archive.org/web/20200523103905/http://hdr.undp.org/en/content/2019-human-development-index-ranking|url-status=dead}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| HDI_rank               = 10th&lt;br /&gt;
| currency               = {{unbulleted list|[[Euro]] (€, EUR)|[[United States dollar|US dollar]] ($, USD){{efn|The euro is used in the European part of the Netherlands and replaced the [[Dutch guilder]] in 2002. The United States dollar is used in the [[Caribbean Netherlands]] and replaced the [[Netherlands Antillean guilder]] in 2011.&amp;lt;ref&amp;gt;{{cite web |url = http://wetten.overheid.nl/BWBR0028551 |title=Wet geldstelsel BES |publisher=Dutch government |date=30 September 2010 |accessdate=11 January 2014 }}&amp;lt;/ref&amp;gt;}}}}&lt;br /&gt;
| time_zone              = {{ubl|[[UTC]]+1 ([[Central European Time|CET]])|[[UTC]]−4 ([[Atlantic Standard Time|AST]]){{efn|CET and CEST are used in the European Netherlands, and AST is used in the Caribbean Netherlands.}}}}&lt;br /&gt;
| utc_offset             = &lt;br /&gt;
| utc_offset_DST         = &lt;br /&gt;
| time_zone_DST          = {{ubl|[[UTC]]+2 ([[Central European Summer Time|CEST]])|[[UTC]]−4 ([[Atlantic Standard Time|AST]])}}&lt;br /&gt;
| DST_note               = {{smaller|Note: Even though the European Netherlands are located within the [[UTC±00:00|UTC±0]] longitudes, the country adopted &lt;br /&gt;
 [[UTC+1]] ([[Central European Time]]) as its standard time under [[German occupation of the Netherlands|German occupation]] on 2 November 1942, with a +0:40:28 offset (+1:40:28 during [[daylight saving time|DST]]) from Amsterdam’s [[Local Mean Time|LMT]] (UTC+0:19:32).&amp;lt;ref&amp;gt;{{cite web |title=Time Zone &amp;amp; Clock Changes in Amsterdam, Netherlands |url=https://www.timeanddate.com/time/zone/netherlands/amsterdam |website=www.timeanddate.com |accessdate=24 March 2020 |language=en}}&amp;lt;/ref&amp;gt;}}&lt;br /&gt;
| date_format            = dd-mm-yyyy&lt;br /&gt;
| electricity            = [[Mains electricity by country|230 V–50 Hz]]&lt;br /&gt;
| drives_on              = right&lt;br /&gt;
| calling_code           = [[Telephone numbers in the Netherlands|+31]], [[Telephone numbers in Curaçao and the Caribbean Netherlands|+599]]{{efn|+599 was the country code designated for the now dissolved [[Netherlands Antilles]]. The Caribbean Netherlands still use +599&amp;amp;nbsp;7 (for Bonaire), +599&amp;amp;nbsp;3 (for Sint Eustatius), and +599&amp;amp;nbsp;4 (for Saba).}}&lt;br /&gt;
| iso3166code            = NL&lt;br /&gt;
| cctld                  = [[.nl]], [[.bq]]{{efn|.nl is the common internet top level domain name for the Netherlands. The [[.eu]] domain is also used, as it is shared with other [[European Union]] member states. .bq is designated, but not in use, for the [[Caribbean Netherlands]].}}&lt;br /&gt;
| today                  = &lt;br /&gt;
}}&lt;br /&gt;
[[File:Netherlands-CIA WFB Map-10-10-10.png|thumb|350px|Map of the Netherlands]]&lt;br /&gt;
The '''Netherlands''' is a [[country]] that is part (of a [[constituent country]]) of the [[Kingdom of the Netherlands]]. Most of it is in [[Western Europe]], but there are also some parts in the [[Caribbean]]. More than 17 million people live there. To the north and west of the [[Europe]]an part of the Netherlands is the [[North Sea]], and to the east is [[Germany]] and to the south is [[Belgium]]. The Netherlands is one of the countries that started the [[European Union]]. People who live in the Netherlands are called &amp;quot;[[Dutch (people)|Dutch]]&amp;quot;. The language of the Netherlands is also called [[Dutch language|Dutch]]. The official capital of the Netherlands is Amsterdam. However, the government is in The Hague.&lt;br /&gt;
&lt;br /&gt;
== Name ==&lt;br /&gt;
&amp;quot;The Netherlands&amp;quot; means &amp;quot;the low lands&amp;quot;. The land only rises, on average, 1&amp;amp;nbsp;meter above sea level. One third of the land is below sea level. The Netherlands is also - incorrectly - referred to as [[Holland]]. Holland was a very rich area (two provinces) in the western part of the Netherlands, thus causing people to be mistaken. Some people who do not live in the western part of the Netherlands do not like it when people call the country Holland. The name &amp;quot;Holland&amp;quot; originates from the old Dutch words &amp;quot;Holt land&amp;quot; which means &amp;quot;wood lands&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
At the end of the [[Middle Ages]] the [[duke]]s of [[Burgundy]], a country that is now part of [[France]], united seventeen areas. Those areas were called the Netherlands. When the daughter of a duke married [[Maximilian I, Holy Roman Emperor]] in 1477, the Netherlands became part of [[Spain]]. In the 16th century many Dutch people became [[Protestant]]. The king of Spain did not like it, he wanted all Dutch to be [[Roman Catholic]]. Of course the Dutch people did not like this, and after violent excesses by the Spanish they started a war against Spain in 1568, also for reasons of taxation. The war lasted until 1648, therefore it is called the [[Eighty Years' War]]. An important leader of the Dutch in this war was Willem van Oranje (Willem of orange) also called [[William the Silent]].&lt;br /&gt;
&lt;br /&gt;
In 1648 the Netherlands and Spain signed [[Peace of Münster|peace]]. The Dutch people were allowed to keep all the areas they conquered. The part of the Netherlands that was not conquered by the Dutch stayed part of Spain. Later this part became the country [[Belgium]].&lt;br /&gt;
&lt;br /&gt;
When the Netherlands became independent, it was a very special country. That time almost all countries in [[Europe]] were ruled by a king, but the Netherlands was a [[republic]]. The Netherlands was made up of seven [[province]]s, that were ruled by the big cities. The cities were ruled by the municipality which consisted of rich civilians. Together those provinces were ruled by a [[stadtholder]], a very powerful man, but compared to the kings of other European countries he had much less power.&lt;br /&gt;
&lt;br /&gt;
In the [[17th century]] the Netherlands was the richest and one of the most powerful countries in the world. Therefore, the Dutch call the 17th century the [[Golden Age]]. Their [[Dutch Empire]] had [[colony|colonies]] around the world. One important colony was the [[East Indies]], which is now called [[Indonesia]]. They also had colonies in the [[Caribbean]], like the other European empires. They also started [[New Netherland]], which is now called [[New York City|New York]]. The Netherlands often fought wars against other European countries, especially the [[Anglo-Dutch Wars]] against [[England]]. [[Michiel de Ruyter]], a Dutch [[admiral]], became a Dutch hero when he defeated the English navy close to London.&lt;br /&gt;
&lt;br /&gt;
In the 18th century the Netherlands became poorer. Many people blamed this on the government leaders, the stadtholders. Many thought they had too much power and wanted them to get away. In 1789 the French people [[French Revolution|deposed]] (got rid of) their king. French armies attacked other countries to depose their leaders too. In 1795 they attacked the Netherlands. Stadtholder [[Stadtholder William V of the Netherlands|William V]] had to flee to England. The Netherlands were renamed to [[Batavian Republic]] and became a [[democracy]]. But the French were not content (satisfied) with the Dutch ruler, so in 1806 the French [[emperor]] [[Napoleon]] made his brother [[Louis Bonaparte]] king of the Netherlands. Louis became popular in the Netherlands, but the emperor was again not content with him, so in 1810 the Netherlands became a part of France.&lt;br /&gt;
&lt;br /&gt;
In 1815 Napoleon was defeated, and the Netherlands became independent again. The rulers of European countries thought it was a good idea to make the Netherlands stronger, to make them able to resist another French invasion. Therefore, [[Belgium]] and [[Luxembourg]] were added to the Netherlands. [[King William I of the Netherlands|William I]], the son of stadtholder William V, became king. Some Belgians disliked their Dutch king. In 1830 they revolted. William sent an army. He was much more powerful than the Belgians but after ten days the French sent an army to support them. In 1831 the Belgians chose their own king and Belgium became an independent country.&lt;br /&gt;
&lt;br /&gt;
[[Liberalism|Some people]] again thought the Dutch king had too much power. They wanted to give him less power and vote for the government themselves. In 1848 there were violent revolts against the kings of many European countries. The Dutch king was afraid the same would happen in the Netherlands. Therefore, he allowed [[Johan Rudolf Thorbecke]] to write a [[constitution]]. From then on people were allowed to vote. At first only rich men were allowed to vote. From 1919 on [[universal suffrage|all adults were allowed to vote]].&lt;br /&gt;
&lt;br /&gt;
In [[World War I]], the Netherlands did not fight and were not invaded. The Dutch wanted to stay [[Neutrality (international relations)|neutral]] in [[World War II]] as well, but in 1940 the country was invaded and occupied by [[Germany]]. Like in other countries they had occupied, the German authorities started to kill [[Jews]]. [[Anne Frank]] was a Jewish girl who lived in the Netherlands. Her family hid from the Nazis and she wrote a [[diary]]. She died in a Nazi [[concentration camp]] and her diary became famous.&lt;br /&gt;
&lt;br /&gt;
In 1944 the [[United States|American]], [[Canada|Canadian]], [[Poland|Polish]] and British armies liberated the south of the Netherlands from Nazi Occupation. They wanted to cross the [[Rhine]] river in [[Operation Market Garden]] to liberate the rest of the country, but they were defeated. It took until May 1945 before the entire country was liberated. During the five years of Nazi occupation, 250,000 people had died in the Netherlands.&lt;br /&gt;
&lt;br /&gt;
Shortly after the war, [[Indonesia]] declared its independence. The Dutch sent soldiers to fight in Indonesia. After other countries, including the [[United States]], told the Dutch to leave Indonesia, they finally did so in 1949.&lt;br /&gt;
&lt;br /&gt;
After the war the Netherlands became one of the richest countries in the world. In 2004 the [[United Nations]] said that the Netherlands was the 5th best country to live in.&lt;br /&gt;
&lt;br /&gt;
== Politics ==&lt;br /&gt;
The Netherlands is a [[constitutional monarchy]]. That means the country has a king, but the real power is in the hands of a [[parliament]], chosen by the Dutch people. All Dutch people at least 18 years old or older are allowed to vote. The Dutch parliament consists of two chambers: the [[Second Chamber (Netherlands)|Second Chamber]] (Dutch: ''Tweede Kamer'', this is the House of Representatives, elected every four years), and the [[First Chamber (Netherlands)|First Chamber]] (Dutch: ''Eerste Kamer'', this is the Senate, elected by provincial politicians every four years). After the Second Chamber elections, parties that have had a majority of the votes create a [[cabinet]]. The cabinet consists of a [[prime minister]] and several other ministers and deputy ministers. Current government is the liberal-Christian democratic [[Third Rutte cabinet]], consisting of [[VVD]], [[CDA]], [[D66]] and [[CU]] politicians. Prime Minister is [[Mark Rutte]] (VVD).&lt;br /&gt;
&lt;br /&gt;
The latest general elections were held on [[2021 Dutch general election|March 17, 2021]]. Winners were liberal parties like [[VVD]] (also the biggest party), [[D66]] (second biggest party) and [[Volt Netherlands|Volt]], and populist parties like [[FVD]] and [[JA21]]. Losers were left parties like [[SP]] and [[GL]], Christian democratic party [[CDA]], populist party [[PVV]], and senior citizen party [[50+]].&lt;br /&gt;
&lt;br /&gt;
The Netherlands is known for [[Toleration|tolerance]] in politics. The Netherlands is the only country where [[soft drugs]] are not entirely considered illegal. Furthermore, the Netherlands is one of the few countries that allow [[same-sex marriage]]s, [[euthanasia]] and [[prostitution]] to a certain extent.&lt;br /&gt;
&lt;br /&gt;
More information: ''[[Politics of the Netherlands]]''.&lt;br /&gt;
&lt;br /&gt;
== Subdivisions ==&lt;br /&gt;
The Netherlands is subdivided in provinces and municipalities.&lt;br /&gt;
&lt;br /&gt;
=== Provinces ===&lt;br /&gt;
{{main|Provinces of the Netherlands}}&lt;br /&gt;
[[File:Map provinces Netherlands-en.svg|thumb|350px|Provinces of the Netherlands]]&lt;br /&gt;
In the Netherlands there are 12 provinces:&lt;br /&gt;
{| style=&amp;quot;background:none;&amp;quot; cellspacing=&amp;quot;2px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{| class=&amp;quot;sortable wikitable&amp;quot; style=&amp;quot;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:40px;&amp;quot; class=&amp;quot;unsortable&amp;quot;| [[Flag]]&lt;br /&gt;
! style=&amp;quot;width:140px;&amp;quot;| [[Province]]&lt;br /&gt;
! style=&amp;quot;width:80px;&amp;quot;| [[Capital (political)|Capital]]&lt;br /&gt;
! style=&amp;quot;width:80px;&amp;quot;| Largest city&lt;br /&gt;
! style=&amp;quot;width:60px;&amp;quot;| [[Area]] (km&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
!&amp;lt;ref name=&amp;quot;ProvArea&amp;quot;&amp;gt;{{cite web|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&amp;amp;DM=SLNL&amp;amp;PA=70072ned&amp;amp;D1=224&amp;amp;D2=5-16&amp;amp;D3=l&amp;amp;HD=081103-1603&amp;amp;HDR=T&amp;amp;STB=G1,G2|language=Dutch|publisher=[[Statistics Netherlands]]|year=2007|accessdate=2007-10-13|title=Regionale Kerncijfers Nederland}}&amp;lt;/ref&amp;gt; width=&amp;quot;70px&amp;quot;| [[Population]]&amp;lt;ref&amp;gt;{{cite web|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&amp;amp;DM=SLNL&amp;amp;PA=03759ned&amp;amp;D1=0&amp;amp;D2=802-813&amp;amp;D3=0&amp;amp;D4=l&amp;amp;HD=081103-1603|language=Dutch|publisher=[[Statistics Netherlands]]|year=2007|accessdate=2007-10-13|title=Bevolking per regio naar leeftijd, geslacht en burgerlijke staat}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
! style=&amp;quot;width:80px;&amp;quot;|Density&amp;lt;br /&amp;gt;(per km&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag Drenthe.svg|27px]] || [[Drenthe]] || [[Assen]] ||&amp;lt;!-- Please DO NOT change the largest city of Drenthe to Emmen. What is intended here is the city proper; not the municipality. Assen city proper is larger than Emmen city proper although Emmen municipality is larger. --&amp;gt; [[Assen]] || style=&amp;quot;text-align:right&amp;quot;|2,641|| style=&amp;quot;text-align:right&amp;quot;|486,197|| style=&amp;quot;text-align:right&amp;quot;|184&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flevolandflag.svg|27px]] || [[Flevoland]] || [[Lelystad]] || [[Almere]] || style=&amp;quot;text-align:right&amp;quot;|1,417|| style=&amp;quot;text-align:right&amp;quot;|374,424|| style=&amp;quot;text-align:right&amp;quot;|264&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Frisian flag.svg|27px]] || [[Friesland]] || [[Leeuwarden]] || [[Leeuwarden]] || style=&amp;quot;text-align:right&amp;quot;|3,341|| style=&amp;quot;text-align:right&amp;quot;|642,209|| style=&amp;quot;text-align:right&amp;quot;|192&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag of Gelderland.svg|27px]] || [[Gelderland]] || [[Arnhem]] || [[Nijmegen]] || style=&amp;quot;text-align:right&amp;quot;|4,971|| style=&amp;quot;text-align:right&amp;quot;|1,979,059|| style=&amp;quot;text-align:right&amp;quot;|398&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag Groningen.svg|27px]] || [[Groningen (province)|Groningen]] || [[Groningen (city)|Groningen]] || [[Groningen (city)|Groningen]] || style=&amp;quot;text-align:right&amp;quot;|2,333|| style=&amp;quot;text-align:right&amp;quot;|573,614|| style=&amp;quot;text-align:right&amp;quot;|246&lt;br /&gt;
|-&lt;br /&gt;
| [[File:NL-LimburgVlag.svg|27px]] || [[Limburg (Netherlands)|Limburg]] || [[Maastricht]] || [[Maastricht]] || style=&amp;quot;text-align:right&amp;quot;|2,150|| style=&amp;quot;text-align:right&amp;quot;|1,127,805|| style=&amp;quot;text-align:right&amp;quot;|525&lt;br /&gt;
|-&lt;br /&gt;
| [[File:North Brabant-Flag.svg|27px]] || [[North Brabant]]&amp;lt;br/ &amp;gt;''(Noord-Brabant)'' || [['s-Hertogenbosch|Den Bosch]]&amp;lt;!-- spelled this way for table-aesthetic reasons--&amp;gt; || [[Eindhoven]] || style=&amp;quot;text-align:right&amp;quot;|4,916|| style=&amp;quot;text-align:right&amp;quot;|2,419,042|| style=&amp;quot;text-align:right&amp;quot;|492&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag North-Holland, Netherlands.svg|27px]] || [[North Holland]]&amp;lt;br/ &amp;gt;''(Noord-Holland)'' || [[Haarlem]] || [[Amsterdam]] || style=&amp;quot;text-align:right&amp;quot;|2,671|| style=&amp;quot;text-align:right&amp;quot;|2,613,070|| style=&amp;quot;text-align:right&amp;quot;|978&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag Overijssel.svg|27px]] || [[Overijssel]] || [[Zwolle, Netherlands|Zwolle]] || [[Enschede]] || style=&amp;quot;text-align:right&amp;quot;|3,325|| style=&amp;quot;text-align:right&amp;quot;|1,116,374|| style=&amp;quot;text-align:right&amp;quot;|336&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Utrecht (province)-Flag.svg|27px]] || [[Utrecht (province)|Utrecht]] || [[Utrecht (city)|Utrecht]] || [[Utrecht (city)|Utrecht]] || style=&amp;quot;text-align:right&amp;quot;|1,385|| style=&amp;quot;text-align:right&amp;quot;|1,190,604|| style=&amp;quot;text-align:right&amp;quot;|860&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag of Zeeland.svg|27px]] || [[Zeeland|Zealand]]&amp;lt;br/ &amp;gt;''(Zeeland)'' || [[Middelburg, Netherlands|Middelburg]] || [[Middelburg, Netherlands|Middelburg]] || style=&amp;quot;text-align:right&amp;quot;|1,787|| style=&amp;quot;text-align:right&amp;quot;|380,497|| style=&amp;quot;text-align:right&amp;quot;|213&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Flag Zuid-Holland.svg|27px]] || [[South Holland]]&amp;lt;br/ &amp;gt;''(Zuid Holland)'' || [[The Hague]]&amp;lt;br /&amp;gt;''(Den Haag)'' || [[Rotterdam]] || style=&amp;quot;text-align:right&amp;quot;|2,814|| style=&amp;quot;text-align:right&amp;quot;|3,455,097|| style=&amp;quot;text-align:right&amp;quot;|1228&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These provinces are all located in the part of the Netherlands that is in Europe. The country also includes three special [[municipality|municipalities]] in the Caribbean: [[Bonaire]], [[Saba]] and [[Sint Eustatius]]. They are not part of any province, but together are known as the [[Caribbean Netherlands]]. The Netherlands (both the European part and the Caribbean Netherlands), together with [[Aruba]], [[Curaçao]] and [[Sint Maarten]], also in the Caribbean, form a [[sovereign state]] called the [[Kingdom of the Netherlands]].&lt;br /&gt;
&lt;br /&gt;
When the Kingdom was formed in 1954, the territories in the Caribbean became part of the [[Netherlands Antilles]]. At that time it also included [[Suriname]] in [[South America]], which became an [[independence|independent]] country in 1975. Aruba left the Antilles in 1986, and Curaçao and Sint Maarten did the same in 2010. The rest of the islands then became the Caribbean Netherlands which is part of the Netherlands proper.&lt;br /&gt;
&lt;br /&gt;
=== Municipalities ===&lt;br /&gt;
{{Main|List of municipalities of the Netherlands}}&lt;br /&gt;
&lt;br /&gt;
The Netherlands has 352 municipalities (2021) and also three special municipalities in the so-called [[Caribbean Netherlands]].&lt;br /&gt;
&lt;br /&gt;
Almost every year the amount of municipalities decrease.&lt;br /&gt;
&lt;br /&gt;
=== Cities ===&lt;br /&gt;
Cities aren't actually a subdivision of the Netherlands. Cities are also municipalities or they make part of municipalities.&lt;br /&gt;
&lt;br /&gt;
This is a list of the cities with over 100,000 people.&lt;br /&gt;
[[File:Amsterdam airphoto.jpg|thumb|[[Amsterdam]]]]&lt;br /&gt;
[[File:RotterdamMaasNederland.jpg|thumb|[[Rotterdam]]]]&lt;br /&gt;
[[File:Skyline Den Haag.JPG|thumb|[[The Hague]]]]&lt;br /&gt;
[[File:Domuitzicht8.jpg|thumb|[[Utrecht (city)|Utrecht]]]]&lt;br /&gt;
[[File:Hoogbouw Eindhoven.jpg|thumb|[[Eindhoven]]]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Rank&lt;br /&gt;
!City&lt;br /&gt;
!Population&lt;br /&gt;
!Province&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|1||[[Amsterdam]]||780,000||{{flag|North Holland}}||&amp;lt;small&amp;gt;''excl. [[Driemond]] and [[Landelijk Noord]]''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2||[[Rotterdam]]||611,000||{{flag|South Holland}}||&lt;br /&gt;
|-&lt;br /&gt;
|3||[[The Hague]]||500,000||{{flag|South Holland}}||&amp;lt;small&amp;gt;''[[Dutch language|Dutch]] name: Den Haag''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||[[Utrecht (city)|Utrecht]]||312,634 ||{{flag|Utrecht}}&lt;br /&gt;
|-&lt;br /&gt;
|5||[[Eindhoven]]||213,809||{{flag|North Brabant}}&lt;br /&gt;
|-&lt;br /&gt;
|6||[[Tilburg]]||203,492||{{flag|North Brabant}}&lt;br /&gt;
|-&lt;br /&gt;
|7||[[Almere]]||193,303||{{flag|Flevoland}}&lt;br /&gt;
|-&lt;br /&gt;
|8||[[Groningen (city)|Groningen]]||187,298||{{flag|Groningen}}||&amp;lt;small&amp;gt;''excl. Engelbert, Hoogkerk, Middelbert and Noorderhoogebrug''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|9||[[Breda]]||173,299||{{flag|North Brabant}}&lt;br /&gt;
|-&lt;br /&gt;
|10||[[Nijmegen]]||164,165||{{flag|Gelderland}}||&amp;lt;small&amp;gt;''excl. Lent and Oosterhout''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|11||[[Apeldoorn]]||155,726||{{flag|Gelderland}}||&amp;lt;small&amp;gt;''excl. Beekbergen, Hoenderloo, Hoog Soeren, Klarenbeek, Lieren, Loenen, Uddel and Ugchelen''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|12||[[Enschede]]||154,017||{{flag|Overijssel}}||&lt;br /&gt;
|-&lt;br /&gt;
|13||[[Haarlem]]||151,853||{{flag|North Holland}}||&amp;lt;small&amp;gt;''excl.Bloemendaal, Hillegom, Heemstede, Velsen, Overveen''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|14||[[Arnhem]]||147,018||{{flag|Gelderland}}||&amp;lt;small&amp;gt;''excl. Schaarsbergen''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|15||[[Amersfoort]]||126,750||{{flag|Utrecht}}||&amp;lt;small&amp;gt;''excl. Hoogland and Hooglanderveen''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|16||[[Dordrecht]]||118,540||{{flag|South Holland}}&lt;br /&gt;
|-&lt;br /&gt;
|17||[[Zoetermeer]]||118,020||{{flag|South Holland}}&lt;br /&gt;
|-&lt;br /&gt;
|18||[[Zwolle, Netherlands|Zwolle]]||118,000||{{flag|Overijssel}}||&amp;lt;small&amp;gt;''excl. Brinkhoek, Haerst, Herfte, Langenholte, Wijthmen and Windesheim''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|19||[[Leiden]]||117,480||{{flag|South Holland}}&lt;br /&gt;
|-&lt;br /&gt;
|20||[[Maastricht]]||116,200||{{flagcountry|Limburg (Netherlands)}}||&amp;lt;small&amp;gt;''excl. Borgharen and Itteren''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|21||[[Ede]]||107,476||{{flag|Gelderland}}||&amp;lt;small&amp;gt;''CBS (1 January, 2007)''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|22||[['s-Hertogenbosch]]||102,220||{{flag|North Brabant}}||&amp;lt;small&amp;gt;''excl. Bokhoven, Empel, Engelen, Kruisstraat, Maliskamp and Rosmalen''&amp;lt;/small&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|23||[[Venlo]]||100,271||{{flagcountry|Limburg (Netherlands)}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Geography ==&lt;br /&gt;
In fact a large part of the Netherlands was created by the sand that came from the many [[river]]s flowing through it. Notable Dutch rivers are the [[Rhine]], the [[Maas]], the [[IJssel]] and the [[Scelt]]. A large part of the Netherlands is below [[sea level]]. This is because the Dutch have made many lakes and parts of the sea dry, creating polders. Therefore, there is a [[saying]] &amp;quot;God created the earth, but the Dutch created the Netherlands.&amp;quot; This makes the Netherlands very flat. In the very south-east of the Netherlands, in [[Limburg (Netherlands)|Limburg]], there are some hills. Therefore, this region is a tourist-attraction for many Dutch people. The highest point in the European portion of the Netherlands, the [[Vaalserberg]], is 323&amp;amp;nbsp;metres above sea level. The highest point in both the Netherlands proper and the Kingdom of the Netherlands is [[Mount Scenery]], on the Caribbean island of [[Saba]], at 887&amp;amp;nbsp;metres.&lt;br /&gt;
&lt;br /&gt;
The Netherlands is a small flat country; about 300&amp;amp;nbsp;kilometers from north to south, and about 170&amp;amp;nbsp;kilometers from east to west. It has an [[oceanic climate]] (''Cfb'' in the [[Köppen climate classification]]).&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
{{main|Dutch people}}&lt;br /&gt;
[[File:Keetmolen in Ede.jpg|thumb|upright|[[Windmill]] in Netherlands]]&lt;br /&gt;
The Netherlands is a small country, but many people live there. It is one of the most [[population density|densely populated]] countries of the world.&lt;br /&gt;
&lt;br /&gt;
Most people in the Netherlands speak [[Dutch language|Dutch]]. In [[Friesland]], about 200,000 people speak [[Frisian language|Frisian]]. Frisian is the language with the most similarities to English. Some Dutch people speak [[dialect]]s. The Saxon dialects spoken in the northeastern part of the Netherlands are somewhat similar to [[Low German]].&lt;br /&gt;
&lt;br /&gt;
According to a survey done in 2006, 25% of the Dutch people are [[Christian]] and 3% believe in another organised religion, like Judaism, Islam or Hinduism. Twenty-six percent are 'unbounded spiritual' (have their own beliefs and are not tied to a religion). The other 44% are not religious.&lt;br /&gt;
&lt;br /&gt;
==Trains==&lt;br /&gt;
[[Nederlandse Spoorwegen]] ({{lang-en|Dutch Railways}}) or '''NS''' is the main passenger railway operator in the Netherlands. The rail [[infrastructure]] is maintained by network manager [[ProRail]], which was split from NS in 2003. Freight services, formerly operated by '''NS Cargo''', merged with the [[DB Schenker]] group in 2000.&lt;br /&gt;
&lt;br /&gt;
NS runs 4,800 scheduled trains daily. In addition, NS provides international rail services from the Netherlands to other European destinations and carries out concessions on a number of foreign rail markets through its subsidiary [[Abellio (transport company)|Abellio]] such as [[Abellio Greater Anglia]], [[Merseyrail]] and [[ScotRail]].&lt;br /&gt;
&lt;br /&gt;
[[Arriva]] is another passenger railway operator in the Netherlands. It is a [[wikt:subsidiary|subsidiary]] of the German company [[Deutsche Bahn]]. Their local headquarters is based at [[Heerenveen]]. They have been active since 1998.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* [[List of rivers of the Netherlands]]&lt;br /&gt;
* [[Netherlands at the Olympics]]&lt;br /&gt;
* [[Netherlands national football team]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
'''Notes'''&lt;br /&gt;
{{Reflist|group=lower-alpha}}&lt;br /&gt;
&lt;br /&gt;
{{Europe}}&lt;br /&gt;
{{European Union}}&lt;br /&gt;
{{North Atlantic Treaty Organisation (NATO)}}&lt;br /&gt;
{{Commons}}&lt;br /&gt;
{{Wikivoyage}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Netherlands| ]]&lt;br /&gt;
[[Category:European Union member states]]&lt;br /&gt;
[[Category:Benelux]]&lt;br /&gt;
[[Category:Current monarchies]]&lt;br /&gt;
[[Category:Dutch-speaking countries]]&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Infobox_road/map&amp;diff=5304665</id>
		<title>Module:Infobox road/map</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Infobox_road/map&amp;diff=5304665"/>
		<updated>2023-05-05T13:39:33Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local mapsizes = {[&amp;quot;DEU&amp;quot;] = &amp;quot;200&amp;quot;, [&amp;quot;USA&amp;quot;] = &amp;quot;290x172&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
function p.map(frame)&lt;br /&gt;
    local pframe = frame:getParent()&lt;br /&gt;
    local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself&lt;br /&gt;
    local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template&lt;br /&gt;
    &lt;br /&gt;
    local map_custom = args.map_custom or ''&lt;br /&gt;
    local map = args.map or ''&lt;br /&gt;
    if map_custom == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        return '&amp;lt;span style=&amp;quot;white-space:nowrap;&amp;quot;&amp;gt;' .. map .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
    end&lt;br /&gt;
    if map == '' then&lt;br /&gt;
    	local currentEntityId = mw.ext.UnlinkedWikibase.getEntityId('enwiki')&lt;br /&gt;
    	if currentEntityId then&lt;br /&gt;
        	local entity = mw.wikibase.getEntity(currentEntityId) or {}&lt;br /&gt;
        else&lt;br /&gt;
        	local entity = {}&lt;br /&gt;
        end&lt;br /&gt;
        local claims = entity.claims or {}&lt;br /&gt;
        local mapProp = claims.p15&lt;br /&gt;
        if not mapProp then -- no claim of that property&lt;br /&gt;
            return &amp;quot;&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        map = mapProp[0].mainsnak.datavalue.value -- This should eventually iterate over all possible values?&lt;br /&gt;
    end&lt;br /&gt;
    local filecode = &amp;quot;[[File:&amp;quot; .. map .. &amp;quot;|&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    local countrymod = require&amp;quot;Module:Infobox road/meta/mask/country&amp;quot;&lt;br /&gt;
    local countryarg = args.country&lt;br /&gt;
    local state = args.state or args.province&lt;br /&gt;
    local country = ''&lt;br /&gt;
    if countryarg and state then&lt;br /&gt;
        country = countrymod._country(state, countryarg)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local mapsize = mapsizes[country] or '290'&lt;br /&gt;
    local alt = args.map_alt or ''&lt;br /&gt;
    filecode = filecode .. mapsize .. 'px|alt=' .. alt .. ']]'&lt;br /&gt;
    return filecode&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Coordinates&amp;diff=5304664</id>
		<title>Module:Coordinates</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Coordinates&amp;diff=5304664"/>
		<updated>2023-05-05T13:37:28Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[&lt;br /&gt;
This module is intended to replace the functionality of {{Coord}} and related&lt;br /&gt;
templates.  It provides several methods, including&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | coord }} : General function formatting and displaying&lt;br /&gt;
coordinate values.&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal&lt;br /&gt;
degree values to DMS format.&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format&lt;br /&gt;
to decimal degree format.&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Coordinates | link }} : Export the link used to reach the tools&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
require('strict')&lt;br /&gt;
&lt;br /&gt;
local math_mod = require(&amp;quot;Module:Math&amp;quot;)&lt;br /&gt;
local coordinates = {};&lt;br /&gt;
&lt;br /&gt;
local current_page = mw.title.getCurrentTitle()&lt;br /&gt;
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );&lt;br /&gt;
local coord_link = '//geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '&amp;amp;params='&lt;br /&gt;
local templatestyles = 'Module:Coordinates/styles.css'&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, replacement for {{coord/display/title}} ]]&lt;br /&gt;
local function displaytitle(s, notes)&lt;br /&gt;
	local l = &amp;quot;[[Geographic coordinate system|Coordinates]]: &amp;quot; .. s&lt;br /&gt;
	local co = '&amp;lt;span id=&amp;quot;coordinates&amp;quot;&amp;gt;' .. l .. notes .. '&amp;lt;/span&amp;gt;';&lt;br /&gt;
	return '&amp;lt;span style=&amp;quot;font-size: small;&amp;quot;&amp;gt;' .. co .. '&amp;lt;/span&amp;gt;';&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, Replacement for {{coord/display/inline}} ]]&lt;br /&gt;
local function displayinline(s, notes)&lt;br /&gt;
	return s .. notes&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, used in detecting DMS formatting ]]&lt;br /&gt;
local function dmsTest(first, second)&lt;br /&gt;
	if type(first) ~= 'string' or type(second) ~= 'string' then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	local s = (first .. second):upper()&lt;br /&gt;
	return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]&lt;br /&gt;
local function makeInvokeFunc(funcName)&lt;br /&gt;
	return function (frame)&lt;br /&gt;
		local args = require('Module:Arguments').getArgs(frame, {&lt;br /&gt;
			wrappers = 'Template:Coord'&lt;br /&gt;
		})&lt;br /&gt;
		return coordinates[funcName](args, frame)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, handle optional args. ]]&lt;br /&gt;
local function optionalArg(arg, supplement)&lt;br /&gt;
	return arg and arg .. supplement or ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Formats any error messages generated for display&lt;br /&gt;
]]&lt;br /&gt;
local function errorPrinter(errors)&lt;br /&gt;
	local result = &amp;quot;&amp;quot;&lt;br /&gt;
	for i,v in ipairs(errors) do&lt;br /&gt;
		local errorHTML = '&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Coordinates: ' .. v[2] .. '&amp;lt;/strong&amp;gt;'&lt;br /&gt;
		result = result .. errorHTML .. &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Determine the required CSS class to display coordinates&lt;br /&gt;
&lt;br /&gt;
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself&lt;br /&gt;
default is the mode as specificied by the user when calling the {{coord}} template&lt;br /&gt;
mode is the display mode (dec or dms) that we will need to determine the css class for&lt;br /&gt;
]]&lt;br /&gt;
local function displayDefault(default, mode)&lt;br /&gt;
	if default == &amp;quot;&amp;quot; then&lt;br /&gt;
		default = &amp;quot;dec&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if default == mode then&lt;br /&gt;
		return &amp;quot;geo-default&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;geo-nondefault&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
specPrinter&lt;br /&gt;
&lt;br /&gt;
Output formatter.  Takes the structure generated by either parseDec&lt;br /&gt;
or parseDMS and formats it for inclusion on Wikipedia.&lt;br /&gt;
]]&lt;br /&gt;
local function specPrinter(args, coordinateSpec)&lt;br /&gt;
	local uriComponents = coordinateSpec[&amp;quot;param&amp;quot;]&lt;br /&gt;
	if uriComponents == &amp;quot;&amp;quot; then&lt;br /&gt;
		-- RETURN error, should never be empty or nil&lt;br /&gt;
		return &amp;quot;ERROR param was empty&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	if args[&amp;quot;name&amp;quot;] then&lt;br /&gt;
		uriComponents = uriComponents .. &amp;quot;&amp;amp;title=&amp;quot; .. mw.uri.encode(coordinateSpec[&amp;quot;name&amp;quot;])&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local geodmshtml = '&amp;lt;span class=&amp;quot;geo-dms&amp;quot; title=&amp;quot;Maps, aerial photos, and other data for this location&amp;quot;&amp;gt;'&lt;br /&gt;
			.. '&amp;lt;span class=&amp;quot;latitude&amp;quot;&amp;gt;' .. coordinateSpec[&amp;quot;dms-lat&amp;quot;] .. '&amp;lt;/span&amp;gt; '&lt;br /&gt;
			.. '&amp;lt;span class=&amp;quot;longitude&amp;quot;&amp;gt;' ..coordinateSpec[&amp;quot;dms-long&amp;quot;] .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
			.. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	local lat = tonumber( coordinateSpec[&amp;quot;dec-lat&amp;quot;] ) or 0&lt;br /&gt;
	local geodeclat&lt;br /&gt;
	if lat &amp;lt; 0 then&lt;br /&gt;
		-- FIXME this breaks the pre-existing precision&lt;br /&gt;
		geodeclat = tostring(coordinateSpec[&amp;quot;dec-lat&amp;quot;]):sub(2) .. &amp;quot;°S&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		geodeclat = (coordinateSpec[&amp;quot;dec-lat&amp;quot;] or 0) .. &amp;quot;°N&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local long = tonumber( coordinateSpec[&amp;quot;dec-long&amp;quot;] ) or 0&lt;br /&gt;
	local geodeclong&lt;br /&gt;
	if long &amp;lt; 0 then&lt;br /&gt;
		-- FIXME does not handle unicode minus&lt;br /&gt;
		geodeclong = tostring(coordinateSpec[&amp;quot;dec-long&amp;quot;]):sub(2) .. &amp;quot;°W&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		geodeclong = (coordinateSpec[&amp;quot;dec-long&amp;quot;] or 0) .. &amp;quot;°E&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local geodechtml = '&amp;lt;span class=&amp;quot;geo-dec&amp;quot; title=&amp;quot;Maps, aerial photos, and other data for this location&amp;quot;&amp;gt;'&lt;br /&gt;
			.. geodeclat .. ' '&lt;br /&gt;
			.. geodeclong&lt;br /&gt;
			.. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	local geonumhtml = '&amp;lt;span class=&amp;quot;geo&amp;quot;&amp;gt;'&lt;br /&gt;
			.. coordinateSpec[&amp;quot;dec-lat&amp;quot;] .. '; '&lt;br /&gt;
			.. coordinateSpec[&amp;quot;dec-long&amp;quot;]&lt;br /&gt;
			.. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	local inner = '&amp;lt;span class=&amp;quot;' .. displayDefault(coordinateSpec[&amp;quot;default&amp;quot;], &amp;quot;dms&amp;quot; ) .. '&amp;quot;&amp;gt;' .. geodmshtml .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
				.. '&amp;lt;span class=&amp;quot;geo-multi-punct&amp;quot;&amp;gt;&amp;amp;#xfeff; / &amp;amp;#xfeff;&amp;lt;/span&amp;gt;'&lt;br /&gt;
				.. '&amp;lt;span class=&amp;quot;' .. displayDefault(coordinateSpec[&amp;quot;default&amp;quot;], &amp;quot;dec&amp;quot; ) .. '&amp;quot;&amp;gt;';&lt;br /&gt;
&lt;br /&gt;
	if not args[&amp;quot;name&amp;quot;] then&lt;br /&gt;
		inner = inner .. geodechtml&lt;br /&gt;
				.. '&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; / ' .. geonumhtml .. '&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
	else&lt;br /&gt;
		inner = inner .. '&amp;lt;span class=&amp;quot;vcard&amp;quot;&amp;gt;' .. geodechtml&lt;br /&gt;
				.. '&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; / ' .. geonumhtml .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
				.. '&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; (&amp;lt;span class=&amp;quot;fn org&amp;quot;&amp;gt;'&lt;br /&gt;
				.. args[&amp;quot;name&amp;quot;] .. '&amp;lt;/span&amp;gt;)&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = templatestyles} }&lt;br /&gt;
	       .. '&amp;lt;span class=&amp;quot;plainlinks nourlexpansion&amp;quot;&amp;gt;'&lt;br /&gt;
	       .. '[' .. coord_link .. uriComponents .. ' ' .. inner .. ']'&lt;br /&gt;
	       .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, convert decimal to degrees ]]&lt;br /&gt;
local function convert_dec2dms_d(coordinate)&lt;br /&gt;
	local d = math_mod._round( coordinate, 0 ) .. &amp;quot;°&amp;quot;&lt;br /&gt;
	return d .. &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, convert decimal to degrees and minutes ]]&lt;br /&gt;
local function convert_dec2dms_dm(coordinate)&lt;br /&gt;
	coordinate = math_mod._round( coordinate * 60, 0 );&lt;br /&gt;
	local m = coordinate % 60;&lt;br /&gt;
	coordinate = math.floor( (coordinate - m) / 60 );&lt;br /&gt;
	local d = coordinate % 360 ..&amp;quot;°&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	return d .. string.format( &amp;quot;%02d′&amp;quot;, m )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]&lt;br /&gt;
local function convert_dec2dms_dms(coordinate)&lt;br /&gt;
	coordinate = math_mod._round( coordinate * 60 * 60, 0 );&lt;br /&gt;
	local s = coordinate % 60&lt;br /&gt;
	coordinate = math.floor( (coordinate - s) / 60 );&lt;br /&gt;
	local m = coordinate % 60&lt;br /&gt;
	coordinate = math.floor( (coordinate - m) / 60 );&lt;br /&gt;
	local d = coordinate % 360 ..&amp;quot;°&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	return d .. string.format( &amp;quot;%02d′&amp;quot;, m ) .. string.format( &amp;quot;%02d″&amp;quot;, s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function, convert decimal latitude or longitude to&lt;br /&gt;
degrees, minutes, and seconds format based on the specified precision.&lt;br /&gt;
]]&lt;br /&gt;
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)&lt;br /&gt;
	local coord = tonumber(coordinate)&lt;br /&gt;
	local postfix&lt;br /&gt;
	if coord &amp;gt;= 0 then&lt;br /&gt;
		postfix = firstPostfix&lt;br /&gt;
	else&lt;br /&gt;
		postfix = secondPostfix&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	precision = precision:lower();&lt;br /&gt;
	if precision == &amp;quot;dms&amp;quot; then&lt;br /&gt;
		return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;&lt;br /&gt;
	elseif precision == &amp;quot;dm&amp;quot; then&lt;br /&gt;
		return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;&lt;br /&gt;
	elseif precision == &amp;quot;d&amp;quot; then&lt;br /&gt;
		return convert_dec2dms_d( math.abs( coord ) ) .. postfix;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Convert DMS format into a N or E decimal coordinate&lt;br /&gt;
]]&lt;br /&gt;
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)&lt;br /&gt;
	local degrees = tonumber(degrees_str)&lt;br /&gt;
	local minutes = tonumber(minutes_str) or 0&lt;br /&gt;
	local seconds = tonumber(seconds_str) or 0&lt;br /&gt;
&lt;br /&gt;
	local factor = 1&lt;br /&gt;
	if direction == &amp;quot;S&amp;quot; or direction == &amp;quot;W&amp;quot; then&lt;br /&gt;
		factor = -1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local precision = 0&lt;br /&gt;
	if seconds_str then&lt;br /&gt;
		precision = 5 + math.max( math_mod._precision(seconds_str), 0 );&lt;br /&gt;
	elseif minutes_str and minutes_str ~= '' then&lt;br /&gt;
		precision = 3 + math.max( math_mod._precision(minutes_str), 0 );&lt;br /&gt;
	else&lt;br /&gt;
		precision = math.max( math_mod._precision(degrees_str), 0 );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local decimal = factor * (degrees+(minutes+seconds/60)/60)&lt;br /&gt;
	return string.format( &amp;quot;%.&amp;quot; .. precision .. &amp;quot;f&amp;quot;, decimal ) -- not tonumber since this whole thing is string based.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Checks input values to for out of range errors.&lt;br /&gt;
]]&lt;br /&gt;
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )&lt;br /&gt;
	local errors = {};&lt;br /&gt;
	lat_d = tonumber( lat_d ) or 0;&lt;br /&gt;
	lat_m = tonumber( lat_m ) or 0;&lt;br /&gt;
	lat_s = tonumber( lat_s ) or 0;&lt;br /&gt;
	long_d = tonumber( long_d ) or 0;&lt;br /&gt;
	long_m = tonumber( long_m ) or 0;&lt;br /&gt;
	long_s = tonumber( long_s ) or 0;&lt;br /&gt;
&lt;br /&gt;
	if strong then&lt;br /&gt;
		if lat_d &amp;lt; 0 then&lt;br /&gt;
			table.insert(errors, {source, &amp;quot;latitude degrees &amp;lt; 0 with hemisphere flag&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
		if long_d &amp;lt; 0 then&lt;br /&gt;
			table.insert(errors, {source, &amp;quot;longitude degrees &amp;lt; 0 with hemisphere flag&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
		--[[&lt;br /&gt;
		#coordinates is inconsistent about whether this is an error.  If globe: is&lt;br /&gt;
		specified, it won't error on this condition, but otherwise it will.&lt;br /&gt;
&lt;br /&gt;
		For not simply disable this check.&lt;br /&gt;
&lt;br /&gt;
		if long_d &amp;gt; 180 then&lt;br /&gt;
			table.insert(errors, {source, &amp;quot;longitude degrees &amp;gt; 180 with hemisphere flag&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
		]]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if lat_d &amp;gt; 90 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude degrees &amp;gt; 90&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_d &amp;lt; -90 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude degrees &amp;lt; -90&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_m &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude minutes &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_m &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude minutes &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_s &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude seconds &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if lat_s &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;latitude seconds &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_d &amp;gt;= 360 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude degrees &amp;gt;= 360&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_d &amp;lt;= -360 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude degrees &amp;lt;= -360&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_m &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude minutes &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_m &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude minutes &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_s &amp;gt;= 60 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude seconds &amp;gt;= 60&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
	if long_s &amp;lt; 0 then&lt;br /&gt;
		table.insert(errors, {source, &amp;quot;longitude seconds &amp;lt; 0&amp;quot;})&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return errors;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
parseDec&lt;br /&gt;
&lt;br /&gt;
Transforms decimal format latitude and longitude into the&lt;br /&gt;
structure to be used in displaying coordinates&lt;br /&gt;
]]&lt;br /&gt;
local function parseDec( lat, long, format )&lt;br /&gt;
	local coordinateSpec = {}&lt;br /&gt;
	local errors = {}&lt;br /&gt;
&lt;br /&gt;
	if not long then&lt;br /&gt;
		return nil, {{&amp;quot;parseDec&amp;quot;, &amp;quot;Missing longitude&amp;quot;}}&lt;br /&gt;
	elseif not tonumber(long) then&lt;br /&gt;
		return nil, {{&amp;quot;parseDec&amp;quot;, &amp;quot;Longitude could not be parsed as a number: &amp;quot; .. long}}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-lat&amp;quot;]  = lat;&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-long&amp;quot;] = long;&lt;br /&gt;
&lt;br /&gt;
	local mode = coordinates.determineMode( lat, long );&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-lat&amp;quot;]  = convert_dec2dms( lat, &amp;quot;N&amp;quot;, &amp;quot;S&amp;quot;, mode)  -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-long&amp;quot;] = convert_dec2dms( long, &amp;quot;E&amp;quot;, &amp;quot;W&amp;quot;, mode)  -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}&lt;br /&gt;
&lt;br /&gt;
	if format then&lt;br /&gt;
		coordinateSpec.default = format&lt;br /&gt;
	else&lt;br /&gt;
		coordinateSpec.default = &amp;quot;dec&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return coordinateSpec, errors&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
parseDMS&lt;br /&gt;
&lt;br /&gt;
Transforms degrees, minutes, seconds format latitude and longitude&lt;br /&gt;
into the a structure to be used in displaying coordinates&lt;br /&gt;
]]&lt;br /&gt;
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )&lt;br /&gt;
	local coordinateSpec, errors, backward = {}, {}&lt;br /&gt;
&lt;br /&gt;
	lat_f = lat_f:upper();&lt;br /&gt;
	long_f = long_f:upper();&lt;br /&gt;
&lt;br /&gt;
	-- Check if specified backward&lt;br /&gt;
	if lat_f == 'E' or lat_f == 'W' then&lt;br /&gt;
		lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );&lt;br /&gt;
	if not long_d then&lt;br /&gt;
		return nil, {{&amp;quot;parseDMS&amp;quot;, &amp;quot;Missing longitude&amp;quot; }}&lt;br /&gt;
	elseif not tonumber(long_d) then&lt;br /&gt;
		return nil, {{&amp;quot;parseDMS&amp;quot;, &amp;quot;Longitude could not be parsed as a number:&amp;quot; .. long_d }}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then&lt;br /&gt;
		if math_mod._precision( lat_d ) &amp;gt; 0 or math_mod._precision( long_d ) &amp;gt; 0 then&lt;br /&gt;
			if lat_f:upper() == 'S' then&lt;br /&gt;
				lat_d = '-' .. lat_d;&lt;br /&gt;
			end&lt;br /&gt;
			if long_f:upper() == 'W' then&lt;br /&gt;
				long_d = '-' .. long_d;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			return parseDec( lat_d, long_d, format );&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-lat&amp;quot;]  = lat_d..&amp;quot;°&amp;quot;..optionalArg(lat_m,&amp;quot;′&amp;quot;) .. optionalArg(lat_s,&amp;quot;″&amp;quot;) .. lat_f&lt;br /&gt;
	coordinateSpec[&amp;quot;dms-long&amp;quot;] = long_d..&amp;quot;°&amp;quot;..optionalArg(long_m,&amp;quot;′&amp;quot;) .. optionalArg(long_s,&amp;quot;″&amp;quot;) .. long_f&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-lat&amp;quot;]  = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}&lt;br /&gt;
	coordinateSpec[&amp;quot;dec-long&amp;quot;] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}&lt;br /&gt;
&lt;br /&gt;
	if format then&lt;br /&gt;
		coordinateSpec.default = format&lt;br /&gt;
	else&lt;br /&gt;
		coordinateSpec.default = &amp;quot;dms&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return coordinateSpec, errors, backward&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Check the input arguments for coord to determine the kind of data being provided&lt;br /&gt;
and then make the necessary processing.&lt;br /&gt;
]]&lt;br /&gt;
local function formatTest(args)&lt;br /&gt;
	local result, errors&lt;br /&gt;
	local backward, primary = false, false&lt;br /&gt;
&lt;br /&gt;
	local function getParam(args, lim)&lt;br /&gt;
		local ret = {}&lt;br /&gt;
		for i = 1, lim do&lt;br /&gt;
			ret[i] = args[i] or ''&lt;br /&gt;
		end&lt;br /&gt;
		return table.concat(ret, '_')&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not args[1] then&lt;br /&gt;
		-- no lat logic&lt;br /&gt;
		return errorPrinter( {{&amp;quot;formatTest&amp;quot;, &amp;quot;Missing latitude&amp;quot;}} )&lt;br /&gt;
	elseif not tonumber(args[1]) then&lt;br /&gt;
		-- bad lat logic&lt;br /&gt;
		return errorPrinter( {{&amp;quot;formatTest&amp;quot;, &amp;quot;Unable to parse latitude as a number:&amp;quot; .. args[1]}} )&lt;br /&gt;
	elseif not args[4] and not args[5] and not args[6] then&lt;br /&gt;
		-- dec logic&lt;br /&gt;
		result, errors = parseDec(args[1], args[2], args.format)&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors);&lt;br /&gt;
		end&lt;br /&gt;
		-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation&lt;br /&gt;
		-- wikiminiatlas doesn't support D;D notation&lt;br /&gt;
		-- #coordinates parserfunction doesn't support negative decimals with NSWE&lt;br /&gt;
		result.param = table.concat({&lt;br /&gt;
			math.abs(tonumber(args[1])),&lt;br /&gt;
			((tonumber(args[1]) or 0) &amp;lt; 0) and 'S' or 'N',&lt;br /&gt;
			math.abs(tonumber(args[2])),&lt;br /&gt;
			((tonumber(args[2]) or 0) &amp;lt; 0) and 'W' or 'E',&lt;br /&gt;
			args[3] or ''}, '_')&lt;br /&gt;
	elseif dmsTest(args[4], args[8]) then&lt;br /&gt;
		-- dms logic&lt;br /&gt;
		result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],&lt;br /&gt;
			args[5], args[6], args[7], args[8], args.format)&lt;br /&gt;
		if args[10] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Extra unexpected parameters'})&lt;br /&gt;
		end&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors)&lt;br /&gt;
		end&lt;br /&gt;
		result.param = getParam(args, 9)&lt;br /&gt;
	elseif dmsTest(args[3], args[6]) then&lt;br /&gt;
		-- dm logic&lt;br /&gt;
		result, errors, backward = parseDMS(args[1], args[2], nil, args[3],&lt;br /&gt;
			args[4], args[5], nil, args[6], args['format'])&lt;br /&gt;
		if args[8] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Extra unexpected parameters'})&lt;br /&gt;
		end&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors)&lt;br /&gt;
		end&lt;br /&gt;
		result.param = getParam(args, 7)&lt;br /&gt;
	elseif dmsTest(args[2], args[4]) then&lt;br /&gt;
		-- d logic&lt;br /&gt;
		result, errors, backward = parseDMS(args[1], nil, nil, args[2],&lt;br /&gt;
			args[3], nil, nil, args[4], args.format)&lt;br /&gt;
		if args[6] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Extra unexpected parameters'})&lt;br /&gt;
		end&lt;br /&gt;
		if not result then&lt;br /&gt;
			return errorPrinter(errors)&lt;br /&gt;
		end&lt;br /&gt;
		result.param = getParam(args, 5)&lt;br /&gt;
	else&lt;br /&gt;
		-- Error&lt;br /&gt;
		return errorPrinter({{&amp;quot;formatTest&amp;quot;, &amp;quot;Unknown argument format&amp;quot;}}) .. '[[Category:Pages with malformed coordinate tags]]'&lt;br /&gt;
	end&lt;br /&gt;
	result.name = args.name&lt;br /&gt;
&lt;br /&gt;
	local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}&lt;br /&gt;
	for _, v in ipairs(extra_param) do&lt;br /&gt;
		if args[v] then&lt;br /&gt;
			table.insert(errors, {'formatTest', 'Parameter: &amp;quot;' .. v .. '=&amp;quot; should be &amp;quot;' .. v .. ':&amp;quot;' })&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ret = specPrinter(args, result)&lt;br /&gt;
	if #errors &amp;gt; 0 then&lt;br /&gt;
		ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'&lt;br /&gt;
	end&lt;br /&gt;
	return ret, backward&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Generate Wikidata tracking categories.&lt;br /&gt;
]]&lt;br /&gt;
local function makeWikidataCategories(qid)&lt;br /&gt;
	local ret&lt;br /&gt;
	local qid = qid or mw.ext.UnlinkedWikibase.getEntityId('enwiki')&lt;br /&gt;
	-- TODO: Remove call to mw.wikibase&lt;br /&gt;
	if mw.wikibase and current_page.namespace == 0 then&lt;br /&gt;
		-- TODO: Remove call to mw.wikibase&lt;br /&gt;
		if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, &amp;quot;P625&amp;quot;) and mw.wikibase.getBestStatements(qid, &amp;quot;P625&amp;quot;)[1] then&lt;br /&gt;
			-- TODO: Remove call to mw.wikibase&lt;br /&gt;
			local snaktype = mw.wikibase.getBestStatements(qid, &amp;quot;P625&amp;quot;)[1].mainsnak.snaktype&lt;br /&gt;
			if snaktype == 'value' then&lt;br /&gt;
				-- coordinates exist both here and on Wikidata, and can be compared.&lt;br /&gt;
				ret = 'Coordinates on Wikidata'&lt;br /&gt;
			elseif snaktype == 'somevalue' then&lt;br /&gt;
				ret = 'Coordinates on Wikidata set to unknown value'&lt;br /&gt;
			elseif snaktype == 'novalue' then&lt;br /&gt;
				ret = 'Coordinates on Wikidata set to no value'&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- We have to either import the coordinates to Wikidata or remove them here.&lt;br /&gt;
			ret = 'Coordinates not on Wikidata'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if ret then&lt;br /&gt;
		return string.format('[[Category:%s]]', ret)&lt;br /&gt;
	else&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
link&lt;br /&gt;
&lt;br /&gt;
Simple function to export the coordinates link for other uses.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | link }}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.link(frame)&lt;br /&gt;
	return coord_link;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
dec2dms&lt;br /&gt;
&lt;br /&gt;
Wrapper to allow templates to call dec2dms directly.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |&lt;br /&gt;
		negative_suffix | precision }}&lt;br /&gt;
&lt;br /&gt;
decimal_coordinate is converted to DMS format.  If positive, the positive_suffix&lt;br /&gt;
is appended (typical N or E), if negative, the negative suffix is appended.  The&lt;br /&gt;
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail&lt;br /&gt;
to use.&lt;br /&gt;
]]&lt;br /&gt;
coordinates.dec2dms = makeInvokeFunc('_dec2dms')&lt;br /&gt;
function coordinates._dec2dms(args)&lt;br /&gt;
	local coordinate = args[1]&lt;br /&gt;
	local firstPostfix = args[2] or ''&lt;br /&gt;
	local secondPostfix = args[3] or ''&lt;br /&gt;
	local precision = args[4] or ''&lt;br /&gt;
&lt;br /&gt;
	return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function to determine whether to use D, DM, or DMS&lt;br /&gt;
format depending on the precision of the decimal input.&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.determineMode( value1, value2 )&lt;br /&gt;
	local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );&lt;br /&gt;
	if precision &amp;lt;= 0 then&lt;br /&gt;
		return 'd'&lt;br /&gt;
	elseif precision &amp;lt;= 2 then&lt;br /&gt;
		return 'dm';&lt;br /&gt;
	else&lt;br /&gt;
		return 'dms';&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
dms2dec&lt;br /&gt;
&lt;br /&gt;
Wrapper to allow templates to call dms2dec directly.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | dms2dec | direction_flag | degrees |&lt;br /&gt;
		minutes | seconds }}&lt;br /&gt;
&lt;br /&gt;
Converts DMS values specified as degrees, minutes, seconds too decimal format.&lt;br /&gt;
direction_flag is one of N, S, E, W, and determines whether the output is&lt;br /&gt;
positive (i.e. N and E) or negative (i.e. S and W).&lt;br /&gt;
]]&lt;br /&gt;
coordinates.dms2dec = makeInvokeFunc('_dms2dec')&lt;br /&gt;
function coordinates._dms2dec(args)&lt;br /&gt;
	local direction = args[1]&lt;br /&gt;
	local degrees = args[2]&lt;br /&gt;
	local minutes = args[3]&lt;br /&gt;
	local seconds = args[4]&lt;br /&gt;
&lt;br /&gt;
	return convert_dms2dec(direction, degrees, minutes, seconds)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
coord&lt;br /&gt;
&lt;br /&gt;
Main entry point for Lua function to replace {{coord}}&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
	{{#invoke:Coordinates | coord }}&lt;br /&gt;
	{{#invoke:Coordinates | coord | lat | long }}&lt;br /&gt;
	{{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}&lt;br /&gt;
	...&lt;br /&gt;
&lt;br /&gt;
	Refer to {{coord}} documentation page for many additional parameters and&lt;br /&gt;
	configuration options.&lt;br /&gt;
&lt;br /&gt;
Note: This function provides the visual display elements of {{coord}}.  In&lt;br /&gt;
order to load coordinates into the database, the {{#coordinates:}} parser&lt;br /&gt;
function must also be called, this is done automatically in the Lua&lt;br /&gt;
version of {{coord}}.&lt;br /&gt;
]]&lt;br /&gt;
coordinates.coord = makeInvokeFunc('_coord')&lt;br /&gt;
function coordinates._coord(args)&lt;br /&gt;
	if not tonumber(args[1]) and not args[2] then&lt;br /&gt;
		args[3] = args[1]; args[1] = nil&lt;br /&gt;
		-- TODO: Remove call to mw.wikibase&lt;br /&gt;
		local entity = mw.wikibase.getEntityObject(args.qid)&lt;br /&gt;
		if entity&lt;br /&gt;
			and entity.claims&lt;br /&gt;
			and entity.claims.P625&lt;br /&gt;
			and entity.claims.P625[1].mainsnak.snaktype == 'value'&lt;br /&gt;
		then&lt;br /&gt;
			local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision&lt;br /&gt;
			args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude&lt;br /&gt;
			args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude&lt;br /&gt;
			if precision then&lt;br /&gt;
				precision = -math_mod._round(math.log(precision)/math.log(10),0)&lt;br /&gt;
				args[1] = math_mod._round(args[1],precision)&lt;br /&gt;
				args[2] = math_mod._round(args[2],precision)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local contents, backward = formatTest(args)&lt;br /&gt;
	local Notes = args.notes or ''&lt;br /&gt;
	local Display = args.display and args.display:lower() or 'inline'&lt;br /&gt;
&lt;br /&gt;
	local function isInline(s)&lt;br /&gt;
		-- Finds whether coordinates are displayed inline.&lt;br /&gt;
		return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'&lt;br /&gt;
	end&lt;br /&gt;
	local function isInTitle(s)&lt;br /&gt;
		-- Finds whether coordinates are displayed in the title.&lt;br /&gt;
		return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function coord_wrapper(in_args)&lt;br /&gt;
		-- Calls the parser function {{#coordinates:}}.&lt;br /&gt;
		return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local text = ''&lt;br /&gt;
	if isInline(Display) then&lt;br /&gt;
		text = text .. displayinline(contents, Notes)&lt;br /&gt;
	end&lt;br /&gt;
	if isInTitle(Display) then&lt;br /&gt;
		text = text&lt;br /&gt;
			.. displaytitle(contents, Notes)&lt;br /&gt;
			.. makeWikidataCategories(args.qid)&lt;br /&gt;
	end&lt;br /&gt;
	if not args.nosave then&lt;br /&gt;
		local page_title, count = mw.title.getCurrentTitle(), 1&lt;br /&gt;
		if backward then&lt;br /&gt;
			local tmp = {}&lt;br /&gt;
			while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end&lt;br /&gt;
			tmp.count = count; count = 2*(count-1)&lt;br /&gt;
			while count &amp;gt;= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end&lt;br /&gt;
			for i, v in ipairs(tmp) do args[i] = v end&lt;br /&gt;
		else&lt;br /&gt;
			while count &amp;lt;= 9 do args[count] = (args[count] or ''); count = count+1 end&lt;br /&gt;
		end&lt;br /&gt;
		if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end&lt;br /&gt;
		args.notes, args.format, args.display = nil&lt;br /&gt;
		text = text .. coord_wrapper(args)&lt;br /&gt;
	end&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
coord2text&lt;br /&gt;
&lt;br /&gt;
Extracts a single value from a transclusion of {{Coord}}.&lt;br /&gt;
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
    {{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}&lt;br /&gt;
&lt;br /&gt;
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.coord2text(frame)&lt;br /&gt;
	if frame.args[1] == '' or frame.args[2] == '' or not frame.args[2] then return nil end&lt;br /&gt;
	frame.args[2] = mw.text.trim(frame.args[2])&lt;br /&gt;
	if frame.args[2] == 'lat' or frame.args[2] == 'long' then&lt;br /&gt;
		local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')&lt;br /&gt;
		if frame.args[2] == 'lat' then&lt;br /&gt;
			result, negative = result[1], 'S'&lt;br /&gt;
		else&lt;br /&gt;
			result, negative = result[2], 'W'&lt;br /&gt;
		end&lt;br /&gt;
		result = mw.text.split(result, '°')&lt;br /&gt;
		if result[2] == negative then result[1] = '-'..result[1] end&lt;br /&gt;
		return result[1]&lt;br /&gt;
	else&lt;br /&gt;
		return mw.ustring.match(frame.args[1], 'params=.-_'..frame.args[2]..':(.-)[ _]')&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
coordinsert&lt;br /&gt;
&lt;br /&gt;
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.&lt;br /&gt;
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
    {{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}&lt;br /&gt;
&lt;br /&gt;
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function coordinates.coordinsert(frame)&lt;br /&gt;
	for i, v in ipairs(frame.args) do&lt;br /&gt;
		if i ~= 1 then&lt;br /&gt;
			if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then&lt;br /&gt;
				frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if frame.args.name then&lt;br /&gt;
		if not mw.ustring.find(frame.args[1], '&amp;lt;span class=&amp;quot;vcard&amp;quot;&amp;gt;') then&lt;br /&gt;
			local namestr = frame.args.name&lt;br /&gt;
			frame.args[1] = mw.ustring.gsub(frame.args[1],&lt;br /&gt;
				'(&amp;lt;span class=&amp;quot;geo%-default&amp;quot;&amp;gt;)(&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;/span&amp;gt;&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;)(&amp;lt;/span&amp;gt;)',&lt;br /&gt;
				'%1&amp;lt;span class=&amp;quot;vcard&amp;quot;&amp;gt;%2&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;amp;#xfeff; (&amp;lt;span class=&amp;quot;fn org&amp;quot;&amp;gt;' .. namestr .. '&amp;lt;/span&amp;gt;)&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;%3')&lt;br /&gt;
			frame.args[1] = mw.ustring.gsub(frame.args[1], '(&amp;amp;params=[^&amp;amp;&amp;quot;&amp;lt;&amp;gt;%[%] ]*) ', '%1&amp;amp;title=' .. mw.uri.encode(namestr) .. ' ')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return frame.args[1]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return coordinates&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1/Identifiers&amp;diff=5304663</id>
		<title>Module:Citation/CS1/Identifiers</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Citation/CS1/Identifiers&amp;diff=5304663"/>
		<updated>2023-05-05T13:36:23Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
&lt;br /&gt;
local has_accept_as_written, is_set, in_array, set_message, select_one,			-- functions in Module:Citation/CS1/Utilities&lt;br /&gt;
		substitute, make_wikilink;&lt;br /&gt;
&lt;br /&gt;
local z;																		-- table of tables defined in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
local cfg;																		-- table of configuration tables that are defined in Module:Citation/CS1/Configuration&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 other modules; that are created here and used here&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local auto_link_urls = {};														-- holds identifier URLs for those identifiers that can auto-link |title=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; H E L P E R   F U N C T I O N S &amp;gt;&amp;gt;============================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; W I K I D A T A _ A R T I C L E _ N A M E _ G E T &amp;gt;----------------------------&lt;br /&gt;
&lt;br /&gt;
as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.&lt;br /&gt;
&lt;br /&gt;
returns :&amp;lt;lang code&amp;gt;:&amp;lt;article title&amp;gt; when &amp;lt;q&amp;gt; has an &amp;lt;article title&amp;gt; for &amp;lt;lang code&amp;gt;; nil else&lt;br /&gt;
&lt;br /&gt;
for identifiers that do not have q, returns nil&lt;br /&gt;
&lt;br /&gt;
for wikis that do not have mw.wikibase installed, returns nil&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wikidata_article_name_get (q)&lt;br /&gt;
	-- TODO: Remove call to mw.wikibase&lt;br /&gt;
	if not is_set (q) or (q and not mw.wikibase) then							-- when no q number or when a q number but mw.wikibase not installed on this wiki&lt;br /&gt;
		return nil;																-- abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local wd_article;&lt;br /&gt;
	local this_wiki_code = cfg.this_wiki_code;									-- Wikipedia subdomain; 'en' for en.wikipedia.org&lt;br /&gt;
&lt;br /&gt;
	-- TODO: Remove call to mw.wikibase&lt;br /&gt;
	wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. 'wiki');			-- fetch article title from WD; nil when no title available at this wiki&lt;br /&gt;
&lt;br /&gt;
	if wd_article then&lt;br /&gt;
		wd_article = table.concat ({':', this_wiki_code, ':', wd_article});		-- interwiki-style link without brackets if taken from WD; leading colon required&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return wd_article;															-- article title from WD; nil else&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N K _ L A B E L _ M A K E &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common function to create identifier link label from handler table or from Wikidata&lt;br /&gt;
&lt;br /&gt;
returns the first available of&lt;br /&gt;
	1. redirect from local wiki's handler table (if enabled)&lt;br /&gt;
	2. Wikidata (if there is a Wikidata entry for this identifier in the local wiki's language)&lt;br /&gt;
	3. label specified in the local wiki's handler table&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function link_label_make (handler)&lt;br /&gt;
	local wd_article;&lt;br /&gt;
	&lt;br /&gt;
	if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then	-- redirect has priority so if enabled and available don't fetch from Wikidata because expensive&lt;br /&gt;
		wd_article = wikidata_article_name_get (handler.q);						-- if Wikidata has an article title for this wiki, get it;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;&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 _ I D &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a wiki-style external link&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function external_link_id (options)&lt;br /&gt;
	local url_string = options.id;&lt;br /&gt;
	local ext_link;&lt;br /&gt;
	local this_wiki_code = cfg.this_wiki_code;									-- Wikipedia subdomain; 'en' for en.wikipedia.org&lt;br /&gt;
	local wd_article;															-- article title from Wikidata&lt;br /&gt;
	&lt;br /&gt;
	if options.encode == true or options.encode == nil then&lt;br /&gt;
		url_string = mw.uri.encode (url_string, 'PATH');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if options.auto_link and is_set (options.access) then&lt;br /&gt;
		auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or &amp;quot;&amp;quot;, mw.text.nowiki (options.id));&lt;br /&gt;
	if is_set (options.access) then&lt;br /&gt;
		ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link});	-- add the free-to-read / paywall lock&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat	({&lt;br /&gt;
		make_wikilink (link_label_make (options), options.label),				-- redirect, Wikidata link, or locally specified link (in that order)&lt;br /&gt;
		options.separator or '&amp;amp;nbsp;',&lt;br /&gt;
		ext_link&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N T E R N A L _ L I N K _ I D &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a wiki-style internal link&lt;br /&gt;
&lt;br /&gt;
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),&lt;br /&gt;
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,&lt;br /&gt;
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function internal_link_id (options)&lt;br /&gt;
	local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits);	-- translate 'local' digits to Western 0-9&lt;br /&gt;
&lt;br /&gt;
	return table.concat (&lt;br /&gt;
		{&lt;br /&gt;
		make_wikilink (link_label_make (options), options.label),				-- wiki-link the identifier label&lt;br /&gt;
		options.separator or '&amp;amp;nbsp;',											-- add the separator&lt;br /&gt;
		make_wikilink (&lt;br /&gt;
			table.concat (&lt;br /&gt;
				{&lt;br /&gt;
				options.prefix,&lt;br /&gt;
				id,																-- translated to Western digits&lt;br /&gt;
				options.suffix or ''&lt;br /&gt;
				}),&lt;br /&gt;
			substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)})	-- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis&lt;br /&gt;
			);																	-- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ E M B A R G O E D &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against&lt;br /&gt;
today's date.  If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns&lt;br /&gt;
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_embargoed (embargo)&lt;br /&gt;
	if is_set (embargo) then&lt;br /&gt;
		local lang = mw.getContentLanguage();&lt;br /&gt;
		local good1, embargo_date, todays_date;&lt;br /&gt;
		good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);&lt;br /&gt;
		todays_date = lang:formatDate ('U');&lt;br /&gt;
	&lt;br /&gt;
		if good1 then															-- if embargo date is a good date&lt;br /&gt;
			if tonumber (embargo_date) &amp;gt;= tonumber (todays_date) then			-- is embargo date is in the future?&lt;br /&gt;
				return embargo;													-- still embargoed&lt;br /&gt;
			else&lt;br /&gt;
				set_message ('maint_pmc_embargo');								-- embargo has expired; add main cat&lt;br /&gt;
				return '';														-- unset because embargo has expired&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return '';																	-- |pmc-embargo-date= not set return empty string&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ V A L I D _ B I O R X I V _ D A T E &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if:&lt;br /&gt;
	2019-12-11T00:00Z &amp;lt;= biorxiv_date &amp;lt; today + 2 days&lt;br /&gt;
	&lt;br /&gt;
The dated form of biorxiv identifier has a start date of 2019-12-11.  The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400&lt;br /&gt;
&lt;br /&gt;
biorxiv_date is the date provided in those |biorxiv= parameter values that are dated at time 00:00:00 UTC&lt;br /&gt;
today is the current date at time 00:00:00 UTC plus 48 hours&lt;br /&gt;
	if today is 2015-01-01T00:00:00 then&lt;br /&gt;
		adding 24 hours gives 2015-01-02T00:00:00 – one second more than today&lt;br /&gt;
		adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow&lt;br /&gt;
&lt;br /&gt;
This function does not work if it is fed month names for languages other than English.  Wikimedia #time: parser&lt;br /&gt;
apparently doesn't understand non-English date month names. This function will always return false when the date&lt;br /&gt;
contains a non-English month name because good1 is false after the call to lang_object.formatDate().  To get&lt;br /&gt;
around that call this function with date parts and create a YYYY-MM-DD format date.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_biorxiv_date (y, m, d)&lt;br /&gt;
	local biorxiv_date = table.concat ({y, m, d}, '-');							-- make ymd date&lt;br /&gt;
	local good1, good2;&lt;br /&gt;
	local biorxiv_ts, tomorrow_ts;												-- to hold Unix timestamps representing the dates&lt;br /&gt;
	local lang_object = mw.getContentLanguage();&lt;br /&gt;
&lt;br /&gt;
	good1, biorxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', biorxiv_date);		-- convert biorxiv_date value to Unix timestamp &lt;br /&gt;
	good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' );	-- today midnight + 2 days is one second more than all day tomorrow&lt;br /&gt;
	&lt;br /&gt;
	if good1 and good2 then														-- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand&lt;br /&gt;
		biorxiv_ts = tonumber (biorxiv_ts) or lang_object:parseFormattedNumber (biorxiv_ts);	-- convert to numbers for the comparison;&lt;br /&gt;
		tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- one or both failed to convert to Unix timestamp&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return ((1576022400 &amp;lt;= biorxiv_ts) and (biorxiv_ts &amp;lt; tomorrow_ts))			-- 2012-12-11T00:00Z &amp;lt;= biorxiv_date &amp;lt; tomorrow's date&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; IS _ V A L I D _ I S X N &amp;gt;-----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.&lt;br /&gt;
ISBN-13 is checked in isbn().&lt;br /&gt;
&lt;br /&gt;
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length&lt;br /&gt;
and stripped of dashes, spaces and other non-ISxN characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_isxn (isxn_str, len)&lt;br /&gt;
	local temp = 0;&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, len) };										-- make a table of byte values '0' → 0x30 .. '9' → 0x39, 'X' → 0x58&lt;br /&gt;
	len = len + 1;																-- adjust to be a loop counter&lt;br /&gt;
	for i, v in ipairs (isxn_str) do											-- loop through all of the bytes and calculate the checksum&lt;br /&gt;
		if v == string.byte (&amp;quot;X&amp;quot; ) then											-- if checkdigit is X (compares the byte value of 'X' which is 0x58)&lt;br /&gt;
			temp = temp + 10 * (len - i);										-- it represents 10 decimal&lt;br /&gt;
		else&lt;br /&gt;
			temp = temp + tonumber (string.char (v) )*(len-i);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 11 == 0;														-- returns true if calculation result is zero&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; IS _ V A L I D _ I S X N _ 1 3 &amp;gt;-----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.&lt;br /&gt;
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length&lt;br /&gt;
and stripped of dashes, spaces and other non-ISxN-13 characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_isxn_13 (isxn_str)&lt;br /&gt;
	local temp=0;&lt;br /&gt;
	&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, 13) };										-- make a table of byte values '0' → 0x30 .. '9' → 0x39&lt;br /&gt;
	for i, v in ipairs (isxn_str) do&lt;br /&gt;
		temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) );			-- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 10 == 0;														-- sum modulo 10 is zero when ISBN-13/ISMN is correct&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N O R M A L I Z E _ L C C N &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)&lt;br /&gt;
1. Remove all blanks.&lt;br /&gt;
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.&lt;br /&gt;
3. If there is a hyphen in the string:&lt;br /&gt;
	a. Remove it.&lt;br /&gt;
	b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):&lt;br /&gt;
		1. All these characters should be digits, and there should be six or less. (not done in this function)&lt;br /&gt;
		2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.&lt;br /&gt;
&lt;br /&gt;
Returns a normalized LCCN for lccn() to validate.  There is no error checking (step 3.b.1) performed in this function.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function normalize_lccn (lccn)&lt;br /&gt;
	lccn = lccn:gsub (&amp;quot;%s&amp;quot;, &amp;quot;&amp;quot;);												-- 1. strip whitespace&lt;br /&gt;
&lt;br /&gt;
	if nil ~= string.find (lccn, '/') then&lt;br /&gt;
		lccn = lccn:match (&amp;quot;(.-)/&amp;quot;);											-- 2. remove forward slash and all character to the right of it&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local prefix&lt;br /&gt;
	local suffix&lt;br /&gt;
	prefix, suffix = lccn:match (&amp;quot;(.+)%-(.+)&amp;quot;);									-- 3.a remove hyphen by splitting the string into prefix and suffix&lt;br /&gt;
&lt;br /&gt;
	if nil ~= suffix then														-- if there was a hyphen&lt;br /&gt;
		suffix = string.rep(&amp;quot;0&amp;quot;, 6-string.len (suffix)) .. suffix;				-- 3.b.2 left fill the suffix with 0s if suffix length less than 6&lt;br /&gt;
		lccn = prefix..suffix;													-- reassemble the LCCN&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return lccn;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; I D E N T I F I E R   F U N C T I O N S &amp;gt;&amp;gt;====================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R X I V &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
See: https://arxiv.org/help/arxiv_identifier&lt;br /&gt;
&lt;br /&gt;
format and error check arXiv identifier.  There are three valid forms of the identifier:&lt;br /&gt;
the first form, valid only between date codes 9107 and 0703, is:&lt;br /&gt;
	arXiv:&amp;lt;archive&amp;gt;.&amp;lt;class&amp;gt;/&amp;lt;date code&amp;gt;&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;archive&amp;gt; is a string of alpha characters - may be hyphenated; no other punctuation&lt;br /&gt;
	&amp;lt;class&amp;gt; is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form&lt;br /&gt;
	&amp;lt;date code&amp;gt; is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01&lt;br /&gt;
		first digit of YY for this form can only 9 and 0&lt;br /&gt;
	&amp;lt;number&amp;gt; is a three-digit number&lt;br /&gt;
	&amp;lt;version&amp;gt; is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)&lt;br /&gt;
	&lt;br /&gt;
the second form, valid from April 2007 through December 2014 is:&lt;br /&gt;
	arXiv:&amp;lt;date code&amp;gt;.&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;date code&amp;gt; is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01&lt;br /&gt;
	&amp;lt;number&amp;gt; is a four-digit number&lt;br /&gt;
	&amp;lt;version&amp;gt; is a 1 or more digit number preceded with a lowercase v; no spaces&lt;br /&gt;
&lt;br /&gt;
the third form, valid from January 2015 is:&lt;br /&gt;
	arXiv:&amp;lt;date code&amp;gt;.&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;date code&amp;gt; and &amp;lt;version&amp;gt; are as defined for 0704-1412&lt;br /&gt;
	&amp;lt;number&amp;gt; is a five-digit number&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function arxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local class = options.Class;												-- TODO: lowercase?&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local year, month, version;&lt;br /&gt;
	local err_msg = false;														-- assume no error message&lt;br /&gt;
	local text;																	-- output text&lt;br /&gt;
	&lt;br /&gt;
	if id:match(&amp;quot;^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$&amp;quot;) then	-- test for the 9107-0703 format with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((not (90 &amp;lt; year or 8 &amp;gt; year)) or (1 &amp;gt; month or 12 &amp;lt; month)) or		-- if invalid year or invalid month&lt;br /&gt;
			((91 == year and 7 &amp;gt; month) or (7 == year and 3 &amp;lt; month)) then		-- if years ok, are starting and ending months ok?&lt;br /&gt;
				err_msg = true;													-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%dv%d+$&amp;quot;) then	-- test for the 0704-1412 with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((7 &amp;gt; year) or (14 &amp;lt; year) or (1 &amp;gt; month or 12 &amp;lt; month)) or			-- is year invalid or is month invalid? (doesn't test for future years)&lt;br /&gt;
			((7 == year) and (4 &amp;gt; month)) then									-- when year is 07, is month invalid (before April)?&lt;br /&gt;
				err_msg = true;													-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d%dv%d+$&amp;quot;) then	-- test for the 1501- format with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((15 &amp;gt; year) or (1 &amp;gt; month or 12 &amp;lt; month)) then						-- is year invalid or is month invalid? (doesn't test for future years)&lt;br /&gt;
			err_msg = true;														-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		err_msg = true;															-- not a recognized format; flag for error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		options.coins_list_t['ARXIV'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local err_msg_t = {};&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		set_message ('err_bad_arxiv');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});&lt;br /&gt;
&lt;br /&gt;
	if is_set (class) then&lt;br /&gt;
		if id:match ('^%d+') then&lt;br /&gt;
			text = table.concat ({text, ' [[//arxiv.org/archive/', class, ' ', class, ']]'});	-- external link within square brackets, not wikilink&lt;br /&gt;
		else&lt;br /&gt;
			set_message ('err_class_ignored');&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B I B C O D E &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validates (sort of) and formats a bibcode ID.&lt;br /&gt;
&lt;br /&gt;
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes&lt;br /&gt;
&lt;br /&gt;
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters&lt;br /&gt;
and first four digits must be a year.  This function makes these tests:&lt;br /&gt;
	length must be 19 characters&lt;br /&gt;
	characters in position&lt;br /&gt;
		1–4 must be digits and must represent a year in the range of 1000 – next year&lt;br /&gt;
		5 must be a letter&lt;br /&gt;
		6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &amp;amp;. )&lt;br /&gt;
		9–18 must be letter, digit, or dot&lt;br /&gt;
		19 must be a letter or dot&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function bibcode (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_type;&lt;br /&gt;
	local err_msg = '';&lt;br /&gt;
	local year;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = access});&lt;br /&gt;
	&lt;br /&gt;
	if 19 ~= id:len() then&lt;br /&gt;
		err_type = cfg.err_msg_supl.length;&lt;br /&gt;
	else&lt;br /&gt;
		year = id:match (&amp;quot;^(%d%d%d%d)[%a][%w&amp;amp;%.][%w&amp;amp;%.][%w&amp;amp;%.][%w.]+[%a%.]$&amp;quot;);&lt;br /&gt;
		if not year then														-- if nil then no pattern match&lt;br /&gt;
			err_type = cfg.err_msg_supl.value;									-- so value error&lt;br /&gt;
		else&lt;br /&gt;
			local next_year = tonumber (os.date ('%Y')) + 1;					-- get the current year as a number and add one for next year&lt;br /&gt;
			year = tonumber (year);												-- convert year portion of bibcode to a number&lt;br /&gt;
			if (1000 &amp;gt; year) or (year &amp;gt; next_year) then&lt;br /&gt;
				err_type = cfg.err_msg_supl.year;								-- year out of bounds&lt;br /&gt;
			end&lt;br /&gt;
			if id:find('&amp;amp;%.') then&lt;br /&gt;
				err_type = cfg.err_msg_supl.journal;							-- journal abbreviation must not have '&amp;amp;.' (if it does it's missing a letter)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (err_type) then													-- if there was an error detected&lt;br /&gt;
		set_message ('err_bad_bibcode', {err_type});&lt;br /&gt;
		options.coins_list_t['BIBCODE'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B I O R X I V &amp;gt;-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format bioRxiv ID and do simple error checking.  Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly&lt;br /&gt;
6 digits.  After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd. &lt;br /&gt;
date and suffixed with an optional version identifier.&lt;br /&gt;
&lt;br /&gt;
The bioRxiv ID is the string of characters:&lt;br /&gt;
	https://doi.org/10.1101/078733 -&amp;gt; 10.1101/078733&lt;br /&gt;
or a date followed by a six-digit number followed by an optional version indicator 'v' and one or more digits:&lt;br /&gt;
	https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -&amp;gt; 10.1101/2019.12.11.123456v2&lt;br /&gt;
	&lt;br /&gt;
see https://www.biorxiv.org/about-biorxiv&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function biorxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_msg = true;														-- flag; assume that there will be an error&lt;br /&gt;
	&lt;br /&gt;
	local patterns = {&lt;br /&gt;
		'^10.1101/%d%d%d%d%d%d$',												-- simple 6-digit identifier (before 2019-12-11)&lt;br /&gt;
		'^10.1101/(20[1-9]%d)%.([01]%d)%.([0-3]%d)%.%d%d%d%d%d%dv%d+$',			-- y.m.d. date + 6-digit identifier + version (after 2019-12-11)&lt;br /&gt;
		'^10.1101/(20[1-9]%d)%.([01]%d)%.([0-3]%d)%.%d%d%d%d%d%d$',				-- y.m.d. date + 6-digit identifier (after 2019-12-11)&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- spin through the patterns looking for a match&lt;br /&gt;
		if id:match (pattern) then&lt;br /&gt;
			local y, m, d = id:match (pattern);									-- found a match, attempt to get year, month and date from the identifier&lt;br /&gt;
&lt;br /&gt;
			if m then															-- m is nil when id is the six-digit form&lt;br /&gt;
				if not is_valid_biorxiv_date (y, m, d) then						-- validate the encoded date; TODO: don't ignore leap-year and actual month lengths ({{#time:}} is a poor date validator)&lt;br /&gt;
					break;														-- date fail; break out early so we don't unset the error message&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			err_msg = nil;														-- we found a match so unset the error message&lt;br /&gt;
			break;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- err_cat remains set here when no match&lt;br /&gt;
&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		options.coins_list_t['BIORXIV'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		set_message ('err_bad_biorxiv');										-- and set the error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator,&lt;br /&gt;
			encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E S E E R X &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
CiteSeerX use their own notion of &amp;quot;doi&amp;quot; (not to be confused with the identifiers resolved via doi.org).&lt;br /&gt;
&lt;br /&gt;
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citeseerx (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local matched;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = handler.access});&lt;br /&gt;
	&lt;br /&gt;
	matched = id:match (&amp;quot;^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$&amp;quot;);&lt;br /&gt;
	if not matched then&lt;br /&gt;
		set_message ('err_bad_citeseerx' );&lt;br /&gt;
		options.coins_list_t['CITESEERX'] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D O I &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a DOI and checks for DOI errors.&lt;br /&gt;
&lt;br /&gt;
DOI names contain two parts: prefix and suffix separated by a forward slash.&lt;br /&gt;
	Prefix: directory indicator '10.' followed by a registrant code&lt;br /&gt;
	Suffix: character string of any length chosen by the registrant&lt;br /&gt;
&lt;br /&gt;
This function checks a DOI name for: prefix/suffix.  If the DOI name contains spaces or endashes, or, if it ends&lt;br /&gt;
with a period or a comma, this function will emit a bad_doi error message.&lt;br /&gt;
&lt;br /&gt;
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,&lt;br /&gt;
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely&lt;br /&gt;
if ever used in DOI names.&lt;br /&gt;
&lt;br /&gt;
https://www.doi.org/doi_handbook/2_Numbering.html				-- 2.2 Syntax of a DOI name&lt;br /&gt;
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2			-- 2.2.2 DOI prefix&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function doi (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local inactive = options.DoiBroken&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
&lt;br /&gt;
	local text;&lt;br /&gt;
	if is_set (inactive) then&lt;br /&gt;
		local inactive_year = inactive:match(&amp;quot;%d%d%d%d&amp;quot;) or '';					-- try to get the year portion from the inactive date&lt;br /&gt;
		local inactive_month, good;&lt;br /&gt;
&lt;br /&gt;
		if is_set (inactive_year) then&lt;br /&gt;
			if 4 &amp;lt; inactive:len() then											-- inactive date has more than just a year (could be anything)&lt;br /&gt;
				local lang_obj = mw.getContentLanguage();						-- get a language object for this wiki&lt;br /&gt;
				good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive);	-- try to get the month name from the inactive date&lt;br /&gt;
				if not good then&lt;br /&gt;
					inactive_month = nil;										-- something went wrong so make sure this is unset&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			inactive_year = nil;												-- |doi-broken-date= has something but it isn't a date&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if is_set (inactive_year) and is_set (inactive_month) then&lt;br /&gt;
			set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '});&lt;br /&gt;
		elseif is_set (inactive_year) then&lt;br /&gt;
			set_message ('maint_doi_inactive_dated', {inactive_year, '', ''});&lt;br /&gt;
		else&lt;br /&gt;
			set_message ('maint_doi_inactive');&lt;br /&gt;
		end&lt;br /&gt;
		inactive = &amp;quot; (&amp;quot; .. cfg.messages['inactive'] .. ' ' .. inactive .. ')';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local registrant = mw.ustring.match (id, '^10%.([^/]+)/[^%s–]-[^%.,]$');	-- registrant set when DOI has the proper basic form&lt;br /&gt;
&lt;br /&gt;
	local registrant_err_patterns = {											-- these patterns are for code ranges that are not supported &lt;br /&gt;
		'^[^1-3]%d%d%d%d%.%d%d*$',												-- 5 digits with subcode (0xxxx, 40000+); accepts: 10000–39999&lt;br /&gt;
		'^[^1-5]%d%d%d%d$',														-- 5 digits without subcode (0xxxx, 60000+); accepts: 10000–59999&lt;br /&gt;
		'^[^1-9]%d%d%d%.%d%d*$',												-- 4 digits with subcode (0xxx); accepts: 1000–9999&lt;br /&gt;
		'^[^1-9]%d%d%d$',														-- 4 digits without subcode (0xxx); accepts: 1000–9999&lt;br /&gt;
		'^%d%d%d%d%d%d+',														-- 6 or more digits&lt;br /&gt;
		'^%d%d?%d?$',															-- less than 4 digits without subcode (3 digits with subcode is legitimate)&lt;br /&gt;
		'^%d%d?%.[%d%.]+',														-- 1 or 2 digits with subcode&lt;br /&gt;
		'^5555$',																-- test registrant will never resolve&lt;br /&gt;
		'[^%d%.]',																-- any character that isn't a digit or a dot&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	if not ignore_invalid then&lt;br /&gt;
		if registrant then														-- when DOI has proper form&lt;br /&gt;
			for i, pattern in ipairs (registrant_err_patterns) do				-- spin through error patterns&lt;br /&gt;
				if registrant:match (pattern) then								-- to validate registrant codes&lt;br /&gt;
					err_flag = set_message ('err_bad_doi');						-- when found, mark this DOI as bad&lt;br /&gt;
					break;														-- and done&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			err_flag = set_message ('err_bad_doi');								-- invalid directory or malformed&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('maint_doi_ignore');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_flag then&lt;br /&gt;
		options.coins_list_t['DOI'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,&lt;br /&gt;
		auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and 'doi' or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored&lt;br /&gt;
		}) .. (inactive or '');&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H D L &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats an HDL with minor error checking.&lt;br /&gt;
&lt;br /&gt;
HDL names contain two parts: prefix and suffix separated by a forward slash.&lt;br /&gt;
	Prefix: character string using any character in the UCS-2 character set except '/'&lt;br /&gt;
	Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant&lt;br /&gt;
&lt;br /&gt;
This function checks a HDL name for: prefix/suffix.  If the HDL name contains spaces, endashes, or, if it ends&lt;br /&gt;
with a period or a comma, this function will emit a bad_hdl error message.&lt;br /&gt;
&lt;br /&gt;
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and&lt;br /&gt;
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely&lt;br /&gt;
if ever used in HDLs.&lt;br /&gt;
&lt;br /&gt;
Query string parameters are named here: https://www.handle.net/proxy_servlet.html.  query strings are not displayed&lt;br /&gt;
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we&lt;br /&gt;
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function hdl (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local query_params = {														-- list of known query parameters from https://www.handle.net/proxy_servlet.html&lt;br /&gt;
		'noredirect',&lt;br /&gt;
		'ignore_aliases',&lt;br /&gt;
		'auth',&lt;br /&gt;
		'cert',&lt;br /&gt;
		'index',&lt;br /&gt;
		'type',&lt;br /&gt;
		'urlappend',&lt;br /&gt;
		'locatt',&lt;br /&gt;
		'action',&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local hdl, suffix, param = id:match ('(.-)(%?(%a+).+)$');					-- look for query string&lt;br /&gt;
	local found;&lt;br /&gt;
&lt;br /&gt;
	if hdl then																	-- when there are query strings, this is the handle identifier portion&lt;br /&gt;
		for _, q in ipairs (query_params) do									-- spin through the list of query parameters&lt;br /&gt;
			if param:match ('^' .. q) then										-- if the query string begins with one of the parameters&lt;br /&gt;
				found = true;													-- announce a find&lt;br /&gt;
				break;															-- and stop looking&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if found then&lt;br /&gt;
		id = hdl;																-- found so replace id with the handle portion; this will be URL-encoded, suffix will not&lt;br /&gt;
	else&lt;br /&gt;
		suffix = '';															-- make sure suffix is empty string for concatenation else&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})&lt;br /&gt;
&lt;br /&gt;
	if nil == id:match(&amp;quot;^[^%s–]-/[^%s–]-[^%.,]$&amp;quot;) then							-- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma&lt;br /&gt;
		set_message ('err_bad_hdl' );&lt;br /&gt;
		options.coins_list_t['HDL'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S B N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether an ISBN string is valid&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function isbn (options)&lt;br /&gt;
	local isbn_str = options.id;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	local function return_result (check, err_type)								-- local function to handle the various returns&lt;br /&gt;
		local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
						prefix = handler.prefix, id = isbn_str, separator = handler.separator});&lt;br /&gt;
		if ignore_invalid then													-- if ignoring ISBN errors&lt;br /&gt;
			set_message ('maint_isbn_ignore');									-- add a maint category even when there is no error&lt;br /&gt;
		else																	-- here when not ignoring&lt;br /&gt;
			if not check then													-- and there is an error&lt;br /&gt;
				options.coins_list_t['ISBN'] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
				set_message ('err_bad_isbn', err_type);							-- set an error message&lt;br /&gt;
				return ISBN;										 			-- return id text&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return ISBN;															-- return id text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if nil ~= isbn_str:match ('[^%s-0-9X]') then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.char);					-- fail if isbn_str contains anything but digits, hyphens, or the uppercase X&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local id = isbn_str:gsub ('[%s-]', '');										-- remove hyphens and whitespace&lt;br /&gt;
&lt;br /&gt;
	local len = id:len();&lt;br /&gt;
 &lt;br /&gt;
	if len ~= 10 and len ~= 13 then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.length);					-- fail if incorrect length&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if len == 10 then&lt;br /&gt;
		if id:match ('^%d*X?$') == nil then										-- fail if isbn_str has 'X' anywhere but last position&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.form);									&lt;br /&gt;
		end&lt;br /&gt;
		if not is_valid_isxn (id, 10) then										-- test isbn-10 for numerical validity&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.check);				-- fail if isbn-10 is not numerically valid&lt;br /&gt;
		end&lt;br /&gt;
		if id:find ('^63[01]') then												-- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.group);				-- fail if isbn-10 begins with 630/1&lt;br /&gt;
		end&lt;br /&gt;
		return return_result (true, cfg.err_msg_supl.check);					-- pass if isbn-10 is numerically valid&lt;br /&gt;
	else&lt;br /&gt;
		if id:match ('^%d+$') == nil then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.char);				-- fail if ISBN-13 is not all digits&lt;br /&gt;
		end&lt;br /&gt;
		if id:match ('^97[89]%d*$') == nil then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.prefix);				-- fail when ISBN-13 does not begin with 978 or 979&lt;br /&gt;
		end&lt;br /&gt;
		if id:match ('^9790') then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.group);				-- group identifier '0' is reserved to ISMN&lt;br /&gt;
		end&lt;br /&gt;
		return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A S I N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a link to Amazon.  Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha&lt;br /&gt;
characters.  If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit&lt;br /&gt;
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.&lt;br /&gt;
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.&lt;br /&gt;
&lt;br /&gt;
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these&lt;br /&gt;
do not cause this function to emit the maint_asin message&lt;br /&gt;
&lt;br /&gt;
This function is positioned here because it calls isbn()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function asin (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local domain = options.ASINTLD;&lt;br /&gt;
	&lt;br /&gt;
	local err_flag;&lt;br /&gt;
&lt;br /&gt;
	if not id:match(&amp;quot;^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$&amp;quot;) then&lt;br /&gt;
		err_flag = set_message ('err_bad_asin');								-- ASIN is not a mix of 10 uppercase alpha and numeric characters&lt;br /&gt;
	else&lt;br /&gt;
		if id:match(&amp;quot;^%d%d%d%d%d%d%d%d%d[%dX]$&amp;quot;) then							-- if 10-digit numeric (or 9 digits with terminal X)&lt;br /&gt;
			if is_valid_isxn (id, 10) then										-- see if ASIN value is or validates as ISBN-10&lt;br /&gt;
				if not id:find ('^63[01]') then									-- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier&lt;br /&gt;
					err_flag = set_message ('err_bad_asin');					-- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn &lt;br /&gt;
				end&lt;br /&gt;
			elseif not is_set (err_flag) then&lt;br /&gt;
				err_flag = set_message ('err_bad_asin');						-- ASIN is not ISBN-10&lt;br /&gt;
			end&lt;br /&gt;
		elseif not id:match(&amp;quot;^%u[%d%u]+$&amp;quot;) then&lt;br /&gt;
			err_flag = set_message ('err_bad_asin');							-- asin doesn't begin with uppercase alpha&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if (not is_set (domain)) or in_array (domain, {'us'}) then					-- default: United States&lt;br /&gt;
		domain = &amp;quot;com&amp;quot;;&lt;br /&gt;
	elseif in_array (domain, {'jp', 'uk'}) then									-- Japan, United Kingdom&lt;br /&gt;
		domain = &amp;quot;co.&amp;quot; .. domain;&lt;br /&gt;
	elseif in_array (domain, {'z.cn'}) then 									-- China&lt;br /&gt;
		domain = &amp;quot;cn&amp;quot;;&lt;br /&gt;
	elseif in_array (domain, {'au', 'br', 'mx', 'sg', 'tr'}) then				-- Australia, Brazil, Mexico, Singapore, Turkey&lt;br /&gt;
		domain = &amp;quot;com.&amp;quot; .. domain;&lt;br /&gt;
	elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'es', 'fr', 'in', 'it', 'nl', 'pl', 'sa', 'se', 'co.jp', 'co.uk', 'com', 'com.au', 'com.br', 'com.mx', 'com.sg', 'com.tr'}) then -- Arabic Emirates, Canada, China, Germany, Spain, France, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don't maintain local ASINs for them)&lt;br /&gt;
		err_flag = set_message ('err_bad_asin_tld');							-- unsupported asin-tld value&lt;br /&gt;
	end&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t['ASIN'] = handler.prefix .. domain .. &amp;quot;/dp/&amp;quot; .. id;	-- asin for coins&lt;br /&gt;
	else&lt;br /&gt;
		options.coins_list_t['ASIN'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix .. domain .. &amp;quot;/dp/&amp;quot;,&lt;br /&gt;
		id = id, encode = handler.encode, separator = handler.separator})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S M N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether an ISMN string is valid.  Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the&lt;br /&gt;
same check digit calculations.  See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf&lt;br /&gt;
section 2, pages 9–12.&lt;br /&gt;
&lt;br /&gt;
ismn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)&lt;br /&gt;
or an identifier registered at info-uri.info (info:)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ismn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local text;&lt;br /&gt;
	local valid_ismn = true;&lt;br /&gt;
	local id_copy;&lt;br /&gt;
&lt;br /&gt;
	id_copy = id;																-- save a copy because this testing is destructive&lt;br /&gt;
	id = id:gsub ('[%s-]', '');													-- remove hyphens and white space&lt;br /&gt;
&lt;br /&gt;
	if 13 ~= id:len() or id:match (&amp;quot;^9790%d*$&amp;quot; ) == nil then					-- ISMN must be 13 digits and begin with 9790&lt;br /&gt;
		valid_ismn = false;&lt;br /&gt;
	else&lt;br /&gt;
		valid_ismn=is_valid_isxn_13 (id);										-- validate ISMN&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--	text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,		-- use this (or external version) when there is some place to link to&lt;br /&gt;
	--		prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
&lt;br /&gt;
	text = table.concat (														-- because no place to link to yet&lt;br /&gt;
		{&lt;br /&gt;
		make_wikilink (link_label_make (handler), handler.label),&lt;br /&gt;
		handler.separator,&lt;br /&gt;
		id_copy&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	if false == valid_ismn then&lt;br /&gt;
		options.coins_list_t['ISMN'] = nil;										-- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS&lt;br /&gt;
		set_message ('err_bad_ismn');											-- create an error message if the ISMN is invalid&lt;br /&gt;
	end &lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S S N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format an ISSN.  This code fixes the case where an editor has included an ISSN in the citation but&lt;br /&gt;
has separated the two groups of four digits with a space.  When that condition occurred, the resulting link looked&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
	|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327]	-- can't have spaces in an external link&lt;br /&gt;
	&lt;br /&gt;
This code now prevents that by inserting a hyphen at the ISSN midpoint.  It also validates the ISSN for length&lt;br /&gt;
and makes sure that the checkdigit agrees with the calculated value.  Incorrect length (8 digits), characters&lt;br /&gt;
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message.  The&lt;br /&gt;
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function issn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
&lt;br /&gt;
	local issn_copy = id;														-- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate&lt;br /&gt;
	local text;&lt;br /&gt;
	local valid_issn = true;&lt;br /&gt;
&lt;br /&gt;
	id = id:gsub ('[%s-]', '');													-- remove hyphens and whitespace&lt;br /&gt;
&lt;br /&gt;
	if 8 ~= id:len() or nil == id:match (&amp;quot;^%d*X?$&amp;quot; ) then						-- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position&lt;br /&gt;
		valid_issn = false;														-- wrong length or improper character&lt;br /&gt;
	else&lt;br /&gt;
		valid_issn = is_valid_isxn (id, 8);										-- validate ISSN&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if true == valid_issn then&lt;br /&gt;
		id = string.sub (id, 1, 4 ) .. &amp;quot;-&amp;quot; .. string.sub (id, 5 );				-- if valid, display correctly formatted version&lt;br /&gt;
	else&lt;br /&gt;
		id = issn_copy;															-- if not valid, show the invalid ISSN with error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
&lt;br /&gt;
	if ignore_invalid then&lt;br /&gt;
		set_message ('maint_issn_ignore');&lt;br /&gt;
	else&lt;br /&gt;
		if false == valid_issn then&lt;br /&gt;
			options.coins_list_t['ISSN'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
			set_message ('err_bad_issn', (options.hkey == 'EISSN') and 'e' or '');	-- create an error message if the ISSN is invalid&lt;br /&gt;
		end &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; J F M &amp;gt;-----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A numerical identifier in the form nn.nnnn.nn&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function jfm (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match ('^[Jj][Ff][Mm](.*)$');									-- identifier with jfm prefix; extract identifier&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message ('maint_jfm_format');&lt;br /&gt;
	else																		-- plain number without JFM prefix&lt;br /&gt;
		id_num = id;															-- if here id does not have prefix&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if id_num and id_num:match('^%d%d%.%d%d%d%d%.%d%d$') then&lt;br /&gt;
		id = id_num;															-- jfm matches pattern&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('err_bad_jfm' );											-- set an error message&lt;br /&gt;
		options.coins_list_t['JFM'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; J S T O R &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format a JSTOR with some error checking&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function jstor (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:find ('[Jj][Ss][Tt][Oo][Rr]') or id:find ('^https?://') or id:find ('%s') then&lt;br /&gt;
		set_message ('err_bad_jstor');											-- set an error message&lt;br /&gt;
		options.coins_list_t['JSTOR'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L C C N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format LCCN link and do simple error checking.  LCCN is a character string 8-12 characters long. The length of&lt;br /&gt;
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.&lt;br /&gt;
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html&lt;br /&gt;
&lt;br /&gt;
length = 8 then all digits&lt;br /&gt;
length = 9 then lccn[1] is lowercase alpha&lt;br /&gt;
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits&lt;br /&gt;
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits&lt;br /&gt;
length = 12 then lccn[1] and lccn[2] are both lowercase alpha&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function lccn (options)&lt;br /&gt;
	local lccn = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;																-- presume that LCCN is valid&lt;br /&gt;
	local id = lccn;															-- local copy of the LCCN&lt;br /&gt;
&lt;br /&gt;
	id = normalize_lccn (id);													-- get canonical form (no whitespace, hyphens, forward slashes)&lt;br /&gt;
	local len = id:len();														-- get the length of the LCCN&lt;br /&gt;
&lt;br /&gt;
	if 8 == len then&lt;br /&gt;
		if id:match(&amp;quot;[^%d]&amp;quot;) then												-- if LCCN has anything but digits (nil if only digits)&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 9 == len then														-- LCCN should be adddddddd&lt;br /&gt;
		if nil == id:match(&amp;quot;%l%d%d%d%d%d%d%d%d&amp;quot;) then							-- does it match our pattern?&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 10 == len then														-- LCCN should be aadddddddd or dddddddddd&lt;br /&gt;
		if id:match(&amp;quot;[^%d]&amp;quot;) then												-- if LCCN has anything but digits (nil if only digits) ...&lt;br /&gt;
			if nil == id:match(&amp;quot;^%l%l%d%d%d%d%d%d%d%d&amp;quot;) then					-- ... see if it matches our pattern&lt;br /&gt;
				err_flag = set_message ('err_bad_lccn');						-- no match, set an error message&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif 11 == len then														-- LCCN should be aaadddddddd or adddddddddd&lt;br /&gt;
		if not (id:match(&amp;quot;^%l%l%l%d%d%d%d%d%d%d%d&amp;quot;) or id:match(&amp;quot;^%l%d%d%d%d%d%d%d%d%d%d&amp;quot;)) then	-- see if it matches one of our patterns&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- no match, set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 12 == len then														-- LCCN should be aadddddddddd&lt;br /&gt;
		if not id:match(&amp;quot;^%l%l%d%d%d%d%d%d%d%d%d%d&amp;quot;) then						-- see if it matches our pattern&lt;br /&gt;
			err_flag = set_message ('err_bad_lccn');							-- no match, set an error message&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		err_flag = set_message ('err_bad_lccn');								-- wrong length, set an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) and nil ~= lccn:find ('%s') then&lt;br /&gt;
		err_flag = set_message ('err_bad_lccn');								-- lccn contains a space, set an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t['LCCN'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = lccn, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M R &amp;gt;--------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function mr (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local id_len;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match ('^[Mm][Rr](%d+)$');										-- identifier with mr prefix&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message ('maint_mr_format');										-- add maint cat&lt;br /&gt;
	else																		-- plain number without mr prefix&lt;br /&gt;
		id_num = id:match ('^%d+$');											-- if here id is all digits&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	id_len = id_num and id_num:len() or 0;&lt;br /&gt;
	if (7 &amp;gt;= id_len) and (0 ~= id_len) then&lt;br /&gt;
		id = string.rep ('0', 7-id_len) .. id_num;								-- zero-fill leading digits&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('err_bad_mr');												-- set an error message&lt;br /&gt;
		options.coins_list_t['MR'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O C L C &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format an OCLC ID.  https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}&lt;br /&gt;
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function oclc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local number;&lt;br /&gt;
&lt;br /&gt;
	if id:match('^ocm%d%d%d%d%d%d%d%d$') then									-- ocm prefix and 8 digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match('ocm(%d+)');											-- get the number&lt;br /&gt;
	elseif id:match('^ocn%d%d%d%d%d%d%d%d%d$') then								-- ocn prefix and 9 digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match('ocn(%d+)');											-- get the number&lt;br /&gt;
	elseif id:match('^on%d%d%d%d%d%d%d%d%d%d+$') then							-- on prefix and 10 or more digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match('^on(%d%d%d%d%d%d%d%d%d%d+)$');						-- get the number&lt;br /&gt;
	elseif id:match('^%(OCoLC%)[1-9]%d*$') then									-- (OCoLC) prefix and variable number digits; no leading zeros; 035 field&lt;br /&gt;
		number = id:match('%(OCoLC%)([1-9]%d*)');								-- get the number&lt;br /&gt;
		if 9 &amp;lt; number:len() then&lt;br /&gt;
			number = nil;														-- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers&lt;br /&gt;
		end&lt;br /&gt;
	elseif id:match('^%d+$') then												-- no prefix&lt;br /&gt;
		number = id;															-- get the number&lt;br /&gt;
		if 10 &amp;lt; number:len() then&lt;br /&gt;
			number = nil;														-- constrain to 1 to 10 digits; change this when OCLC issues 11-digit numbers&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if number then																-- proper format&lt;br /&gt;
		id = number;															-- exclude prefix, if any, from external link&lt;br /&gt;
	else&lt;br /&gt;
		set_message ('err_bad_oclc')											-- add an error message if the id is malformed&lt;br /&gt;
		options.coins_list_t['OCLC'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O P E N L I B R A R Y &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats an OpenLibrary link, and checks for associated errors.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function openlibrary (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ident, code = id:gsub('^OL', ''):match(&amp;quot;^(%d+([AMW]))$&amp;quot;);				-- strip optional OL prefix followed immediately by digits followed by 'A', 'M', or 'W';&lt;br /&gt;
	local err_flag;&lt;br /&gt;
	local prefix = {															-- these are appended to the handler.prefix according to code&lt;br /&gt;
		['A']='authors/OL',&lt;br /&gt;
		['M']='books/OL',&lt;br /&gt;
		['W']='works/OL',&lt;br /&gt;
		['X']='OL'																-- not a code; spoof when 'code' in id is invalid&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
	if not ident then&lt;br /&gt;
		code = 'X';																-- no code or id completely invalid&lt;br /&gt;
		ident = id;																-- copy id to ident so that we display the flawed identifier&lt;br /&gt;
		err_flag = set_message ('err_bad_ol');&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t['OL'] = handler.prefix .. prefix[code] .. ident;	-- experiment for ol coins&lt;br /&gt;
	else&lt;br /&gt;
		options.coins_list_t['OL'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix .. prefix[code],&lt;br /&gt;
		id = ident, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O S T I &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;&lt;br /&gt;
the value in test_limit will need to be updated periodically as more OSTIs are issued.&lt;br /&gt;
&lt;br /&gt;
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function osti (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if OSTI has anything but digits&lt;br /&gt;
		set_message ('err_bad_osti');											-- set an error message&lt;br /&gt;
		options.coins_list_t['OSTI'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- OSTI is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1018 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then						-- if OSTI is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_osti');										-- set an error message&lt;br /&gt;
			options.coins_list_t['OSTI'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P M C &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format a PMC, do simple error checking, and check for embargoed articles.&lt;br /&gt;
&lt;br /&gt;
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not&lt;br /&gt;
be linked to the article.  If the embargo date is today or in the past, or if it is empty or omitted, then the&lt;br /&gt;
PMC identifier is linked to the article through the link at cfg.id_handlers['PMC'].prefix.&lt;br /&gt;
&lt;br /&gt;
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation&lt;br /&gt;
has |pmc=&amp;lt;value&amp;gt; but does not have a |url= then |title= is linked with the PMC link.  Function is_embargoed ()&lt;br /&gt;
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
PMCs are sequential numbers beginning at 1 and counting up.  This code checks the PMC to see that it contains only digits and is less&lt;br /&gt;
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function pmc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local embargo = options.Embargo;											-- TODO: lowercase?&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match ('^[Pp][Mm][Cc](%d+)$');									-- identifier with PMC prefix&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message ('maint_pmc_format');&lt;br /&gt;
	else																		-- plain number without PMC prefix&lt;br /&gt;
		id_num = id:match ('^%d+$');											-- if here id is all digits&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if PMC is outside test limit boundaries&lt;br /&gt;
			err_flag = set_message ('err_bad_pmc');								-- set an error message&lt;br /&gt;
		else&lt;br /&gt;
			id = tostring (id_num);												-- make sure id is a string&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		err_flag = set_message ('err_bad_pmc');									-- set an error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (embargo) and is_set (is_embargoed (embargo)) then				-- is PMC is still embargoed?&lt;br /&gt;
		text = table.concat (													-- still embargoed so no external link&lt;br /&gt;
			{&lt;br /&gt;
			make_wikilink (link_label_make (handler), handler.label),&lt;br /&gt;
			handler.separator,&lt;br /&gt;
			id,&lt;br /&gt;
			});&lt;br /&gt;
	else&lt;br /&gt;
		text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,	-- no embargo date or embargo has expired, ok to link to article&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,&lt;br /&gt;
			auto_link = not err_flag and 'pmc' or nil							-- do not auto-link when PMC has error&lt;br /&gt;
			});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_flag then&lt;br /&gt;
		options.coins_list_t['PMC'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P M I D &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format PMID and do simple error checking.  PMIDs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable&lt;br /&gt;
test_limit will need to be updated periodically as more PMIDs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function pmid (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if PMID has anything but digits&lt;br /&gt;
		set_message ('err_bad_pmid');											-- set an error message&lt;br /&gt;
		options.coins_list_t['PMID'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- PMID is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if PMID is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_pmid');										-- set an error message&lt;br /&gt;
			options.coins_list_t['PMID'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R F C &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;&lt;br /&gt;
the value in test_limit will need to be updated periodically as more RFCs are issued.&lt;br /&gt;
&lt;br /&gt;
An index of all RFCs is here: https://tools.ietf.org/rfc/&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function rfc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if RFC has anything but digits&lt;br /&gt;
		set_message ('err_bad_rfc');											-- set an error message&lt;br /&gt;
		options.coins_list_t['RFC'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- RFC is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if RFC is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_rfc');										-- set an error message&lt;br /&gt;
			options.coins_list_t['RFC'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S 2 C I D &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an S2CID, do simple error checking&lt;br /&gt;
&lt;br /&gt;
S2CIDs are sequential numbers beginning at 1 and counting up.  This code checks the S2CID to see that it is only&lt;br /&gt;
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically&lt;br /&gt;
as more S2CIDs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function s2cid (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
	&lt;br /&gt;
	id_num = id:match ('^[1-9]%d*$');											-- id must be all digits; must not begin with 0; no open access flag&lt;br /&gt;
&lt;br /&gt;
 	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if handler.id_limit &amp;lt; id_num then										-- if S2CID is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_s2cid');										-- set an error message&lt;br /&gt;
			options.coins_list_t['S2CID'] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		set_message ('err_bad_s2cid');											-- set an error message&lt;br /&gt;
		options.coins_list_t['S2CID'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S B N &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional '0' to make 10 digits&lt;br /&gt;
&lt;br /&gt;
sbn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)&lt;br /&gt;
or an identifier registered at info-uri.info (info:)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sbn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local function return_result (check, err_type)								-- local function to handle the various returns&lt;br /&gt;
		local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
						prefix = handler.prefix, id = id, separator = handler.separator});&lt;br /&gt;
		if not ignore_invalid then												-- if not ignoring SBN errors&lt;br /&gt;
			if not check then&lt;br /&gt;
				options.coins_list_t['SBN'] = nil;								-- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS&lt;br /&gt;
				set_message ('err_bad_sbn', {err_type});						-- display an error message&lt;br /&gt;
				return SBN; &lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			set_message ('maint_isbn_ignore');									-- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)&lt;br /&gt;
		end&lt;br /&gt;
		return SBN;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if id:match ('[^%s-0-9X]') then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.char);					-- fail if SBN contains anything but digits, hyphens, or the uppercase X&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ident = id:gsub ('[%s-]', '');										-- remove hyphens and whitespace; they interfere with the rest of the tests&lt;br /&gt;
&lt;br /&gt;
	if  9 ~= ident:len() then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.length);					-- fail if incorrect length&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ident:match ('^%d*X?$') == nil then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.form);					-- fail if SBN has 'X' anywhere but last position&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return return_result (is_valid_isxn ('0' .. ident, 10), cfg.err_msg_supl.check);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S S R N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an SSRN, do simple error checking&lt;br /&gt;
&lt;br /&gt;
SSRNs are sequential numbers beginning at 100? and counting up.  This code checks the SSRN to see that it is&lt;br /&gt;
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need&lt;br /&gt;
to be updated periodically as more SSRNs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ssrn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
	&lt;br /&gt;
	id_num = id:match ('^%d+$');												-- id must be all digits&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if 100 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then						-- if SSRN is outside test limit boundaries&lt;br /&gt;
			set_message ('err_bad_ssrn');										-- set an error message&lt;br /&gt;
			options.coins_list_t['SSRN'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		set_message ('err_bad_ssrn');											-- set an error message&lt;br /&gt;
		options.coins_list_t['SSRN'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U S E N E T _ I D &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format a usenet message id.  Simple error checking, looks for 'id-left@id-right' not enclosed in&lt;br /&gt;
'&amp;lt;' and/or '&amp;gt;' angle brackets.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function usenet_id (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
 &lt;br /&gt;
	if not id:match('^.+@.+$') or not id:match('^[^&amp;lt;].*[^&amp;gt;]$') then				-- doesn't have '@' or has one or first or last character is '&amp;lt; or '&amp;gt;'&lt;br /&gt;
		set_message ('err_bad_usenet_id')										-- add an error message if the message id is invalid&lt;br /&gt;
		options.coins_list_t['USENETID'] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end &lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Z B L &amp;gt;-----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional&lt;br /&gt;
&lt;br /&gt;
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/&lt;br /&gt;
&lt;br /&gt;
temporary format is apparently eight digits.  Anything else is an error&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function zbl (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match('^%d%d%d%d%d%d%d%d$') then										-- is this identifier using temporary format?&lt;br /&gt;
		set_message ('maint_zbl');												-- yes, add maint cat&lt;br /&gt;
	elseif not id:match('^%d?%d?%d?%d%.%d%d%d%d%d$') then						-- not temporary, is it normal format?&lt;br /&gt;
		set_message ('err_bad_zbl');											-- no, set an error message&lt;br /&gt;
		options.coins_list_t['ZBL'] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; I N T E R F A C E   F U N C T I O N S &amp;gt;&amp;gt;==========================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A C T _ I D S &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for&lt;br /&gt;
any of the parameters listed in each cfg.id_handlers['...'].parameters.  If found, adds the parameter and value to&lt;br /&gt;
the identifier list.  Emits redundant error message if more than one alias exists in args&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_ids (args)&lt;br /&gt;
	local id_list = {};															-- list of identifiers found in args&lt;br /&gt;
	for k, v in pairs (cfg.id_handlers) do										-- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers['ISBN'], v is a table&lt;br /&gt;
		v = select_one (args, v.parameters, 'err_redundant_parameters' );		-- v.parameters is a table of aliases for k; here we pick one from args if present&lt;br /&gt;
		if is_set (v) then id_list[k] = v; end									-- if found in args, add identifier to our list&lt;br /&gt;
	end&lt;br /&gt;
	return id_list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A C T _ I D _ A C C E S S _ L E V E L S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access&lt;br /&gt;
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.&lt;br /&gt;
&lt;br /&gt;
returns a table of k/v pairs where k is same as the identifier's key in cfg.id_handlers and v is the assigned (valid) keyword&lt;br /&gt;
&lt;br /&gt;
access-level values must match the case used in cfg.keywords_lists['id-access'] (lowercase unless there is some special reason for something else)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_id_access_levels (args, id_list)&lt;br /&gt;
	local id_accesses_list = {};&lt;br /&gt;
	for k, v in pairs (cfg.id_handlers) do&lt;br /&gt;
		local access_param = v.custom_access;									-- name of identifier's access-level parameter&lt;br /&gt;
		if is_set (access_param) then&lt;br /&gt;
			local access_level = args[access_param];							-- get the assigned value if there is one&lt;br /&gt;
			if is_set (access_level) then&lt;br /&gt;
				if not in_array (access_level, cfg.keywords_lists['id-access']) then	-- exact match required&lt;br /&gt;
					set_message ('err_invalid_param_val', {access_param, access_level});	&lt;br /&gt;
					access_level = nil;											-- invalid so unset&lt;br /&gt;
				end&lt;br /&gt;
				if not is_set (id_list[k]) then									-- identifier access-level must have a matching identifier&lt;br /&gt;
					set_message ('err_param_access_requires_param', {k:lower()});	-- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message&lt;br /&gt;
				end&lt;br /&gt;
				id_accesses_list[k] = cfg.keywords_xlate[access_level];			-- get translated keyword&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return id_accesses_list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B U I L D _ I D _ L I S T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
render the identifiers into a sorted sequence table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID_list_coins_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value&lt;br /&gt;
&amp;lt;options_t&amp;gt; is a table of various k/v option pairs provided in the call to new_build_id_list();&lt;br /&gt;
	modified by	this function and passed to all identifier rendering functions&lt;br /&gt;
&amp;lt;access_levels_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)&lt;br /&gt;
&lt;br /&gt;
returns a sequence table of sorted (by hkey - 'handler' key) rendered identifier strings&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)&lt;br /&gt;
	local ID_list_t = {};&lt;br /&gt;
	local accept;&lt;br /&gt;
	local func_map = {															--function map points to functions associated with hkey identifier&lt;br /&gt;
		['ARXIV'] = arxiv,&lt;br /&gt;
		['ASIN'] = asin,&lt;br /&gt;
		['BIBCODE'] = bibcode,&lt;br /&gt;
		['BIORXIV'] = biorxiv,&lt;br /&gt;
		['CITESEERX'] = citeseerx,&lt;br /&gt;
		['DOI'] = doi,&lt;br /&gt;
		['EISSN'] = issn,&lt;br /&gt;
		['HDL'] = hdl,&lt;br /&gt;
		['ISBN'] = isbn,&lt;br /&gt;
		['ISMN'] = ismn,&lt;br /&gt;
		['ISSN'] = issn,&lt;br /&gt;
		['JFM'] = jfm,&lt;br /&gt;
		['JSTOR'] = jstor,&lt;br /&gt;
		['LCCN'] = lccn,&lt;br /&gt;
		['MR'] = mr,&lt;br /&gt;
		['OCLC'] = oclc,&lt;br /&gt;
		['OL'] = openlibrary,&lt;br /&gt;
		['OSTI'] = osti,&lt;br /&gt;
		['PMC'] = pmc,&lt;br /&gt;
		['PMID'] = pmid,&lt;br /&gt;
		['RFC']  = rfc,&lt;br /&gt;
		['S2CID'] = s2cid,&lt;br /&gt;
		['SBN'] = sbn,&lt;br /&gt;
		['SSRN'] = ssrn,&lt;br /&gt;
		['USENETID'] = usenet_id,&lt;br /&gt;
		['ZBL'] = zbl,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	for hkey, v in pairs (ID_list_coins_t) do&lt;br /&gt;
		v, accept = has_accept_as_written (v);									-- remove accept-as-written markup if present; accept is boolean true when markup removed; false else&lt;br /&gt;
																				-- every function gets the options table with value v and accept boolean&lt;br /&gt;
		options_t.hkey = hkey;													-- ~/Configuration handler key&lt;br /&gt;
		options_t.id = v;														-- add that identifier value to the options table&lt;br /&gt;
		options_t.accept = accept;												-- add the accept boolean flag&lt;br /&gt;
		options_t.access = access_levels_t[hkey];								-- add the access level for those that have an |&amp;lt;identifier-access= parameter&lt;br /&gt;
		options_t.handler = cfg.id_handlers[hkey];&lt;br /&gt;
		options_t.coins_list_t = ID_list_coins_t;								-- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's metadata&lt;br /&gt;
		options_t.coins_list_t[hkey] = v;										-- id value without accept-as-written markup for metadata&lt;br /&gt;
		&lt;br /&gt;
		if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists['id-access']) then&lt;br /&gt;
			error (cfg.messages['unknown_ID_access'] .. options_t.handler.access);	-- here when handler access key set to a value not listed in list of allowed id access keywords&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if func_map[hkey] then&lt;br /&gt;
			local id_text = func_map[hkey] (options_t);							-- call the function to get identifier text and any error message&lt;br /&gt;
			table.insert (ID_list_t, {hkey, id_text});							-- add identifier text to the output sequence table&lt;br /&gt;
		else&lt;br /&gt;
			error (cfg.messages['unknown_ID_key'] .. hkey);						-- here when func_map doesn't have a function for hkey&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function comp (a, b)													-- used by following table.sort()&lt;br /&gt;
		return a[1]:lower() &amp;lt; b[1]:lower();										-- sort by hkey&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.sort (ID_list_t, comp);												-- sequence table of tables sort	&lt;br /&gt;
	for k, v in ipairs (ID_list_t) do											-- convert sequence table of tables to simple sequence table of strings&lt;br /&gt;
		ID_list_t[k] = v[2];													-- v[2] is the identifier rendering from the call to the various functions in func_map{}&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return ID_list_t;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O P T I O N S _ C H E C K &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check that certain option parameters have their associated identifier parameters with values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID_list_coins_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value&lt;br /&gt;
&amp;lt;ID_support_t&amp;gt; is a sequence table of tables created in citation0() where each subtable has four elements:&lt;br /&gt;
	[1] is the support parameter's assigned value; empty string if not set&lt;br /&gt;
	[2] is a text string same as key in cfg.id_handlers&lt;br /&gt;
	[3] is cfg.error_conditions key used to create error message&lt;br /&gt;
	[4] is original ID support parameter name used to create error message&lt;br /&gt;
	&lt;br /&gt;
returns nothing; on error emits an appropriate error message&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function options_check (ID_list_coins_t, ID_support_t)&lt;br /&gt;
	for _, v in ipairs (ID_support_t) do&lt;br /&gt;
		if is_set (v[1]) and not ID_list_coins_t[v[2]] then						-- when support parameter has a value but matching identifier parameter is missing or empty&lt;br /&gt;
			set_message (v[3], (v[4]));											-- emit the appropriate error 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 D E N T I F I E R _ L I S T S _ G E T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the&lt;br /&gt;
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered&lt;br /&gt;
citation.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function identifier_lists_get (args_t, options_t, ID_support_t)&lt;br /&gt;
	local ID_list_coins_t = extract_ids (args_t);										-- get a table of identifiers and their values for use locally and for use in COinS&lt;br /&gt;
	options_check (ID_list_coins_t, ID_support_t);										-- ID support parameters must have matching identifier parameters &lt;br /&gt;
	local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t);		-- get a table of identifier access levels&lt;br /&gt;
	local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t);	-- get a sequence table of rendered identifier strings&lt;br /&gt;
&lt;br /&gt;
	return ID_list_t, ID_list_coins_t;											-- return the tables&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S E L E C T E D _ M O D U L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)&lt;br /&gt;
	cfg = cfg_table_ptr;&lt;br /&gt;
&lt;br /&gt;
	has_accept_as_written = utilities_page_ptr.has_accept_as_written;			-- import functions from select Module:Citation/CS1/Utilities module&lt;br /&gt;
	is_set = utilities_page_ptr.is_set;								&lt;br /&gt;
	in_array = utilities_page_ptr.in_array;&lt;br /&gt;
	set_message = utilities_page_ptr.set_message;&lt;br /&gt;
	select_one = utilities_page_ptr.select_one;&lt;br /&gt;
	substitute = utilities_page_ptr.substitute;&lt;br /&gt;
	make_wikilink = utilities_page_ptr.make_wikilink;&lt;br /&gt;
&lt;br /&gt;
	z = utilities_page_ptr.z;													-- table of tables in Module:Citation/CS1/Utilities&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;
	auto_link_urls = auto_link_urls,											-- table of identifier URLs to be used when auto-linking |title=&lt;br /&gt;
	&lt;br /&gt;
	identifier_lists_get = identifier_lists_get,								-- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels&lt;br /&gt;
	is_embargoed = is_embargoed;&lt;br /&gt;
	set_selected_modules = set_selected_modules;&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Authority_control&amp;diff=5304662</id>
		<title>Module:Authority control</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Authority_control&amp;diff=5304662"/>
		<updated>2023-05-05T13:35:23Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require('strict')&lt;br /&gt;
local config = mw.loadData('Module:Authority control/config')&lt;br /&gt;
local p = {}&lt;br /&gt;
local title = mw.title.getCurrentTitle()&lt;br /&gt;
local namespace = title.namespace&lt;br /&gt;
local testcases = (string.sub(title.subpageText,1,9) == 'testcases')&lt;br /&gt;
&lt;br /&gt;
local function needsAttention(sortkey)&lt;br /&gt;
	return '[[Category:Pages with authority control identifiers needing attention|' .. sortkey .. title.text .. ']]'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function addCat(cat,sortkey)&lt;br /&gt;
	if cat and cat ~= '' and (namespace == 0 or namespace == 14 or testcases) then&lt;br /&gt;
		local redlinkcat = ''&lt;br /&gt;
		if testcases == false and mw.title.new(cat, 14).exists == false then&lt;br /&gt;
			redlinkcat = needsAttention('N')&lt;br /&gt;
		end&lt;br /&gt;
		if sortkey then&lt;br /&gt;
			cat = '[[Category:'..cat..'|' .. sortkey .. title.text .. ']]'&lt;br /&gt;
		else&lt;br /&gt;
			cat = '[[Category:'..cat..']]'&lt;br /&gt;
		end&lt;br /&gt;
		cat = cat .. redlinkcat&lt;br /&gt;
		return cat&lt;br /&gt;
	else&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getCatForId(id,faulty)&lt;br /&gt;
	local cat = 'Articles with '&lt;br /&gt;
	if faulty then cat = cat .. 'faulty ' end&lt;br /&gt;
	cat = cat .. id .. ' identifiers'&lt;br /&gt;
	return addCat(cat)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getIdsFromWikidata(qid,property)&lt;br /&gt;
	local function getquals(statement,qualid)&lt;br /&gt;
		if statement.qualifiers and statement.qualifiers['P'..qualid] then&lt;br /&gt;
			-- TODO: Remove call to mw.wikibase&lt;br /&gt;
			return mw.wikibase.renderSnak(statement.qualifiers['P'..qualid][1])&lt;br /&gt;
		else&lt;br /&gt;
			return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local ids = {}&lt;br /&gt;
	if qid then&lt;br /&gt;
		-- TODO: Remove call to mw.wikibase&lt;br /&gt;
		for _, statement in ipairs(mw.wikibase.getBestStatements(qid,property)) do&lt;br /&gt;
			if statement.mainsnak.datavalue then&lt;br /&gt;
				local val = statement.mainsnak.datavalue.value&lt;br /&gt;
				if val then&lt;br /&gt;
					local namedas = getquals(statement,1810) or getquals(statement,742) or ''&lt;br /&gt;
					table.insert(ids,{id=val,name=namedas})&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return ids&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local _makelink = function(conf,val,nextid,qid) --validate values and create a link&lt;br /&gt;
	local function tooltip(text,label)&lt;br /&gt;
		if label and label~='' then&lt;br /&gt;
			return mw.getCurrentFrame():expandTemplate{title = &amp;quot;Tooltip&amp;quot;, args = {text,label}}		&lt;br /&gt;
		else&lt;br /&gt;
			return text&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local link&lt;br /&gt;
	if nextid==1 then&lt;br /&gt;
		if conf.prefix then&lt;br /&gt;
			link = '*' .. conf.prefix .. '\n**'&lt;br /&gt;
		else&lt;br /&gt;
			link = '*'&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		link = '\n**'&lt;br /&gt;
	end&lt;br /&gt;
	local valid_value = false&lt;br /&gt;
	if conf.customlink then -- use function to validate and generate link&lt;br /&gt;
		local label = nextid&amp;gt;1 and nextid&lt;br /&gt;
		local newlink= require(config.auxiliary)[conf.customlink](val.id,label)&lt;br /&gt;
		if newlink then&lt;br /&gt;
			link = link .. newlink&lt;br /&gt;
			valid_value = true&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if conf.pattern then -- use pattern to determine validity if defined&lt;br /&gt;
			valid_value = string.match(val.id,conf.pattern)&lt;br /&gt;
		elseif conf.patterns then&lt;br /&gt;
			for _,pattern in ipairs(conf.patterns) do&lt;br /&gt;
				valid_value = val.id:match(pattern)&lt;br /&gt;
				if valid_value then break end&lt;br /&gt;
			end&lt;br /&gt;
		elseif conf.valid then -- otherwise use function to determine validity&lt;br /&gt;
			valid_value = require(config.auxiliary)[conf.valid](val.id)&lt;br /&gt;
		else -- no validation possible&lt;br /&gt;
			valid_value = val.id&lt;br /&gt;
		end&lt;br /&gt;
		if valid_value then&lt;br /&gt;
			local newlink&lt;br /&gt;
			local label = conf.label&lt;br /&gt;
			if not label or nextid&amp;gt;1 then&lt;br /&gt;
				label = tostring(nextid)&lt;br /&gt;
			end&lt;br /&gt;
			if conf.link then&lt;br /&gt;
				valid_value = valid_value:gsub('%%', '%%%%')&lt;br /&gt;
				newlink = '[' .. mw.ustring.gsub(conf.link,'%$1',valid_value) .. ' ' .. label .. ']'&lt;br /&gt;
			else&lt;br /&gt;
				newlink = valid_value&lt;br /&gt;
			end&lt;br /&gt;
			link = link .. '&amp;lt;span class=&amp;quot;uid&amp;quot;&amp;gt;'..tooltip(newlink,val.name)..'&amp;lt;/span&amp;gt;'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if valid_value then&lt;br /&gt;
		link = link .. getCatForId(conf.category or conf[1])&lt;br /&gt;
	else&lt;br /&gt;
		--local preview = require(&amp;quot;Module:If preview&amp;quot;)&lt;br /&gt;
		local wdlink = qid and '[[:wikidata:' .. qid .. '#P' .. conf.property .. ']]' or ''&lt;br /&gt;
		link = link .. '[[File:345-409 Ambox warning centered.svg|20px|frameless|link=' .. wdlink .. '|The ' .. conf[1] .. ' id ' .. val.id .. ' is not valid.]]'&lt;br /&gt;
		if conf.errorcat then&lt;br /&gt;
			link = link .. addCat(conf.errorcat)&lt;br /&gt;
		else&lt;br /&gt;
			link = link .. getCatForId(conf.category or conf[1],true)&lt;br /&gt;
		end&lt;br /&gt;
		link = link .. addCat('All articles with faulty authority control information',conf[1])-- .. preview._warning({'The '..conf[1]..' id '..val..' is not valid.'})&lt;br /&gt;
	end&lt;br /&gt;
	return link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[==========================================================================]]&lt;br /&gt;
--[[                                   Main                                   ]]&lt;br /&gt;
--[[==========================================================================]]&lt;br /&gt;
function p.authorityControl(frame)&lt;br /&gt;
	local function resolveQID(qid)&lt;br /&gt;
		if qid then&lt;br /&gt;
			qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '')&lt;br /&gt;
			-- TODO: Remove call to mw.wikibase&lt;br /&gt;
			if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) then&lt;br /&gt;
				return qid&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local conf = config.config&lt;br /&gt;
	local parentArgs = frame:getParent().args&lt;br /&gt;
	local auxCats = ''&lt;br /&gt;
	local rct = false -- boolean to track if there are any links to be returned&lt;br /&gt;
	local qid,topic&lt;br /&gt;
	if namespace == 0 then&lt;br /&gt;
		qid = mw.ext.UnlinkedWikibase.getEntityId('enwiki')&lt;br /&gt;
	end&lt;br /&gt;
	if qid then -- article is connected to Wikidata item&lt;br /&gt;
		if parentArgs.qid and (resolveQID(parentArgs.qid) ~= qid) then -- non-matching qid parameter&lt;br /&gt;
			auxCats = auxCats .. needsAttention('D')&lt;br /&gt;
		end&lt;br /&gt;
	else -- page is not connected to any Wikidata item&lt;br /&gt;
		qid = resolveQID(parentArgs.qid) -- check qid parameter if no wikidata item is connected&lt;br /&gt;
		if qid then -- qid parameter is valid, set topic to display&lt;br /&gt;
			-- TODO: Remove call to mw.wikibase&lt;br /&gt;
			topic = mw.wikibase.getLabel(qid)&lt;br /&gt;
			if topic and (mw.ustring.lower(title.subpageText) == mw.ustring.lower(topic)) then -- suppress topic display if subpagename equals topic up to case change&lt;br /&gt;
				topic = nil&lt;br /&gt;
			end&lt;br /&gt;
		elseif parentArgs.qid and parentArgs.qid~='' then -- invalid qid has been supplied, add to tracking cat&lt;br /&gt;
			auxCats = auxCats .. needsAttention('Q')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- TODO: Remove call to mw.wikibase&lt;br /&gt;
	if topic and mw.wikibase.getSitelink(qid) then -- make wikilink to article&lt;br /&gt;
		-- TODO: Remove call to mw.wikibase&lt;br /&gt;
		topic = '[[' .. mw.wikibase.getSitelink(qid) .. '|' .. topic .. ']]'&lt;br /&gt;
	end&lt;br /&gt;
	local qids = {} -- setup any additional QIDs&lt;br /&gt;
	if parentArgs.additional and parentArgs.additional ~= '' then&lt;br /&gt;
		for _,v in ipairs(mw.text.split(parentArgs.additional,&amp;quot;%s*,%s*&amp;quot;)) do&lt;br /&gt;
			v = resolveQID(v)&lt;br /&gt;
			if v == qid then -- duplicate of qid parameter&lt;br /&gt;
				auxCats = auxCats .. needsAttention('R')&lt;br /&gt;
			end&lt;br /&gt;
			table.insert(qids,v)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local sections = {}&lt;br /&gt;
	local numsections = 0&lt;br /&gt;
	for _,_ in ipairs(config.sections) do numsections = numsections + 1 end&lt;br /&gt;
	for _ = 1,#qids+numsections do table.insert(sections,{}) end&lt;br /&gt;
	local qslink = '' -- setup link to add using QuickStatements&lt;br /&gt;
&lt;br /&gt;
	-- check which identifiers to show/suppress in template&lt;br /&gt;
	local show = {} -- setup list&lt;br /&gt;
	local showall = true&lt;br /&gt;
	local function stripP(pid)&lt;br /&gt;
		if pid:match(&amp;quot;^[Pp]%d+$&amp;quot;) then&lt;br /&gt;
			pid = mw.ustring.gsub(pid,'[Pp]','') --strip P from property number&lt;br /&gt;
		end&lt;br /&gt;
		if pid:match(&amp;quot;^%d+$&amp;quot;) then&lt;br /&gt;
			pid = tonumber(pid)&lt;br /&gt;
		end&lt;br /&gt;
		return pid&lt;br /&gt;
	end&lt;br /&gt;
	local function addshowlist(list)&lt;br /&gt;
		if list and list ~= '' then&lt;br /&gt;
			for _,v in ipairs(mw.text.split(string.lower(list),&amp;quot;%s*,%s*&amp;quot;)) do&lt;br /&gt;
				v = stripP(v)&lt;br /&gt;
				if type(v) == 'string' then -- e.g. show=arts to use whitelist&lt;br /&gt;
					if config.whitelists[v] then&lt;br /&gt;
						for _,w in ipairs(config.whitelists[v].properties) do&lt;br /&gt;
							show[w] = true&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				else -- e.g. show=214 to show one particular property&lt;br /&gt;
					show[v] = true&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			showall = false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	addshowlist(frame.args.show) -- check show= parameter on wrapper template&lt;br /&gt;
	addshowlist(parentArgs.show or parentArgs.country) -- check show parameter on article template&lt;br /&gt;
	if parentArgs.suppress then&lt;br /&gt;
		local suppresslist = mw.text.split(parentArgs.suppress,&amp;quot;%s*,%s*&amp;quot;) -- split parameter by comma&lt;br /&gt;
		for _,v in ipairs(suppresslist) do&lt;br /&gt;
			v=stripP(string.upper(v))&lt;br /&gt;
			show[v] = false&lt;br /&gt;
			auxCats = auxCats .. '[[Category:Articles with suppressed authority control identifiers]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local function makeSections(qid,addit)&lt;br /&gt;
		local tval = {}&lt;br /&gt;
		local function parameter_is_used(property)&lt;br /&gt;
			local used = false&lt;br /&gt;
			if property then&lt;br /&gt;
				if tval[property] then&lt;br /&gt;
					if tval[property][1] then&lt;br /&gt;
						used = true&lt;br /&gt;
					end&lt;br /&gt;
				elseif tval[property] == false then -- property has been manually suppressed&lt;br /&gt;
					used = true&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return used&lt;br /&gt;
		end&lt;br /&gt;
		for _, params in ipairs(conf) do&lt;br /&gt;
			tval[params.property] = getIdsFromWikidata(qid, 'P' .. params.property) -- setup table for values with property number as key&lt;br /&gt;
			local showb = true&lt;br /&gt;
			if (show[params.property] == nil) and (show[string.upper(params[1])] == nil ) then&lt;br /&gt;
				showb = showall -- if not specified then depends on showall&lt;br /&gt;
			elseif (show[params.property] == false) or (show[string.upper(params[1])] == false) then -- if either are false then id will be suppressed&lt;br /&gt;
				showb = false&lt;br /&gt;
			end&lt;br /&gt;
			if not showb then&lt;br /&gt;
				tval[params.property] = false -- indicates the identifier is suppressed&lt;br /&gt;
			elseif not addit then&lt;br /&gt;
				local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]&lt;br /&gt;
				if val and val ~= '' then -- add local parameter to list if not already in&lt;br /&gt;
					local bnew = true&lt;br /&gt;
					for _, w in pairs(tval[params.property]) do&lt;br /&gt;
						if val == w.id then&lt;br /&gt;
							bnew = false&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					if bnew then -- add new value to table&lt;br /&gt;
						if qid then&lt;br /&gt;
							qslink = qslink .. '%7C%7C' .. qid .. '%7CP' .. params.property .. '%7C%22' .. mw.uri.encode(val,&amp;quot;PATH&amp;quot;) .. '%22%7CS143%7CQ328'&lt;br /&gt;
						end&lt;br /&gt;
						table.insert(tval[params.property],{id=val,name=''})&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			local suppress = false&lt;br /&gt;
			if params.suppressedbyproperty then&lt;br /&gt;
				for _,sc in ipairs(params.suppressedbyproperty) do&lt;br /&gt;
					if parameter_is_used(sc) then&lt;br /&gt;
						suppress = true&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if tval[params.property] ~= false and not suppress then&lt;br /&gt;
				local tlinks = {} -- setup table for links&lt;br /&gt;
				local nextIdVal = 1&lt;br /&gt;
				local row = ''&lt;br /&gt;
				for _,val in ipairs(tval[params.property]) do&lt;br /&gt;
					local link = _makelink(params,val,nextIdVal,qid)&lt;br /&gt;
					row = row .. link&lt;br /&gt;
					table.insert(tlinks,link)&lt;br /&gt;
					nextIdVal = nextIdVal + 1&lt;br /&gt;
				end&lt;br /&gt;
				if nextIdVal&amp;gt;=2 then&lt;br /&gt;
					row = row .. '\n'&lt;br /&gt;
					table.insert(sections[addit or params.section],row)&lt;br /&gt;
					rct = true&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local function pencil(qid)&lt;br /&gt;
		if not qid then&lt;br /&gt;
			return ''&lt;br /&gt;
		end&lt;br /&gt;
		local args = { pid = 'identifiers' } -- #target the list of identifiers&lt;br /&gt;
		args.qid = qid&lt;br /&gt;
		return require('Module:EditAtWikidata')._showMessage(args)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	makeSections(qid,false)&lt;br /&gt;
	for c = 1,#qids do&lt;br /&gt;
		makeSections(qids[c],numsections+c)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--configure Navbox&lt;br /&gt;
	local outString = ''&lt;br /&gt;
	if rct then -- there is at least one link to display&lt;br /&gt;
		local Navbox = require('Module:Navbox')&lt;br /&gt;
		local sect,lastsect = 0,0&lt;br /&gt;
		local navboxArgs = {&lt;br /&gt;
			name  = 'Authority control',&lt;br /&gt;
			navboxclass = 'authority-control',&lt;br /&gt;
			bodyclass = 'hlist',&lt;br /&gt;
			state = parentArgs.state or 'autocollapse',&lt;br /&gt;
			navbar = 'off'&lt;br /&gt;
		}&lt;br /&gt;
		for c=1,numsections+#qids do&lt;br /&gt;
			if #sections[c] ~= 0 then -- section is non-empty&lt;br /&gt;
				sect = sect + 1&lt;br /&gt;
				lastsect = c&lt;br /&gt;
				local sectname&lt;br /&gt;
				if c &amp;lt;= numsections then -- regular section&lt;br /&gt;
					sectname = config.sections[c].name&lt;br /&gt;
				else -- section from additional qid&lt;br /&gt;
					-- TODO: Remove call to mw.wikibase&lt;br /&gt;
					sectname = mw.wikibase.getLabel(qids[c-numsections]) .. pencil(qids[c-numsections])&lt;br /&gt;
				end&lt;br /&gt;
				navboxArgs['group' .. c] = sectname&lt;br /&gt;
				navboxArgs['list' .. c] = table.concat(sections[c])&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		local aclink = '[[Help:Authority control|Authority control]]'&lt;br /&gt;
		if qslink ~= '' then&lt;br /&gt;
			qslink = '&amp;lt;span class=&amp;quot;qs autoconfirmed-show&amp;quot;&amp;gt;&amp;amp;#32;[[File:Commons to Wikidata QuickStatements.svg|20px|link=https://quickstatements.toolforge.org/#/v1=' .. qslink .. '|Add values to Wikidata.]]&amp;lt;/span&amp;gt;'&lt;br /&gt;
		end&lt;br /&gt;
		if topic then -- display in expanded form with topic&lt;br /&gt;
			navboxArgs.title = aclink .. ' &amp;amp;ndash; ' .. topic .. pencil(qid) .. qslink&lt;br /&gt;
		elseif sect == 1 then -- special display when only one section&lt;br /&gt;
			if lastsect &amp;lt;= numsections then&lt;br /&gt;
				if config.sections[lastsect].hidelabelwhenalone then -- no special label when only general or other IDs are present&lt;br /&gt;
					navboxArgs['group' .. lastsect] = aclink .. pencil(qid) .. qslink&lt;br /&gt;
				else -- other regular section&lt;br /&gt;
					navboxArgs['group' .. lastsect] = aclink .. ': ' .. config.sections[lastsect].name .. pencil(qid) .. qslink&lt;br /&gt;
				end&lt;br /&gt;
			else -- section from additional qid&lt;br /&gt;
				navboxArgs['group' .. lastsect] = aclink .. ': ' .. navboxArgs['group' .. lastsect] .. qslink&lt;br /&gt;
			end&lt;br /&gt;
		else -- add title to navbox&lt;br /&gt;
			navboxArgs.title = aclink .. pencil(qid) .. qslink&lt;br /&gt;
		end&lt;br /&gt;
		outString = Navbox._navbox(navboxArgs)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if parentArgs.state then&lt;br /&gt;
		if (parentArgs.state ~= 'collapsed') and (parentArgs.state ~= 'expanded') and (parentArgs.state ~= 'autocollapse') then --invalid state parameter&lt;br /&gt;
			auxCats = auxCats .. needsAttention('S')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if testcases then&lt;br /&gt;
		auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--out&lt;br /&gt;
	outString = outString..auxCats&lt;br /&gt;
	if namespace ~= 0 then&lt;br /&gt;
		outString = mw.ustring.gsub(outString,'(%[%[)(Category:Articles)([^%|%]]+)%|?[^%|%]]*(%]%])','%1:%2%3%4')&lt;br /&gt;
		outString = mw.ustring.gsub(outString,'(%[%[)(Category:All articles)([^%|%]]+)%|?[^%|%]]*(%]%])','%1:%2%3%4')&lt;br /&gt;
	end&lt;br /&gt;
	local check = require('Module:Check for unknown parameters')._check&lt;br /&gt;
	local sortkey&lt;br /&gt;
	if namespace == 0 then&lt;br /&gt;
		sortkey = '*' .. title.text&lt;br /&gt;
	else&lt;br /&gt;
		sortkey = title.fullText&lt;br /&gt;
	end&lt;br /&gt;
	local tracking = check({&lt;br /&gt;
		['unknown']='[[Category:Pages using authority control with parameters|' .. sortkey .. ']]',&lt;br /&gt;
		['preview']='Page using [[Template:Authority control]] with &amp;quot;_VALUE_&amp;quot;, please move this to Wikidata.',&lt;br /&gt;
		'show', 'country', 'suppress', 'additional', 'qid', 'state'&lt;br /&gt;
		}, parentArgs)&lt;br /&gt;
	if namespace == 0 -- mainspace&lt;br /&gt;
		or namespace == 14 -- category&lt;br /&gt;
		or namespace == 2 -- user&lt;br /&gt;
		or namespace == 118 then -- draft&lt;br /&gt;
		outString = outString .. tracking&lt;br /&gt;
	end&lt;br /&gt;
	return outString&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.makelink = function(conf,val,nextid,qid)&lt;br /&gt;
	return _makelink(conf,val,nextid,qid)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Template:UnlinkedWikibaseTest&amp;diff=5304661</id>
		<title>Template:UnlinkedWikibaseTest</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Template:UnlinkedWikibaseTest&amp;diff=5304661"/>
		<updated>2023-05-05T12:57:08Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Created page with &amp;quot;{{#invoke: UnlinkedWikibaseTest | getCurrentWikidataId }}&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke: UnlinkedWikibaseTest | getCurrentWikidataId }}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Taxonbar/candidate&amp;diff=5304659</id>
		<title>Module:Taxonbar/candidate</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Taxonbar/candidate&amp;diff=5304659"/>
		<updated>2023-05-05T12:53:05Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.check(frame)&lt;br /&gt;
	local taxonbarExists = require('Module:Taxonbar/exists').check&lt;br /&gt;
	if taxonbarExists(frame) then&lt;br /&gt;
		return ''&lt;br /&gt;
	else&lt;br /&gt;
		local resolveEntity = require( 'Module:ResolveEntityId' )&lt;br /&gt;
		local currentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
		local currentItem = nil&lt;br /&gt;
		local categories = {&lt;br /&gt;
			'[[Category:Taxobox articles possibly missing a taxonbar]]' --unset if acceptable or unacceptable found&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		--preliminary exclusion criteria&lt;br /&gt;
		if string.match( currentTitle.text, '^List of ') then&lt;br /&gt;
			return ''&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		--find Wikidata item&lt;br /&gt;
		if currentTitle.namespace == 0 then --mainspace&lt;br /&gt;
			local currentEntityId = mw.ext.UnlinkedWikibase.getEntityId('enwiki')&lt;br /&gt;
			if resolveEntity._id(currentEntityId) then&lt;br /&gt;
				currentItem = mw.ext.UnlinkedWikibase.getEntity(currentEntityId)&lt;br /&gt;
			else --currentEntityId == nil/unresolvable&lt;br /&gt;
				return categories[1]&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return ''&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if currentItem then --currentItem should not be nil here, but check just in case&lt;br /&gt;
			--determine if {{Taxonbar}} is *possibly* missing, or *definitely* missing&lt;br /&gt;
			local acceptableInstanceOf_All = { --copied from [[Module:Taxonbar]]&lt;br /&gt;
				['Q16521'] = 'taxon',                      --strict&lt;br /&gt;
				['Q310890'] = 'monotypic taxon',           --strict&lt;br /&gt;
				['Q2568288'] = 'ichnotaxon',               --strict&lt;br /&gt;
				['Q23038290'] = 'fossil taxon',            --strict&lt;br /&gt;
				['Q47487597'] = 'monotypic fossil taxon',  --strict&lt;br /&gt;
				['Q42621'] = 'hybrid',                     --lax&lt;br /&gt;
				['Q235536'] = 'incertae sedis',            --lax&lt;br /&gt;
				['Q713623'] = 'clade',                     --lax&lt;br /&gt;
				['Q848328'] = 'serotype',                  --lax&lt;br /&gt;
				['Q857968'] = 'candidatus',                --lax&lt;br /&gt;
				['Q17487588'] = 'unavailable combination', --lax&lt;br /&gt;
			}&lt;br /&gt;
			local unacceptableInstanceOf = {&lt;br /&gt;
				['Q913170'] = 'trivial name',&lt;br /&gt;
				['Q55983715'] = 'group of organisms known by one particular common name',&lt;br /&gt;
				['Q937228'] = 'property',&lt;br /&gt;
				['Q14712'] = 'drupe',&lt;br /&gt;
				['Q163233'] = 'compound drupe',&lt;br /&gt;
				['Q747463'] = 'compound fruit',&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			local acceptableCount = 0&lt;br /&gt;
			local unacceptableCount = 0&lt;br /&gt;
			for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance of&lt;br /&gt;
				local instanceOf = instanceOfState.mainsnak.datavalue.value.id&lt;br /&gt;
				if acceptableInstanceOf_All[instanceOf] then&lt;br /&gt;
					acceptableCount = acceptableCount + 1&lt;br /&gt;
				elseif unacceptableInstanceOf[instanceOf] then&lt;br /&gt;
					unacceptableCount = unacceptableCount + 1&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			for _, subclassOfState in pairs ( currentItem:getBestStatements('P279') ) do --subclass of&lt;br /&gt;
				local subclassOf = subclassOfState.mainsnak.datavalue.value.id&lt;br /&gt;
				if acceptableInstanceOf_All[subclassOf] then&lt;br /&gt;
					acceptableCount = acceptableCount + 1&lt;br /&gt;
				elseif unacceptableInstanceOf[subclassOf] then&lt;br /&gt;
					unacceptableCount = unacceptableCount + 1&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if acceptableCount &amp;gt; 0 then&lt;br /&gt;
				categories[1] = ''&lt;br /&gt;
				categories[2] = '[[Category:Taxobox articles missing a taxonbar]]'&lt;br /&gt;
			elseif unacceptableCount &amp;gt; 0 then&lt;br /&gt;
				categories[1] = ''&lt;br /&gt;
				categories[2] = ''&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			return table.concat(categories)&lt;br /&gt;
			&lt;br /&gt;
		else&lt;br /&gt;
			return ''&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=User:Wikibase-admin&amp;diff=5304646</id>
		<title>User:Wikibase-admin</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=User:Wikibase-admin&amp;diff=5304646"/>
		<updated>2023-04-18T06:01:26Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Taxonbar|from=Q19}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Taxonbar|from=Q19088}}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.kidzsearch.com/w/index.php?title=Module:Infobox_military_conflict/styles.css&amp;diff=5304588</id>
		<title>Module:Infobox military conflict/styles.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.kidzsearch.com/w/index.php?title=Module:Infobox_military_conflict/styles.css&amp;diff=5304588"/>
		<updated>2023-04-18T05:50:10Z</updated>

		<summary type="html">&lt;p&gt;Wikibase-admin: Created page with &amp;quot;@media all and (min-width:720px) { 	.desktop-float-right { 		box-sizing: border-box; 		float: right; 		clear: right; 	} }&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;@media all and (min-width:720px) {&lt;br /&gt;
	.desktop-float-right {&lt;br /&gt;
		box-sizing: border-box;&lt;br /&gt;
		float: right;&lt;br /&gt;
		clear: right;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Wikibase-admin</name></author>
	</entry>
</feed>