Opened 17 years ago

Last modified 4 years ago

#1728 new defect

macros in included wikis not processed correctly

Reported by: chtaylo3@… Owned by:
Priority: normal Component: IncludeMacro
Severity: major Keywords: macro processor renderer nesting
Cc: Trac Release: 0.10

Description (last modified by Steffen Hoffmann)

if you include a wiki page that itself calls a macro (such as ParentLinkage) then said macro will run with the request information of the containing wiki page (as opposed to the contained wiki page).

This manifests itself when: Parent1\!WikiPage1 contains:


and, Parent2\!WikiPage2 contains:


the ouput prints the parent linkage for Parent2\!WikiPage2 twice as opposed to the parent linkage for Parent2\!WikiPage2 followed by Parent1\!WikiPage1.

suggest the following workaround:

  1. import wiki_to_html from
  2. under the case where source_format == 'wiki' instead out setting out to be page.text, call wiki_to_html. You will probably need to pass in a crafted req object based on ... I think the var you need to set is req.hdf.setValue('wiki.page_name', but I'm not very familiar with Trac ... not sure if that's the best way to go about it or not.
  3. at the end, do not call Mimeview.render if the source_format is a wiki .... since it is already called from the wiki_to_html func.

hope this helps!

funny .... I'm trying to suggest some fixes and I can't even remember to use trac properly ... lol... it's late

Attachments (0)

Change History (5)

comment:1 Changed 12 years ago by Steffen Hoffmann

Description: modified (diff)
Keywords: macro processor renderer nesting added
Owner: changed from Noah Kantrowitz to Ryan J Ollos

salvaging correct formatting from former comment:1 (deleted) for readability

comment:2 Changed 12 years ago by Steffen Hoffmann

#9035 is related, but is aiming at purging nested macro output from the included resource instead.

comment:3 Changed 11 years ago by Ryan J Ollos

Status: newassigned

comment:4 Changed 10 years ago by Marcin

I found this ticket while experiencing what I believe is the opposite issue.

I am using Trac 1.0.1, and I have a page called Include/AllPagesAfterTitle which is meant to be included on every Wiki page right after the title to give all pages the same general structure. This Include/AllPagesAfterTitle consists of (besides other things) [[PageOutline(2-9,Page Table Of Contents,inline,unnumbered)]].

The problem I am seeing is that this macro renders the table of contents of the Include/AllPagesAfterTitle page, and not the page that calls [[Include(Include/AllPagesAfterTitle)]], which is what I intend.

comment:5 Changed 4 years ago by Ryan J Ollos

Owner: Ryan J Ollos deleted
Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

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

Note: See TracTickets for help on using tickets.