Module:Phabricator

This is an old revision of this page, as edited by Hex (talk | contribs) at 22:11, 24 December 2024 (New module; to replace innards of Template:Phabricator). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

p.task = function(frame)
	local paramId = frame.args[1]
	local paramTitle = frame.args[2]
	local paramArt = frame.args['art']
	local paramArticle = frame.args['article']

	if not paramId then
		return '[https://phabricator.wikimedia.org/ Phabricator]'
	end

	local output = ''
	local taskId

	if (string.find(paramId, '^T%d+$')) then
		taskId = paramId
	elseif (string.find(paramId, '^%d+$')) then
		taskId = 'T' .. paramId
	end

	output = p.makePhabWikiLink(taskId, taskId)

	if (paramTitle) then
		output = output .. ' • ' .. p.makePhabWikiLink(taskId, paramTitle)
	end
	
	local articleLink = false
	
	local honk = 'honk'
	honk = 'bonk' .. honk
	if ((paramArt == 'y') or (paramArticle == 'y')) then
--		return honk
		output = '[[Wikipedia:Phabricator|Phabricator]]: ' .. output
	end

	return output
end

function p.makePhabWikiLink(taskId, linkTitle)
	return '[[Phabricator:' .. taskId .. '|' .. linkTitle .. ']]'
end

return p