Opened 20 years ago
Closed 20 years ago
#2916 closed defect (fixed)
OutlineFormatter does not handle macros properly
| Reported by: | Emmanuel Blot | Owned by: | Christian Boos | 
|---|---|---|---|
| Priority: | normal | Milestone: | 0.10 | 
| Component: | wiki system | Version: | devel | 
| Severity: | normal | Keywords: | wikiprocessor outline macro | 
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
As initially exposed in #2829, the [[PageOutline]] macro is not able to properly cope with embedded macros.
In trunk/trac/wiki/formatter.py, OutlineFormatter class is in charge of rendering the outline of a wiki page.
There is a special trick to prevent from rendering nested macros: the default _macro_formatter method is overloaded so that macros are not rendered in the outline. However, this overloaded method only deals with [[MacroName]] styles of macros. It does not cope with the {{{!#macroname ...}}} style of macros.
With macros implemented using the second syntax such as GraphvizPlugin, the outline invokes the macro rendering. The consequences are:
- macros are rendered twice (once to render the outline body, once to render the wiki page body)
 - macros are implicitly nested, which may be a source of potential issues
 - the nested macro received an invalid 
reqobject, which is the cause of page rendering failure as described in #2829. 
I think the rendering of macros using the second style should be prevented, as it is already done with the first style of macros.
I attach a dirty patch that shows one way to fix this issue, but I don't really know the wiki formatter code, so I don't think that's the better way to fix it, nor if it breaks some other Wiki tag rendering. In other words, do not merge it into the trunk, I attach it to help understanding the issue.
Attachments (1)
Change History (5)
by , 20 years ago
| Attachment: | wikifmt.patch added | 
|---|
comment:1 by , 20 years ago
| Milestone: | → 0.9.4 | 
|---|---|
| Version: | devel → 0.9.4 | 
Tried this patch with 0.9.4 and it didn't work. I'm still getting errors with [[MacroList]]
Error: Macro MacroList(None) failed global name 'inspect' is not defined
comment:2 by , 20 years ago
| Milestone: | 0.9.4 | 
|---|---|
| Version: | 0.9.4 → devel | 
comment:3 by , 20 years ago
| Keywords: | wikiprocessor outline macro added | 
|---|---|
| Milestone: | → 0.10 | 
| Owner: | changed from to | 
Scott, I believe that your problem is actually related to #2917, not this one.
Manu, I'll have a look at the issue.



  
special handler for [[PageOutline]] and {{{#macro}}}