<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thegoonshow.co.uk/wiki/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://www.thegoonshow.co.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ACite_iucn"/>
	<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Cite_iucn&amp;action=history"/>
	<updated>2026-05-14T00:48:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Cite_iucn&amp;diff=8755&amp;oldid=prev</id>
		<title>Kurt: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Cite_iucn&amp;diff=8755&amp;oldid=prev"/>
		<updated>2022-07-26T03:05:46Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:05, 25 July 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&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;/table&gt;</summary>
		<author><name>Kurt</name></author>
	</entry>
	<entry>
		<id>https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Cite_iucn&amp;diff=8754&amp;oldid=prev</id>
		<title>en&gt;Trappist the monk: attempt to detect and handle &lt;i&gt;et al.&lt;/i&gt;;</title>
		<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Cite_iucn&amp;diff=8754&amp;oldid=prev"/>
		<updated>2022-05-28T16:14:10Z</updated>

		<summary type="html">&lt;p&gt;attempt to detect and handle &amp;lt;i&amp;gt;et al.&amp;lt;/i&amp;gt;;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals');&lt;br /&gt;
local getArgs = require ('Module:Arguments').getArgs;&lt;br /&gt;
&lt;br /&gt;
local amendment_pattern = '%s*%(amended version of (%d%d%d%d) assessment%)';&lt;br /&gt;
local errata_pattern = '%s*%(errata version published in (%d%d%d%d)%)';&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)&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;
	local msg&lt;br /&gt;
	&lt;br /&gt;
	if args.doi then&lt;br /&gt;
		doi_taxon_ID, doi_assesment_ID = args.doi:match ('[Tt](%d+)[Aa](%d+)%.e[ns]$')&lt;br /&gt;
		if not doi_taxon_ID then&lt;br /&gt;
			msg = 'malformed |doi= identifier'&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 ('^[eE]%.[Tt](%d+)[Aa](%d+)$')&lt;br /&gt;
		if not page_taxon_ID then&lt;br /&gt;
			msg = 'malformed |page= identifier'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if args.url then&lt;br /&gt;
		if args.url:match ('https://www.iucnredlist.org/species/') then			-- must be a 'new-form' url&lt;br /&gt;
			url_taxon_ID, url_assesment_ID = args.url:match ('/species/(%d+)/(%d+)')&lt;br /&gt;
			if not url_taxon_ID then&lt;br /&gt;
				msg = 'malformed |url= identifier'&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not msg 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;
				msg = '|doi= / |page= mismatch'&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;
				msg = '|doi= / |url= mismatch'&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;
				msg = '|page= / |url= mismatch'&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if msg then&lt;br /&gt;
		msg = '&amp;lt;span class=&amp;quot;error&amp;quot; style=&amp;quot;font-size:100%&amp;quot;&amp;gt;{{cite iucn}}: error: ' .. msg .. ' ([[Template:Cite iucn|help]])&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return doi_taxon_ID, doi_assesment_ID, page_taxon_ID, page_assesment_ID, msg&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)&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 ('[Ii][Uu][Cc][Nn]%.[Uu][Kk]%.(%d%d%d%d)')&lt;br /&gt;
	local msg&lt;br /&gt;
	&lt;br /&gt;
	if vol and date then&lt;br /&gt;
		msg = (vol ~= date) and '|volume= / |date= mismatch' or msg&lt;br /&gt;
	end&lt;br /&gt;
	if vol and doi then&lt;br /&gt;
		msg = ((vol ~= doi) and not args.amends) and '|volume= / |doi= mismatch' or msg&lt;br /&gt;
	end&lt;br /&gt;
	if date and doi then&lt;br /&gt;
		msg = ((doi ~= date) and not args.amends) and '|date= / |doi= mismatch' or msg&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return msg&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 = {};														-- holds error messages for rendering&lt;br /&gt;
	local maint_msgs = {};														-- 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;
	local missing_title = not args.title										-- special case that results from script writing {{cite iucn}} template from bare iucn url&lt;br /&gt;
																				-- don't duplicate cs1|2 error message; don't duplicate {{cite iucn}} error cat&lt;br /&gt;
																				-- TODO: remove this when the error category has been cleared of missing title errors&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 (maint_msgs, 'title has extraneous text');					-- 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;
	local msg																	-- this holds error messages; nil on success&lt;br /&gt;
