murdoc 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -84,11 +84,13 @@ module Murdoc
84
84
 
85
85
  # post-processing: stripping comments and removing empty strings from beginnings and ends
86
86
  starting_line += postprocess_source(source_lines)
87
- postprocess_comments(comment_lines)
87
+ postprocess_comments(comment_lines)
88
+ # clear comment lines if that's commented out code
89
+ comment_lines.clear if comment_lines[0] =~ /^:code:$/
88
90
 
89
- # writing a new paragraph unless we have a case of commented out code
90
- unless comment_lines[0] =~ /^:code:$/
91
- @paragraphs << Paragraph.new(source_lines.join("\n"), comment_lines.join("\n"), starting_line, source_type, options)
91
+ # if we have comments or source
92
+ if comment_lines.size > 0 || source_lines.size > 0
93
+ @paragraphs << Paragraph.new(source_lines.join("\n"), comment_lines.join("\n"), starting_line, source_type, options)
92
94
  end
93
95
  end
94
96
  end
data/markup/template.haml CHANGED
@@ -12,4 +12,4 @@
12
12
  %ol
13
13
  - 1.upto(p.source.split("\n").size) do |i|
14
14
  %li= i + p.starting_line
15
- %code<= p.formatted_source
15
+ %code<~ p.formatted_source
data/murdoc.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{murdoc}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Abramov"]
@@ -83,7 +83,6 @@ describe Murdoc::Annotator do
83
83
  source = "=begin\n"
84
84
  lambda {
85
85
  subject = described_class.new(source, :ruby)
86
- subject.source = source
87
86
  }.should_not raise_error
88
87
  end
89
88
  end
@@ -104,6 +103,14 @@ describe Murdoc::Annotator do
104
103
  subject.paragraphs[0].source.should == "def hi\nend"
105
104
  subject.paragraphs[0].annotation.should == "Comment"
106
105
  end
106
+
107
+ it "should not swallow wrong code" do
108
+ source = "# :code:\n# def hi\n# end\n\ndef hallo\nend"
109
+ subject = described_class.new(source, :ruby)
110
+ subject.should have_exactly(1).paragraphs
111
+ subject.paragraphs[0].annotation.to_s.should == ""
112
+ subject.paragraphs[0].source.should == "def hallo\nend"
113
+ end
107
114
  end
108
115
 
109
116
  it "should not choke on edge cases" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 7
9
- version: 0.1.7
8
+ - 8
9
+ version: 0.1.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Abramov
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- hash: -231788783804928032
154
+ hash: 1151868179894521634
155
155
  segments:
156
156
  - 0
157
157
  version: "0"