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
@@ -2,181 +2,185 @@
2
2
  require 'cgi/escape'
3
3
  require 'cgi/util' unless defined?(CGI::EscapeExt)
4
4
 
5
- ##
6
- # A section of documentation like:
7
- #
8
- # # :section: The title
9
- # # The body
10
- #
11
- # Sections can be referenced multiple times and will be collapsed into a
12
- # single section.
5
+ module RDoc
6
+ class Context
7
+ ##
8
+ # A section of documentation like:
9
+ #
10
+ # # :section: The title
11
+ # # The body
12
+ #
13
+ # Sections can be referenced multiple times and will be collapsed into a
14
+ # single section.
13
15
 
14
- class RDoc::Context::Section
16
+ class Section
15
17
 
16
- include RDoc::Text
18
+ include Text
17
19
 
18
- MARSHAL_VERSION = 0 # :nodoc:
20
+ MARSHAL_VERSION = 0 # :nodoc:
19
21
 
20
- ##
21
- # Section comments
22
+ ##
23
+ # Section comments
22
24
 
23
- attr_reader :comments
25
+ attr_reader :comments
24
26
 
25
- ##
26
- # Context this Section lives in
27
+ ##
28
+ # Context this Section lives in
27
29
 
28
- attr_reader :parent
30
+ attr_reader :parent
29
31
 
30
- ##
31
- # Section title
32
+ ##
33
+ # Section title
32
34
 
33
- attr_reader :title
35
+ attr_reader :title
34
36
 
35
- ##
36
- # The RDoc::Store for this object.
37
+ ##
38
+ # The RDoc::Store for this object.
37
39
 
38
- attr_reader :store
40
+ attr_reader :store
39
41
 
40
- ##
41
- # Creates a new section with +title+ and +comment+
42
+ ##
43
+ # Creates a new section with +title+ and +comment+
42
44
 
43
- def initialize(parent, title, comment, store = nil)
44
- @parent = parent
45
- @title = title ? title.strip : title
46
- @store = store
45
+ def initialize(parent, title, comment, store = nil)
46
+ @parent = parent
47
+ @title = title ? title.strip : title
48
+ @store = store
47
49
 
48
- @comments = []
50
+ @comments = []
49
51
 
50
- add_comment comment
51
- end
52
+ add_comment comment
53
+ end
52
54
 
53
- ##
54
- # Sections are equal when they have the same #title
55
+ ##
56
+ # Sections are equal when they have the same #title
55
57
 
56
- def ==(other)
57
- self.class === other and @title == other.title
58
- end
58
+ def ==(other)
59
+ self.class === other and @title == other.title
60
+ end
59
61
 
60
- alias eql? ==
62
+ alias eql? ==
61
63
 
62
- ##
63
- # Adds +comment+ to this section
64
+ ##
65
+ # Adds +comment+ to this section
64
66
 
65
- def add_comment(comment)
66
- Array(comment).each do |c|
67
- next if c.nil?
68
- raise TypeError, "unknown comment #{c.inspect}" unless RDoc::Comment === c
69
- @comments << c unless c.empty?
70
- end
71
- end
67
+ def add_comment(comment)
68
+ Array(comment).each do |c|
69
+ next if c.nil?
70
+ raise TypeError, "unknown comment #{c.inspect}" unless Comment === c
71
+ @comments << c unless c.empty?
72
+ end
73
+ end
72
74
 
73
- ##
74
- # Anchor reference for linking to this section using GitHub-style format.
75
- #
76
- # Examples:
77
- # "Section" -> "section"
78
- # "One Two" -> "one-two"
79
- # "[untitled]" -> "untitled"
75
+ ##
76
+ # Anchor reference for linking to this section using GitHub-style format.
77
+ #
78
+ # Examples:
79
+ # "Section" -> "section"
80
+ # "One Two" -> "one-two"
81
+ # "[untitled]" -> "untitled"
80
82
 
81
- def aref
82
- title = @title || '[untitled]'
83
+ def aref
84
+ title = @title || '[untitled]'
83
85
 
84
- RDoc::Text.to_anchor(title)
85
- end
86
+ Text.to_anchor(title)
87
+ end
86
88
 
87
- ##
88
- # Legacy anchor reference for backward compatibility.
89
- #
90
- # Examples:
91
- # "Section" -> "section"
92
- # "One Two" -> "one+two"
93
- # "[untitled]" -> "5Buntitled-5D"
89
+ ##
90
+ # Legacy anchor reference for backward compatibility.
91
+ #
92
+ # Examples:
93
+ # "Section" -> "section"
94
+ # "One Two" -> "one+two"
95
+ # "[untitled]" -> "5Buntitled-5D"
94
96
 
95
- def legacy_aref
96
- title = @title || '[untitled]'
97
+ def legacy_aref
98
+ title = @title || '[untitled]'
97
99
 
98
- CGI.escape(title).gsub('%', '-').sub(/^-/, '')
99
- end
100
+ CGI.escape(title).gsub('%', '-').sub(/^-/, '')
101
+ end
100
102
 
101
- def inspect # :nodoc:
102
- "#<%s:0x%x %p>" % [self.class, object_id, title]
103
- end
103
+ def inspect # :nodoc:
104
+ "#<%s:0x%x %p>" % [self.class, object_id, title]
105
+ end
104
106
 
105
- def hash # :nodoc:
106
- @title.hash
107
- end
108
-
109
- ##
110
- # The files comments in this section come from
107
+ def hash # :nodoc:
108
+ @title.hash
109
+ end
111
110
 
112
- def in_files
113
- @comments.map(&:file)
114
- end
111
+ ##
112
+ # The files comments in this section come from
115
113
 
116
- ##
117
- # Serializes this Section. The title and parsed comment are saved, but not
118
- # the section parent which must be restored manually.
114
+ def in_files
115
+ @comments.map(&:file)
116
+ end
119
117
 
120
- def marshal_dump
121
- [
122
- MARSHAL_VERSION,
123
- @title,
124
- to_document,
125
- ]
126
- end
118
+ ##
119
+ # Serializes this Section. The title and parsed comment are saved, but not
120
+ # the section parent which must be restored manually.
127
121
 
128
- ##
129
- # De-serializes this Section. The section parent must be restored manually.
122
+ def marshal_dump
123
+ [
124
+ MARSHAL_VERSION,
125
+ @title,
126
+ to_document,
127
+ ]
128
+ end
130
129
 
131
- def marshal_load(array)
132
- @parent = nil
130
+ ##
131
+ # De-serializes this Section. The section parent must be restored manually.
133
132
 
134
- @title = array[1]
135
- @comments = array[2].parts.map { |doc| RDoc::Comment.from_document(doc) }
136
- end
133
+ def marshal_load(array)
134
+ @parent = nil
137
135
 
138
- ##
139
- # Parses +comment_location+ into an RDoc::Markup::Document composed of
140
- # multiple RDoc::Markup::Documents with their file set.
136
+ @title = array[1]
137
+ @comments = array[2].parts.map { |doc| Comment.from_document(doc) }
138
+ end
141
139
 
142
- def to_document
143
- RDoc::Markup::Document.new(*@comments.map(&:parse))
144
- end
140
+ ##
141
+ # Parses +comment_location+ into an RDoc::Markup::Document composed of
142
+ # multiple RDoc::Markup::Documents with their file set.
143
+
144
+ def to_document
145
+ Markup::Document.new(*@comments.map(&:parse))
146
+ end
147
+
148
+ ##
149
+ # The section's title, or 'Top Section' if the title is nil.
150
+ #
151
+ # This is used by the table of contents template so the name is silly.
152
+
153
+ def plain_html
154
+ @title || 'Top Section'
155
+ end
156
+
157
+ ##
158
+ # Section comment
159
+
160
+ def comment
161
+ return nil if @comments.empty?
162
+ Comment.from_document(to_document)
163
+ end
164
+
165
+ def description
166
+ return '' if @comments.empty?
167
+ markup comment
168
+ end
169
+
170
+ def language
171
+ @comments.first&.language
172
+ end
173
+
174
+ ##
175
+ # Removes a comment from this section if it is from the same file as
176
+ # +comment+
177
+
178
+ def remove_comment(target_comment)
179
+ @comments.delete_if do |stored_comment|
180
+ stored_comment.file == target_comment.file
181
+ end
182
+ end
145
183
 
146
- ##
147
- # The section's title, or 'Top Section' if the title is nil.
148
- #
149
- # This is used by the table of contents template so the name is silly.
150
-
151
- def plain_html
152
- @title || 'Top Section'
153
- end
154
-
155
- ##
156
- # Section comment
157
-
158
- def comment
159
- return nil if @comments.empty?
160
- RDoc::Comment.from_document(to_document)
161
- end
162
-
163
- def description
164
- return '' if @comments.empty?
165
- markup comment
166
- end
167
-
168
- def language
169
- @comments.first&.language
170
- end
171
-
172
- ##
173
- # Removes a comment from this section if it is from the same file as
174
- # +comment+
175
-
176
- def remove_comment(target_comment)
177
- @comments.delete_if do |stored_comment|
178
- stored_comment.file == target_comment.file
179
184
  end
180
185
  end
181
-
182
186
  end