&lt;br /&gt;
	doi_taxon_ID, doi_assesment_ID, page_taxon_ID, page_assesment_ID, msg = iucn_identifiers_get (args);&lt;br /&gt;
	if msg then&lt;br /&gt;
		table.insert (error_msgs, msg);											-- malformed or mismatched identifiers&lt;br /&gt;
	end&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 ('iucnredlist.org/details/', 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'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, 'old-form url')							-- announce that this template has has an old-form url&lt;br /&gt;
		elseif url:find ('iucnredlist.org/species/', 1, true) then				-- new-form url&lt;br /&gt;
--			table.insert (maint_msgs, 'new-form url')				--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 (maint_msgs, 'unknown url')							-- announce that this template has has some sort of url we don't recognize&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 .. '/' .. url_assesment_ID&lt;br /&gt;
		else&lt;br /&gt;
			table.insert (maint_msgs, 'no identifier')							-- TODO: raise this to  error status?&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['journal'] and not args['work'] then&lt;br /&gt;
		args['journal'] = &amp;quot;[[IUCN Red List|IUCN Red List of Threatened Species]]&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	msg = iucn_volume_check (args);												-- |volume=, |year= (|date=), |doi= must all refer to the same volume&lt;br /&gt;
	if msg then&lt;br /&gt;
		table.insert (maint_msgs, msg);&lt;br /&gt;
	end&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['orig-date'] = 'errata version of ' .. (args.year or args.date or args.volume) .. ' assessment';&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['orig-date'] = 'amended version of ' .. args.amends .. ' assessment';&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['doi-access'] = args.doi and args.doi:match ('10%.2305/[Ii][Uu][Cc][Nn].+[Tt]%d+[Aa]%d+%.[Ee][NnSs]') and 'free' or nil&lt;br /&gt;
		&lt;br /&gt;
	return frame:expandTemplate{ title = 'cite journal', args = args } ..							-- the template&lt;br /&gt;
		(((0 == #error_msgs) and missing_title) and ('[[Category:cite iucn errors]]') or '') ..		-- special case to not duplicate cs1|2 err msg or cite iucn error cat&lt;br /&gt;
		((0 &amp;lt; #error_msgs) and table.concat (error_msgs, ', ') or '') ..							-- the error messages&lt;br /&gt;
		(((0 &amp;lt; #error_msgs) and (0 == namespace)) and ('[[Category:cite iucn errors]]') or '') ..	-- error category when in mainspace&lt;br /&gt;
		((0 &amp;lt; #maint_msgs) and ('&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;' .. table.concat (maint_msgs, ', ') .. '&amp;lt;/span&amp;gt;') or '') ..	-- the maint messages&lt;br /&gt;
		(((0 &amp;lt; #maint_msgs) and (0 == namespace)) and ('[[Category:cite iucn maint]]') or '')		-- maint category when in mainspace&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;']*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\&amp;quot;']*$&amp;quot;,						-- variations on the 'et al' theme&lt;br /&gt;
	&amp;quot;[;,]? *[\&amp;quot;']*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\&amp;quot;']*$&amp;quot;,		-- variations on the 'et alia', 'et alii' and 'et aliae' themes (false positive 'et aliie' 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 ('%b&amp;lt;&amp;gt;', '');											-- 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 'et al' 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 'I.' 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 list = {};															-- table that holds name list parts&lt;br /&gt;
	local author_names = raw_iucn_cite:match ('^([^%d]-)%s+%d%d%d%d');			-- extract author name-list from raw iucn citation&lt;br /&gt;
	local collaboration = author_names:match ('%s*(%b())$');					-- 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 ('[%(%)]', '');						-- remove bounding parentheses&lt;br /&gt;
		author_names = author_names:gsub ('%s*(%b())$', '');					-- and remove collaboration from author-name-list&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local names = author_names:gsub ('%.?,?%s+&amp;amp;%s+', '.|'):gsub ('%.,%s+', '.|');	-- replace 'separators' (&amp;lt;dot&amp;gt;&amp;lt;comma&amp;gt;&amp;lt;space&amp;gt; and &amp;lt;opt. dot&amp;gt;&amp;lt;opt. 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 ('(%.%u),', '%1.|');										-- special case for when last initial is missing its trailing dot&lt;br /&gt;
	list = mw.text.split (names, '|');											-- split the string on the pipes into entries in list{}&lt;br /&gt;
	&lt;br /&gt;
	if 0 == #list then&lt;br /&gt;
		return table.concat ({'|author=', author_names})						-- no 'names' 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 'et al'&lt;br /&gt;
				list[i] = '|display-authors=etal';								-- add |dispaly-authors=etal parameter and &lt;br /&gt;
				break;															-- assume that the etal was the last 'name' so stop processing names&lt;br /&gt;
			else&lt;br /&gt;
				list[i] = table.concat ({'|author', (i == 1) and '' or i, '=', 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;
			table.insert (list, table.concat ({'|collaboration', '=', collaboration}));	-- add |collaboration= parameter&lt;br /&gt;
		end&lt;br /&gt;
		return table.concat (list, ' ');										-- 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;
''binomen'' (amended or errata title)&lt;br /&gt;
''binomen''&lt;br /&gt;
''binomen'' ssp. ''subspecies''&lt;br /&gt;
''binomen'' subsp. ''subspecies''&lt;br /&gt;
''binomen'' var. ''variety''&lt;br /&gt;
''binomen'' subvar. ''subvariety''&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 ('%d%d%d%d%.%s+(.-)%s*%. The IUCN Red List of Threatened Species');&lt;br /&gt;
&lt;br /&gt;
	local patterns = {															-- tables of string.match patterns [1] and string.gsub patterns [2]&lt;br /&gt;
		{'(.-)%sssp%.%s+(.-)%s(%b())$', &amp;quot;''%1'' ssp. ''%2'' %3&amp;quot;},				-- binomen ssp. subspecies (zoology) with errata or amended text&lt;br /&gt;
		{'(.-)%sssp%.%s+(.+)', &amp;quot;''%1'' ssp. ''%2''&amp;quot;},							-- binomen ssp. subspecies (zoology)&lt;br /&gt;
		{'(.-)%ssubsp%.%s+(.-)%s(%b())$', &amp;quot;''%1'' subsp. ''%2'' %3&amp;quot;},			-- binomen subsp. subspecies (botany) with errata or amended text&lt;br /&gt;
		{'(.-)%ssubsp%.%s+(.+)', &amp;quot;''%1'' subsp. ''%2''&amp;quot;},						-- binomen subsp. subspecies (botany)&lt;br /&gt;
		{'(.-)%svar%.%s+(.-)%s+(%b())$', &amp;quot;''%1'' var. ''%2'' %3&amp;quot;},				-- binomen var. variety (botany) with errata or amended text&lt;br /&gt;
		{'(.-)%svar%.%s+(.+)', &amp;quot;''%1'' var. ''%2''&amp;quot;},							-- binomen var. variety (botany)&lt;br /&gt;
		{'(.-)%ssubvar%.%s+(.-)%s(%b())$', &amp;quot;''%1'' subvar. ''%2'' %3&amp;quot;},			-- binomen subvar. subvariety (botany) with errata or amended text&lt;br /&gt;
		{'(.-)%ssubvar%.%s+(.+)', &amp;quot;''%1'' subvar. ''%2''&amp;quot;},						-- binomen subvar. subvariety (botany)&lt;br /&gt;
		{'(.-)%s*(%b())$', &amp;quot;''%1'' %2&amp;quot;},										-- binomen with errata or amended text&lt;br /&gt;
		{'(.+)', &amp;quot;''%1''&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 ({' |title=', title});									-- return the |title= parameter&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 = getArgs (frame);&lt;br /&gt;
	local raw_iucn_cite = args[1];&lt;br /&gt;
&lt;br /&gt;
	local template = {'{{cite iucn '};											-- table that holds the {{cite iucn}} template as it is being assembled&lt;br /&gt;
	local year, volume, page, doi, accessdate;&lt;br /&gt;
&lt;br /&gt;
	year = raw_iucn_cite:match ('^%D+(%d%d%d%d)');&lt;br /&gt;
	volume, page = raw_iucn_cite:match ('(%d%d%d%d):%s+(e%.T%d+A+%d+)%.%s');&lt;br /&gt;
	doi = raw_iucn_cite:match ('10%.2305/IUCN%.UK%.[%d%-]+%.RLTS%.T%d+A%d+%.e[ns]');&lt;br /&gt;
&lt;br /&gt;
--	accessdate = raw_iucn_cite:match ('Downloaded on (.-)%.?$'):gsub ('^0', '');	-- strips leading 0 in day 01 January 2020 -&amp;gt; 1 January 2020&lt;br /&gt;
	accessdate = raw_iucn_cite:match ('Accessed on (.-)%.?$') or raw_iucn_cite:match ('Downloaded on (.-)%.?$');	-- 'Downloaded' → 'Accessed' change occured December 2021;&lt;br /&gt;
	accessdate = accessdate:gsub ('^0', '');									-- strips leading 0 in day 01 January 2020 -&amp;gt; 1 January 2020&lt;br /&gt;
&lt;br /&gt;
	table.insert (template, author_names_get (raw_iucn_cite));					-- add string of author name parameters&lt;br /&gt;
	table.insert (template, table.concat ({' |year=', year}));					-- add formatted year&lt;br /&gt;
	local title = title_get (raw_iucn_cite);&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, table.concat ({' |errata=', errata}));			-- add formatted errata&lt;br /&gt;
		title = title:gsub (errata_pattern, '');								-- 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, table.concat ({' |amends=', amends}));			-- add year of assessment that this assessment amends&lt;br /&gt;
		title = title:gsub (amendment_pattern, '');								-- remove amendment annotation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.insert (template, title);												-- add formatted title&lt;br /&gt;
	table.insert (template, table.concat ({' |volume=', volume}));				-- add formatted volume&lt;br /&gt;
	table.insert (template, table.concat ({' |page=', page}));					-- add formatted page&lt;br /&gt;
	table.insert (template, table.concat ({' |doi=', doi}));					-- add formatted doi&lt;br /&gt;
	table.insert (template, table.concat ({' |access-date=', accessdate}));		-- add formatted access-date&lt;br /&gt;
&lt;br /&gt;
	table.insert (template, '}}');												-- close the template&lt;br /&gt;
&lt;br /&gt;
	if args[2] then																-- if anything in args[2], write a nowiki'd version that editors can copy into &amp;lt;ref&amp;gt; tags&lt;br /&gt;
		return table.concat ({'&amp;lt;code&amp;gt;', frame:callParserFunction ('#tag:nowiki', table.concat (template)), '&amp;lt;/code&amp;gt;'})&lt;br /&gt;
	end&lt;br /&gt;
	if args['ref'] then                                                         -- enable subst of ref tags with name&lt;br /&gt;
		return '&amp;lt;ref name=' .. args['ref'] .. '&amp;gt;' .. table.concat (template) .. '&amp;lt;/ref&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat (template);												-- the subst'd version&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>en&gt;Trappist the monk</name></author>
	</entry>
</feed>