Hi,

I'm developing a trac macro to make it easier for wiki editors to add links to 
an external tool.

In Wiki-Markup they can then use a macro:

[[MyLink(my_value)]]

to have a link in trac style on their wiki page to the external tool.

The format of the link is similar to this:

myschema://myserver:1234/this/that/page?param1=value1&param2=value2&param3=my_value&param4=value4

My py code (I'm not a python developer, but developing C/C++. Google helps me 
with python) looks like this in the macro file (I modified the example from 
here https://trac.edgewall.org/wiki/0.12/WikiMacros):

from genshi.core import Markup
from trac.wiki.macros import WikiMacroBase
from trac.wiki import Formatter
import StringIO

class MyLinkMacro(WikiMacroBase):
        def expand_macro(self, formatter, name, text, args):
                the_link = 
'[myschema://myserver:1234/this/that/page?param1=value1&param2=value2&param3=' 
+ text + '&param4=value4 ' + text + ']'

                # Convert Wiki markup to HTML, new style
                out = StringIO.StringIO()
                Formatter(self.env, formatter.context).format(the_link, out)
                return Markup(out.getvalue())

My problem is, that the link is rendered but does not work afterwards because 
"&" is replaced by "&" and without any deeper knowledge of python and trac 
development I'm blocked in progress.

Any help is appreciated.

Best regards
Torge

CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: 
+49 711 7825-4000, Internet: www.cenit.com
Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz, 
Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), 
Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 
SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 
00 SWIFT-Code : COBADEFF600,
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to