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,178 +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
13
- # 4::
14
- # Added type_signature_lines (serialized as joined string)
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)
15
16
 
16
- MARSHAL_VERSION = 4 # :nodoc:
17
+ MARSHAL_VERSION = 4 # :nodoc:
17
18
 
18
- ##
19
- # Is the attribute readable ('R'), writable ('W') or both ('RW')?
19
+ ##
20
+ # Is the attribute readable ('R'), writable ('W') or both ('RW')?
20
21
 
21
- attr_accessor :rw
22
+ attr_accessor :rw
22
23
 
23
- ##
24
- # Creates a new Attr with +name+, read/write status +rw+ and
25
- # +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.
26
27
 
27
- def initialize(name, rw, comment, singleton: false)
28
- super(name, singleton: singleton)
28
+ def initialize(name, rw, comment, singleton: false)
29
+ super(name, singleton: singleton)
29
30
 
30
- @rw = rw
31
- self.comment = comment
32
- end
31
+ @rw = rw
32
+ self.comment = comment
33
+ end
33
34
 
34
- ##
35
- # Attributes are equal when their names, singleton and rw are identical
35
+ ##
36
+ # Attributes are equal when their names, singleton and rw are identical
36
37
 
37
- def ==(other)
38
- self.class == other.class and
39
- self.name == other.name and
40
- self.rw == other.rw and
41
- self.singleton == other.singleton
42
- 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
43
44
 
44
- ##
45
- # Add +an_alias+ as an attribute in +context+.
46
-
47
- def add_alias(an_alias, context)
48
- access_type = an_alias.new_name.end_with?('=') ? 'W' : 'R'
49
- new_attr = self.class.new(an_alias.new_name, access_type, comment, singleton: singleton)
50
- new_attr.record_location an_alias.file
51
- new_attr.visibility = self.visibility
52
- new_attr.is_alias_for = self
53
- new_attr.type_signature_lines = self.type_signature_lines
54
- @aliases << new_attr
55
- context.add_attribute new_attr
56
- new_attr
57
- 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
58
59
 
59
- ##
60
- # The #aref prefix for attributes
60
+ ##
61
+ # The #aref prefix for attributes
61
62
 
62
- def aref_prefix
63
- 'attribute'
64
- end
63
+ def aref_prefix
64
+ 'attribute'
65
+ end
65
66
 
66
- ##
67
- # Attributes never call super. See RDoc::AnyMethod#calls_super
68
- #
69
- # An RDoc::Attr can show up in the method list in some situations (see
70
- # 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)
71
72
 
72
- def calls_super # :nodoc:
73
- false
74
- end
73
+ def calls_super # :nodoc:
74
+ false
75
+ end
75
76
 
76
- ##
77
- # Returns attr_reader, attr_writer or attr_accessor as appropriate.
77
+ ##
78
+ # Returns attr_reader, attr_writer or attr_accessor as appropriate.
78
79
 
79
- def definition
80
- case @rw
81
- when 'RW' then 'attr_accessor'
82
- when 'R' then 'attr_reader'
83
- 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
84
86
  end
85
- end
86
87
 
87
- def inspect # :nodoc:
88
- alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
89
- visibility = self.visibility
90
- visibility = "forced #{visibility}" if force_documentation
91
- "#<%s:0x%x %s %s (%s)%s>" % [
92
- self.class, object_id,
93
- full_name,
94
- rw,
95
- visibility,
96
- alias_for,
97
- ]
98
- 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
99
100
 
100
- ##
101
- # Dumps this Attr for use by ri. See also #marshal_load
102
-
103
- def marshal_dump
104
- [ MARSHAL_VERSION,
105
- @name,
106
- full_name,
107
- @rw,
108
- @visibility,
109
- parse(@comment),
110
- singleton,
111
- @file.relative_name,
112
- @parent.full_name,
113
- @parent.class,
114
- @section.title,
115
- @type_signature_lines&.join("\n"),
116
- ]
117
- 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
118
119
 
119
- ##
120
- # Loads this Attr from +array+. For a loaded Attr the following
121
- # methods will return cached values:
122
- #
123
- # * #full_name
124
- # * #parent_name
125
-
126
- def marshal_load(array)
127
- initialize_visibility
128
-
129
- @aliases = []
130
- @parent = nil
131
- @parent_name = nil
132
- @parent_class = nil
133
- @section = nil
134
- @file = nil
135
-
136
- version = array[0]
137
- @name = array[1]
138
- @full_name = array[2]
139
- @rw = array[3]
140
- @visibility = array[4]
141
- @comment = RDoc::Comment.from_document array[5]
142
- @singleton = array[6] || false # MARSHAL_VERSION == 0
143
- # 7 handled below
144
- @parent_name = array[8]
145
- @parent_class = array[9]
146
- @section_title = array[10]
147
- @type_signature_lines = array[11]&.split("\n")
148
-
149
- @file = RDoc::TopLevel.new array[7] if version > 1
150
-
151
- @parent_name ||= @full_name.split('#', 2).first
152
- 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
153
154
 
154
- def pretty_print(q) # :nodoc:
155
- q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
156
- unless comment.empty? then
157
- q.breakable
158
- q.text "comment:"
159
- q.breakable
160
- 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
161
163
  end
162
164
  end
163
- end
164
165
 
165
- def to_s # :nodoc:
166
- "#{definition} #{name} in: #{parent}"
167
- end
166
+ def to_s # :nodoc:
167
+ "#{definition} #{name} in: #{parent}"
168
+ end
168
169
 
169
- ##
170
- # Attributes do not have token streams.
171
- #
172
- # An RDoc::Attr can show up in the method list in some situations (see
173
- # 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)
174
175
 
175
- def token_stream # :nodoc:
176
- end
176
+ def token_stream # :nodoc:
177
+ end
177
178
 
179
+ end
178
180
  end