<?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%3ACite_archive</id>
	<title>Module:Cite archive - 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%3ACite_archive"/>
	<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Cite_archive&amp;action=history"/>
	<updated>2026-04-06T04:10:36Z</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:Cite_archive&amp;diff=1809&amp;oldid=prev</id>
		<title>imported&gt;GreenC at 05:19, 5 September 2025</title>
		<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Cite_archive&amp;diff=1809&amp;oldid=prev"/>
		<updated>2025-09-05T05:19:37Z</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(&amp;#039;strict&amp;#039;)&lt;br /&gt;
local f = {};&lt;br /&gt;
local code_style=&amp;quot;color:inherit; border:inherit; padding:inherit;&amp;quot;;				-- used in styling error messages&lt;br /&gt;
&lt;br /&gt;
local lock_icons = {															--icon classes are defined in Module:Citation/CS1/styles.css&lt;br /&gt;
	[&amp;#039;free&amp;#039;] = {&amp;#039;cs1-lock-free&amp;#039;, &amp;#039;Freely accessible&amp;#039;},&lt;br /&gt;
	[&amp;#039;registration&amp;#039;] = {&amp;#039;cs1-lock-registration&amp;#039;, &amp;#039;Free registration required&amp;#039;},&lt;br /&gt;
	[&amp;#039;limited&amp;#039;] = {&amp;#039;cs1-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;cs1-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; 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; S E L E C T _ O N E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Choose one parameter value from a list of parameter values.  If more than one is set, emit error message.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function select_one (list, args)&lt;br /&gt;
	local selected_param;&lt;br /&gt;
	local selected_val=&amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	for param, value in pairs (list) do										-- loop through the list&lt;br /&gt;
		if not is_set (selected_param) then										-- if we have not yet selected a parameter value&lt;br /&gt;
			if is_set (value) then												-- is this value set?&lt;br /&gt;
				selected_val = value;											-- select it&lt;br /&gt;
				selected_param = param;											-- remember the name for possible error message&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if is_set (value) then												-- error message if we have selected and found another set parameter&lt;br /&gt;
				args.err_msg = string.format (&lt;br /&gt;
					&amp;#039; more than one of &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|%s=&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|%s=&amp;lt;/code&amp;gt;&amp;#039;,&lt;br /&gt;
					code_style, selected_param, code_style, param&lt;br /&gt;
				)&lt;br /&gt;
				break;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return selected_val or &amp;#039;&amp;#039;;															-- return selected value or empty string if none set&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 author 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;
		mask = tonumber (mask);													-- because the value provided might not be a number&lt;br /&gt;
		if is_set (mask) then&lt;br /&gt;
			name = string.rep (&amp;#039;—&amp;#039;, mask)										-- make a string that number length of mdashes&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; M A K E _ A U T H O R _ L I S T &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
form the authors display list:&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;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_author_list (args, number_of_authors)&lt;br /&gt;
	local authors = &amp;#039;&amp;#039;;&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 = number_of_authors;											-- 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 = string.format (&amp;#039;%s invalid &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|display-authors=&amp;lt;/code&amp;gt;; &amp;#039;, args.err_msg, code_style);&lt;br /&gt;
--				args.err_msg = args.err_msg .. &amp;#039; invalid |display-authors=&amp;#039;;	-- if zero, then emit error message&lt;br /&gt;
				count = number_of_authors;										-- and display all authors&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if count &amp;gt; number_of_authors then&lt;br /&gt;
			count = number_of_authors;											-- 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; number_of_authors 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 = number_of_authors;												-- 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 (authors) then&lt;br /&gt;
			authors = authors .. &amp;#039;; &amp;#039; .. make_name (args.last[i], args.first[i], args.link[i], args.mask[i]);	-- the rest of the authors&lt;br /&gt;
		else&lt;br /&gt;
			authors = make_name (args.last[i], args.first[i], args.link[i], args.mask[i]);	-- first author&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;
		authors = authors .. &amp;#039;; et al.&amp;#039;;										-- append et al.&lt;br /&gt;
	elseif &amp;#039;yes&amp;#039; == args.last_author_amp then&lt;br /&gt;
		authors = authors: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;
&lt;br /&gt;
--	if args.sepc ~= authors:sub(-1) and args.sepc .. &amp;#039;]]&amp;#039; ~= authors:sub(-3) then&lt;br /&gt;
--		authors = authors;											-- add separator if not same as last character in name list (|first=John S. or et al.)&lt;br /&gt;
--	end&lt;br /&gt;
																				-- TODO: better way to handle wikilink case?&lt;br /&gt;
	authors = authors:gsub (&amp;#039;%&amp;#039; .. args.sepc .. &amp;#039;$&amp;#039;, &amp;#039;&amp;#039;, 1);					-- remove trailing separator character&lt;br /&gt;
	authors = authors:gsub (&amp;#039;%&amp;#039; .. args.sepc .. &amp;#039;]]$&amp;#039;, &amp;#039;]]&amp;#039;, 1);				-- remove trailing separator character inside wikilink&lt;br /&gt;
&lt;br /&gt;
	return authors;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ I T E M &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function formats |item= and, if present, |item-url= into the linked part and if present appends |date= and&lt;br /&gt;
|type= with appropriate markup to complete the item portion of the citation.  This function assumes that item&lt;br /&gt;
has a value when it is called.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_item (item, url, item_date, item_type, item_access)&lt;br /&gt;
	local output = {};															-- table of item bits&lt;br /&gt;
	if is_set (url) then&lt;br /&gt;
		item = string.format (&amp;#039;[%s %s]&amp;#039;, url, item);							-- make item into an external wikilink&lt;br /&gt;
	end&lt;br /&gt;
	if item_access and (&amp;#039;subscription&amp;#039; == item_access or &amp;#039;registration&amp;#039; == item_access) then&lt;br /&gt;
		table.insert (output, table.concat ({									-- opening quote mark then add access icon markup to this item&lt;br /&gt;
						&amp;#039;&amp;quot;&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[item_access][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[item_access][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;
						item,&lt;br /&gt;
						&amp;#039;&amp;lt;/span&amp;gt;&amp;quot;&amp;#039;,												-- and close the span and close the quote&lt;br /&gt;
					}));&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;&amp;quot;%s&amp;quot;&amp;#039;, item));					-- enclose in quotes and add to table&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (item_date) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;(%s)&amp;#039;, item_date));				-- enclose in parentheses and add to table&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (item_type) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;[%s]&amp;#039;, item_type));				-- enclose in square brackets and add to table&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.concat (output, &amp;#039; &amp;#039;);											-- concatenate with space as separator&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ C O L L E C T I O N &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function formats |collection= and, if present, |collection-url= into the linked part and if present, appends&lt;br /&gt;
the values from |fonds=, |series=, |box=, |file=, |itemid=, and |page= or |pages= to complete the collection&lt;br /&gt;
portion of the citation.  This function assumes that collection has a value when it is called (because that is one&lt;br /&gt;
of the two required parameters)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_collection (args)&lt;br /&gt;
	local output = {};															-- table of collections bits&lt;br /&gt;
	local collection = args.collection;&lt;br /&gt;
	if is_set (args.collectionURL) then&lt;br /&gt;
		collection = string.format (&amp;#039;[%s %s]&amp;#039;, args.collectionURL, collection);				-- make collection into an external wikilink&lt;br /&gt;
	end&lt;br /&gt;
	table.insert (output, string.format (&amp;#039;%s&amp;#039;, collection));					-- enclose in quotes and add to table&lt;br /&gt;
	if is_set (args.fonds) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;Fonds: %s&amp;#039;, args.fonds));			-- format and add to table&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (args.series) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;Series: %s&amp;#039;, args.series));		-- format and add to table&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (args.box) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;Box: %s&amp;#039;, args.box));				-- format and add to table&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (args.file) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;File: %s&amp;#039;, args.file));			-- format and add to table&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (args.itemID) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;ID: %s&amp;#039;, args.itemID));				-- format and add to table&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (args.p) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;%s%s&amp;#039;, args.page_sep, args.p));&lt;br /&gt;
	elseif is_set (args.pp) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;%s%s&amp;#039;, args.pages_sep, args.pp));&lt;br /&gt;
	end      &lt;br /&gt;
 &lt;br /&gt;
 	if is_set (args.p) and is_set (args.pp) then&lt;br /&gt;
		args.err_msg = string.format (&amp;#039;%s more than one of &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|page=&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|pages=&amp;lt;/code&amp;gt;; &amp;#039;, args.err_msg, code_style, code_style);&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	return table.concat (output, &amp;#039;, &amp;#039;);											-- concatenate with comma space as separator&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ L O C A T I O N &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function formats |location=, |repository, and |institution= into the location portion of the citation.&lt;br /&gt;
This function assumes that |institution= (a required parameter) has a value when it is called.&lt;br /&gt;
&lt;br /&gt;
Unlike other groups of parameters, the required parameter is the &amp;#039;last&amp;#039; and separator characters are not all the same.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_location (location, repository, institution)&lt;br /&gt;
	local output = {};															-- table of location bits&lt;br /&gt;
	if is_set (location) then&lt;br /&gt;
		location = string.format (&amp;#039;%s: &amp;#039;, location);							-- format&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (repository) then&lt;br /&gt;
		table.insert (output, repository);										-- and add to table&lt;br /&gt;
	end&lt;br /&gt;
	table.insert (output, institution);											-- and add to table&lt;br /&gt;
	&lt;br /&gt;
	return string.format (&amp;#039;%s%s&amp;#039;, location, table.concat (output, &amp;#039;, &amp;#039;));		-- concatenate with comma space separators&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ I D E N T I F I E R S &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function formats |oclc= and |accession into the identifiers portion of the citation.  Neither of these&lt;br /&gt;
parameters are required.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_identifiers (args)&lt;br /&gt;
	local output = {};															-- table ofidentifier bits&lt;br /&gt;
	if is_set (args.oclc) then&lt;br /&gt;
		table.insert (output, string.format (&amp;#039;[[OCLC]]&amp;amp;nbsp;[https://www.worldcat.org/oclc/ %s]&amp;#039;, args.oclc));&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (args.accession) then&lt;br /&gt;
		table.insert (output, args.accession);&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat (output, args.sepc .. &amp;#039; &amp;#039;);								-- concatenate with sepc space as separator&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; _ C I T E _ A R C H I V E &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Assembles the various parts provided by the template into a properly formatted citation.  Adds punctuation&lt;br /&gt;
and text; encloses the whole within a cite tag with id and class attributes.&lt;br /&gt;
&lt;br /&gt;
This creates a CITEREF anchor from |last1= through |last4= and the year portion of |date= when |ref=harv.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function _cite_archive (args)&lt;br /&gt;
	local cite_open_tag;														-- holds CITEREF and css&lt;br /&gt;
	local authors = &amp;#039;&amp;#039;;															-- list of authors&lt;br /&gt;
	local identifiers = &amp;#039;&amp;#039;;														-- OCLC and accession identifiers list&lt;br /&gt;
	local result = {};															-- the assembly of the citation&amp;#039;s output&lt;br /&gt;
&lt;br /&gt;
-- form the anchor ID&lt;br /&gt;
	if is_set (args.ref) and &amp;#039;none&amp;#039; ~= args.ref and &amp;#039;harv&amp;#039; ~= args.ref then		-- |ref= has a value that is not &amp;#039;none&amp;#039; and not &amp;#039;harv&amp;#039; so use that value as the anchor ID&lt;br /&gt;
		cite_open_tag = &amp;#039;&amp;lt;cite id=&amp;quot;&amp;#039; .. args.ref .. &amp;#039;&amp;quot; class=&amp;quot;citation archive&amp;quot;&amp;gt;&amp;#039;;&lt;br /&gt;
	elseif 0 ~= #args.citeref and &amp;#039;none&amp;#039; ~= args.ref then						-- there is an author list and |ref= has a value that is not &amp;#039;none&amp;#039; so create a CITEREF anchor&lt;br /&gt;
		cite_open_tag = &amp;#039;&amp;lt;cite id=&amp;quot;CITEREF&amp;#039; .. table.concat (args.citeref) .. args.year .. &amp;#039;&amp;quot; class=&amp;quot;citation archive&amp;quot;&amp;gt;&amp;#039;;&lt;br /&gt;
	else&lt;br /&gt;
		cite_open_tag = &amp;#039;&amp;lt;cite class=&amp;quot;citation archive&amp;quot;&amp;gt;&amp;#039;;						-- no author list or |ref=none; no anchor ID&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #args.last then														-- if there are author names&lt;br /&gt;
		table.insert (result, make_author_list (args, #args.last));				-- assemble author name list and add to result table&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (args.item) then													-- if there is an item&lt;br /&gt;
		table.insert (result, make_item (args.item, args.itemURL, args.date, args.type, args.item_access));	-- build the item portion of the citation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.insert (result, make_collection (args));								-- build the collection portion of the citation (|collection= is required)&lt;br /&gt;
&lt;br /&gt;
	table.insert (result, make_location (args.location, args.repository, args.institution));	-- build the location portion of the citation (institution= is required)&lt;br /&gt;
&lt;br /&gt;
	identifiers = make_identifiers (args);										-- build the identifiers (oclc and accession) portion of the citation&lt;br /&gt;
	if is_set (identifiers) then&lt;br /&gt;
		table.insert (result, identifiers);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (args.accessdate) then&lt;br /&gt;
		table.insert (result, args.retrieved .. args.accessdate);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (args.via) then&lt;br /&gt;
		table.insert (result, args.viastr .. args.via);&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 class=&amp;quot;cs1-visible-error citation-comment&amp;quot;&amp;gt; cite archive:&amp;#039; .. args.err_msg .. &amp;#039; ([[Template:cite archive|help]])&amp;lt;/span&amp;gt;&amp;#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
-- and put it all together and be done&lt;br /&gt;
	return string.format (&amp;#039;%s%s%s&amp;lt;/cite&amp;gt;%s&amp;#039;, cite_open_tag, table.concat (result, args.sepc .. &amp;#039; &amp;#039;), args.ps, args.err_msg);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F . C I T E _ A R C H I V E &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Entry point from {{cite archive}} template.  Fetches parent frame parameters, does a bit of simple error checking&lt;br /&gt;
and calls _cite_archive() if required parameters are present.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function f.cite_archive (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;,													-- cs1|2 style page(s) prefixes&lt;br /&gt;
		pages_sep = &amp;quot;pp.&amp;amp;nbsp;&amp;quot;,&lt;br /&gt;
		retrieved = &amp;#039;Retrieved &amp;#039;,												-- cs1 style access date static text&lt;br /&gt;
		viastr = &amp;#039; – via &amp;#039;,&lt;br /&gt;
		sepc = &amp;#039;.&amp;#039;,																-- default to cs1 stylre&lt;br /&gt;
		ps = &amp;#039;.&amp;#039;,																-- default to cs1 stylre&lt;br /&gt;
		last = {},																-- table of author last name values&lt;br /&gt;
		first = {},																-- table of author first name values&lt;br /&gt;
		link = {},																-- table of author link values&lt;br /&gt;
		mask = {},																-- table of author mask values&lt;br /&gt;
		citeref = {}															-- table of last names that will be used in making the CITEREF anchor&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	local pframe = frame:getParent();											-- get template&amp;#039;s parameters&lt;br /&gt;
&lt;br /&gt;
	args.item = pframe.args.item or &amp;#039;&amp;#039;;											-- these are the &amp;#039;item&amp;#039; group&lt;br /&gt;
	args.itemURL = pframe.args[&amp;#039;item-url&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.item_access = pframe.args[&amp;#039;item-url-access&amp;#039;];&lt;br /&gt;
	args.type = pframe.args.type or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.date = pframe.args.date or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.year = args.date:match (&amp;#039;%d%d%d%d&amp;#039;) or &amp;#039;&amp;#039;;								-- used in creation of the CITEREF anchor&lt;br /&gt;
&lt;br /&gt;
	args.collection = pframe.args.collection or &amp;#039;&amp;#039;;								-- these are the collection group&lt;br /&gt;
	args.collectionURL = pframe.args[&amp;#039;collection-url&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.fonds = pframe.args.fonds or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.series = pframe.args.series or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.file = pframe.args.file or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.box = pframe.args.box or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.itemID = pframe.args[&amp;#039;item-id&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.p = pframe.args.page or pframe.args.p or &amp;#039;&amp;#039;;							-- if both are set, the singular is rendered&lt;br /&gt;
	args.pp = pframe.args.pages or pframe.args.pp or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.repository = pframe.args.repository or &amp;#039;&amp;#039;;								-- these are the location group&lt;br /&gt;
	args.location = pframe.args.location or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.institution = pframe.args.institution or &amp;#039;&amp;#039;;							-- required parameter&lt;br /&gt;
&lt;br /&gt;
	args.oclc = pframe.args.oclc or &amp;#039;&amp;#039;;											-- these are the identifiers group&lt;br /&gt;
	args.accession = pframe.args.accession or &amp;#039;&amp;#039;;&lt;br /&gt;
	&lt;br /&gt;
	if not is_set (args.collection) then										-- check for required parameters&lt;br /&gt;
		args.err_msg = string.format (&amp;#039; &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|collection=&amp;lt;/code&amp;gt; required; &amp;#039;, code_style);&lt;br /&gt;
	end&lt;br /&gt;
	if not is_set (args.institution) then&lt;br /&gt;
		args.err_msg = string.format (&amp;#039;%s &amp;lt;code style=&amp;quot;%s&amp;quot;&amp;gt;|institution=&amp;lt;/code&amp;gt; required; &amp;#039;, args.err_msg, code_style);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (args.err_msg) then												-- if set here, then we are missing one or both required parameters so quit&lt;br /&gt;
		return &amp;#039;&amp;lt;span class=&amp;quot;cs1-visible-error citation-comment&amp;quot;&amp;gt;cite archive:&amp;#039; .. args.err_msg .. &amp;#039; ([[Template:cite archive|help]])&amp;lt;/span&amp;gt;&amp;#039;;	-- with an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
																				-- standard cs1|2 parameters&lt;br /&gt;
	args.accessdate = pframe.args[&amp;#039;access-date&amp;#039;] or pframe.args.accessdate or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.via = pframe.args[&amp;#039;via&amp;#039;] or pframe.args.via or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	args.ref = pframe.args.ref 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 author names to display&lt;br /&gt;
	args.last_author_amp = pframe.args[&amp;#039;last-author-amp&amp;#039;] or					-- yes only; |last-author-amp=no does not work&lt;br /&gt;
				pframe.args[&amp;#039;lastauthoramp&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	args.last_author_amp:lower();												-- make it case agnostic&lt;br /&gt;
	&lt;br /&gt;
	if is_set (pframe.args[&amp;#039;last1&amp;#039;]) or is_set (pframe.args[&amp;#039;last&amp;#039;]) or&lt;br /&gt;
		is_set (pframe.args[&amp;#039;author1&amp;#039;]) or is_set (pframe.args[&amp;#039;author&amp;#039;]) then	-- must have at least this to continue&lt;br /&gt;
		&lt;br /&gt;
		args.last[1] = select_one ({											-- get first author&amp;#039;s last name&lt;br /&gt;
			[&amp;#039;last&amp;#039;]=pframe.args.last,&lt;br /&gt;
			[&amp;#039;last1&amp;#039;] = pframe.args.last1,&lt;br /&gt;
			[&amp;#039;author&amp;#039;] = pframe.args.author,&lt;br /&gt;
			[&amp;#039;author1&amp;#039;] = pframe.args.author1}, args);&lt;br /&gt;
		args.citeref[1] = args.last[1];											-- add it to the citeref&lt;br /&gt;
&lt;br /&gt;
		args.first[1] = select_one ({											-- get first author&amp;#039;s first name&lt;br /&gt;
			[&amp;#039;first&amp;#039;] = pframe.args.first,&lt;br /&gt;
			[&amp;#039;first1&amp;#039;] = pframe.args.first1}, args);&lt;br /&gt;
		args.link[1] = select_one ({											-- get first author&amp;#039;s article link&lt;br /&gt;
			[&amp;#039;author-link&amp;#039;] = pframe.args[&amp;#039;author-link&amp;#039;],&lt;br /&gt;
			[&amp;#039;author-link1&amp;#039;] = pframe.args[&amp;#039;author-link1&amp;#039;]}, args);&lt;br /&gt;
		args.mask[1] = select_one ({											-- get first author&amp;#039;s mask&lt;br /&gt;
			[&amp;#039;author-mask&amp;#039;] = pframe.args[&amp;#039;author-mask&amp;#039;],&lt;br /&gt;
			[&amp;#039;author-mask1&amp;#039;] = pframe.args[&amp;#039;author-mask1&amp;#039;]}, args);&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];						-- author-links&lt;br /&gt;
			args.mask[i] = pframe.args[&amp;#039;author-mask&amp;#039;..i];						-- author-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 &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 separator character to comma, cs2 mode&lt;br /&gt;
		args.retrieved = args.retrieved:lower();&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat ({&lt;br /&gt;
		frame:extensionTag (&amp;#039;templatestyles&amp;#039;, &amp;#039;&amp;#039;, {src=&amp;#039;Module:Citation/CS1/styles.css&amp;#039;}),	-- add template styles for access icons and .citation&lt;br /&gt;
		_cite_archive (args)													-- go render the citation&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return f;&lt;/div&gt;</summary>
		<author><name>imported&gt;GreenC</name></author>
	</entry>
</feed>