On 10/14/2010 7:15 PM, Ariel Barreiro wrote:
I am trying to develop a very quick macro to a mantis site we are
using for bugtracking (yes, I know, I should be using trac, but it's
not a change we've been able to do yet). I kind of got the grip on the
macro code (I am on the hello world stage anyway) and I got a macro
working for pages but it doesn't appear to work on revision logs.

It works fine on the changeset view, but not on the revision log, in
the revision log I get the following: [[mantis(...)]] (as plain-text).
The macro does something there because otherwise I would get a link to
create a wiki page, but it doesn't get properly expanded as on wiki
pages or changeset pages.

That's "normal", well, expected at least. Macros are currently not expanded by the OneLinerFormatter, which is used in the Revision Log. The verbose mode for the revision log uses the normal display and there the macro will be expanded.

In the future (0.13), Macros will either expand to block content or line content, and in the latter case will also be shown in oneliner output mode.

Is there a way to accomplish this?

But yes, in the meantime you should use a IWikiSyntaxProvider extension, in that case.

Luckily for you, someone had exactly the same problem as you with Mantis ;-)
Take a look at the following single file plugin http://trac.edgewall.org/attachment/wiki/ChristianBoos/mantis_tickets.py (I see there's also http://trac.edgewall.org/attachment/wiki/ChristianBoos/mantis_tickets_link.py not by me and untested, YMMV).

Is this a bug?

No.

Any help will be appreciate it.

And while we are at it, what's the standard way to output a link using
the trac API, I was about to use plain html but I am sure there's a
'proper' way of doing it.

You should use the genshi builder tag.a("label", href=url), or reuse the formatter methods (private ones, unfortunately, see abovementioned plugin).

-- Christian

--
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to trac-...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to