rdoc 6.5.0 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.rdoc +1 -1
  3. data/README.rdoc +2 -2
  4. data/TODO.rdoc +1 -1
  5. data/lib/rdoc/alias.rb +0 -1
  6. data/lib/rdoc/anon_class.rb +0 -1
  7. data/lib/rdoc/any_method.rb +15 -0
  8. data/lib/rdoc/attr.rb +0 -1
  9. data/lib/rdoc/class_module.rb +0 -1
  10. data/lib/rdoc/comment.rb +20 -41
  11. data/lib/rdoc/constant.rb +0 -1
  12. data/lib/rdoc/context/section.rb +0 -1
  13. data/lib/rdoc/context.rb +1 -1
  14. data/lib/rdoc/cross_reference.rb +3 -1
  15. data/lib/rdoc/encoding.rb +1 -17
  16. data/lib/rdoc/erb_partial.rb +0 -1
  17. data/lib/rdoc/erbio.rb +2 -7
  18. data/lib/rdoc/extend.rb +0 -1
  19. data/lib/rdoc/generator/darkfish.rb +2 -6
  20. data/lib/rdoc/generator/json_index.rb +2 -2
  21. data/lib/rdoc/generator/markup.rb +0 -1
  22. data/lib/rdoc/generator/pot.rb +1 -0
  23. data/lib/rdoc/generator/ri.rb +0 -1
  24. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
  25. data/lib/rdoc/generator/template/darkfish/class.rhtml +6 -0
  26. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +38 -13
  27. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +13 -0
  28. data/lib/rdoc/generator/template/darkfish/js/search.js +3 -3
  29. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +5 -4
  30. data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
  31. data/lib/rdoc/ghost_method.rb +0 -1
  32. data/lib/rdoc/include.rb +0 -1
  33. data/lib/rdoc/markdown/entities.rb +0 -1
  34. data/lib/rdoc/markdown/literals.kpeg +0 -2
  35. data/lib/rdoc/markdown/literals.rb +66 -44
  36. data/lib/rdoc/markdown.kpeg +3 -3
  37. data/lib/rdoc/markdown.rb +7 -5
  38. data/lib/rdoc/markup/attr_changer.rb +0 -1
  39. data/lib/rdoc/markup/attr_span.rb +0 -1
  40. data/lib/rdoc/markup/attribute_manager.rb +14 -12
  41. data/lib/rdoc/markup/attributes.rb +0 -1
  42. data/lib/rdoc/markup/blank_line.rb +0 -1
  43. data/lib/rdoc/markup/block_quote.rb +0 -1
  44. data/lib/rdoc/markup/document.rb +0 -1
  45. data/lib/rdoc/markup/formatter.rb +1 -2
  46. data/lib/rdoc/markup/hard_break.rb +0 -1
  47. data/lib/rdoc/markup/heading.rb +0 -1
  48. data/lib/rdoc/markup/include.rb +0 -1
  49. data/lib/rdoc/markup/indented_paragraph.rb +0 -1
  50. data/lib/rdoc/markup/list.rb +0 -1
  51. data/lib/rdoc/markup/list_item.rb +0 -1
  52. data/lib/rdoc/markup/paragraph.rb +0 -1
  53. data/lib/rdoc/markup/parser.rb +5 -1
  54. data/lib/rdoc/markup/raw.rb +0 -1
  55. data/lib/rdoc/markup/regexp_handling.rb +0 -1
  56. data/lib/rdoc/markup/rule.rb +0 -1
  57. data/lib/rdoc/markup/table.rb +11 -2
  58. data/lib/rdoc/markup/to_ansi.rb +0 -1
  59. data/lib/rdoc/markup/to_bs.rb +25 -0
  60. data/lib/rdoc/markup/to_html.rb +7 -3
  61. data/lib/rdoc/markup/to_html_crossref.rb +13 -14
  62. data/lib/rdoc/markup/to_html_snippet.rb +3 -1
  63. data/lib/rdoc/markup/to_joined_paragraph.rb +2 -3
  64. data/lib/rdoc/markup/to_label.rb +0 -1
  65. data/lib/rdoc/markup/to_markdown.rb +4 -5
  66. data/lib/rdoc/markup/to_rdoc.rb +11 -4
  67. data/lib/rdoc/markup/to_table_of_contents.rb +0 -1
  68. data/lib/rdoc/markup/to_test.rb +0 -1
  69. data/lib/rdoc/markup/to_tt_only.rb +0 -1
  70. data/lib/rdoc/markup/verbatim.rb +0 -1
  71. data/lib/rdoc/meta_method.rb +0 -1
  72. data/lib/rdoc/method_attr.rb +0 -1
  73. data/lib/rdoc/mixin.rb +0 -1
  74. data/lib/rdoc/normal_class.rb +0 -1
  75. data/lib/rdoc/normal_module.rb +0 -1
  76. data/lib/rdoc/options.rb +4 -2
  77. data/lib/rdoc/parser/c.rb +33 -22
  78. data/lib/rdoc/parser/changelog.rb +15 -1
  79. data/lib/rdoc/parser/markdown.rb +0 -2
  80. data/lib/rdoc/parser/rd.rb +0 -1
  81. data/lib/rdoc/parser/ripper_state_lex.rb +11 -1
  82. data/lib/rdoc/parser/ruby.rb +18 -6
  83. data/lib/rdoc/parser/ruby_tools.rb +0 -2
  84. data/lib/rdoc/parser/text.rb +0 -1
  85. data/lib/rdoc/parser.rb +4 -2
  86. data/lib/rdoc/rd/block_parser.rb +650 -4
  87. data/lib/rdoc/rd/block_parser.ry +1 -1
  88. data/lib/rdoc/rd/inline.rb +0 -1
  89. data/lib/rdoc/rd/inline_parser.rb +649 -3
  90. data/lib/rdoc/rdoc.rb +2 -4
  91. data/lib/rdoc/require.rb +0 -1
  92. data/lib/rdoc/ri/driver.rb +10 -9
  93. data/lib/rdoc/ri/store.rb +0 -1
  94. data/lib/rdoc/single_class.rb +0 -1
  95. data/lib/rdoc/stats/quiet.rb +0 -1
  96. data/lib/rdoc/stats/verbose.rb +0 -2
  97. data/lib/rdoc/store.rb +29 -19
  98. data/lib/rdoc/task.rb +28 -2
  99. data/lib/rdoc/text.rb +10 -0
  100. data/lib/rdoc/token_stream.rb +1 -2
  101. data/lib/rdoc/top_level.rb +3 -1
  102. data/lib/rdoc/version.rb +1 -1
  103. data/lib/rdoc.rb +12 -0
  104. metadata +8 -8
