Content deleted Content added
tweak formatting |
Implement url-access |
||
Line 66:
function p.main (frame)
local args = getArgs (frame);
if is_set(args[1]) then▼
▲ local result = {};
▲ if is_set(args[1]) then
local result = {};
local link_prefix = args['link-prefix'] or '';▼
local lock_icons = {
local link_postfix = args['link-postfix'] or '';▼
['free'] = '[[File:Lock-green.svg|9px|link=|alt=Freely accessible|Freely accessible]]',
local item_prefix = args['item-prefix'] or '';▼
['registration'] = '[[File:Lock-blue-alt-2.svg|9px|link=|alt=Free registration required|Free registration required]]',
local item_postfix = args['item-postfix'] or '';▼
['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]]',
local list_leadout;▼
list_leadout = table.concat ({▼
leadout_postfix,▼
▲ });
else▼
local url_access = lock_icons[mw.text.trim(args['url-access'] or '')] or '';
list_leadout = '';▼
end▼
if
▲ list_leadout = table.concat ({
mw.ustring.match(mw.ustring.sub(args['list-leadout'],1,1), '[%a]') and ' ' or '',
args['list-leadout'],
▲ leadout_postfix,
});
▲ list_leadout = '';
article = make_wikilink (args['article-link'], args['article-name']);
if is_set (article) then
Line 112 ⟶ 120:
item_postfix, -- item postfix
']' -- close ext link markup
});
if is_set (url_access) then
item = table.concat ({
item,
'<span style="padding-left:0.15em;">',
url_access,
'</span>'
});
end
else
item = table.concat ({ -- create an unlinked item
Line 118 ⟶ 135:
item, -- item as label
item_postfix, -- item postfix
end
Line 125 ⟶ 142:
if is_set (args['list-leadout']) then
else
end
if is_set (url_access) then
out_text = mw.html.create('span')
:addClass('plainlinks')
:wikitext(out)
end
return ''▼
end
end
|