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?
I was able to determine that a lot (though not all) of the problems are due to an iframe put in by the attachments macro. (As discovered by Davin, my problem only happens when drag-and-drop is turned on for tha macro). The offending line is:
<iframe class="plugin_attachments_uploadiframe hidden" name="haZWwwvlQLusX3zF97FMhgclmFMl4K5NcJrP6wljX5WaAYtE9qiZtY6pN7plcSHd" src="" />
I don't think this part (${paramName}) is right. The $ should be next to the variable name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is the shorthand notation (https://velocity.apache.org/engine/devel/user-guide.html#variables). The form with braces is for situations where the interpreter might get confused.
I think I said this, but: the code I gave works fine, except when the included page includes an "attachments" macro AND I store the result in a velicity variable before printing it. In that case only, the result is screwed up. When I saw "screwed up" I don't mean that it prints the velocity variable, I mean that there's something fairly subtle wrong with the output, so nothing past the attachments macro gets printed, including the page footer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok ... sorry I misread the question. Also, I didn't realize that was velocity syntax ... never had a reason to have the curly braces in it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried replicating your issue with a user macro. I was able to get pages to include if there was an attachments macro on that page correctly only if the upload option was turned off for the attachments macro. If upload is turned on then it messed up. Is this the same issue you are having?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. I hadn't tried that -- turning off download in attachments does allow this to work. That is helpful, thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan,
I think you need to use $action.helper.renderConfluenceMacro(...) in user macros. The following works for me:
## @noparams #set($macro="{cheese}") #set($page=$action.helper.renderConfluenceMacro($macro)) $page
Hope this helps.
Cheers
Remo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess I wasn't clear enough -- I'm not having a problem running renderConfluenceMacro ($helper in my sample was set to $action.helper, I just didn't include that detail). As I mentioned, my code works fine as long as I print the output of the render directly, without first storing it in a velocity variable.
The problem is that I get a display failure if I store it in a variable and then print it.
You may be confused because I didn't say why I'd want to do that -- I left out that detail to simplify the problem. If you want to understand that, I want to manipulate the result before printing it. In testing why that wasn't working, I discovered that just storing in a variable was enough to screw up the output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.