rdoc 6.13.0 → 6.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -1
  3. data/lib/rdoc/code_object/any_method.rb +4 -4
  4. data/lib/rdoc/code_object/attr.rb +3 -3
  5. data/lib/rdoc/code_object/class_module.rb +18 -16
  6. data/lib/rdoc/code_object/constant.rb +5 -5
  7. data/lib/rdoc/code_object/context/section.rb +7 -7
  8. data/lib/rdoc/code_object/context.rb +19 -19
  9. data/lib/rdoc/code_object/method_attr.rb +6 -6
  10. data/lib/rdoc/code_object/mixin.rb +3 -3
  11. data/lib/rdoc/code_object/normal_class.rb +1 -1
  12. data/lib/rdoc/code_object/normal_module.rb +1 -1
  13. data/lib/rdoc/code_object/single_class.rb +1 -1
  14. data/lib/rdoc/code_object/top_level.rb +10 -8
  15. data/lib/rdoc/code_object.rb +3 -3
  16. data/lib/rdoc/comment.rb +6 -6
  17. data/lib/rdoc/cross_reference.rb +3 -3
  18. data/lib/rdoc/encoding.rb +4 -4
  19. data/lib/rdoc/erb_partial.rb +1 -1
  20. data/lib/rdoc/erbio.rb +2 -2
  21. data/lib/rdoc/generator/darkfish.rb +15 -15
  22. data/lib/rdoc/generator/json_index.rb +3 -3
  23. data/lib/rdoc/generator/markup.rb +12 -0
  24. data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
  25. data/lib/rdoc/generator/pot/po.rb +1 -1
  26. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  27. data/lib/rdoc/generator/pot.rb +1 -1
  28. data/lib/rdoc/generator/ri.rb +1 -1
  29. data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
  30. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
  31. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  32. data/lib/rdoc/markup/attributes.rb +3 -3
  33. data/lib/rdoc/markup/blank_line.rb +2 -2
  34. data/lib/rdoc/markup/block_quote.rb +1 -1
  35. data/lib/rdoc/markup/document.rb +8 -8
  36. data/lib/rdoc/markup/formatter.rb +12 -12
  37. data/lib/rdoc/markup/hard_break.rb +3 -3
  38. data/lib/rdoc/markup/heading.rb +4 -4
  39. data/lib/rdoc/markup/include.rb +3 -3
  40. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  41. data/lib/rdoc/markup/list.rb +4 -4
  42. data/lib/rdoc/markup/list_item.rb +4 -4
  43. data/lib/rdoc/markup/paragraph.rb +2 -2
  44. data/lib/rdoc/markup/parser.rb +11 -11
  45. data/lib/rdoc/markup/pre_process.rb +6 -6
  46. data/lib/rdoc/markup/raw.rb +5 -5
  47. data/lib/rdoc/markup/rule.rb +2 -2
  48. data/lib/rdoc/markup/table.rb +4 -4
  49. data/lib/rdoc/markup/to_ansi.rb +3 -3
  50. data/lib/rdoc/markup/to_bs.rb +6 -6
  51. data/lib/rdoc/markup/to_html.rb +21 -16
  52. data/lib/rdoc/markup/to_html_crossref.rb +5 -5
  53. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  54. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  55. data/lib/rdoc/markup/to_label.rb +5 -5
  56. data/lib/rdoc/markup/to_markdown.rb +12 -12
  57. data/lib/rdoc/markup/to_rdoc.rb +29 -28
  58. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  59. data/lib/rdoc/markup/to_test.rb +1 -1
  60. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  61. data/lib/rdoc/markup/verbatim.rb +3 -3
  62. data/lib/rdoc/markup.rb +3 -3
  63. data/lib/rdoc/options.rb +31 -12
  64. data/lib/rdoc/parser/c.rb +16 -16
  65. data/lib/rdoc/parser/changelog.rb +9 -9
  66. data/lib/rdoc/parser/prism_ruby.rb +1 -1
  67. data/lib/rdoc/parser/ruby.rb +43 -43
  68. data/lib/rdoc/parser/simple.rb +2 -2
  69. data/lib/rdoc/parser.rb +8 -8
  70. data/lib/rdoc/rd/inline.rb +4 -4
  71. data/lib/rdoc/rd.rb +1 -1
  72. data/lib/rdoc/rdoc.rb +8 -8
  73. data/lib/rdoc/ri/driver.rb +49 -49
  74. data/lib/rdoc/ri/paths.rb +2 -2
  75. data/lib/rdoc/ri/task.rb +1 -1
  76. data/lib/rdoc/rubygems_hook.rb +14 -11
  77. data/lib/rdoc/servlet.rb +15 -15
  78. data/lib/rdoc/stats/normal.rb +1 -1
  79. data/lib/rdoc/stats/quiet.rb +1 -1
  80. data/lib/rdoc/stats/verbose.rb +3 -3
  81. data/lib/rdoc/stats.rb +12 -12
  82. data/lib/rdoc/store.rb +30 -30
  83. data/lib/rdoc/task.rb +2 -2
  84. data/lib/rdoc/text.rb +11 -11
  85. data/lib/rdoc/token_stream.rb +1 -1
  86. data/lib/rdoc/tom_doc.rb +7 -7
  87. data/lib/rdoc/version.rb +1 -1
  88. data/man/ri.1 +2 -0
  89. metadata +17 -3
@@ -236,7 +236,7 @@ class RDoc::CodeObject
236
236
  #
237
237
  # Set to +nil+ to clear RDoc's cached value
238
238
 
239
- def full_name= full_name
239
+ def full_name=(full_name)
240
240
  @full_name = full_name
241
241
  end
242
242
 
@@ -316,7 +316,7 @@ class RDoc::CodeObject
316
316
  ##
317
317
  # Records the RDoc::TopLevel (file) where this code object was defined
318
318
 
319
- def record_location top_level
319
+ def record_location(top_level)
320
320
  @ignored = false
321
321
  @suppressed = false
322
322
  @file = top_level
@@ -358,7 +358,7 @@ class RDoc::CodeObject
358
358
  ##
359
359
  # Sets the +store+ that contains this CodeObject
360
360
 
361
- def store= store
361
+ def store=(store)
362
362
  @store = store
363
363
 
364
364
  return unless @track_visibility
data/lib/rdoc/comment.rb CHANGED
@@ -53,7 +53,7 @@ class RDoc::Comment
53
53
  # Creates a new comment with +text+ that is found in the RDoc::TopLevel
54
54
  # +location+.
55
55
 
56
- def initialize text = nil, location = nil, language = nil
56
+ def initialize(text = nil, location = nil, language = nil)
57
57
  @location = location
58
58
  @text = text.nil? ? nil : text.dup
59
59
  @language = language
@@ -67,11 +67,11 @@ class RDoc::Comment
67
67
  #--
68
68
  # TODO deep copy @document
69
69
 
70
- def initialize_copy copy # :nodoc:
70
+ def initialize_copy(copy) # :nodoc:
71
71
  @text = copy.text.dup
72
72
  end
73
73
 
74
- def == other # :nodoc:
74
+ def ==(other) # :nodoc:
75
75
  self.class === other and
76
76
  other.text == @text and other.location == @location
77
77
  end
@@ -129,7 +129,7 @@ class RDoc::Comment
129
129
  ##
130
130
  # HACK dubious
131
131
 
132
- def encode! encoding
132
+ def encode!(encoding)
133
133
  @text = String.new @text, encoding: encoding
134
134
  self
135
135
  end
@@ -137,7 +137,7 @@ class RDoc::Comment
137
137
  ##
138
138
  # Sets the format of this comment and resets any parsed document
139
139
 
140
- def format= format
140
+ def format=(format)
141
141
  @format = format
