Content deleted Content added
←Created page with 'local p = {} function p.main(frame) local args = {} -- discard empty parameters and trim whitespace for k, v in frame:getParent().args do if v and mw.ust...' |
pairs |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3:
function p.main(frame)
local args = {}
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
▲ local output = ''
if args[1] then
local i = 1
Line 17 ⟶ 24:
if args['article-link'] or args['article-name'] then
if args['article-link'] then
else
end
else
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
end
else -- if not last item or list-leadout isn't specified
end
end
Line 40 ⟶ 47:
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
i = i + 1
end
end
if lockIcon[args['url-access']] or args['plain-links'] then
return output▼
out = '<span class="plainlinks">' .. out .. '</span>'
end
end
|