Relax dust grammar for supporting spaces #21

vybs opened this Issue May 2, 2012 · 9 comments


None yet

4 participants

vybs commented May 2, 2012

Investigate to alter the dust grammar to support arbitrary space ..

Now Invalid gramar

{#a root1="p1" r2="p2" }


Compare the syntax with handle bars or mustache and see how they do it ?

rragan commented May 2, 2012

I would vote strongly for such a change. This is such an easy error for a user to make.

@jairodemorais jairodemorais was assigned May 2, 2012
vybs commented May 3, 2012

Sure !, looks like it is our top most requested feature here as well ...

So it is our top priority...

vybs commented May 4, 2012

Relaxing the grammar to support white spaces.

Jairo and I are working on the above issue for Milestone 3.

Here is the details of the spec:

  1. Allow WS* in the beginning and endinf of the block ? { #a }
  2. Allow WS* between inline params {#a d="r" t="r" }
  3. Allow WS* for self-closing , {#a d="r" t="r" /} and {#a d="r" t="r" / }
  4. Allow WS* for closing, {#a d="r" t="r" } .... { / }

What about other tags ? { > partial / },

Is the consensus to relax it for every tag ? @, ? ^ .....

The same will be ported to the ANTLR as well


Mustache parser seems to be in their JS code as regex's
HandleBars uses Jison. Here's the grammar
Hogan has a compiler.js file

vybs commented May 5, 2012


@bgaff and eran discussed the same today

We probably wil support the same as in the html

vybs commented May 7, 2012


I looked at mustache and its flavors ..

Have u compared Hogan and Handlebars? AFAIK, both added the compiler option, to make mustache rendering fast ...other than that what do they differ with?

Also, looking at the grammar, they do not allow arbitary white spaces as well ..

having said that, it does not mean we should not extend, but we wil now have our own grammar...

vybs commented May 7, 2012


Here is one proposal...

We follow the html tag standard

  1. Trailing whitespaces allowed

<br / > afsdfs ( Valid tag in html )

So {/skills } and {/ skills } are supported

  1. No spaces between the { and /
    { /skills} not supported
  2. Same hold true for the opening curly brace, no space between the {#skills or {?skills
  3. Same hold true for self closing tags.

We are going to follow the W3C recommendation. you can read the spec here:

So we aren't going to allow ws immediately after the open tag and before the close tag.

W3C spec extract:

In order to avoid problems with SGML line break rules and inconsistencies among extant implementations, authors should not rely on user agents to render white space immediately after a start tag or immediately before an end tag.


fixed and merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment