<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="nl">
	<id>https://wiki-raamsdonk.nl/index.php?action=history&amp;feed=atom&amp;title=Module%3ACatalog_lookup_link</id>
	<title>Module:Catalog lookup link - Bewerkingsoverzicht</title>
	<link rel="self" type="application/atom+xml" href="https://wiki-raamsdonk.nl/index.php?action=history&amp;feed=atom&amp;title=Module%3ACatalog_lookup_link"/>
	<link rel="alternate" type="text/html" href="https://wiki-raamsdonk.nl/index.php?title=Module:Catalog_lookup_link&amp;action=history"/>
	<updated>2026-04-03T18:29:16Z</updated>
	<subtitle>Bewerkingsoverzicht voor deze pagina op de wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki-raamsdonk.nl/index.php?title=Module:Catalog_lookup_link&amp;diff=113708&amp;oldid=prev</id>
		<title>Colani: 1 versie geïmporteerd</title>
		<link rel="alternate" type="text/html" href="https://wiki-raamsdonk.nl/index.php?title=Module:Catalog_lookup_link&amp;diff=113708&amp;oldid=prev"/>
		<updated>2024-07-07T10:36:52Z</updated>

		<summary type="html">&lt;p&gt;1 versie geïmporteerd&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nieuwe pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
|1=, |2=, |3=, |4=, |5=, |6=, |7=, |8=, |9=: Optional unnamed parameters for 0 to 9 items to be listed.&lt;br /&gt;
	Whitespace is trimmed off both ends and the strings are urlencoded as if they were query strings.&lt;br /&gt;
|article-link=: Optional Wikipedia article name to link to.&lt;br /&gt;
|article-name=: Optional alternative text to be displayed for |article-link= link in front of catalog link.&lt;br /&gt;
	If not specified, |article-link= is used for display as well. If both parameters are not specified, the prefix is omitted completely.&lt;br /&gt;
