wiki:ExtractUrlPlugin

Extract URL from Trac wiki links in plugins and macros

Description

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.

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)

Bugs/Feature Requests

Existing bugs and feature requests for ExtractUrlPlugin are here.

If you have any issues, create a new ticket.

defect

2 / 2

task

1 / 1

Download

Download the zipped source from here.

The plugin is also available on PyPi.

Source

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

Installation

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

Recent Changes

17115 by rjollos on 2018-04-12 21:50:07
TracExtractUrl 0.4: Make compatible with Trac 1.3.2+

Conform to PEP8.

17114 by rjollos on 2018-04-12 21:41:17
Remove empty directory
16394 by rjollos on 2017-03-25 09:20:58
Remove eggs
(more)

Author/Contributors

Author: martin_s
Maintainer: Martin Scharrer
Contributors:

Last modified 2 months ago Last modified on Apr 13, 2018, 5:48:07 PM