rdoc 6.12.0 → 6.14.1

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -1
  3. data/lib/rdoc/code_object/alias.rb +2 -9
  4. data/lib/rdoc/code_object/any_method.rb +9 -14
  5. data/lib/rdoc/code_object/attr.rb +6 -9
  6. data/lib/rdoc/code_object/class_module.rb +40 -23
  7. data/lib/rdoc/code_object/constant.rb +5 -5
  8. data/lib/rdoc/code_object/context/section.rb +8 -7
  9. data/lib/rdoc/code_object/context.rb +23 -65
  10. data/lib/rdoc/code_object/method_attr.rb +9 -28
  11. data/lib/rdoc/code_object/mixin.rb +3 -3
  12. data/lib/rdoc/code_object/normal_class.rb +1 -1
  13. data/lib/rdoc/code_object/normal_module.rb +1 -1
  14. data/lib/rdoc/code_object/require.rb +1 -1
  15. data/lib/rdoc/code_object/single_class.rb +1 -1
  16. data/lib/rdoc/code_object/top_level.rb +12 -30
  17. data/lib/rdoc/code_object.rb +6 -37
  18. data/lib/rdoc/comment.rb +7 -10
  19. data/lib/rdoc/cross_reference.rb +3 -3
  20. data/lib/rdoc/encoding.rb +4 -4
  21. data/lib/rdoc/erb_partial.rb +1 -1
  22. data/lib/rdoc/erbio.rb +2 -2
  23. data/lib/rdoc/generator/darkfish.rb +97 -109
  24. data/lib/rdoc/generator/json_index.rb +4 -20
  25. data/lib/rdoc/generator/markup.rb +14 -2
  26. data/lib/rdoc/generator/pot/message_extractor.rb +6 -6
  27. data/lib/rdoc/generator/pot/po.rb +1 -1
  28. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  29. data/lib/rdoc/generator/pot.rb +1 -6
  30. data/lib/rdoc/generator/ri.rb +1 -1
  31. data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  35. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
  36. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +15 -0
  37. data/lib/rdoc/markdown.kpeg +7 -5
  38. data/lib/rdoc/markdown.rb +34 -21
  39. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  40. data/lib/rdoc/markup/attributes.rb +3 -3
  41. data/lib/rdoc/markup/blank_line.rb +2 -2
  42. data/lib/rdoc/markup/block_quote.rb +1 -1
  43. data/lib/rdoc/markup/document.rb +8 -8
  44. data/lib/rdoc/markup/formatter.rb +12 -12
  45. data/lib/rdoc/markup/hard_break.rb +3 -3
  46. data/lib/rdoc/markup/heading.rb +11 -5
  47. data/lib/rdoc/markup/include.rb +3 -3
  48. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  49. data/lib/rdoc/markup/list.rb +4 -4
  50. data/lib/rdoc/markup/list_item.rb +4 -4
  51. data/lib/rdoc/markup/paragraph.rb +2 -2
  52. data/lib/rdoc/markup/parser.rb +11 -11
  53. data/lib/rdoc/markup/pre_process.rb +6 -6
  54. data/lib/rdoc/markup/raw.rb +5 -5
  55. data/lib/rdoc/markup/rule.rb +2 -2
  56. data/lib/rdoc/markup/table.rb +4 -4
  57. data/lib/rdoc/markup/to_ansi.rb +3 -3
  58. data/lib/rdoc/markup/to_bs.rb +6 -6
  59. data/lib/rdoc/markup/to_html.rb +25 -16
  60. data/lib/rdoc/markup/to_html_crossref.rb +5 -5
  61. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  62. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  63. data/lib/rdoc/markup/to_label.rb +6 -5
  64. data/lib/rdoc/markup/to_markdown.rb +12 -12
  65. data/lib/rdoc/markup/to_rdoc.rb +29 -28
  66. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  67. data/lib/rdoc/markup/to_test.rb +1 -1
  68. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  69. data/lib/rdoc/markup/verbatim.rb +3 -3
  70. data/lib/rdoc/markup.rb +3 -3
  71. data/lib/rdoc/options.rb +31 -12
  72. data/lib/rdoc/parser/c.rb +20 -23
  73. data/lib/rdoc/parser/changelog.rb +9 -9
  74. data/lib/rdoc/parser/prism_ruby.rb +9 -16
  75. data/lib/rdoc/parser/ruby.rb +50 -53
  76. data/lib/rdoc/parser/simple.rb +2 -2
  77. data/lib/rdoc/parser.rb +8 -8
  78. data/lib/rdoc/rd/inline.rb +4 -4
  79. data/lib/rdoc/rd.rb +1 -1
  80. data/lib/rdoc/rdoc.rb +11 -26
  81. data/lib/rdoc/ri/driver.rb +60 -52
  82. data/lib/rdoc/ri/paths.rb +2 -2
  83. data/lib/rdoc/ri/task.rb +1 -1
  84. data/lib/rdoc/rubygems_hook.rb +14 -17
  85. data/lib/rdoc/servlet.rb +23 -22
  86. data/lib/rdoc/stats/normal.rb +1 -1
  87. data/lib/rdoc/stats/quiet.rb +1 -1
  88. data/lib/rdoc/stats/verbose.rb +3 -3
  89. data/lib/rdoc/stats.rb +14 -14
  90. data/lib/rdoc/store.rb +39 -43
  91. data/lib/rdoc/task.rb +2 -2
  92. data/lib/rdoc/text.rb +13 -13
  93. data/lib/rdoc/token_stream.rb +1 -1
  94. data/lib/rdoc/tom_doc.rb +7 -7
  95. data/lib/rdoc/version.rb +1 -1
  96. data/man/ri.1 +2 -0
  97. data/rdoc.gemspec +69 -0
  98. metadata +18 -5
  99. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  100. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
