Hi Vidar,
Vidar Ramdal schrieb:
> This is off the top of my head from the Jackrabbit/Sling BOF at ApacheCon:
>
> It would be of great use to support another script delimiter in script
> files. The current delimiters (<% and %>) does not play well with most
> IDEs (at least the one I've tried). At least in IntelliJ IDEA, you can
> mix XML/HTML with other languages (and have auto-completion and error
> checking) only if it is delimited by a valid XML element.
>
> We have at least two options here:
>
> 1. Use the standard HTML <script> element, and add a non-standard
> attribute to specify that the script is to be executed server-side. In
> ASP (if I remember correctly) you would use <script runat="server"
> type="text/javascript"> to specify a block of server-side JavaScript.
>
> 2. Use a namespaced element, like <sling:javascript>.
>
> The latter is perhaps the cleanest option, but it might cause trouble
> for those who still insist on writing HTML (and not XHTML).
>
> Any opinions?
For the background: The current syntax we use for ESP scriptlets and
expressions is borrowed from the JSP specification for traditional JSP
pages.
Nowadays, the JSP specification als defines a pure XML syntax for JSP
scripts, which requires to replace the old style syntax elements with
proper tags:
<%= expression %>
--> <jsp:expression>expression</jsp:expression>
<% scriptlet %>
--> <jsp:scriptlet>scriptlet</jsp:scriptlet>
Currently the ESP syntax is handled by a very simple, character stream
based reader, the EspReader, which just wraps the script reader and
converts ESP syntax to plain ECMA syntax on-the-fly (no intermediate
file generation and preserving line numbers).
I could imagine the following: (1) Extend EspReader to support an
extended syntax or (2) create a new parser which does not support the
simple syntax but the new tag-based syntax.
I would opt for #2 and call this for the extensions .espx (like .jspx
for JSP Documents).
WDYT ?
Any volounteers ;-)
Regards
Felix
>