142
142
  @document = nil
143
143
  end
@@ -208,7 +208,7 @@ class RDoc::Comment
208
208
  #
209
209
  # An error is raised if the comment contains a document but no text.
210
210
 
211
- def text= text
211
+ def text=(text)
212
212
  raise RDoc::Error, 'replacing document-only comment is not allowed' if
213
213
  @text.nil? and @document
214
214
 
@@ -124,7 +124,7 @@ class RDoc::CrossReference
124
124
  # Allows cross-references to be created based on the given +context+
125
125
  # (RDoc::Context).
126
126
 
127
- def initialize context
127
+ def initialize(context)
128
128
  @context = context
129
129
  @store = context.store
130
130
 
@@ -134,7 +134,7 @@ class RDoc::CrossReference
134
134
  ##
135
135
  # Returns a method reference to +name+.
136
136
 
137
- def resolve_method name
137
+ def resolve_method(name)
138
138
  ref = nil
139
139
 
140
140
  if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
@@ -187,7 +187,7 @@ class RDoc::CrossReference
187
187
  # returned. If +name+ is escaped +name+ is returned. If +name+ is not
188
188
  # found +text+ is returned.
189
189
 
190
- def resolve name, text
190
+ def resolve(name, text)
191
191
  return @seen[name] if @seen.include? name
192
192
 
193
193
  ref = case name
data/lib/rdoc/encoding.rb CHANGED
@@ -29,7 +29,7 @@ module RDoc::Encoding
29
29
  # If +force_transcode+ is true the document will be transcoded and any
30
30
  # unknown character in the target encoding will be replaced with '?'
31
31
 
32
- def self.read_file filename, encoding, force_transcode = false
32
+ def self.read_file(filename, encoding, force_transcode = false)
33
33
  content = File.open filename, "rb" do |f| f.read end
34
34
  content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
35
35
 
@@ -89,7 +89,7 @@ module RDoc::Encoding
89
89
  ##
90
90
  # Detects the encoding of +string+ based on the magic comment
91
91
 
92
- def self.detect_encoding string
92
+ def self.detect_encoding(string)
93
93
  result = HEADER_REGEXP.match string
94
94
  name = result && result[:name]
95
95
 
@@ -99,7 +99,7 @@ module RDoc::Encoding
99
99
  ##
100
100
  # Removes magic comments and shebang
101
101
 
102
- def self.remove_magic_comment string
102
+ def self.remove_magic_comment(string)
103
103
  string.sub HEADER_REGEXP do |s|
104
104
  s.gsub(/[^\n]/, '')
105
105
  end
@@ -109,7 +109,7 @@ module RDoc::Encoding
109
109
  # Changes encoding based on +encoding+ without converting and returns new
110
110
  # string
111
111
 
112
- def self.change_encoding text, encoding
112
+ def self.change_encoding(text, encoding)
113
113
  if text.kind_of? RDoc::Comment
114
114
  text.encode! encoding
115
115
  else
@@ -9,7 +9,7 @@ class RDoc::ERBPartial < ERB
9
9
  # Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
10
10
  # if it isn't already set.
11
11
 
12
- def set_eoutvar compiler, eoutvar = '_erbout'
12
+ def set_eoutvar(compiler, eoutvar = '_erbout')
13
13
  super
14
14
 
15
15
  compiler.pre_cmd = ["#{eoutvar} ||= +''"]
data/lib/rdoc/erbio.rb CHANGED
@@ -20,14 +20,14 @@ class RDoc::ERBIO < ERB
20
20
  ##
21
21
  # Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize
22
22
 
23
- def initialize str, trim_mode: nil, eoutvar: 'io'
23
+ def initialize(str, trim_mode: nil, eoutvar: 'io')
24
24
  super(str, trim_mode: trim_mode, eoutvar: eoutvar)
25
25
  end
26
26
 
27
27
  ##
28
28
  # Instructs +compiler+ how to write to +io_variable+
