diff -Nru ruby-haml-4.0.6/CHANGELOG.md ruby-haml-4.0.7/CHANGELOG.md --- ruby-haml-4.0.6/CHANGELOG.md 2015-01-26 13:55:12.000000000 +0000 +++ ruby-haml-4.0.7/CHANGELOG.md 2015-08-16 21:21:27.000000000 +0000 @@ -1,5 +1,12 @@ # Haml Changelog +## 4.0.7 + +Released on August 10, 2015 +([diff](https://github.com/haml/haml/compare/4.0.6...4.0.7)). + +* Significantly improve performance of regexp used to fix whitespace handling in textareas (thanks [Stan Hu](https://github.com/stanhu)). + ## 4.0.6 Released on Dec 1, 2014 ([diff](https://github.com/haml/haml/compare/4.0.5...4.0.6)). diff -Nru ruby-haml-4.0.6/debian/changelog ruby-haml-4.0.7/debian/changelog --- ruby-haml-4.0.6/debian/changelog 2015-08-29 05:11:30.000000000 +0000 +++ ruby-haml-4.0.7/debian/changelog 2015-10-29 21:51:57.000000000 +0000 @@ -1,3 +1,12 @@ +ruby-haml (4.0.7-1) unstable; urgency=low + + [ Nitesh A Jain ] + * Team upload + * New upstream release + * Change upstream homepage link + + -- Pirate Praveen Fri, 30 Oct 2015 03:21:55 +0530 + ruby-haml (4.0.6-1) unstable; urgency=medium * Team upload. diff -Nru ruby-haml-4.0.6/debian/control ruby-haml-4.0.7/debian/control --- ruby-haml-4.0.6/debian/control 2015-08-29 05:11:10.000000000 +0000 +++ ruby-haml-4.0.7/debian/control 2015-10-27 17:22:31.000000000 +0000 @@ -8,7 +8,7 @@ Standards-Version: 3.9.6 Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-haml.git Vcs-Browser: http://anonscm.debian.org/gitweb?p=pkg-ruby-extras/ruby-haml.git;a=summary -Homepage: http://haml-lang.com/ +Homepage: https://github.com/haml/haml XS-Ruby-Versions: all Package: ruby-haml diff -Nru ruby-haml-4.0.6/lib/haml/buffer.rb ruby-haml-4.0.7/lib/haml/buffer.rb --- ruby-haml-4.0.6/lib/haml/buffer.rb 2015-01-26 13:55:12.000000000 +0000 +++ ruby-haml-4.0.7/lib/haml/buffer.rb 2015-08-16 21:21:27.000000000 +0000 @@ -270,16 +270,16 @@ # @since Haml 4.0.1 # @private def fix_textareas!(input) - pattern = /([ ]*)<(textarea)([^>]*)>(\n| )(.*?)(<\/\2>)/im + pattern = /<(textarea)([^>]*)>(\n| )(.*?)<\/textarea>/im input.gsub!(pattern) do |s| match = pattern.match(s) - content = match[5] - if match[4] == ' ' + content = match[4] + if match[3] == ' ' content.sub!(/\A /, ' ') else content.sub!(/\A[ ]*/, '') end - "#{match[1]}<#{match[2]}#{match[3]}>\n#{content}" + "<#{match[1]}#{match[2]}>\n#{content}" end end diff -Nru ruby-haml-4.0.6/lib/haml/version.rb ruby-haml-4.0.7/lib/haml/version.rb --- ruby-haml-4.0.6/lib/haml/version.rb 2015-01-26 13:55:12.000000000 +0000 +++ ruby-haml-4.0.7/lib/haml/version.rb 2015-08-16 21:21:27.000000000 +0000 @@ -1,3 +1,3 @@ module Haml - VERSION = "4.0.6" + VERSION = '4.0.7' end diff -Nru ruby-haml-4.0.6/metadata.yml ruby-haml-4.0.7/metadata.yml --- ruby-haml-4.0.6/metadata.yml 2015-01-26 13:55:12.000000000 +0000 +++ ruby-haml-4.0.7/metadata.yml 2015-08-16 21:21:27.000000000 +0000 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: haml version: !ruby/object:Gem::Version - version: 4.0.6 + version: 4.0.7 platform: ruby authors: - Nathan Weizenbaum @@ -10,7 +10,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2014-12-01 00:00:00.000000000 Z +date: 2015-08-10 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: tilt @@ -136,6 +136,12 @@ - test/gemfiles/Gemfile.rails-3.1.x - test/gemfiles/Gemfile.rails-3.2.x - test/gemfiles/Gemfile.rails-4.0.x +- test/haml-spec/LICENSE +- test/haml-spec/README.md +- test/haml-spec/lua_haml_spec.lua +- test/haml-spec/perl_haml_test.pl +- test/haml-spec/ruby_haml_test.rb +- test/haml-spec/tests.json - test/helper_test.rb - test/markaby/standard.mab - test/mocks/article.rb @@ -228,13 +234,14 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.4 +rubygems_version: 2.4.7 signing_key: specification_version: 4 summary: An elegant, structured (X)HTML/XML templating engine. test_files: - test/engine_test.rb - test/filters_test.rb +- test/haml-spec/ruby_haml_test.rb - test/helper_test.rb - test/parser_test.rb - test/template_test.rb diff -Nru ruby-haml-4.0.6/REFERENCE.md ruby-haml-4.0.7/REFERENCE.md --- ruby-haml-4.0.6/REFERENCE.md 2015-01-26 13:55:12.000000000 +0000 +++ ruby-haml-4.0.7/REFERENCE.md 2015-08-16 21:21:27.000000000 +0000 @@ -329,7 +329,7 @@ You can use as many such attribute methods as you want by separating them with -commas, like a Ruby argument list. All the hashes will me merged together, from +commas, like a Ruby argument list. All the hashes will be merged together, from left to right. For example, if you defined def hash1 diff -Nru ruby-haml-4.0.6/test/haml-spec/LICENSE ruby-haml-4.0.7/test/haml-spec/LICENSE --- ruby-haml-4.0.6/test/haml-spec/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ ruby-haml-4.0.7/test/haml-spec/LICENSE 2015-08-16 21:21:27.000000000 +0000 @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff -Nru ruby-haml-4.0.6/test/haml-spec/lua_haml_spec.lua ruby-haml-4.0.7/test/haml-spec/lua_haml_spec.lua --- ruby-haml-4.0.6/test/haml-spec/lua_haml_spec.lua 1970-01-01 00:00:00.000000000 +0000 +++ ruby-haml-4.0.7/test/haml-spec/lua_haml_spec.lua 2015-08-16 21:21:27.000000000 +0000 @@ -0,0 +1,38 @@ +local dir = require 'pl.dir' +local haml = require 'haml' +local json = require 'json' +local path = require 'pl.path' +local telescope = require 'telescope' +local assert = assert +local describe = telescope.describe +local getinfo = debug.getinfo +local it = telescope.it +local open = io.open +local pairs = pairs + +module('hamlspec') + +local function get_tests(filename) + local me = path.abspath(getinfo(1).source:match("@(.*)$")) + return path.join(path.dirname(me), filename) +end + +local json_file = get_tests("tests.json") +local file = assert(open(json_file)) +local input = file:read '*a' +file:close() + +local contexts = json.decode(input) + +describe("LuaHaml", function() + for context, expectations in pairs(contexts) do + describe("When handling " .. context, function() + for name, exp in pairs(expectations) do + it(("should correctly render %s"):format(name), function() + local engine = haml.new(exp.config) + assert_equal(engine:render(exp.haml, exp.locals), exp.html) + end) + end + end) + end +end) \ No newline at end of file diff -Nru ruby-haml-4.0.6/test/haml-spec/perl_haml_test.pl ruby-haml-4.0.7/test/haml-spec/perl_haml_test.pl --- ruby-haml-4.0.6/test/haml-spec/perl_haml_test.pl 1970-01-01 00:00:00.000000000 +0000 +++ ruby-haml-4.0.7/test/haml-spec/perl_haml_test.pl 2015-08-16 21:21:27.000000000 +0000 @@ -0,0 +1,81 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Test::More 'no_plan'; +use Text::Haml; +use FindBin; +use JSON 'from_json'; + +our $VERSION = 0.990101; + +my $tests; + +open FILE, "< $FindBin::Bin/tests.json" or die $!; +$tests = from_json(join("\n", )); +close FILE; + +while (my ($section_name, $section) = each %$tests) { + diag $section_name; + + while (my ($test_name, $test) = each %$section) { + is( Text::Haml->new(%{$test->{config}}, vars_as_subs => 1) + ->render($test->{haml}, %{$test->{locals}}), + $test->{html}, $test_name + ); + } +} +__END__ + +=head1 NAME + +perl_haml_test.pl - Text::Haml spec tests runner + +=head1 SYNOPSIS + + $ perl perl_haml_test.pl + + # conditional comments + ok 1 - a conditional comment + # tags with nested content + ok 2 - a tag with CSS + + ... + + ok 81 - an inline comment + ok 82 - a nested comment + 1..82 + +=head1 DESCRIPTION + +This file is a part of Haml spec tests envorinment. It tests Perl +implementation using . + +=head1 DEPENDENCIES + +=over + + * Text::Haml (available via CPAN or http://github.com/vti/text-haml) + * JSON (available on CPAN) + * Test::More (included in Perl core) + * FindBin (included in Perl core) + +=back + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Viacheslav Tykhanovskyi, C. + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2009, Viacheslav Tykhanovskyi + +This program is free software, you can redistribute it and/or modify it under +the terms of the Artistic License version 2.0. + +=cut diff -Nru ruby-haml-4.0.6/test/haml-spec/README.md ruby-haml-4.0.7/test/haml-spec/README.md --- ruby-haml-4.0.6/test/haml-spec/README.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-haml-4.0.7/test/haml-spec/README.md 2015-08-16 21:21:27.000000000 +0000 @@ -0,0 +1,106 @@ +# Haml Spec # + +Haml Spec provides a basic suite of tests for Haml interpreters. + +It is intented for developers who are creating or maintaining an implementation +of the [Haml](http://haml-lang.com) markup language. + +At the moment, there are test runners for the [original +Haml](http://github.com/nex3/haml) in Ruby, [Lua +Haml](http://github.com/norman/lua-haml) and the +[Text::Haml](http://github.com/vti/text-haml) Perl port. Support for other +versions of Haml will be added if their developers/maintainers are interested in +using it. + +## The Tests ## + +The tests are kept in JSON format for portability across languages. Each test +is a JSON object with expected input, output, local variables and configuration +parameters (see below). The test suite only provides tests for features which +are portable, therefore no tests for script are provided, nor for external +filters such as :markdown or :textile. + +The one major exception to this are the tests for interpolation, which you may +need to modify with a regular expression to run under PHP or Perl, which +require a sigil before variable names. These tests are included despite being +less than 100% portable because interpolation is an important part of Haml and +can be tricky to implement. These tests are flagged as "optional" so that you +can avoid running them if your implementation of Haml will not support this +feature. + +## Running the Tests ## + +### Ruby ### + +The Ruby test runner uses minitest, the same as the Ruby Haml implementation. +To run the tests you probably only need to install `haml`, `minitest` and +possibly `ruby` if your platform doesn't come with it by default. If you're +using Ruby 1.8.x, you'll also need to install `json`: + + sudo gem install haml + sudo gem install minitest + # for Ruby 1.8.x; check using "ruby --version" if unsure + sudo gem install json + +Then, running the Ruby test suite is easy: + + ruby ruby_haml_test.rb + +At the moment, running the tests with Ruby 1.8.7 fails because of issues with +the JSON library. Please use 1.9.2 until this is resolved. + +### Lua ### + +The Lua test depends on +[Penlight](http://stevedonovan.github.com/Penlight/), +[Telescope](http://github.com/norman/telescope), +[jason4lua](http://json.luaforge.net/), and +[Lua Haml](http://github.com/norman/lua-haml). Install and run `tsc +lua_haml_spec.lua`. + +### Getting it ### + +You can access the [Git repository](http://github.com/norman/haml-spec) at: + + git://github.com/norman/haml-spec.git + +Patches are *very* welcome, as are test runners for your Haml implementation. + +As long as any test you add run against Ruby Haml and are not redundant, I'll +be very happy to add them. + +### Test JSON format ### + + "test name" : { + "haml" : "haml input", + "html" : "expected html output", + "result" : "expected test result", + "locals" : "local vars", + "config" : "config params", + "optional" : true|false + } + +* test name: This should be a *very* brief description of what's being tested. It can + be used by the test runners to name test methods, or to exclude certain tests from being + run. +* haml: The Haml code to be evaluated. Always required. +* html: The HTML output that should be generated. Required unless "result" is "error". +* result: Can be "pass" or "error". If it's absent, then "pass" is assumed. If it's "error", + then the goal of the test is to make sure that malformed Haml code generates an error. +* locals: An object containing local variables needed for the test. +* config: An object containing configuration parameters used to run the test. + The configuration parameters should be usable directly by Ruby's Haml with no + modification. If your implementation uses config parameters with different + names, you may need to process them to make them match your implementation. + If your implementation has options that do not exist in Ruby's Haml, then you + should add tests for this in your implementation's test rather than here. +* optional: whether or not the test is optional + +## License ## + + This project is released under the [WTFPL](http://sam.zoy.org/wtfpl/) in order + to be as usable as possible in any project, commercial or free. + +## Author ## + + [Norman Clarke](mailto:norman@njclarke.com) diff -Nru ruby-haml-4.0.6/test/haml-spec/ruby_haml_test.rb ruby-haml-4.0.7/test/haml-spec/ruby_haml_test.rb --- ruby-haml-4.0.6/test/haml-spec/ruby_haml_test.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-haml-4.0.7/test/haml-spec/ruby_haml_test.rb 2015-08-16 21:21:27.000000000 +0000 @@ -0,0 +1,23 @@ +require "rubygems" +require "minitest/autorun" +require "json" +require "haml" + +class HamlTest < MiniTest::Unit::TestCase + contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json")) + contexts.each do |context| + context[1].each do |name, test| + define_method("test_spec: #{name} (#{context[0]})") do + html = test["html"] + haml = test["haml"] + locals = Hash[(test["locals"] || {}).map {|x, y| [x.to_sym, y]}] + options = Hash[(test["config"] || {}).map {|x, y| [x.to_sym, y]}] + options[:format] = options[:format].to_sym if options.key?(:format) + engine = Haml::Engine.new(haml, options) + result = engine.render(Object.new, locals) + + assert_equal html, result.strip + end + end + end +end diff -Nru ruby-haml-4.0.6/test/haml-spec/tests.json ruby-haml-4.0.7/test/haml-spec/tests.json --- ruby-haml-4.0.6/test/haml-spec/tests.json 1970-01-01 00:00:00.000000000 +0000 +++ ruby-haml-4.0.7/test/haml-spec/tests.json 2015-08-16 21:21:27.000000000 +0000 @@ -0,0 +1,660 @@ +{ + "headers" : { + + "an XHTML XML prolog" : { + "haml" : "!!! XML", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an XHTML default (transitional) doctype" : { + "haml" : "!!!", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an XHTML 1.1 doctype" : { + "haml" : "!!! 1.1", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an XHTML 1.2 mobile doctype" : { + "haml" : "!!! mobile", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an XHTML 1.1 basic doctype" : { + "haml" : "!!! basic", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an XHTML 1.0 frameset doctype" : { + "haml" : "!!! frameset", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an HTML 5 doctype with XHTML syntax" : { + "haml" : "!!! 5", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "an HTML 5 XML prolog (silent)" : { + "haml" : "!!! XML", + "html" : "", + "config" : { + "format" : "html5" + } + }, + + "an HTML 5 doctype" : { + "haml" : "!!!", + "html" : "", + "config" : { + "format" : "html5" + } + }, + + "an HTML 4 XML prolog (silent)" : { + "haml" : "!!! XML", + "html" : "", + "config" : { + "format" : "html4" + } + }, + + "an HTML 4 default (transitional) doctype" : { + "haml" : "!!!", + "html" : "", + "config" : { + "format" : "html4" + } + }, + + "an HTML 4 frameset doctype" : { + "haml" : "!!! frameset", + "html" : "", + "config" : { + "format" : "html4" + } + }, + + "an HTML 4 strict doctype" : { + "haml" : "!!! strict", + "html" : "", + "config" : { + "format" : "html4" + } + } + + }, + + "basic Haml tags and CSS": { + + "a simple Haml tag" : { + "haml" : "%p", + "html" : "

" + }, + + "a self-closing tag (XHTML)" : { + "haml" : "%meta", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "a self-closing tag (HTML4)" : { + "haml" : "%meta", + "html" : "", + "config" : { + "format" : "html4" + } + }, + + "a self-closing tag (HTML5)" : { + "haml" : "%meta", + "html" : "", + "config" : { + "format" : "html5" + } + }, + + "a self-closing tag ('/' modifier + XHTML)" : { + "haml" : "%zzz/", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "a self-closing tag ('/' modifier + HTML5)" : { + "haml" : "%zzz/", + "html" : "", + "config" : { + "format" : "html5" + } + }, + + "a tag with a CSS class" : { + "haml" : "%p.class1", + "html" : "

" + }, + + "a tag with multiple CSS classes" : { + "haml" : "%p.class1.class2", + "html" : "

" + }, + + "a tag with a CSS id" : { + "haml" : "%p#id1", + "html" : "

" + }, + + "a tag with multiple CSS id's" : { + "haml" : "%p#id1#id2", + "html" : "

" + }, + + "a tag with a class followed by an id" : { + "haml" : "%p.class1#id1", + "html" : "

" + }, + + "a tag with an id followed by a class" : { + "haml" : "%p#id1.class1", + "html" : "

" + }, + + "an implicit div with a CSS id" : { + "haml" : "#id1", + "html" : "
" + }, + + "an implicit div with a CSS class" : { + "haml" : ".class1", + "html" : "
" + }, + + "multiple simple Haml tags" : { + "haml" : "%div\n %div\n %p", + "html" : "
\n
\n

\n
\n
" + } + }, + + "tags with unusual HTML characters" : { + + "a tag with colons" : { + "haml" : "%ns:tag", + "html" : "" + }, + + "a tag with underscores" : { + "haml" : "%snake_case", + "html" : "" + }, + + "a tag with dashes" : { + "haml" : "%dashed-tag", + "html" : "" + }, + + "a tag with camelCase" : { + "haml" : "%camelCase", + "html" : "" + }, + + "a tag with PascalCase" : { + "haml" : "%PascalCase", + "html" : "" + } + }, + + "tags with unusual CSS identifiers" : { + + "an all-numeric class" : { + "haml" : ".123", + "html" : "
" + }, + + "a class with underscores" : { + "haml" : ".__", + "html" : "
" + }, + + "a class with dashes" : { + "haml" : ".--", + "html" : "
" + } + }, + + "tags with inline content" : { + + "Inline content simple tag" : { + "haml" : "%p hello", + "html" : "

hello

" + }, + + "Inline content tag with CSS" : { + "haml" : "%p.class1 hello", + "html" : "

hello

" + }, + + "Inline content multiple simple tags" : { + "haml" : "%div\n %div\n %p text", + "html" : "
\n
\n

text

\n
\n
" + } + }, + + "tags with nested content" : { + + "Nested content simple tag" : { + "haml" : "%p\n hello", + "html" : "

