<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki3d.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACite_IUCN</id>
	<title>Module:Cite IUCN - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki3d.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACite_IUCN"/>
	<link rel="alternate" type="text/html" href="https://mediawiki3d.org/index.php?title=Module:Cite_IUCN&amp;action=history"/>
	<updated>2026-04-28T08:30:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://mediawiki3d.org/index.php?title=Module:Cite_IUCN&amp;diff=3413&amp;oldid=prev</id>
		<title>OpenDEM 1: 1 revision imported from :wikipedia:en:Module:Cite_IUCN</title>
		<link rel="alternate" type="text/html" href="https://mediawiki3d.org/index.php?title=Module:Cite_IUCN&amp;diff=3413&amp;oldid=prev"/>
		<updated>2025-08-17T14:24:21Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported from &lt;a href=&quot;https://en.wikipedia.org/wiki/en:Module:Cite_IUCN&quot; class=&quot;extiw&quot; title=&quot;wikipedia:en:Module:Cite IUCN&quot;&gt;wikipedia:en:Module:Cite_IUCN&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:24, 17 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wiki3d:diff:1.41:old-3412:rev-3413 --&gt;
&lt;/table&gt;</summary>
		<author><name>OpenDEM 1</name></author>
	</entry>
	<entry>
		<id>https://mediawiki3d.org/index.php?title=Module:Cite_IUCN&amp;diff=3412&amp;oldid=prev</id>
		<title>wikipedia:en&gt;Jonesey95: Fix Linter errors. Close span tag in all circumstances. See &quot;Vachellia hindsii&quot; entry at User:Neb/sandbox for an example.</title>
		<link rel="alternate" type="text/html" href="https://mediawiki3d.org/index.php?title=Module:Cite_IUCN&amp;diff=3412&amp;oldid=prev"/>
		<updated>2024-11-07T19:31:52Z</updated>

		<summary type="html">&lt;p&gt;Fix &lt;a href=&quot;/index.php/Special:LintErrors&quot; class=&quot;new&quot; title=&quot;Special:LintErrors (page does not exist)&quot;&gt;Linter&lt;/a&gt; errors. Close span tag in all circumstances. See &amp;quot;Vachellia hindsii&amp;quot; entry at &lt;a href=&quot;/index.php?title=User:Neb/sandbox&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Neb/sandbox (page does not exist)&quot;&gt;User:Neb/sandbox&lt;/a&gt; for an example.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;#039;strict&amp;#039;);&lt;br /&gt;
