Skip to content

Commit 071e2ec

Browse files
authored
Merge pull request #582 from aycabta/fix-method-name-characters
Fix method name characters
2 parents db7df86 + af7aa4c commit 071e2ec

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

lib/rdoc/text.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def strip_stars text
169169

170170
encoding = text.encoding
171171

172-
text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, ''
172+
text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+-/*\%@`\[\]]+%, ''
173173

174174
space = ' '
175175
space = RDoc::Encoding.change_encoding space, encoding if encoding

test/test_rdoc_text.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,32 @@ def test_strip_stars_document_method
378378
assert_equal expected, strip_stars(text)
379379
end
380380

381+
def test_strip_stars_document_method_special
382+
text = <<-TEXT
383+
/*
384+
* Document-method: Zlib::GzipFile#mtime=
385+
* Document-method: []
386+
* Document-method: `
387+
* Document-method: |
388+
* Document-method: &
389+
* Document-method: <=>
390+
* Document-method: =~
391+
* Document-method: +
392+
* Document-method: -
393+
* Document-method: +@
394+
*
395+
* A comment
396+
*/
397+
TEXT
398+
399+
expected = <<-EXPECTED
400+
401+
A comment
402+
EXPECTED
403+
404+
assert_equal expected, strip_stars(text)
405+
end
406+
381407
def test_strip_stars_encoding
382408
text = <<-TEXT
383409
/*

0 commit comments

Comments
 (0)