1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/strip-rdoc.rb
卜部昌平 ef74483594 tool/strip-rdoc.rb: optimize
This script is called from Doxygen many times.  Worth optimising.
[ci skip]
2021-09-10 20:00:06 +09:00

14 lines
359 B
Ruby
Executable file

#!ruby
# frozen_string_literal: true
# Filter for preventing Doxygen from processing RDoc comments.
# Used by the Doxygen template.
print ARGF.binmode.read.tap {|src|
src.gsub!(%r|(/\*[!*])(?:(?!\*/).)+?^\s*\*\s?\-\-\s*$(.+?\*/)|m) {
marker = $1
comment = $2
comment.sub!(%r|^\s*\*\s?\+\+\s*$.+?(\s*\*/)\z|m, '\\1')
marker + comment
}
}