Edgewall Software
Modify

Opened 18 years ago

Closed 18 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:

  1. macros are rendered twice (once to render the outline body, once to render the wiki page body)
  2. macros are implicitly nested, which may be a source of potential issues
  3. 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.

Attachments (1)

wikifmt.patch (1.5 KB ) - added by Emmanuel Blot 18 years ago.
special handler for [[PageOutline]] and {{{#macro}}}

Download all attachments as: .zip

Change History (5)

by Emmanuel Blot, 18 years ago

Attachment: wikifmt.patch added

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

comment:1 by Scott Grayban <evilborg2001@…>, 18 years ago

Milestone: 0.9.4
Version: devel0.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 Scott Grayban <evilborg2001@…>, 18 years ago

Milestone: 0.9.4
Version: 0.9.4devel

comment:3 by Christian Boos, 18 years ago

Keywords: wikiprocessor outline macro added
Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos

Scott, I believe that your problem is actually related to #2917, not this one.

Manu, I'll have a look at the issue.

comment:4 by Christian Boos, 18 years ago

Resolution: fixed
Status: newclosed

Should be fixed by r3072.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.