Skip to content

Commit 9a97f62

Browse files
committed
Restore earlier behavior of -- to stop comments. Bug #7
1 parent dda5105 commit 9a97f62

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

History.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
test can be created. RubyForge bug #28821 by Usaku Nakamura.
1919
* Fixed line-height of headings in method and alias descriptions. RubyForge
2020
Bug #2770 by Adam Avilla
21+
* Relaxed RDoc::Parser::Ruby#remove_private_comments to consume more dashes
22+
as older versions once did. Bug #7 by Claus Folke Brobak.
2123

2224
=== 3.4 / 2010-01-06
2325

lib/rdoc/parser/ruby.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,8 +1647,8 @@ def remove_private_comments(comment)
16471647
empty = ''
16481648
empty.force_encoding comment.encoding if Object.const_defined? :Encoding
16491649

1650-
comment.gsub!(/^#--\n.*?^#\+\+\n?/m, empty)
1651-
comment.sub!(/^#--\n.*\n?/m, empty)
1650+
comment.gsub!(/^#--.*?^#\+\+\n?/m, empty)
1651+
comment.sub!(/^#--.*/m, '')
16521652
end
16531653

16541654
##

test/test_rdoc_parser_ruby.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,25 @@ def test_remove_private_comments_encoding
203203
assert_equal Encoding::IBM437, comment.encoding
204204
end
205205

206+
def test_remove_private_comments_long
207+
util_parser ''
208+
209+
comment = <<-EOS
210+
#-----
211+
#++
212+
# this is text
213+
#-----
214+
EOS
215+
216+
expected = <<-EOS
217+
# this is text
218+
EOS
219+
220+
@parser.remove_private_comments(comment)
221+
222+
assert_equal expected, comment
223+
end
224+
206225
def test_remove_private_comments_rule
207226
util_parser ''
208227

0 commit comments

Comments
 (0)