29
29
 
30
- def set_eoutvar compiler, io_variable
30
+ def set_eoutvar(compiler, io_variable)
31
31
  compiler.put_cmd = "#{io_variable}.write"
32
32
  compiler.insert_cmd = "#{io_variable}.write"
33
33
  compiler.pre_cmd = []
@@ -150,7 +150,7 @@ class RDoc::Generator::Darkfish
150
150
  ##
151
151
  # Initialize a few instance variables before we start
152
152
 
153
- def initialize store, options
153
+ def initialize(store, options)
154
154
  @store = store
155
155
  @options = options
156
156
 
@@ -269,7 +269,7 @@ class RDoc::Generator::Darkfish
269
269
  # Return a list of the documented modules sorted by salience first, then
270
270
  # by name.
271
271
 
272
- def get_sorted_module_list classes
272
+ def get_sorted_module_list(classes)
273
273
  classes.select do |klass|
274
274
  klass.display?
275
275
  end.sort
@@ -313,7 +313,7 @@ class RDoc::Generator::Darkfish
313
313
  ##
314
314
  # Generates a class file for +klass+
315
315
 
316
- def generate_class klass, template_file = nil
316
+ def generate_class(klass, template_file = nil)
317
317
  current = klass
318
318
 
319
319
  template_file ||= @template_dir + 'class.rhtml'
@@ -435,7 +435,7 @@ class RDoc::Generator::Darkfish
435
435
  ##
436
436
  # Generate a page file for +file+
437
437
 
438
- def generate_page file
438
+ def generate_page(file)
439
439
  template_file = @template_dir + 'page.rhtml'
440
440
 
441
441
  out_file = @outputdir + file.path
@@ -462,7 +462,7 @@ class RDoc::Generator::Darkfish
462
462
  ##
463
463
  # Generates the 404 page for the RDoc servlet
464
464
 
465
- def generate_servlet_not_found message
465
+ def generate_servlet_not_found(message)
466
466
  template_file = @template_dir + 'servlet_not_found.rhtml'
467
467
  return unless template_file.exist?
468
468
 
@@ -493,7 +493,7 @@ class RDoc::Generator::Darkfish
493
493
  ##
494
494
  # Generates the servlet root page for the RDoc servlet
495
495
 
496
- def generate_servlet_root installed
496
+ def generate_servlet_root(installed)
497
497
  template_file = @template_dir + 'servlet_root.rhtml'
498
498
  return unless template_file.exist?
499
499
 
@@ -547,7 +547,7 @@ class RDoc::Generator::Darkfish
547
547
  raise error
548
548
  end
549
549
 
550
- def install_rdoc_static_file source, destination, options # :nodoc:
550
+ def install_rdoc_static_file(source, destination, options) # :nodoc:
551
551
  return unless source.exist?
552
552
 
553
553
  begin
@@ -586,7 +586,7 @@ class RDoc::Generator::Darkfish
586
586
  # For backwards compatibility, if +body_file+ contains "<html" the body is
587
587
  # used directly.
588
588
 
589
- def assemble_template body_file
589
+ def assemble_template(body_file)
590
590
  body = body_file.read
591
591
  return body if body =~ /<html/
592
592
 
@@ -595,7 +595,7 @@ class RDoc::Generator::Darkfish
595
595
  <<-TEMPLATE
596
596
  <!DOCTYPE html>
597
597
 
598
- <html>
598
+ <html lang="#{@options.locale&.name || 'en'}">
599
599
  <head>
600
600
  #{head_file.read}
601
601
 
@@ -607,7 +607,7 @@ class RDoc::Generator::Darkfish
607
607
  # Renders the ERb contained in +file_name+ relative to the template
608
608
  # directory and returns the result based on the current context.
609
609
 
610
- def render file_name
610
+ def render(file_name)
611
611
  template_file = @template_dir + file_name
612
612
 
613
613
  template = template_for template_file, false, RDoc::ERBPartial
