Skip to content

Officially unsupport multi-line attribute blocks. #95

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ Here is the first example(with a little extra added) from the [haml][] site conv
</div><div id="bio">Experienced software professional...
</div></div></div></body></html>

Note that this works almost the same as ruby's [haml][], but doesn't pretty print the html. This would greatly slow down and complicate the code. If you really want pretty printed html, then I suggest writing one using the xml parser library and process the resulting html..
Note that this works almost the same as ruby's [haml][], but doesn't pretty print the html. This would greatly slow down and complicate the code. If you really want pretty printed html, then I suggest writing one using the xml parser library and process the resulting html.

## Differences from Ruby HAML

* `=` and `-` interpolate JavaScript code, not Ruby
* Multi-line attribute blocks are not supported.

## API

Expand Down
5 changes: 3 additions & 2 deletions lib/haml.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ var Haml;

for (i = 1; count > 0; i += 1) {

// If we reach the end of the line, then there is a problem
// If we reach the end of the line, then there is a problem, or the attribute block is multi-line.
// This behavior is unsupported in HAML-js
if (i > l) {
throw "Malformed attribute block";
throw "Multi-line attribute blocks are unsupported in HAML-js";
}

c = line.charAt(i);
Expand Down