2

Hi I'm a total Noob at scalate/scaml (I tagged haml since scaml & haml are similar). I have some template that looks like this:

-@ var customer : com.x.model.Customer
!!!
%html
    %body
        %p Contact:
            %a{:href => 'mailto:#{customer.email}'}=customer.contact

The %p line is flagged with this error:

org.fusesource.scalate.InvalidSyntaxException: Illegal nesting: content can't be given on the same line as html element or nested within it if the tag is closed at 16.17
Kevin
  • 24,871
  • 19
  • 102
  • 158
  • When I remove the "Contact:" from the %p line it makes it further...to some other syntax error. But I don't understand why what I'm doing is wrong. I want the html to be

    Contact: xxxx

    – Kevin May 07 '11 at 02:23
  • putting "Contact:" in a %span seems to be a workaround... – Kevin May 07 '11 at 02:30

1 Answers1

5

In HAML, you can't provide content both on the same line and indented.

So, if you write %p Contact:, you can't add anything else to the <p>. You have to move everything to the next indentation level:

    %p
      Contact:
      %a{:href => 'mailto:#{customer.email}'}=customer.contact
Michaël Witrant
  • 7,525
  • 40
  • 44