Search code examples
asp.net-mvcsyntax-errornhaml

Error when specifying tag attributes in NHaml


I am just getting started with NHaml and ran into a snag.

This is my application.haml file:

%html
  %head
    %title = Get Some Data
    %link{ href="/media/css/styles.css", rel="Stylesheet", type="text/css" }
  %body
    %div.page
      %h1 = Get Some Data
      _

When I try to view in a browser it throw the following error:

NHaml.Exceptions.SyntaxException: The attribute ',' is occurs twice.

If I remove the line beginning with %link it works fine. What am I doing wrong?

I am following the step-by-step from Brian Hartsock:
http://blog.brianhartsock.com/2009/01/15/using-nhaml-from-source/#nhaml_reference


Solution

  • Weird, maybe NHaml has changed since Brian wrote that tutorial, but the following works...

    %link{ href="/media/css/styles.css" rel="stylesheet" type="text/css" }
    

    No , inside the {}