slim 0.7.2 → 0.7.3

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.
@@ -9,7 +9,7 @@ html
9
9
  alert('Hello World');
10
10
  });
11
11
 
12
- haml:
12
+ haml:
13
13
  #someid.someclass{:this => 'test'} Content in haml
14
14
 
15
15
  erb:
@@ -22,7 +22,7 @@ html
22
22
  h1 = @page_title
23
23
  p#notice.message
24
24
  | Welcome to the the syntax test.
25
- This file is to excercise the various markup.
25
+ This file is to exercise the various markup.
26
26
  This is another line
27
27
  - unless @users.empty?
28
28
  table
@@ -312,13 +312,13 @@ module Slim
312
312
  # Closed tag
313
313
  tag[4] = true
314
314
  [tag, block, nil, nil]
315
- elsif !line.empty?
315
+ elsif line =~ /^\s*$/
316
+ # Empty line
317
+ [tag, content, nil, nil]
318
+ else
316
319
  # Handle text content
317
320
  content << [:slim, :text, line.sub(/^( )/, '')]
318
321
  [tag, content, nil, orig_line.size - line.size + ($1 ? 1 : 0)]
319
- else
320
- # Empty line
321
- [tag, content, nil, nil]
322
322
  end
323
323
  end
324
324
 
@@ -1,3 +1,3 @@
1
1
  module Slim
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -26,6 +26,7 @@ markdown:
26
26
  end
27
27
 
28
28
  def test_render_with_javascript
29
+ # Keep the trailing space behind "javascript: "!
29
30
  source = %q{
30
31
  javascript:
31
32
  $(function() {});
@@ -2,11 +2,12 @@ require 'helper'
2
2
 
3
3
  class TestSlimHtmlStructure < TestSlim
4
4
  def test_simple_render
5
+ # Keep the trailing space behind "body "!
5
6
  source = %q{
6
7
  html
7
8
  head
8
9
  title Simple Test Title
9
- body
10
+ body
10
11
  p Hello World, meet Slim.
11
12
  }
12
13
 
@@ -0,0 +1,78 @@
1
+ require 'helper'
2
+
3
+ require 'rubygems'
4
+ require 'rails'
5
+ require 'action_controller'
6
+ require 'action_view'
7
+ require 'slim/rails'
8
+
9
+ class TestSlimRails < TestSlim
10
+ def render(source, &block)
11
+ view = ActionView::Base.new
12
+ view.controller = ActionController::Base.new
13
+ if defined?(ActionController::Response)
14
+ # This is needed for >=3.0.0
15
+ view.controller.response = ActionController::Response.new
16
+ end
17
+ view.render :inline => source, :type => :slim
18
+ end
19
+
20
+ def assert_html(expected, source, &block)
21
+ assert_equal expected, render(source, &block)
22
+ end
23
+
24
+ def test_rails_template
25
+ source = %q{
26
+ html
27
+ head
28
+ title Simple Test Title
29
+ body
30
+ p Hello World, meet Slim.
31
+ }
32
+
33
+ assert_html '<html><head><title>Simple Test Title</title></head><body><p>Hello World, meet Slim.</p></body></html>', source
34
+ end
35
+
36
+ def test_content_for_without_output
37
+ source = %q{
38
+ = content_for :content do
39
+ - if false
40
+ .content_one
41
+ - else
42
+ .content_two
43
+ }
44
+
45
+ assert_html '', source
46
+ end
47
+
48
+ def test_content_for_with_output
49
+ source = %q{
50
+ = content_for :content do
51
+ - if false
52
+ .content_one
53
+ - else
54
+ .content_two
55
+ p This is the captured content
56
+ == content_for :content
57
+ }
58
+
59
+ assert_html '<p>This is the captured content</p><div class="content_two"></div>', source
60
+ end
61
+
62
+ def test_content_for_with_output2
63
+ source = %q{
64
+ - if true
65
+ = content_for :content do
66
+ p a1
67
+ p a2
68
+ - else
69
+ = content_for :content do
70
+ p b1
71
+ p b2
72
+ p This is the captured content
73
+ == content_for :content
74
+ }
75
+
76
+ assert_html '<p>This is the captured content</p><p>a1</p><p>a2</p>', source
77
+ end
78
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 2
9
- version: 0.7.2
8
+ - 3
9
+ version: 0.7.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrew Stone
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-09 00:00:00 -05:00
19
+ date: 2010-11-16 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -204,6 +204,7 @@ files:
204
204
  - test/slim/test_html_escaping.rb
205
205
  - test/slim/test_html_structure.rb
206
206
  - test/slim/test_parser_errors.rb
207
+ - test/slim/test_rails.rb
207
208
  - test/slim/test_ruby_errors.rb
208
209
  - test/slim/test_sections.rb
209
210
  - test/slim/test_slim_template.rb