Details
-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
6.3
-
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.