Uploaded image for project: 'XWiki Rendering'
  1. XWiki Rendering
  2. XRENDERING-763

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • Rendering in the platform
    • None
    • Unknown

    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:

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

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

      ~{{/info}}
      

      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...

      Attachments

        Issue Links

          Activity

            People

              trishabusch69 Trisha Busch
              tmortagne Thomas Mortagne
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: