diff options
author | aycabta <[email protected]> | 2019-01-22 04:46:46 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2019-07-26 17:20:58 +0800 |
commit | a86d4eef4b4551a48a5329bb993c3c6c39a1b1f3 (patch) | |
tree | 15c6b61eac64464b984b41d59906b02643ab372f /lib/rdoc/parser | |
parent | f7cbbc707413f7e1c71ac1839b0c8834550451e6 (diff) |
[ruby/rdoc] Normalization of comment should check language
RDoc::Text#normalize_comment that is included RDoc::Comment always
remove Ruby style comment indicator "#" and C style comment indicator
"/**/", but should check language and remove only the language's comment
indicator.
https://github.com/ruby/rdoc/commit/ca68ba1e73
Diffstat (limited to 'lib/rdoc/parser')
-rw-r--r-- | lib/rdoc/parser/c.rb | 18 | ||||
-rw-r--r-- | lib/rdoc/parser/ruby.rb | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index c51e2f6365..5cc009e499 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -446,7 +446,7 @@ class RDoc::Parser::C < RDoc::Parser next unless cls = @classes[c] m = @known_classes[m] || m - comment = RDoc::Comment.new '', @top_level + comment = RDoc::Comment.new '', @top_level, :c incl = cls.add_include RDoc::Include.new(m, comment) incl.record_location @top_level end @@ -564,7 +564,7 @@ class RDoc::Parser::C < RDoc::Parser \s*"#{Regexp.escape new_name}"\s*, \s*"#{Regexp.escape old_name}"\s*\);%xm - RDoc::Comment.new($1 || '', @top_level) + RDoc::Comment.new($1 || '', @top_level, :c) end ## @@ -603,7 +603,7 @@ class RDoc::Parser::C < RDoc::Parser '' end - RDoc::Comment.new comment, @top_level + RDoc::Comment.new comment, @top_level, :c end ## @@ -643,7 +643,7 @@ class RDoc::Parser::C < RDoc::Parser case type when :func_def - comment = RDoc::Comment.new args[0], @top_level + comment = RDoc::Comment.new args[0], @top_level, :c body = args[1] offset, = args[2] @@ -673,7 +673,7 @@ class RDoc::Parser::C < RDoc::Parser body when :macro_def - comment = RDoc::Comment.new args[0], @top_level + comment = RDoc::Comment.new args[0], @top_level, :c body = args[1] offset, = args[2] @@ -780,7 +780,7 @@ class RDoc::Parser::C < RDoc::Parser comment = '' end - comment = RDoc::Comment.new comment, @top_level + comment = RDoc::Comment.new comment, @top_level, :c comment.normalize look_for_directives_in class_mod, comment @@ -825,7 +825,7 @@ class RDoc::Parser::C < RDoc::Parser table[const_name] || '' - RDoc::Comment.new comment, @top_level + RDoc::Comment.new comment, @top_level, :c end ## @@ -856,7 +856,7 @@ class RDoc::Parser::C < RDoc::Parser return unless comment - RDoc::Comment.new comment, @top_level + RDoc::Comment.new comment, @top_level, :c end ## @@ -990,7 +990,7 @@ class RDoc::Parser::C < RDoc::Parser new_comment = "#{$1}#{new_comment.lstrip}" - new_comment = RDoc::Comment.new new_comment, @top_level + new_comment = RDoc::Comment.new new_comment, @top_level, :c con = RDoc::Constant.new const_name, new_definition, new_comment else diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 97399f87ff..8da19cf2e2 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -667,7 +667,7 @@ class RDoc::Parser::Ruby < RDoc::Parser # Creates a comment with the correct format def new_comment comment - c = RDoc::Comment.new comment, @top_level + c = RDoc::Comment.new comment, @top_level, :ruby c.format = @markup c end |