codemix / htmling

Polymer / HTML5 templating syntax for node.js
MIT License
177 stars 32 forks source link

When a script has attributes on a new line, the document doesn't parse. #19

Open TickleThePanda opened 7 years ago

TickleThePanda commented 7 years ago

I wanted to add jquery to a particular page. The following snippet caused a parse error:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"
    integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
    crossorigin="anonymous">

Error:

Jan 22 12:56:10 4986-11937-2229 node[17019]: /**/node_modules/htmling/lib/parser.js:7782
Jan 22 12:56:10 4986-11937-2229 node[17019]: throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
Jan 22 12:56:10 4986-11937-2229 node[17019]: ^
Jan 22 12:56:10 4986-11937-2229 node[17019]: SyntaxError: Expected <content>, <include>, <script>, <template>, Custom Element, OutputStatement, Raw Content, comment or end of input but "<" found.

This doesn't occur if the script is all on one line, e.g.:

<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous">