Extract URL from Trac wiki links in plugins and macros


This plugin provides the function extract_url, which can be used in Trac plugins and macros to extract the URL of any TracWiki link, for example generation of links in produced HTML code.

Bugs/Feature Requests

Existing bugs and feature requests for ExtractUrlPlugin are here.

If you have any issues, create a new ticket.


2 / 2


1 / 1


Download the zipped source from here.

There is also a version on PyPi.


Check out here using Subversion, or browse the source with Trac.


General instructions on installing Trac plugins can be found on the TracPlugins page.


The definition of this plugin is as follows:

from tracextracturl import extract_url
# ...
  url = extract_url (env, context, wikilink, raw=False)

The optional argument raw controls whether the returned link should point to a brows-able (False) or download-able (True) target. The value True can be used in image or similar tags. False is the default value.

As an example you could have this:

from tracextracturl import extract_url

def MyMacro(WikiMacroBase):
  def expand_macro (self, formatter, name, content):
     # e.g. wikilink = 'wiki:WikiStart'
     url = extract_url(self.env, formatter.context, wikilink)

Recent Changes

16394 by rjollos on 2017-03-25 09:20:58
Remove eggs
15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

8545 by martin_s on 2010-08-30 21:57:33
Added encoding meta-comment and declared SVN keywords as unicode to avoid issues with non-english locales.


Author: martin_s
Maintainer: Martin Scharrer

Last modified 2 years ago Last modified on Jan 23, 2016, 7:36:38 AM