Okay folks, this one has me stumped.

[[MyMacro(args)]] works just fine. I tested in using a number of commands,
even nested ones. Except where you'd expect it not to, such as {{{...}}}.

Until I got to headings. Which pisses me off because those are exactly the
elements it's designed for. Instead of expansion, I get:

[[MyMacro(...)]] -- literally, the three dots instead of the arguments as
I observed in a string verbatim/monospace context. Examples:

 * '''''[[MyMacro(args)]]''''' -- works just fine

{{{[[MyMacro(args)]]}}} -- string literal, args are displayed

= [[MyMacro(args)]] = -- borked, looking at the rendered HTML I get:

<h1 id="MyMacro...">[[MyMacro(...)]]</h1>

In general, the macro returns plain text. Sometimes with spaces, less
often with punctuation characters, never with anything odd like unicode
characters or HTML tags (which shouldn't matter either, other than XSS
injection risks associated with untrusted data). The data is in fact
fairly trustworthy, never from say an anonymous visitor or anything
along those lines.

So I went ahead and attempted to break the heading wiki markup with
all sorts of things, and it handled them just fine. Stripping or entity
encoding dangerous characters, compressing whitespace in the id value,
and so on, just like you'd expect from a smart engine.

So the question is, how do I delay the rendering engine from kicking
in until after my macro returns a string? I've tried all sorts of
techniques based on existing macros and read through all the docs.
I realize I could code the macro to *only* return the valid heading
itself. But I don't want to restrict it to that role alone.

Go easy gurus, I'm fairly new to Trac and this is my first macro so...

Oh, platform: Ubuntu 8.04, Apache 2.2, mod_python, Trac 0.11 under
the Python (2.5) Trac development environment. Browse the source at:

http://github.com/dwclifton/tracinigetmacro/tree/master/0.11

TIA,

-- 
Douglas Clifton
[email protected]
http://loadaveragezero.com/drx/rss/recent
http://loadaveragezero.com/app/wp/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to