rdoc 8.0.0 → 8.1.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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -3
  3. data/RI.md +75 -75
  4. data/exe/rdoc +2 -2
  5. data/lib/rdoc/code_object/alias.rb +71 -69
  6. data/lib/rdoc/code_object/any_method.rb +305 -303
  7. data/lib/rdoc/code_object/attr.rb +150 -148
  8. data/lib/rdoc/code_object/class_module.rb +798 -792
  9. data/lib/rdoc/code_object/constant.rb +175 -173
  10. data/lib/rdoc/code_object/context/section.rb +142 -138
  11. data/lib/rdoc/code_object/context.rb +926 -958
  12. data/lib/rdoc/code_object/extend.rb +7 -5
  13. data/lib/rdoc/code_object/include.rb +7 -5
  14. data/lib/rdoc/code_object/method_attr.rb +326 -319
  15. data/lib/rdoc/code_object/mixin.rb +97 -95
  16. data/lib/rdoc/code_object/normal_class.rb +77 -78
  17. data/lib/rdoc/code_object/normal_module.rb +61 -59
  18. data/lib/rdoc/code_object/require.rb +23 -39
  19. data/lib/rdoc/code_object/single_class.rb +21 -19
  20. data/lib/rdoc/code_object/top_level.rb +212 -219
  21. data/lib/rdoc/code_object.rb +305 -303
  22. data/lib/rdoc/comment.rb +275 -273
  23. data/lib/rdoc/cross_reference.rb +192 -190
  24. data/lib/rdoc/encoding.rb +105 -103
  25. data/lib/rdoc/erb_partial.rb +13 -11
  26. data/lib/rdoc/erbio.rb +29 -27
  27. data/lib/rdoc/generator/aliki.rb +161 -153
  28. data/lib/rdoc/generator/darkfish.rb +645 -635
  29. data/lib/rdoc/generator/json_index.rb +233 -229
  30. data/lib/rdoc/generator/markup.rb +164 -146
  31. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  32. data/lib/rdoc/generator/pot/po.rb +52 -51
  33. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  34. data/lib/rdoc/generator/pot.rb +85 -81
  35. data/lib/rdoc/generator/ri.rb +23 -19
  36. data/lib/rdoc/generator/template/aliki/DESIGN.md +6 -4
  37. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  38. data/lib/rdoc/generator/template/aliki/_head.rhtml +10 -10
  39. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  40. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  41. data/lib/rdoc/generator/template/aliki/css/rdoc.css +207 -178
  42. data/lib/rdoc/generator/template/aliki/js/aliki.js +60 -84
  43. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  44. data/lib/rdoc/generator.rb +48 -46
  45. data/lib/rdoc/i18n/locale.rb +99 -95
  46. data/lib/rdoc/i18n/text.rb +109 -105
  47. data/lib/rdoc/i18n.rb +7 -5
  48. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  49. data/lib/rdoc/markdown.kpeg +15 -11
  50. data/lib/rdoc/markdown.rb +40 -47
  51. data/lib/rdoc/markup/block_quote.rb +12 -8
  52. data/lib/rdoc/markup/document.rb +127 -123
  53. data/lib/rdoc/markup/formatter.rb +219 -215
  54. data/lib/rdoc/markup/include.rb +33 -29
  55. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  56. data/lib/rdoc/markup/inline_parser.rb +281 -277
  57. data/lib/rdoc/markup/list.rb +80 -88
  58. data/lib/rdoc/markup/list_item.rb +73 -85
  59. data/lib/rdoc/markup/paragraph.rb +23 -19
  60. data/lib/rdoc/markup/parser.rb +501 -497
  61. data/lib/rdoc/markup/pre_process.rb +283 -279
  62. data/lib/rdoc/markup/raw.rb +2 -2
  63. data/lib/rdoc/markup/rule.rb +16 -12
  64. data/lib/rdoc/markup/to_ansi.rb +143 -139
  65. data/lib/rdoc/markup/to_bs.rb +72 -68
  66. data/lib/rdoc/markup/to_html.rb +594 -565
  67. data/lib/rdoc/markup/to_html_crossref.rb +234 -230
  68. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  69. data/lib/rdoc/markup/to_joined_paragraph.rb +36 -32
  70. data/lib/rdoc/markup/to_label.rb +63 -59
  71. data/lib/rdoc/markup/to_markdown.rb +212 -208
  72. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  73. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  74. data/lib/rdoc/markup/to_test.rb +60 -56
  75. data/lib/rdoc/markup/to_tt_only.rb +84 -80
  76. data/lib/rdoc/markup/verbatim.rb +62 -58
  77. data/lib/rdoc/markup.rb +198 -196
  78. data/lib/rdoc/options.rb +1063 -1061
  79. data/lib/rdoc/parser/c.rb +1039 -1037
  80. data/lib/rdoc/parser/changelog.rb +319 -315
  81. data/lib/rdoc/parser/markdown.rb +17 -13
  82. data/lib/rdoc/parser/rbs.rb +239 -235
  83. data/lib/rdoc/parser/rd.rb +17 -13
  84. data/lib/rdoc/parser/ruby.rb +1245 -1124
  85. data/lib/rdoc/parser/ruby_colorizer.rb +263 -213
  86. data/lib/rdoc/parser/simple.rb +31 -27
  87. data/lib/rdoc/parser/text.rb +12 -8
  88. data/lib/rdoc/parser.rb +228 -220
  89. data/lib/rdoc/rbs_helper.rb +1 -1
  90. data/lib/rdoc/rd/inline.rb +57 -53
  91. data/lib/rdoc/rd.rb +90 -88
  92. data/lib/rdoc/rdoc.rb +500 -491
  93. data/lib/rdoc/ri/driver.rb +1140 -1135
  94. data/lib/rdoc/ri/formatter.rb +7 -3
  95. data/lib/rdoc/ri/paths.rb +140 -136
  96. data/lib/rdoc/ri/servlet.rb +354 -350
  97. data/lib/rdoc/ri/store.rb +4 -2
  98. data/lib/rdoc/ri/task.rb +55 -51
  99. data/lib/rdoc/ri.rb +14 -12
  100. data/lib/rdoc/rubygems_hook.rb +183 -181
  101. data/lib/rdoc/server.rb +349 -347
  102. data/lib/rdoc/stats/normal.rb +46 -42
  103. data/lib/rdoc/stats/quiet.rb +39 -35
  104. data/lib/rdoc/stats/verbose.rb +35 -31
  105. data/lib/rdoc/stats.rb +365 -363
  106. data/lib/rdoc/store.rb +888 -902
  107. data/lib/rdoc/task.rb +260 -256
  108. data/lib/rdoc/text.rb +135 -133
  109. data/lib/rdoc/token_stream.rb +101 -93
  110. data/lib/rdoc/tom_doc.rb +203 -201
  111. data/lib/rdoc/version.rb +1 -1
  112. metadata +4 -5
  113. data/lib/rdoc/markdown/literals.kpeg +0 -21
  114. data/lib/rdoc/markdown/literals.rb +0 -454
@@ -1,164 +1,168 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A Document containing lists, headings, paragraphs, etc.
2
+ module RDoc
3
+ class Markup
4
+ ##
5
+ # A Document containing lists, headings, paragraphs, etc.
4
6
 
5
- class RDoc::Markup::Document
7
+ class Document
6
8
 
7
- include Enumerable
9
+ include Enumerable
8
10
 
9
- ##
10
- # The file this document was created from. See also
11
- # RDoc::ClassModule#add_comment
11
+ ##
12
+ # The file this document was created from. See also
13
+ # RDoc::ClassModule#add_comment
12
14
 
13
- attr_reader :file
15
+ attr_reader :file
14
16
 
15
- ##
16
- # If a heading is below the given level it will be omitted from the
17
- # table_of_contents
17
+ ##
18
+ # If a heading is below the given level it will be omitted from the
19
+ # table_of_contents
18
20
 
19
- attr_accessor :omit_headings_below
21
+ attr_accessor :omit_headings_below
20
22
 
21
- ##
22
- # The parts of the Document
23
+ ##
24
+ # The parts of the Document
23
25
 
24
- attr_reader :parts
26
+ attr_reader :parts
25
27
 
26
- ##
27
- # Creates a new Document with +parts+
28
+ ##
29
+ # Creates a new Document with +parts+
28
30
 
29
- def initialize(*parts)
30
- @parts = []
31
- @parts.concat parts
31
+ def initialize(*parts)
32
+ @parts = []
33
+ @parts.concat parts
32
34
 
33
- @file = nil
34
- @omit_headings_from_table_of_contents_below = nil
35
- end
36
-
37
- ##
38
- # Appends +part+ to the document
35
+ @file = nil
36
+ @omit_headings_from_table_of_contents_below = nil
37
+ end
39
38
 
40
- def <<(part)
41
- case part
42
- when RDoc::Markup::Document then
43
- unless part.empty? then
44
- parts.concat part.parts
45
- parts << RDoc::Markup::BlankLine.new
39
+ ##
40
+ # Appends +part+ to the document
41
+
42
+ def <<(part)
43
+ case part
44
+ when Markup::Document
45
+ unless part.empty?
46
+ parts.concat part.parts
47
+ parts << Markup::BlankLine.new
48
+ end
49
+ when String
50
+ raise ArgumentError,
51
+ "expected RDoc::Markup::Document and friends, got String" unless
52
+ part.empty?
53
+ else
54
+ parts << part
55
+ end
46
56
  end
47
- when String then
48
- raise ArgumentError,
49
- "expected RDoc::Markup::Document and friends, got String" unless
50
- part.empty?
51
- else
52
- parts << part
53
- end
54
- end
55
57
 
56
- def ==(other) # :nodoc:
57
- self.class == other.class and
58
- @file == other.file and
59
- @parts == other.parts
60
- end
58
+ def ==(other) # :nodoc:
59
+ self.class == other.class and
60
+ @file == other.file and
61
+ @parts == other.parts
62
+ end
61
63
 
62
- ##
63
- # Runs this document and all its #items through +visitor+
64
+ ##
65
+ # Runs this document and all its #items through +visitor+
64
66
 
65
- def accept(visitor)
66
- visitor.start_accepting
67
+ def accept(visitor)
68
+ visitor.start_accepting
67
69
 
68
- visitor.accept_document self
70
+ visitor.accept_document self
69
71
 
70
- visitor.end_accepting
71
- end
72
+ visitor.end_accepting
73
+ end
72
74
 
73
- ##
74
- # Concatenates the given +parts+ onto the document
75
+ ##
76
+ # Concatenates the given +parts+ onto the document
75
77
 
76
- def concat(parts)
77
- self.parts.concat parts
78
- end
78
+ def concat(parts)
79
+ self.parts.concat parts
80
+ end
79
81
 
80
- ##
81
- # Enumerator for the parts of this document
82
+ ##
83
+ # Enumerator for the parts of this document
82
84
 
83
- def each(&block)
84
- @parts.each(&block)
85
- end
85
+ def each(&block)
86
+ @parts.each(&block)
87
+ end
86
88
 
87
- ##
88
- # Does this document have no parts?
89
+ ##
90
+ # Does this document have no parts?
89
91
 
90
- def empty?
91
- @parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)
92
- end
92
+ def empty?
93
+ @parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)
94
+ end
93
95
 
94
- ##
95
- # The file this Document was created from.
96
+ ##
97
+ # The file this Document was created from.
96
98
 
97
- def file=(location)
98
- @file = case location
99
- when RDoc::TopLevel then
100
- location.relative_name
101
- else
102
- location
103
- end
104
- end
105
-
106
- ##
107
- # When this is a collection of documents (#file is not set and this document
108
- # contains only other documents as its direct children) #merge replaces
109
- # documents in this class with documents from +other+ when the file matches
110
- # and adds documents from +other+ when the files do not.
111
- #
112
- # The information in +other+ is preferred over the receiver
113
-
114
- def merge(other)
115
- if empty? then
116
- @parts = other.parts
117
- return self
118
- end
99
+ def file=(location)
100
+ @file = case location
101
+ when TopLevel
102
+ location.relative_name
103
+ else
104
+ location
105
+ end
106
+ end
119
107
 
120
- other.parts.each do |other_part|
121
- self.parts.delete_if do |self_part|
122
- self_part.file and self_part.file == other_part.file
108
+ ##
109
+ # When this is a collection of documents (#file is not set and this document
110
+ # contains only other documents as its direct children) #merge replaces
111
+ # documents in this class with documents from +other+ when the file matches
112
+ # and adds documents from +other+ when the files do not.
113
+ #
114
+ # The information in +other+ is preferred over the receiver
115
+
116
+ def merge(other)
117
+ if empty?
118
+ @parts = other.parts
119
+ return self
120
+ end
121
+
122
+ other.parts.each do |other_part|
123
+ self.parts.delete_if do |self_part|
124
+ self_part.file and self_part.file == other_part.file
125
+ end
126
+
127
+ self.parts << other_part
128
+ end
129
+
130
+ self
123
131
  end
124
132
 
125
- self.parts << other_part
126
- end
133
+ ##
134
+ # Does this Document contain other Documents?
127
135
 
128
- self
129
- end
136
+ def merged?
137
+ Markup::Document === @parts.first
138
+ end
130
139
 
131
- ##
132
- # Does this Document contain other Documents?
140
+ def pretty_print(q) # :nodoc:
141
+ start = @file ? "[doc (#{@file}): " : '[doc: '
133
142
 
134
- def merged?
135
- RDoc::Markup::Document === @parts.first
136
- end
143
+ q.group 2, start, ']' do
144
+ q.seplist @parts do |part|
145
+ q.pp part
146
+ end
147
+ end
148
+ end
137
149
 
138
- def pretty_print(q) # :nodoc:
139
- start = @file ? "[doc (#{@file}): " : '[doc: '
150
+ ##
151
+ # Appends +parts+ to the document
140
152
 
141
- q.group 2, start, ']' do
142
- q.seplist @parts do |part|
143
- q.pp part
153
+ def push(*parts)
154
+ self.parts.concat parts
144
155
  end
145
- end
146
- end
147
156
 
148
- ##
149
- # Appends +parts+ to the document
150
-
151
- def push(*parts)
152
- self.parts.concat parts
153
- end
157
+ ##
158
+ # Returns an Array of headings in the document.
159
+ #
160
+ # Require 'rdoc/markup/formatter' before calling this method.
154
161
 
155
- ##
156
- # Returns an Array of headings in the document.
157
- #
158
- # Require 'rdoc/markup/formatter' before calling this method.
162
+ def table_of_contents
163
+ accept Markup::ToTableOfContents.to_toc
164
+ end
159
165
 
160
- def table_of_contents
161
- accept RDoc::Markup::ToTableOfContents.to_toc
166
+ end
162
167
  end
163
-
164
168
  end