wiki:ExtractUrlPlugin

Version 6 (modified by figaro, 9 years ago) (diff)

Cosmetic changes

Plug-in to extract URL from TracWiki links in Plug-ins 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 e.g. 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 and Source

Download the [download:extracturlplugin zipped source], check out here using Subversion, or browse the source with Trac.

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

17893 by rjollos on 2020-12-03 21:46:14
TracExtractUrl 0.5: Add release command
17892 by rjollos on 2020-12-03 21:44:39
TracExtractUrl 0.5: Remove www prefix from URL
17115 by rjollos on 2018-04-12 21:50:07
TracExtractUrl 0.4: Make compatible with Trac 1.3.2+

Conform to PEP8.

(more)

Author/Contributors

Author: martin_s
Maintainer: Martin Scharrer
Contributors: