On Oct 6, 2009, at 5:15 PM, Marius Dumitru Florea wrote:

> Hi Lewis,
>
> Lewis Denizen wrote:
>> Hi xwiki-users,
>>
>> One small quirck with the 2.0 release - when I try something like  
>> this:
>>
>> {{box title="{{info}}test{{/info}}"}}this is a test{{/box}}
>>
>> the output becomes a bit screwey...  Parts of the {{info}} tag gets  
>> added to
>> the content of the box instead of into the title.  It does work  
>> when the
>> {{info}} is escaped properly:
>>
>> {{box title="~{~{info~}~}test~{~{/info~}~}"}}this is a test{{/box}}
>>
>> but the WYSIWYG editor doesn't escape these (and it would make  
>> things look a
>> bit nicer if we didn't have to escape on properly-quoted  
>> parameters..  with
>> the obvious exception of a double-quote inside a quoted- 
>> parameter :-)).
>> So...  what should the right behavior be?
>
> IMO there shouldn't be any need for escaping the { and } inside a
> parameter value. It seems the XWiki 2.0 parser stops reading the
> parameter value when it encounters }} which I think it's a bug.
>
> Thomas should know more about it.

This is voluntary right now. Here's the grammar:

     | <#MACRO_NAME: (<XWIKI_CHAR>)+ (["-", "_", ".", ":"]  
(<XWIKI_CHAR>)+)* >
     | <#MACRO_PARAMS: ( "~" ~[] | ~["}"] | "}" ~["}"] )* >
     | <#MACRO_EMPTY: "{{" <MACRO_NAME> ((<SPACE>) <MACRO_PARAMS>)?  
"/}}" >
     | <#MACRO_START: "{{" <MACRO_NAME> ((<SPACE>) <MACRO_PARAMS>)?  
"}}" >
     | <#MACRO_END: "{{/" <MACRO_NAME> (<SPACE>)* "}}" >
     | <#MACRO_CONTENT: ( <XWIKI_CHAR> | <SPACE> |<NEW_LINE> |  
<XWIKI_SPECIAL_SYMBOL> ) >

So }} is not allowed in a macro parameter. Otherwise there would be a  
pb to know which "}}" correspond to the macro end (it would be harder).

BTW you only need to escape one "}" to make it work fine ;)

Note that quotes for macro values are optional right now and this is  
the reason macro params are checked for }}.

We could decide that quotes are mandatory but it's a pretty big change  
(would be for Syntax 2.1) and I don't think it's a good idea since  
this your use case is pretty rare. And btw I still don't know if  
accepting wiki syntax in parameters is a good thing or not.

Thanks
-Vincent

> Thanks,
> Marius
>
>>
>> -- Lewis
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to