Changes between Version 10 and Version 11 of ExtractUrlPlugin


Ignore:
Timestamp:
Apr 13, 2018, 5:47:21 PM (6 years ago)
Author:
figaro
Comment:

Moved example to functional description

Legend:

Unmodified
Added
Removed
Modified
  • ExtractUrlPlugin

    v10 v11  
    66
    77This 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.
     8
     9As an example
     10The definition of this plugin is as follows:
     11
     12{{{#!python
     13from tracextracturl import extract_url
     14# ...
     15  url = extract_url (env, context, wikilink, raw=False)
     16}}}
     17
     18The 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.
     19
     20As an example you could have this:
     21
     22{{{#!python
     23from tracextracturl import extract_url
     24
     25def MyMacro(WikiMacroBase):
     26  def expand_macro (self, formatter, name, content):
     27     # e.g. wikilink = 'wiki:WikiStart'
     28     url = extract_url(self.env, formatter.context, wikilink)
     29}}}
    830
    931== Bugs/Feature Requests
     
    3153General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page.
    3254
    33 == Example
    34 
    35 The definition of this plugin is as follows:
    36 
    37 {{{#!python
    38 from tracextracturl import extract_url
    39 # ...
    40   url = extract_url (env, context, wikilink, raw=False)
    41 }}}
    42 
    43 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.
    44 
    45 As an example you could have this:
    46 
    47 {{{#!python
    48 from tracextracturl import extract_url
    49 
    50 def MyMacro(WikiMacroBase):
    51   def expand_macro (self, formatter, name, content):
    52      # e.g. wikilink = 'wiki:WikiStart'
    53      url = extract_url(self.env, formatter.context, wikilink)
    54 }}}
    55 
    5655== Recent Changes
    5756