We have a user macro with a parameter of type confluence-content. When we try to get the page with a title containing special characters e.g. "This & That", the parameter returns the title encoded "This & That". So when trying to get the page from the pageManager, the page is not found. Is there a possibility to avoid the encoding of a parameter?
is your parameter type set to "type=confluence-content"? That is supposed to allow a user to run a match to existing content.
Yes, it is set to confluence-content. In a macro within a plugin, this parameter then is returned without encoding but in a user macro when rendering the velocity template, the parameter will be encoded.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you convert the results from the PageManager to encoded HTML before doing a compare? Or are you trying to do a page look up?
And how about just pulling the pageID of the desired page?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The other way is to parse your parameter to find replace HTML encodings. Not fun, but you can add corner cases (and tell user to please not put special characters in page names).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When using the confluence-content type for a parameter, only "spaceKey:pageTitle" is available for rendering the velocity template. I replaced the known entities now, but this is not generic and I didn't found a decoder, which is available in the rendering context and no way to avoid the encoding of the parameter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have never used that parameter type, but there are others that don't work the way you think they would. User macros are in need of TLC for quite some time. It is a shame, but they are not maintaining this very powerful tool, and given the forced move to the cloud, user macros will only be available to data center customers -- larger entities that have resources to program full-blown plugins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Michael AmmannI found this article when researching another topic:
how-to-display-modified-page-dates-in-a-table
What is interesting is that they are using the confluence content type in a user macro and converting it back into a page object. I think that will solve your problem as once it is an objects, the usual methods can be used.
Let me know if this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In our macro we make quite the same as mentioned in this article. But as the link contains the page title, we have the problem that the title is escaped and e.g. the & is replaced by the html entity & If there is no way to avoid this conversion, the page tile has to be decoded again and I found no velocity helper to do this for all cases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the issue is having page names that include the following reserved characters: ", ', <,>,&.
My suggestion is to build a find/replace function for those five characters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As workaround I already replaced the & with the & and I will enhance that. I tried to find a more common solution but I found none.
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.