local getArgs = require (&amp;#039;Module:Arguments&amp;#039;).getArgs;&lt;br /&gt;
&lt;br /&gt;
local amendment_pattern = &amp;#039;%s*%(amended version of (%d%d%d%d) assessment%)&amp;#039;;&lt;br /&gt;
local errata_pattern = &amp;#039;%s*%(errata version published in (%d%d%d%d)%)&amp;#039;;&lt;br /&gt;
local green_status_pattern = &amp;#039;%s*%((Green Status assessment)%)&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I U C N _ I D E N T I F I E R S _ G E T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
cs1|2 templates cite single sources;  when the identifiers in |doi=, |id=, and |page= are different from each other&lt;br /&gt;
then the template is attempting to cite multiple sources.  This function evaluates the identifier portions of these&lt;br /&gt;
parameters. returns seven values: identifyier parts (or nil when parameter not used) and a message (nil on success,&lt;br /&gt;
error message else)&lt;br /&gt;
&lt;br /&gt;
the identifier portions of the several parameters must be properly formed&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function iucn_identifiers_get (args, error_msgs_t)&lt;br /&gt;
	local doi_taxon_ID, doi_assesment_ID&lt;br /&gt;
	local page_taxon_ID, page_assesment_ID&lt;br /&gt;
	local url_taxon_ID, url_assesment_ID&lt;br /&gt;
&lt;br /&gt;
	if args.doi then&lt;br /&gt;
		local lang_tag&lt;br /&gt;
		doi_taxon_ID, doi_assesment_ID, lang_tag = args.doi:match (&amp;#039;[Tt](%d+)[Aa](%d+)%.(%l%l)$&amp;#039;)&lt;br /&gt;
		if not doi_taxon_ID or not ({[&amp;#039;en&amp;#039;] = true, [&amp;#039;es&amp;#039;] = true, [&amp;#039;fr&amp;#039;] = true, [&amp;#039;pt&amp;#039;] = true})[lang_tag] then&lt;br /&gt;
			table.insert (error_msgs_t, &amp;#039;malformed |doi= identifier&amp;#039;);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if args.page then&lt;br /&gt;
		page_taxon_ID, page_assesment_ID = args.page:match (&amp;#039;^[eE]%.[Tt](%d+)[Aa](%d+)$&amp;#039;)&lt;br /&gt;
		if not page_taxon_ID then&lt;br /&gt;
			table.insert (error_msgs_t, &amp;#039;malformed |page= identifier&amp;#039;);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if args.url then&lt;br /&gt;
		if args.url:match (&amp;#039;https://www.iucnredlist.org/species/&amp;#039;) then			-- must be a &amp;#039;new-form&amp;#039; url&lt;br /&gt;
			url_taxon_ID, url_assesment_ID = args.url:match (&amp;#039;/species/(%d+)/(%d+)&amp;#039;)&lt;br /&gt;
			if not url_taxon_ID then&lt;br /&gt;
				table.insert (error_msgs_t, &amp;#039;malformed |url= identifier&amp;#039;);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not error_msgs_t[1] then&lt;br /&gt;
		if doi_taxon_ID and page_taxon_ID then&lt;br /&gt;
			if (doi_taxon_ID ~= page_taxon_ID or ((doi_assesment_ID ~= page_assesment_ID) and not args.errata)) then&lt;br /&gt;
				table.insert (error_msgs_t, &amp;#039;|doi= / |page= mismatch&amp;#039;);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if doi_taxon_ID and url_taxon_ID then&lt;br /&gt;
			if (doi_taxon_ID ~= url_taxon_ID or ((doi_assesment_ID ~= url_assesment_ID) and not args.errata)) then&lt;br /&gt;
				table.insert (error_msgs_t, &amp;#039;|doi= / |url= mismatch&amp;#039;);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if page_taxon_ID and url_taxon_ID then&lt;br /&gt;
			if (page_taxon_ID ~= url_taxon_ID or ((page_assesment_ID ~= url_assesment_ID) and not args.errata)) then&lt;br /&gt;
				table.insert (error_msgs_t, &amp;#039;|page= / |url= mismatch&amp;#039;);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return doi_taxon_ID, doi_assesment_ID, page_taxon_ID, page_assesment_ID;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I U C N _ V O L U M E _ C H E C K &amp;gt;--------------------------------------------&lt;br /&gt;
&lt;br /&gt;
compares volume in |volume= (if present) against year in |date= or |year= (if present) against volume in |doi= (if present)&lt;br /&gt;
&lt;br /&gt;
returns nil if all that are present are correct; message else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function iucn_volume_check (args, maint_msgs_t)&lt;br /&gt;
	local vol = args.volume;&lt;br /&gt;
	local date = args.date or args.year;&lt;br /&gt;
	local doi = args.doi and args.doi:match (&amp;#039;[Ii][Uu][Cc][Nn]%.[Uu][Kk]%.(%d%d%d%d)&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	if vol and date and (vol ~= date) then&lt;br /&gt;
		table.insert (maint_msgs_t, &amp;#039;|volume= / |date= mismatch&amp;#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if vol and doi and ((vol ~= doi) and not args.amends) then&lt;br /&gt;
		table.insert (maint_msgs_t, &amp;#039;|volume= / |doi= mismatch&amp;#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if date and doi and ((doi ~= date) and not args.amends) then&lt;br /&gt;
		table.insert (maint_msgs_t, &amp;#039;|date= / |doi= mismatch&amp;#039;);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Wraps {{cite journal}}:&lt;br /&gt;
     takes cite journal parameters but updates old style url using electronic page number&lt;br /&gt;
     page should be in format e.T13922A45199653&lt;br /&gt;
     the url uses                13922/45199653&lt;br /&gt;
     so we need to extract the number between T and A (taxon ID) and the number after A (assessment ID)&lt;br /&gt;
     the target url is https://www.iucnredlist.org/species/13922/45199653&lt;br /&gt;
     usage: {{#invoke:iucn|cite}}&lt;br /&gt;
     template: {{Template:Cite iucn}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function cite (frame)&lt;br /&gt;
	local error_msgs_t = {};													-- holds error messages for rendering&lt;br /&gt;
	local maint_msgs_t = {};														-- holds hidden maint messages for rendering&lt;br /&gt;
	local namespace = mw.title.getCurrentTitle().namespace;						-- used for categorization&lt;br /&gt;
	local args = getArgs (frame);												-- local copy of template arguments&lt;br /&gt;
&lt;br /&gt;
	if args.title and (args.title:match (errata_pattern) or args.title:match (amendment_pattern)) then&lt;br /&gt;
		table.insert (error_msgs_t, &amp;#039;title has extraneous text&amp;#039;);					-- announce that this template has has errata or amendment text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local doi_taxon_ID, doi_assesment_ID;										-- all of these contain the same identifying info in slightly&lt;br /&gt;
	local page_taxon_ID, page_assesment_ID;										-- different forms. when any combination of these is present,&lt;br /&gt;
&lt;br /&gt;
	doi_taxon_ID, doi_assesment_ID, page_taxon_ID, page_assesment_ID = iucn_identifiers_get (args, error_msgs_t);&lt;br /&gt;
&lt;br /&gt;
	args.id = nil																-- unset; not supported&lt;br /&gt;
&lt;br /&gt;
	local url_taxon_ID = page_taxon_ID or doi_taxon_ID;							-- select for use in url that we will create&lt;br /&gt;
	local url_assesment_ID = page_assesment_ID  or doi_assesment_ID;&lt;br /&gt;
	&lt;br /&gt;
	local url = args.url;&lt;br /&gt;
	if url then&lt;br /&gt;
		if url:find (&amp;#039;iucnredlist.org/details/&amp;#039;, 1, true) then					-- old-form url&lt;br /&gt;
			if url_taxon_ID then												-- when there is an identifier&lt;br /&gt;
				url = nil														-- unset; we&amp;#039;ll create new url below&lt;br /&gt;
			else																-- here when old-form but no identifier that we can use to create new url&lt;br /&gt;
				args.url = args.url:gsub (&amp;quot;http:&amp;quot;, &amp;quot;https:&amp;quot;)					-- sometimes works with redirect on iucn site&lt;br /&gt;
			end&lt;br /&gt;
			table.insert (maint_msgs_t, &amp;#039;old-form url&amp;#039;)							-- announce that this template has has an old-form url&lt;br /&gt;
		elseif url:find (&amp;#039;iucnredlist.org/species/&amp;#039;, 1, true) then				-- new-form url&lt;br /&gt;
--			table.insert (maint_msgs_t, &amp;#039;new-form url&amp;#039;)				--TODO: restore this line when most new-form urls have been removed from article space		-- announce that this template has has an new-form url&lt;br /&gt;
		else&lt;br /&gt;
			table.insert (error_msgs_t, &amp;#039;unknown url&amp;#039;)							-- emit error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not url then																-- when no url or unset old-form url&lt;br /&gt;
		if url_taxon_ID then&lt;br /&gt;
			args.url = &amp;quot;https://www.iucnredlist.org/species/&amp;quot; .. url_taxon_ID .. &amp;#039;/&amp;#039; .. url_assesment_ID&lt;br /&gt;
		else&lt;br /&gt;
			table.insert (error_msgs_t, &amp;#039;no identifier&amp;#039;)						-- emit error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- add journal if not provided (TODO decide if this should override provided value)&lt;br /&gt;
	if not args[&amp;#039;journal&amp;#039;] and not args[&amp;#039;work&amp;#039;] then&lt;br /&gt;
		args[&amp;#039;journal&amp;#039;] = &amp;quot;[[IUCN Red List|IUCN Red List of Threatened Species]]&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	iucn_volume_check (args, maint_msgs_t);										-- |volume=, |year= (|date=), |doi= must all refer to the same volume&lt;br /&gt;
&lt;br /&gt;
	if not args.volume and (args.year or args.date) then&lt;br /&gt;
		args.volume = args.year or args.date&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.errata then&lt;br /&gt;
		args[&amp;#039;orig-date&amp;#039;] = &amp;#039;errata version of &amp;#039; .. (args.year or args.date or args.volume) .. &amp;#039; assessment&amp;#039;;&lt;br /&gt;
		args.date = args.errata;												-- update publication data to errata year&lt;br /&gt;
		args.year = nil;														-- unset these as no longer needed&lt;br /&gt;
		args.errata = nil;&lt;br /&gt;
	elseif args.amends then&lt;br /&gt;
		args[&amp;#039;orig-date&amp;#039;] = &amp;#039;amended version of &amp;#039; .. args.amends .. &amp;#039; assessment&amp;#039;;&lt;br /&gt;
		args.amends = nil;														-- unset as no longer needed&lt;br /&gt;
	end&lt;br /&gt;
																				-- add free-to-read icon to mark a correctly formed doi&lt;br /&gt;
	args[&amp;#039;doi-access&amp;#039;] = args.doi and args.doi:match (&amp;#039;10%.2305/[Ii][Uu][Cc][Nn].+[Tt]%d+[Aa]%d+%.%a%a&amp;#039;) and &amp;#039;free&amp;#039; or nil&lt;br /&gt;
	&lt;br /&gt;
	local out_t = {};&lt;br /&gt;
	if error_msgs_t[1] then&lt;br /&gt;
		table.insert (out_t, &amp;#039; &amp;lt;span class=&amp;quot;error&amp;quot; style=&amp;quot;font-size:100%&amp;quot;&amp;gt;{{[[Template:cite iucn|cite iucn]]}}: error: &amp;#039;);&lt;br /&gt;
		table.insert (out_t, table.concat (error_msgs_t, &amp;#039;, &amp;#039;));&lt;br /&gt;
		table.insert (out_t, &amp;#039; ([[Template:Cite iucn#Error messages|help]])&amp;#039;);&lt;br /&gt;
		if (0 == namespace) then&lt;br /&gt;
			table.insert (out_t, &amp;#039;[[Category:cite IUCN errors]]&amp;#039;);&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (out_t, &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if maint_msgs_t[1] then&lt;br /&gt;
		table.insert (out_t, &amp;#039;&amp;lt;span class=&amp;quot;citation-comment&amp;quot; style=&amp;quot;display: none; color: #33aa33; margin-left: 0.3em;&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
		if not error_msgs_t[1] then&lt;br /&gt;
			table.insert (out_t, &amp;#039;{{[[Template:cite iucn|cite iucn]]}}: &amp;#039;)&lt;br /&gt;
			table.insert (out_t, table.concat (maint_msgs_t, &amp;#039;, &amp;#039;));&lt;br /&gt;
			table.insert (out_t, &amp;#039; ([[Template:Cite iucn#Maintenance messages|help]])&amp;#039;);&lt;br /&gt;
			if (0 == namespace) then&lt;br /&gt;
				table.insert (out_t, &amp;#039;[[Category:cite IUCN maint]]&amp;#039;);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (out_t, &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (not args[&amp;#039;doi-access&amp;#039;]) and (0 == namespace) then&lt;br /&gt;
		table.insert (out_t, &amp;#039;[[Category:cite IUCN without doi]]&amp;#039;);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return frame:expandTemplate{ title = &amp;#039;cite journal&amp;#039;, args = args } ..							-- the template&lt;br /&gt;
		table.concat (out_t);																		-- error and maint messages and categories&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; E T _ A L _ P A T T E R N S &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This adapted from Module:Citation/CS1/Configuration&lt;br /&gt;
&lt;br /&gt;
This table provides Lua patterns for the phrase &amp;quot;et al&amp;quot; and variants in a name.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local et_al_patterns = {&lt;br /&gt;
	&amp;quot;[;,]? *[\&amp;quot;&amp;#039;]*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\&amp;quot;&amp;#039;]*$&amp;quot;,						-- variations on the &amp;#039;et al&amp;#039; theme&lt;br /&gt;
	&amp;quot;[;,]? *[\&amp;quot;&amp;#039;]*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\&amp;quot;&amp;#039;]*$&amp;quot;,		-- variations on the &amp;#039;et alia&amp;#039;, &amp;#039;et alii&amp;#039; and &amp;#039;et aliae&amp;#039; themes (false positive &amp;#039;et aliie&amp;#039; unlikely to match)&lt;br /&gt;
	&amp;quot;[;,]? *%f[%a]and [Oo]thers&amp;quot;,												-- an alternative to et al.&lt;br /&gt;
	}&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;
This adapted from Module:Citation/CS1&lt;br /&gt;
&lt;br /&gt;
Evaluates the content of a name for variations on the theme of et al.  If found,&lt;br /&gt;
returns true; nil else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_etal (name)&lt;br /&gt;
	local etal;&lt;br /&gt;
&lt;br /&gt;
	if name then																-- name can be nil in which case just return&lt;br /&gt;
		name = name:gsub (&amp;#039;%b&amp;lt;&amp;gt;&amp;#039;, &amp;#039;&amp;#039;);											-- remove any html markup (typically &amp;lt;i&amp;gt;...&amp;lt;/i&amp;gt;)&lt;br /&gt;
		for _, pattern in ipairs (et_al_patterns) do							-- loop through all of the patterns&lt;br /&gt;
			if name:match (pattern) then										-- if this &amp;#039;et al&amp;#039; pattern is found in name&lt;br /&gt;
				return true;													-- has etal, so return true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A U T H O R _ L I S T _ M A K E &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
creates a list of individual |authorn= parameters from the list of names provided in the raw iucn citation.  names&lt;br /&gt;
must have the form: Surname, I. (more than one &amp;#039;I.&amp;#039; pair allowed but no spaces between I. pairs)&lt;br /&gt;
&lt;br /&gt;
assumes that parenthetical text at the end of the author-name-list is a collaboration&lt;br /&gt;
	Name, I.I., &amp;amp; Name, I.I. (Colaboration name)&lt;br /&gt;
&lt;br /&gt;
assumes that &amp;lt;i&amp;gt;et al.&amp;lt;/i&amp;gt; is the last name in a list of names&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
--local function author_names_get (raw_iucn_cite)&lt;br /&gt;
local function author_names_get (raw_iucn_cite, params_t)						-- EXPERIMENT&lt;br /&gt;
	local list = {};															-- table that holds name list parts&lt;br /&gt;
	local author_names = raw_iucn_cite:match (&amp;#039;^([^%d]-)%s+%d%d%d%d&amp;#039;);			-- extract author name-list from raw iucn citation&lt;br /&gt;
	local collaboration = author_names:match (&amp;#039;%s*(%b())$&amp;#039;);					-- get collaboration name if it exists&lt;br /&gt;
&lt;br /&gt;
	if collaboration then														-- when there is a colaboration&lt;br /&gt;
		collaboration = collaboration:gsub (&amp;#039;[%(%)]&amp;#039;, &amp;#039;&amp;#039;);						-- remove bounding parentheses&lt;br /&gt;
		author_names = author_names:gsub (&amp;#039;%s*(%b())$&amp;#039;, &amp;#039;&amp;#039;);					-- and remove collaboration from author-name-list&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local names = author_names:gsub (&amp;#039;%.?,?%s+&amp;amp;%s+&amp;#039;, &amp;#039;.|&amp;#039;);						-- replace &amp;#039;separators&amp;#039; (&amp;lt;optional dot&amp;gt;&amp;lt;optional comma&amp;gt;&amp;lt;space&amp;gt;&amp;lt;ampersand&amp;gt;&amp;lt;space&amp;gt;) with &amp;lt;dot&amp;gt;&amp;lt;pipe&amp;gt;&lt;br /&gt;
	names = names:gsub (&amp;#039;%.,%s*&amp;#039;, &amp;#039;.|&amp;#039;);										-- replace &amp;#039;separators&amp;#039; (&amp;lt;dot&amp;gt;&amp;lt;comma&amp;gt;&amp;lt;optional space&amp;gt;) with &amp;lt;dot&amp;gt;&amp;lt;pipe&amp;gt;&lt;br /&gt;
	names = names:gsub (&amp;#039;(%.%u),&amp;#039;, &amp;#039;%1.|&amp;#039;);										-- special case for when last initial is missing its trailing dot&lt;br /&gt;
	list = mw.text.split (names, &amp;#039;|&amp;#039;);											-- split the string on the pipes into entries in list{}&lt;br /&gt;
	&lt;br /&gt;
	if 0 == #list then&lt;br /&gt;
		params_t[&amp;#039;author&amp;#039;] = author_names;										-- EXPERIMENT&lt;br /&gt;
		return table.concat ({&amp;#039;|author=&amp;#039;, author_names}), params_t;				-- EXPERIMENT		-- no &amp;#039;names&amp;#039; of the proper form; return the original as a single |author= parameter&lt;br /&gt;
--		return table.concat ({&amp;#039;|author=&amp;#039;, author_names})						-- no &amp;#039;names&amp;#039; of the proper form; return the original as a single |author= parameter&lt;br /&gt;
	else&lt;br /&gt;
		for i, name in ipairs (list) do											-- spin through the list and &lt;br /&gt;
			if name_has_etal (name) then										-- if this name has some form of &amp;#039;et al&amp;#039;&lt;br /&gt;
				params_t[&amp;#039;display-authors&amp;#039;] = &amp;#039;etal&amp;#039;;							-- EXPERIMENT&lt;br /&gt;
				list[i] = &amp;#039;|display-authors=etal&amp;#039;;								-- add |dispaly-authors=etal parameter and &lt;br /&gt;
				break;															-- assume that the etal was the last &amp;#039;name&amp;#039; so stop processing names&lt;br /&gt;
			else&lt;br /&gt;
				params_t[&amp;#039;author&amp;#039; .. i] = name;									-- EXPERIMENT&lt;br /&gt;
				list[i] = table.concat ({&amp;#039;|author&amp;#039;, (i == 1) and &amp;#039;&amp;#039; or i, &amp;#039;=&amp;#039;, name});	-- add |authorn= parameter names; create |author= instead of |author1=&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if collaboration then&lt;br /&gt;
			params_t[&amp;#039;collaboration&amp;#039;] = collaboration;							-- EXPERIMENT&lt;br /&gt;
			table.insert (list, table.concat ({&amp;#039;|collaboration&amp;#039;, &amp;#039;=&amp;#039;, collaboration}));	-- add |collaboration= parameter&lt;br /&gt;
		end&lt;br /&gt;
		return table.concat (list, &amp;#039; &amp;#039;);										-- make a big string and return that&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T I T L E _ G E T &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
extract and format citation title; attempts to get the italic right&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;binomen&amp;#039;&amp;#039; (amended or errata title)&lt;br /&gt;
&amp;#039;&amp;#039;binomen&amp;#039;&amp;#039;&lt;br /&gt;
&amp;#039;&amp;#039;binomen&amp;#039;&amp;#039; ssp. &amp;#039;&amp;#039;subspecies&amp;#039;&amp;#039;&lt;br /&gt;
&amp;#039;&amp;#039;binomen&amp;#039;&amp;#039; subsp. &amp;#039;&amp;#039;subspecies&amp;#039;&amp;#039;&lt;br /&gt;
&amp;#039;&amp;#039;binomen&amp;#039;&amp;#039; var. &amp;#039;&amp;#039;variety&amp;#039;&amp;#039;&lt;br /&gt;
&amp;#039;&amp;#039;binomen&amp;#039;&amp;#039; subvar. &amp;#039;&amp;#039;subvariety&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
all of the above may have trailing amended or errata text in parentheses&lt;br /&gt;
&lt;br /&gt;
TODO: are there others?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function title_get (raw_iucn_cite)&lt;br /&gt;
	local title = raw_iucn_cite:match (&amp;#039;%d%d%d%d%.%s+(.-)%s*%. The IUCN Red List of Threatened Species&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	local patterns = {															-- tables of string.match patterns [1] and string.gsub patterns [2]&lt;br /&gt;
		{&amp;#039;(.-)%sssp%.%s+(.-)%s(%b())$&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; ssp. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039; %3&amp;quot;},				-- binomen ssp. subspecies (zoology) with errata or amended text&lt;br /&gt;
		{&amp;#039;(.-)%sssp%.%s+(.+)&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; ssp. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039;&amp;quot;},							-- binomen ssp. subspecies (zoology)&lt;br /&gt;
		{&amp;#039;(.-)%ssubsp%.%s+(.-)%s(%b())$&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; subsp. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039; %3&amp;quot;},			-- binomen subsp. subspecies (botany) with errata or amended text&lt;br /&gt;
		{&amp;#039;(.-)%ssubsp%.%s+(.+)&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; subsp. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039;&amp;quot;},						-- binomen subsp. subspecies (botany)&lt;br /&gt;
		{&amp;#039;(.-)%svar%.%s+(.-)%s+(%b())$&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; var. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039; %3&amp;quot;},				-- binomen var. variety (botany) with errata or amended text&lt;br /&gt;
		{&amp;#039;(.-)%svar%.%s+(.+)&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; var. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039;&amp;quot;},							-- binomen var. variety (botany)&lt;br /&gt;
		{&amp;#039;(.-)%ssubvar%.%s+(.-)%s(%b())$&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; subvar. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039; %3&amp;quot;},			-- binomen subvar. subvariety (botany) with errata or amended text&lt;br /&gt;
		{&amp;#039;(.-)%ssubvar%.%s+(.+)&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; subvar. &amp;#039;&amp;#039;%2&amp;#039;&amp;#039;&amp;quot;},						-- binomen subvar. subvariety (botany)&lt;br /&gt;
		{&amp;#039;(.-)%s*(%b())$&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039; %2&amp;quot;},										-- binomen with errata or amended text&lt;br /&gt;
		{&amp;#039;(.+)&amp;#039;, &amp;quot;&amp;#039;&amp;#039;%1&amp;#039;&amp;#039;&amp;quot;},														-- binomen&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for i, v in ipairs (patterns) do											-- spin through the patterns&lt;br /&gt;
		if title:match (v[1]) then												-- when a match&lt;br /&gt;
			title = title:gsub (v[1], v[2]);									-- add italics &lt;br /&gt;
			break;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
--	return table.concat ({&amp;#039; |title=&amp;#039;, title});									-- return the |title= parameter&lt;br /&gt;
	return title;																-- return the formatted title&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ C I T E _ I U C N &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
parses apart an iucn-format citation copied from their webpage and reformats that into a {{cite iucn}} template for substing&lt;br /&gt;
&lt;br /&gt;
automatic substing by User:AnomieBOT/docs/TemplateSubster&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_cite_iucn (frame)&lt;br /&gt;
	local args_t = getArgs (frame);&lt;br /&gt;
	local raw_iucn_cite = args_t[1];&lt;br /&gt;
&lt;br /&gt;
	local template_t = {&amp;#039;{{cite iucn &amp;#039;};										-- sequence that holds the {{cite iucn}} template as it is being assembled; for nowiki&amp;#039;d output&lt;br /&gt;
	local params_t = {};														-- table of parameter/value pairs for substing&lt;br /&gt;
	&lt;br /&gt;
	local year, volume, page, doi, accessdate;&lt;br /&gt;
&lt;br /&gt;
	year = raw_iucn_cite:match (&amp;#039;^%D+(%d%d%d%d)&amp;#039;);&lt;br /&gt;
	volume, page = raw_iucn_cite:match (&amp;#039;(%d%d%d%d):%s+(e%.T%d+A+%d+)%.%s?&amp;#039;);&lt;br /&gt;
	doi = raw_iucn_cite:match (&amp;#039;10%.2305/IUCN%.UK%.[%d%-]+%.RLTS%.T%d+A%d+%.%a%a&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	accessdate = raw_iucn_cite:match (&amp;#039;Accessed on (.-)%.?$&amp;#039;) or raw_iucn_cite:match (&amp;#039;Downloaded on (.-)%.?$&amp;#039;);	-- &amp;#039;Downloaded&amp;#039; → &amp;#039;Accessed&amp;#039; change occured December 2021;&lt;br /&gt;
	accessdate = accessdate:gsub (&amp;#039;^0&amp;#039;, &amp;#039;&amp;#039;);									-- strips leading 0 in day 01 January 2020 -&amp;gt; 1 January 2020&lt;br /&gt;
&lt;br /&gt;
	table.insert (template_t, author_names_get (raw_iucn_cite, params_t));		-- add author name parameters; as a single string to &amp;lt;template_t&amp;gt;; as individual entries to &amp;lt;params_t&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	table.insert (template_t, table.concat ({&amp;#039; |year=&amp;#039;, year}));				-- add formatted year&lt;br /&gt;
	params_t.year = year;&lt;br /&gt;
	&lt;br /&gt;
	local title = title_get (raw_iucn_cite);&lt;br /&gt;
	local type_p = title:match (green_status_pattern);&lt;br /&gt;
	if type_p then&lt;br /&gt;
		title = title:match (&amp;#039;^([^%(]+)%s*%(&amp;#039;);&lt;br /&gt;
		table.insert (template_t, table.concat ({&amp;#039; |type=&amp;#039;, type_p}));			-- add formatted errata&lt;br /&gt;
		params_t.type = type_p;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local errata = title:match (errata_pattern);								-- nil unless IUCN citation has errata annotation; else year that this errata published (|date=)&lt;br /&gt;
	if errata then&lt;br /&gt;
		table.insert (template_t, table.concat ({&amp;#039; |errata=&amp;#039;, errata}));		-- add formatted errata&lt;br /&gt;
		params_t.errata = errata;&lt;br /&gt;
		title = title:gsub (errata_pattern, &amp;#039;&amp;#039;);								-- remove errata annotation&lt;br /&gt;
	end&lt;br /&gt;
	local amends = title:match (amendment_pattern);								-- nil unless IUCN citation has amendment annotation; else year that this assessment amends (|orig-date=)&lt;br /&gt;
	if amends then&lt;br /&gt;
		table.insert (template_t, table.concat ({&amp;#039; |amends=&amp;#039;, amends}));		-- add year of assessment that this assessment amends&lt;br /&gt;
		params_t.amends = amends;&lt;br /&gt;
		title = title:gsub (amendment_pattern, &amp;#039;&amp;#039;);								-- remove amendment annotation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.insert (template_t, table.concat ({&amp;#039; |title=&amp;#039;, title}));				-- add formatted title&lt;br /&gt;
	params_t.title = title;&lt;br /&gt;
	table.insert (template_t, table.concat ({&amp;#039; |volume=&amp;#039;, volume}));			-- add formatted volume&lt;br /&gt;
	params_t.volume = volume;&lt;br /&gt;
	table.insert (template_t, table.concat ({&amp;#039; |page=&amp;#039;, page}));				-- add formatted page&lt;br /&gt;
	params_t.page = page;&lt;br /&gt;
	table.insert (template_t, table.concat ({&amp;#039; |doi=&amp;#039;, doi}));					-- add formatted doi&lt;br /&gt;
	params_t.doi = doi;&lt;br /&gt;
&lt;br /&gt;
	table.insert (template_t, table.concat ({&amp;#039; |access-date=&amp;#039;, accessdate}));	-- add formatted access-date&lt;br /&gt;
	params_t[&amp;#039;access-date&amp;#039;] = accessdate;&lt;br /&gt;
&lt;br /&gt;
	table.insert (template_t, &amp;#039;}}&amp;#039;);											-- close the template&lt;br /&gt;
&lt;br /&gt;
	if args_t[2] then															-- if anything in args_t[2], write a nowiki&amp;#039;d version that editors can copy into &amp;lt;ref&amp;gt; tags&lt;br /&gt;
		return frame:preprocess (table.concat ({&amp;#039;&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline=&amp;quot;1&amp;quot;&amp;gt;&amp;#039;, table.concat (template_t), &amp;#039;&amp;lt;/syntaxhighlight&amp;gt;&amp;#039;})); -- caveat lector: if left long enough anomiebot will subst this&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args_t[&amp;#039;ref&amp;#039;] then														-- enable subst of ref tags with name&lt;br /&gt;
		return frame:preprocess (&amp;#039;&amp;lt;ref name=&amp;#039; .. args_t[&amp;#039;ref&amp;#039;] .. &amp;#039;&amp;gt;&amp;#039; .. table.concat (template_t) .. &amp;#039;&amp;lt;/ref&amp;gt;&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return frame:preprocess (table.concat (template_t));						-- render {{cite iucn}} template; substable&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;
	cite = cite,&lt;br /&gt;
	make_cite_iucn = make_cite_iucn,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>wikipedia:en&gt;Jonesey95</name></author>
	</entry>
</feed>