Skip to content

Fix method name characters #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rdoc/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def strip_stars text

encoding = text.encoding

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

space = ' '
space = RDoc::Encoding.change_encoding space, encoding if encoding
Expand Down
26 changes: 26 additions & 0 deletions test/test_rdoc_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,32 @@ def test_strip_stars_document_method
assert_equal expected, strip_stars(text)
end

def test_strip_stars_document_method_special
text = <<-TEXT
/*
* Document-method: Zlib::GzipFile#mtime=
* Document-method: []
* Document-method: `
* Document-method: |
* Document-method: &
* Document-method: <=>
* Document-method: =~
* Document-method: +
* Document-method: -
* Document-method: +@
*
* A comment
*/
TEXT

expected = <<-EXPECTED

A comment
EXPECTED

assert_equal expected, strip_stars(text)
end

def test_strip_stars_encoding
text = <<-TEXT
/*
Expand Down