ruhl 0.9.5 → 0.9.6

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5
1
+ 0.9.6
@@ -42,14 +42,14 @@ module Ruhl
42
42
  private
43
43
 
44
44
  def render_with_layout
45
- render_file( @layout_source || File.read(@layout) )
45
+ render_nodes Nokogiri::HTML( @layout_source || File.read(@layout) )
46
46
  end
47
47
 
48
48
  def render_partial(tag, code)
49
49
  file = execute_ruby(tag, code)
50
50
  raise PartialNotFoundError.new(file) unless File.exists?(file)
51
51
 
52
- render_file( File.read(file) )
52
+ render_nodes Nokogiri::HTML.fragment( File.read(file) )
53
53
  end
54
54
 
55
55
  def render_collection(tag, code, actions = nil)
@@ -79,10 +79,9 @@ module Ruhl
79
79
  Ruhl::Engine.new(tag.inner_html, :block_object => bo).render(scope)
80
80
  end
81
81
 
82
- def render_file(contents)
83
- doc = Nokogiri::HTML( contents )
84
- parse_doc(doc)
85
- doc.to_s
82
+ def render_nodes(nodes)
83
+ parse_doc(nodes)
84
+ nodes.to_s
86
85
  end
87
86
 
88
87
  def parse_doc(doc)
@@ -34,7 +34,7 @@ module Ruhl
34
34
 
35
35
  raise PartialNotFoundError.new(file) unless template
36
36
 
37
- render_file( template.source )
37
+ render_nodes Nokogiri::HTML.fragment( template.source )
38
38
  end
39
39
 
40
40
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruhl}
8
- s.version = "0.9.5"
8
+ s.version = "0.9.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Stone"]
@@ -1,7 +1,9 @@
1
- <h3>Real Sidebarlinks</h3>
2
- <ul>
3
- <li><a href="#">Real Link 1</a></li>
4
- <li><a href="#">Real Link 2</a></li>
5
- <li><a href="#">Real Link 3</a></li>
6
- <li><a href="#">Real Link 4</a></li>
7
- </ul>
1
+ <div>
2
+ <h3>Real Sidebarlinks</h3>
3
+ <ul>
4
+ <li><a href="#">Real Link 1</a></li>
5
+ <li><a href="#">Real Link 2</a></li>
6
+ <li><a href="#">Real Link 3</a></li>
7
+ <li><a href="#">Real Link 4</a></li>
8
+ </ul>
9
+ </div>
@@ -74,16 +74,11 @@ describe Ruhl do
74
74
 
75
75
  it "should replace sidebar with partial contents" do
76
76
  doc = create_doc
77
- html = %{<div id="sidebar">
78
- <h3>Real Sidebarlinks</h3>
79
- <ul>
80
- <li><a href="#">Real Link 1</a></li>
81
- <li><a href="#">Real Link 2</a></li>
82
- <li><a href="#">Real Link 3</a></li>
83
- <li><a href="#">Real Link 4</a></li>
84
- </ul>
85
- </div>}
86
- doc.xpath('//div[@id="sidebar"]').to_s.should == html
77
+ doc.xpath('/html/body/div/div/div//h3')[0].inner_html.
78
+ should == "Real Sidebarlinks"
79
+
80
+ doc.xpath('/html/body/div/div/div/ul/li//a')[0].inner_html.
81
+ should == "Real Link 1"
87
82
  end
88
83
  end
89
84
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruhl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Stone