I'm trying out Jade (via Scalate) and am running into an error that I'm not finding an answer to. (Or, at least not seeing.) I mocked up a form using BlueGriffon (it's been years since I've coded HTML...) and placed the resultant HTML into Aarron Powel's HTML-JADE converter. Here is the top portion or that translation which is in my .jade template file:
br
form(method='POST', action='/account/create', name='userAccountDetails')
| Username:
input(required='required', name='username', type='text')
etc., etc.,
Trying to run the scala app where this is nested generates this error:
org.fusesource.scalate.InvalidSyntaxException:
)' expected but
,' found at 5.19 at org.fusesource.scalate.scaml.ScamlParser.parse(ScamlParser.scala:375) at org.fusesource.scalate.jade.JadeCodeGenerator.generate(JadeCodeGenerator.scala:38)
It seems to not like the comman-sperated attributes, but I'm not sure why. Aslo, within the stacktrace clip it appears to be pulling in a Scaml parser, even though the file has a .jade extension.
Can someone point me in the right direction? Thanks.
For whomever finds themselves here, the issue (at least for me) appears to be due to syntactic differences between the Scala/Scalatra and JavaScript/NodeJS implementation of JADE. As luck would have it, my searches for JADE examples turned up the latter - both in terms of utilities, as well as forum Q&A - which all indicate the necessity for commas.
Solution: remove the commas and things work as they should:
!!!
h2 New Account Setup
br
form(method='PUT' action='/account/create')
...
EDIT: To be more precise, the discrepancy actually lies within Scalate (the Scala Template Engine) that is integrated by Scalatra. (There may be some other JADE-based scala libraries which following the original syntax.)