Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Ahecht/Catalog lookup link
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p.main(frame) local args = {} local out = '' local defaultSeparator = ', ' local lockIcon = { ['free'] = '[[File:Lock-green.svg|9px|link=|alt=Freely accessible|Freely accessible]]', ['registration'] = '[[File:Lock-blue-alt-2.svg|9px|link=|alt=Free registration required|Free registration required]]', ['limited'] = '[[File:Lock-blue-alt-2.svg|9px|link=|alt=Free access subject to limited trial, subscription normally required|Free access subject to limited trial, subscription normally required]]', ['subscription'] = '[[File:Lock-red-alt.svg|9px|link=|alt=Paid subscription required|Paid subscription required]]', } -- discard empty parameters and trim whitespace for k, v in pairs(frame:getParent().args) do if v and mw.ustring.match(v,'%S') then args[k] = mw.text.trim(v) end end if args[1] then local i = 1 while args[i] do if i == 1 then -- if first item, add article link if args['article-link'] or args['article-name'] then if args['article-link'] then out = '[[' .. args['article-link'] .. '|' .. (args['article-name'] or args['article-link']) .. ']]' else out = args['article-name'] end out = out .. (args['article-postfix'] or '') .. ' ' else out = (args['article-postfix'] or '') end else -- otherwise, add separator if ( (not args[i+1]) and args['list-leadout'] ) then -- if last item if mw.ustring.match(mw.ustring.sub(args['list-leadout'],1,1), '[%a]') then out = out .. ' ' end out = out .. args['list-leadout'] .. args['leadout-postfix'] .. ' ' else -- if not last item or list-leadout isn't specified out = out .. (args['list-separator'] or defaultSeparator) end end -- generate link local item = (args['item-prefix'] or '') .. args[i] .. (args['item-postfix'] or '') if args['link-prefix'] then item = '[' .. args['link-prefix'] .. mw.uri.encode(args[i]) .. (args['link-postfix'] or '') .. ' '.. item .. ']' if lockIcon[args['url-access']] then item = item .. '<span style="padding-left:0.15em;">' .. lockIcon[args['url-access']] .. '</span>' end end out = out .. item i = i + 1 end end if lockIcon[args['url-access']] or args['plain-links'] then out = '<span class="plainlinks">' .. out .. '</span>' end return out end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Ahecht/Catalog lookup link/doc
(
edit
)