On Apr 9, 2010, at 2:27 PM, Vincent Massol wrote:
On Apr 9, 2010, at 2:14 PM, Andreas Jonsson wrote:
Hi,
I prefer a solution where the end token is changed rather than
the content. Look at the embedded parser construction in
MoinMoin syntax for an example.
I instead propose to introduce an instruction to the parser in
the start-tag to expect a different end token. Something like:
{{foo #endtag:foobar}}
content
{{/foo}}
still content
{{/foobar}}
Not a bad idea. It would be backward compatible too.
Forgot to mention that reason I like the idea is because the user can copy paste its
content without having to edit it.
Thanks
-Vincent
For verbatim we could use the same technique as
MoinMoin, either:
{{{{
content
}}}
more content
}}}}
or:
{{{arbitrarystringofalphanumerics
content
}}}
more content
arbitrarystringofalphanumerics}}}
This would change our syntax since right now we can write: {{{hello}}}
Your solution would loose the ability to have inline verbatim.
Thanks
-Vincent
Best regards,
Andreas Jonsson
Thomas Mortagne wrote:
> Hi devs,
>
> We have a limitation in the xwiki/2.0 parser related to the way macros
> are parsed: impossible to have the ending syntax of a macro as content
> of this macro.
>
> Here is the related jira issue:
http://jira.xwiki.org/jira/browse/XWIKI-5077
>
> A good example is: i want to have "{{/code}}" alone as the content of
> a code macro. That's impossible.
>
> The only way to have {{/code}} in the content is with:
>
> {{code}}
> {{code}}
> {{/code}}
> {{/code}}
>
> or
>
> {{code}}
> ~{{/code}}
> {{/code}}
>
> but in the first case you get "{{code}}" you did not want and in the
> second you get "~" you did not want.
>
> Only solution i can see is to specifically handle escaping of ending
> macro syntax inside macros of the same name.
>
> Here is some examples:
>
> 1)
>
> {{code}}
> ~{{/code}}
> {{/code}}
>
> would give code macro containing "{{/code}}"
>
> 2)
>
> {{code}}
> ~{{/somemacro}}
> {{/code}}
>
> would give code macro containing "~{{/somemacro}}"
>
> 3)
>
> {{code}}
> ~~{{/code}}
> {{/code}}
>
> would give code macro containing "~" followed by the text
"{{/code}}"
>
> 4)
>
> {{code}}
> ~~~{{/code}}
> {{/code}}
>
> would give code macro containing "~{{/code}}"
>
> 5)
>
> Then double escaping for each level to escape:
>
> {{box}}
> {{box}}
> ~~~{{/box}}
> {{/box}}
> {{/box}}
>
> would give box macro containing a box macro containing the text
> "{{/box}}": the first pass change "~~~{{/box}}" into
"~{{/box}}" like
> in example 4) and the second pass escape "{{/box}}" like in example
> 1).
>
> So WDYT ?
>
> Here is my +1