haml-edge 2.3.155 → 2.3.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EDGE_GEM_VERSION +1 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/haml/engine.rb +1 -1
- data/lib/haml/html.rb +1 -1
- data/lib/haml/util.rb +15 -3
- data/lib/sass/css.rb +5 -5
- data/lib/sass/engine.rb +1 -1
- data/test/haml/engine_test.rb +11 -0
- data/test/haml/spec/README.md +97 -0
- data/test/haml/spec/lua_haml_spec.lua +30 -0
- data/test/haml/spec/ruby_haml_test.rb +19 -0
- data/test/haml/spec/tests.json +534 -0
- data/vendor/fssm/LICENSE +20 -0
- data/vendor/fssm/README.markdown +55 -0
- data/vendor/fssm/Rakefile +59 -0
- data/vendor/fssm/VERSION.yml +5 -0
- data/vendor/fssm/example.rb +9 -0
- data/vendor/fssm/fssm.gemspec +77 -0
- data/vendor/fssm/lib/fssm.rb +33 -0
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
- data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
- data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
- data/vendor/fssm/lib/fssm/monitor.rb +26 -0
- data/vendor/fssm/lib/fssm/path.rb +91 -0
- data/vendor/fssm/lib/fssm/pathname.rb +502 -0
- data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
- data/vendor/fssm/lib/fssm/state/file.rb +24 -0
- data/vendor/fssm/lib/fssm/support.rb +63 -0
- data/vendor/fssm/lib/fssm/tree.rb +176 -0
- data/vendor/fssm/profile/prof-cache.rb +40 -0
- data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
- data/vendor/fssm/profile/prof-pathname.rb +68 -0
- data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
- data/vendor/fssm/profile/prof.html +2379 -0
- data/vendor/fssm/spec/path_spec.rb +75 -0
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +14 -0
- metadata +37 -2
data/EDGE_GEM_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.158
|
data/Rakefile
CHANGED
|
@@ -213,7 +213,6 @@ task :release_edge do
|
|
|
213
213
|
sh %{rake package}
|
|
214
214
|
sh %{git checkout VERSION}
|
|
215
215
|
|
|
216
|
-
sh %{rubyforge login}
|
|
217
216
|
sh %{rubyforge add_release haml haml-edge "Bleeding Edge (v#{edge_version})" pkg/haml-edge-#{edge_version}.gem}
|
|
218
217
|
sh %{gem push pkg/haml-edge-#{edge_version}.gem}
|
|
219
218
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.158
|
data/lib/haml/engine.rb
CHANGED
|
@@ -99,7 +99,7 @@ module Haml
|
|
|
99
99
|
@options[:encoding] = @options[:encoding].name
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
check_encoding(template) {|msg, line| raise Haml::Error.new(msg, line)}
|
|
102
|
+
template = check_encoding(template) {|msg, line| raise Haml::Error.new(msg, line)}
|
|
103
103
|
|
|
104
104
|
# :eod is a special end-of-document marker
|
|
105
105
|
@template = (template.rstrip).split(/\r\n|\r|\n/) + [:eod, :eod]
|
data/lib/haml/html.rb
CHANGED
|
@@ -127,7 +127,7 @@ module Haml
|
|
|
127
127
|
template = template.read
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
Haml::Util.check_encoding(template) {|msg, line| raise Haml::Error.new(msg, line)}
|
|
130
|
+
template = Haml::Util.check_encoding(template) {|msg, line| raise Haml::Error.new(msg, line)}
|
|
131
131
|
|
|
132
132
|
if @options[:erb]
|
|
133
133
|
require 'haml/html/erb'
|
data/lib/haml/util.rb
CHANGED
|
@@ -237,7 +237,8 @@ module Haml
|
|
|
237
237
|
Haml::Util::RUBY_VERSION[0] == 1 && Haml::Util::RUBY_VERSION[1] < 9
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
-
# Checks that the encoding of a string is valid in Ruby 1.9
|
|
240
|
+
# Checks that the encoding of a string is valid in Ruby 1.9
|
|
241
|
+
# and cleans up potential encoding gotchas like the UTF-8 BOM.
|
|
241
242
|
# If it's not, yields an error string describing the invalid character
|
|
242
243
|
# and the line on which it occurrs.
|
|
243
244
|
#
|
|
@@ -245,9 +246,19 @@ module Haml
|
|
|
245
246
|
# @yield [msg] A block in which an encoding error can be raised.
|
|
246
247
|
# Only yields if there is an encoding error
|
|
247
248
|
# @yieldparam msg [String] The error message to be raised
|
|
249
|
+
# @return [String] `str`, potentially with encoding gotchas like BOMs removed
|
|
248
250
|
def check_encoding(str)
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
if ruby1_8?
|
|
252
|
+
return str.gsub(/\A\xEF\xBB\xBF/, '') # Get rid of the UTF-8 BOM
|
|
253
|
+
elsif str.valid_encoding?
|
|
254
|
+
# Get rid of the Unicode BOM if possible
|
|
255
|
+
if str.encoding.name =~ /^UTF-(8|16|32)(BE|LE)?$/
|
|
256
|
+
return str.gsub(Regexp.new("\\A\uFEFF".encode(str.encoding.name)), '')
|
|
257
|
+
else
|
|
258
|
+
return str
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
251
262
|
encoding = str.encoding
|
|
252
263
|
newlines = Regexp.new("\r\n|\r|\n".encode(encoding).force_encoding("binary"))
|
|
253
264
|
str.force_encoding("binary").split(newlines).each_with_index do |line, i|
|
|
@@ -259,6 +270,7 @@ Invalid #{encoding.name} character #{e.error_char.dump}
|
|
|
259
270
|
MSG
|
|
260
271
|
end
|
|
261
272
|
end
|
|
273
|
+
return str
|
|
262
274
|
end
|
|
263
275
|
|
|
264
276
|
# Checks to see if a class has a given method.
|
data/lib/sass/css.rb
CHANGED
|
@@ -76,7 +76,7 @@ module Sass
|
|
|
76
76
|
@options = options.dup
|
|
77
77
|
# Backwards compatibility
|
|
78
78
|
@options[:old] = true if @options[:alternate] == false
|
|
79
|
-
@
|
|
79
|
+
@template_str = template
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# Converts the CSS template into Sass code.
|
|
@@ -84,10 +84,10 @@ module Sass
|
|
|
84
84
|
# @return [String] The resulting Sass code
|
|
85
85
|
# @raise [Sass::SyntaxError] if there's an error parsing the CSS template
|
|
86
86
|
def render
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
@template = StringScanner.new(
|
|
88
|
+
Haml::Util.check_encoding(@template_str) do |msg, line|
|
|
89
|
+
raise Sass::SyntaxError.new(msg, :line => line)
|
|
90
|
+
end)
|
|
91
91
|
build_tree.to_sass(0, @options).strip + "\n"
|
|
92
92
|
rescue Sass::SyntaxError => err
|
|
93
93
|
err.modify_backtrace(:filename => @options[:filename] || '(css)', :line => @line)
|
data/lib/sass/engine.rb
CHANGED
|
@@ -172,7 +172,7 @@ module Sass
|
|
|
172
172
|
# @return [Sass::Tree::Node] The root of the parse tree.
|
|
173
173
|
# @raise [Sass::SyntaxError] if there's an error in the document
|
|
174
174
|
def to_tree
|
|
175
|
-
check_encoding(@template) {|msg, line| raise Sass::SyntaxError.new(msg, :line => line)}
|
|
175
|
+
@template = check_encoding(@template) {|msg, line| raise Sass::SyntaxError.new(msg, :line => line)}
|
|
176
176
|
|
|
177
177
|
root = Tree::RootNode.new(@template)
|
|
178
178
|
append_children(root, tree(tabulate(@template)).first, true)
|
data/test/haml/engine_test.rb
CHANGED
|
@@ -1250,6 +1250,17 @@ SASS
|
|
|
1250
1250
|
|
|
1251
1251
|
# Encodings
|
|
1252
1252
|
|
|
1253
|
+
def test_utf_8_bom
|
|
1254
|
+
assert_equal <<CSS, render(<<SCSS)
|
|
1255
|
+
<div class='foo'>
|
|
1256
|
+
<p>baz</p>
|
|
1257
|
+
</div>
|
|
1258
|
+
CSS
|
|
1259
|
+
\xEF\xBB\xBF.foo
|
|
1260
|
+
%p baz
|
|
1261
|
+
SCSS
|
|
1262
|
+
end
|
|
1263
|
+
|
|
1253
1264
|
unless Haml::Util.ruby1_8?
|
|
1254
1265
|
def test_default_encoding
|
|
1255
1266
|
assert_equal(Encoding.find("utf-8"), render(<<HAML.encode("us-ascii")).encoding)
|
|
@@ -0,0 +1,97 @@
|
|
|
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 Haml](http://github.com/nex3/haml)
|
|
9
|
+
in Ruby, and for [Lua Haml](http://github.com/norman/lua-haml). Support for
|
|
10
|
+
other versions of Haml will be added if their developers/maintainers
|
|
11
|
+
are interested in using it.
|
|
12
|
+
|
|
13
|
+
## The Tests ##
|
|
14
|
+
|
|
15
|
+
The tests are kept in JSON format for portability across languages. Each test
|
|
16
|
+
is a JSON object with expected input, output, local variables and configuration
|
|
17
|
+
parameters (see below). The test suite only provides tests for features which
|
|
18
|
+
are portable, therefore no tests for script are provided, nor for external
|
|
19
|
+
filters such as :markdown or :textile.
|
|
20
|
+
|
|
21
|
+
The one major exception to this are the tests for interpolation, which you may
|
|
22
|
+
need to modify with a regular expression to run under PHP or Perl, which
|
|
23
|
+
require a symbol before variable names. These tests are included despite being
|
|
24
|
+
less than 100% portable because interpolation is an important part of Haml and
|
|
25
|
+
can be tricky to implement.
|
|
26
|
+
|
|
27
|
+
## Running the Tests ##
|
|
28
|
+
|
|
29
|
+
### Ruby ###
|
|
30
|
+
|
|
31
|
+
In order to make it as easy as possible for non-Ruby programmers to run the
|
|
32
|
+
Ruby Haml tests, the Ruby test runner uses test/unit, rather than something
|
|
33
|
+
fancier like Rspec. To run them you probably only need to install `haml`, and
|
|
34
|
+
possibly `ruby` if your platform doesn't come with it by default. If you're
|
|
35
|
+
using Ruby 1.8.x, you'll also need to install `json`:
|
|
36
|
+
|
|
37
|
+
sudo gem install haml
|
|
38
|
+
# for Ruby 1.8.x; check using "ruby --version" if unsure
|
|
39
|
+
sudo gem install json
|
|
40
|
+
|
|
41
|
+
Then, running the Ruby test suite is easy:
|
|
42
|
+
|
|
43
|
+
ruby ruby_haml_test.rb
|
|
44
|
+
|
|
45
|
+
### Lua ###
|
|
46
|
+
|
|
47
|
+
The Lua test depends on [Telescope](http://telescope.luaforge.net/),
|
|
48
|
+
[jason4lua](http://json.luaforge.net/), and
|
|
49
|
+
[Lua Haml](http://github.com/norman/lua-haml). Install and
|
|
50
|
+
run `tsc lua_haml_spec.lua`.
|
|
51
|
+
|
|
52
|
+
## Contributing ##
|
|
53
|
+
|
|
54
|
+
### Getting it ###
|
|
55
|
+
|
|
56
|
+
You can access the [Git repository](http://github.com/norman/haml-spec) at:
|
|
57
|
+
|
|
58
|
+
git://github.com/norman/haml-spec.git
|
|
59
|
+
|
|
60
|
+
Patches are *very* welcome, as are test runners for your Haml implementation.
|
|
61
|
+
|
|
62
|
+
As long as any test you add run against Ruby Haml and are not redundant, I'll
|
|
63
|
+
be very happy to add them.
|
|
64
|
+
|
|
65
|
+
### Test JSON format ###
|
|
66
|
+
|
|
67
|
+
"test name" : {
|
|
68
|
+
"haml" : "haml input",
|
|
69
|
+
"html" : "expected html output",
|
|
70
|
+
"result" : "expected test result",
|
|
71
|
+
"locals" : "local vars",
|
|
72
|
+
"config" : "config params"
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
* test name: This should be a *very* brief description of what's being tested. It can
|
|
76
|
+
be used by the test runners to name test methods, or to exclude certain tests from being
|
|
77
|
+
run.
|
|
78
|
+
* haml: The Haml code to be evaluated. Always required.
|
|
79
|
+
* html: The HTML output that should be generated. Required unless "result" is "error".
|
|
80
|
+
* result: Can be "pass" or "error". If it's absent, then "pass" is assumed. If it's "error",
|
|
81
|
+
then the goal of the test is to make sure that malformed Haml code generates an error.
|
|
82
|
+
* locals: An object containing local variables needed for the test.
|
|
83
|
+
* config: An object containing configuration parameters used to run the test.
|
|
84
|
+
The configuration parameters should be usable directly by Ruby's Haml with no
|
|
85
|
+
modification. If your implementation uses config parameters with different
|
|
86
|
+
names, you may need to process them to make them match your implementation.
|
|
87
|
+
If your implementation has options that do not exist in Ruby's Haml, then you
|
|
88
|
+
should add tests for this in your implementation's test rather than here.
|
|
89
|
+
|
|
90
|
+
## License ##
|
|
91
|
+
|
|
92
|
+
This project is released under the [WTFPL](http://sam.zoy.org/wtfpl/) in order
|
|
93
|
+
to be as usable as possible in any project, commercial or free.
|
|
94
|
+
|
|
95
|
+
## Author ##
|
|
96
|
+
|
|
97
|
+
[Norman Clarke](mailto:norman@njclarke.com)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'luarocks.require'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'telescope'
|
|
4
|
+
require 'haml'
|
|
5
|
+
|
|
6
|
+
local function get_tests(filename)
|
|
7
|
+
local self = debug.getinfo(1).short_src
|
|
8
|
+
if self:match("/") then return "./" .. self:gsub("[^/]*%.lua$", "/" .. filename)
|
|
9
|
+
elseif self:match("\\") then return self:gsub("[^\\]*%.lua$", "\\" .. filename)
|
|
10
|
+
else return filename
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
local fh = assert(io.open(get_tests("tests.json")))
|
|
15
|
+
local input = fh:read '*a'
|
|
16
|
+
fh:close()
|
|
17
|
+
|
|
18
|
+
local contexts = json.decode(input)
|
|
19
|
+
|
|
20
|
+
describe("LuaHaml", function()
|
|
21
|
+
for context, expectations in pairs(contexts) do
|
|
22
|
+
describe("When handling " .. context, function()
|
|
23
|
+
for name, exp in pairs(expectations) do
|
|
24
|
+
it(string.format("should correctly render %s", name), function()
|
|
25
|
+
assert_equal(haml.render(exp.haml, exp.config or {}, exp.locals or {}), exp.html)
|
|
26
|
+
end)
|
|
27
|
+
end
|
|
28
|
+
end)
|
|
29
|
+
end
|
|
30
|
+
end)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "test/unit"
|
|
2
|
+
require "json"
|
|
3
|
+
require "haml"
|
|
4
|
+
|
|
5
|
+
class HamlTest < Test::Unit::TestCase
|
|
6
|
+
contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
|
|
7
|
+
contexts.each do |context|
|
|
8
|
+
context[1].each do |name, test|
|
|
9
|
+
class_eval(<<-EOTEST)
|
|
10
|
+
def test_#{name.gsub(/\s+|[^a-zA-Z0-9_]/, "_")}
|
|
11
|
+
locals = Hash[*(#{test}["locals"] || {}).collect {|k, v| [k.to_sym, v] }.flatten]
|
|
12
|
+
options = Hash[*(#{test}["config"] || {}).collect {|k, v| [k.to_sym, v.to_sym] }.flatten]
|
|
13
|
+
engine = Haml::Engine.new(#{test}["haml"], options)
|
|
14
|
+
assert_equal(engine.render(Object.new, locals).chomp, #{test}["html"])
|
|
15
|
+
end
|
|
16
|
+
EOTEST
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,534 @@
|
|
|
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 tag with a CSS class" : {
|
|
118
|
+
"haml" : "%p.class1",
|
|
119
|
+
"html" : "<p class='class1'></p>"
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
"a tag with multiple CSS classes" : {
|
|
123
|
+
"haml" : "%p.class1.class2",
|
|
124
|
+
"html" : "<p class='class1 class2'></p>"
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
"a tag with a CSS id" : {
|
|
128
|
+
"haml" : "%p#id1",
|
|
129
|
+
"html" : "<p id='id1'></p>"
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
"a tag with multiple CSS id's" : {
|
|
133
|
+
"haml" : "%p#id1#id2",
|
|
134
|
+
"html" : "<p id='id2'></p>"
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
"a tag with a class followed by an id" : {
|
|
138
|
+
"haml" : "%p.class1#id1",
|
|
139
|
+
"html" : "<p class='class1' id='id1'></p>"
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
"a tag with an id followed by a class" : {
|
|
143
|
+
"haml" : "%p#id1.class1",
|
|
144
|
+
"html" : "<p class='class1' id='id1'></p>"
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
"an implicit div with a CSS id" : {
|
|
148
|
+
"haml" : "#id1",
|
|
149
|
+
"html" : "<div id='id1'></div>"
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
"an implicit div with a CSS class" : {
|
|
153
|
+
"haml" : ".class1",
|
|
154
|
+
"html" : "<div class='class1'></div>"
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
"multiple simple Haml tags" : {
|
|
158
|
+
"haml" : "%div\n %div\n %p",
|
|
159
|
+
"html" : "<div>\n <div>\n <p></p>\n </div>\n</div>"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
"tags with unusual HTML characters" : {
|
|
164
|
+
|
|
165
|
+
"a tag with colons" : {
|
|
166
|
+
"haml" : "%ns:tag",
|
|
167
|
+
"html" : "<ns:tag></ns:tag>"
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
"a tag with underscores" : {
|
|
171
|
+
"haml" : "%snake_case",
|
|
172
|
+
"html" : "<snake_case></snake_case>"
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
"a tag with dashes" : {
|
|
176
|
+
"haml" : "%dashed-tag",
|
|
177
|
+
"html" : "<dashed-tag></dashed-tag>"
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
"a tag with camelCase" : {
|
|
181
|
+
"haml" : "%camelCase",
|
|
182
|
+
"html" : "<camelCase></camelCase>"
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
"a tag with PascalCase" : {
|
|
186
|
+
"haml" : "%PascalCase",
|
|
187
|
+
"html" : "<PascalCase></PascalCase>"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
"tags with unusual CSS identifiers" : {
|
|
192
|
+
|
|
193
|
+
"an all-numeric class" : {
|
|
194
|
+
"haml" : ".123",
|
|
195
|
+
"html" : "<div class='123'></div>"
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
"a class with underscores" : {
|
|
199
|
+
"haml" : ".__",
|
|
200
|
+
"html" : "<div class='__'></div>"
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
"a class with dashes" : {
|
|
204
|
+
"haml" : ".--",
|
|
205
|
+
"html" : "<div class='--'></div>"
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
"tags with inline content" : {
|
|
211
|
+
|
|
212
|
+
"a simple tag" : {
|
|
213
|
+
"haml" : "%p hello",
|
|
214
|
+
"html" : "<p>hello</p>"
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
"a tag with CSS" : {
|
|
218
|
+
"haml" : "%p.class1 hello",
|
|
219
|
+
"html" : "<p class='class1'>hello</p>"
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
"multiple simple tags" : {
|
|
223
|
+
"haml" : "%div\n %div\n %p text",
|
|
224
|
+
"html" : "<div>\n <div>\n <p>text</p>\n </div>\n</div>"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
"tags with nested content" : {
|
|
229
|
+
|
|
230
|
+
"a simple tag" : {
|
|
231
|
+
"haml" : "%p\n hello",
|
|
232
|
+
"html" : "<p>\n hello\n</p>"
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
"a tag with CSS" : {
|
|
236
|
+
"haml" : "%p.class1\n hello",
|
|
237
|
+
"html" : "<p class='class1'>\n hello\n</p>"
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
"multiple simple tags" : {
|
|
241
|
+
"haml" : "%div\n %div\n %p\n text",
|
|
242
|
+
"html" : "<div>\n <div>\n <p>\n text\n </p>\n </div>\n</div>"
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
"tags with HTML-style attributes": {
|
|
248
|
+
|
|
249
|
+
"one attribute" : {
|
|
250
|
+
"haml" : "%p(a='b')",
|
|
251
|
+
"html" : "<p a='b'></p>"
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
"multiple attributes" : {
|
|
255
|
+
"haml" : "%p(a='b' c='d')",
|
|
256
|
+
"html" : "<p a='b' c='d'></p>"
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
"attributes separated with newlines" : {
|
|
260
|
+
"haml" : "%p(a='b'\n c='d')",
|
|
261
|
+
"html" : "<p a='b' c='d'></p>"
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
"an interpolated attribute" : {
|
|
265
|
+
"haml" : "%p(a=\"#{var}\")",
|
|
266
|
+
"html" : "<p a='value'></p>",
|
|
267
|
+
"locals" : {
|
|
268
|
+
"var" : "value"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
"'class' as an attribute" : {
|
|
273
|
+
"haml" : "%p(class='class1')",
|
|
274
|
+
"html" : "<p class='class1'></p>"
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
"a tag with a CSS class and 'class' as an attribute" : {
|
|
278
|
+
"haml" : "%p.class2(class='class1')",
|
|
279
|
+
"html" : "<p class='class1 class2'></p>"
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
"a tag with 'id' as an attribute" : {
|
|
283
|
+
"haml" : "%p(id='1')",
|
|
284
|
+
"html" : "<p id='1'></p>"
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
"a tag with a CSS id and 'id' as an attribute" : {
|
|
288
|
+
"haml" : "%p#id(id='1')",
|
|
289
|
+
"html" : "<p id='id_1'></p>"
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
"a tag with a variable attribute" : {
|
|
293
|
+
"haml" : "%p(class=var)",
|
|
294
|
+
"html" : "<p class='hello'></p>",
|
|
295
|
+
"locals" : {
|
|
296
|
+
"var" : "hello"
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
"a tag with a CSS class and 'class' as a variable attribute" : {
|
|
301
|
+
"haml" : ".hello(class=var)",
|
|
302
|
+
"html" : "<div class='hello world'></div>",
|
|
303
|
+
"locals" : {
|
|
304
|
+
"var" : "world"
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
"a tag multiple CSS classes (sorted correctly)" : {
|
|
309
|
+
"haml" : ".z(class=var)",
|
|
310
|
+
"html" : "<div class='a z'></div>",
|
|
311
|
+
"locals" : {
|
|
312
|
+
"var" : "a"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
},
|
|
317
|
+
|
|
318
|
+
"tags with Ruby-style attributes": {
|
|
319
|
+
|
|
320
|
+
"one attribute" : {
|
|
321
|
+
"haml" : "%p{:a => 'b'}",
|
|
322
|
+
"html" : "<p a='b'></p>"
|
|
323
|
+
},
|
|
324
|
+
|
|
325
|
+
"attributes hash with whitespace" : {
|
|
326
|
+
"haml" : "%p{ :a => 'b' }",
|
|
327
|
+
"html" : "<p a='b'></p>"
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
"an interpolated attribute" : {
|
|
331
|
+
"haml" : "%p{:a =>\"#{var}\"}",
|
|
332
|
+
"html" : "<p a='value'></p>",
|
|
333
|
+
"locals" : {
|
|
334
|
+
"var" : "value"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
"multiple attributes" : {
|
|
339
|
+
"haml" : "%p{ :a => 'b', 'c' => 'd' }",
|
|
340
|
+
"html" : "<p a='b' c='d'></p>"
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
"attributes separated with newlines" : {
|
|
344
|
+
"haml" : "%p{ :a => 'b',\n 'c' => 'd' }",
|
|
345
|
+
"html" : "<p a='b' c='d'></p>"
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
"'class' as an attribute" : {
|
|
349
|
+
"haml" : "%p{:class => 'class1'}",
|
|
350
|
+
"html" : "<p class='class1'></p>"
|
|
351
|
+
},
|
|
352
|
+
|
|
353
|
+
"a tag with a CSS class and 'class' as an attribute" : {
|
|
354
|
+
"haml" : "%p.class2{:class => 'class1'}",
|
|
355
|
+
"html" : "<p class='class1 class2'></p>"
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
"a tag with 'id' as an attribute" : {
|
|
359
|
+
"haml" : "%p{:id => '1'}",
|
|
360
|
+
"html" : "<p id='1'></p>"
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
"a tag with a CSS id and 'id' as an attribute" : {
|
|
364
|
+
"haml" : "%p#id{:id => '1'}",
|
|
365
|
+
"html" : "<p id='id_1'></p>"
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
"a tag with a CSS id and a numeric 'id' as an attribute" : {
|
|
369
|
+
"haml" : "%p#id{:id => 1}",
|
|
370
|
+
"html" : "<p id='id_1'></p>"
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
"a tag with a variable attribute" : {
|
|
374
|
+
"haml" : "%p{:class => var}",
|
|
375
|
+
"html" : "<p class='hello'></p>",
|
|
376
|
+
"locals" : {
|
|
377
|
+
"var" : "hello"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
"a tag with a CSS class and 'class' as a variable attribute" : {
|
|
382
|
+
"haml" : ".hello{:class => var}",
|
|
383
|
+
"html" : "<div class='hello world'></div>",
|
|
384
|
+
"locals" : {
|
|
385
|
+
"var" : "world"
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
"a tag multiple CSS classes (sorted correctly)" : {
|
|
390
|
+
"haml" : ".z{:class => var}",
|
|
391
|
+
"html" : "<div class='a z'></div>",
|
|
392
|
+
"locals" : {
|
|
393
|
+
"var" : "a"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
"silent comments" : {
|
|
400
|
+
|
|
401
|
+
"an inline comment" : {
|
|
402
|
+
"haml" : "-# hello",
|
|
403
|
+
"html" : ""
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
"a nested comment" : {
|
|
407
|
+
"haml" : "-#\n hello",
|
|
408
|
+
"html" : ""
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
"markup comments" : {
|
|
414
|
+
|
|
415
|
+
"an inline comment" : {
|
|
416
|
+
"haml" : "/ comment",
|
|
417
|
+
"html" : "<!-- comment -->"
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
"a nested comment" : {
|
|
421
|
+
"haml" : "/\n comment\n comment2",
|
|
422
|
+
"html" : "<!--\n comment\n comment2\n-->"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
"conditional comments": {
|
|
427
|
+
"a conditional comment" : {
|
|
428
|
+
"haml" : "/[if IE]\n %p a",
|
|
429
|
+
"html" : "<!--[if IE]>\n <p>a</p>\n<![endif]-->"
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
"internal filters": {
|
|
434
|
+
|
|
435
|
+
"content in an 'escaped' filter" : {
|
|
436
|
+
"haml" : ":escaped\n <&\">",
|
|
437
|
+
"html" : "<&">"
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
"content in a 'preserve' filter" : {
|
|
441
|
+
"haml" : ":preserve\n hello\n\n%p",
|
|
442
|
+
"html" : "hello
\n<p></p>"
|
|
443
|
+
},
|
|
444
|
+
|
|
445
|
+
"content in a 'plain' filter" : {
|
|
446
|
+
"haml" : ":plain\n hello\n\n%p",
|
|
447
|
+
"html" : "hello\n<p></p>"
|
|
448
|
+
},
|
|
449
|
+
|
|
450
|
+
"content in a 'javascript' filter" : {
|
|
451
|
+
"haml" : ":javascript\n a();\n%p",
|
|
452
|
+
"html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>"
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
"interpolation": {
|
|
458
|
+
|
|
459
|
+
"interpolation inside inline content" : {
|
|
460
|
+
"haml" : "%p #{var}",
|
|
461
|
+
"html" : "<p>value</p>",
|
|
462
|
+
"locals" : {
|
|
463
|
+
"var" : "value"
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
|
|
467
|
+
"no interpolation when escaped" : {
|
|
468
|
+
"haml" : "%p \\#{var}",
|
|
469
|
+
"html" : "<p>#{var}</p>"
|
|
470
|
+
},
|
|
471
|
+
|
|
472
|
+
"interpolation when the escape character is escaped" : {
|
|
473
|
+
"haml" : "%p \\\\#{var}",
|
|
474
|
+
"html" : "<p>\\value</p>",
|
|
475
|
+
"locals" : {
|
|
476
|
+
"var" : "value"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
"interpolation inside filtered content" : {
|
|
481
|
+
"haml" : ":plain\n #{var} interpolated: #{var}",
|
|
482
|
+
"html" : "value interpolated: value",
|
|
483
|
+
"locals" : {
|
|
484
|
+
"var" : "value"
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
"HTML escaping" : {
|
|
491
|
+
|
|
492
|
+
"code following '&='" : {
|
|
493
|
+
"haml" : "&= '<\"&>'",
|
|
494
|
+
"html" : "<"&>"
|
|
495
|
+
},
|
|
496
|
+
|
|
497
|
+
"code following '=' when escape_haml is set to true" : {
|
|
498
|
+
"haml" : "= '<\"&>'",
|
|
499
|
+
"html" : "<"&>",
|
|
500
|
+
"config" : {
|
|
501
|
+
"escape_html" : "true"
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
|
|
505
|
+
"code following '!=' when escape_haml is set to true" : {
|
|
506
|
+
"haml" : "!= '<\"&>'",
|
|
507
|
+
"html" : "<\"&>",
|
|
508
|
+
"config" : {
|
|
509
|
+
"escape_html" : "true"
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
"Boolean attributes" : {
|
|
516
|
+
|
|
517
|
+
"boolean attribute with XHTML" : {
|
|
518
|
+
"haml" : "%input(checked=true)",
|
|
519
|
+
"html" : "<input checked='checked' />",
|
|
520
|
+
"config" : {
|
|
521
|
+
"format" : "xhtml"
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
"boolean attribute with HTML" : {
|
|
526
|
+
"haml" : "%input(checked=true)",
|
|
527
|
+
"html" : "<input checked>",
|
|
528
|
+
"config" : {
|
|
529
|
+
"format" : "html5"
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
}
|