haml 3.1.5.rc.1 → 3.1.5

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 CHANGED
@@ -1 +1 @@
1
- ca95c9a9098626a22c0f9fd5b8f7655bee615a97
1
+ 9a5743d5002ab63dc5e22f52a0b07ff0a0493d20
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.5.rc.1
1
+ 3.1.5
@@ -0,0 +1,14 @@
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
+
@@ -0,0 +1,106 @@
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)
@@ -0,0 +1,38 @@
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)
@@ -0,0 +1,81 @@
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
@@ -0,0 +1,23 @@
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
@@ -0,0 +1,612 @@
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" : "&lt;&amp;&quot;&gt;"
469
+ },
470
+
471
+ "content in a 'preserve' filter" : {
472
+ "haml" : ":preserve\n hello\n\n%p",
473
+ "html" : "hello&#x000A;\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" : "&lt;&quot;&amp;&gt;"
537
+ },
538
+
539
+ "code following '=' when escape_haml is set to true" : {
540
+ "haml" : "= '<\"&>'",
541
+ "html" : "&lt;&quot;&amp;&gt;",
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&#x000A;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
+ }
metadata CHANGED
@@ -1,55 +1,68 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: haml
3
- version: !ruby/object:Gem::Version
4
- version: 3.1.5.rc.1
5
- prerelease: 6
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 3
8
+ - 1
9
+ - 5
10
+ version: 3.1.5
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Nathan Weizenbaum
9
14
  - Hampton Catlin
10
15
  - Norman Clarke
11
16
  autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
- date: 2012-05-01 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
19
+
20
+ date: 2012-05-07 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
17
23
  name: yard
18
- requirement: &70331865203400 !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
19
26
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 13
31
+ segments:
32
+ - 0
33
+ - 5
34
+ - 3
23
35
  version: 0.5.3
24
36
  type: :development
25
- prerelease: false
26
- version_requirements: *70331865203400
27
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
28
39
  name: maruku
29
- requirement: &70331865202940 !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
30
42
  none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 25
47
+ segments:
48
+ - 0
49
+ - 5
50
+ - 9
34
51
  version: 0.5.9
35
52
  type: :development
36
- prerelease: false
37
- version_requirements: *70331865202940
38
- description: ! " Haml (HTML Abstraction Markup Language) is a layer on top of
39
- XHTML or XML\n that's designed to express the structure of XHTML or XML documents\n
40
- \ in a non-repetitive, elegant, easy way,\n using indentation rather than
41
- closing tags\n and allowing Ruby to be embedded with ease.\n It was originally
42
- envisioned as a plugin for Ruby on Rails,\n but it can function as a stand-alone
43
- templating engine.\n"
44
- email:
53
+ version_requirements: *id002
54
+ description: " Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML\n that's designed to express the structure of XHTML or XML documents\n in a non-repetitive, elegant, easy way,\n using indentation rather than closing tags\n and allowing Ruby to be embedded with ease.\n It was originally envisioned as a plugin for Ruby on Rails,\n but it can function as a stand-alone templating engine.\n"
55
+ email:
45
56
  - haml@googlegroups.com
46
57
  - norman@njclarke.com
47
- executables:
58
+ executables:
48
59
  - haml
49
60
  - html2haml
50
61
  extensions: []
62
+
51
63
  extra_rdoc_files: []
52
- files:
64
+
65
+ files:
53
66
  - rails/init.rb
54
67
  - lib/haml/buffer.rb
55
68
  - lib/haml/compiler.rb
@@ -164,6 +177,12 @@ files:
164
177
  - test/haml/templates/very_basic.haml
165
178
  - test/haml/templates/whitespace_handling.haml
166
179
  - test/haml/util_test.rb
180
+ - test/haml-spec/LICENSE
181
+ - test/haml-spec/lua_haml_spec.lua
182
+ - test/haml-spec/perl_haml_test.pl
183
+ - test/haml-spec/README.md
184
+ - test/haml-spec/ruby_haml_test.rb
185
+ - test/haml-spec/tests.json
167
186
  - test/linked_rails.rb
168
187
  - test/test_helper.rb
169
188
  - extra/update_watch.rb
@@ -436,29 +455,38 @@ files:
436
455
  - VERSION_NAME
437
456
  homepage: http://haml.info/
438
457
  licenses: []
458
+
439
459
  post_install_message:
440
460
  rdoc_options: []
441
- require_paths:
461
+
462
+ require_paths:
442
463
  - lib
443
- required_ruby_version: !ruby/object:Gem::Requirement
464
+ required_ruby_version: !ruby/object:Gem::Requirement
444
465
  none: false
445
- requirements:
446
- - - ! '>='
447
- - !ruby/object:Gem::Version
448
- version: '0'
449
- required_rubygems_version: !ruby/object:Gem::Requirement
466
+ requirements:
467
+ - - ">="
468
+ - !ruby/object:Gem::Version
469
+ hash: 3
470
+ segments:
471
+ - 0
472
+ version: "0"
473
+ required_rubygems_version: !ruby/object:Gem::Requirement
450
474
  none: false
451
- requirements:
452
- - - ! '>'
453
- - !ruby/object:Gem::Version
454
- version: 1.3.1
475
+ requirements:
476
+ - - ">="
477
+ - !ruby/object:Gem::Version
478
+ hash: 3
479
+ segments:
480
+ - 0
481
+ version: "0"
455
482
  requirements: []
483
+
456
484
  rubyforge_project: haml
457
- rubygems_version: 1.8.11
485
+ rubygems_version: 1.8.24
458
486
  signing_key:
459
487
  specification_version: 3
460
488
  summary: An elegant, structured XHTML/XML templating engine.
461
- test_files:
489
+ test_files:
462
490
  - test/haml/engine_test.rb
463
491
  - test/haml/helper_test.rb
464
492
  - test/haml/html2haml_test.rb
@@ -466,3 +494,4 @@ test_files:
466
494
  - test/haml/spec_test.rb
467
495
  - test/haml/template_test.rb
468
496
  - test/haml/util_test.rb
497
+ - test/haml-spec/ruby_haml_test.rb