update some stray references to v1 syntax

pull/1508/head
Conduitry 7 years ago
parent 54799736b8
commit 5e8a8b95e5

@ -35,7 +35,7 @@ export default class Title extends Node {
// TODO some of this code is repeated in Tag.ts — would be good to // TODO some of this code is repeated in Tag.ts — would be good to
// DRY it out if that's possible without introducing crazy indirection // DRY it out if that's possible without introducing crazy indirection
if (this.children.length === 1) { if (this.children.length === 1) {
// single {{tag}} — may be a non-string // single {tag} — may be a non-string
const { expression } = this.children[0]; const { expression } = this.children[0];
const { dependencies, snippet } = this.children[0].expression; const { dependencies, snippet } = this.children[0].expression;

@ -37,7 +37,7 @@ export default function mustache(parser: Parser) {
parser.allowWhitespace(); parser.allowWhitespace();
// {{/if}} or {{/each}} // {/if} or {/each}
if (parser.eat('/')) { if (parser.eat('/')) {
let block = parser.current(); let block = parser.current();
let expected; let expected;
@ -92,7 +92,7 @@ export default function mustache(parser: Parser) {
if (block.type !== 'IfBlock') if (block.type !== 'IfBlock')
parser.error({ parser.error({
code: `invalid-elseif-placement`, code: `invalid-elseif-placement`,
message: 'Cannot have an {{elseif ...}} block outside an {{#if ...}} block' message: 'Cannot have an {:elseif ...} block outside an {#if ...} block'
}); });
parser.requireWhitespace(); parser.requireWhitespace();
@ -124,7 +124,7 @@ export default function mustache(parser: Parser) {
if (block.type !== 'IfBlock' && block.type !== 'EachBlock') { if (block.type !== 'IfBlock' && block.type !== 'EachBlock') {
parser.error({ parser.error({
code: `invalid-else-placement`, code: `invalid-else-placement`,
message: 'Cannot have an {{else}} block outside an {{#if ...}} or {{#each ...}} block' message: 'Cannot have an {:else} block outside an {#if ...} or {#each ...} block'
}); });
} }
@ -187,7 +187,7 @@ export default function mustache(parser: Parser) {
parser.stack.push(catchBlock); parser.stack.push(catchBlock);
} }
} else if (parser.eat('#')) { } else if (parser.eat('#')) {
// {{#if foo}} or {{#each foo}} // {#if foo}, {#each foo} or {#await foo}
let type; let type;
if (parser.eat('if')) { if (parser.eat('if')) {
@ -244,7 +244,7 @@ export default function mustache(parser: Parser) {
parser.allowWhitespace(); parser.allowWhitespace();
// {{#each}} blocks must declare a context {{#each list as item}} // {#each} blocks must declare a context {#each list as item}
if (type === 'EachBlock') { if (type === 'EachBlock') {
parser.eat('as', true); parser.eat('as', true);
parser.requireWhitespace(); parser.requireWhitespace();
@ -299,7 +299,7 @@ export default function mustache(parser: Parser) {
parser.stack.push(childBlock); parser.stack.push(childBlock);
} }
} else if (parser.eat('@html')) { } else if (parser.eat('@html')) {
// {{{raw}}} mustache // {@html content} tag
const expression = readExpression(parser); const expression = readExpression(parser);
parser.allowWhitespace(); parser.allowWhitespace();

@ -69,7 +69,7 @@ export default function validateElement(
if (child.type !== 'Text' && child.type !== 'MustacheTag') { if (child.type !== 'Text' && child.type !== 'MustacheTag') {
validator.error(child, { validator.error(child, {
code: 'illegal-structure', code: 'illegal-structure',
message: `<title> can only contain text and {{tags}}` message: `<title> can only contain text and {tags}`
}); });
} }
}); });

@ -13,7 +13,7 @@ export default function validateHead(validator: Validator, node: Node, refs: Map
// TODO ensure only valid elements are included here // TODO ensure only valid elements are included here
node.children.forEach(node => { node.children.forEach(node => {
if (node.type !== 'Element' && node.type !== 'Title') return; // TODO handle {{#if}} and friends? if (node.type !== 'Element' && node.type !== 'Title') return; // TODO handle {#if} and friends?
validateElement(validator, node, refs, refCallees, [], []); validateElement(validator, node, refs, refCallees, [], []);
}); });
} }

@ -1,7 +1,7 @@
<div>green: {message}</div> <div>green: {message}</div>
<!-- Two styles should *not* be included --> <!-- Two styles should *not* be included -->
<!-- <Two message='{{message}}'/> --> <!-- <Two {message}/> -->
<style> <style>
div { div {

@ -1,6 +1,6 @@
[{ [{
"code": "illegal-structure", "code": "illegal-structure",
"message": "<title> can only contain text and {{tags}}", "message": "<title> can only contain text and {tags}",
"start": { "start": {
"line": 2, "line": 2,
"column": 11, "column": 11,

Loading…
Cancel
Save