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