Trac Changeset Links from Chatzilla
Update: Chatzilla 0.9.78 breaks this script. Looks like I'll have to add some priority levels to the munger rules when I get some spare time.
Update: New version 0.2, here, allows per-channel Trac sites.
Following this tutorial, I just wrote a Chatzilla script that makes links to Trac changesets from IRC text matching /r\d{1,6}/. You enter:
r42
and you see:
<a href="http://.../changeset/42">r42</a>
It's a bit rough (no per-channel control) but useful enough.
Under your "Auto-load scripts" directory, create a sub-directory named "trac-rev". Save the following script as trac-rev/init.js and modify the changeset URL accordingly:
CHANGESET_URL = "http://YOUR_PROJECT/changeset/%s"; function initPlugin(glob) { plugin.id = "trac-rev"; plugin.major = 0; plugin.minor = 1; plugin.version = plugin.major + "." + plugin.minor; plugin.description = "link to trac revisions"; client.munger.addRule( "trac-rev-link", /(?:\s|\W|^)(r\d{1,6})/i, mungerTracRev, 1 ); display(plugin.id + " v" + plugin.version + " enabled."); } function mungerTracRev(matchText, containerTag) { var number = matchText.match(/(\d+)/i)[1]; var anchor = document.createElementNS("http://www.w3.org/1999/xhtml", "html:a"); anchor.setAttribute("href", CHANGESET_URL.replace("%s", number)); anchor.setAttribute("class", "chatzilla-link"); anchor.appendChild(document.createTextNode(matchText)) containerTag.appendChild(anchor); }
Comments
Re: Trac Changeset Links from Chatzilla
Author: Christopher Schmidt
Sounds like what oltrac does: