Ticket #1728 (new defect)

Opened 6 years ago

macros in included wikis not processed correctly

Reported by: Assigned to: chtaylo3@gmail.com rjollos normal IncludeMacro major macro processor renderer nesting 0.10

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:

[[ParentLinkage(=)]]


and, Parent2\WikiPage2 contains:

[[ParentLinkage(=)]]
[[Include(wiki:Parent1\WikiPage1)]]


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 trac.wiki.formatter
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 page.name ... I think the var you need to set is req.hdf.setValue('wiki.page_name',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

Change History

12/13/12 21:56:13 changed by hasienda

• owner changed from coderanger to rjollos.
• keywords set to macro processor renderer nesting.
• description changed.

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

12/13/12 22:01:07 changed by hasienda

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

Add/Change #1728 (macros in included wikis not processed correctly)

Change Properties