\n hello\n

" + }, + + "Nested content tag with CSS" : { + "haml" : "%p.class1\n hello", + "html" : "

\n hello\n

" + }, + + "Nested content multiple simple tags" : { + "haml" : "%div\n %div\n %p\n text", + "html" : "
\n
\n

\n text\n

\n
\n
" + } + }, + + "tags with HTML-style attributes": { + + "HTML-style one attribute" : { + "haml" : "%p(a='b')", + "html" : "

" + }, + + "HTML-style multiple attributes" : { + "haml" : "%p(a='b' c='d')", + "html" : "

" + }, + + "HTML-style attributes separated with newlines" : { + "haml" : "%p(a='b'\n c='d')", + "html" : "

" + }, + + "HTML-style interpolated attribute" : { + "haml" : "%p(a=\"#{var}\")", + "html" : "

", + "locals" : { + "var" : "value" + } + }, + + "HTML-style 'class' as an attribute" : { + "haml" : "%p(class='class1')", + "html" : "

" + }, + + "HTML-style tag with a CSS class and 'class' as an attribute" : { + "haml" : "%p.class2(class='class1')", + "html" : "

" + }, + + "HTML-style tag with 'id' as an attribute" : { + "haml" : "%p(id='1')", + "html" : "

" + }, + + "HTML-style tag with a CSS id and 'id' as an attribute" : { + "haml" : "%p#id(id='1')", + "html" : "

" + }, + + "HTML-style tag with a variable attribute" : { + "haml" : "%p(class=var)", + "html" : "

", + "locals" : { + "var" : "hello" + } + }, + + "HTML-style tag with a CSS class and 'class' as a variable attribute" : { + "haml" : ".hello(class=var)", + "html" : "
", + "locals" : { + "var" : "world" + } + }, + + "HTML-style tag multiple CSS classes (sorted correctly)" : { + "haml" : ".z(class=var)", + "html" : "
", + "locals" : { + "var" : "a" + } + } + }, + + "tags with Ruby-style attributes": { + + "Ruby-style one attribute" : { + "haml" : "%p{:a => 'b'}", + "html" : "

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

", + "optional" : true + }, + + "Ruby-style interpolated attribute" : { + "haml" : "%p{:a =>\"#{var}\"}", + "html" : "

", + "optional" : true, + "locals" : { + "var" : "value" + } + }, + + "Ruby-style multiple attributes" : { + "haml" : "%p{ :a => 'b', 'c' => 'd' }", + "html" : "

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

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

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

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

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

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

", + "optional" : true + }, + + "Ruby-style tag with a variable attribute" : { + "haml" : "%p{:class => var}", + "html" : "

", + "optional" : true, + "locals" : { + "var" : "hello" + } + }, + + "Ruby-style tag with a CSS class and 'class' as a variable attribute" : { + "haml" : ".hello{:class => var}", + "html" : "
", + "optional" : true, + "locals" : { + "var" : "world" + } + }, + + "Ruby-style tag multiple CSS classes (sorted correctly)" : { + "haml" : ".z{:class => var}", + "html" : "
", + "optional" : true, + "locals" : { + "var" : "a" + } + } + }, + + "silent comments" : { + + "an inline silent comment" : { + "haml" : "-# hello", + "html" : "" + }, + + "a nested silent comment" : { + "haml" : "-#\n hello", + "html" : "" + }, + + "a multiply nested silent comment" : { + "haml" : "-#\n %div\n foo", + "html" : "" + }, + + "a multiply nested silent comment with inconsistent indents" : { + "haml" : "-#\n %div\n foo", + "html" : "" + } + }, + + "markup comments" : { + + "an inline markup comment" : { + "haml" : "/ comment", + "html" : "" + }, + + "a nested markup comment" : { + "haml" : "/\n comment\n comment2", + "html" : "" + } + }, + + "conditional comments": { + "a conditional comment" : { + "haml" : "/[if IE]\n %p a", + "html" : "" + } + }, + + "internal filters": { + + "content in an 'escaped' filter" : { + "haml" : ":escaped\n <&\">", + "html" : "<&">" + }, + + "content in a 'preserve' filter" : { + "haml" : ":preserve\n hello\n\n%p", + "html" : "hello \n

" + }, + + "content in a 'plain' filter" : { + "haml" : ":plain\n hello\n\n%p", + "html" : "hello\n

" + }, + + "content in a 'css' filter (XHTML)" : { + "haml" : ":css\n hello\n\n%p", + "html" : "\n

", + "config" : { + "format" : "xhtml" + } + }, + + "content in a 'javascript' filter (XHTML)" : { + "haml" : ":javascript\n a();\n%p", + "html" : "\n

", + "config" : { + "format" : "xhtml" + } + }, + + "content in a 'css' filter (HTML)" : { + "haml" : ":css\n hello\n\n%p", + "html" : "\n

", + "config" : { + "format" : "html5" + } + }, + + "content in a 'javascript' filter (HTML)" : { + "haml" : ":javascript\n a();\n%p", + "html" : "\n

", + "config" : { + "format" : "html5" + } + } + }, + + "Ruby-style interpolation": { + + "interpolation inside inline content" : { + "haml" : "%p #{var}", + "html" : "

value

", + "optional" : true, + "locals" : { + "var" : "value" + } + }, + + "no interpolation when escaped" : { + "haml" : "%p \\#{var}", + "html" : "

#{var}

", + "optional" : true, + "locals" : { + "var" : "value" + } + }, + + "interpolation when the escape character is escaped" : { + "haml" : "%p \\\\#{var}", + "html" : "

\\value

", + "optional" : true, + "locals" : { + "var" : "value" + } + }, + + "interpolation inside filtered content" : { + "haml" : ":plain\n #{var} interpolated: #{var}", + "html" : "value interpolated: value", + "optional" : true, + "locals" : { + "var" : "value" + } + } + }, + + "HTML escaping" : { + + "code following '&='" : { + "haml" : "&= '<\"&>'", + "html" : "<"&>" + }, + + "code following '=' when escape_haml is set to true" : { + "haml" : "= '<\"&>'", + "html" : "<"&>", + "config" : { + "escape_html" : "true" + } + }, + + "code following '!=' when escape_haml is set to true" : { + "haml" : "!= '<\"&>'", + "html" : "<\"&>", + "config" : { + "escape_html" : "true" + } + } + + }, + + "boolean attributes" : { + + "boolean attribute with XHTML" : { + "haml" : "%input(checked=true)", + "html" : "", + "config" : { + "format" : "xhtml" + } + }, + + "boolean attribute with HTML" : { + "haml" : "%input(checked=true)", + "html" : "", + "config" : { + "format" : "html5" + } + } + }, + + "whitespace preservation" : { + + "following the '~' operator" : { + "haml" : "~ \"Foo\\n
Bar\\nBaz
\"", + "html" : "Foo\n
Bar
Baz
", + "optional" : true + }, + + "inside a textarea tag" : { + "haml" : "%textarea\n hello\n hello", + "html" : "" + }, + + "inside a pre tag" : { + "haml" : "%pre\n hello\n hello", + "html" : "
hello\nhello
" + } + }, + + "whitespace removal" : { + + "a tag with '>' appended and inline content" : { + "haml" : "%li hello\n%li> world\n%li again", + "html" : "
  • hello
  • world
  • again
  • " + }, + + "a tag with '>' appended and nested content" : { + "haml" : "%li hello\n%li>\n world\n%li again", + "html" : "
  • hello
  • \n world\n
  • again
  • " + }, + + "a tag with '<' appended" : { + "haml" : "%p<\n hello\n world", + "html" : "

    hello\nworld

    " + } + } +}