Please help me on this

8 views
Skip to first unread message

venkat

unread,
Sep 17, 2008, 8:09:18 AM9/17/08
to Haml
ActionView::TemplateError (4 spaces were used for indentation. Haml
must be indented using two spaces.)

Thanks in advance

-venkat

Nathan Weizenbaum

unread,
Sep 17, 2008, 11:35:39 AM9/17/08
to ha...@googlegroups.com
I'm not sure if I can be more clear than the error itself... Haml
requires two spaces for indentation. You used more than two spaces.

Chris Eppstein

unread,
Sep 17, 2008, 12:01:43 PM9/17/08
to Haml
ActionView::TemplateError (4 spaces were used for indentation. Haml
must be indented using exactly *two* spaces. Please go to line 7 of
foo.sass,
place the cursor before the first non-space character and press the
backspace key 2 times. Then save the file.)

;-)

Dave Rothlisberger

unread,
Sep 28, 2008, 4:01:27 PM9/28/08
to Haml
I have seen this error when you have blank lines in the template. I
can't remember the details, it may have had to do with multi-line
content (with the dreaded "|" line-joining syntax).

e.g. something like

stuff
stuff
= blah blah blah blah blah |
blah blah blah blah

= blah


Haml seemed to think the second "= blah" line was indented too far,
when in fact it was matching the previous indentation. Removing the
blank line fixed the problem for me.

Again, I can't remember the exact details so I don't have a working
test case for this. Are blank lines allowed or discouraged in haml?

Cheers
Dave.

Nathan Weizenbaum

unread,
Sep 28, 2008, 5:31:54 PM9/28/08
to ha...@googlegroups.com
The problem is caused by the multiline syntax. Haml multiline syntax
requires the | to be used at the end of *each* line in the multiline
block. So you should do

stuff
stuff
= blah blah blah blah blah |
blah blah blah blah |

= blah


See question three of
http://haml.hamptoncatlin.com/docs/rdoc/files/FAQ.html.

Dave Rothlisberger

unread,
Sep 28, 2008, 8:48:54 PM9/28/08
to Haml
Oops, yes I missed the | at the end of the last line. Thanks for
taking the time to reply; however the | is not exactly related to the
problem at hand.

I have narrowed narrowed it down. The following haml template gives
the error "Syntax error on line 6: 4 spaces were used for indentation.
Haml must be indented using two spaces.":

%div
%div
= "blah blah blah blah blah " + |
"blah blah blah." |

= "blah"

If I remove the blank line between the two "=" statements, it compiles
fine.

If the statement above the blank line isn't a multiline statement, it
compiles fine.

If I add 4 spaces to the blank line (to match the indentation of the
other lines, even though other than whitespace there is nothing on
that line) it compiles fine.

I'm using haml 2.0.3, ruby 1.8.7-p22, and rails 2-1-stable.

Cheers,
Dave.



On Sep 28, 4:31 pm, Nathan Weizenbaum <nex...@gmail.com> wrote:
> The problem is caused by the multiline syntax. Haml multiline syntax
> requires the | to be used at the end of *each* line in the multiline
> block. So you should do
>
>   stuff
>     stuff
>       = blah blah blah blah blah |
>         blah blah blah blah      |
>
>       = blah
>
> See question three ofhttp://haml.hamptoncatlin.com/docs/rdoc/files/FAQ.html.

Nathan Weizenbaum

unread,
Sep 28, 2008, 8:52:29 PM9/28/08
to ha...@googlegroups.com
Okay, that's definitely a bug. I'll look into it.

Nathan Weizenbaum

unread,
Oct 3, 2008, 1:42:06 AM10/3/08
to ha...@googlegroups.com
After looking into this further, I've realized that this issue doesn't
appear in the master branch. Since it's easy to work around it in
stable, I don't think I'm going to bother tracking it down further.

jemmons

unread,
Mar 1, 2009, 5:07:46 PM3/1/09
to Nathan Weizenbaum, ha...@googlegroups.com
Sorry to jump in the wayback machine, but this is a hard problem to
google for and this thread was the only hit I've got so far:
http://groups.google.com/group/haml/browse_thread/thread/dbcc90fd32270a34?fwc=2

I'm still having this "empty line after line continuation operator"
problem in 2.0.9, so I guess it leaked into master at some point?
Anyone know if this is on anyone's radar (or can you point me to the
general area I should be looking in to fix it)?

Many thanks!
-Joshua Emmons

Reply all
Reply to author
Forward
0 new messages