Quellcode durchsuchen

Comments should have a ! before the closing tag. The comment syntax is now {{! TEXT !}}

tags/0.5.0-vsc
Sahab Yazdani vor 15 Jahren
Ursprung
Commit
7e4548979f
1 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen
  1. +10
    -2
      mustache.js

+ 10
- 2
mustache.js Datei anzeigen

@@ -459,13 +459,21 @@ var Mustache = function() {
}, },
discard: function(parserContext, contextStack) { discard: function(parserContext, contextStack) {
if (parserContext.token()===parserContext.closeTag) {
return 'text';
if (parserContext.token()==='!') {
return 'closeComment';
} else { } else {
return 'discard'; return 'discard';
} }
}, },
closeComment: function(parserContext, contextStack) {
if (parserContext.token()!==parserContext.closeTag) {
return 'discard';
} else {
return 'text';
}
},
endOfDoc: function(parserContext, contextStack) { endOfDoc: function(parserContext, contextStack) {
// eventually we may want to give better error messages // eventually we may want to give better error messages
throw new ParserException('Unexpected end of document.'); throw new ParserException('Unexpected end of document.');


Laden…
Abbrechen
Speichern