Module:Separated entries: Difference between revisions

Content deleted Content added
m Changed protection level for "Module:Separated entries": High-risk Lua module: Over 2M transclusions ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 8:
 
function p._main(args)
local span = args.span or false
local author = args.author or false
local separator = args.separator
-- Decode (convert to Unicode) HTML escape sequences, such as " " for space.
and mw.text.decode(args.separator) or ''
if span then
separator = '</span>' .. separator .. '<span>'
end
local conjunction = args.conjunction and mw.text.decode(args.conjunction) or separator
-- Discard values before the starting parameter.
Line 19 ⟶ 24:
-- Discard named parameters.
local values = compressSparseArray(args)
if span then
return mw.text.listToText(values, separator, conjunction)
local spanAttrs = {}
if author then
spanAttrs.class = 'templatequote-author'
end
return mw.text.tag( 'span', spanAttrs, mw.text.listToText(values, separator, conjunction) )
else
return mw.text.listToText(values, separator, conjunction)
end
end
 
Line 35 ⟶ 48:
p.br = makeInvokeFunction('<br />')
p.comma = makeInvokeFunction(mw.message.new('comma-separator'):plain())
 
return p