Skip to content

Commit

Permalink
Merge pull request linkedin#8 from smfoote/gh-pages-syntax
Browse files Browse the repository at this point in the history
Add reference and special syntax reference
  • Loading branch information
smfoote committed Jan 23, 2015
2 parents b71a953 + 8d70b4a commit ab69854
Showing 1 changed file with 35 additions and 11 deletions.
46 changes: 35 additions & 11 deletions docs/syntax.md
Expand Up @@ -6,24 +6,48 @@ permalink: /docs/syntax/

##Dust Syntax

###References

###Bodies
<h3 id="reference"><code>{reference}</code></h3>

####Exists
A reference is used to insert values from your context (or JSON data) into your template.

####Not-exists
A reference is a single opening curly brace `{`, followed by one or more characters of the following set, followed by a closing curly brace `}`:

####Sections
- `a-z`
- `A-Z`
- `_` (underscore)
- `$`
- `0-9`
- `-`

####Helpers
NOTE: The first character of a reference cannot be `0-9` or `-`.

####`{:else}` Bodies
<h3 id="bodies"><code>{?bodies/}</code></h3>

###Blocks
<h4 id="exists"><code>{?exists/}</code></h4>

###Inline-partials
<h4 id="not-exists"><code>{^not-exists/}</code></h4>

###Partials
<h4 id="section"><code>{#section/}</code></h4>

###Special
<h4 id="helper"><code>{@helper/}</code></h4>

<h4 id="else-bodies"><code>{:else}</code> Bodies</h4>

<h3 id="block"><code>{+block/}</code></h3>

<h3 id="inline-partial"><code>{&lt;inline-partial/}</code></h3>

<h3 id="partial"><code>{&gt;partial/}</code></h3>

<h3 id="special"><code>{~special}</code></h3>

A special is converted to a special character

A special is defined as an opeing curly brace `{`, followed by a tilde `~`, follwed by any of the characters in a [reference](#reference), followed by a closing curly brace `}`. Dust supports five "specials":

- `{~s}` becomes a single space
- `{~n}` becomes a new line
- `{~r}` becomes a carriage return
- `{~lb}` becomes a left curly brace `{`
- `{~rb}` becomes a right curly brace `}`

0 comments on commit ab69854

Please sign in to comment.