{
  "simple test" : {

    "a blank file" : {
        "haml_template" : "text/blank",
        "html_template" : "text/blank"
    },

    "meta tag" : {
        "haml" : "%meta(http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\")",
        "html" : "<meta http-equiv='content-type' content='text/html; charset=UTF-8' />"
    }

  },

  "elements" : {

    "a blank file" : {
        "haml_template" : "text/div_nesting",
        "html_template" : "text/div_nesting"
    }

  },

  "data attributes" : {

    "Ruby 1.8 style" : {
        "haml" : "%a{ :href => '/link', :data => { :test => '123', :another => 'test' } }",
        "html" : "<a href='/link' data-test='123' data-another='test'></a>"
    },

    "Ruby 1.8 style over multiple lines" : {
        "haml" : "%a{ :href => '/link', :data => {\n  :test => '123',\n  :another => 'test' } }",
        "html" : "<a href='/link' data-test='123' data-another='test'></a>"
    },

    "Ruby 1.9 style" : {
        "haml" : "%a{ href: '/link', data: { test: '123', another: 'test' } }",
        "html" : "<a href='/link' data-test='123' data-another='test'></a>"
    },

    "Ruby 1.9 style over multiple lines" : {
        "haml" : "%a{ href: '/link', data: {\n  test: '123',\n  another: 'test' } }",
        "html" : "<a href='/link' data-test='123' data-another='test'></a>"
    }
  },

  "tags with Ruby 1.9 style attributes": {

    "Ruby 1.9 style one attribute" : {
      "haml" : "%p{a: 'b'}",
      "html" : "<p a='b'></p>",
      "optional" : true
    },

    "Ruby 1.9 style attributes hash with whitespace" : {
      "haml" : "%p{  a:  'b'  }",
      "html" : "<p a='b'></p>",
      "optional" : true
    },

    "Ruby 1.9 style interpolated attribute" : {
      "haml" : "%p{a: \"#{@var}\"}",
      "html" : "<p a='value'></p>",
      "optional" : true,
      "locals" : {
        "var" : "value"
      }
    },

    "Ruby 1.9 style multiple attributes" : {
      "haml" : "%p{ a: 'b', 'c': 'd' }",
      "html" : "<p a='b' c='d'></p>",
      "optional" : true
    },

    "Ruby 1.9 style attributes separated with newlines" : {
      "haml" : "%p{ a: 'b',\n  'c': 'd' }",
      "html" : "<p a='b' c='d'></p>",
      "optional" : true
    },

    "Ruby 1.9 style 'class' as an attribute" : {
      "haml" : "%p{class: 'class1'}",
      "html" : "<p class='class1'></p>",
      "optional" : true
    },

    "Ruby 1.9 style tag with a CSS class and 'class' as an attribute" : {
      "haml" : "%p.class2{class: 'class1'}",
      "html" : "<p class='class1 class2'></p>",
      "optional" : true
    },

    "Ruby 1.9 style tag with 'id' as an attribute" : {
      "haml" : "%p{id: '1'}",
      "html" : "<p id='1'></p>",
      "optional" : true
    },

    "Ruby 1.9 style tag with a CSS id and 'id' as an attribute" : {
      "haml" : "%p#id{id: '1'}",
      "html" : "<p id='id_1'></p>",
      "optional" : true
    },

    "Ruby 1.9 style tag with a CSS id and a numeric 'id' as an attribute" : {
      "haml" : "%p#id{id: 1}",
      "html" : "<p id='id_1'></p>",
      "optional" : true
    },

    "Ruby 1.9 style tag with a variable attribute" : {
      "haml" : "%p{class: @var}",
      "html" : "<p class='hello'></p>",
      "optional" : true,
      "locals" : {
        "var" : "hello"
      }
    },

    "Ruby 1.9 style tag with a CSS class and 'class' as a variable attribute" : {
      "haml" : ".hello{class: @var}",
      "html" : "<div class='hello world'></div>",
      "optional" : true,
      "locals" : {
        "var" : "world"
      }
    },

    "Ruby 1.9 style tag multiple CSS classes (sorted correctly)" : {
      "haml" : ".z{class: @var}",
      "html" : "<div class='a z'></div>",
      "optional" : true,
      "locals" : {
        "var" : "a"
      }
    }
  },

  "attributes" : {

    "HTML attributes with XHTML" : {
      "haml_template" : "text/attributes",
      "html_template" : "text/attributes_xhtml",
      "locals" : {
        "x" : "1"
      },
      "config" : {
        "format" : "xhtml"
      }
    },

    "HTML attributes with HTML5" : {
      "haml_template" : "text/attributes",
      "html_template" : "text/attributes_html5",
      "locals" : {
        "x" : "1"
      },
      "config" : {
        "format" : "html5"
      }
    },

    "boolean attribute with XHTML" : {
      "haml_template" : "text/boolean_attributes",
      "html_template" : "text/boolean_attributes_xhtml",
      "config" : {
        "format" : "xhtml"
      }
    },

    "boolean attribute with HTML" : {
      "haml_template" : "text/boolean_attributes",
      "html_template" : "text/boolean_attributes_html5",
      "config" : {
        "format" : "html5"
      }
    },

    "Unescape assignment" : {
      "haml" : "%p#important.text{ a: '1' }!= @text",
      "html" : "<p class='text' id='important' a='1'><Hello&></p>",
      "config" : {
        "escape_html" : "true"
      },
      "locals" : {
        "text" : "<Hello&>"
      }
    },

    "Escape assignment" : {
      "haml" : "%p#important.text{ a: '1' }&= @text",
      "html" : "<p class='text' id='important' a='1'>&lt;Hello&amp;&gt;</p>",
      "config" : {
        "escape_html" : "false"
      },
      "locals" : {
        "text" : "<Hello&>"
      }
    },

    "Preserve whitespace assignment" : {
      "haml" : "%p#important.text{ a: '1' }~ 'Foo\\n<pre>Bar\\nBaz</pre>'",
      "html" : "<p class='text' id='important' a='1'>Foo\n<pre>Bar&#x000A;Baz</pre></p>"
    }
  },

  "comments" : {

    "HTML attributes" : {
      "haml_template" : "text/comments",
      "html_template" : "text/comments"
    }

  },

  "Helpers" : {
    "Haml helpers" : {
      "haml_template" : "coffee/helpers",
      "html_template" : "coffee/helpers"
    }
  },

  "CoffeeScript" : {

    "attribute assignment" : {
      "haml_template" : "coffee/attributes",
      "html_template" : "coffee/attributes",
      "locals" : {
        "two" : "We are two",
        "three" : "We are three",
        "products" : [
          {
            "id" : "12345",
            "color" : "blue"
          },
          {
            "id" : "999",
            "color" : "red"
          }
        ],
        "title": "Mr"
      }
    },

    "clean escaped code values" : {
      "haml_template" : "coffee/clean_values",
      "html_template" : "coffee/clean_values",
      "config" : {
        "escape_html" : "true",
        "escape_attributes" : "true"
      },
      "locals" : {
        "nullValue" : null
      }
    },

    "clean unescaped code values" : {
      "haml_template" : "coffee/clean_values",
      "html_template" : "coffee/clean_values",
      "config" : {
        "escape_html" : "false",
        "escape_attributes" : "false"
      },
      "locals" : {
        "nullValue" : null
      }
    },

    "variable assignment" : {
      "haml_template" : "coffee/variable_assignment",
      "html_template" : "coffee/variable_assignment"
    },

    "for loop" : {
      "haml_template" : "coffee/for_loop",
      "html_template" : "coffee/for_loop",
      "locals" : {
        "projects" : [
          {
            "name" : "Project A",
            "tasks" : [
              { "name" : "Do X" },
              { "name" : "Do Y" },
              { "name" : "Do Z" }
            ]
          },
          {
            "name" : "Project B",
            "tasks" : [
              { "name" : "Do A" },
              { "name" : "Do B" },
              { "name" : "Do C" }
            ]
          }
        ]
      }
    },

    "loop nested arrays" : {
      "haml_template" : "coffee/loop_nested_array",
      "html_template" : "coffee/loop_nested_array"
    },

    "multiline assignment" : {
      "haml_template" : "coffee/multiline",
      "html_template" : "coffee/multiline"
    },

    "inline function that generates Haml" : {
      "haml" : "- foo = (x) ->\n  #bar= x*10\n- foo(10)",
      "html" : "<div id='bar'>100</div>"
    },

    "complex example" : {
      "haml_template" : "coffee/complex",
      "html_template" : "coffee/complex",
      "locals" : {
        "items" : ["a", "b", "c"],
        "project_title": "Hello World"
      }
    },

    "Whitespace preservation" : {
      "haml_template" : "coffee/preserve",
      "html_template" : "coffee/preserve",
      "locals" : {
        "title" : "This is a\nmulti line example"
      }
    },
    
    "evaluation in inserting functions" : {
      "haml_template" : "coffee/evaluation_in_function",
      "html_template" : "coffee/evaluation_in_function"
    }
  },

  "filters" : {

    "Preserve" : {
      "haml_template" : "filters/preserve",
      "html_template" : "filters/preserve"
    },

    "CData" : {
      "haml_template" : "filters/cdata",
      "html_template" : "filters/cdata"
    },

    "Escaped" : {
      "haml_template" : "filters/escaped",
      "html_template" : "filters/escaped"
    },

    "Plain" : {
      "haml_template" : "filters/plain",
      "html_template" : "filters/plain"
    },

    "CSS for XHTML" : {
      "haml_template" : "filters/css",
      "html_template" : "filters/css_xhtml",
      "config" : {
        "format" : "xhtml"
      }
    },

    "CSS for HTML4" : {
      "haml_template" : "filters/css",
      "html_template" : "filters/css_html4",
      "config" : {
        "format" : "html4"
      }
    },

    "CSS for HTML5" : {
      "haml_template" : "filters/css",
      "html_template" : "filters/css_html5",
      "config" : {
        "format" : "html5"
      }
    },

    "JavaScript for XHTML" : {
      "haml_template" : "filters/javascript",
      "html_template" : "filters/javascript_xhtml",
      "config" : {
        "format" : "xhtml"
      }
    },

    "JavaScript for HTML4" : {
      "haml_template" : "filters/javascript",
      "html_template" : "filters/javascript_html4",
      "config" : {
        "format" : "html4"
      }
    },

    "JavaScript for HTML5" : {
      "haml_template" : "filters/javascript",
      "html_template" : "filters/javascript_html5",
      "config" : {
        "format" : "html5"
      }
    },

    "CoffeeScript" : {
      "haml_template" : "filters/coffeescript",
      "html_template" : "filters/coffeescript",
      "locals" : {
        "visible" : true,
        "project" : "Haml CoffeeScript",
        "tags" : ["Haml", "CoffeeScript"]
      }
    },

    "JavaScript and CSS" : {
      "haml_template" : "filters/script_css",
      "html_template" : "filters/script_css"
    }
  },

  "escaping" : {
    "plain text escaping" : {
      "haml" : "%title\n  = @title\n  \\= @title",
      "html" : "<title>\n  MyPage\n  = @title\n</title>",
      "locals" : {
        "title" : "MyPage"
      }
    },

    "escaping off" : {
        "haml_template" : "text/escaping",
        "html_template" : "text/escaping_off",
        "config" : {
          "escape_html" : "false"
        },
        "locals" : {
          "title" : "html <em>escaping</em> test"
        }
    },

    "escaping on" : {
        "haml_template" : "text/escaping",
        "html_template" : "text/escaping_on",
        "config" : {
          "escape_html" : "true"
        },
        "locals" : {
          "title" : "html <em>escaping</em> test"
        }
    }
  },

  "special texts" : {

    "embedding HTML" : {
        "haml_template" : "text/embedded_html",
        "html_template" : "text/embedded_html"
    },

    "long plain text" : {
        "haml_template" : "text/long",
        "html_template" : "text/long"
    },

    "Haml online example" : {
        "haml_template" : "text/haml_online_example",
        "html_template" : "text/haml_online_example"
    },

    "Whitespace" : {
        "haml_template" : "text/whitespace",
        "html_template" : "text/whitespace"
    },

    "wrong indention" : {
      "haml_template" : "text/indention",
      "html_template" : "text/indention"
    }

  }
}
