Content deleted Content added
out→out_text |
positional url-access parameters |
||
Line 21:
require('Module:No globals');
local getArgs = require ('Module:Arguments').getArgs;
}▼
local p = {};
Line 36 ⟶ 42:
--[=[-------------------------< M A K E _
Makes a
wikilink in the form [[L|D]]; if only link is provided,
is provided, makes a plain-text label; if neither are provided makes a label from postfix, returns an empty string else.
]=]
local function
local label = '';
if is_set (link) then
if is_set (display) then
else
end
elseif is_set (display) then
label = display; -- plain-text label
end▼
return table.concat ({label, postfix, ' '}); -- assemble the complete label
else
return postfix or ''; -- no space after postfix if no label
end
end
Line 68 ⟶ 78:
local args = getArgs (frame);
local out_text = '';
if is_set(args[1]) then
local result = {};
local
▲ local lock_icons = {
▲ ['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]]',
local article_postfix = args['article-postfix'] or '';
Line 87 ⟶ 90:
local list_separator = args['list-separator'] or ', ';
local leadout_postfix = args['leadout-postfix'] or ' ';
local access_index;
local url_access = lock_icons[mw.text.trim(args['url-access'] or '')] or '';▼
local list_leadout;
if is_set (args['list-leadout']) then
list_leadout = table.concat ({
Line 100 ⟶ 103:
end
▲ if is_set (article) then
end▼
for k, item in ipairs (args) do -- for each of the positional parameters
item = mw.text.trim (item); -- remove extraneous whitespace
Line 122 ⟶ 120:
});
access_index = table.concat ({'url-access', k}); -- make an enumerated index
local access_icon;
if is_set (args[access_index]) then -- if set
access_icon = lock_icons[args[access_index]]
▲ end
if not access_icon then -- if lock_icons[access_icon]not set
▲
end▼
if access_icon then
item = table.concat ({ -- add access icon markup to this item
'<span class="plainlinks">', -- this link is plain
item,
'<span style="padding-left:0.15em;">', -- and replaced with
access_icon, -- the appropriate icon
'</span>', -- and close the spans
'</span>'
});
end
else
item = table.concat ({ -- create an unlinked item
Line 142 ⟶ 150:
if is_set (args['list-leadout']) then
out_text = table.concat ({
else
out_text = table.concat ({
end
end
▲ end
▲ end
return out_text
|