haml 3.2.0.alpha.14 → 3.2.0.beta.1

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.

@@ -2,5 +2,4 @@ source :rubygems
2
2
 
3
3
  gem 'rails', '>= 3.0.0', '< 3.1.0'
4
4
  gemspec :path => "../.."
5
- gem "haml-contrib", :path => "../../vendor/haml-contrib"
6
5
 
@@ -2,6 +2,5 @@ source :rubygems
2
2
 
3
3
  gem 'rails', '>= 3.1.0', '< 3.2.0'
4
4
  gemspec :path => "../.."
5
- gem "haml-contrib", :path => "../../vendor/haml-contrib"
6
5
 
7
6
 
@@ -2,5 +2,4 @@ source :rubygems
2
2
 
3
3
  gem 'rails', '>= 3.2.0', '< 3.3.0'
4
4
  gemspec :path => "../.."
5
- gem "haml-contrib", :path => "../../vendor/haml-contrib"
6
5
 
@@ -3,37 +3,58 @@
3
3
 
4
4
  "an XHTML XML prolog" : {
5
5
  "haml" : "!!! XML",
6
- "html" : "<?xml version='1.0' encoding='utf-8' ?>"
6
+ "html" : "<?xml version='1.0' encoding='utf-8' ?>",
7
+ "config" : {
8
+ "format" : "xhtml"
9
+ }
7
10
  },
8
11
 
9
12
  "an XHTML default (transitional) doctype" : {
10
13
  "haml" : "!!!",
11
- "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
14
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
15
+ "config" : {
16
+ "format" : "xhtml"
17
+ }
12
18
  },
13
19
 
14
20
  "an XHTML 1.1 doctype" : {
15
21
  "haml" : "!!! 1.1",
16
- "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">"
22
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">",
23
+ "config" : {
24
+ "format" : "xhtml"
25
+ }
17
26
  },
18
27
 
19
28
  "an XHTML 1.2 mobile doctype" : {
20
29
  "haml" : "!!! mobile",
21
- "html" : "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">"
30
+ "html" : "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">",
31
+ "config" : {
32
+ "format" : "xhtml"
33
+ }
22
34
  },
23
35
 
24
36
  "an XHTML 1.1 basic doctype" : {
25
37
  "haml" : "!!! basic",
26
- "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">"
38
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">",
39
+ "config" : {
40
+ "format" : "xhtml"
41
+ }
27
42
  },
28
43
 
29
44
  "an XHTML 1.0 frameset doctype" : {
30
45
  "haml" : "!!! frameset",
31
- "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
46
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">",
47
+ "config" : {
48
+ "format" : "xhtml"
49
+ }
32
50
  },
33
51
 
34
52
  "an HTML 5 doctype with XHTML syntax" : {
35
53
  "haml" : "!!! 5",
36
- "html" : "<!DOCTYPE html>"
54
+ "html" : "<!DOCTYPE html>",
55
+ "config" : {
56
+ "format" : "xhtml"
57
+ }
37
58
  },
38
59
 
39
60
  "an HTML 5 XML prolog (silent)" : {
@@ -95,7 +116,10 @@
95
116
 
96
117
  "a self-closing tag (XHTML)" : {
97
118
  "haml" : "%meta",
98
- "html" : "<meta />"
119
+ "html" : "<meta />",
120
+ "config" : {
121
+ "format" : "xhtml"
122
+ }
99
123
  },
100
124
 
101
125
  "a self-closing tag (HTML4)" : {
@@ -116,7 +140,10 @@
116
140
 
117
141
  "a self-closing tag ('/' modifier + XHTML)" : {
118
142
  "haml" : "%zzz/",
119
- "html" : "<zzz />"
143
+ "html" : "<zzz />",
144
+ "config" : {
145
+ "format" : "xhtml"
146
+ }
120
147
  },
121
148
 
122
149
  "a self-closing tag ('/' modifier + HTML5)" : {
@@ -478,16 +505,37 @@
478
505
  "html" : "hello\n<p></p>"
479
506
  },
480
507
 
481
- "content in a 'css' filter" : {
508
+ "content in a 'css' filter (XHTML)" : {
482
509
  "haml" : ":css\n hello\n\n%p",
483
- "html" : "<style type='text/css'>\n /*<![CDATA[*/\n hello\n /*]]>*/\n</style>\n<p></p>"
510
+ "html" : "<style type='text/css'>\n /*<![CDATA[*/\n hello\n /*]]>*/\n</style>\n<p></p>",
511
+ "config" : {
512
+ "format" : "xhtml"
513
+ }
484
514
  },
485
515
 
486
- "content in a 'javascript' filter" : {
516
+ "content in a 'javascript' filter (XHTML)" : {
487
517
  "haml" : ":javascript\n a();\n%p",
488
- "html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>"
489
- }
518
+ "html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>",
519
+ "config" : {
520
+ "format" : "xhtml"
521
+ }
522
+ },
490
523
 
524
+ "content in a 'css' filter (HTML)" : {
525
+ "haml" : ":css\n hello\n\n%p",
526
+ "html" : "<style>\n hello\n</style>\n<p></p>",
527
+ "config" : {
528
+ "format" : "html5"
529
+ }
530
+ },
531
+
532
+ "content in a 'javascript' filter (HTML)" : {
533
+ "haml" : ":javascript\n a();\n%p",
534
+ "html" : "<script>\n a();\n</script>\n<p></p>",
535
+ "config" : {
536
+ "format" : "html5"
537
+ }
538
+ }
491
539
  },
492
540
 
493
541
  "Ruby-style interpolation": {
@@ -275,7 +275,7 @@ HAML
275
275
  end
276
276
 
277
277
  def test_haml_tag_with_data_hash
278
- assert_equal("<p data-baz='data-baz' data-foo='bar'>foo</p>\n",
278
+ assert_equal("<p data-baz data-foo='bar'>foo</p>\n",
279
279
  render("- haml_tag :p, 'foo', :data => {:foo => 'bar', :baz => true}"))
280
280
  end
281
281
 
@@ -0,0 +1,59 @@
1
+ require 'test_helper'
2
+
3
+ module Haml
4
+ class ParserTest < MiniTest::Unit::TestCase
5
+
6
+ test "should raise error for 'else' at wrong indent level" do
7
+ begin
8
+ parse("- if true\n #first\n text\n - else\n #second")
9
+ flunk("Should have raised a Haml::SyntaxError")
10
+ rescue SyntaxError => e
11
+ assert_equal Error.message(:bad_script_indent, 'else', 0, 1), e.message
12
+ end
13
+ end
14
+
15
+ test "should raise error for 'elsif' at wrong indent level" do
16
+ begin
17
+ parse("- if true\n #first\n text\n - elsif false\n #second")
18
+ flunk("Should have raised a Haml::SyntaxError")
19
+ rescue SyntaxError => e
20
+ assert_equal Error.message(:bad_script_indent, 'elsif', 0, 1), e.message
21
+ end
22
+ end
23
+
24
+ test "should raise error for 'else' at wrong indent level after unless" do
25
+ begin
26
+ parse("- unless true\n #first\n text\n - else\n #second")
27
+ flunk("Should have raised a Haml::SyntaxError")
28
+ rescue SyntaxError => e
29
+ assert_equal Error.message(:bad_script_indent, 'else', 0, 1), e.message
30
+ end
31
+ end
32
+
33
+ test "should raise syntax error for else with no if" do
34
+ begin
35
+ parse("- else\n 'foo'")
36
+ flunk("Should have raised a Haml::SyntaxError")
37
+ rescue SyntaxError => e
38
+ assert_equal Error.message(:missing_if, 'else'), e.message
39
+ end
40
+ end
41
+
42
+ test "should raise syntax error for nested else with no" do
43
+ begin
44
+ parse("#foo\n - else\n 'foo'")
45
+ flunk("Should have raised a Haml::SyntaxError")
46
+ rescue SyntaxError => e
47
+ assert_equal Error.message(:missing_if, 'else'), e.message
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def parse(haml, options = nil)
54
+ options ||= Options.new
55
+ parser = Parser.new(haml, options)
56
+ parser.parse
57
+ end
58
+ end
59
+ end
@@ -70,6 +70,7 @@ class TemplateTest < MiniTest::Unit::TestCase
70
70
 
71
71
  def render(text, opts = {})
72
72
  return @base.render(:inline => text, :type => :haml) if opts == :action_view
73
+ opts = opts.merge(:format => :xhtml)
73
74
  Haml::Engine.new(text, opts).to_html(@base)
74
75
  end
75
76
 
@@ -117,14 +118,14 @@ class TemplateTest < MiniTest::Unit::TestCase
117
118
 
118
119
  def test_templates_should_render_correctly_with_render_proc
119
120
  assert_renders_correctly("standard") do |name|
120
- engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
121
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"), :format => :xhtml)
121
122
  engine.render_proc(@base).call
122
123
  end
123
124
  end
124
125
 
125
126
  def test_templates_should_render_correctly_with_def_method
126
127
  assert_renders_correctly("standard") do |name|
127
- engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
128
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"), :format => :xhtml)
128
129
  engine.def_method(@base, "render_standard")
129
130
  @base.render_standard
130
131
  end
@@ -20,6 +20,9 @@ Rails.application = TestApp
20
20
  ActionController::Base.logger = Logger.new(nil)
21
21
 
22
22
  require 'fileutils'
23
+
24
+ $VERBOSE = true
25
+
23
26
  require 'haml'
24
27
  require 'haml/template'
25
28
 
@@ -72,6 +75,8 @@ class MiniTest::Unit::TestCase
72
75
  flunk "Expected exception #{klass}, none raised"
73
76
  end
74
77
 
75
- end
78
+ def self.error(*args)
79
+ Haml::Error.message(*args)
80
+ end
76
81
 
77
- $VERBOSE = true
82
+ end
metadata CHANGED
@@ -1,147 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: haml
3
- version: !ruby/object:Gem::Version
4
- hash: 906808591
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.2.0.beta.1
5
5
  prerelease: 6
6
- segments:
7
- - 3
8
- - 2
9
- - 0
10
- - alpha
11
- - 14
12
- version: 3.2.0.alpha.14
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Nathan Weizenbaum
16
9
  - Hampton Catlin
17
10
  - Norman Clarke
18
11
  autorequire:
19
12
  bindir: bin
20
13
  cert_chain: []
21
-
22
- date: 2012-06-14 00:00:00 Z
23
- dependencies:
24
- - !ruby/object:Gem::Dependency
14
+ date: 2012-06-27 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
25
17
  name: tilt
26
- prerelease: false
27
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
28
19
  none: false
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- hash: 3
33
- segments:
34
- - 0
35
- version: "0"
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
36
24
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: yard
40
25
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: !ruby/object:Gem::Requirement
42
27
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 13
47
- segments:
48
- - 0
49
- - 5
50
- - 3
51
- version: 0.5.3
52
- type: :development
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: maruku
56
- prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rails
34
+ requirement: !ruby/object:Gem::Requirement
58
35
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 25
63
- segments:
64
- - 0
65
- - 5
66
- - 9
67
- version: 0.5.9
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: 3.0.0
68
40
  type: :development
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: rails
72
41
  prerelease: false
73
- requirement: &id004 !ruby/object:Gem::Requirement
42
+ version_requirements: !ruby/object:Gem::Requirement
74
43
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 7
79
- segments:
80
- - 3
81
- - 0
82
- - 0
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
83
47
  version: 3.0.0
84
- type: :development
85
- version_requirements: *id004
86
- - !ruby/object:Gem::Dependency
48
+ - !ruby/object:Gem::Dependency
87
49
  name: rbench
88
- prerelease: false
89
- requirement: &id005 !ruby/object:Gem::Requirement
50
+ requirement: !ruby/object:Gem::Requirement
90
51
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
98
56
  type: :development
99
- version_requirements: *id005
100
- - !ruby/object:Gem::Dependency
101
- name: minitest
102
57
  prerelease: false
103
- requirement: &id006 !ruby/object:Gem::Requirement
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: minitest
66
+ requirement: !ruby/object:Gem::Requirement
104
67
  none: false
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- hash: 3
109
- segments:
110
- - 0
111
- version: "0"
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
112
72
  type: :development
113
- version_requirements: *id006
114
- - !ruby/object:Gem::Dependency
115
- name: json
116
73
  prerelease: false
117
- requirement: &id007 !ruby/object:Gem::Requirement
74
+ version_requirements: !ruby/object:Gem::Requirement
118
75
  none: false
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- hash: 3
123
- segments:
124
- - 0
125
- version: "0"
126
- type: :development
127
- version_requirements: *id007
128
- description: |
129
- Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ description: ! 'Haml (HTML Abstraction Markup Language) is a layer on top of HTML
81
+ or XML that''s
82
+
130
83
  designed to express the structure of documents in a non-repetitive, elegant, and
84
+
131
85
  easy way by using indentation rather than closing tags and allowing Ruby to be
86
+
132
87
  embedded with ease. It was originally envisioned as a plugin for Ruby on Rails,
88
+
133
89
  but it can function as a stand-alone templating engine.
134
90
 
135
- email:
91
+ '
92
+ email:
136
93
  - haml@googlegroups.com
137
94
  - norman@njclarke.com
138
- executables:
95
+ executables:
139
96
  - haml
140
97
  extensions: []
141
-
142
98
  extra_rdoc_files: []
143
-
144
- files:
99
+ files:
145
100
  - rails/init.rb
146
101
  - lib/haml/buffer.rb
147
102
  - lib/haml/compiler.rb
@@ -171,11 +126,8 @@ files:
171
126
  - test/erb/standard.erb
172
127
  - test/filters_test.rb
173
128
  - test/gemfiles/Gemfile.rails-3.0.x
174
- - test/gemfiles/Gemfile.rails-3.0.x.lock
175
129
  - test/gemfiles/Gemfile.rails-3.1.x
176
- - test/gemfiles/Gemfile.rails-3.1.x.lock
177
130
  - test/gemfiles/Gemfile.rails-3.2.x
178
- - test/gemfiles/Gemfile.rails-3.2.x.lock
179
131
  - test/haml-spec/LICENSE
180
132
  - test/haml-spec/lua_haml_spec.lua
181
133
  - test/haml-spec/perl_haml_test.pl
@@ -185,6 +137,7 @@ files:
185
137
  - test/helper_test.rb
186
138
  - test/markaby/standard.mab
187
139
  - test/mocks/article.rb
140
+ - test/parser_test.rb
188
141
  - test/results/content_for_layout.xhtml
189
142
  - test/results/eval_suppressed.xhtml
190
143
  - test/results/helpers.xhtml
@@ -245,58 +198,62 @@ files:
245
198
  - REFERENCE.md
246
199
  homepage: http://haml.info/
247
200
  licenses: []
201
+ post_install_message: ! '
248
202
 
249
- post_install_message: |+
250
-
251
203
  HEADS UP! Haml 3.2 has many improvements, but also has changes that may break
204
+
252
205
  your application:
253
-
206
+
207
+
254
208
  * Support for Ruby 1.8.6 dropped
209
+
255
210
  * Support for Rails 2 dropped
211
+
256
212
  * Sass filter now always outputs <script> tags
213
+
257
214
  * Data attributes are now hyphenated, not underscored
215
+
258
216
  * html2haml utility moved to the html2haml gem
217
+
259
218
  * Textile and Maruku filters moved to the haml-contrib gem
260
-
219
+
220
+
261
221
  For more info see:
262
-
222
+
223
+
263
224
  http://rubydoc.info/github/haml/haml/file/CHANGELOG.md
264
-
265
- rdoc_options: []
266
225
 
267
- require_paths:
226
+
227
+ '
228
+ rdoc_options: []
229
+ require_paths:
268
230
  - lib
269
- required_ruby_version: !ruby/object:Gem::Requirement
231
+ required_ruby_version: !ruby/object:Gem::Requirement
270
232
  none: false
271
- requirements:
272
- - - ">="
273
- - !ruby/object:Gem::Version
274
- hash: 3
275
- segments:
233
+ requirements:
234
+ - - ! '>='
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ segments:
276
238
  - 0
277
- version: "0"
278
- required_rubygems_version: !ruby/object:Gem::Requirement
239
+ hash: -1734032859910060370
240
+ required_rubygems_version: !ruby/object:Gem::Requirement
279
241
  none: false
280
- requirements:
281
- - - ">"
282
- - !ruby/object:Gem::Version
283
- hash: 25
284
- segments:
285
- - 1
286
- - 3
287
- - 1
242
+ requirements:
243
+ - - ! '>'
244
+ - !ruby/object:Gem::Version
288
245
  version: 1.3.1
289
246
  requirements: []
290
-
291
247
  rubyforge_project:
292
248
  rubygems_version: 1.8.24
293
249
  signing_key:
294
250
  specification_version: 3
295
251
  summary: An elegant, structured (X)HTML/XML templating engine.
296
- test_files:
252
+ test_files:
297
253
  - test/engine_test.rb
298
254
  - test/filters_test.rb
299
255
  - test/haml-spec/ruby_haml_test.rb
300
256
  - test/helper_test.rb
257
+ - test/parser_test.rb
301
258
  - test/template_test.rb
302
259
  - test/util_test.rb