https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ATracked
Module:Tracked - Revision history
2025-05-30T06:45:33Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.3
https://en.wikipedia.org/w/index.php?title=Module:Tracked&diff=1271743062&oldid=prev
Namoroka: from enwikisource :s:Module:Tracked 14459324
2025-01-25T13:36:23Z
<p>from enwikisource <a href="https://en.wikisource.org/wiki/Module:Tracked" class="extiw" title="s:Module:Tracked">s:Module:Tracked</a> 14459324</p>
<p><b>New page</b></p><div>require('strict')<br />
<br />
local getArgs = require('Module:Arguments').getArgs<br />
local p = {}<br />
<br />
-- Entry point when #invoke'ed by a template or wikipage.<br />
function p.main(frame)<br />
local args = getArgs(frame)<br />
return p._main(args)<br />
end<br />
<br />
-- Entry point when called from other Lua modules.<br />
function p._main(args)<br />
-- Check if the template provided a status<br />
local manual_status<br />
if args[2] ~= nil and args[2] ~= '' then<br />
manual_status = args[2]<br />
end<br />
<br />
-- Check if the template provided a tracker number<br />
local task<br />
if args[1] ~= nil and args[1] ~= '' then<br />
if string.match(args[1], "^[Tt]%d+$") then<br />
-- It's a Phab task, so just use it as is (minus the "T")<br />
task = string.gsub(args[1], "^[Tt]", "")<br />
elseif string.match(args[1], "^%d+$") then<br />
-- It's a bzImport, so massage it first<br />
task = args[1] + 2000<br />
else<br />
-- Tracking arg given, but doesn't match our patterns<br />
-- FIXME: Emit a visible error for this? Tracking cat?<br />
end<br />
else<br />
-- No tracking number provided.<br />
-- FIXME: Emit a visible error for this? Tracking cat?<br />
end<br />
<br />
-- Now create the top level container<br />
local box = mw.html.create('div')<br />
:attr("role", "note")<br />
:addClass('tracked')<br />
:addClass('plainlinks')<br />
box:tag('span')<br />
:addClass('tracked-header')<br />
:wikitext('Tracked in [[phabricator:|Phabricator]]')<br />
if task then<br />
box:addClass('mw-trackedTemplate')<br />
:addClass("phab-T" .. task) -- Easily find the task in JS<br />
:attr('data-phab-task', task) -- Task ID for easy access in JS<br />
local linktext = mw.html.create('span')<br />
:addClass('tracked-linktext')<br />
:wikitext("Task T" .. task)<br />
local wikitext_link = '[[phabricator:T' .. task .. '|' .. tostring(linktext) .. ']]'<br />
box:tag('span')<br />
:addClass('tracked-link')<br />
:wikitext(wikitext_link)<br />
end<br />
<br />
local s = {<br />
resolved = "Resolved",<br />
fixed = "Resolved",<br />
invalid = "Invalid",<br />
duplicate = "Duplicate",<br />
declined = "Declined",<br />
wontfix = "Declined",<br />
stalled = "Stalled",<br />
open = "Open"<br />
}<br />
<br />
if manual_status then<br />
local status_text = "Unknown"<br />
local status_span = box:tag('span')<br />
status_span:addClass('tracked-closure')<br />
if manual_status == "resolved" or manual_status == "fixed" then<br />
status_span:addClass('tracked-resolved')<br />
end<br />
if s[manual_status] ~= nil then<br />
status_text = s[manual_status]<br />
end<br />
status_span:wikitext(status_text)<br />
end<br />
return tostring(box)<br />
end<br />
<br />
return p</div>
Namoroka