<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AHarvc</id>
	<title>Module:Harvc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AHarvc"/>
	<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Harvc&amp;action=history"/>
	<updated>2026-04-05T22:39:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.5</generator>
	<entry>
		<id>https://www.cultopedia.org/index.php?title=Module:Harvc&amp;diff=171&amp;oldid=prev</id>
		<title>imported&gt;Hike395: replace target_check() with call to target_check() in Module:Footnotes, which has full wrapper/whitelist functionality</title>
		<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Harvc&amp;diff=171&amp;oldid=prev"/>
		<updated>2025-01-26T16:13:50Z</updated>

		<summary type="html">&lt;p&gt;replace target_check() with call to target_check() in &lt;a href=&quot;/index.php/Module:Footnotes&quot; title=&quot;Module:Footnotes&quot;&gt;Module:Footnotes&lt;/a&gt;, which has full wrapper/whitelist functionality&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;
&lt;br /&gt;
local code_open_tag = &amp;#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;#039;;								-- cs1-code class defined in Module:Citation/CS1/styles.css&lt;br /&gt;
local lock_icons = {															--icon classes are defined in Module:Citation/CS1/styles.css&lt;br /&gt;
	[&amp;#039;registration&amp;#039;] = {&amp;#039;id-lock-registration&amp;#039;, &amp;#039;Free registration required&amp;#039;},&lt;br /&gt;
	[&amp;#039;limited&amp;#039;] = {&amp;#039;id-lock-limited&amp;#039;, &amp;#039;Free access subject to limited trial, subscription normally required&amp;#039;},&lt;br /&gt;
	[&amp;#039;subscription&amp;#039;] = {&amp;#039;id-lock-subscription&amp;#039;, &amp;#039;Paid subscription required&amp;#039;},&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;
check to see if target of harvc exists in the page somewhere. Uses the target check mechanism from Module:Footnotes&lt;br /&gt;
&lt;br /&gt;
setting |ignore-errors=yes in {{harvc}} will override this check&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function target_check (anchor_id, ignore)&lt;br /&gt;
    local whitelist_check = require(&amp;#039;Module:Footnotes&amp;#039;).target_check&lt;br /&gt;
    local args = {ignore=ignore, template=&amp;#039;Harvc&amp;#039;, show=true}&lt;br /&gt;
    return whitelist_check(anchor_id, args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S E T &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Whether variable is set or not.  A variable is set when it is not nil and not empty.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_set( var )&lt;br /&gt;
	return not (var == nil or var == &amp;#039;&amp;#039;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C H E C K _ Y E A R S &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
evaluates params to see if they are one of these forms with or without lowercase letter disambiguator (same as in&lt;br /&gt;
Module:Footnotes):&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;
when anchor_year present, year portion must be same as year param and must have disambiguator&lt;br /&gt;
&lt;br /&gt;
returns empty string when params have correct form; error message else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_years (year, anchor_year)&lt;br /&gt;
	local y, ay;&lt;br /&gt;
	&lt;br /&gt;
	if not is_set (year) then													-- year is required so return error message when not set&lt;br /&gt;
		return &amp;#039; missing &amp;#039; .. code_open_tag .. &amp;#039;|year=&amp;lt;/code&amp;gt;.&amp;#039;;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local patterns = {															-- allowed year patterns from Module:Footnotes (captures added here)&lt;br /&gt;
		&amp;#039;^(%d%d%d%d?)%l?$&amp;#039;,														-- YYY or YYYY&lt;br /&gt;
		&amp;#039;^(n%.d%.)%l?$&amp;#039;,														-- n.d.&lt;br /&gt;
		&amp;#039;^(nd)%l?$&amp;#039;,															-- nd&lt;br /&gt;
		&amp;#039;^(c%. %d%d%d%d?)%l?$&amp;#039;,													-- c. YYY or c. YYYY&lt;br /&gt;
		&amp;#039;^(%d%d%d%d–%d%d%d%d)%l?$&amp;#039;,												-- YYYY–YYYY&lt;br /&gt;
		&amp;#039;^(%d%d%d%d–%d%d)%l?$&amp;#039;													-- YYYY–YY&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- spin through the patterns&lt;br /&gt;
		y = year:match (pattern);												-- y is the year portion&lt;br /&gt;
		if y then&lt;br /&gt;
			break;																-- when y is set, we found a match so done&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not y then&lt;br /&gt;
		return &amp;#039; invalid &amp;#039; .. code_open_tag .. &amp;#039;|year=&amp;lt;/code&amp;gt;.&amp;#039;;												-- y not set, so year is malformed&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (anchor_year) then												-- anchor_year is optional&lt;br /&gt;
		for _, pattern in ipairs (patterns) do									-- spin through the patterns&lt;br /&gt;
			ay = anchor_year:match (pattern);									-- ay is the year portion&lt;br /&gt;
			if ay then&lt;br /&gt;
				break;															-- when ay is set, we found a match so done&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if not ay then&lt;br /&gt;
			return &amp;#039; invalid &amp;#039; .. code_open_tag .. &amp;#039;|anchor-year&amp;lt;/code&amp;gt;.&amp;#039;;		-- ay not set, so anchor_year is malformed&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
--		if not anchor_year:match (&amp;#039;%l$&amp;#039;) then&lt;br /&gt;
--			return &amp;#039; &amp;#039; .. code_open_tag .. &amp;#039;|anchor-year=&amp;lt;/code&amp;gt; missing dab.&amp;#039;;	-- anchor_year must end with a disambiguator letter&lt;br /&gt;
--		end&lt;br /&gt;
	&lt;br /&gt;
		if y ~= ay then&lt;br /&gt;
			return &amp;#039; &amp;#039; .. code_open_tag .. &amp;#039;|year=&amp;lt;/code&amp;gt; / &amp;#039; .. code_open_tag .. &amp;#039;|anchor-year=&amp;lt;/code&amp;gt; mismatch.&amp;#039;;	-- &amp;#039;year&amp;#039; portions of year and anchor_year must be the same&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;#039;&amp;#039;;																	-- both years are good; empty string for concatenation&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ N A M E &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Assembles last, first, link, or mask into a displayable contributor name.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_name (last, first, link, mask)&lt;br /&gt;
	local name = last;&lt;br /&gt;
	&lt;br /&gt;
	if is_set (first) then&lt;br /&gt;
		name = name .. &amp;#039;, &amp;#039; .. first;											-- concatenate first onto last&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (link) then&lt;br /&gt;
		name = &amp;#039;[[&amp;#039; .. link .. &amp;#039;|&amp;#039; .. name .. &amp;#039;]]&amp;#039;;								-- form a wikilink around the name&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (mask) then														-- mask this author&lt;br /&gt;
		if tonumber(mask) then&lt;br /&gt;
			name = string.rep (&amp;#039;—&amp;#039;, mask)										-- make a string that number length of mdashes&lt;br /&gt;
		else&lt;br /&gt;
			name = mask;														-- mask is not a number so use the mask text&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return name;&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;
Assembles the various parts provided by the template into a properly formatted bridging citation.  Adds punctuation&lt;br /&gt;
and text; encloses the whole within a span with id and class attributes.&lt;br /&gt;
&lt;br /&gt;
This creates a CITEREF anchor from |last1= through |last4= and |year=.  It also creates a CITEREF link from |in1= through&lt;br /&gt;
|in4= and |year=.  It is presumed that the dates of contributions are the same as the date of the enclosing work.&lt;br /&gt;
&lt;br /&gt;
Even though not displayed, a year parameter is still required for the CITEREF anchor&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function core( args )&lt;br /&gt;
	local span_open_tag;														-- holds CITEREF and css&lt;br /&gt;
	local contributors = &amp;#039;&amp;#039;;													-- chapter or contribution authors&lt;br /&gt;
	local source = &amp;#039;&amp;#039;;															-- editor/author date list that forms a CITEREF link to a full citation&lt;br /&gt;
	local in_text = &amp;#039; In &amp;#039;;&lt;br /&gt;
&lt;br /&gt;
-- form the CITEREF anchor&lt;br /&gt;
	if is_set (args.id) then&lt;br /&gt;
		args.id = mw.uri.anchorEncode (args.id)&lt;br /&gt;
		span_open_tag = &amp;#039;&amp;lt;span id=&amp;quot;&amp;#039; .. args.id .. &amp;#039;&amp;quot; class=&amp;quot;citation&amp;quot;&amp;gt;&amp;#039;;		-- for use when contributor name is same as source name&lt;br /&gt;
	else&lt;br /&gt;
		local citeref = &amp;#039;CITEREF&amp;#039; .. table.concat (args.citeref) .. (is_set (args[&amp;#039;anchor-year&amp;#039;]) and args[&amp;#039;anchor-year&amp;#039;] or args.year);&lt;br /&gt;
		citeref = mw.uri.anchorEncode (citeref);&lt;br /&gt;
		span_open_tag = &amp;#039;&amp;lt;span id=&amp;quot;&amp;#039; .. citeref .. &amp;#039;&amp;quot; class=&amp;quot;citation&amp;quot;&amp;gt;&amp;#039;;&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
--[[&lt;br /&gt;
form the contributors display list:&lt;br /&gt;
	if |name-list-style=harv, display is similar to {{sfn}} and {{harv}}, 1 to 4 last names;&lt;br /&gt;
	if |display-authors= is empty or omitted, display is similar to cs1|2: display all names in last, first order &lt;br /&gt;
	if |display-authors=etal then displays all author names in last, first order and append et al.&lt;br /&gt;
	if value assigned to |display-authors= is less than the number of author last names, displays the specified number of author names in last, first order followed by et al.&lt;br /&gt;
]]&lt;br /&gt;
	if &amp;#039;harv&amp;#039; ~= args.name_list_style then										-- default cs1|2 style contributor list&lt;br /&gt;
		local i = 1;&lt;br /&gt;
		local count;&lt;br /&gt;
		local etal = false;														-- when |display-authors= is same as number of authors in contributor list&lt;br /&gt;
		&lt;br /&gt;
		if is_set (args.display_authors) then&lt;br /&gt;
			if &amp;#039;etal&amp;#039; == args.display_authors:lower():gsub(&amp;quot;[ &amp;#039;%.]&amp;quot;, &amp;#039;&amp;#039;) then	-- the :gsub() portion makes &amp;#039;etal&amp;#039; from a variety of &amp;#039;et al.&amp;#039; spellings and stylings&lt;br /&gt;
				count = #args.last;												-- display all authors and ...&lt;br /&gt;
				etal = true;													-- ... append &amp;#039;et al.&amp;#039;&lt;br /&gt;
			else&lt;br /&gt;
				count = tonumber (args.display_authors) or 0;					-- 0 if can&amp;#039;t be converted to a number&lt;br /&gt;
				if 0 &amp;gt;= count then&lt;br /&gt;
					args.err_msg = args.err_msg .. &amp;#039; invalid &amp;#039; .. code_open_tag .. &amp;#039;|display-authors=&amp;lt;/code&amp;gt;&amp;#039;;	-- if zero, then emit error message&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if count &amp;gt; #args.last then&lt;br /&gt;
				count = #args.last;												-- when |display-authors= is more than the number of authors, use the number of authors&lt;br /&gt;
			end&lt;br /&gt;
			if count &amp;lt; #args.last then											-- when |display-authors= is less than the number of authors&lt;br /&gt;
				etal = true;													-- append &amp;#039;et al.&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			count = #args.last;													-- set count to display all of the authors&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		while i &amp;lt;= count do&lt;br /&gt;
			if is_set (contributors) then&lt;br /&gt;
				contributors = contributors .. &amp;#039;; &amp;#039; .. make_name (args.last[i], args.first[i], args.link[i], args.mask[i]);			-- the rest of the contributors&lt;br /&gt;
			else&lt;br /&gt;
				contributors = make_name (args.last[i], args.first[i], args.link[i], args.mask[i]);			-- first contributor&amp;#039;s name&lt;br /&gt;
			end&lt;br /&gt;
			i = i+1;															-- bump the index&lt;br /&gt;
		end&lt;br /&gt;
		if true == etal then&lt;br /&gt;
			contributors = contributors .. &amp;#039; et al.&amp;#039;;							-- append et al.&lt;br /&gt;
		elseif &amp;#039;amp&amp;#039; == args.name_list_style then&lt;br /&gt;
			contributors = contributors:gsub(&amp;#039;; ([^;]+)$&amp;#039;, &amp;#039; &amp;amp; %1&amp;#039;)				-- replace last separator with &amp;#039; &amp;amp; &amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- do default harv- or sfn-style contributor display&lt;br /&gt;
		if 4 &amp;lt;= #args.last then													-- four or more contributors (first followed by et al.)&lt;br /&gt;
			contributors = args.last[1] .. &amp;#039; et al.&amp;#039;;&lt;br /&gt;
		elseif 3 == #args.last then												-- three (display them all)&lt;br /&gt;
			contributors = args.last[1] .. &amp;#039;, &amp;#039; .. args.last[2] .. &amp;#039; &amp;amp;amp; &amp;#039; .. args.last[3];&lt;br /&gt;
		elseif 2 == #args.last then												-- two (first &amp;amp; second)&lt;br /&gt;
			contributors = args.last[1] .. &amp;#039; &amp;amp;amp; &amp;#039; .. args.last[2];&lt;br /&gt;
		elseif 1 == #args.last then												-- just one (first)&lt;br /&gt;
			contributors = args.last[1];&lt;br /&gt;
		else&lt;br /&gt;
			args.err_msg = args.err_msg .. &amp;#039; no authors in contributor list.&amp;#039;;	-- this code used to find holes in the list; no more&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
--form the source author-date list&lt;br /&gt;
	if is_set (args.in4) and is_set (args.in3) and is_set (args.in2) and is_set (args.in1) then&lt;br /&gt;
		source = args.in1 .. &amp;#039; et al.&amp;#039;;&lt;br /&gt;
	elseif not is_set (args.in4) and is_set (args.in3) and is_set (args.in2) and is_set (args.in1) then&lt;br /&gt;
		source = args.in1 .. &amp;#039;, &amp;#039; .. args.in2 .. &amp;#039; &amp;amp;amp; &amp;#039; .. args.in3;&lt;br /&gt;
	elseif not is_set (args.in4) and not is_set (args.in3) and is_set (args.in2) and is_set (args.in1) then&lt;br /&gt;
		source = args.in1 .. &amp;#039; &amp;amp;amp; &amp;#039; .. args.in2;&lt;br /&gt;
	elseif not is_set (args.in4) and not is_set (args.in3) and not is_set (args.in2) and is_set (args.in1) then&lt;br /&gt;
		source = args.in1;&lt;br /&gt;
	else&lt;br /&gt;
		args.err_msg = args.err_msg .. &amp;#039; author missing from source list.&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	source = source .. &amp;#039; &amp;#039; .. args.open .. args.year .. args.close;				-- add the year with or without brackets&lt;br /&gt;
&lt;br /&gt;
--assemble CITEREF wikilink&lt;br /&gt;
	local anchor_id;&lt;br /&gt;
	local target_err_msg;&lt;br /&gt;
	&lt;br /&gt;
	if &amp;#039;&amp;#039; ~= args.ref then&lt;br /&gt;
		anchor_id = mw.uri.anchorEncode (args.ref)&lt;br /&gt;
	else&lt;br /&gt;
		anchor_id = mw.uri.anchorEncode(table.concat ({&amp;#039;CITEREF&amp;#039;, args.in1, args.in2, args.in3, args.in4, args.year}));&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	target_err_msg = target_check (anchor_id, args.ignore);						-- see if there is a target for this anchor_id&lt;br /&gt;
	source = &amp;#039;[[#&amp;#039; .. anchor_id .. &amp;quot;|&amp;quot; .. source .. &amp;quot;]]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
-- special case for afterword, foreword, introduction, preface&lt;br /&gt;
	local no_quotes = ({[&amp;#039;afterword&amp;#039;]=true, [&amp;#039;foreword&amp;#039;]=true, [&amp;#039;introduction&amp;#039;]=true, [&amp;#039;preface&amp;#039;]=true})[args.contribution:lower()];&lt;br /&gt;
&lt;br /&gt;
--combine contribution with url to make external link&lt;br /&gt;
	if args.url ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		args.contribution = &amp;#039;[&amp;#039; .. args.url .. &amp;#039; &amp;#039; .. args.contribution .. &amp;#039;]&amp;#039;;	-- format external link&lt;br /&gt;
&lt;br /&gt;
		if args[&amp;#039;url-access&amp;#039;] then&lt;br /&gt;
			if lock_icons[args[&amp;#039;url-access&amp;#039;]] then&lt;br /&gt;
			args.contribution = table.concat ({									-- add access icon markup to this item&lt;br /&gt;
				&amp;#039;&amp;lt;span class=&amp;quot;&amp;#039;,												-- open the opening span tag; icon classes are defined in Module:Citation/CS1/styles.css&lt;br /&gt;
				lock_icons[args[&amp;#039;url-access&amp;#039;]][1],								-- add the appropriate lock icon class&lt;br /&gt;
				&amp;#039;&amp;quot; title=&amp;quot;&amp;#039;,													-- and the title attribute&lt;br /&gt;
				lock_icons[args[&amp;#039;url-access&amp;#039;]][2],								-- for an appropriate tool tip&lt;br /&gt;
				&amp;#039;&amp;quot;&amp;gt;&amp;#039;,															-- close the opening span tag&lt;br /&gt;
				args.contribution,&lt;br /&gt;
				&amp;#039;&amp;lt;/span&amp;gt;&amp;#039;,														-- and close the span&lt;br /&gt;
				});&lt;br /&gt;
			end&lt;br /&gt;
		end	&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (args[&amp;#039;anchor-year&amp;#039;]) then&lt;br /&gt;
		contributors = contributors .. &amp;#039; (&amp;#039; .. args[&amp;#039;anchor-year&amp;#039;] .. &amp;#039;)&amp;#039; .. args.sepc;&lt;br /&gt;
	elseif args.sepc ~= contributors:sub(-1) and args.sepc .. &amp;#039;]]&amp;#039; ~= contributors:sub(-3) then&lt;br /&gt;
		contributors = contributors .. args.sepc;								-- add separator if not same as last character in name list (|first=John S. or et al.)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
-- pages and other insource location&lt;br /&gt;
	if args.p ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		args.p = args.page_sep .. args.p;&lt;br /&gt;
	elseif args.pp ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		args.p = args.pages_sep .. args.pp;										-- args.p not set so use it to hold common insource location info&lt;br /&gt;
	end      &lt;br /&gt;
 &lt;br /&gt;
	if args.loc ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		args.p = args.p .. &amp;#039;, &amp;#039; .. args.loc;									-- add arg.loc to args.p&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
--wrap error messages in span and add help link&lt;br /&gt;
	if is_set (args.err_msg) then&lt;br /&gt;
		args.err_msg = &amp;#039;&amp;lt;span style=&amp;quot;font-size:100%&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt; harvc:&amp;#039; .. args.err_msg .. &amp;#039; ([[Template:Harvc|help]])&amp;lt;/span&amp;gt;&amp;#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;,&amp;#039; == args.sepc then&lt;br /&gt;
		in_text = in_text:lower();												-- CS2 style use lower case&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
-- and put it all together&lt;br /&gt;
	local result = {};															-- the assemby of the above output&lt;br /&gt;
	table.insert (result, span_open_tag);&lt;br /&gt;
	table.insert (result, contributors);&lt;br /&gt;
	table.insert (result, no_quotes and &amp;#039; &amp;#039; or &amp;#039; &amp;quot;&amp;#039;);							-- foreword, afterword, introduction, preface contributions are not quoted; all other contributions are&lt;br /&gt;
	table.insert (result, args.contribution);&lt;br /&gt;
	table.insert (result, no_quotes and &amp;#039;&amp;#039; or &amp;#039;&amp;quot;&amp;#039;);								-- foreword, afterword, introduction, preface contributions are not quoted; all other contributions are&lt;br /&gt;
	table.insert (result, args.sepc);&lt;br /&gt;
	table.insert (result, in_text);&lt;br /&gt;
	table.insert (result, source);&lt;br /&gt;
	table.insert (result, args.p);&lt;br /&gt;
	table.insert (result, args.ps);&lt;br /&gt;
	table.insert (result, args.err_msg);&lt;br /&gt;
    if not is_set(args.err_msg) then&lt;br /&gt;
	    table.insert (result, target_err_msg)&lt;br /&gt;
    end&lt;br /&gt;
	table.insert (result, &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return table.concat (result);												-- make a string and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A R V C &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Entry point from {{harvc}} template.  Fetches parent frame parameters, does a bit of simple error checking&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function harvc (frame)&lt;br /&gt;
	local args = {&lt;br /&gt;
		err_msg = &amp;#039;&amp;#039;,&lt;br /&gt;
		page_sep = &amp;quot;, p.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
		pages_sep = &amp;quot;, pp.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
		sepc = &amp;#039;.&amp;#039;,&lt;br /&gt;
		ps = &amp;#039;.&amp;#039;,&lt;br /&gt;
		open = &amp;#039;(&amp;#039;,																-- year brackets for source year&lt;br /&gt;
		close = &amp;#039;)&amp;#039;,&lt;br /&gt;
		last = {},&lt;br /&gt;
		first = {},&lt;br /&gt;
		link = {},&lt;br /&gt;
		mask = {},&lt;br /&gt;
		citeref = {}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	local pframe = frame:getParent();&lt;br /&gt;
 &lt;br /&gt;
	args.contribution =  pframe.args.c or										-- chapter or contribution&lt;br /&gt;
				pframe.args.chapter or&lt;br /&gt;
				pframe.args.contribution or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.id = pframe.args.id or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.in1 = pframe.args[&amp;#039;in&amp;#039;] or pframe.args.in1 or &amp;#039;&amp;#039;;						-- source editor surnames; &amp;#039;in&amp;#039; is a Lua reserved keyword&lt;br /&gt;
	args.in2 = pframe.args.in2 or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.in3 = pframe.args.in3 or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.in4 = pframe.args.in4 or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.display_authors = pframe.args[&amp;#039;display-authors&amp;#039;];						-- the number of contributor names to display; cs1|2 format includes first names&lt;br /&gt;
	args.name_list_style = pframe.args[&amp;#039;name-list-style&amp;#039;] or &amp;#039;&amp;#039;;					-- when set to &amp;#039;harv&amp;#039; display contributor list in sfn or harv style&lt;br /&gt;
	args.name_list_style = args.name_list_style:lower();						-- make it case agnostic&lt;br /&gt;
&lt;br /&gt;
	if is_set (pframe.args.last) or is_set (pframe.args.last1) or&lt;br /&gt;
		is_set (pframe.args.author) or is_set (pframe.args.author1) then		-- must have at least this to continue&lt;br /&gt;
			args.last[1] = pframe.args.last or pframe.args.last1 or pframe.args.author or pframe.args.author1;		-- get first contributor&amp;#039;s last name&lt;br /&gt;
			args.citeref[1] = args.last[1];										-- add it to the citeref&lt;br /&gt;
			args.first[1] = pframe.args.first or pframe.args.first1;			-- get first contributor&amp;#039;s first name&lt;br /&gt;
			args.link[1] = pframe.args[&amp;#039;author-link&amp;#039;] or pframe.args[&amp;#039;author-link1&amp;#039;];	-- get first contributor&amp;#039;s article link&lt;br /&gt;
			args.mask[1] = pframe.args[&amp;#039;author-mask&amp;#039;] or pframe.args[&amp;#039;author-mask1&amp;#039;];	-- get first contributor&amp;#039;s article link&lt;br /&gt;
		&lt;br /&gt;
			local i = 2;														-- index for the rest of the names&lt;br /&gt;
			while is_set (pframe.args[&amp;#039;last&amp;#039;..i]) or is_set (pframe.args[&amp;#039;author&amp;#039;..i]) do	-- loop through pframe.args and get the rest of the names&lt;br /&gt;
				args.last[i] = pframe.args[&amp;#039;last&amp;#039;..i] or pframe.args[&amp;#039;author&amp;#039;..i];	-- last names&lt;br /&gt;
				args.first[i] = pframe.args[&amp;#039;first&amp;#039;..i];						-- first names&lt;br /&gt;
				args.link[i] = pframe.args[&amp;#039;author-link&amp;#039;..i];					-- links&lt;br /&gt;
				args.mask[i] = pframe.args[&amp;#039;author-mask&amp;#039;..i];					-- masks&lt;br /&gt;
				if 5 &amp;gt; i then&lt;br /&gt;
					args.citeref[i] = args.last[i];								-- collect first four last names for CITEREF anchor&lt;br /&gt;
				end&lt;br /&gt;
				i = i + 1														-- bump the index&lt;br /&gt;
			end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 0 == #args.last then														-- |last= is required&lt;br /&gt;
		args.err_msg = args.err_msg .. &amp;#039; no authors in contributor list.&amp;#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	args.p = pframe.args.p or pframe.args.page or &amp;#039;&amp;#039;;							-- source page number(s) or location&lt;br /&gt;
	args.pp = pframe.args.pp or pframe.args.pages or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.loc = pframe.args.loc or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.ref = pframe.args.ref or pframe.args.Ref or &amp;#039;&amp;#039;;						-- used to match |ref=&amp;lt;text&amp;gt; in cs1|2 source template&lt;br /&gt;
	args.ignore = &amp;#039;yes&amp;#039; == pframe.args[&amp;#039;ignore-err&amp;#039;];							-- suppress false-positive &amp;#039;no target&amp;#039; errors&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;cs2&amp;#039; == pframe.args.mode then&lt;br /&gt;
		args.ps = &amp;#039;&amp;#039;;															-- set postscript character to empty string, cs2 mode&lt;br /&gt;
		args.sepc = &amp;#039;,&amp;#039;;														-- set seperator character to comma, cs2 mode&lt;br /&gt;
	end&lt;br /&gt;
	do																			-- to limit scope of local temp&lt;br /&gt;
		local temp = pframe.args.ps or pframe.args.postscript;&lt;br /&gt;
		&lt;br /&gt;
		if is_set (temp) then&lt;br /&gt;
			if &amp;#039;none&amp;#039; == temp:lower() then										-- if |ps=none or |postscript=none then&lt;br /&gt;
				args.ps = &amp;#039;&amp;#039;;													-- no postscript&lt;br /&gt;
			else&lt;br /&gt;
				args.ps = temp;													-- override default postscript&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- end of scope limit&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;yes&amp;#039; == pframe.args.nb then												-- if no brackets around year in link to cs1|2 template&lt;br /&gt;
		args.open = &amp;#039;&amp;#039;;															-- unset these&lt;br /&gt;
		args.close = &amp;#039;&amp;#039;;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	args.url = pframe.args.url or												-- url for chapter or contribution&lt;br /&gt;
			pframe.args[&amp;#039;chapter-url&amp;#039;] or&lt;br /&gt;
			pframe.args[&amp;#039;contribution-url&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	&lt;br /&gt;
	args[&amp;#039;url-access&amp;#039;] = pframe.args[&amp;#039;url-access&amp;#039;];&lt;br /&gt;
	&lt;br /&gt;
	args.year = pframe.args.year or &amp;#039;&amp;#039;;											-- required&lt;br /&gt;
	args[&amp;#039;anchor-year&amp;#039;] = pframe.args[&amp;#039;anchor-year&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.err_msg = args.err_msg .. check_years (args.year, args[&amp;#039;anchor-year&amp;#039;]);&lt;br /&gt;
&lt;br /&gt;
	if not is_set (args.contribution) then&lt;br /&gt;
		args.err_msg = args.err_msg .. &amp;#039; required contribution is missing.&amp;#039;;	-- error message if source not provided&lt;br /&gt;
		args.contribution = args.url;											-- if set it will give us linkable text&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.last[1] == args.in1 and&lt;br /&gt;
		args.last[2] == args.in2 and&lt;br /&gt;
		args.last[3] == args.in3 and&lt;br /&gt;
		args.last[4] == args.in4 and&lt;br /&gt;
		not is_set (args.id) then&lt;br /&gt;
			args.err_msg = args.err_msg .. &amp;#039; required &amp;#039; .. code_open_tag .. &amp;#039;|id=&amp;lt;/code&amp;gt; parameter missing.&amp;#039;;		-- error message if contributor and source are the same&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat ({frame:extensionTag (&amp;#039;templatestyles&amp;#039;, &amp;#039;&amp;#039;, {src=&amp;#039;Module:Citation/CS1/styles.css&amp;#039;}), core (args)});&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;
	harvc = harvc&lt;br /&gt;
	};&lt;/div&gt;</summary>
		<author><name>imported&gt;Hike395</name></author>
	</entry>
</feed>