|article-suffix=: Optional symbol to be displayed after article name or link (f.e. &amp;quot;:&amp;quot;; omitted, if not defined).&lt;br /&gt;
|link-prefix=: Optional prefix portion of url to external catalog item(s).&lt;br /&gt;
|link-suffix=: Optional suffix portion of url to external catalog item(s).&lt;br /&gt;
|item-prefix=: Optional text displayed in front of each external link (omitted, if not defined)&lt;br /&gt;
|item-suffix=: Optional text displayed immediately after each external link (omitted, if not defined)&lt;br /&gt;
|list-separator=: Optional alternative separator displayed between list items (default: &amp;quot;, &amp;quot;, if not specified). Whitespace must be encoded.&lt;br /&gt;
|list-leadout=: Optional alternative leadout text displayed between the last two list items (f.e. &amp;quot;and&amp;quot;, &amp;quot;or&amp;quot;, &amp;quot;as well as&amp;quot;, etc., default is the |list-separator= or &amp;quot;, &amp;quot;.)&lt;br /&gt;
|leadout-suffix=: Optional alternative suffix text of the leadout (see |list-leadout=) displayed between the last two list items.&lt;br /&gt;
	This gets added in front of the last list item instead of the default whitespace which is added without this parameter.&lt;br /&gt;
	This may be necessary if |list-separator= is used not only to define the list separator but also parts of the item prefix&lt;br /&gt;
	(except for the first one). (At present, this is used only to cope with format oddities of the {{MR}} template.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
new parameters that support access icons:&lt;br /&gt;
|allowed_icons= – comma-separated list of keywords: free, limited, registration, subscription, none, all (default; &amp;#039;all&amp;#039; implied when this parameter empty or omitted)&lt;br /&gt;
	the icons specified in the following parameters are checked agains the list in |allowed-icons=; not in the list? not displayed&lt;br /&gt;
|url-access-all= – applies specified icon to all items in the list; accepted keywords: free, limited, registration, subscription;&lt;br /&gt;
|url-accessn= – applies specified icon to item n of the list (the nth positional parameter); accepted keywords: free, limited, registration, subscription;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
require(&amp;#039;strict&amp;#039;);&lt;br /&gt;
local getArgs = require (&amp;#039;Module:Arguments&amp;#039;).getArgs;&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;id-lock-free&amp;#039;, &amp;#039;Freely accessible&amp;#039;},&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; I S _ S E T &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Returns true if argument is set; false otherwise. Argument is &amp;#039;set&amp;#039; when it exists (not nil) or when it is not an empty string.&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; M A K E _ L A B E L &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Makes a wikilinked or plain text label from arguments; when both link and display text is provided, makes a&lt;br /&gt;
wikilink in the form [[L|D]]; if only link is provided, makes a wikilinked label in the form [[L]]; if only display&lt;br /&gt;
is provided, makes a plain-text label; if neither are provided makes a label from suffix, returns an empty string else.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function make_label (link, display, suffix)&lt;br /&gt;
local label = &amp;#039;&amp;#039;;&lt;br /&gt;
	if is_set (link) then&lt;br /&gt;
		if is_set (display) then&lt;br /&gt;
			label = table.concat ({&amp;#039;[[&amp;#039;, link, &amp;#039;|&amp;#039;, display, &amp;#039;]]&amp;#039;});			-- make [[L|D]] wikilinked label&lt;br /&gt;
		else&lt;br /&gt;
			label = table.concat ({&amp;#039;[[&amp;#039;, link, &amp;#039;]]&amp;#039;});							-- make [[L]] wikilinked label&lt;br /&gt;
		end&lt;br /&gt;
	elseif is_set (display) then&lt;br /&gt;
		label = display;														-- plain-text label&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (label) then														&lt;br /&gt;
		return table.concat ({label, suffix, &amp;#039;&amp;amp;nbsp;&amp;#039;});						-- assemble the complete label&lt;br /&gt;
	else&lt;br /&gt;
		return suffix;															-- no space after suffix if no label&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I C O N _ I N D E X _ G E T &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns index into lock_icons[] if value assigned to |url-access= or |url-access-all= is a valid icon selector&lt;br /&gt;
(free, limited, registration, subscription)&lt;br /&gt;
&lt;br /&gt;
icon selection may be limited to a subset of the icons with:&lt;br /&gt;
	|allow_icons=&amp;lt;comma-separated list of allowed icons&amp;gt;&lt;br /&gt;
&amp;lt;comma-separated list of allowed icons&amp;gt; may be any of the keywords: free, limited, registration, subscription, none, all&lt;br /&gt;
&lt;br /&gt;
keyword &amp;#039;all&amp;#039; is default condition; &amp;#039;all&amp;#039; is implied when |allowed=icons= is empty or omitted&lt;br /&gt;
&lt;br /&gt;
keyword &amp;#039;none&amp;#039; for use with identifiers where icons are inappropriate (isbn, issn, oclc)&lt;br /&gt;
&lt;br /&gt;
Templates using this module should set:&lt;br /&gt;
	|allow_icons=free for most identifiers;&lt;br /&gt;
	|allow_icons=none for isbn, issn, oclc, etc&lt;br /&gt;
&lt;br /&gt;
|url-access= is alias of |url-access1=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function icon_index_get (args, k)&lt;br /&gt;
	local icon;&lt;br /&gt;
	local param_name = (1 == k and is_set (args[&amp;#039;url-access&amp;#039;]) and &amp;#039;url-access&amp;#039;) or table.concat ({&amp;#039;url-access&amp;#039;, k});	-- make an enumerated parameter name&lt;br /&gt;
&lt;br /&gt;
	if is_set (args[&amp;#039;url-access-all&amp;#039;]) and lock_icons[args[&amp;#039;url-access-all&amp;#039;]] then	-- if set and valid&lt;br /&gt;
		icon = args[&amp;#039;url-access-all&amp;#039;];											-- tentatively &lt;br /&gt;
&lt;br /&gt;
	elseif is_set (args[param_name]) and lock_icons[args[param_name]] then		-- if set and valid&lt;br /&gt;
		icon = args[param_name];												-- tentatively&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		return nil;																-- neither |url-access-all= nor |url-accessn= set so return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args[&amp;#039;allow_icons&amp;#039;] and args[&amp;#039;allow_icons&amp;#039;]:find (&amp;#039;none&amp;#039;) then			-- if &amp;#039;none&amp;#039; keyword is present&lt;br /&gt;
		return nil;																-- icons display not allowed&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (args[&amp;#039;allow_icons&amp;#039;]) or args[&amp;#039;allow_icons&amp;#039;]:find (&amp;#039;all&amp;#039;) or args[&amp;#039;allow_icons&amp;#039;]:find (icon) then	--if all allowed or specified icon is allowed&lt;br /&gt;
		return icon;															-- return selected icon as index into icon table&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A I N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Template entrypoint to this module; arguments come primarily from the parent frame though in templates that use&lt;br /&gt;
this module, |allowed-icons= is typically set, if needed, in the {{#invoke:}}.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function main (frame)&lt;br /&gt;
	local args = getArgs (frame);&lt;br /&gt;
	local out_text = &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	if is_set(args[1]) then&lt;br /&gt;
		local result = {};&lt;br /&gt;
		local label;&lt;br /&gt;
		&lt;br /&gt;
		local article_suffix = args[&amp;#039;article-suffix&amp;#039;] or args[&amp;#039;article-postfix&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
		local link_prefix = args[&amp;#039;link-prefix&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
		local link_suffix = args[&amp;#039;link-suffix&amp;#039;] or args[&amp;#039;link-postfix&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
		local item_prefix = args[&amp;#039;item-prefix&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
		local item_suffix = args[&amp;#039;item-suffix&amp;#039;] or args[&amp;#039;item-postfix&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
		local list_separator = args[&amp;#039;list-separator&amp;#039;] or &amp;#039;, &amp;#039;;&lt;br /&gt;
		local leadout_suffix = args[&amp;#039;leadout-suffix&amp;#039;] or args[&amp;#039;leadout-postfix&amp;#039;] or &amp;#039; &amp;#039;;&lt;br /&gt;
		local list_leadout;&lt;br /&gt;
&lt;br /&gt;
		local icon_index;&lt;br /&gt;
		&lt;br /&gt;
		if is_set (args[&amp;#039;list-leadout&amp;#039;]) then&lt;br /&gt;
			list_leadout = table.concat ({&lt;br /&gt;
				mw.ustring.gsub (args[&amp;#039;list-leadout&amp;#039;], &amp;#039;^(%a)&amp;#039;, &amp;#039; %1&amp;#039;),			-- insert leading space if first character is a letter&lt;br /&gt;
				leadout_suffix,&lt;br /&gt;
			});&lt;br /&gt;
		else&lt;br /&gt;
			list_leadout = &amp;#039;&amp;#039;;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		label = make_label (args[&amp;#039;article-link&amp;#039;], args[&amp;#039;article-name&amp;#039;], article_suffix);&lt;br /&gt;
&lt;br /&gt;
		for k, item in ipairs (args) do											-- for each of the positional parameters&lt;br /&gt;
			item = mw.text.trim (item);											-- remove extraneous whitespace&lt;br /&gt;
			if is_set (link_prefix) then										-- if there is link prefix...&lt;br /&gt;
				item = table.concat ({											-- create an external link item&lt;br /&gt;
					&amp;#039;[&amp;#039;,														-- open ext link markup&lt;br /&gt;
					link_prefix,												-- url prefix&lt;br /&gt;
					mw.uri.encode (item),										-- item is part of url&lt;br /&gt;
					link_suffix,												-- url suffix&lt;br /&gt;
					&amp;#039; &amp;#039;,														-- required space between url and label&lt;br /&gt;
					item_prefix,												-- label prefix&lt;br /&gt;
					item,														-- item as label&lt;br /&gt;
					item_suffix,												-- item suffix&lt;br /&gt;
					&amp;#039;]&amp;#039;															-- close ext link markup&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				icon_index = icon_index_get (args, k);							-- set if icon specified and allowed for this item; nil else&lt;br /&gt;
				if icon_index then&lt;br /&gt;
					item = 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[icon_index][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[icon_index][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;#039;,												-- and close the span&lt;br /&gt;
					});&lt;br /&gt;
				end	&lt;br /&gt;
			else&lt;br /&gt;
				item = table.concat ({											-- create an unlinked item&lt;br /&gt;
					item_prefix,												-- label prefix&lt;br /&gt;
					item,														-- item as label&lt;br /&gt;
					item_suffix,												-- item suffix&lt;br /&gt;
				});&lt;br /&gt;
			end&lt;br /&gt;
	&lt;br /&gt;
			table.insert (result, item);										-- add the item to the result list&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		out_text = frame:callParserFunction(&amp;#039;#tag&amp;#039;, {&amp;#039;templatestyles&amp;#039;, &amp;#039;&amp;#039;, src=table.concat({&lt;br /&gt;
			&amp;#039;Module:Citation/CS1&amp;#039;,&lt;br /&gt;
			mw.ustring.match(frame:getTitle(), &amp;#039;/sandbox$&amp;#039;) or &amp;#039;&amp;#039;,&lt;br /&gt;
			&amp;#039;/styles.css&amp;#039;,&lt;br /&gt;
		})});&lt;br /&gt;
		if is_set (args[&amp;#039;list-leadout&amp;#039;]) then&lt;br /&gt;
			out_text = table.concat ({out_text, label, mw.text.listToText (result, list_separator, list_leadout)});&lt;br /&gt;
		else&lt;br /&gt;
			out_text = table.concat ({out_text, label, table.concat (result, list_separator)});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end	--is_set (args[1])&lt;br /&gt;
&lt;br /&gt;
	return out_text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {main = main};&lt;/div&gt;</summary>
		<author><name>Colani</name></author>
	</entry>
</feed>