reverse_markdown 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,7 @@ module ReverseMarkdown
11
11
  when Nokogiri::XML::Document then input.root
12
12
  when Nokogiri::XML::Node then input
13
13
  end
14
+
14
15
  ReverseMarkdown::Mapper.new(opts).process_root(root)
15
16
  end
16
17
 
@@ -13,6 +13,8 @@ module ReverseMarkdown
13
13
  end
14
14
 
15
15
  def process_root(element)
16
+ return '' if element.nil?
17
+
16
18
  markdown = process_element(element) # recursively process all elements to get full markdown
17
19
 
18
20
  # Extract github style code blocks
@@ -1,3 +1,3 @@
1
1
  module ReverseMarkdown
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/spec/mapper_spec.rb CHANGED
@@ -5,6 +5,10 @@ describe ReverseMarkdown::Mapper do
5
5
  let(:document) { Nokogiri::HTML(input) }
6
6
  let(:mapper) { ReverseMarkdown::Mapper.new }
7
7
 
8
+ it "behaves in a sane way when root element is nil" do
9
+ mapper.process_root(nil).should == ''
10
+ end
11
+
8
12
  context "error handling" do
9
13
 
10
14
  let(:unknown_element) { Nokogiri::XML::Node.new('foo', document) }
@@ -36,4 +40,4 @@ describe ReverseMarkdown::Mapper do
36
40
  end
37
41
  end
38
42
  end
39
- end
43
+ end
@@ -15,5 +15,4 @@ describe ReverseMarkdown do
15
15
  it "parses string input" do
16
16
  lambda { ReverseMarkdown.parse_string(input) }.should_not raise_error
17
17
  end
18
-
19
- end
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reverse_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-02 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  segments:
150
150
  - 0
151
- hash: 2880516726110025982
151
+ hash: -3864032046770196939
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  segments:
159
159
  - 0
160
- hash: 2880516726110025982
160
+ hash: -3864032046770196939
161
161
  requirements: []
162
162
  rubyforge_project: reverse_markdown
163
163
  rubygems_version: 1.8.24