Links in {{html}} and {{velocity}} macros are not updated when moving or renaming a page

Links in {{html}} and script Makros are not updated when moving or renaming the page

Link 1: 
[[Link>>doc:Sandbox.Test.WebHome]] 

Link 2:
{{html wiki="true"}}
[[Link>>doc:Sandbox.Test.WebHome]]
{{/html}}

Link 3:
{{velocity}}
[[Link>>doc:Sandbox.Test.WebHome]]
{{/velocity}}

Behavior:

When Sandbox.Test.WebHome is moved or renamed, only Link 1 is updated. Links in the {{html}} and {{velocity}} macros (Link 2 and Link 3) remain unchanged.

Question:

Is this behavior intended, or shouldn’t links within {{html}} and {{velocity}} macros also be updated, too?

It’s expected for the script macros, since it’s actually not easy to do that reliably.

For the html macro we could actually treat it like the other wiki content based macros when it has wiki=true. So looks like a miss that would deserve a jira issue.

Thanks for the quick answer. I created XWIKI-22785

I do not know how this would have to be implemented, but I was wondering why {{velocity}} isn’t just like {{html}} just with wiki=true by default.

Isn’t

{{html wiki=true}}
[[Sandbox>>doc:Sandbox.WebHome]]
{{/html}}

equivalent to

{{velocity}}
[[Sandbox>>doc:Sandbox.WebHome]]
{{/velocity}}

in some way?

If the link is not updated during refactoring, I would need to update it manually (e.g., using Bulk replace content in pages).

However, something like this:

{{velocity}}
#set ($page = "[[Sandbox>>doc:Sandbox.Test.WebHome]]")
[[$page.substring(23, 27)>>$page.substring(11, 35)]]
{{/velocity}}

would, in most cases, present a broken Link after renaming. There could be cases where the script crashes, too. Is it that what makes it challenging?

It’s the same result, but there is a huge different: in one case it’s wiki content, and in the other it’s a Velocity script generating wiki content. The fact that you selected an example where the script looks exactly like its result does not make it wiki content.

Yes.

1 Like