There is 1 update.
 
 
XWiki Rendering / cid:jira-generated-image-avatar-9838f2ec-e766-4c42-9e23-b7c12e82d3c0 XRENDERING-763 Open

The xwiki/2.0 and 2.1 renderers break the end macro when the content ends with an odd number of ~

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-80653942-5b0b-48a9-b4b0-d9deefac9934 Changes by Thomas Mortagne on 13/Dec/24 09:13
 
Description: When a MacroBlock has " ~ " as content, the xwiki/2.x render does not do anything specific about that ~. For example, an info macro with content " ~ " will be serialized as:

{noformat}
{{info}}~{{/info}}
{noformat}

The problem is that " ~ " being an escaping character, the content above is actually the macro info with content


{noformat}
"{{/info}}" .
{noformat}

We need to make sure to properly protect the end macro from the ~.
The difficulty is that in xwiki/2.1 the ~ is not consumed when it's used to escape something which is located in a macro. So doubling the ~~ protects the end macro, but you will actually have ~~ in that macro content. This is something that should ideally be fixed in a xwiki/2.2 syntax, but in the meantime we need to decide the least bad option to stop breaking end macros:

* escape with ~ despite the problem described above: at least it will behave as expected when the macro contains wiki syntax
* add an extra white space after the infamous ~: it's not more valid, but at least the hack is less visible for a human
* a mix:
  ** when the Macro indicates that the content type is wiki syntax, escape using ~
  ** when we don't know the content type, add an extra white space

Whatever solution, a slightly bad escaping is better that completely breaking the macro...