https://en.seminaverbi.bibleget.io/w/index.php?title=Module:Catalog_lookup_link&feed=atom&action=historyModule:Catalog lookup link - Revision history2024-03-29T00:56:33ZRevision history for this page on the wikiMediaWiki 1.41.0https://en.seminaverbi.bibleget.io/w/index.php?title=Module:Catalog_lookup_link&diff=22661&oldid=prevJohnrdorazio at 12:55, September 10, 20202020-09-10T12:55:13Z<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:55, September 10, 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l59">Line 59:</td>
<td colspan="2" class="diff-lineno">Line 59:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if is_set (link) then</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if is_set (link) then</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if is_set (display) then</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if is_set (display) then</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> label = table.concat ({'[[', link, '|', display, ']]'}); -- make [[L|D]] wikilinked label</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> label = table.concat ({'[[<ins style="font-weight: bold; text-decoration: none;">wikipedia:</ins>', link, '|', display, ']]'}); -- make [[L|D]] wikilinked label</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> label = table.concat ({'[[', link, ']]'}); <del style="font-weight: bold; text-decoration: none;"> </del>-- make [[L]] wikilinked label</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> label = table.concat ({'[[<ins style="font-weight: bold; text-decoration: none;">wikipedia:', link, '|</ins>', link, ']]'}); <ins style="font-weight: bold; text-decoration: none;"> </ins>-- make [[L]] wikilinked label</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> elseif is_set (display) then</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> elseif is_set (display) then</div></td></tr>
<!-- diff cache key seminaverbi_en:diff:1.41:old-1154:rev-22661:php=table -->
</table>Johnrdoraziohttps://en.seminaverbi.bibleget.io/w/index.php?title=Module:Catalog_lookup_link&diff=1154&oldid=prevJohnrdorazio: 1 revision imported2020-08-21T19:40:15Z<p>1 revision imported</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:40, August 21, 2020</td>
</tr><tr><td colspan="4" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr>
<!-- diff cache key seminaverbi_en:diff:1.41:old-1153:rev-1154 -->
</table>Johnrdoraziohttps://en.seminaverbi.bibleget.io/w/index.php?title=Module:Catalog_lookup_link&diff=1153&oldid=preven>Trappist the monk: fix lock icon css class;2020-07-17T10:11:36Z<p>fix lock icon css class;</p>
<p><b>New page</b></p><div>--[[<br />
|1=, |2=, |3=, |4=, |5=, |6=, |7=, |8=, |9=: Optional unnamed parameters for 0 to 9 items to be listed.<br />
Whitespace is trimmed off both ends and the strings are urlencoded as if they were query strings.<br />
|article-link=: Optional Wikipedia article name to link to.<br />
|article-name=: Optional alternative text to be displayed for |article-link= link in front of catalog link.<br />
If not specified, |article-link= is used for display as well. If both parameters are not specified, the prefix is omitted completely.<br />
|article-suffix=: Optional symbol to be displayed after article name or link (f.e. ":"; omitted, if not defined).<br />
|link-prefix=: Optional prefix portion of url to external catalog item(s).<br />
|link-suffix=: Optional suffix portion of url to external catalog item(s).<br />
|item-prefix=: Optional text displayed in front of each external link (omitted, if not defined)<br />
|item-suffix=: Optional text displayed immediately after each external link (omitted, if not defined)<br />
|list-separator=: Optional alternative separator displayed between list items (default: ", ", if not specified). Whitespace must be encoded.<br />
|list-leadout=: Optional alternative leadout text displayed between the last two list items (f.e. "and", "or", "as well as", etc., default is the |list-separator= or ", ".)<br />
|leadout-suffix=: Optional alternative suffix text of the leadout (see |list-leadout=) displayed between the last two list items.<br />
This gets added in front of the last list item instead of the default whitespace which is added without this parameter.<br />
This may be necessary if |list-separator= is used not only to define the list separator but also parts of the item prefix<br />
(except for the first one). (At present, this is used only to cope with format oddities of the {{MR}} template.)<br />
<br />
<br />
new parameters that support access icons:<br />
|allowed_icons= – comma-separated list of keywords: free, limited, registration, subscription, none, all (default; 'all' implied when this parameter empty or omitted)<br />
the icons specified in the following parameters are checked agains the list in |allowed-icons=; not in the list? not displayed<br />
|url-access-all= – applies specified icon to all items in the list; accepted keywords: free, limited, registration, subscription;<br />
|url-accessn= – applies specified icon to item n of the list (the nth positional parameter); accepted keywords: free, limited, registration, subscription;<br />
<br />
]]<br />
<br />
require('Module:No globals');<br />
local getArgs = require ('Module:Arguments').getArgs;<br />
local lock_icons = { --icon classes are defined in Module:Citation/CS1/styles.css<br />
['free'] = {'id-lock-free', 'Freely accessible'},<br />
['registration'] = {'id-lock-registration', 'Free registration required'},<br />
['limited'] = {'id-lock-limited', 'Free access subject to limited trial, subscription normally required'},<br />
['subscription'] = {'id-lock-subscription', 'Paid subscription required'},<br />
}<br />
<br />
<br />
--[[--------------------------< I S _ S E T >------------------------------------------------------------------<br />
<br />
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.<br />
<br />
]]<br />
<br />
local function is_set( var )<br />
return not (var == nil or var == '');<br />
end<br />
<br />
<br />
--[=[-------------------------< M A K E _ L A B E L >----------------------------------------------------------<br />
<br />
Makes a wikilinked or plain text label from arguments; when both link and display text is provided, makes a<br />
wikilink in the form [[L|D]]; if only link is provided, makes a wikilinked label in the form [[L]]; if only display<br />
is provided, makes a plain-text label; if neither are provided makes a label from suffix, returns an empty string else.<br />
<br />
]=]<br />
<br />
local function make_label (link, display, suffix)<br />
local label = '';<br />
if is_set (link) then<br />
if is_set (display) then<br />
label = table.concat ({'[[', link, '|', display, ']]'}); -- make [[L|D]] wikilinked label<br />
else<br />
label = table.concat ({'[[', link, ']]'}); -- make [[L]] wikilinked label<br />
end<br />
elseif is_set (display) then<br />
label = display; -- plain-text label<br />
end<br />
<br />
if is_set (label) then <br />
return table.concat ({label, suffix, '&nbsp;'}); -- assemble the complete label<br />
else<br />
return suffix; -- no space after suffix if no label<br />
end<br />
end<br />
<br />
<br />
--[[--------------------------< I C O N _ I N D E X _ G E T >--------------------------------------------------<br />
<br />
returns index into lock_icons[] if value assigned to |url-access= or |url-access-all= is a valid icon selector<br />
(free, limited, registration, subscription)<br />
<br />
icon selection may be limited to a subset of the icons with:<br />
|allow_icons=<comma-separated list of allowed icons><br />
<comma-separated list of allowed icons> may be any of the keywords: free, limited, registration, subscription, none, all<br />
<br />
keyword 'all' is default condition; 'all' is implied when |allowed=icons= is empty or omitted<br />
<br />
keyword 'none' for use with identifiers where icons are inappropriate (isbn, issn, oclc)<br />
<br />
Templates using this module should set:<br />
|allow_icons=free for most identifiers;<br />
|allow_icons=none for isbn, issn, oclc, etc<br />
<br />
|url-access= is alias of |url-access1=<br />
<br />
]]<br />
<br />
local function icon_index_get (args, k)<br />
local icon;<br />
local param_name = (1 == k and is_set (args['url-access']) and 'url-access') or table.concat ({'url-access', k}); -- make an enumerated parameter name<br />
<br />
if is_set (args['url-access-all']) and lock_icons[args['url-access-all']] then -- if set and valid<br />
icon = args['url-access-all']; -- tentatively <br />
<br />
elseif is_set (args[param_name]) and lock_icons[args[param_name]] then -- if set and valid<br />
icon = args[param_name]; -- tentatively<br />
<br />
else<br />
return nil; -- neither |url-access-all= nor |url-accessn= set so return nil<br />
end<br />
<br />
if args['allow_icons'] and args['allow_icons']:find ('none') then -- if 'none' keyword is present<br />
return nil; -- icons display not allowed<br />
end<br />
<br />
if not is_set (args['allow_icons']) or args['allow_icons']:find ('all') or args['allow_icons']:find (icon) then --if all allowed or specified icon is allowed<br />
return icon; -- return selected icon as index into icon table<br />
end<br />
end<br />
<br />
<br />
--[[--------------------------< M A I N >----------------------------------------------------------------------<br />
<br />
Template entrypoint to this module; arguments come primarily from the parent frame though in templates that use<br />
this module, |allowed-icons= is typically set, if needed, in the {{#invoke:}}.<br />
<br />
]]<br />
<br />
local function main (frame)<br />
local args = getArgs (frame);<br />
local out_text = '';<br />
<br />
if is_set(args[1]) then<br />
local result = {};<br />
local label;<br />
<br />
local article_suffix = args['article-suffix'] or args['article-postfix'] or '';<br />
local link_prefix = args['link-prefix'] or '';<br />
local link_suffix = args['link-suffix'] or args['link-postfix'] or '';<br />
local item_prefix = args['item-prefix'] or '';<br />
local item_suffix = args['item-suffix'] or args['item-postfix'] or '';<br />
local list_separator = args['list-separator'] or ', ';<br />
local leadout_suffix = args['leadout-suffix'] or args['leadout-postfix'] or ' ';<br />
local list_leadout;<br />
<br />
local icon_index;<br />
<br />
if is_set (args['list-leadout']) then<br />
list_leadout = table.concat ({<br />
mw.ustring.gsub (args['list-leadout'], '^(%a)', ' %1'), -- insert leading space if first character is a letter<br />
leadout_suffix,<br />
});<br />
else<br />
list_leadout = '';<br />
end<br />
<br />
label = make_label (args['article-link'], args['article-name'], article_suffix);<br />
<br />
for k, item in ipairs (args) do -- for each of the positional parameters<br />
item = mw.text.trim (item); -- remove extraneous whitespace<br />
if is_set (link_prefix) then -- if there is link prefix...<br />
item = table.concat ({ -- create an external link item<br />
'[', -- open ext link markup<br />
link_prefix, -- url prefix<br />
mw.uri.encode (item), -- item is part of url<br />
link_suffix, -- url suffix<br />
' ', -- required space between url and label<br />
item_prefix, -- label prefix<br />
item, -- item as label<br />
item_suffix, -- item suffix<br />
']' -- close ext link markup<br />
});<br />
<br />
icon_index = icon_index_get (args, k); -- set if icon specified and allowed for this item; nil else<br />
if icon_index then<br />
item = table.concat ({ -- add access icon markup to this item<br />
'<span class="', -- open the opening span tag; icon classes are defined in Module:Citation/CS1/styles.css<br />
lock_icons[icon_index][1], -- add the appropriate lock icon class<br />
'" title="', -- and the title attribute<br />
lock_icons[icon_index][2], -- for an appropriate tool tip<br />
'">', -- close the opening span tag<br />
item,<br />
'</span>', -- and close the span<br />
});<br />
end <br />
else<br />
item = table.concat ({ -- create an unlinked item<br />
item_prefix, -- label prefix<br />
item, -- item as label<br />
item_suffix, -- item suffix<br />
});<br />
end<br />
<br />
table.insert (result, item); -- add the item to the result list<br />
end<br />
<br />
if is_set (args['list-leadout']) then<br />
out_text = table.concat ({label, mw.text.listToText (result, list_separator, list_leadout)});<br />
else<br />
out_text = table.concat ({label, table.concat (result, list_separator)});<br />
end<br />
<br />
end --is_set (args[1])<br />
<br />
return out_text<br />
end<br />
<br />
return {main = main};</div>en>Trappist the monk