rdoc 6.17.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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +193 -0
  3. data/LEGAL.rdoc +6 -0
  4. data/LICENSE.rdoc +4 -0
  5. data/README.md +132 -8
  6. data/RI.md +75 -75
  7. data/doc/markup_reference/markdown.md +659 -0
  8. data/doc/markup_reference/rdoc.rdoc +1169 -0
  9. data/exe/rdoc +2 -2
  10. data/lib/rdoc/code_object/alias.rb +70 -74
  11. data/lib/rdoc/code_object/any_method.rb +308 -293
  12. data/lib/rdoc/code_object/attr.rb +150 -142
  13. data/lib/rdoc/code_object/class_module.rb +802 -715
  14. data/lib/rdoc/code_object/constant.rb +181 -144
  15. data/lib/rdoc/code_object/context/section.rb +140 -130
  16. data/lib/rdoc/code_object/context.rb +925 -941
  17. data/lib/rdoc/code_object/extend.rb +7 -5
  18. data/lib/rdoc/code_object/include.rb +7 -5
  19. data/lib/rdoc/code_object/method_attr.rb +328 -315
  20. data/lib/rdoc/code_object/mixin.rb +97 -92
  21. data/lib/rdoc/code_object/normal_class.rb +77 -78
  22. data/lib/rdoc/code_object/normal_module.rb +61 -59
  23. data/lib/rdoc/code_object/require.rb +23 -39
  24. data/lib/rdoc/code_object/single_class.rb +21 -19
  25. data/lib/rdoc/code_object/top_level.rb +215 -202
  26. data/lib/rdoc/code_object.rb +305 -305
  27. data/lib/rdoc/comment.rb +274 -337
  28. data/lib/rdoc/cross_reference.rb +195 -206
  29. data/lib/rdoc/encoding.rb +105 -103
  30. data/lib/rdoc/erb_partial.rb +13 -11
  31. data/lib/rdoc/erbio.rb +29 -27
  32. data/lib/rdoc/generator/aliki.rb +196 -30
  33. data/lib/rdoc/generator/darkfish.rb +647 -629
  34. data/lib/rdoc/generator/json_index.rb +233 -229
  35. data/lib/rdoc/generator/markup.rb +165 -122
  36. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  37. data/lib/rdoc/generator/pot/po.rb +52 -51
  38. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  39. data/lib/rdoc/generator/pot.rb +85 -81
  40. data/lib/rdoc/generator/ri.rb +23 -19
  41. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  42. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  43. data/lib/rdoc/generator/template/aliki/_footer.rhtml +2 -2
  44. data/lib/rdoc/generator/template/aliki/_head.rhtml +15 -10
  45. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  46. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  47. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  48. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  49. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +3 -3
  50. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
  51. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  52. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  53. data/lib/rdoc/generator/template/aliki/class.rhtml +71 -61
  54. data/lib/rdoc/generator/template/aliki/css/rdoc.css +796 -323
  55. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/js/aliki.js +119 -113
  57. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  58. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
  59. data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
  60. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  61. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  62. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  63. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  64. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  68. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  69. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +2 -2
  70. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  71. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  72. data/lib/rdoc/generator/template/darkfish/class.rhtml +29 -32
  73. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -1
  74. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  75. data/lib/rdoc/generator.rb +48 -46
  76. data/lib/rdoc/i18n/locale.rb +99 -95
  77. data/lib/rdoc/i18n/text.rb +109 -105
  78. data/lib/rdoc/i18n.rb +7 -5
  79. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  80. data/lib/rdoc/markdown.kpeg +52 -33
  81. data/lib/rdoc/markdown.rb +365 -177
  82. data/lib/rdoc/markup/blank_line.rb +25 -23
  83. data/lib/rdoc/markup/block_quote.rb +12 -8
  84. data/lib/rdoc/markup/document.rb +127 -123
  85. data/lib/rdoc/markup/element.rb +21 -0
  86. data/lib/rdoc/markup/formatter.rb +220 -203
  87. data/lib/rdoc/markup/hard_break.rb +30 -27
  88. data/lib/rdoc/markup/heading.rb +163 -77
  89. data/lib/rdoc/markup/include.rb +33 -29
  90. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  91. data/lib/rdoc/markup/inline_parser.rb +316 -0
  92. data/lib/rdoc/markup/list.rb +80 -88
  93. data/lib/rdoc/markup/list_item.rb +73 -85
  94. data/lib/rdoc/markup/paragraph.rb +23 -19
  95. data/lib/rdoc/markup/parser.rb +501 -497
  96. data/lib/rdoc/markup/pre_process.rb +284 -305
  97. data/lib/rdoc/markup/raw.rb +52 -55
  98. data/lib/rdoc/markup/rule.rb +16 -12
  99. data/lib/rdoc/markup/table.rb +48 -40
  100. data/lib/rdoc/markup/to_ansi.rb +143 -92
  101. data/lib/rdoc/markup/to_bs.rb +86 -102
  102. data/lib/rdoc/markup/to_html.rb +608 -506
  103. data/lib/rdoc/markup/to_html_crossref.rb +219 -210
  104. data/lib/rdoc/markup/to_html_snippet.rb +210 -205
  105. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  106. data/lib/rdoc/markup/to_label.rb +64 -51
  107. data/lib/rdoc/markup/to_markdown.rb +212 -184
  108. data/lib/rdoc/markup/to_rdoc.rb +341 -277
  109. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  110. data/lib/rdoc/markup/to_test.rb +62 -50
  111. data/lib/rdoc/markup/to_tt_only.rb +83 -92
  112. data/lib/rdoc/markup/verbatim.rb +62 -58
  113. data/lib/rdoc/markup.rb +196 -215
  114. data/lib/rdoc/options.rb +1063 -1076
  115. data/lib/rdoc/parser/c.rb +1039 -1036
  116. data/lib/rdoc/parser/changelog.rb +320 -287
  117. data/lib/rdoc/parser/markdown.rb +17 -13
  118. data/lib/rdoc/parser/rbs.rb +279 -0
  119. data/lib/rdoc/parser/rd.rb +17 -13
  120. data/lib/rdoc/parser/ruby.rb +1231 -2222
  121. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  122. data/lib/rdoc/parser/simple.rb +31 -27
  123. data/lib/rdoc/parser/text.rb +12 -8
  124. data/lib/rdoc/parser.rb +230 -221
  125. data/lib/rdoc/rbs_helper.rb +186 -0
  126. data/lib/rdoc/rd/inline.rb +57 -53
  127. data/lib/rdoc/rd.rb +90 -88
  128. data/lib/rdoc/rdoc.rb +547 -366
  129. data/lib/rdoc/ri/driver.rb +1141 -1130
  130. data/lib/rdoc/ri/formatter.rb +7 -3
  131. data/lib/rdoc/ri/paths.rb +140 -136
  132. data/lib/rdoc/ri/servlet.rb +456 -0
  133. data/lib/rdoc/ri/store.rb +4 -2
  134. data/lib/rdoc/ri/task.rb +55 -51
  135. data/lib/rdoc/ri.rb +14 -11
  136. data/lib/rdoc/rubygems_hook.rb +194 -192
  137. data/lib/rdoc/server.rb +462 -0
  138. data/lib/rdoc/stats/normal.rb +46 -42
  139. data/lib/rdoc/stats/quiet.rb +39 -35
  140. data/lib/rdoc/stats/verbose.rb +35 -31
  141. data/lib/rdoc/stats.rb +363 -338
  142. data/lib/rdoc/store.rb +919 -725
  143. data/lib/rdoc/task.rb +260 -255
  144. data/lib/rdoc/text.rb +164 -240
  145. data/lib/rdoc/token_stream.rb +88 -106
  146. data/lib/rdoc/tom_doc.rb +203 -201
  147. data/lib/rdoc/version.rb +1 -1
  148. data/lib/rdoc.rb +35 -7
  149. data/lib/rubygems_plugin.rb +2 -11
  150. data/rdoc-logo.svg +43 -0
  151. data/rdoc.gemspec +9 -7
  152. metadata +46 -32
  153. data/CONTRIBUTING.rdoc +0 -219
  154. data/ExampleMarkdown.md +0 -39
  155. data/ExampleRDoc.rdoc +0 -210
  156. data/lib/rdoc/code_object/anon_class.rb +0 -10
  157. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  158. data/lib/rdoc/code_object/meta_method.rb +0 -6
  159. data/lib/rdoc/markdown/literals.kpeg +0 -21
  160. data/lib/rdoc/markdown/literals.rb +0 -454
  161. data/lib/rdoc/markup/attr_changer.rb +0 -22
  162. data/lib/rdoc/markup/attr_span.rb +0 -35
  163. data/lib/rdoc/markup/attribute_manager.rb +0 -405
  164. data/lib/rdoc/markup/attributes.rb +0 -70
  165. data/lib/rdoc/markup/regexp_handling.rb +0 -40
  166. data/lib/rdoc/parser/prism_ruby.rb +0 -1100
  167. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  168. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  169. data/lib/rdoc/servlet.rb +0 -452
@@ -1,172 +1,180 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # An attribute created by \#attr, \#attr_reader, \#attr_writer or
4
- # \#attr_accessor
2
+ module RDoc
3
+ ##
4
+ # An attribute created by \#attr, \#attr_reader, \#attr_writer or
5
+ # \#attr_accessor
5
6
 
6
- class RDoc::Attr < RDoc::MethodAttr
7
+ class Attr < ::RDoc::MethodAttr
7
8
 
8
- ##
9
- # 3::
10
- # RDoc 4
11
- # Added parent name and class
12
- # Added section title
9
+ ##
10
+ # 3::
11
+ # RDoc 4
12
+ # Added parent name and class
13
+ # Added section title
14
+ # 4::
15
+ # Added type_signature_lines (serialized as joined string)
13
16
 
14
- MARSHAL_VERSION = 3 # :nodoc:
17
+ MARSHAL_VERSION = 4 # :nodoc:
15
18
 
16
- ##
17
- # Is the attribute readable ('R'), writable ('W') or both ('RW')?
19
+ ##
20
+ # Is the attribute readable ('R'), writable ('W') or both ('RW')?
18
21
 
19
- attr_accessor :rw
22
+ attr_accessor :rw
20
23
 
21
- ##
22
- # Creates a new Attr with body +text+, +name+, read/write status +rw+ and
23
- # +comment+. +singleton+ marks this as a class attribute.
24
+ ##
25
+ # Creates a new Attr with +name+, read/write status +rw+ and
26
+ # +comment+. +singleton+ marks this as a class attribute.
24
27
 
