[Trac-tickets] Re: [The Trac Project] #1009: Should be a way to
differentiate external links from links to the project server
The Trac Project
noreply at edgewall.com
Mon Jan 31 05:01:49 EST 2005
#1009: Should be a way to differentiate external links from links to the project
server
-------------------------+--------------------------------------------------
Id: 1009 | Status: new
Component: wiki | Modified: Mon Jan 31 05:01:49 2005
Severity: enhancement | Milestone:
Priority: normal | Version: devel
Owner: jonas | Reporter: Juanma Barranquero
-------------------------+--------------------------------------------------
Comment (by Juanma Barranquero):
Broken again. There goes the full patch:
{{{
#!text/x-diff
Index: trac/WikiFormatter.py
===================================================================
--- trac/WikiFormatter.py (revision 1231)
+++ trac/WikiFormatter.py (working copy)
@@ -58,2 +58,9 @@
self._href = absurls and env.abs_href or env.href
+ self._local = env.get_config('project', 'url')
+
+ def link_type(self, link):
+ if self._local and link.find(self._local) == 0:
+ return 'loc-link'
+ else:
+ return 'ext-link'
@@ -151,3 +158,3 @@
def _make_ext_link(self, url, text):
- return '<a class="ext-link" href="%s">%s</a>' % (url, text)
+ return '<a class="%s" href="%s">%s</a>' % (self.link_type(url),
url, text)
}}}
FWIW, I still think something like that ''should'' be done in Trac, not as
an external patch...
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/1009>
The Trac Project <>
More information about the Trac-Tickets
mailing list