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 +1 -1
- data/lib/murdoc/annotator.rb +6 -4
- data/markup/template.haml +1 -1
- data/murdoc.gemspec +1 -1
- data/spec/murdoc/annotator_spec.rb +8 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/lib/murdoc/annotator.rb
CHANGED
@@ -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
|
-
#
|
90
|
-
|
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
data/murdoc.gemspec
CHANGED
@@ -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
|
-
-
|
9
|
-
version: 0.1.
|
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:
|
154
|
+
hash: 1151868179894521634
|
155
155
|
segments:
|
156
156
|
- 0
|
157
157
|
version: "0"
|