@@ -25,9 +25,9 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
25
25
  def accept_paragraph paragraph
26
26
  parts = paragraph.parts.chunk do |part|
27
27
  String === part
28
- end.map do |string, chunk|
28
+ end.flat_map do |string, chunk|
29
29
  string ? chunk.join.rstrip : chunk
30
- end.flatten
30
+ end
31
31
 
32
32
  paragraph.parts.replace parts
33
33
  end
@@ -44,4 +44,3 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
44
44
  alias accept_table ignore
45
45
 
46
46
  end
47
-
@@ -72,4 +72,3 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
72
72
  alias start_accepting ignore
73
73
 
74
74
  end
75
-
@@ -45,8 +45,6 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
45
45
  # Finishes consumption of `list`
46
46
 
47
47
  def accept_list_end list
48
- @res << "\n"
49
-
50
48
  super
51
49
  end
52
50
 
@@ -60,6 +58,8 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
60
58
  when :NOTE, :LABEL then
61
59
  use_prefix
62
60
 
61
+ @res << "\n"
62
+
63
63
  4
64
64
  else
65
65
  @list_index[-1] = @list_index.last.succ
@@ -81,11 +81,11 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
81
81
  attributes(label).strip
82
82
  end.join "\n"
83
83
 
84
- bullets << "\n:"
84
+ bullets << "\n" unless bullets.empty?
85
85
 
86
86
  @prefix = ' ' * @indent
87
87
  @indent += 4
88
- @prefix << bullets + (' ' * (@indent - 1))
88
+ @prefix << bullets << ":" << (' ' * (@indent - 1))
89
89
  else
90
90
  bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'
91
91
  @prefix = (' ' * @indent) + bullet.ljust(4)
@@ -189,4 +189,3 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
189
189
  end
190
190
 
191
191
  end
192
-
@@ -145,11 +145,19 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
145
145
 
146
146
  case type
147
147
  when :NOTE, :LABEL then
148
- bullets = Array(list_item.label).map do |label|
148
+ stripped_labels = Array(list_item.label).map do |label|
149
149
  attributes(label).strip
150
- end.join "\n"
150
+ end
151
+
152
+ bullets = case type
153
+ when :NOTE
154
+ stripped_labels.map { |b| "#{b}::" }
155
+ when :LABEL
156
+ stripped_labels.map { |b| "[#{b}]" }
157
+ end
151
158
 
152
- bullets << ":\n" unless bullets.empty?
159
+ bullets = bullets.join("\n")
160
+ bullets << "\n" unless stripped_labels.empty?
153
161
 
154
162
  @prefix = ' ' * @indent
155
163
  @indent += 2
@@ -342,4 +350,3 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
342
350
  end
343
351
 
344
352
  end
345
-
@@ -86,4 +86,3 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
86
86
  # :startdoc:
87
87
 
88
88
  end
89
-
@@ -67,4 +67,3 @@ class RDoc::Markup::ToTest < RDoc::Markup::Formatter
67
67
  # :startdoc:
68
68
 
69
69
  end
70
-
@@ -118,4 +118,3 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
118
118
  end
119
119
 
120
120
  end
121
-
@@ -81,4 +81,3 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
81
81
  end
82
82
 
83
83
  end
84
-
@@ -4,4 +4,3 @@
4
4
 
5
5
  class RDoc::MetaMethod < RDoc::AnyMethod
6
6
  end
7
-
@@ -416,4 +416,3 @@ class RDoc::MethodAttr < RDoc::CodeObject
416
416
  end
417
417
 
418
418
  end
419
-
data/lib/rdoc/mixin.rb CHANGED
@@ -118,4 +118,3 @@ class RDoc::Mixin < RDoc::CodeObject
118
118
  end
119
119
 
120
120
  end
121
-
@@ -90,4 +90,3 @@ class RDoc::NormalClass < RDoc::ClassModule
90
90
  end
91
91
 
92
92
  end
93
-
@@ -71,4 +71,3 @@ class RDoc::NormalModule < RDoc::ClassModule
71
71
  end
72
72
 
73
73
  end
74
-
data/lib/rdoc/options.rb CHANGED
@@ -105,6 +105,7 @@ class RDoc::Options
105
105
  generator_name
106
106
  generator_options
107
107
  generators
108
+ locale
108
109
  op_dir
109
110
  page_dir
110
111
  option_parser
@@ -565,9 +566,10 @@ class RDoc::Options
565
566
 
566
567
  @op_dir ||= 'doc'
567
568
 
568
- @rdoc_include << "." if @rdoc_include.empty?
569
569
  root = @root.to_s
570
- @rdoc_include << root unless @rdoc_include.include?(root)
570
+ if @rdoc_include.empty? || !@rdoc_include.include?(root)
571
+ @rdoc_include << root
572
+ end
571
573
 
572
574
  @exclude = self.exclude
573
575
 
data/lib/rdoc/parser/c.rb CHANGED
@@ -575,19 +575,18 @@ class RDoc::Parser::C < RDoc::Parser
575
575
  table = {}
576
576
  file_content.scan(%r{
577
577
  ((?>/\*.*?\*/\s*)?)
578
- ((?:(?:\w+)\s+)?
579
- (?:intern\s+)?VALUE\s+(\w+)
580
- \s*(?:\([^)]*\))(?:[^\);]|$))
578
+ ((?:\w+\s+){0,2} VALUE\s+(\w+)
579
+ \s*(?:\([^\)]*\))(?:[^\);]|$))
581
580
  | ((?>/\*.*?\*/\s*))^\s*(\#\s*define\s+(\w+)\s+(\w+))
582
581
  | ^\s*\#\s*define\s+(\w+)\s+(\w+)
583
582
  }xm) do
584
583
  case
585
- when $1
586
- table[$3] = [:func_def, $1, $2, $~.offset(2)] if !table[$3] || table[$3][0] != :func_def
587
- when $4
588
- table[$6] = [:macro_def, $4, $5, $~.offset(5), $7] if !table[$6] || table[$6][0] == :macro_alias
589
- when $8
590
- table[$8] ||= [:macro_alias, $9]
584
+ when name = $3
585
+ table[name] = [:func_def, $1, $2, $~.offset(2)] if !(t = table[name]) || t[0] != :func_def
586
+ when name = $6
587
+ table[name] = [:macro_def, $4, $5, $~.offset(5), $7] if !(t = table[name]) || t[0] == :macro_alias
588
+ when name = $8
589
+ table[name] ||= [:macro_alias, $9]
591
590
  end
592
591
  end
593
592
  table
@@ -757,17 +756,27 @@ class RDoc::Parser::C < RDoc::Parser
757
756
  def gen_const_table file_content
758
757
  table = {}
759
758
  @content.scan(%r{
760
- ((?>^\s*/\*.*?\*/\s+))
761
- rb_define_(\w+)\((?:\s*(?:\w+),)?\s*
762
- "(\w+)"\s*,
759
+ (?<doc>(?>^\s*/\*.*?\*/\s+))
760
+ rb_define_(?<type>\w+)\(\s*(?:\w+),\s*
761
+ "(?<name>\w+)"\s*,
763
762
  .*?\)\s*;
763
+ | (?<doc>(?>^\s*/\*.*?\*/\s+))
764
+ rb_file_(?<type>const)\(\s*
765
+ "(?<name>\w+)"\s*,
766
+ .*?\)\s*;
767
+ | (?<doc>(?>^\s*/\*.*?\*/\s+))
768
+ rb_curses_define_(?<type>const)\(\s*
769
+ (?<name>\w+)
770
+ \s*\)\s*;
764
771
  | Document-(?:const|global|variable):\s
765
- ((?:\w+::)*\w+)
766
- \s*?\n((?>.*?\*/))
772
+ (?<name>(?:\w+::)*\w+)
773
+ \s*?\n(?<doc>(?>.*?\*/))
767
774
  }mxi) do
768
- case
769
- when $1 then table[[$2, $3]] = $1
770
- when $4 then table[$4] = "/*\n" + $5
775
+ name, doc, type = $~.values_at(:name, :doc, :type)
776
+ if type
777
+ table[[type, name]] = doc
778
+ else
779
+ table[name] = "/*\n" + doc
771
780
  end
772
781
  end
773
782
  table
@@ -939,14 +948,13 @@ class RDoc::Parser::C < RDoc::Parser
939
948
  # "/* definition: comment */" form. The literal ':' and '\' characters
940
949
  # can be escaped with a backslash.
941
950
  if type.downcase == 'const' then
942
- no_match, new_definition, new_comment = comment.text.split(/(\A.*):/)
951
+ if /\A(.+?)?:(?!\S)/ =~ comment.text
952
+ new_definition, new_comment = $1, $'
943
953
 
944
- if no_match and no_match.empty? then
945
- if new_definition.empty? then # Default to literal C definition
954
+ if !new_definition # Default to literal C definition
946
955
  new_definition = definition
947
956
  else
948
- new_definition = new_definition.gsub("\:", ":")
949
- new_definition = new_definition.gsub("\\", '\\')
957
+ new_definition = new_definition.gsub(/\\([\\:])/, '\1')
950
958
  end
951
959
 
952
960
  new_definition.sub!(/\A(\s+)/, '')
@@ -1217,6 +1225,9 @@ class RDoc::Parser::C < RDoc::Parser
1217
1225
  @top_level
1218
1226
  end
1219
1227
 
1228
+ ##
1229
+ # Creates a RDoc::Comment instance.
1230
+
1220
1231
  def new_comment text = nil, location = nil, language = nil
1221
1232
  RDoc::Comment.new(text, location, language).tap do |comment|
1222
1233
  comment.format = @markup
@@ -216,12 +216,22 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
216
216
  @top_level
217
217
  end
218
218
 
219
+ ##
220
+ # The extension for Git commit log
221
+
219
222
  module Git
223
+ ##
224
+ # Parses auxiliary info. Currentry `base-url` to expand
225
+ # references is effective.
226
+
220
227
  def parse_info(info)
221
228
  /^\s*base-url\s*=\s*(.*\S)/ =~ info
222
229
  @base_url = $1
223
230
  end
224
231
 
232
+ ##
233
+ # Parses the entries in the Git commit logs
234
+
225
235
  def parse_entries
226
236
  entries = []
227
237
 
@@ -244,6 +254,11 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
244
254
  entries
245
255
  end
246
256
 
257
+ ##
258
+ # Returns a list of ChangeLog entries as
259
+ # RDoc::Parser::ChangeLog::Git::LogEntry list for the given
260
+ # +entries+.
261
+
247
262
  def create_entries entries
248
263
  # git log entries have no strictly itemized style like the old
249
264
  # style, just assume Markdown.
@@ -332,4 +347,3 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
332
347
  end
333
348
  end
334
349
  end
335
-
@@ -20,5 +20,3 @@ class RDoc::Parser::Markdown < RDoc::Parser
20
20
  end
21
21
 
22
22
  end
23
-
24
-
@@ -20,4 +20,3 @@ class RDoc::Parser::RD < RDoc::Parser
20
20
  end
21
21
 
22
22
  end
23
-
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
  require 'ripper'
3
3
 
4
+ ##
5
+ # Wrapper for Ripper lex states
6
+
4
7
  class RDoc::Parser::RipperStateLex
8
+ # :stopdoc:
9
+
5
10
  # TODO: Remove this constants after Ruby 2.4 EOL
6
11
  RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
7
12
 
@@ -368,7 +373,7 @@ class RDoc::Parser::RipperStateLex
368
373
  private def get_symbol_tk(tk)
369
374
  is_symbol = true
370
375
  symbol_tk = Token.new(tk.line_no, tk.char_no, :on_symbol)
371
- if ":'" == tk[:text] or ':"' == tk[:text]
376
+ if ":'" == tk[:text] or ':"' == tk[:text] or tk[:text].start_with?('%s')
372
377
  tk1 = get_string_tk(tk)
373
378
  symbol_tk[:text] = tk1[:text]
374
379
  symbol_tk[:state] = tk1[:state]
@@ -565,6 +570,9 @@ class RDoc::Parser::RipperStateLex
565
570
  tk
566
571
  end
567
572
 
573
+ # :startdoc:
574
+
575
+ # New lexer for +code+.
568
576
  def initialize(code)
569
577
  @buf = []
570
578
  @heredoc_queue = []
@@ -572,6 +580,7 @@ class RDoc::Parser::RipperStateLex
572
580
  @tokens = @inner_lex.parse([])
573
581
  end
574
582
 
583
+ # Returns tokens parsed from +code+.
575
584
  def self.parse(code)
576
585
  lex = self.new(code)
577
586
  tokens = []
@@ -584,6 +593,7 @@ class RDoc::Parser::RipperStateLex
584
593
  tokens
585
594
  end
586
595
 
596
+ # Returns +true+ if lex state will be +END+ after +token+.
587
597
  def self.end?(token)
588
598
  (token[:state] & EXPR_END)
589
599
  end
@@ -8,6 +8,9 @@
8
8
  # by Keiju ISHITSUKA (Nippon Rational Inc.)
9
9
  #
10
10
 
11
+ require 'ripper'
12
+ require_relative 'ripper_state_lex'
13
+
11
14
  ##
12
15
  # Extracts code elements from a source file returning a TopLevel object
13
16
  # containing the constituent file elements.
@@ -138,9 +141,6 @@
138
141
  # Note that by default, the :method: directive will be ignored if there is a
139
142
  # standard rdocable item following it.
140
143
 
141
- require 'ripper'
142
- require_relative 'ripper_state_lex'
143
-
144
144
  class RDoc::Parser::Ruby < RDoc::Parser
145
145
 
146
146
  parse_files_matching(/\.rbw?$/)
@@ -180,6 +180,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
180
180
  reset
181
181
  end
182
182
 
183
+ ##
184
+ # Return +true+ if +tk+ is a newline.
185
+
183
186
  def tk_nl?(tk)
184
187
  :on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]
185
188
  end
@@ -786,8 +789,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
786
789
  al.line = line_no
787
790
 
788
791
  read_documentation_modifiers al, RDoc::ATTR_MODIFIERS
789
- context.add_alias al
790
- @stats.add_alias al
792
+ if al.document_self or not @track_visibility
793
+ context.add_alias al
794
+ @stats.add_alias al
795
+ end
791
796
 
792
797
  al
793
798
  end
@@ -1450,6 +1455,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
1450
1455
  meth = RDoc::AnyMethod.new get_tkread, name
1451
1456
  look_for_directives_in meth, comment
1452
1457
  meth.singleton = single == SINGLE ? true : singleton
1458
+ if singleton
1459
+ # `current_line_visibility' is useless because it works against
1460
+ # the normal method named as same as the singleton method, after
1461
+ # the latter was defined. Of course these are different things.
1462
+ container.current_line_visibility = :public
1463
+ end
1453
1464
 
1454
1465
  record_location meth
1455
1466
  meth.line = line_no
@@ -1773,6 +1784,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1773
1784
 
1774
1785
  nest = 1
1775
1786
  save_visibility = container.visibility
1787
+ container.visibility = :public unless current_method
1776
1788
 
1777
1789
  non_comment_seen = true
1778
1790
 
@@ -2134,7 +2146,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2134
2146
  if :on_nl == tk[:kind] or (:on_kw == tk[:kind] && 'def' == tk[:text]) then
2135
2147
  return
2136
2148
  elsif :on_comment == tk[:kind] or :on_embdoc == tk[:kind] then
2137
- return unless tk[:text] =~ /\s*:?([\w-]+):\s*(.*)/
2149
+ return unless tk[:text] =~ /:?\b([\w-]+):\s*(.*)/
2138
2150
 
2139
2151
  directive = $1.downcase
2140
2152
 
@@ -163,5 +163,3 @@ module RDoc::Parser::RubyTools
163
163
  end
164
164
 
165
165
  end
166
-
167
-
@@ -9,4 +9,3 @@
9
9
 
10
10
  module RDoc::Parser::Text
11
11
  end
12
-
data/lib/rdoc/parser.rb CHANGED
@@ -125,9 +125,11 @@ class RDoc::Parser
125
125
  return parser if ext_name.empty?
126
126
 
127
127
  if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/ then
128
- case check_modeline file_name
128
+ case mode = check_modeline(file_name)
129
129
  when nil, 'rdoc' then # continue
130
- else return nil
130
+ else
131
+ RDoc::Parser.parsers.find { |_, p| return p if mode.casecmp?(p.name[/\w+\z/]) }
132
+ return nil
131
133
  end
132
134
  end
133
135