DOMly icon indicating copy to clipboard operation
DOMly copied to clipboard

Parsing breaks on inline styles

Open cespare opened this issue 10 years ago • 2 comments

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?

cespare avatar Mar 11 '15 22:03 cespare

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.

lazd avatar Mar 11 '15 22:03 lazd

Thanks!

cespare avatar Mar 11 '15 23:03 cespare