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(&#039;strict&#039;)<br /> <br /> local getArgs = require(&#039;Module:Arguments&#039;).getArgs<br /> local p = {}<br /> <br /> -- Entry point when #invoke&#039;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] ~= &#039;&#039; 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] ~= &#039;&#039; then<br /> if string.match(args[1], &quot;^[Tt]%d+$&quot;) then<br /> -- It&#039;s a Phab task, so just use it as is (minus the &quot;T&quot;)<br /> task = string.gsub(args[1], &quot;^[Tt]&quot;, &quot;&quot;)<br /> elseif string.match(args[1], &quot;^%d+$&quot;) then<br /> -- It&#039;s a bzImport, so massage it first<br /> task = args[1] + 2000<br /> else<br /> -- Tracking arg given, but doesn&#039;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(&#039;div&#039;)<br /> :attr(&quot;role&quot;, &quot;note&quot;)<br /> :addClass(&#039;tracked&#039;)<br /> :addClass(&#039;plainlinks&#039;)<br /> box:tag(&#039;span&#039;)<br /> :addClass(&#039;tracked-header&#039;)<br /> :wikitext(&#039;Tracked in [[phabricator:|Phabricator]]&#039;)<br /> if task then<br /> box:addClass(&#039;mw-trackedTemplate&#039;)<br /> :addClass(&quot;phab-T&quot; .. task) -- Easily find the task in JS<br /> :attr(&#039;data-phab-task&#039;, task) -- Task ID for easy access in JS<br /> local linktext = mw.html.create(&#039;span&#039;)<br /> :addClass(&#039;tracked-linktext&#039;)<br /> :wikitext(&quot;Task T&quot; .. task)<br /> local wikitext_link = &#039;[[phabricator:T&#039; .. task .. &#039;|&#039; .. tostring(linktext) .. &#039;]]&#039;<br /> box:tag(&#039;span&#039;)<br /> :addClass(&#039;tracked-link&#039;)<br /> :wikitext(wikitext_link)<br /> end<br /> <br /> local s = {<br /> resolved = &quot;Resolved&quot;,<br /> fixed = &quot;Resolved&quot;,<br /> invalid = &quot;Invalid&quot;,<br /> duplicate = &quot;Duplicate&quot;,<br /> declined = &quot;Declined&quot;,<br /> wontfix = &quot;Declined&quot;,<br /> stalled = &quot;Stalled&quot;,<br /> open = &quot;Open&quot;<br /> }<br /> <br /> if manual_status then<br /> local status_text = &quot;Unknown&quot;<br /> local status_span = box:tag(&#039;span&#039;)<br /> status_span:addClass(&#039;tracked-closure&#039;)<br /> if manual_status == &quot;resolved&quot; or manual_status == &quot;fixed&quot; then<br /> status_span:addClass(&#039;tracked-resolved&#039;)<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