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

Unpredictable inline/block error conditions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Minor
    • None
    • 6.3
    • Macro - HTML
    • None
    • XWiki Enterprise 6.3 on Ubuntu via repository deb packages

    Description

      The difference between the following code snippets, within the content of my XWiki page, is a single line after the first #if. The html macro has blank lines before and after in both cases, as recommended in the FAQ.

      Causes Exception
      {{velocity}}
      #if("$!{request.xpage}" != 'plain')
      #if(!${xcontext.errors.isEmpty()})
      ## Do some error reporting
      #else
      
      
      {{html}}
      <form action="" id="editTextForm" method="post">
      <div><span class="buttonwrapper"><span class="buttonwrapper"><input type="submit" class="button" value="Submit"/></span></div>
      </form>
      {{/html}}
      
      
      #end
      #end
      {{/velocity}}
      
      Does not cause Exception
      {{velocity}}
      #if("$!{request.xpage}" != 'plain')
      
      #if(!${xcontext.errors.isEmpty()})
      ## Do some error reporting
      #else
      
      
      {{html}}
      <form action="" id="editTextForm" method="post">
      <div><span class="buttonwrapper"><span class="buttonwrapper"><input type="submit" class="button" value="Submit"/></span></div>
      </form>
      {{/html}}
      
      
      #end
      #end
      {{/velocity}}
      

      However the first snippet causes an exception

      org.xwiki.rendering.macro.MacroExecutionException: When using the HTML macro inline, you can only use inline HTML content. Block HTML content (such as tables) cannot be displayed. Try leaving an empty line before and after the HTML macro.

      I find this behaviour unpredictable and hard to debug. It would greatly help users if the html macro was more robust to such usage.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            beldaz Bryn Jeffries
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: