diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-27 10:45:24 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-27 10:45:24 +0000 |
commit | 55518710865bd7258422807524403c91347519a2 (patch) | |
tree | 4146c423ab0c55ed35d9d860e64d7e3a7e2a9efb /lib/rdoc/markup/pre_process.rb | |
parent | 2d9f20e1cfdc7532a8acef4da9b8b7a788c4e99a (diff) |
Merge rdoc-6.0.0.beta4 from upstream.
It version applied `frozen_string_literal: true`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/markup/pre_process.rb')
-rw-r--r-- | lib/rdoc/markup/pre_process.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb index 6ce523be89..0ac7a41934 100644 --- a/lib/rdoc/markup/pre_process.rb +++ b/lib/rdoc/markup/pre_process.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Handle common directives that can occur in a block of text: # @@ -105,7 +105,7 @@ class RDoc::Markup::PreProcess # regexp helper (square brackets for optional) # $1 $2 $3 $4 $5 # [prefix][\]:directive:[spaces][param]newline - text.gsub!(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do + text = text.gsub(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do # skip something like ':toto::' next $& if $4.empty? and $5 and $5[0, 1] == ':' @@ -123,7 +123,11 @@ class RDoc::Markup::PreProcess handle_directive $1, $3, $5, code_object, text.encoding, &block end - comment = text unless comment + if comment then + comment.text = text + else + comment = text + end self.class.post_processors.each do |handler| handler.call comment, code_object @@ -150,7 +154,7 @@ class RDoc::Markup::PreProcess case directive when 'arg', 'args' then - return "#{prefix}:#{directive}: #{param}\n" unless code_object + return "#{prefix}:#{directive}: #{param}\n" unless code_object && code_object.kind_of?(RDoc::AnyMethod) code_object.params = param @@ -212,7 +216,7 @@ class RDoc::Markup::PreProcess when 'yield', 'yields' then return blankline unless code_object # remove parameter &block - code_object.params.sub!(/,?\s*&\w+/, '') if code_object.params + code_object.params = code_object.params.sub(/,?\s*&\w+/, '') if code_object.params code_object.block_params = param |