@@ -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
@@ -81,11 +81,6 @@ class RDoc::Generator::POT
81
81
  end
82
82
  end
83
83
 
84
- # :nodoc:
85
- def class_dir
86
- nil
87
- end
88
-
89
84
  private
90
85
  def extract_messages
91
86
  extractor = MessageExtractor.new(@store)
@@ -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 %>/";
@@ -1,34 +1,5 @@
1
1
  <div id="classindex-section" class="nav-section">
2
2
  <h3>Class and Module Index</h3>
3
3
 
4
- <%-
5
- all_classes = @classes.group_by do |klass|
6
- klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
7
- end.delete_if do |_, klasses|
8
- !klasses.any?(&:display?)
9
- end
10
- link = proc do |index_klass, display = index_klass.display?|
11
- if display
12
- -%><code><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a></code><%-
13
- else
14
- -%><code><%= index_klass.name %></code><%-
15
- end
16
- end
17
- if top = all_classes[nil]
18
- solo = top.one? {|klass| klass.display?}
19
- traverse = proc do |klasses| -%>
20
- <ul class="link-list">
21
- <%- klasses.uniq!(&:full_name) -%>
22
- <%- klasses.each do |index_klass| -%>
23
- <%- if children = all_classes[index_klass.full_name] -%>
24
- <li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
25
- <%- traverse.call(children) -%>
26
- </ul></details>
27
- <%- elsif index_klass.display? -%>
28
- <li><% link.call(index_klass, true) %>
29
- <%- end -%>
30
- <%- end -%>
31
- <%- end -%>
32
- <%- traverse.call(top) -%>
33
- <%- end -%>
4
+ <%= generate_class_index_content(@classes, rel_prefix) %>
34
5
  </div>
@@ -3,7 +3,7 @@
3
3
  <h3>Extended With Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <%- klass.each_extend do |ext| -%>
6
+ <%- klass.extends.each do |ext| -%>
7
7
  <%- unless String === ext.module then -%>
8
8
  <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
9
9
  <%- else -%>
@@ -3,7 +3,7 @@
3
3
  <h3>Included Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <%- klass.each_include do |inc| -%>
6
+ <%- klass.includes.each do |inc| -%>
7
7
  <%- unless String === inc.module then -%>
8
8
  <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
9
9
  <%- else -%>
@@ -18,6 +18,21 @@
18
18
  </nav>
19
19
 
20
20
  <main role="main" aria-labelledby="<%=h klass.aref %>">
21
+ <%# If nesting level is 1, breadcrumb list is not needed %>
22
+ <% if breadcrumb.size > 1 %>
23
+ <ol role="navigation" aria-label="breadcrumb" class="breadcrumb">
24
+ <% breadcrumb.each do |namespace| %>
25
+ <li>
26
+ <% if namespace[:self] %>
27
+ <span><%= namespace[:name] %></span>
28
+ <% else %>
29
+ <a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span>::</span>
30
+ <% end %>
31
+ </li>
32
+ <% end %>
33
+ </ol>
34
+ <% end %>
35
+
21
36
  <h1 id="<%=h klass.aref %>" class="anchor-link <%= klass.type %>">
22
37
  <%= klass.type %> <%= klass.full_name %>
23
38
  </h1>
@@ -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 {
@@ -199,6 +201,19 @@ nav h3,
199
201
  font-size: 1em;
200
202
  }
201
203
 
204
+ ol.breadcrumb {
205
+ display: flex;
206
+
207
+ padding: 0;
208
+ margin: 0 0 1em;
209
+ }
210
+
211
+ ol.breadcrumb li {
212
+ display: block;
213
+ list-style: none;
214
+ font-size: 125%;
215
+ }
216
+
202
217
  nav ul,
203
218
  nav dl,
204
219
  nav p {
@@ -992,9 +992,8 @@ Strike = &{ strike? }
992
992
  "~~"
993
993
  { strike a.join }
994
994
 
995
- # TODO alt text support
996
- Image = "!" ( ExplicitLink | ReferenceLink ):a
997
- { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
995
+ Image = "!" ExplicitLinkWithLabel:a
996
+ { "rdoc-image:#{a[:link]}:#{a[:label]}" }
998
997
 
999
998
  Link = ExplicitLink | ReferenceLink | AutoLink
1000
999
 
@@ -1006,8 +1005,11 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label
1006
1005
  ReferenceLinkSingle = Label:content < (Spnl "[]")? >
1007
1006
  { link_to content, content, text }
1008
1007
 
1009
- ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")"
1010
- { "{#{l}}[#{s}]" }
1008
+ ExplicitLink = ExplicitLinkWithLabel:a
1009
+ { "{#{a[:label]}}[#{a[:link]}]" }
1010
+
1011
+ ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")"
1012
+ { { label: label, link: link } }
1011
1013
 
1012
1014
  Source = ( "<" < SourceContents > ">" | < SourceContents > )
1013
1015
  { text }
data/lib/rdoc/markdown.rb CHANGED
@@ -10978,7 +10978,7 @@ class RDoc::Markdown
10978
10978
  return _tmp
10979
10979
  end
10980
10980
 
10981
- # Image = "!" (ExplicitLink | ReferenceLink):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
10981
+ # Image = "!" ExplicitLinkWithLabel:a { "rdoc-image:#{a[:link]}:#{a[:label]}" }
10982
10982
  def _Image
10983
10983
 
10984
10984
  _save = self.pos
@@ -10988,24 +10988,13 @@ class RDoc::Markdown
10988
10988
  self.pos = _save
10989
10989
  break
10990
10990
  end
10991
-
10992
- _save1 = self.pos
10993
- while true # choice
10994
- _tmp = apply(:_ExplicitLink)
10995
- break if _tmp
10996
- self.pos = _save1
10997
- _tmp = apply(:_ReferenceLink)
10998
- break if _tmp
10999
- self.pos = _save1
11000
- break
11001
- end # end choice
11002
-
10991
+ _tmp = apply(:_ExplicitLinkWithLabel)
11003
10992
  a = @result
11004
10993
  unless _tmp
11005
10994
  self.pos = _save
11006
10995
  break
11007
10996
  end
11008
- @result = begin; "rdoc-image:#{a[/\[(.*)\]/, 1]}" ; end
10997
+ @result = begin; "rdoc-image:#{a[:link]}:#{a[:label]}" ; end
11009
10998
  _tmp = true
11010
10999
  unless _tmp
11011
11000
  self.pos = _save
@@ -11153,13 +11142,36 @@ class RDoc::Markdown
11153
11142
  return _tmp
11154
11143
  end
11155
11144
 
11156
- # ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" }
11145
+ # ExplicitLink = ExplicitLinkWithLabel:a { "{#{a[:label]}}[#{a[:link]}]" }
11157
11146
  def _ExplicitLink
11158
11147
 
11148
+ _save = self.pos
11149
+ while true # sequence
11150
+ _tmp = apply(:_ExplicitLinkWithLabel)
11151
+ a = @result
11152
+ unless _tmp
11153
+ self.pos = _save
11154
+ break
11155
+ end
11156
+ @result = begin; "{#{a[:label]}}[#{a[:link]}]" ; end
11157
+ _tmp = true
11158
+ unless _tmp
11159
+ self.pos = _save
11160
+ end
11161
+ break
11162
+ end # end sequence
11163
+
11164
+ set_failed_rule :_ExplicitLink unless _tmp
11165
+ return _tmp
11166
+ end
11167
+
11168
+ # ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")" { { label: label, link: link } }
11169
+ def _ExplicitLinkWithLabel
11170
+
11159
11171
  _save = self.pos
11160
11172
  while true # sequence
11161
11173
  _tmp = apply(:_Label)
11162
- l = @result
11174
+ label = @result
11163
11175
  unless _tmp
11164
11176
  self.pos = _save
11165
11177
  break
@@ -11175,7 +11187,7 @@ class RDoc::Markdown
11175
11187
  break
11176
11188
  end
11177
11189
  _tmp = apply(:_Source)
11178
- s = @result
11190
+ link = @result
11179
11191
  unless _tmp
11180
11192
  self.pos = _save
11181
11193
  break
@@ -11200,7 +11212,7 @@ class RDoc::Markdown
11200
11212
  self.pos = _save
11201
11213
  break
11202
11214
  end
11203
- @result = begin; "{#{l}}[#{s}]" ; end
11215
+ @result = begin; { label: label, link: link } ; end
11204
11216
  _tmp = true
11205
11217
  unless _tmp
11206
11218
  self.pos = _save
@@ -11208,7 +11220,7 @@ class RDoc::Markdown
11208
11220
  break
11209
11221
  end # end sequence
11210
11222
 
11211
- set_failed_rule :_ExplicitLink unless _tmp
11223
+ set_failed_rule :_ExplicitLinkWithLabel unless _tmp
11212
11224
  return _tmp
11213
11225
  end
11214
11226
 
@@ -16711,12 +16723,13 @@ class RDoc::Markdown
16711
16723
  Rules[:_StrongStar] = rule_info("StrongStar", "\"**\" !@Whitespace @StartList:a (!\"**\" Inline:b { a << b })+ \"**\" { strong a.join }")
16712
16724
  Rules[:_StrongUl] = rule_info("StrongUl", "\"__\" !@Whitespace @StartList:a (!\"__\" Inline:b { a << b })+ \"__\" { strong a.join }")
16713
16725
  Rules[:_Strike] = rule_info("Strike", "&{ strike? } \"~~\" !@Whitespace @StartList:a (!\"~~\" Inline:b { a << b })+ \"~~\" { strike a.join }")
16714
- Rules[:_Image] = rule_info("Image", "\"!\" (ExplicitLink | ReferenceLink):a { \"rdoc-image:\#{a[/\\[(.*)\\]/, 1]}\" }")
16726
+ Rules[:_Image] = rule_info("Image", "\"!\" ExplicitLinkWithLabel:a { \"rdoc-image:\#{a[:link]}:\#{a[:label]}\" }")
16715
16727
  Rules[:_Link] = rule_info("Link", "(ExplicitLink | ReferenceLink | AutoLink)")
16716
16728
  Rules[:_ReferenceLink] = rule_info("ReferenceLink", "(ReferenceLinkDouble | ReferenceLinkSingle)")
16717
16729
  Rules[:_ReferenceLinkDouble] = rule_info("ReferenceLinkDouble", "Label:content < Spnl > !\"[]\" Label:label { link_to content, label, text }")
16718
16730
  Rules[:_ReferenceLinkSingle] = rule_info("ReferenceLinkSingle", "Label:content < (Spnl \"[]\")? > { link_to content, content, text }")
16719
- Rules[:_ExplicitLink] = rule_info("ExplicitLink", "Label:l \"(\" @Sp Source:s Spnl Title @Sp \")\" { \"{\#{l}}[\#{s}]\" }")
16731
+ Rules[:_ExplicitLink] = rule_info("ExplicitLink", "ExplicitLinkWithLabel:a { \"{\#{a[:label]}}[\#{a[:link]}]\" }")
16732
+ Rules[:_ExplicitLinkWithLabel] = rule_info("ExplicitLinkWithLabel", "Label:label \"(\" @Sp Source:link Spnl Title @Sp \")\" { { label: label, link: link } }")
16720
16733
  Rules[:_Source] = rule_info("Source", "(\"<\" < SourceContents > \">\" | < SourceContents >) { text }")
16721
16734
  Rules[:_SourceContents] = rule_info("SourceContents", "((!\"(\" !\")\" !\">\" Nonspacechar)+ | \"(\" SourceContents \")\")*")
16722
16735
  Rules[:_Title] = rule_info("Title", "(TitleSingle | TitleDouble | \"\"):a { a }")
@@ -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
@@ -21,7 +21,7 @@ class RDoc::Markup::Formatter
21
21
  ##
22
22
  # Converts a target url to one that is relative to a given path
23
23
 
24
- def self.gen_relative_url path, target
24
+ def self.gen_relative_url(path, target)
25
25
  from = File.dirname path
26
26
  to, to_file = File.split target
27
27
 
@@ -45,7 +45,7 @@ class RDoc::Markup::Formatter
45
45
  ##
46
46
  # Creates a new Formatter
47
47
 
48
- def initialize options, markup = nil
48
+ def initialize(options, markup = nil)
49
49
  @options = options
50
50
 
51
51
  @markup = markup || RDoc::Markup.new
@@ -66,7 +66,7 @@ class RDoc::Markup::Formatter
66
66
  ##
67
67
  # Adds +document+ to the output
68
68
 
69
- def accept_document document
69
+ def accept_document(document)
70
70
  document.parts.each do |item|
71
71
  case item
72
72
  when RDoc::Markup::Document then # HACK
@@ -117,7 +117,7 @@ class RDoc::Markup::Formatter
117
117
  ##
118
118
  # Marks up +content+
119
119
 
120
- def convert content
120
+ def convert(content)
121
121
  @markup.convert content, self
122
122
  end
123
123
 
@@ -147,7 +147,7 @@ class RDoc::Markup::Formatter
147
147
  ##
148
148
  # Converts added regexp handlings. See RDoc::Markup#add_regexp_handling
149
149
 
150
- def convert_regexp_handling target
150
+ def convert_regexp_handling(target)
151
151
  return target.text if in_tt?
152
152
 
153
153
  handled = false
@@ -173,7 +173,7 @@ class RDoc::Markup::Formatter
173
173
  ##
174
174
  # Converts a string to be fancier if desired
175
175
 
176
- def convert_string string
176
+ def convert_string(string)
177
177
  string
178
178
  end
179
179
 
@@ -195,7 +195,7 @@ class RDoc::Markup::Formatter
195
195
  @in_tt > 0
196
196
  end
197
197
 
198
- def tt_tag? attr_mask, reverse = false
198
+ def tt_tag?(attr_mask, reverse = false)
199
199
  each_attr_tag(attr_mask, reverse) do |tag|
200
200
  return true if tt? tag
201
201
  end
@@ -205,7 +205,7 @@ class RDoc::Markup::Formatter
205
205
  ##
206
206
  # Turns on tags for +item+ on +res+
207
207
 
208
- def on_tags res, item
208
+ def on_tags(res, item)
209
209
  each_attr_tag(item.turn_on) do |tag|
210
210
  res << annotate(tag.on)
211
211
  @in_tt += 1 if tt? tag
@@ -215,14 +215,14 @@ class RDoc::Markup::Formatter
215
215
  ##
216
216
  # Turns off tags for +item+ on +res+
217
217
 
218
- def off_tags res, item
218
+ def off_tags(res, item)
219
219
  each_attr_tag(item.turn_off, true) do |tag|
220
220
  @in_tt -= 1 if tt? tag
221
221
  res << annotate(tag.off)
222
222
  end
223
223
  end
224
224
 
225
- def each_attr_tag attr_mask, reverse = false
225
+ def each_attr_tag(attr_mask, reverse = false)
226
226
  return if attr_mask.zero?
227
227
 
228
228
  @attr_tags.public_send(reverse ? :reverse_each : :each) do |tag|
@@ -235,7 +235,7 @@ class RDoc::Markup::Formatter
235
235
  ##
236
236
  # Extracts and a scheme, url and an anchor id from +url+ and returns them.
237
237
 
238
- def parse_url url
238
+ def parse_url(url)
239
239
  case url
240
240
  when /^rdoc-label:([^:]*)(?::(.*))?/ then
241
241
  scheme = 'link'
@@ -265,7 +265,7 @@ class RDoc::Markup::Formatter
265
265
  ##
266
266
  # Is +tag+ a tt tag?
267
267
 
268
- def tt? tag
268
+ def tt?(tag)
269
269
  tag.bit == @tt_bit
270
270
  end
271
271
 
@@ -16,15 +16,15 @@ class RDoc::Markup::HardBreak
16
16
  ##
17
17
  # Calls #accept_hard_break on +visitor+
18
18
 
19
- def accept visitor
19
+ def accept(visitor)
20
20
  visitor.accept_hard_break self
21
21
  end
22
22
 
23
- def == other # :nodoc:
23
+ def ==(other) # :nodoc:
24
24
  self.class === other
25
25
  end
26
26
 
27
- def pretty_print q # :nodoc:
27
+ def pretty_print(q) # :nodoc:
28
28
  q.text "[break]"
29
29
  end
30
30