After trying to implement it I've found the following caveats:

* if the user wants an html comment he needs to escape the --
* if the user wants a NL he'll need to enter <br/>
* if the user wants a paragraph he'll need to enter <p>...</p>
* And the most problematic one IMO: the user needs to be very careful  
about new lines since:

<table>
<tr>
<td>
* [[listitem]]
</td>
</tr>
</table>

is very different from

<table>
<tr>
<td>
* [[listitem]]

</td>
</tr>
</table>

In the first case the </td>, </tr> and </table> and continuation of  
the list item written in wiki syntax since the wiki parser accepts  
multiline content... hence you'll get in XHTML:

<table><tbody><tr><td><ul><li><!--startwikilink:listitem--><span  
class="wikicreatelink"><a href="/xwiki/bin/view/listitem? 
parent=xwiki:Space.Page"><span class="wikigeneratedlinkcontent">Page</ 
span></a></span><!--stopwikilink--></td></tr></tbody></table></li></ul>

which is completely invalid.

The same applies for:

{{macro/}}
</td>

vs

{{macro/}}

</td>

in the first case the macro is inline and will generate inline content  
and in the second case it's standalone.

Still trying to figure out a best solution but I don't see one right  
now...

If you have any idea, shoot!

Thanks
-Vincent

On May 4, 2009, at 3:25 PM, Vincent Massol wrote:

> Hi,
>
> After discussing with Thomas we've reached the conclusion that we  
> should change the way the HTML macro handle its content when  
> wiki=true.
> For ex take the following input:
>
> {{velocity}}
> ...
> {{html wiki="true"}}
> <form>
> $xwiki.includeForm("XWiki.MyClassSheet")
> <br />
> <p>
> <input type="submit" name="submit" value="Create this new  
> Workpackage" />
> </p>
> </form>
> {{/html}}
> ...
> {{/velocity}}
>
> And assume that MyClassSheet has some $doc.display() velocity code  
> which thus generate {{html}} macros.
>
> Current Result
> ============
>
> Right now here's what happens:
> 1) velocity macro is executed and $xwiki.includeForm executes
> 2) MyClassSheet generate {{html}} macro content thus yielding:
>
> {{html wiki="true"}}
> <form>
> {{html}}...<someTag>...</someTag>{{/html}}
> </form>
> {{/html}}
>
> 3) After velocity has finished executing the velocity macro calls  
> the wiki parser on the result and thus the top level HTML macro  
> executes
> 4) since wiki=true the content is given to a SAX parser and each XML  
> tag content is given to the wiki parser. Thus "{{html}}...", "..."  
> and "{{/html}}"  will be parser by the wiki parser separately  
> (because <someTag> is valid XML), thus generating non expected  
> content as a result.
>
> Proposed change
> ==============
>
> Modify the HTML behavior so that the wiki parser executes first  
> (instead of the SAX parser) and render the result using a special  
> renderer that prints the special symbols and text as is.
>
> When run on our example this would give (same steps 1) and 2)):
>
> 3) wiki parser executes and generate XDOM. Render it using the  
> special renderer
>
> Note that this means that if in HTML your write content that has a  
> meaning in some wiki syntax you'll need to escape it. For example if  
> you have:
>
> {{html wiki=true}}
> <!--hello-->
> {{/html}}
>
> you'll get some strikethrough. So you'll need to write instead:
>
> {{html wiki=true}}
> <!~-~-hello~-~->
> {{/html}}
>
> WDYT?
>
> Here's my +1
>
> Thanks
> -Vincent
>

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to