<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mindpowe.red/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AFootnotes</id>
	<title>Module:Footnotes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mindpowe.red/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AFootnotes"/>
	<link rel="alternate" type="text/html" href="https://mindpowe.red/wiki/index.php?title=Module:Footnotes&amp;action=history"/>
	<updated>2026-04-05T21:09:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://mindpowe.red/wiki/index.php?title=Module:Footnotes&amp;diff=1086&amp;oldid=prev</id>
		<title>WikiSysop: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://mindpowe.red/wiki/index.php?title=Module:Footnotes&amp;diff=1086&amp;oldid=prev"/>
		<updated>2020-08-25T19:07:01Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 19:07, 25 August 2020&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>WikiSysop</name></author>
		
	</entry>
	<entry>
		<id>https://mindpowe.red/wiki/index.php?title=Module:Footnotes&amp;diff=1085&amp;oldid=prev</id>
		<title>en&gt;Trappist the monk at 18:32, 23 May 2020</title>
		<link rel="alternate" type="text/html" href="https://mindpowe.red/wiki/index.php?title=Module:Footnotes&amp;diff=1085&amp;oldid=prev"/>
		<updated>2020-05-23T18:32:01Z</updated>

		<summary type="html">&lt;p&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;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R G S _ D E F A U L T &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
a table to specify initial values.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local args_default = {&lt;br /&gt;
	bracket_left = '',&lt;br /&gt;
	bracket_right = '',&lt;br /&gt;
	bracket_year_left = '',&lt;br /&gt;
	bracket_year_right = '',&lt;br /&gt;
	postscript = '',&lt;br /&gt;
	page = '',&lt;br /&gt;
	pages = '',&lt;br /&gt;
	location = '',&lt;br /&gt;
	page_sep = &amp;quot;, p.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
	pages_sep = &amp;quot;, pp.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
	ref = '',&lt;br /&gt;
	template = 'harv',															-- if template name not provided in {{#invoke:}} use this&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T A R G E T _ C H E C K &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for anchor_id (CITEREF name-list and year or text from |ref=) in anchor_id_list&lt;br /&gt;
&lt;br /&gt;
the 'no target' error may be suppressed with |ignore-err=yes when target cannot be found because target is inside&lt;br /&gt;
a template that wraps another template; 'multiple targets' error may not be suppressed&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function target_check (anchor_id, args)&lt;br /&gt;
	local namespace = mw.title.getCurrentTitle().namespace;&lt;br /&gt;
	local anchor_id_list_module = mw.loadData ('Module:Footnotes/anchor_id_list');&lt;br /&gt;
	local anchor_id_list = anchor_id_list_module.anchor_id_list;&lt;br /&gt;
	local article_whitelist = anchor_id_list_module.article_whitelist;&lt;br /&gt;
	local template_list = anchor_id_list_module.template_list;&lt;br /&gt;
	&lt;br /&gt;
	local whitelist_module = mw.loadData ('Module:Footnotes/whitelist');&lt;br /&gt;
	local whitelist = whitelist_module.whitelist;&lt;br /&gt;
	local special_patterns = whitelist_module.special_patterns;&lt;br /&gt;
	local DNB_special_patterns = whitelist_module.DNB_special_patterns;&lt;br /&gt;
	local DNB_template_names = whitelist_module.DNB_template_names;&lt;br /&gt;
&lt;br /&gt;
	if 10 == namespace then&lt;br /&gt;
		return '';																-- automatic form of |template-doc-demo=true; TODO: is this too broad?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local tally = anchor_id_list[anchor_id];									-- nil when anchor_id not in list; else a tally&lt;br /&gt;
	local msg;&lt;br /&gt;
	local category;&lt;br /&gt;
&lt;br /&gt;
	if not tally then&lt;br /&gt;
		if args.ignore then&lt;br /&gt;
			return '';															-- if ignore is true then no message, no category&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if article_whitelist and article_whitelist[anchor_id] then				-- if an article-local whitelist and anchor ID is in it&lt;br /&gt;
			return '';															-- done&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local wl_anchor_id = anchor_id;											-- copy to be modified to index into the whitelist&lt;br /&gt;
		&lt;br /&gt;
		if args.year then														-- for anchor IDs created by this template (not in |ref=) that have a date&lt;br /&gt;
			if args.year:match ('%d%l$') or										-- use the date value to determine if we should remove the disambiguator&lt;br /&gt;
				args.year:match ('n%.d%.%l$') or&lt;br /&gt;
				args.year:match ('nd%l$') then&lt;br /&gt;
					wl_anchor_id = wl_anchor_id:gsub ('%l$', '');				-- remove the disambiguator&lt;br /&gt;
			end&lt;br /&gt;
		end		&lt;br /&gt;
&lt;br /&gt;
		local t_tbl = whitelist[wl_anchor_id];									-- get list of templates associated with this anchor ID&lt;br /&gt;
&lt;br /&gt;
		if t_tbl then															-- when anchor ID not whitelisted t_tbl is nil&lt;br /&gt;
			for _, t in ipairs (t_tbl) do										-- spin through the list of templates associated with this anchor ID&lt;br /&gt;
				if template_list[t] then										-- if associated template is found in the list of templates in the article&lt;br /&gt;
					return '';													-- anchor ID is whitlisted and article has matching template so no error&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		for _, pattern in ipairs (special_patterns) do							-- spin through the spcial patterns and try to match&lt;br /&gt;
			if anchor_id:match (pattern) then&lt;br /&gt;
				return '';&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		for _, dnb_t in ipairs (DNB_template_names or {}) do					-- getting desparate now, are there any DNB templates? DNB_template_names may be nil; empty table prevents script error&lt;br /&gt;
			if template_list[dnb_t] then										-- if the article has this DNB template&lt;br /&gt;
				for _, pattern in ipairs (DNB_special_patterns) do				-- spin through the DNB-specifiec wildcard patterns&lt;br /&gt;
					if anchor_id:match (pattern) then							-- and attempt a match&lt;br /&gt;
						return '';												-- found a match&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		msg = 'no target: ' .. anchor_id;										-- anchor_id not found&lt;br /&gt;
		category = '[[Category:Harv and Sfn no-target errors]]';&lt;br /&gt;
&lt;br /&gt;
	elseif 1 &amp;lt; tally then&lt;br /&gt;
		msg = 'multiple targets (' .. tally .. '×): ' .. anchor_id;				-- more than one anchor_id in this article&lt;br /&gt;
		category = '[[Category:Harv and Sfn multiple-target errors]]';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
--	category = 0 == namespace and '[[Category:Harv and Sfn template errors]]' or '';	-- only categorize in article space&lt;br /&gt;
	category = 0 == namespace and category or '';								-- only categorize in article space&lt;br /&gt;
&lt;br /&gt;
--use this version to show error messages&lt;br /&gt;
--	return msg and '&amp;lt;span class=&amp;quot;error harv-error&amp;quot; style=&amp;quot;display: inline; font-size:100%&amp;quot;&amp;gt; ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])&amp;lt;/span&amp;gt;' .. category or '';&lt;br /&gt;
--use this version to hide error messages&lt;br /&gt;
	return msg and '&amp;lt;span class=&amp;quot;error harv-error&amp;quot; style=&amp;quot;display: none; font-size:100%&amp;quot;&amp;gt; ' .. args.template .. ' error: ' .. msg .. ' ([[:Category:Harv and Sfn template errors|help]])&amp;lt;/span&amp;gt;' .. category or '';&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ Y E A R &amp;gt;----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
evaluates param to see if it is one of these forms with or without lowercase letter disambiguator:&lt;br /&gt;
	YYYY&lt;br /&gt;
	n.d.&lt;br /&gt;
	nd	&lt;br /&gt;
	c. YYYY&lt;br /&gt;
	YYYY–YYYY	(separator is endash)&lt;br /&gt;
	YYYY–YY		(separator is endash)&lt;br /&gt;
&lt;br /&gt;
return true when param has a recognized form; false else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local patterns_date= {&lt;br /&gt;
	'^%d%d%d%d?%l?$',&lt;br /&gt;
	'^n%.d%.%l?$',&lt;br /&gt;
	'^nd%l?$',&lt;br /&gt;
	'^c%. %d%d%d%d?%l?$',&lt;br /&gt;
	'^%d%d%d%d–%d%d%d%d%l?$',&lt;br /&gt;
	'^%d%d%d%d–%d%d%l?$',&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local function is_year (param, args)&lt;br /&gt;
	args.year = '';																-- used for harv error; &lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns_date) do&lt;br /&gt;
		if mw.ustring.match (param, pattern) then&lt;br /&gt;
			args.year = param;													-- used for harv error; &lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C O R E &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns an anchor link (CITEREF) formed from one to four author names, year, and insource location (|p=, |pp=, loc=)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function core( args )&lt;br /&gt;
	local result;&lt;br /&gt;
	local err_msg = ''&lt;br /&gt;
&lt;br /&gt;
	if args.P5 ~= '' then&lt;br /&gt;
		if is_year (args.P5, args) then&lt;br /&gt;
			result = table.concat ({args.P1, ' et al. ', args.bracket_year_left, args.P5, args.bracket_year_right});&lt;br /&gt;
		else&lt;br /&gt;
			args.P5 = '';														-- when P5 not a year don't include in anchor&lt;br /&gt;
			result = table.concat ({args.P1, ' et al.'});						-- and don't render it&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif args.P4 ~= '' then&lt;br /&gt;
		if is_year (args.P4, args) then&lt;br /&gt;
			result = table.concat ({args.P1, ', ', args.P2, ' &amp;amp;amp; ', args.P3, ' ', args.bracket_year_left, args.P4, args.bracket_year_right});	-- three names and a year&lt;br /&gt;
		else&lt;br /&gt;
			result = table.concat ({args.P1, ' et al.'});						-- four names&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif args.P3 ~= '' then&lt;br /&gt;
		if is_year (args.P3, args) then&lt;br /&gt;
			result = table.concat ({args.P1, ' &amp;amp;amp; ', args.P2, ' ', args.bracket_year_left, args.P3, args.bracket_year_right});	-- two names and a year&lt;br /&gt;
		else&lt;br /&gt;
			result = table.concat ({args.P1, ', ', args.P2, ' ', ' &amp;amp;amp; ', args.P3});	-- three names&lt;br /&gt;
		end&lt;br /&gt;
			&lt;br /&gt;
	elseif args.P2 ~= '' then&lt;br /&gt;
		if is_year (args.P2, args) then&lt;br /&gt;
			result = table.concat ({args.P1, ' ', args.bracket_year_left, args.P2, args.bracket_year_right});	-- one name and year&lt;br /&gt;
		else&lt;br /&gt;
			result = table.concat ({args.P1, ' &amp;amp;amp; ', args.P2});				-- two names&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	else&lt;br /&gt;
		result = args.P1;														-- one name&lt;br /&gt;
	end&lt;br /&gt;
																				-- when author-date result ends with a dot (typically when the last positional parameter holds 'n.d.')&lt;br /&gt;
																				-- and when no in-source location (no |p=, |pp=, or |loc=)&lt;br /&gt;
																				-- and when the first or only character in args.postscript is a dot&lt;br /&gt;
																				-- remove the author-date result trailing dot&lt;br /&gt;
																				-- the author-date result trailing dot will be replaced later with the content of args.postscript (usually a dot)&lt;br /&gt;
	if ('.' == result:sub(-1)) and ('.' == args.postscript:sub(1)) and ('' == args.page) and ('' == args.pages) and ('' == args.location) then&lt;br /&gt;
		result = result:gsub ('%.$', '');&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.ref ~= 'none' then&lt;br /&gt;
		local anchor_id;&lt;br /&gt;
		if args.ref ~= '' then&lt;br /&gt;
			anchor_id = mw.uri.anchorEncode (args.ref);&lt;br /&gt;
			err_msg = target_check (anchor_id, args);&lt;br /&gt;
			result = table.concat ({'[[#', anchor_id, '|', result, ']]'});&lt;br /&gt;
		else&lt;br /&gt;
			anchor_id = mw.uri.anchorEncode (table.concat ({'CITEREF', args.P1, args.P2, args.P3, args.P4, args.P5}));&lt;br /&gt;
			err_msg = target_check (anchor_id, args);&lt;br /&gt;
			result = table.concat ({'[[#', anchor_id, '|', result, ']]'});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.page ~= '' then&lt;br /&gt;
		result = table.concat ({result, args.page_sep, args.page});&lt;br /&gt;
	elseif args.pages ~= ''then&lt;br /&gt;
		result = table.concat ({result, args.pages_sep, args.pages});&lt;br /&gt;
	end      &lt;br /&gt;
&lt;br /&gt;
	if args.location ~= '' then&lt;br /&gt;
		result = table.concat ({result, ', ', args.location});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	result = table.concat ({args.bracket_left, result, args.bracket_right, args.postscript}):gsub ('%s+', ' ');		-- strip redundant spaces&lt;br /&gt;
	return result .. err_msg;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R G S  _ F E T C H &amp;gt;---------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Because all of the templates share a common set of parameters, a single common function to fetch those parameters&lt;br /&gt;
from frame and parent frame.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function args_fetch (frame, ps)&lt;br /&gt;
	local args = args_default;													-- create a copy of the default table&lt;br /&gt;
	local pframe = frame:getParent();											-- point to the template's parameter table&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame.args) do											-- override defaults with values provided in the #invoke: if any&lt;br /&gt;
		args[k] = v;	   &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	args.postscript = pframe.args.postscript or pframe.args.ps or ps;&lt;br /&gt;
	if 'none' == args.postscript then&lt;br /&gt;
		args.postscript = '';&lt;br /&gt;
	end&lt;br /&gt;
	args.page = pframe.args.p or pframe.args.page or '';&lt;br /&gt;
	args.pages = pframe.args.pp or pframe.args.pages or '';&lt;br /&gt;
	args.location = pframe.args.loc or '';&lt;br /&gt;
	args.ref = pframe.args.ref or pframe.args.Ref or '';&lt;br /&gt;
	args.ignore = ('yes' == pframe.args['ignore-false-positive']) or ('yes' == pframe.args['ignore-err']);&lt;br /&gt;
&lt;br /&gt;
	for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do						-- loop through the five positional parameters and trim if set else empty string&lt;br /&gt;
		args[v] = (pframe.args[i] and mw.text.trim (pframe.args[i])) or '';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.P5 and not is_year (args.P5, args) then&lt;br /&gt;
		local i = 6;															-- initialize the indexer to the sixth positional parameter&lt;br /&gt;
		while pframe.args[i] do													-- in case there are too many authors loop through the authors looking for a year&lt;br /&gt;
			local v = mw.text.trim (pframe.args[i]);							-- trim&lt;br /&gt;
			if is_year (v, args) then											-- if a year&lt;br /&gt;
				args.P5 = v;													-- overwrite whatever was in args.P5 with year&lt;br /&gt;
				break;															-- and abandon the search&lt;br /&gt;
			end&lt;br /&gt;
			i = i + 1;															-- bump the indexer&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return args;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A R V A R D _ C I T A T I O N &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common entry point for:&lt;br /&gt;
	{{harvard citation}} aka {{harv}}&lt;br /&gt;
	{{Harvard citation no brackets}} aka {{harvnb}}&lt;br /&gt;
	{{harvcol}}&lt;br /&gt;
	{{harvcolnb}}&lt;br /&gt;
	{{harvcoltxt}}&lt;br /&gt;
	{{Harvard citation text}} aka {{harvtxt}}&lt;br /&gt;
	{{Harvp}}&lt;br /&gt;
&lt;br /&gt;
Distinguishing features (brackets and page separators) are specified in this module's {{#invoke}} in the respective templates.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function harvard_citation (frame)&lt;br /&gt;
	local args = args_fetch (frame, '');										-- get the template and invoke parameters; default postscript is empty string&lt;br /&gt;
&lt;br /&gt;
	return core (args);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S T R I P _ U R L &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
used by sfn() and sfnm().  This function fixes an issue with reference tooltip gadget where the tooltip is not displayed&lt;br /&gt;
when an insource locator (|p=, |pp=, |loc=) has an external wikilink that contains a # character&lt;br /&gt;
&lt;br /&gt;
strip uri-reserved characters from urls in |p=, |pp-, and |loc= parameters  The researved characters are:&lt;br /&gt;
	!#$&amp;amp;'()*+,/:;=?@[]&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function strip_url (pages)&lt;br /&gt;
	local escaped_uri;&lt;br /&gt;
	if not pages or ('' == pages) then&lt;br /&gt;
		return pages;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for uri in pages:gmatch ('%[(%a[%w%+%.%-]*://%S+)') do						-- for each external link get the uri&lt;br /&gt;
		escaped_uri = uri:gsub (&amp;quot;([%(%)%.%%%+%-%*%?%[%^%$%]])&amp;quot;, &amp;quot;%%%1&amp;quot; );		-- save a copy with lua pattern characters escaped&lt;br /&gt;
		uri = uri:gsub (&amp;quot;[!#%$&amp;amp;'%(%)%*%+,/:;=%?@%[%]%.%%]&amp;quot;, '');				-- remove reserved characters and '%' because '%20' (space character) is a lua 'invalid capture index'&lt;br /&gt;
		pages = pages:gsub (escaped_uri, uri, 1);								-- replace original uri with the stripped version&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return pages;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S F N &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
entry point for {{sfn}} and {{sfnp}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sfn (frame)&lt;br /&gt;
	local args = args_fetch (frame, '.');										-- get the template and invoke parameters; default postscript is a dot&lt;br /&gt;
&lt;br /&gt;
	local result = core (args);													-- go make a CITEREF anchor&lt;br /&gt;
																				-- put it all together and then strip redundant spaces&lt;br /&gt;
	local name = table.concat ({'FOOTNOTE', args.P1, args.P2, args.P3, args.P4, args.P5, strip_url (args.page), strip_url (args.pages), strip_url (args.location)}):gsub ('%s+', ' ');&lt;br /&gt;
&lt;br /&gt;
	return frame:extensionTag ({name='ref', args={name=name}, content=result});	&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S F N M &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common entry point for {{sfnm}} and {{sfnmp}}&lt;br /&gt;
&lt;br /&gt;
Distinguishing features (brackets) are specified in this module's {{#invoke}} in the respective templates.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sfnm (frame)&lt;br /&gt;
	local args = args_default;													-- create a copy of the default table&lt;br /&gt;
	local pframe = frame:getParent();											-- point to the template's parameter table&lt;br /&gt;
	&lt;br /&gt;
	local n = 1;																-- index of source; this is the 'n' in na1, ny, etc&lt;br /&gt;
	local first_pnum = 1;														-- first of a pair of positional parameters&lt;br /&gt;
	local second_pnum = 2;														-- second of a pair of positional parameters&lt;br /&gt;
&lt;br /&gt;
	local last_ps = 0;															-- index of the last source with |nps= set&lt;br /&gt;
	local last_index = 0;														-- index of the last source; these used to determine which of |ps= or |nps= will terminate the whole rendering&lt;br /&gt;
&lt;br /&gt;
	local out = {};																-- table to hold rendered sources&lt;br /&gt;
	local footnote = {'FOOTNOTE'};												-- all author, date, insource location stuff becomes part of the reference's footnote id; added as we go&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame.args) do											-- override defaults with values provided in the #invoke: if any&lt;br /&gt;
		args[k] = v;	   &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	while true do&lt;br /&gt;
		if not pframe.args[table.concat ({n, 'a1'})] and not pframe.args[first_pnum] then&lt;br /&gt;
			break;																-- no na1 or matching positional parameter so done&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if pframe.args[table.concat ({n, 'a1'})] then							-- does this source use named parameters?&lt;br /&gt;
			for _, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do				-- initialize for this source&lt;br /&gt;
				args[v] = '';&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			for i, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do				-- extract author and year parameters for this source&lt;br /&gt;
				args[v] = pframe.args[table.concat ({n, 'a', i})] or '';		-- attempt to assign author name&lt;br /&gt;
				if '' == args[v] then											-- when there wasn't an author name&lt;br /&gt;
					args[v] = pframe.args[table.concat ({n, 'y'})] or '';		-- attempt to assign year&lt;br /&gt;
					break;														-- done with author/date for this source&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
		else																	-- this source uses positional parameters&lt;br /&gt;
			args.P1 = mw.text.trim (pframe.args[first_pnum]);					-- yes, only one author supported&lt;br /&gt;
			args.P2 = (pframe.args[second_pnum] and mw.text.trim (pframe.args[second_pnum])) or '';	-- when positional author, year must also be positional&lt;br /&gt;
&lt;br /&gt;
			for _, v in ipairs ({'P3', 'P4', 'P5'}) do							-- blank the rest of these for this source&lt;br /&gt;
				args[v] = '';&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			first_pnum = first_pnum + 2;										-- source must use positional author and positional year&lt;br /&gt;
			second_pnum = first_pnum + 1;										-- bump these for possible next positional source&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		args.postscript = pframe.args[table.concat ({n, 'ps'})] or '';&lt;br /&gt;
		if 'none' == args.postscript then										-- this for compatibility with other footnote templates; does nothing&lt;br /&gt;
			args.postscript = '';&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		args.ref = pframe.args[table.concat ({n, 'ref'})] or '';				-- alternate reference for this source&lt;br /&gt;
&lt;br /&gt;
		args.page = pframe.args[table.concat ({n, 'p'})] or '';					-- insource locations for this source&lt;br /&gt;
		args.pages = pframe.args[table.concat ({n, 'pp'})] or '';&lt;br /&gt;
		args.location = pframe.args[table.concat ({n, 'loc'})] or '';&lt;br /&gt;
		args.ignore = ('yes' == pframe.args[table.concat ({n, 'ignore-false-positive'})]) or ('yes' == pframe.args[table.concat ({n, 'ignore-err'})]);&lt;br /&gt;
--		args.ignore = 'yes' == pframe.args[table.concat ({n, 'ignore-err'})];&lt;br /&gt;
&lt;br /&gt;
		table.insert (out, core (args));										-- save the rendering of this source&lt;br /&gt;
		&lt;br /&gt;
		for k, v in ipairs ({'P1', 'P2', 'P3', 'P4', 'P5'}) do					-- create the FOOTNOTE id&lt;br /&gt;
			if '' ~= args[v] then&lt;br /&gt;
				table.insert (footnote, args[v]);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for k, v in ipairs ({'page', 'pages', 'location'}) do					-- these done separately so that we can strip uri-reserved characters from extlinked page numbers &lt;br /&gt;
			if '' ~= args[v] then&lt;br /&gt;
				table.insert (footnote, strip_url (args[v]))&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		last_index = n;															-- flags used to select terminal postscript from nps or from end_ps&lt;br /&gt;
		if '' ~= args.postscript then							&lt;br /&gt;
			last_ps = n;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		n = n+1;																-- bump for the next one&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local name = table.concat (footnote):gsub ('%s+', ' ');						-- put the footnote together and strip redundant space&lt;br /&gt;
	&lt;br /&gt;
	args.end_ps = pframe.args.postscript or pframe.args.ps or '.';				-- this is the postscript for the whole not for the individual sources&lt;br /&gt;
	if 'none' == args.end_ps then												-- not an original sfnm parameter value; added for compatibility with other footnote templates&lt;br /&gt;
		args.end_ps = '';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result = table.concat ({table.concat (out, '; '), (last_index == last_ps) and '' or  args.end_ps});&lt;br /&gt;
	return frame:extensionTag ({name='ref', args={name=name}, content=result});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S F N R E F &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
implements {{sfnref}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sfnref (frame)&lt;br /&gt;
	local args = getArgs (frame);&lt;br /&gt;
	local out = {};&lt;br /&gt;
	&lt;br /&gt;
	for i=1, 5 do																-- get the first five args if there are five args&lt;br /&gt;
		if args[i] then&lt;br /&gt;
			out[i] = args[i];&lt;br /&gt;
		else&lt;br /&gt;
			break;																-- less than 5 args break out&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 5 == #out then															-- when we have seen five args there may bemore&lt;br /&gt;
		local i = 6;															-- initialize the indexer to the sixth positional parameter&lt;br /&gt;
		while args[i] do														-- in case there are too many authors loop through the authors looking for a year&lt;br /&gt;
			if is_year (args[i], args) then										-- if a year&lt;br /&gt;
				out[5] = args[i];												-- overwrite whatever was in args[5] with year&lt;br /&gt;
				break;															-- and abandon the search&lt;br /&gt;
			end&lt;br /&gt;
			i = i + 1;															-- bump the indexer&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return mw.uri.anchorEncode ('CITEREF' .. table.concat (out));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	harvard_citation = harvard_citation,&lt;br /&gt;
	sfn = sfn,&lt;br /&gt;
	sfnm = sfnm,&lt;br /&gt;
	sfnref = sfnref,&lt;br /&gt;
	};&lt;/div&gt;</summary>
		<author><name>en&gt;Trappist the monk</name></author>
		
	</entry>
</feed>