25
- def initialize(text, name, rw, comment, singleton: false)
26
- super(text, name, singleton: singleton)
28
+ def initialize(name, rw, comment, singleton: false)
29
+ super(name, singleton: singleton)
27
30
 
28
- @rw = rw
29
- self.comment = comment
30
- end
31
+ @rw = rw
32
+ self.comment = comment
33
+ end
31
34
 
32
- ##
33
- # Attributes are equal when their names, singleton and rw are identical
35
+ ##
36
+ # Attributes are equal when their names, singleton and rw are identical
34
37
 
35
- def ==(other)
36
- self.class == other.class and
37
- self.name == other.name and
38
- self.rw == other.rw and
39
- self.singleton == other.singleton
40
- end
38
+ def ==(other)
39
+ self.class == other.class and
40
+ self.name == other.name and
41
+ self.rw == other.rw and
42
+ self.singleton == other.singleton
43
+ end
41
44
 
42
- ##
43
- # Add +an_alias+ as an attribute in +context+.
44
-
45
- def add_alias(an_alias, context)
46
- new_attr = self.class.new(text, an_alias.new_name, rw, comment, singleton: singleton)
47
- new_attr.record_location an_alias.file
48
- new_attr.visibility = self.visibility
49
- new_attr.is_alias_for = self
50
- @aliases << new_attr
51
- context.add_attribute new_attr
52
- new_attr
53
- end
45
+ ##
46
+ # Add +an_alias+ as an attribute in +context+.
47
+
48
+ def add_alias(an_alias, context)
49
+ access_type = an_alias.new_name.end_with?('=') ? 'W' : 'R'
50
+ new_attr = self.class.new(an_alias.new_name, access_type, comment, singleton: singleton)
51
+ new_attr.record_location an_alias.file
52
+ new_attr.visibility = self.visibility
53
+ new_attr.is_alias_for = self
54
+ new_attr.type_signature_lines = self.type_signature_lines
55
+ @aliases << new_attr
56
+ context.add_attribute new_attr
57
+ new_attr
58
+ end
54
59
 
55
- ##
56
- # The #aref prefix for attributes
60
+ ##
61
+ # The #aref prefix for attributes
57
62
 
58
- def aref_prefix
59
- 'attribute'
60
- end
63
+ def aref_prefix
64
+ 'attribute'
65
+ end
61
66
 
62
- ##
63
- # Attributes never call super. See RDoc::AnyMethod#calls_super
64
- #
65
- # An RDoc::Attr can show up in the method list in some situations (see
66
- # Gem::ConfigFile)
67
+ ##
68
+ # Attributes never call super. See RDoc::AnyMethod#calls_super
69
+ #
70
+ # An RDoc::Attr can show up in the method list in some situations (see
71
+ # Gem::ConfigFile)
67
72
 
68
- def calls_super # :nodoc:
69
- false
70
- end
73
+ def calls_super # :nodoc:
74
+ false
75
+ end
71
76
 
72
- ##
73
- # Returns attr_reader, attr_writer or attr_accessor as appropriate.
77
+ ##
78
+ # Returns attr_reader, attr_writer or attr_accessor as appropriate.
74
79
 
75
- def definition
76
- case @rw
77
- when 'RW' then 'attr_accessor'
78
- when 'R' then 'attr_reader'
79
- when 'W' then 'attr_writer'
80
+ def definition
81
+ case @rw
82
+ when 'RW' then 'attr_accessor'
83
+ when 'R' then 'attr_reader'
84
+ when 'W' then 'attr_writer'
85
+ end
80
86
  end
81
- end
82
87
 
83
- def inspect # :nodoc:
84
- alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
85
- visibility = self.visibility
86
- visibility = "forced #{visibility}" if force_documentation
87
- "#<%s:0x%x %s %s (%s)%s>" % [
88
- self.class, object_id,
89
- full_name,
90
- rw,
91
- visibility,
92
- alias_for,
93
- ]
94
- end
88
+ def inspect # :nodoc:
89
+ alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
90
+ visibility = self.visibility
91
+ visibility = "forced #{visibility}" if force_documentation
92
+ "#<%s:0x%x %s %s (%s)%s>" % [
93
+ self.class, object_id,
94
+ full_name,
95
+ rw,
96
+ visibility,
97
+ alias_for,
98
+ ]
99
+ end
95
100
 
