diff --git a/compiler/parse/state/mustache.js b/compiler/parse/state/mustache.js index b27e694608..1cc4532efd 100644 --- a/compiler/parse/state/mustache.js +++ b/compiler/parse/state/mustache.js @@ -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 ); diff --git a/test/parser/raw-mustaches/input.html b/test/parser/raw-mustaches/input.html new file mode 100644 index 0000000000..349fc29186 --- /dev/null +++ b/test/parser/raw-mustaches/input.html @@ -0,0 +1 @@ +

{{{raw1}}} {{{raw2}}}

diff --git a/test/parser/raw-mustaches/output.json b/test/parser/raw-mustaches/output.json new file mode 100644 index 0000000000..4acedf34ea --- /dev/null +++ b/test/parser/raw-mustaches/output.json @@ -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 +}