haml 3.1.6.rc.1 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/REVISION +1 -1
- data/VERSION +1 -1
- metadata +5 -12
- data/test/haml-spec/LICENSE +0 -14
- data/test/haml-spec/README.md +0 -106
- data/test/haml-spec/lua_haml_spec.lua +0 -38
- data/test/haml-spec/perl_haml_test.pl +0 -81
- data/test/haml-spec/ruby_haml_test.rb +0 -23
- data/test/haml-spec/tests.json +0 -612
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
e6d7c09025116a5991641d04fd0fb9976a990ea6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.6
|
1
|
+
3.1.6
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.6
|
5
|
-
prerelease:
|
4
|
+
version: 3.1.6
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nathan Weizenbaum
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-05-
|
14
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: yard
|
@@ -174,12 +174,6 @@ files:
|
|
174
174
|
- test/haml/templates/very_basic.haml
|
175
175
|
- test/haml/templates/whitespace_handling.haml
|
176
176
|
- test/haml/util_test.rb
|
177
|
-
- test/haml-spec/LICENSE
|
178
|
-
- test/haml-spec/lua_haml_spec.lua
|
179
|
-
- test/haml-spec/perl_haml_test.pl
|
180
|
-
- test/haml-spec/README.md
|
181
|
-
- test/haml-spec/ruby_haml_test.rb
|
182
|
-
- test/haml-spec/tests.json
|
183
177
|
- test/linked_rails.rb
|
184
178
|
- test/test_helper.rb
|
185
179
|
- extra/update_watch.rb
|
@@ -465,9 +459,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
465
459
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
466
460
|
none: false
|
467
461
|
requirements:
|
468
|
-
- - ! '
|
462
|
+
- - ! '>='
|
469
463
|
- !ruby/object:Gem::Version
|
470
|
-
version:
|
464
|
+
version: '0'
|
471
465
|
requirements: []
|
472
466
|
rubyforge_project: haml
|
473
467
|
rubygems_version: 1.8.24
|
@@ -482,4 +476,3 @@ test_files:
|
|
482
476
|
- test/haml/spec_test.rb
|
483
477
|
- test/haml/template_test.rb
|
484
478
|
- test/haml/util_test.rb
|
485
|
-
- test/haml-spec/ruby_haml_test.rb
|
data/test/haml-spec/LICENSE
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
2
|
-
Version 2, December 2004
|
3
|
-
|
4
|
-
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
5
|
-
|
6
|
-
Everyone is permitted to copy and distribute verbatim or modified
|
7
|
-
copies of this license document, and changing it is allowed as long
|
8
|
-
as the name is changed.
|
9
|
-
|
10
|
-
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
-
|
13
|
-
0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
-
|
data/test/haml-spec/README.md
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
# Haml Spec #
|
2
|
-
|
3
|
-
Haml Spec provides a basic suite of tests for Haml interpreters.
|
4
|
-
|
5
|
-
It is intented for developers who are creating or maintaining an implementation
|
6
|
-
of the [Haml](http://haml-lang.com) markup language.
|
7
|
-
|
8
|
-
At the moment, there are test runners for the [original
|
9
|
-
Haml](http://github.com/nex3/haml) in Ruby, [Lua
|
10
|
-
Haml](http://github.com/norman/lua-haml) and the
|
11
|
-
[Text::Haml](http://github.com/vti/text-haml) Perl port. Support for other
|
12
|
-
versions of Haml will be added if their developers/maintainers are interested in
|
13
|
-
using it.
|
14
|
-
|
15
|
-
## The Tests ##
|
16
|
-
|
17
|
-
The tests are kept in JSON format for portability across languages. Each test
|
18
|
-
is a JSON object with expected input, output, local variables and configuration
|
19
|
-
parameters (see below). The test suite only provides tests for features which
|
20
|
-
are portable, therefore no tests for script are provided, nor for external
|
21
|
-
filters such as :markdown or :textile.
|
22
|
-
|
23
|
-
The one major exception to this are the tests for interpolation, which you may
|
24
|
-
need to modify with a regular expression to run under PHP or Perl, which
|
25
|
-
require a sigil before variable names. These tests are included despite being
|
26
|
-
less than 100% portable because interpolation is an important part of Haml and
|
27
|
-
can be tricky to implement. These tests are flagged as "optional" so that you
|
28
|
-
can avoid running them if your implementation of Haml will not support this
|
29
|
-
feature.
|
30
|
-
|
31
|
-
## Running the Tests ##
|
32
|
-
|
33
|
-
### Ruby ###
|
34
|
-
|
35
|
-
In order to make it as easy as possible for non-Ruby programmers to run the
|
36
|
-
Ruby Haml tests, the Ruby test runner uses test/unit, rather than something
|
37
|
-
fancier like Rspec. To run them you probably only need to install `haml`, and
|
38
|
-
possibly `ruby` if your platform doesn't come with it by default. If you're
|
39
|
-
using Ruby 1.8.x, you'll also need to install `json`:
|
40
|
-
|
41
|
-
sudo gem install haml
|
42
|
-
# for Ruby 1.8.x; check using "ruby --version" if unsure
|
43
|
-
sudo gem install json
|
44
|
-
|
45
|
-
Then, running the Ruby test suite is easy:
|
46
|
-
|
47
|
-
ruby -rminitest/autorun ruby_haml_test.rb
|
48
|
-
|
49
|
-
At the moment, running the tests with Ruby 1.8.7 fails because of issues with
|
50
|
-
the JSON library. Please use 1.9.2 until this is resolved.
|
51
|
-
|
52
|
-
### Lua ###
|
53
|
-
|
54
|
-
The Lua test depends on
|
55
|
-
[Penlight](http://stevedonovan.github.com/Penlight/),
|
56
|
-
[Telescope](http://github.com/norman/telescope),
|
57
|
-
[jason4lua](http://json.luaforge.net/), and
|
58
|
-
[Lua Haml](http://github.com/norman/lua-haml). Install and run `tsc
|
59
|
-
lua_haml_spec.lua`.
|
60
|
-
|
61
|
-
### Getting it ###
|
62
|
-
|
63
|
-
You can access the [Git repository](http://github.com/norman/haml-spec) at:
|
64
|
-
|
65
|
-
git://github.com/norman/haml-spec.git
|
66
|
-
|
67
|
-
Patches are *very* welcome, as are test runners for your Haml implementation.
|
68
|
-
|
69
|
-
As long as any test you add run against Ruby Haml and are not redundant, I'll
|
70
|
-
be very happy to add them.
|
71
|
-
|
72
|
-
### Test JSON format ###
|
73
|
-
|
74
|
-
"test name" : {
|
75
|
-
"haml" : "haml input",
|
76
|
-
"html" : "expected html output",
|
77
|
-
"result" : "expected test result",
|
78
|
-
"locals" : "local vars",
|
79
|
-
"config" : "config params",
|
80
|
-
"optional" : true|false
|
81
|
-
}
|
82
|
-
|
83
|
-
* test name: This should be a *very* brief description of what's being tested. It can
|
84
|
-
be used by the test runners to name test methods, or to exclude certain tests from being
|
85
|
-
run.
|
86
|
-
* haml: The Haml code to be evaluated. Always required.
|
87
|
-
* html: The HTML output that should be generated. Required unless "result" is "error".
|
88
|
-
* result: Can be "pass" or "error". If it's absent, then "pass" is assumed. If it's "error",
|
89
|
-
then the goal of the test is to make sure that malformed Haml code generates an error.
|
90
|
-
* locals: An object containing local variables needed for the test.
|
91
|
-
* config: An object containing configuration parameters used to run the test.
|
92
|
-
The configuration parameters should be usable directly by Ruby's Haml with no
|
93
|
-
modification. If your implementation uses config parameters with different
|
94
|
-
names, you may need to process them to make them match your implementation.
|
95
|
-
If your implementation has options that do not exist in Ruby's Haml, then you
|
96
|
-
should add tests for this in your implementation's test rather than here.
|
97
|
-
* optional: whether or not the test is optional
|
98
|
-
|
99
|
-
## License ##
|
100
|
-
|
101
|
-
This project is released under the [WTFPL](http://sam.zoy.org/wtfpl/) in order
|
102
|
-
to be as usable as possible in any project, commercial or free.
|
103
|
-
|
104
|
-
## Author ##
|
105
|
-
|
106
|
-
[Norman Clarke](mailto:norman@njclarke.com)
|
@@ -1,38 +0,0 @@
|
|
1
|
-
local dir = require 'pl.dir'
|
2
|
-
local haml = require 'haml'
|
3
|
-
local json = require 'json'
|
4
|
-
local path = require 'pl.path'
|
5
|
-
local telescope = require 'telescope'
|
6
|
-
local assert = assert
|
7
|
-
local describe = telescope.describe
|
8
|
-
local getinfo = debug.getinfo
|
9
|
-
local it = telescope.it
|
10
|
-
local open = io.open
|
11
|
-
local pairs = pairs
|
12
|
-
|
13
|
-
module('hamlspec')
|
14
|
-
|
15
|
-
local function get_tests(filename)
|
16
|
-
local me = path.abspath(getinfo(1).source:match("@(.*)$"))
|
17
|
-
return path.join(path.dirname(me), filename)
|
18
|
-
end
|
19
|
-
|
20
|
-
local json_file = get_tests("tests.json")
|
21
|
-
local file = assert(open(json_file))
|
22
|
-
local input = file:read '*a'
|
23
|
-
file:close()
|
24
|
-
|
25
|
-
local contexts = json.decode(input)
|
26
|
-
|
27
|
-
describe("LuaHaml", function()
|
28
|
-
for context, expectations in pairs(contexts) do
|
29
|
-
describe("When handling " .. context, function()
|
30
|
-
for name, exp in pairs(expectations) do
|
31
|
-
it(("should correctly render %s"):format(name), function()
|
32
|
-
local engine = haml.new(exp.config)
|
33
|
-
assert_equal(engine:render(exp.haml, exp.locals), exp.html)
|
34
|
-
end)
|
35
|
-
end
|
36
|
-
end)
|
37
|
-
end
|
38
|
-
end)
|
@@ -1,81 +0,0 @@
|
|
1
|
-
#!/usr/bin/env perl
|
2
|
-
|
3
|
-
use strict;
|
4
|
-
use warnings;
|
5
|
-
|
6
|
-
use Test::More 'no_plan';
|
7
|
-
use Text::Haml;
|
8
|
-
use FindBin;
|
9
|
-
use JSON 'from_json';
|
10
|
-
|
11
|
-
our $VERSION = 0.990101;
|
12
|
-
|
13
|
-
my $tests;
|
14
|
-
|
15
|
-
open FILE, "< $FindBin::Bin/tests.json" or die $!;
|
16
|
-
$tests = from_json(join("\n", <FILE>));
|
17
|
-
close FILE;
|
18
|
-
|
19
|
-
while (my ($section_name, $section) = each %$tests) {
|
20
|
-
diag $section_name;
|
21
|
-
|
22
|
-
while (my ($test_name, $test) = each %$section) {
|
23
|
-
is( Text::Haml->new(%{$test->{config}}, vars_as_subs => 1)
|
24
|
-
->render($test->{haml}, %{$test->{locals}}),
|
25
|
-
$test->{html}, $test_name
|
26
|
-
);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
__END__
|
30
|
-
|
31
|
-
=head1 NAME
|
32
|
-
|
33
|
-
perl_haml_test.pl - Text::Haml spec tests runner
|
34
|
-
|
35
|
-
=head1 SYNOPSIS
|
36
|
-
|
37
|
-
$ perl perl_haml_test.pl
|
38
|
-
|
39
|
-
# conditional comments
|
40
|
-
ok 1 - a conditional comment
|
41
|
-
# tags with nested content
|
42
|
-
ok 2 - a tag with CSS
|
43
|
-
|
44
|
-
...
|
45
|
-
|
46
|
-
ok 81 - an inline comment
|
47
|
-
ok 82 - a nested comment
|
48
|
-
1..82
|
49
|
-
|
50
|
-
=head1 DESCRIPTION
|
51
|
-
|
52
|
-
This file is a part of Haml spec tests envorinment. It tests Perl
|
53
|
-
implementation using <Text::Haml>.
|
54
|
-
|
55
|
-
=head1 DEPENDENCIES
|
56
|
-
|
57
|
-
=over
|
58
|
-
|
59
|
-
* Text::Haml (available via CPAN or http://github.com/vti/text-haml)
|
60
|
-
* JSON (available on CPAN)
|
61
|
-
* Test::More (included in Perl core)
|
62
|
-
* FindBin (included in Perl core)
|
63
|
-
|
64
|
-
=back
|
65
|
-
|
66
|
-
=head1 SEE ALSO
|
67
|
-
|
68
|
-
L<Text::Haml>
|
69
|
-
|
70
|
-
=head1 AUTHOR
|
71
|
-
|
72
|
-
Viacheslav Tykhanovskyi, C<vti@cpan.org>.
|
73
|
-
|
74
|
-
=head1 COPYRIGHT AND LICENSE
|
75
|
-
|
76
|
-
Copyright (C) 2009, Viacheslav Tykhanovskyi
|
77
|
-
|
78
|
-
This program is free software, you can redistribute it and/or modify it under
|
79
|
-
the terms of the Artistic License version 2.0.
|
80
|
-
|
81
|
-
=cut
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "test/unit"
|
3
|
-
require "json"
|
4
|
-
require "haml"
|
5
|
-
|
6
|
-
class HamlTest < Test::Unit::TestCase
|
7
|
-
contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
|
8
|
-
contexts.each do |context|
|
9
|
-
context[1].each do |name, test|
|
10
|
-
define_method("test_spec: #{name} (#{context[0]})") do
|
11
|
-
html = test["html"]
|
12
|
-
haml = test["haml"]
|
13
|
-
locals = Hash[(test["locals"] || {}).map {|x, y| [x.to_sym, y]}]
|
14
|
-
options = Hash[(test["config"] || {}).map {|x, y| [x.to_sym, y]}]
|
15
|
-
options[:format] = options[:format].to_sym if options.key?(:format)
|
16
|
-
engine = Haml::Engine.new(test["haml"], options)
|
17
|
-
result = engine.render(Object.new, locals)
|
18
|
-
|
19
|
-
assert_equal html, result.strip
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/test/haml-spec/tests.json
DELETED
@@ -1,612 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"headers" : {
|
3
|
-
|
4
|
-
"an XHTML XML prolog" : {
|
5
|
-
"haml" : "!!! XML",
|
6
|
-
"html" : "<?xml version='1.0' encoding='utf-8' ?>"
|
7
|
-
},
|
8
|
-
|
9
|
-
"an XHTML default (transitional) doctype" : {
|
10
|
-
"haml" : "!!!",
|
11
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
|
12
|
-
},
|
13
|
-
|
14
|
-
"an XHTML 1.1 doctype" : {
|
15
|
-
"haml" : "!!! 1.1",
|
16
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">"
|
17
|
-
},
|
18
|
-
|
19
|
-
"an XHTML 1.2 mobile doctype" : {
|
20
|
-
"haml" : "!!! mobile",
|
21
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">"
|
22
|
-
},
|
23
|
-
|
24
|
-
"an XHTML 1.1 basic doctype" : {
|
25
|
-
"haml" : "!!! basic",
|
26
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">"
|
27
|
-
},
|
28
|
-
|
29
|
-
"an XHTML 1.0 frameset doctype" : {
|
30
|
-
"haml" : "!!! frameset",
|
31
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
|
32
|
-
},
|
33
|
-
|
34
|
-
"an HTML 5 doctype with XHTML syntax" : {
|
35
|
-
"haml" : "!!! 5",
|
36
|
-
"html" : "<!DOCTYPE html>"
|
37
|
-
},
|
38
|
-
|
39
|
-
"an HTML 5 XML prolog (silent)" : {
|
40
|
-
"haml" : "!!! XML",
|
41
|
-
"html" : "",
|
42
|
-
"config" : {
|
43
|
-
"format" : "html5"
|
44
|
-
}
|
45
|
-
},
|
46
|
-
|
47
|
-
"an HTML 5 doctype" : {
|
48
|
-
"haml" : "!!!",
|
49
|
-
"html" : "<!DOCTYPE html>",
|
50
|
-
"config" : {
|
51
|
-
"format" : "html5"
|
52
|
-
}
|
53
|
-
},
|
54
|
-
|
55
|
-
"an HTML 4 XML prolog (silent)" : {
|
56
|
-
"haml" : "!!! XML",
|
57
|
-
"html" : "",
|
58
|
-
"config" : {
|
59
|
-
"format" : "html4"
|
60
|
-
}
|
61
|
-
},
|
62
|
-
|
63
|
-
"an HTML 4 default (transitional) doctype" : {
|
64
|
-
"haml" : "!!!",
|
65
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
|
66
|
-
"config" : {
|
67
|
-
"format" : "html4"
|
68
|
-
}
|
69
|
-
},
|
70
|
-
|
71
|
-
"an HTML 4 frameset doctype" : {
|
72
|
-
"haml" : "!!! frameset",
|
73
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
|
74
|
-
"config" : {
|
75
|
-
"format" : "html4"
|
76
|
-
}
|
77
|
-
},
|
78
|
-
|
79
|
-
"an HTML 4 strict doctype" : {
|
80
|
-
"haml" : "!!! strict",
|
81
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">",
|
82
|
-
"config" : {
|
83
|
-
"format" : "html4"
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
},
|
88
|
-
|
89
|
-
"basic Haml tags and CSS": {
|
90
|
-
|
91
|
-
"a simple Haml tag" : {
|
92
|
-
"haml" : "%p",
|
93
|
-
"html" : "<p></p>"
|
94
|
-
},
|
95
|
-
|
96
|
-
"a self-closing tag (XHTML)" : {
|
97
|
-
"haml" : "%meta",
|
98
|
-
"html" : "<meta />"
|
99
|
-
},
|
100
|
-
|
101
|
-
"a self-closing tag (HTML4)" : {
|
102
|
-
"haml" : "%meta",
|
103
|
-
"html" : "<meta>",
|
104
|
-
"config" : {
|
105
|
-
"format" : "html4"
|
106
|
-
}
|
107
|
-
},
|
108
|
-
|
109
|
-
"a self-closing tag (HTML5)" : {
|
110
|
-
"haml" : "%meta",
|
111
|
-
"html" : "<meta>",
|
112
|
-
"config" : {
|
113
|
-
"format" : "html5"
|
114
|
-
}
|
115
|
-
},
|
116
|
-
|
117
|
-
"a self-closing tag ('/' modifier + XHTML)" : {
|
118
|
-
"haml" : "%zzz/",
|
119
|
-
"html" : "<zzz />"
|
120
|
-
},
|
121
|
-
|
122
|
-
"a self-closing tag ('/' modifier + HTML5)" : {
|
123
|
-
"haml" : "%zzz/",
|
124
|
-
"html" : "<zzz>",
|
125
|
-
"config" : {
|
126
|
-
"format" : "html5"
|
127
|
-
}
|
128
|
-
},
|
129
|
-
|
130
|
-
"a tag with a CSS class" : {
|
131
|
-
"haml" : "%p.class1",
|
132
|
-
"html" : "<p class='class1'></p>"
|
133
|
-
},
|
134
|
-
|
135
|
-
"a tag with multiple CSS classes" : {
|
136
|
-
"haml" : "%p.class1.class2",
|
137
|
-
"html" : "<p class='class1 class2'></p>"
|
138
|
-
},
|
139
|
-
|
140
|
-
"a tag with a CSS id" : {
|
141
|
-
"haml" : "%p#id1",
|
142
|
-
"html" : "<p id='id1'></p>"
|
143
|
-
},
|
144
|
-
|
145
|
-
"a tag with multiple CSS id's" : {
|
146
|
-
"haml" : "%p#id1#id2",
|
147
|
-
"html" : "<p id='id2'></p>"
|
148
|
-
},
|
149
|
-
|
150
|
-
"a tag with a class followed by an id" : {
|
151
|
-
"haml" : "%p.class1#id1",
|
152
|
-
"html" : "<p class='class1' id='id1'></p>"
|
153
|
-
},
|
154
|
-
|
155
|
-
"a tag with an id followed by a class" : {
|
156
|
-
"haml" : "%p#id1.class1",
|
157
|
-
"html" : "<p class='class1' id='id1'></p>"
|
158
|
-
},
|
159
|
-
|
160
|
-
"an implicit div with a CSS id" : {
|
161
|
-
"haml" : "#id1",
|
162
|
-
"html" : "<div id='id1'></div>"
|
163
|
-
},
|
164
|
-
|
165
|
-
"an implicit div with a CSS class" : {
|
166
|
-
"haml" : ".class1",
|
167
|
-
"html" : "<div class='class1'></div>"
|
168
|
-
},
|
169
|
-
|
170
|
-
"multiple simple Haml tags" : {
|
171
|
-
"haml" : "%div\n %div\n %p",
|
172
|
-
"html" : "<div>\n <div>\n <p></p>\n </div>\n</div>"
|
173
|
-
}
|
174
|
-
},
|
175
|
-
|
176
|
-
"tags with unusual HTML characters" : {
|
177
|
-
|
178
|
-
"a tag with colons" : {
|
179
|
-
"haml" : "%ns:tag",
|
180
|
-
"html" : "<ns:tag></ns:tag>"
|
181
|
-
},
|
182
|
-
|
183
|
-
"a tag with underscores" : {
|
184
|
-
"haml" : "%snake_case",
|
185
|
-
"html" : "<snake_case></snake_case>"
|
186
|
-
},
|
187
|
-
|
188
|
-
"a tag with dashes" : {
|
189
|
-
"haml" : "%dashed-tag",
|
190
|
-
"html" : "<dashed-tag></dashed-tag>"
|
191
|
-
},
|
192
|
-
|
193
|
-
"a tag with camelCase" : {
|
194
|
-
"haml" : "%camelCase",
|
195
|
-
"html" : "<camelCase></camelCase>"
|
196
|
-
},
|
197
|
-
|
198
|
-
"a tag with PascalCase" : {
|
199
|
-
"haml" : "%PascalCase",
|
200
|
-
"html" : "<PascalCase></PascalCase>"
|
201
|
-
}
|
202
|
-
},
|
203
|
-
|
204
|
-
"tags with unusual CSS identifiers" : {
|
205
|
-
|
206
|
-
"an all-numeric class" : {
|
207
|
-
"haml" : ".123",
|
208
|
-
"html" : "<div class='123'></div>"
|
209
|
-
},
|
210
|
-
|
211
|
-
"a class with underscores" : {
|
212
|
-
"haml" : ".__",
|
213
|
-
"html" : "<div class='__'></div>"
|
214
|
-
},
|
215
|
-
|
216
|
-
"a class with dashes" : {
|
217
|
-
"haml" : ".--",
|
218
|
-
"html" : "<div class='--'></div>"
|
219
|
-
}
|
220
|
-
},
|
221
|
-
|
222
|
-
"tags with inline content" : {
|
223
|
-
|
224
|
-
"Inline content simple tag" : {
|
225
|
-
"haml" : "%p hello",
|
226
|
-
"html" : "<p>hello</p>"
|
227
|
-
},
|
228
|
-
|
229
|
-
"Inline content tag with CSS" : {
|
230
|
-
"haml" : "%p.class1 hello",
|
231
|
-
"html" : "<p class='class1'>hello</p>"
|
232
|
-
},
|
233
|
-
|
234
|
-
"Inline content multiple simple tags" : {
|
235
|
-
"haml" : "%div\n %div\n %p text",
|
236
|
-
"html" : "<div>\n <div>\n <p>text</p>\n </div>\n</div>"
|
237
|
-
}
|
238
|
-
},
|
239
|
-
|
240
|
-
"tags with nested content" : {
|
241
|
-
|
242
|
-
"Nested content simple tag" : {
|
243
|
-
"haml" : "%p\n hello",
|
244
|
-
"html" : "<p>\n hello\n</p>"
|
245
|
-
},
|
246
|
-
|
247
|
-
"Nested content tag with CSS" : {
|
248
|
-
"haml" : "%p.class1\n hello",
|
249
|
-
"html" : "<p class='class1'>\n hello\n</p>"
|
250
|
-
},
|
251
|
-
|
252
|
-
"Nested content multiple simple tags" : {
|
253
|
-
"haml" : "%div\n %div\n %p\n text",
|
254
|
-
"html" : "<div>\n <div>\n <p>\n text\n </p>\n </div>\n</div>"
|
255
|
-
}
|
256
|
-
},
|
257
|
-
|
258
|
-
"tags with HTML-style attributes": {
|
259
|
-
|
260
|
-
"HTML-style one attribute" : {
|
261
|
-
"haml" : "%p(a='b')",
|
262
|
-
"html" : "<p a='b'></p>"
|
263
|
-
},
|
264
|
-
|
265
|
-
"HTML-style multiple attributes" : {
|
266
|
-
"haml" : "%p(a='b' c='d')",
|
267
|
-
"html" : "<p a='b' c='d'></p>"
|
268
|
-
},
|
269
|
-
|
270
|
-
"HTML-style attributes separated with newlines" : {
|
271
|
-
"haml" : "%p(a='b'\n c='d')",
|
272
|
-
"html" : "<p a='b' c='d'></p>"
|
273
|
-
},
|
274
|
-
|
275
|
-
"HTML-style interpolated attribute" : {
|
276
|
-
"haml" : "%p(a=\"#{var}\")",
|
277
|
-
"html" : "<p a='value'></p>",
|
278
|
-
"locals" : {
|
279
|
-
"var" : "value"
|
280
|
-
}
|
281
|
-
},
|
282
|
-
|
283
|
-
"HTML-style 'class' as an attribute" : {
|
284
|
-
"haml" : "%p(class='class1')",
|
285
|
-
"html" : "<p class='class1'></p>"
|
286
|
-
},
|
287
|
-
|
288
|
-
"HTML-style tag with a CSS class and 'class' as an attribute" : {
|
289
|
-
"haml" : "%p.class2(class='class1')",
|
290
|
-
"html" : "<p class='class1 class2'></p>"
|
291
|
-
},
|
292
|
-
|
293
|
-
"HTML-style tag with 'id' as an attribute" : {
|
294
|
-
"haml" : "%p(id='1')",
|
295
|
-
"html" : "<p id='1'></p>"
|
296
|
-
},
|
297
|
-
|
298
|
-
"HTML-style tag with a CSS id and 'id' as an attribute" : {
|
299
|
-
"haml" : "%p#id(id='1')",
|
300
|
-
"html" : "<p id='id_1'></p>"
|
301
|
-
},
|
302
|
-
|
303
|
-
"HTML-style tag with a variable attribute" : {
|
304
|
-
"haml" : "%p(class=var)",
|
305
|
-
"html" : "<p class='hello'></p>",
|
306
|
-
"locals" : {
|
307
|
-
"var" : "hello"
|
308
|
-
}
|
309
|
-
},
|
310
|
-
|
311
|
-
"HTML-style tag with a CSS class and 'class' as a variable attribute" : {
|
312
|
-
"haml" : ".hello(class=var)",
|
313
|
-
"html" : "<div class='hello world'></div>",
|
314
|
-
"locals" : {
|
315
|
-
"var" : "world"
|
316
|
-
}
|
317
|
-
},
|
318
|
-
|
319
|
-
"HTML-style tag multiple CSS classes (sorted correctly)" : {
|
320
|
-
"haml" : ".z(class=var)",
|
321
|
-
"html" : "<div class='a z'></div>",
|
322
|
-
"locals" : {
|
323
|
-
"var" : "a"
|
324
|
-
}
|
325
|
-
}
|
326
|
-
},
|
327
|
-
|
328
|
-
"tags with Ruby-style attributes": {
|
329
|
-
|
330
|
-
"Ruby-style one attribute" : {
|
331
|
-
"haml" : "%p{:a => 'b'}",
|
332
|
-
"html" : "<p a='b'></p>",
|
333
|
-
"optional" : true
|
334
|
-
},
|
335
|
-
|
336
|
-
"Ruby-style attributes hash with whitespace" : {
|
337
|
-
"haml" : "%p{ :a => 'b' }",
|
338
|
-
"html" : "<p a='b'></p>",
|
339
|
-
"optional" : true
|
340
|
-
},
|
341
|
-
|
342
|
-
"Ruby-style interpolated attribute" : {
|
343
|
-
"haml" : "%p{:a =>\"#{var}\"}",
|
344
|
-
"html" : "<p a='value'></p>",
|
345
|
-
"optional" : true,
|
346
|
-
"locals" : {
|
347
|
-
"var" : "value"
|
348
|
-
}
|
349
|
-
},
|
350
|
-
|
351
|
-
"Ruby-style multiple attributes" : {
|
352
|
-
"haml" : "%p{ :a => 'b', 'c' => 'd' }",
|
353
|
-
"html" : "<p a='b' c='d'></p>",
|
354
|
-
"optional" : true
|
355
|
-
},
|
356
|
-
|
357
|
-
"Ruby-style attributes separated with newlines" : {
|
358
|
-
"haml" : "%p{ :a => 'b',\n 'c' => 'd' }",
|
359
|
-
"html" : "<p a='b' c='d'></p>",
|
360
|
-
"optional" : true
|
361
|
-
},
|
362
|
-
|
363
|
-
"Ruby-style 'class' as an attribute" : {
|
364
|
-
"haml" : "%p{:class => 'class1'}",
|
365
|
-
"html" : "<p class='class1'></p>",
|
366
|
-
"optional" : true
|
367
|
-
},
|
368
|
-
|
369
|
-
"Ruby-style tag with a CSS class and 'class' as an attribute" : {
|
370
|
-
"haml" : "%p.class2{:class => 'class1'}",
|
371
|
-
"html" : "<p class='class1 class2'></p>",
|
372
|
-
"optional" : true
|
373
|
-
},
|
374
|
-
|
375
|
-
"Ruby-style tag with 'id' as an attribute" : {
|
376
|
-
"haml" : "%p{:id => '1'}",
|
377
|
-
"html" : "<p id='1'></p>",
|
378
|
-
"optional" : true
|
379
|
-
},
|
380
|
-
|
381
|
-
"Ruby-style tag with a CSS id and 'id' as an attribute" : {
|
382
|
-
"haml" : "%p#id{:id => '1'}",
|
383
|
-
"html" : "<p id='id_1'></p>",
|
384
|
-
"optional" : true
|
385
|
-
},
|
386
|
-
|
387
|
-
"Ruby-style tag with a CSS id and a numeric 'id' as an attribute" : {
|
388
|
-
"haml" : "%p#id{:id => 1}",
|
389
|
-
"html" : "<p id='id_1'></p>",
|
390
|
-
"optional" : true
|
391
|
-
},
|
392
|
-
|
393
|
-
"Ruby-style tag with a variable attribute" : {
|
394
|
-
"haml" : "%p{:class => var}",
|
395
|
-
"html" : "<p class='hello'></p>",
|
396
|
-
"optional" : true,
|
397
|
-
"locals" : {
|
398
|
-
"var" : "hello"
|
399
|
-
}
|
400
|
-
},
|
401
|
-
|
402
|
-
"Ruby-style tag with a CSS class and 'class' as a variable attribute" : {
|
403
|
-
"haml" : ".hello{:class => var}",
|
404
|
-
"html" : "<div class='hello world'></div>",
|
405
|
-
"optional" : true,
|
406
|
-
"locals" : {
|
407
|
-
"var" : "world"
|
408
|
-
}
|
409
|
-
},
|
410
|
-
|
411
|
-
"Ruby-style tag multiple CSS classes (sorted correctly)" : {
|
412
|
-
"haml" : ".z{:class => var}",
|
413
|
-
"html" : "<div class='a z'></div>",
|
414
|
-
"optional" : true,
|
415
|
-
"locals" : {
|
416
|
-
"var" : "a"
|
417
|
-
}
|
418
|
-
}
|
419
|
-
},
|
420
|
-
|
421
|
-
"silent comments" : {
|
422
|
-
|
423
|
-
"an inline silent comment" : {
|
424
|
-
"haml" : "-# hello",
|
425
|
-
"html" : ""
|
426
|
-
},
|
427
|
-
|
428
|
-
"a nested silent comment" : {
|
429
|
-
"haml" : "-#\n hello",
|
430
|
-
"html" : ""
|
431
|
-
},
|
432
|
-
|
433
|
-
"a multiply nested silent comment" : {
|
434
|
-
"haml" : "-#\n %div\n foo",
|
435
|
-
"html" : ""
|
436
|
-
},
|
437
|
-
|
438
|
-
"a multiply nested silent comment with inconsistent indents" : {
|
439
|
-
"haml" : "-#\n %div\n foo",
|
440
|
-
"html" : ""
|
441
|
-
}
|
442
|
-
},
|
443
|
-
|
444
|
-
"markup comments" : {
|
445
|
-
|
446
|
-
"an inline markup comment" : {
|
447
|
-
"haml" : "/ comment",
|
448
|
-
"html" : "<!-- comment -->"
|
449
|
-
},
|
450
|
-
|
451
|
-
"a nested markup comment" : {
|
452
|
-
"haml" : "/\n comment\n comment2",
|
453
|
-
"html" : "<!--\n comment\n comment2\n-->"
|
454
|
-
}
|
455
|
-
},
|
456
|
-
|
457
|
-
"conditional comments": {
|
458
|
-
"a conditional comment" : {
|
459
|
-
"haml" : "/[if IE]\n %p a",
|
460
|
-
"html" : "<!--[if IE]>\n <p>a</p>\n<![endif]-->"
|
461
|
-
}
|
462
|
-
},
|
463
|
-
|
464
|
-
"internal filters": {
|
465
|
-
|
466
|
-
"content in an 'escaped' filter" : {
|
467
|
-
"haml" : ":escaped\n <&\">",
|
468
|
-
"html" : "<&">"
|
469
|
-
},
|
470
|
-
|
471
|
-
"content in a 'preserve' filter" : {
|
472
|
-
"haml" : ":preserve\n hello\n\n%p",
|
473
|
-
"html" : "hello
\n<p></p>"
|
474
|
-
},
|
475
|
-
|
476
|
-
"content in a 'plain' filter" : {
|
477
|
-
"haml" : ":plain\n hello\n\n%p",
|
478
|
-
"html" : "hello\n<p></p>"
|
479
|
-
},
|
480
|
-
|
481
|
-
"content in a 'css' filter" : {
|
482
|
-
"haml" : ":css\n hello\n\n%p",
|
483
|
-
"html" : "<style type='text/css'>\n /*<![CDATA[*/\n hello\n /*]]>*/\n</style>\n<p></p>"
|
484
|
-
},
|
485
|
-
|
486
|
-
"content in a 'javascript' filter" : {
|
487
|
-
"haml" : ":javascript\n a();\n%p",
|
488
|
-
"html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>"
|
489
|
-
}
|
490
|
-
|
491
|
-
},
|
492
|
-
|
493
|
-
"Ruby-style interpolation": {
|
494
|
-
|
495
|
-
"interpolation inside inline content" : {
|
496
|
-
"haml" : "%p #{var}",
|
497
|
-
"html" : "<p>value</p>",
|
498
|
-
"optional" : true,
|
499
|
-
"locals" : {
|
500
|
-
"var" : "value"
|
501
|
-
}
|
502
|
-
},
|
503
|
-
|
504
|
-
"no interpolation when escaped" : {
|
505
|
-
"haml" : "%p \\#{var}",
|
506
|
-
"html" : "<p>#{var}</p>",
|
507
|
-
"optional" : true,
|
508
|
-
"locals" : {
|
509
|
-
"var" : "value"
|
510
|
-
}
|
511
|
-
},
|
512
|
-
|
513
|
-
"interpolation when the escape character is escaped" : {
|
514
|
-
"haml" : "%p \\\\#{var}",
|
515
|
-
"html" : "<p>\\value</p>",
|
516
|
-
"optional" : true,
|
517
|
-
"locals" : {
|
518
|
-
"var" : "value"
|
519
|
-
}
|
520
|
-
},
|
521
|
-
|
522
|
-
"interpolation inside filtered content" : {
|
523
|
-
"haml" : ":plain\n #{var} interpolated: #{var}",
|
524
|
-
"html" : "value interpolated: value",
|
525
|
-
"optional" : true,
|
526
|
-
"locals" : {
|
527
|
-
"var" : "value"
|
528
|
-
}
|
529
|
-
}
|
530
|
-
},
|
531
|
-
|
532
|
-
"HTML escaping" : {
|
533
|
-
|
534
|
-
"code following '&='" : {
|
535
|
-
"haml" : "&= '<\"&>'",
|
536
|
-
"html" : "<"&>"
|
537
|
-
},
|
538
|
-
|
539
|
-
"code following '=' when escape_haml is set to true" : {
|
540
|
-
"haml" : "= '<\"&>'",
|
541
|
-
"html" : "<"&>",
|
542
|
-
"config" : {
|
543
|
-
"escape_html" : "true"
|
544
|
-
}
|
545
|
-
},
|
546
|
-
|
547
|
-
"code following '!=' when escape_haml is set to true" : {
|
548
|
-
"haml" : "!= '<\"&>'",
|
549
|
-
"html" : "<\"&>",
|
550
|
-
"config" : {
|
551
|
-
"escape_html" : "true"
|
552
|
-
}
|
553
|
-
}
|
554
|
-
|
555
|
-
},
|
556
|
-
|
557
|
-
"boolean attributes" : {
|
558
|
-
|
559
|
-
"boolean attribute with XHTML" : {
|
560
|
-
"haml" : "%input(checked=true)",
|
561
|
-
"html" : "<input checked='checked' />",
|
562
|
-
"config" : {
|
563
|
-
"format" : "xhtml"
|
564
|
-
}
|
565
|
-
},
|
566
|
-
|
567
|
-
"boolean attribute with HTML" : {
|
568
|
-
"haml" : "%input(checked=true)",
|
569
|
-
"html" : "<input checked>",
|
570
|
-
"config" : {
|
571
|
-
"format" : "html5"
|
572
|
-
}
|
573
|
-
}
|
574
|
-
},
|
575
|
-
|
576
|
-
"whitespace preservation" : {
|
577
|
-
|
578
|
-
"following the '~' operator" : {
|
579
|
-
"haml" : "~ \"Foo\\n<pre>Bar\\nBaz</pre>\"",
|
580
|
-
"html" : "Foo\n<pre>Bar
Baz</pre>",
|
581
|
-
"optional" : true
|
582
|
-
},
|
583
|
-
|
584
|
-
"inside a textarea tag" : {
|
585
|
-
"haml" : "%textarea\n hello\n hello",
|
586
|
-
"html" : "<textarea>hello\nhello</textarea>"
|
587
|
-
},
|
588
|
-
|
589
|
-
"inside a pre tag" : {
|
590
|
-
"haml" : "%pre\n hello\n hello",
|
591
|
-
"html" : "<pre>hello\nhello</pre>"
|
592
|
-
}
|
593
|
-
},
|
594
|
-
|
595
|
-
"whitespace removal" : {
|
596
|
-
|
597
|
-
"a tag with '>' appended and inline content" : {
|
598
|
-
"haml" : "%li hello\n%li> world\n%li again",
|
599
|
-
"html" : "<li>hello</li><li>world</li><li>again</li>"
|
600
|
-
},
|
601
|
-
|
602
|
-
"a tag with '>' appended and nested content" : {
|
603
|
-
"haml" : "%li hello\n%li>\n world\n%li again",
|
604
|
-
"html" : "<li>hello</li><li>\n world\n</li><li>again</li>"
|
605
|
-
},
|
606
|
-
|
607
|
-
"a tag with '<' appended" : {
|
608
|
-
"haml" : "%p<\n hello\n world",
|
609
|
-
"html" : "<p>hello\nworld</p>"
|
610
|
-
}
|
611
|
-
}
|
612
|
-
}
|