#2916: OutlineFormatter does not handle macros properly
--------------------+-------------------------------------------------------
 Reporter:  eblot   |       Owner:  jonas
     Type:  defect  |      Status:  new  
 Priority:  normal  |   Milestone:       
Component:  wiki    |     Version:  devel
 Severity:  normal  |    Keywords:       
--------------------+-------------------------------------------------------
 As initially exposed in #2829, the ![[PageOutline]] macro is not able to
 properly cope with embedded macros.

 In [source:/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 [http://trac-
 hacks.org/wiki/GraphvizPlugin GraphvizPlugin], the outline invokes the
 macro rendering. The consequences are:
  1. macros are rendered twice (once to render the outline body, once to
 render the wiki page body)
  1. macros are implicitly nested, which may be a source of potential
 issues
  1. the nested macro received an invalid `req` object, 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.

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2916>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to