wiki:ExtractUrlPlugin

Version 7 (modified by figaro, 7 years ago) (diff)

Cosmetic changes

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.

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

2 / 2

Download

Download the zipped source from here.

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.

Usage

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

The argument raw controls if the returned link should point to a brows-able (False) or download-able (True) target. The second one can be used in image or similar tags.

Example

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

4773 by martin_s on 2008-11-11 22:47:34
Initial version.
4772 by martin_s on 2008-11-11 22:46:22
New hack ExtractUrlPlugin, created by martin_s
(more)

Author/Contributors

Author: martin_s
Maintainer: Martin Scharrer
Contributors: