rdoc 6.12.0 → 6.14.2

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 +51 -6
  38. data/lib/rdoc/markdown.rb +80 -24
  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 +71 -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 {
@@ -496,6 +496,46 @@
496
496
  "<s>#{text}</s>"
497
497
  end
498
498
  end
499
+
500
+ ##
501
+ # Parses inline markdown in table cells
502
+
503
+ def parse_table_cells(table)
504
+ # Parse header cells
505
+ table.header = table.header.map { |cell| parse_cell_inline(cell) }
506
+
507
+ # Parse body cells
508
+ table.body = table.body.map do |row|
509
+ row.map { |cell| parse_cell_inline(cell) }
510
+ end
511
+
512
+ table
513
+ end
514
+
515
+ ##
516
+ # Parses inline markdown in a single table cell
517
+
518
+ def parse_cell_inline(text)
519
+ return text if text.nil? || text.empty?
520
+
521
+ # Create a new parser instance for the cell
522
+ cell_parser = RDoc::Markdown.new(@extensions, @debug)
523
+
524
+ # Parse the cell content
525
+ doc = cell_parser.parse(text)
526
+
527
+ # Extract the parsed content
528
+ if doc && doc.parts && !doc.parts.empty?
529
+ para = doc.parts.first
530
+ if para.is_a?(RDoc::Markup::Paragraph)
531
+ para.parts.join
532
+ else
533
+ text
534
+ end
535
+ else
536
+ text
537
+ end
538
+ end
499
539
  }
500
540
 
501
541
  root = Doc
@@ -992,9 +1032,8 @@ Strike = &{ strike? }
992
1032
  "~~"
993
1033
  { strike a.join }
994
1034
 
