Take a page containing an attachments macro.
Include it into another page using a user macro that writes the include as wiki markup and executes $helper.renderconfluencemacro
That works fine.
In the user macro, now store the result of $helper.renderconfluencemacro in a velocity variable, and print that, like this:
#set($macro="{include: ${paramName} }")
#set($page=$helper.renderConfluenceMacro($macro))
$page
The resulting page is now screwed up -- something happens in the middle of the attachments macro's output, and the rest of the page doesn't show.
I've examined the results with the Chrome debugger, and I don't see what is wrong. I didn't see any related errors in the console.
Anyone have an idea what is happening?