Edgewall Software
Modify

Ticket #2916 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

OutlineFormatter does not handle macros properly

Reported by: eblot Owned by: cboos
Priority: normal Milestone: 0.10
Component: wiki system Version: devel
Severity: normal Keywords: wikiprocessor outline macro
Cc:
Release Notes:
API 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

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

Download all attachments as: .zip

Change History

Changed 6 years ago by eblot

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

comment:1 Changed 6 years ago by Scott Grayban <evilborg2001@…>

  • Milestone set to 0.9.4
  • Version changed from devel to 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 Changed 6 years ago by Scott Grayban <evilborg2001@…>

  • Milestone 0.9.4 deleted
  • Version changed from 0.9.4 to devel

comment:3 Changed 6 years ago by cboos

  • Keywords wikiprocessor outline macro added
  • Milestone set to 0.10
  • Owner changed from jonas to cboos

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 Changed 6 years ago by cboos

  • Resolution set to fixed
  • Status changed from new to closed

Should be fixed by r3072.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.