2
votes

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
1
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 <p>Contact: <a href="...">xxxx</a></p> - Kevin
putting "Contact:" in a %span seems to be a workaround... - Kevin

1 Answers

5
votes

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