wiki:RegexLinkPlugin

Version 14 (modified by ComaVN, 5 years ago) (diff)

--

Turn anything matching a certain regex into a link

Description

A disadvantage of using InterWiki to link to external pages is that the user has to put a prefix before the link, for example MeatBall:InterMapTxt.

In some cases, the actual text to be linked is distinctive enough to be turned into a link without many false positives. For example, TOPdesk service management software uses identifiers like '0811 123' for incidents. When text of this form occurs, it could be automatically rendered into a link to the relevant TOPdesk page.

The intention of this Trac plugin is to allow these kinds of links to be made with a minimum of configuration, based on a regex that matches the external identifiers.

Known issues

  • Unnamed groups in the regex cannot be used in the url (#4146)

Bugs/Feature Requests

Existing bugs and feature requests for RegexLinkPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out RegexLinkPlugin from here using Subversion, or browse the source with Trac.

trunk is where active development occurs (on trac 0.11), tags contains released versions, and any development for other trac versions will occur in branches

Example

in trac.ini:

[regexlink]
regex1 = \b(?P<topdeskyymm>\d\d(?:0[1-9]|1[0-2])) (?P<topdesknr>\d{3})\b
url1 = http://topdesk/query=\g<topdeskyymm>%20\g<topdesknr>
regex2 = \bexample(?P<exampleid>\d+)\b
url2 = http://example.org/\g<exampleid>

This means 0811 123 becomes a link to http://topdesk/query=0811%0123, and example123 becomes a link to http://example.org/123

(the topdesk url is not correct, this is an example only)

Recent Changes

[4969] by ComaVN on 2008-12-06 20:29:30
credits
[4870] by ComaVN on 2008-11-25 00:12:43
increased trunk version to 0.3
[4869] by ComaVN on 2008-11-25 00:11:44
tagged 0.2 version

Author/Contributors

Author: ComaVN
Contributors: