Module:Live song: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
local function link(name, title)
local out = '[['
if title == '' then
out = out .. name
else
out = out .. title .. '|' .. name
end
return out .. ']]'
end


function p._entry(name, title, note, cover, tease, abandoned)
function p._entry(name, title, note, cover, tease, abandoned)
Line 5: Line 17:


if cover ~= '' and (tease ~= '' or abandoned ~= '') then
if cover ~= '' and (tease ~= '' or abandoned ~= '') then
if title == '' then
local mw_title = mw.title.makeTitle(0, name)
 
if mw_title.exists then
out = out .. link(name, title)
else
out = out .. name
out = out .. name
else
out = out .. title
end
end
else
else
out = out .. '[[' .. name
out = out .. link(name, title)
 
if title ~= '' then
out = out .. '|' .. title
end
end
end