Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline pipe appears not to be honored #88

Open
StoneCypher opened this issue Jan 14, 2015 · 3 comments
Open

Multiline pipe appears not to be honored #88

StoneCypher opened this issue Jan 14, 2015 · 3 comments

Comments

@StoneCypher
Copy link

The HAML Spec offers a multiline notation. A HAML transform built on this library which works on similar code fails with this error:

<pre class='error'>SyntaxError: Unexpected token |
  at Function.&lt;anonymous&gt; (/Users/project/node_modules/gulp-haml/node_modules/haml/lib/haml.js:595:29)
  at execute (/Users/project/node_modules/gulp-haml/node_modules/haml/lib/haml.js:602:8)
  at Function.render (/Users/project/node_modules/gulp-haml/node_modules/haml/lib/haml.js:587:12)
  at hamlStream (/Users/project/node_modules/gulp-haml/index.js:23:44)
  at wrappedMapper (/Users/project/node_modules/gulp-haml/node_modules/map-stream/index.js:84:19)
...
@StoneCypher
Copy link
Author

The triggering code is the sample code from the specification

@StoneCypher
Copy link
Author

From the spec:

The pipe character designates a multiline string. It’s placed at the end of a line (after some whitespace) and means that all following lines that end with | will be evaluated as though they were on the same line. Note that even the last line in the multiline block should end with |. For example:

%whoo
  %hoo= h(                       |
    "I think this might get " +  |
    "pretty long so I should " + |
    "probably make it " +        |
    "multiline so it doesn't " + |
    "look awful.")               |
  %p This is short.

is compiled to:

<whoo>
  <hoo>I think this might get pretty long so I should probably make it multiline so it doesn't look awful.</hoo>
  <p>This is short</p>
</whoo>

Instead a compilation failure occurs.

This in concert with #74 make haml-js very difficult to use for practical real-world templates.

@seballot
Copy link

Fixed with #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants