Module:Live song: Difference between revisions

From SPCodex, The Smashing Pumpkins wiki
No edit summary
No edit summary
Line 7: Line 7:
mw.logObject(tease)
mw.logObject(tease)


if cover and (tease or abandoned) then
if cover ~= '' and (tease ~= '' or abandoned ~= '') then
if title == '' then
if title == '' then
title = name
out = out .. name
else
out = out .. title
end
end
out = out .. title
else
else
out = out .. '[[' .. name
out = out .. '[[' .. name

Revision as of 21:22, 22 July 2020

Documentation for this module may be created at Module:Live song/doc

local p = {}

function p._entry(name, title, note, cover, tease, abandoned)
	local out = '"'
	mw.logObject(title)
	mw.logObject(cover)
	mw.logObject(tease)

	if cover ~= '' and (tease ~= '' or abandoned ~= '') then
		if title == '' then
			out = out .. name
		else
			out = out .. title
		end
	else
		out = out .. '[[' .. name

		if title ~= '' then
			out = out .. '|' .. title
		end
	end

	if not(cover ~= '' and (tease ~= '' or abandoned ~= '')) then
		out = out .. ']]'
	end

	out = out .. '" '

	if cover ~= '' then
		out = out .. '<nowiki>[</nowiki>' .. cover .. '<nowiki>]</nowiki>&nbsp;'
	end

	if tease ~= '' and abandoned ~= '' then
		out = out .. '(tease / abandoned)&nbsp;'
	elseif tease ~= '' then
		out = out .. '(tease)&nbsp;'
	elseif abandoned ~= '' then
		out = out .. '(abandoned)&nbsp;'
	end

	if note ~= '' then
		out = out .. '(' .. note .. ')'
	end

	return out
end

function p.entry(frame)
	local name = frame.args[1]
	local title = frame.args[2]
	local note = frame.args[3]
	local cover = frame.args[4]
	local tease = frame.args[5]
	local abandoned = frame.args[6]
	return p._entry(name, title, note, cover, tease, abandoned)
end

return p