@@ -625,7 +625,7 @@ class RDoc::Generator::Darkfish
625
625
  #
626
626
  # An io will be yielded which must be captured by binding in the caller.
627
627
 
628
- def render_template template_file, out_file = nil # :yield: io
628
+ def render_template(template_file, out_file = nil) # :yield: io
629
629
  io_output = out_file && !@dry_run && @file_output
630
630
  erb_klass = io_output ? RDoc::ERBIO : ERB
631
631
 
@@ -659,7 +659,7 @@ class RDoc::Generator::Darkfish
659
659
  # Creates the result for +template+ with +context+. If an error is raised a
660
660
  # Pathname +template_file+ will indicate the file where the error occurred.
661
661
 
662
- def template_result template, context, template_file
662
+ def template_result(template, context, template_file)
663
663
  template.filename = template_file.to_s
664
664
  template.result context
665
665
  rescue NoMethodError => e
@@ -672,7 +672,7 @@ class RDoc::Generator::Darkfish
672
672
  ##
673
673
  # Retrieves a cache template for +file+, if present, or fills the cache.
674
674
 
675
- def template_for file, page = true, klass = ERB
675
+ def template_for(file, page = true, klass = ERB)
676
676
  template = @template_cache[file]
677
677
 
678
678
  return template if template
@@ -793,7 +793,7 @@ class RDoc::Generator::Darkfish
793
793
 
794
794
  private
795
795
 
796
- def nesting_namespaces_to_class_modules klass
796
+ def nesting_namespaces_to_class_modules(klass)
797
797
  tree = {}
798
798
 
799
799
  klass.nesting_namespaces.zip(klass.fully_qualified_nesting_namespaces) do |ns, fqns|
@@ -803,7 +803,7 @@ class RDoc::Generator::Darkfish
803
803
  tree
804
804
  end
805
805
 
806
- def generate_nesting_namespaces_breadcrumb klass, rel_prefix
806
+ def generate_nesting_namespaces_breadcrumb(klass, rel_prefix)
807
807
  nesting_namespaces_to_class_modules(klass).map do |namespace, class_module|
808
808
  path = class_module ? (rel_prefix + class_module.path).to_s : ""
809
809
  { name: namespace, path: path, self: klass.full_name == class_module&.full_name }
@@ -89,7 +89,7 @@ class RDoc::Generator::JsonIndex
89
89
  # Creates a new generator.
90
90
  # +options+ are the same options passed to the parent generator.
91
91
 
92
- def initialize parent_generator, options
92
+ def initialize(parent_generator, options)
93
93
  @parent_generator = parent_generator
94
94
  @store = parent_generator.store
95
95
  @options = options
@@ -263,7 +263,7 @@ class RDoc::Generator::JsonIndex
263
263
  end
264
264
  end
265
265
 
266
- def reset files, classes # :nodoc:
266
+ def reset(files, classes) # :nodoc:
267
267
  @files = files
268
268
  @classes = classes
269
269
 
@@ -277,7 +277,7 @@ class RDoc::Generator::JsonIndex
277
277
  ##
278
278
  # Removes whitespace and downcases +string+
279
279
 
280
- def search_string string
280
+ def search_string(string)
281
281
  string.downcase.gsub(/\s/, '')
282
282
  end
283
283
 
@@ -55,6 +55,18 @@ module RDoc::Generator::Markup
55
55
  end
56
56
  end
57
57
 
58
+ ##
59
+ # The preferred URL for this object.
60
+
61
+ def canonical_url
62
+ options = @store.options
63
+ if path
64
+ File.join(options.canonical_root, path.to_s)
65
+ else
66
+ options.canonical_root
67
+ end
68
+ end
69
+
58
70
  end
59
71
 
60
72
  class RDoc::CodeObject
@@ -7,7 +7,7 @@ class RDoc::Generator::POT::MessageExtractor
7
7
  ##
8
8
  # Creates a message extractor for +store+.
9
9
 
10
- def initialize store
10
+ def initialize(store)
11
11
  @store = store
12
12
  @po = RDoc::Generator::POT::PO.new
13
13
  end
@@ -25,7 +25,7 @@ class RDoc::Generator::POT::MessageExtractor
25
25
 
26
26
  private
27
27
 
28
- def extract_from_klass klass
28
+ def extract_from_klass(klass)
29
29
  extract_text(klass.comment_location, klass.full_name)
30
30
 
31
31
  klass.each_section do |section, constants, attributes|
@@ -48,7 +48,7 @@ class RDoc::Generator::POT::MessageExtractor
48
48
  end
49
49
  end
50
50
 
51
- def extract_text text, comment, location = nil
51
+ def extract_text(text, comment, location = nil)
52
52
  return if text.nil?
53
53
 
54
54
  options = {
@@ -61,7 +61,7 @@ class RDoc::Generator::POT::MessageExtractor
61
61
  end
62
62
  end
63
63
 
64
- def entry msgid, options
64
+ def entry(msgid, options)
65
65
  RDoc::Generator::POT::POEntry.new(msgid, options)
66
66
  end
67
67
 
@@ -15,7 +15,7 @@ class RDoc::Generator::POT::PO
15
15
  ##
16
16
  # Adds a PO entry to the PO.
17
17
 
18
- def add entry
18
+ def add(entry)
19
19
  existing_entry = @entries[entry.msgid]
20
20
  if existing_entry
21
21
  entry = existing_entry.merge(entry)
@@ -26,7 +26,7 @@ class RDoc::Generator::POT::POEntry
26
26
  # Creates a PO entry for +msgid+. Other values can be specified by
27
27
  # +options+.
28
28
 
29
- def initialize msgid, options = {}
29
+ def initialize(msgid, options = {})
30
30
  @msgid = msgid
31
31
  @msgstr = options[:msgstr] || ""
32
32
  @translator_comment = options[:translator_comment]
@@ -53,7 +53,7 @@ msgstr #{format_message(@msgstr)}
53
53
  ##
54
54
  # Merges the PO entry with +other_entry+.
55
55
 
56
- def merge other_entry
56
+ def merge(other_entry)
57
57
  options = {
58
58
  :extracted_comment => merge_string(@extracted_comment,
59
59
  other_entry.extracted_comment),
@@ -69,7 +69,7 @@ msgstr #{format_message(@msgstr)}
69
69
 
70
70
  private
71
71
 
72
- def format_comment mark, comment
72
+ def format_comment(mark, comment)
73
73
  return '' unless comment
74
74
  return '' if comment.empty?
75
75
 
@@ -106,7 +106,7 @@ msgstr #{format_message(@msgstr)}
106
106
  "\#, #{formatted_flags}\n"
107
107
  end
108
108
 
109
- def format_message message
109
+ def format_message(message)
110
110
  return "\"#{escape(message)}\"" unless message.include?("\n")
111
111
 
112
112
  formatted_message = '""'
@@ -117,7 +117,7 @@ msgstr #{format_message(@msgstr)}
117
117
  formatted_message
118
118
  end
119
119
 
120
- def escape string
120
+ def escape(string)
121
121
  string.gsub(/["\\\t\n]/) do |special_character|
122
122
  case special_character
123
123
  when "\t"
@@ -130,11 +130,11 @@ msgstr #{format_message(@msgstr)}
130
130
  end
131
131
  end
132
132
 
133
- def merge_string string1, string2
133
+ def merge_string(string1, string2)
134
134
  [string1, string2].compact.join("\n")
135
135
  end
136
136
 
137
- def merge_array array1, array2
137
+ def merge_array(array1, array2)
138
138
  (array1 + array2).uniq
139
139
  end
140
140
 
@@ -65,7 +65,7 @@ class RDoc::Generator::POT
65
65
  ##
66
66
  # Set up a new .pot generator
67
67
 
68
- def initialize store, options #:not-new:
68
+ def initialize(store, options) #:not-new:
69
69
  @options = options
70
70
  @store = store
71
71
  end
@@ -14,7 +14,7 @@ class RDoc::Generator::RI
14
14
  ##
15
15
  # Set up a new ri generator
16
16
 
17
- def initialize store, options #:not-new:
17
+ def initialize(store, options) #:not-new:
18
18
  @options = options
19
19
  @store = store
20
20
  @store.path = '.'
@@ -25,6 +25,11 @@
25
25
  <%- end -%>
26
26
  <%- end -%>
27
27
 
28
+ <%- if canonical_url = @options.canonical_root -%>
29
+ <% canonical_url = current.canonical_url if defined?(current) %>
30
+ <link rel="canonical" href="<%= canonical_url %>">
31
+ <%- end -%>
32
+
28
33
  <script type="text/javascript">
29
34
  var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
30
35
  var index_rel_prefix = "<%= h rel_prefix %>/";
@@ -96,6 +96,8 @@ main .anchor-link:target {
96
96
  a {
97
97
  color: var(--link-color);
98
98
  transition: color 0.3s ease;
99
+ text-decoration: underline;
100
+ text-underline-offset: 0.2em; /* Make sure it doesn't overlap with underscores in a method name. */
99
101
  }
100
102
 
101
103
  a:hover {
@@ -107,7 +107,7 @@ class RDoc::Markup::AttributeManager
107
107
  ##
108
108
  # Changes the current attribute from +current+ to +new+
109
109
 
110
- def change_attribute current, new
110
+ def change_attribute(current, new)
111
111
  diff = current ^ new
112
112
  attribute(new & diff, current & diff)
113
113
  end
@@ -116,7 +116,7 @@ class RDoc::Markup::AttributeManager
116
116
  # Used by the tests to change attributes by name from +current_set+ to
117
117
  # +new_set+
118
118
 
119
- def changed_attribute_by_name current_set, new_set
119
+ def changed_attribute_by_name(current_set, new_set)
120
120
  current = new = 0
121
121
  current_set.each do |name|
122
122
  current |= @attributes.bitmap_for(name)
@@ -220,7 +220,7 @@ class RDoc::Markup::AttributeManager
220
220
  ##
221
221
  # Converts regexp handling sequences to RDoc attributes
222
222
 
223
- def convert_regexp_handlings str, attrs, exclusive = false
223
+ def convert_regexp_handlings(str, attrs, exclusive = false)
224
224
  @regexp_handlings.each do |regexp, attribute|
225
225
  next unless exclusive == exclusive?(attribute)
226
226
  str.scan(regexp) do
@@ -295,7 +295,7 @@ class RDoc::Markup::AttributeManager
295
295
  #
296
296
  # @am.add_regexp_handling(/((https?:)\S+\w)/, :HYPERLINK)
297
297
 
298
- def add_regexp_handling pattern, name, exclusive = false
298
+ def add_regexp_handling(pattern, name, exclusive = false)
299
299
  bitmap = @attributes.bitmap_for(name)
300
300
  @regexp_handlings << [pattern, bitmap]
301
301
  @exclusive_bitmap |= bitmap if exclusive
@@ -304,7 +304,7 @@ class RDoc::Markup::AttributeManager
304
304
  ##
305
305
  # Processes +str+ converting attributes, HTML and regexp handlings
306
306
 
307
- def flow str
307
+ def flow(str)
308
308
  @str = str.dup
309
309
 
310
310
  mask_protected_sequences
@@ -26,7 +26,7 @@ class RDoc::Markup::Attributes
26
26
  ##
27
27
  # Returns a unique bit for +name+
28
28
 
29
- def bitmap_for name
29
+ def bitmap_for(name)
30
30
  bitmap = @name_to_bitmap.assoc name
31
31
 
32
32
  unless bitmap then
@@ -43,7 +43,7 @@ class RDoc::Markup::Attributes
43
43
  ##
44
44
  # Returns a string representation of +bitmap+
45
45
 
46
- def as_string bitmap
46
+ def as_string(bitmap)
47
47
  return 'none' if bitmap.zero?
48
48
  res = []
49
49
 
@@ -57,7 +57,7 @@ class RDoc::Markup::Attributes
57
57
  ##
58
58
  # yields each attribute name in +bitmap+
59
59
 
60
- def each_name_of bitmap
60
+ def each_name_of(bitmap)
61
61
  return enum_for __method__, bitmap unless block_given?
62
62
 
63
63
  @name_to_bitmap.each do |name, bit|
@@ -16,11 +16,11 @@ class RDoc::Markup::BlankLine
16
16
  ##
17
17
  # Calls #accept_blank_line on +visitor+
18
18
 
19
- def accept visitor
19
+ def accept(visitor)
20
20
  visitor.accept_blank_line self
21
21
  end
22
22
 
23
- def pretty_print q # :nodoc:
23
+ def pretty_print(q) # :nodoc:
24
24
  q.text 'blankline'
25
25
  end
26
26
 
@@ -7,7 +7,7 @@ class RDoc::Markup::BlockQuote < RDoc::Markup::Raw
7
7
  ##
8
8
  # Calls #accept_block_quote on +visitor+
9
9
 
10
- def accept visitor
10
+ def accept(visitor)
11
11
  visitor.accept_block_quote self
12
12
  end
13
13
 
@@ -37,7 +37,7 @@ class RDoc::Markup::Document
37
37
  ##
38
38
  # Appends +part+ to the document
39
39
 
40
- def << part
40
+ def <<(part)
41
41
  case part
42
42
  when RDoc::Markup::Document then
43
43
  unless part.empty? then
@@ -53,7 +53,7 @@ class RDoc::Markup::Document
53
53
  end
54
54
  end
55
55
 
56
- def == other # :nodoc:
56
+ def ==(other) # :nodoc:
57
57
  self.class == other.class and
58
58
  @file == other.file and
59
59
  @parts == other.parts
@@ -62,7 +62,7 @@ class RDoc::Markup::Document
62
62
  ##
63
63
  # Runs this document and all its #items through +visitor+
64
64
 
65
- def accept visitor
65
+ def accept(visitor)
66
66
  visitor.start_accepting
67
67
 
68
68
  visitor.accept_document self
@@ -73,14 +73,14 @@ class RDoc::Markup::Document
73
73
  ##
74
74
  # Concatenates the given +parts+ onto the document
75
75
 
76
- def concat parts
76
+ def concat(parts)
77
77
  self.parts.concat parts
78
78
  end
79
79
 
80
80
  ##
81
81
  # Enumerator for the parts of this document
82
82
 
83
- def each &block
83
+ def each(&block)
84
84
  @parts.each(&block)
85
85
  end
86
86
 
@@ -94,7 +94,7 @@ class RDoc::Markup::Document
94
94
  ##
95
95
  # The file this Document was created from.
96
96
 
97
- def file= location
97
+ def file=(location)
98
98
  @file = case location
99
99
  when RDoc::TopLevel then
100
100
  location.relative_name
@@ -111,7 +111,7 @@ class RDoc::Markup::Document
111
111
  #
112
112
  # The information in +other+ is preferred over the receiver
113
113
 
114
- def merge other
114
+ def merge(other)
115
115
  if empty? then
116
116
  @parts = other.parts
117
117
  return self
@@ -135,7 +135,7 @@ class RDoc::Markup::Document
135
135
  RDoc::Markup::Document === @parts.first
136
136
  end
137
137
 
138
- def pretty_print q # :nodoc:
138
+ def pretty_print(q) # :nodoc:
139
139
  start = @file ? "[doc (#{@file}): " : '[doc: '
140
140
 
141
141
  q.group 2, start, ']' do