Module:Catalog lookup link: Difference between revisions

Content deleted Content added
No edit summary
m documentation;
Line 16:
This may be necessary if |list-separator= is used not only to define the list separator but also parts of the item prefix
(except for the first one). (At present, this is used only to cope with format oddities of the {{MR}} template.)
 
 
new parameters that support access icons:
|allowed_icons= – comma-separated list of keywords: free, limited, registration, subscription, none, all (default; same as parameter empty or omitted)
the icons specified in the following parameters are checked agains the list in |allowed-icons=; not in the list? not displayed
|url-access-all= – applies specified icon to all items in the list; accepted keywords: free, limited, registration, subscription;
|url-accessn= – applies specified icon to item n of the list (the nth positional parameter); accepted keywords: free, limited, registration, subscription;
 
]]
Line 38 ⟶ 45:
 
local function is_set( var )
return not (var and== nil or mw.ustring.match(var, == '%S')) and true or false;
end
 
Line 75 ⟶ 82:
(free, limited, registration, subscription)
 
icon selection may be limited to a subset of the icons with:
When used in templates for source identifiers (doi, PMC, jstor, etc) limit icon selection to free perhaps with"
|allow_icons=<comma -separated list of allowed icons>
<comma-separated list of allowed icons> may be any of the keywords: free, limited, registration, subscription, none, all
default when |allow_icons=<empty> or missing) allows all;
 
keyword 'all' is default condition; same when |allowed=icons= is empty of omitted
 
keyword 'none' for use with identifiers where icons are inappropriate (isbn, issn, oclc)
 
Templates using this module should set:
|allow_icons=free for most identifiers;
|allow_icons=none for isbn, issn, oclc, etc
 
]]
Line 100 ⟶ 113:
end
 
if not is_set (args['allow_icons']) or ('all' == args['allow_icons']:find ('all') or args['allow_icons']:find (icon) then --if all allowed or specified icon is allowed
return icon; -- return selected icon as index into icon table
end
Line 108 ⟶ 121:
--[[--------------------------< M A I N >----------------------------------------------------------------------
 
Template entrypoint to this module; arguments come primarily from the parent frame though in templates that use
this module, |allowed-icons= is typically set, if needed, in the {{#invoke:}}.
 
]]