|
|
|
@ -86,7 +86,18 @@ export default function mustache(parser: Parser) {
|
|
|
|
|
|
|
|
|
|
block.end = parser.index;
|
|
|
|
|
parser.stack.pop();
|
|
|
|
|
} else if (parser.eat(':elseif')) {
|
|
|
|
|
} else if (parser.eat(':else')) {
|
|
|
|
|
if (parser.eat('if')) {
|
|
|
|
|
parser.error({
|
|
|
|
|
code: 'invalid-elseif',
|
|
|
|
|
message: `'elseif' should be 'else if'`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parser.allowWhitespace();
|
|
|
|
|
|
|
|
|
|
// :else if
|
|
|
|
|
if (parser.eat('if')) {
|
|
|
|
|
const block = parser.current();
|
|
|
|
|
if (block.type !== 'IfBlock')
|
|
|
|
|
parser.error({
|
|
|
|
@ -118,7 +129,10 @@ export default function mustache(parser: Parser) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
parser.stack.push(block.else.children[0]);
|
|
|
|
|
} else if (parser.eat(':else')) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// :else
|
|
|
|
|
else {
|
|
|
|
|
const block = parser.current();
|
|
|
|
|
if (block.type !== 'IfBlock' && block.type !== 'EachBlock') {
|
|
|
|
|
parser.error({
|
|
|
|
@ -138,6 +152,7 @@ export default function mustache(parser: Parser) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
parser.stack.push(block.else);
|
|
|
|
|
}
|
|
|
|
|
} else if (parser.eat(':then')) {
|
|
|
|
|
// TODO DRY out this and the next section
|
|
|
|
|
const pendingBlock = parser.current();
|
|
|
|
|