diff --git a/compiler/Parser.js b/compiler/Parser.js index 80c1a0b86..21a764371 100644 --- a/compiler/Parser.js +++ b/compiler/Parser.js @@ -222,6 +222,8 @@ class Parser { }); return; } + } else if (attrName === 'marko-init') { + return 'static-text'; } } diff --git a/taglibs/core/core-transformer.js b/taglibs/core/core-transformer.js index b41e630e5..c139f242f 100644 --- a/taglibs/core/core-transformer.js +++ b/taglibs/core/core-transformer.js @@ -70,8 +70,21 @@ var coreAttrHandlers = [ } ], [ - 'marko-preserve-whitespace', function(attr, node) { - node.setPreserveWhitespace(true); + 'marko-preserve-whitespace', function(attr, node, el) { + el.setPreserveWhitespace(true); + } + ], + [ + 'marko-init', function(attr, node, el) { + if (el.tagName !== 'script') { + this.addError('The "marko-init" attribute should only be used on the Hello ${name}! --- \ No newline at end of file diff --git a/test/fixtures/render/autotest/invoke/template.marko b/test/fixtures/render/autotest/invoke/template.marko index ed233c451..48c039e99 100644 --- a/test/fixtures/render/autotest/invoke/template.marko +++ b/test/fixtures/render/autotest/invoke/template.marko @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/test/fixtures/render/autotest/require/template.marko b/test/fixtures/render/autotest/require/template.marko index 9d2d290ab..bd5fb53c7 100644 --- a/test/fixtures/render/autotest/require/template.marko +++ b/test/fixtures/render/autotest/require/template.marko @@ -1,7 +1,7 @@ --- - + Hello ${testHelpers.upperCase("world")}! Hello ${testHelpers.trim(" World ")}!