96
- ##
97
- # Dumps this Attr for use by ri. See also #marshal_load
98
-
99
- def marshal_dump
100
- [ MARSHAL_VERSION,
101
- @name,
102
- full_name,
103
- @rw,
104
- @visibility,
105
- parse(@comment),
106
- singleton,
107
- @file.relative_name,
108
- @parent.full_name,
109
- @parent.class,
110
- @section.title
111
- ]
112
- end
101
+ ##
102
+ # Dumps this Attr for use by ri. See also #marshal_load
103
+
104
+ def marshal_dump
105
+ [ MARSHAL_VERSION,
106
+ @name,
107
+ full_name,
108
+ @rw,
109
+ @visibility,
110
+ parse(@comment),
111
+ singleton,
112
+ @file.relative_name,
113
+ @parent.full_name,
114
+ @parent.class,
115
+ @section.title,
116
+ @type_signature_lines&.join("\n"),
117
+ ]
118
+ end
113
119
 
114
- ##
115
- # Loads this Attr from +array+. For a loaded Attr the following
116
- # methods will return cached values:
117
- #
118
- # * #full_name
119
- # * #parent_name
120
-
121
- def marshal_load(array)
122
- initialize_visibility
123
-
124
- @aliases = []
125
- @parent = nil
126
- @parent_name = nil
127
- @parent_class = nil
128
- @section = nil
129
- @file = nil
130
-
131
- version = array[0]
132
- @name = array[1]
133
- @full_name = array[2]
134
- @rw = array[3]
135
- @visibility = array[4]
136
- @comment = RDoc::Comment.from_document array[5]
137
- @singleton = array[6] || false # MARSHAL_VERSION == 0
138
- # 7 handled below
139
- @parent_name = array[8]
140
- @parent_class = array[9]
141
- @section_title = array[10]
142
-
143
- @file = RDoc::TopLevel.new array[7] if version > 1
144
-
145
- @parent_name ||= @full_name.split('#', 2).first
146
- end
120
+ ##
121
+ # Loads this Attr from +array+. For a loaded Attr the following
122
+ # methods will return cached values:
123
+ #
124
+ # * #full_name
125
+ # * #parent_name
126
+
127
+ def marshal_load(array)
128
+ initialize_visibility
129
+
130
+ @aliases = []
131
+ @parent = nil
132
+ @parent_name = nil
133
+ @parent_class = nil
134
+ @section = nil
135
+ @file = nil
136
+
137
+ version = array[0]
138
+ @name = array[1]
139
+ @full_name = array[2]
140
+ @rw = array[3]
141
+ @visibility = array[4] || :public
142
+ @comment = Comment.from_document array[5]
143
+ @singleton = array[6] || false # MARSHAL_VERSION == 0
144
+ # 7 handled below
145
+ @parent_name = array[8]
146
+ @parent_class = array[9]
147
+ @section_title = array[10]
148
+ @type_signature_lines = array[11]&.split("\n")
149
+
150
+ @file = TopLevel.new array[7] if version > 1
151
+
152
+ @parent_name ||= @full_name.split('#', 2).first
153
+ end
147
154
 
148
- def pretty_print(q) # :nodoc:
149
- q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
150
- unless comment.empty? then
151
- q.breakable
152
- q.text "comment:"
153
- q.breakable
154
- q.pp @comment
155
+ def pretty_print(q) # :nodoc:
156
+ q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
157
+ unless comment.empty?
158
+ q.breakable
159
+ q.text "comment:"
160
+ q.breakable
161
+ q.pp @comment
162
+ end
155
163
  end
156
164
  end
157
- end
158
165
 
159
- def to_s # :nodoc:
160
- "#{definition} #{name} in: #{parent}"
161
- end
166
+ def to_s # :nodoc:
167
+ "#{definition} #{name} in: #{parent}"
168
+ end
162
169
 
163
- ##
164
- # Attributes do not have token streams.
165
- #
166
- # An RDoc::Attr can show up in the method list in some situations (see
167
- # Gem::ConfigFile)
170
+ ##
171
+ # Attributes do not have token streams.
172
+ #
173
+ # An RDoc::Attr can show up in the method list in some situations (see
174
+ # Gem::ConfigFile)
168
175
 
169
- def token_stream # :nodoc:
170
- end
176
+ def token_stream # :nodoc:
177
+ end
171
178
 
179
+ end
172
180
  end