haml-edge 2.3.167 → 2.3.168

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/VERSION +1 -1
  3. data/lib/haml/helpers/xss_mods.rb +10 -1
  4. data/test/haml/spec/README.md +97 -0
  5. data/test/haml/spec/lua_haml_spec.lua +30 -0
  6. data/test/haml/spec/ruby_haml_test.rb +19 -0
  7. data/test/haml/spec/tests.json +534 -0
  8. data/vendor/fssm/LICENSE +20 -0
  9. data/vendor/fssm/README.markdown +55 -0
  10. data/vendor/fssm/Rakefile +59 -0
  11. data/vendor/fssm/VERSION.yml +5 -0
  12. data/vendor/fssm/example.rb +9 -0
  13. data/vendor/fssm/fssm.gemspec +77 -0
  14. data/vendor/fssm/lib/fssm.rb +33 -0
  15. data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
  16. data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
  17. data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
  18. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
  19. data/vendor/fssm/lib/fssm/monitor.rb +26 -0
  20. data/vendor/fssm/lib/fssm/path.rb +91 -0
  21. data/vendor/fssm/lib/fssm/pathname.rb +502 -0
  22. data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
  23. data/vendor/fssm/lib/fssm/state/file.rb +24 -0
  24. data/vendor/fssm/lib/fssm/support.rb +63 -0
  25. data/vendor/fssm/lib/fssm/tree.rb +176 -0
  26. data/vendor/fssm/profile/prof-cache.rb +40 -0
  27. data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
  28. data/vendor/fssm/profile/prof-pathname.rb +68 -0
  29. data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
  30. data/vendor/fssm/profile/prof.html +2379 -0
  31. data/vendor/fssm/spec/path_spec.rb +75 -0
  32. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  33. data/vendor/fssm/spec/root/file.css +0 -0
  34. data/vendor/fssm/spec/root/file.rb +0 -0
  35. data/vendor/fssm/spec/root/file.yml +0 -0
  36. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  37. data/vendor/fssm/spec/spec_helper.rb +14 -0
  38. metadata +37 -2
@@ -1 +1 @@
1
- 2.3.167
1
+ 2.3.168
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.167
1
+ 2.3.168
@@ -92,6 +92,13 @@ module Haml
92
92
  html_escape(text)
93
93
  end
94
94
  end
95
+
96
+ class ErrorReturn
97
+ # Any attempt to treat ErrorReturn as a string should cause it to blow up.
98
+ alias_method :html_safe, :to_s
99
+ alias_method :html_safe?, :to_s
100
+ alias_method :html_safe!, :to_s
101
+ end
95
102
  end
96
103
  end
97
104
 
@@ -99,7 +106,9 @@ module ActionView
99
106
  module Helpers
100
107
  module FormTagHelper
101
108
  def form_tag_with_haml_xss(*args, &block)
102
- Haml::Util.html_safe(form_tag_without_haml_xss(*args, &block))
109
+ res = form_tag_without_haml_xss(*args, &block)
110
+ res = Haml::Util.html_safe(res) unless block_given?
111
+ res
103
112
  end
104
113
  alias_method :form_tag_without_haml_xss, :form_tag
105
114
  alias_method :form_tag, :form_tag_with_haml_xss
@@ -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" : "&lt;&amp;&quot;&gt;"
438
+ },
439
+
440
+ "content in a 'preserve' filter" : {
441
+ "haml" : ":preserve\n hello\n\n%p",
442
+ "html" : "hello&#x000A;\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" : "&lt;&quot;&amp;&gt;"
495
+ },
496
+
497
+ "code following '=' when escape_haml is set to true" : {
498
+ "haml" : "= '<\"&>'",
499
+ "html" : "&lt;&quot;&amp;&gt;",
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
+ }