Hi everyone,
The Application Development Best Practices includes this item:
Page content must contain the minimum of HTML (since HTML doesn’t translate in discrete XDOM elements and thus are not always handled by all Renderers). For example don’t use
<div class="something">...</div>
and instead use(% class="something" %)(((...)))
. One notable exception is for HTML forms for which we don’t have a macro yet.
I thought we discussed about this in the past but I can’t find the discussion and I’m pretty sure I’ve expressed by disagreement with this rule a couple of times. My point of view:
- we need to distinguish between user interface and user content; in simplistic terms this means:
- user interface: what the end user can view and interact with but should not change
- user content: what the end user can view and interact with but also can change
- HTML is not suited for writing user content because it’s too technical, too verbose and thus error prone
- on the other hand, wiki syntax is simpler, less verbose, because it was specifically designed to be used for writing user content, not user interfaces
- HTML is better suited for writing user interfaces (on the web) than wiki syntax
- XWiki is primarily a web application and thus XWiki’s user interface will end up as HTML/DOM in the browser
- web developers must have full control over the HTML that ends up in the browser (e.g. when developing the user interface of an XWiki application)
With these in mind it’s pretty obvious for me that we should recommend using:
- wiki syntax for writing user content
- and the HTML macro (
{{html clean="false"}}
) for writing user interfaces
So this vote is about changing the item I quoted above with this:
- Use the HTML macro (
{{html clean="false"}}
) for writing the user interface of your application (e.g. layouts, forms, dialogs, menus, tabs, accordions, trees, panels, etc.). This usually goes inside technical and thus hidden code pages.- Don’t use HTML for writing user content (e.g. documentation, help or demo pages). Use wiki syntax instead. This usually goes inside public, non-hidden, pages.
WDYT? +1 on my side obviously.
Thanks,
Marius