995
- # TODO alt text support
996
- Image = "!" ( ExplicitLink | ReferenceLink ):a
997
- { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
1035
+ Image = "!" ExplicitLinkWithLabel:a
1036
+ { "rdoc-image:#{a[:link]}:#{a[:label]}" }
998
1037
 
999
1038
  Link = ExplicitLink | ReferenceLink | AutoLink
1000
1039
 
@@ -1006,8 +1045,11 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label
1006
1045
  ReferenceLinkSingle = Label:content < (Spnl "[]")? >
1007
1046
  { link_to content, content, text }
1008
1047
 
1009
- ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")"
1010
- { "{#{l}}[#{s}]" }
1048
+ ExplicitLink = ExplicitLinkWithLabel:a
1049
+ { "{#{a[:label]}}[#{a[:link]}]" }
1050
+
1051
+ ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")"
1052
+ { { label: label, link: link } }
1011
1053
 
1012
1054
  Source = ( "<" < SourceContents > ">" | < SourceContents > )
1013
1055
  { text }
@@ -1199,7 +1241,10 @@ CodeFence = &{ github? }
1199
1241
 
1200
1242
  Table = &{ github? }
1201
1243
  TableHead:header TableLine:line TableRow+:body
1202
- { table = RDoc::Markup::Table.new(header, line, body) }
1244
+ {
1245
+ table = RDoc::Markup::Table.new(header, line, body)
1246
+ parse_table_cells(table)
1247
+ }
1203
1248
 
1204
1249
  TableHead = TableItem2+:items "|"? @Newline
1205
1250
  { items }
data/lib/rdoc/markdown.rb CHANGED
@@ -882,6 +882,46 @@ class RDoc::Markdown
882
882
  end
883
883
  end
884
884
 
885
+ ##
886
+ # Parses inline markdown in table cells
887
+
888
+ def parse_table_cells(table)
889
+ # Parse header cells
890
+ table.header = table.header.map { |cell| parse_cell_inline(cell) }
891
+
892
+ # Parse body cells
893
+ table.body = table.body.map do |row|
894
+ row.map { |cell| parse_cell_inline(cell) }
895
+ end
896
+
897
+ table
898
+ end
899
+
900
+ ##
901
+ # Parses inline markdown in a single table cell
902
+
903
+ def parse_cell_inline(text)
904
+ return text if text.nil? || text.empty?
905
+
906
+ # Create a new parser instance for the cell
907
+ cell_parser = RDoc::Markdown.new(@extensions, @debug)
908
+
909
+ # Parse the cell content
910
+ doc = cell_parser.parse(text)
911
+
912
+ # Extract the parsed content
913
+ if doc && doc.parts && !doc.parts.empty?
914
+ para = doc.parts.first
915
+ if para.is_a?(RDoc::Markup::Paragraph)
916
+ para.parts.join
917
+ else
918
+ text
919
+ end
920
+ else
921
+ text
922
+ end
923
+ end
924
+
885
925
 
886
926
  # :stopdoc:
887
927
  def setup_foreign_grammar
@@ -10978,7 +11018,7 @@ class RDoc::Markdown
10978
11018
  return _tmp
10979
11019
  end
10980
11020
 
10981
- # Image = "!" (ExplicitLink | ReferenceLink):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
11021
+ # Image = "!" ExplicitLinkWithLabel:a { "rdoc-image:#{a[:link]}:#{a[:label]}" }
10982
11022
  def _Image
10983
11023
 
10984
11024
  _save = self.pos
@@ -10988,24 +11028,13 @@ class RDoc::Markdown
10988
11028
  self.pos = _save
10989
11029
  break
10990
11030
  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
-
11031
+ _tmp = apply(:_ExplicitLinkWithLabel)
11003
11032
  a = @result
11004
11033
  unless _tmp
11005
11034
  self.pos = _save
11006
11035
  break
11007
11036
  end
11008
- @result = begin; "rdoc-image:#{a[/\[(.*)\]/, 1]}" ; end
11037
+ @result = begin; "rdoc-image:#{a[:link]}:#{a[:label]}" ; end
11009
11038
  _tmp = true
11010
11039
  unless _tmp
11011
11040
  self.pos = _save
@@ -11153,13 +11182,36 @@ class RDoc::Markdown
11153
11182
  return _tmp
11154
11183
  end
11155
11184
 
11156
- # ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" }
11185
+ # ExplicitLink = ExplicitLinkWithLabel:a { "{#{a[:label]}}[#{a[:link]}]" }
11157
11186
  def _ExplicitLink
11158
11187
 
11188
+ _save = self.pos
11189
+ while true # sequence
11190
+ _tmp = apply(:_ExplicitLinkWithLabel)
11191
+ a = @result
11192
+ unless _tmp
11193
+ self.pos = _save
11194
+ break
11195
+ end
11196
+ @result = begin; "{#{a[:label]}}[#{a[:link]}]" ; end
11197
+ _tmp = true
11198
+ unless _tmp
11199
+ self.pos = _save
11200
+ end
11201
+ break
11202
+ end # end sequence
11203
+
11204
+ set_failed_rule :_ExplicitLink unless _tmp
11205
+ return _tmp
11206
+ end
11207
+
11208
+ # ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")" { { label: label, link: link } }
11209
+ def _ExplicitLinkWithLabel
11210
+
11159
11211
  _save = self.pos
11160
11212
  while true # sequence
11161
11213
  _tmp = apply(:_Label)
11162
- l = @result
11214
+ label = @result
11163
11215
  unless _tmp
11164
11216
  self.pos = _save
11165
11217
  break
@@ -11175,7 +11227,7 @@ class RDoc::Markdown
11175
11227
  break
11176
11228
  end
11177
11229
  _tmp = apply(:_Source)
11178
- s = @result
11230
+ link = @result
11179
11231
  unless _tmp
11180
11232
  self.pos = _save
11181
11233
  break
@@ -11200,7 +11252,7 @@ class RDoc::Markdown
11200
11252
  self.pos = _save
11201
11253
  break
11202
11254
  end
11203
- @result = begin; "{#{l}}[#{s}]" ; end
11255
+ @result = begin; { label: label, link: link } ; end
11204
11256
  _tmp = true
11205
11257
  unless _tmp
11206
11258
  self.pos = _save
@@ -11208,7 +11260,7 @@ class RDoc::Markdown
11208
11260
  break
11209
11261
  end # end sequence
11210
11262
 
11211
- set_failed_rule :_ExplicitLink unless _tmp
11263
+ set_failed_rule :_ExplicitLinkWithLabel unless _tmp
11212
11264
  return _tmp
11213
11265
  end
11214
11266
 
@@ -15943,7 +15995,7 @@ class RDoc::Markdown
15943
15995
  return _tmp
15944
15996
  end
15945
15997
 
15946
- # Table = &{ github? } TableHead:header TableLine:line TableRow+:body { table = RDoc::Markup::Table.new(header, line, body) }
15998
+ # Table = &{ github? } TableHead:header TableLine:line TableRow+:body { table = RDoc::Markup::Table.new(header, line, body) parse_table_cells(table) }
15947
15999
  def _Table
15948
16000
 
15949
16001
  _save = self.pos
@@ -15987,7 +16039,10 @@ class RDoc::Markdown
15987
16039
  self.pos = _save
15988
16040
  break
15989
16041
  end
15990
- @result = begin; table = RDoc::Markup::Table.new(header, line, body) ; end
16042
+ @result = begin;
16043
+ table = RDoc::Markup::Table.new(header, line, body)
16044
+ parse_table_cells(table)
16045
+ ; end
15991
16046
  _tmp = true
15992
16047
  unless _tmp
15993
16048
  self.pos = _save
@@ -16711,12 +16766,13 @@ class RDoc::Markdown
16711
16766
  Rules[:_StrongStar] = rule_info("StrongStar", "\"**\" !@Whitespace @StartList:a (!\"**\" Inline:b { a << b })+ \"**\" { strong a.join }")
16712
16767
  Rules[:_StrongUl] = rule_info("StrongUl", "\"__\" !@Whitespace @StartList:a (!\"__\" Inline:b { a << b })+ \"__\" { strong a.join }")
16713
16768
  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]}\" }")
16769
+ Rules[:_Image] = rule_info("Image", "\"!\" ExplicitLinkWithLabel:a { \"rdoc-image:\#{a[:link]}:\#{a[:label]}\" }")
16715
16770
  Rules[:_Link] = rule_info("Link", "(ExplicitLink | ReferenceLink | AutoLink)")
16716
16771
  Rules[:_ReferenceLink] = rule_info("ReferenceLink", "(ReferenceLinkDouble | ReferenceLinkSingle)")
16717
16772
  Rules[:_ReferenceLinkDouble] = rule_info("ReferenceLinkDouble", "Label:content < Spnl > !\"[]\" Label:label { link_to content, label, text }")
16718
16773
  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}]\" }")
16774
+ Rules[:_ExplicitLink] = rule_info("ExplicitLink", "ExplicitLinkWithLabel:a { \"{\#{a[:label]}}[\#{a[:link]}]\" }")
16775
+ Rules[:_ExplicitLinkWithLabel] = rule_info("ExplicitLinkWithLabel", "Label:label \"(\" @Sp Source:link Spnl Title @Sp \")\" { { label: label, link: link } }")
16720
16776
  Rules[:_Source] = rule_info("Source", "(\"<\" < SourceContents > \">\" | < SourceContents >) { text }")
16721
16777
  Rules[:_SourceContents] = rule_info("SourceContents", "((!\"(\" !\")\" !\">\" Nonspacechar)+ | \"(\" SourceContents \")\")*")
16722
16778
  Rules[:_Title] = rule_info("Title", "(TitleSingle | TitleDouble | \"\"):a { a }")
@@ -16777,7 +16833,7 @@ class RDoc::Markdown
16777
16833
  Rules[:_Notes] = rule_info("Notes", "(Note | SkipBlock)*")
16778
16834
  Rules[:_RawNoteBlock] = rule_info("RawNoteBlock", "@StartList:a (!@BlankLine !RawNoteReference OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }")
16779
16835
  Rules[:_CodeFence] = rule_info("CodeFence", "&{ github? } Ticks3 (@Sp StrChunk:format)? Spnl < ((!\"`\" Nonspacechar)+ | !Ticks3 /`+/ | Spacechar | @Newline)+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format.instance_of?(String) verbatim }")
16780
- Rules[:_Table] = rule_info("Table", "&{ github? } TableHead:header TableLine:line TableRow+:body { table = RDoc::Markup::Table.new(header, line, body) }")
16836
+ Rules[:_Table] = rule_info("Table", "&{ github? } TableHead:header TableLine:line TableRow+:body { table = RDoc::Markup::Table.new(header, line, body) parse_table_cells(table) }")
16781
16837
  Rules[:_TableHead] = rule_info("TableHead", "TableItem2+:items \"|\"? @Newline { items }")
16782
16838
  Rules[:_TableRow] = rule_info("TableRow", "((TableItem:item1 TableItem2*:items { [item1, *items] }):row | TableItem2+:row) \"|\"? @Newline { row }")
16783
16839
  Rules[:_TableItem2] = rule_info("TableItem2", "\"|\" TableItem")
@@ -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