add parser support for raw mustache tags

pull/124/head
Arpad Borsos 8 years ago
parent def48e2c1d
commit 9187c2dd09
No known key found for this signature in database
GPG Key ID: 908EDF65263368B4

@ -190,6 +190,21 @@ export default function mustache ( parser ) {
});
}
// {{{raw}}} mustache
else if ( parser.eat( '{' ) ) {
const expression = readExpression( parser );
parser.allowWhitespace();
parser.eat( '}}}', true );
parser.current().children.push({
start,
end: parser.index,
type: 'RawMustacheTag',
expression
});
}
else {
const expression = readExpression( parser );

@ -0,0 +1 @@
<p> {{{raw1}}} {{{raw2}}} </p>

@ -0,0 +1,48 @@
{
"html": {
"start": 0,
"end": 30,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 30,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 4,
"end": 14,
"type": "RawMustacheTag",
"expression": {
"start": 7,
"end": 11,
"type": "Identifier",
"name": "raw1"
}
},
{
"start": 14,
"end": 15,
"type": "Text",
"data": " "
},
{
"start": 15,
"end": 25,
"type": "RawMustacheTag",
"expression": {
"start": 18,
"end": 22,
"type": "Identifier",
"name": "raw2"
}
}
]
}
]
},
"css": null,
"js": null
}
Loading…
Cancel
Save