Opened 16 years ago
Last modified 3 years ago
#7728 new enhancement
Realm URL resolve function needed Trac Plugins
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | topic-wikiengine |
Component: | general | Version: | |
Severity: | minor | Keywords: | traclinks |
Cc: | martin@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In the current Trac code there seems to be no separate function/method to resolve a given TracLink to an full valid URL which can be used in XHTML code returned by macros.
I'm talking about macro similar to the Image macro which takes a trac realm like 'source:
' or 'attachment:
'. The Image macro has this resolving hardcoded while this should be an own method provided to all macros.
At the moment several macros on TracHacks (FlashViewPlugin, FreemindMacro, …) implement there own (sometimes incomplete and buggy) implementation of this.
An easy solution would be just to take the relevant code out of the Image macro and put it in an separate method. This must be already implemented somewhere else too because the same conversation is done by 'wiki_to_html
' etc.
If there is already such an method I couldn't find it. I searched the trac source code, check several macro and the Nabble trac forum.
Attachments (1)
Change History (10)
comment:1 by , 16 years ago
comment:4 by , 14 years ago
Keywords: | traclinks added |
---|---|
Milestone: | next-minor-0.12.x → 0.13 |
Owner: | changed from | to
Severity: | normal → minor |
This will be possible with the WikiDom API.
comment:5 by , 14 years ago
In the meantime I implemented the th:ExtractUrlPlugin to provide a way get the href
of any TracLink.
While this is good for me, I still think such a function should still be provided by Trac itself.
comment:6 by , 14 years ago
Milestone: | 0.13 → 0.14-wikiengine |
---|
comment:7 by , 11 years ago
Keywords: | traclink added; traclinks removed |
---|
comment:8 by , 11 years ago
Keywords: | traclinks added; traclink removed |
---|
comment:9 by , 9 years ago
Owner: | removed |
---|
After going through a lot of trac and plugin code I found the (relative new?) method '
extract_link
' which does half of the needed work. Because an 'Element
' object is returned the href can be extracted without using an regular expression.Because I couldn't find an example or documentation for this I coded a simple example so future macro developer have something to start with. Please find it attached. Please be aware that I'm a Perl programmer which is relative new to Python.
IMHO a method with code like this should be put in WikiMacroBase because many macro programmers need this.