Many times I have wondered why people are so reluctant to investigate RIFE. After having asked around a bit, the most recurring critique was that our template syntax is too arcane at the initial glance. Somehow the look of the tags syntax pushes people away without them ever checking out any of the features of our framework.
Ironically, none of the users consider the syntax to be a problem. Many even love how it stands out while still being totally invisible to a browser or an XHTML editor.
Still, initial adoption seems to be all about appearances, so I think this issue needs to be addressed. That's why I'm asking you, the non-rife users which alternate syntax looks best to you.
Note that in most of the following snippets you'll find our compact [! /] syntax inside the values of tag attributes. I did this since most of the other syntaxes would totally invalidate the XML well-formdness if they were used instead.
Current syntax
This is how RIFE invisible XHTML template tags currently look:
<form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
<input name="name" value="[!V 'PARAM:name'][!/V]" />
<input type="submit" value="That's who I am!" />
</form>
<div>Hi , it's !</div>
Processing instruction variant
This is a variant that uses the XML processing instruction to achieve invisibility and conciseness:
<form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
<input name="name" value="[!V 'PARAM:name'][!/V]" />
<input type="submit" value="That's who I am!" />
</form>
<div>Hi , it's !</div>
Regular tags
This version uses custom XHTML tags that look exactly the same as the rest of the layout code and that can easily get validation and auto-completion support in IDEs:
<r:v name="content"/>
<r:bv name="content">
<form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
<r:v name="SUBMISSION:PARAMS:myData"/>
<input name="name" value="[!V 'PARAM:name'][!/V]" />
<input type="submit" value="That's who I am!" />
</form>
</r:bv>
<r:b name="welcome">
<div>Hi <r:v name="PARAM:name"/>, it's <r:v name="day"/>!</div>
</r:b>
Velocity inspired
These tags should look somewhat familiar to people that are used to Velocity. Sadly they will not become invisible if the template is viewed in a browser:
Update 23 feb.: I reworked the Velocity inspired syntax to be more consistent with the features of the template engine, to have lesser possibility for conflicts with existing RIFE templates, and to be faster to parse.
${v content/}
${bv content}
<form action="${v SUBMISSION:FORM:myData:/}" method="post">
${v SUBMISSION:PARAMS:myData/}
<input name="name" value="${v PARAM:name}${/v}" />
<input type="submit" value="That's who I am!" />
</form>
${/bv}
${b welcome}
<div>Hi ${v PARAM:name/}, ${v day/}!</div>
${/b}
older proposal
${content}
$bv{content}
<form action="${SUBMISSION:FORM:myData}" method="post">
${SUBMISSION:PARAMS:myData}
<input name="name" value="$v{PARAM:name}$/v" />
<input type="submit" value="That's who I am!" />
</form>
$/bv
$b{welcome}
<div>Hi ${PARAM:name}, ${day}!</div>
$/b
Tapestry inspired
These tags should feel comfortable to people that are used to Tapestry, the span tag attributes are used for doing markup:
<span rife:v="content"/>
<span rife:bv="content">
<form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
<span rife:v="SUBMISSION:PARAMS:myData"/>
<input name="name" value="[!V 'PARAM:name'][!/V]" />
<input type="submit" value="That's who I am!" />
</form>
</span>
<span rife:b="welcome">
<div>Hi <span rife:v="PARAM:name"/>, it's <span rife:v="day"/>!</div>
</span>
Your opinion?
So which one did you prefer?
- Processing instruction variant
- Regular tags
- Velocity inspired
- Tapestry inspired
If you have other ideas, please don't hesitate to suggest them!