lazd / DOMly

The fast template system that creates and clones DOM nodes
MIT License
53 stars 9 forks source link

Parsing breaks on inline styles #29

Open cespare opened 9 years ago

cespare commented 9 years ago

Input file:

<style>
  body { color: green }
</style>

Result:

Error: Parse error on line 2:
  body { color: green }
-------^
Expecting 'EOF', 'ESCAPED_LEFT', 'ESCAPED_RIGHT', 'CONTENT', '{{', '{{{', got 'INVALID'
  at Object.parseError (<anonymous>:45:15)
  at Object.parse (<anonymous>:110:22)
  at Compiler.makeVariableStatements (/usr/lib/node_modules/domly-liftoff/index.js:292:29)
  at Compiler.setTextContent (/usr/lib/node_modules/domly-liftoff/index.js:243:25)
  at Compiler.buildFunctionBody (/usr/lib/node_modules/domly-liftoff/index.js:632:18)
  at Compiler.precompile (/usr/lib/node_modules/domly-liftoff/index.js:705:8)
  at Object.module.exports.precompile (/usr/lib/node_modules/domly-liftoff/index.js:770:21)
  at Object.<anonymous> (/home/caleb/w/liftoff/admarkup/domlify.coffee:13:13, <js>:17:21)
  at Object.<anonymous> (/home/caleb/w/liftoff/admarkup/domlify.coffee:3:1, <js>:21:4)
  at Module._compile (module.js:456:26)

Is this supposed to work?

lazd commented 9 years ago

Yeah, I think it ought to as we should be looking for {{ and }} not { and }.

For now, you can escape each { and } with \{ and \}. See the Style tag.html test fixture.

cespare commented 9 years ago

Thanks!