rdoc 6.3.4.1 → 8.0.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +195 -0
  3. data/History.rdoc +65 -63
  4. data/LEGAL.rdoc +7 -1
  5. data/LICENSE.rdoc +6 -0
  6. data/README.md +236 -0
  7. data/RI.md +842 -0
  8. data/TODO.rdoc +8 -7
  9. data/doc/markup_reference/markdown.md +659 -0
  10. data/doc/markup_reference/rdoc.rdoc +1169 -0
  11. data/exe/rdoc +0 -1
  12. data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -18
  13. data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +50 -24
  14. data/lib/rdoc/{attr.rb → code_object/attr.rb} +16 -14
  15. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +225 -58
  16. data/lib/rdoc/{constant.rb → code_object/constant.rb} +44 -10
  17. data/lib/rdoc/code_object/context/section.rb +182 -0
  18. data/lib/rdoc/{context.rb → code_object/context.rb} +78 -106
  19. data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -1
  20. data/lib/rdoc/{include.rb → code_object/include.rb} +0 -1
  21. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +46 -48
  22. data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +6 -4
  23. data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +2 -3
  24. data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
  25. data/lib/rdoc/{require.rb → code_object/require.rb} +1 -2
  26. data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +5 -1
  27. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +60 -63
  28. data/lib/rdoc/code_object.rb +11 -39
  29. data/lib/rdoc/code_objects.rb +1 -2
  30. data/lib/rdoc/comment.rb +202 -99
  31. data/lib/rdoc/cross_reference.rb +75 -62
  32. data/lib/rdoc/encoding.rb +8 -24
  33. data/lib/rdoc/erb_partial.rb +1 -2
  34. data/lib/rdoc/erbio.rb +3 -8
  35. data/lib/rdoc/generator/aliki.rb +200 -0
  36. data/lib/rdoc/generator/darkfish.rb +156 -122
  37. data/lib/rdoc/generator/json_index.rb +8 -24
  38. data/lib/rdoc/generator/markup.rb +70 -34
  39. data/lib/rdoc/generator/pot/message_extractor.rb +7 -7
  40. data/lib/rdoc/generator/pot/po.rb +1 -1
  41. data/lib/rdoc/generator/pot/po_entry.rb +8 -8
  42. data/lib/rdoc/generator/pot.rb +1 -5
  43. data/lib/rdoc/generator/ri.rb +1 -2
  44. data/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  45. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  46. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  47. data/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  48. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  49. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  50. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  51. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  52. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  53. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  54. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  55. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  56. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  57. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  58. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  59. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  60. data/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  61. data/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  62. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  63. data/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  64. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  65. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  66. data/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  67. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  68. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  69. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  70. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  71. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  72. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  73. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  74. data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -14
  75. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
  76. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +11 -9
  77. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +11 -9
  78. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  79. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
  80. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +25 -5
  81. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
  82. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +2 -1
  83. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  84. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +28 -7
  85. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  86. data/lib/rdoc/generator/template/darkfish/class.rhtml +138 -90
  87. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +420 -358
  88. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  89. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  90. data/lib/rdoc/generator/template/darkfish/index.rhtml +14 -12
  91. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +59 -3
  92. data/lib/rdoc/generator/template/darkfish/js/search.js +15 -5
  93. data/lib/rdoc/generator/template/darkfish/page.rhtml +7 -6
  94. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +12 -9
  95. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +24 -21
  96. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +35 -21
  97. data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
  98. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  99. data/lib/rdoc/generator.rb +6 -5
  100. data/lib/rdoc/i18n/text.rb +3 -3
  101. data/lib/rdoc/i18n.rb +1 -1
  102. data/lib/rdoc/known_classes.rb +5 -4
  103. data/lib/rdoc/markdown/entities.rb +0 -1
  104. data/lib/rdoc/markdown/literals.kpeg +0 -2
  105. data/lib/rdoc/markdown/literals.rb +0 -1
  106. data/lib/rdoc/markdown.kpeg +140 -62
  107. data/lib/rdoc/markdown.rb +1015 -873
  108. data/lib/rdoc/markup/blank_line.rb +25 -24
  109. data/lib/rdoc/markup/block_quote.rb +1 -2
  110. data/lib/rdoc/markup/document.rb +10 -11
  111. data/lib/rdoc/markup/element.rb +21 -0
  112. data/lib/rdoc/markup/formatter.rb +134 -115
  113. data/lib/rdoc/markup/hard_break.rb +30 -28
  114. data/lib/rdoc/markup/heading.rb +163 -72
  115. data/lib/rdoc/markup/include.rb +3 -4
  116. data/lib/rdoc/markup/indented_paragraph.rb +4 -5
  117. data/lib/rdoc/markup/inline_parser.rb +312 -0
  118. data/lib/rdoc/markup/list.rb +6 -7
  119. data/lib/rdoc/markup/list_item.rb +6 -7
  120. data/lib/rdoc/markup/paragraph.rb +2 -3
  121. data/lib/rdoc/markup/parser.rb +29 -19
  122. data/lib/rdoc/markup/pre_process.rb +39 -18
  123. data/lib/rdoc/markup/raw.rb +52 -56
  124. data/lib/rdoc/markup/rule.rb +2 -3
  125. data/lib/rdoc/markup/table.rb +49 -32
  126. data/lib/rdoc/markup/to_ansi.rb +58 -8
  127. data/lib/rdoc/markup/to_bs.rb +47 -38
  128. data/lib/rdoc/markup/to_html.rb +343 -105
  129. data/lib/rdoc/markup/to_html_crossref.rb +143 -58
  130. data/lib/rdoc/markup/to_html_snippet.rb +78 -76
  131. data/lib/rdoc/markup/to_joined_paragraph.rb +3 -9
  132. data/lib/rdoc/markup/to_label.rb +34 -25
  133. data/lib/rdoc/markup/to_markdown.rb +74 -51
  134. data/lib/rdoc/markup/to_rdoc.rb +141 -82
  135. data/lib/rdoc/markup/to_table_of_contents.rb +4 -5
  136. data/lib/rdoc/markup/to_test.rb +10 -3
  137. data/lib/rdoc/markup/to_tt_only.rb +17 -31
  138. data/lib/rdoc/markup/verbatim.rb +5 -6
  139. data/lib/rdoc/markup.rb +59 -707
  140. data/lib/rdoc/options.rb +228 -101
  141. data/lib/rdoc/parser/c.rb +186 -184
  142. data/lib/rdoc/parser/changelog.rb +57 -13
  143. data/lib/rdoc/parser/markdown.rb +0 -2
  144. data/lib/rdoc/parser/rbs.rb +275 -0
  145. data/lib/rdoc/parser/rd.rb +0 -1
  146. data/lib/rdoc/parser/ruby.rb +963 -2024
  147. data/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  148. data/lib/rdoc/parser/simple.rb +6 -23
  149. data/lib/rdoc/parser/text.rb +0 -1
  150. data/lib/rdoc/parser.rb +35 -14
  151. data/lib/rdoc/rbs_helper.rb +186 -0
  152. data/lib/rdoc/rd/block_parser.rb +659 -11
  153. data/lib/rdoc/rd/block_parser.ry +13 -9
  154. data/lib/rdoc/rd/inline.rb +4 -5
  155. data/lib/rdoc/rd/inline_parser.rb +646 -2
  156. data/lib/rdoc/rd.rb +4 -5
  157. data/lib/rdoc/rdoc.rb +234 -90
  158. data/lib/rdoc/ri/driver.rb +172 -172
  159. data/lib/rdoc/ri/paths.rb +3 -3
  160. data/lib/rdoc/{servlet.rb → ri/servlet.rb} +28 -27
  161. data/lib/rdoc/ri/store.rb +0 -1
  162. data/lib/rdoc/ri/task.rb +3 -3
  163. data/lib/rdoc/ri.rb +5 -5
  164. data/lib/rdoc/rubygems_hook.rb +106 -25
  165. data/lib/rdoc/server.rb +460 -0
  166. data/lib/rdoc/stats/normal.rb +1 -1
  167. data/lib/rdoc/stats/quiet.rb +1 -2
  168. data/lib/rdoc/stats/verbose.rb +3 -5
  169. data/lib/rdoc/stats.rb +158 -136
  170. data/lib/rdoc/store.rb +267 -48
  171. data/lib/rdoc/task.rb +54 -28
  172. data/lib/rdoc/text.rb +60 -120
  173. data/lib/rdoc/token_stream.rb +30 -45
  174. data/lib/rdoc/tom_doc.rb +9 -15
  175. data/lib/rdoc/version.rb +3 -1
  176. data/lib/rdoc.rb +90 -52
  177. data/lib/rubygems_plugin.rb +14 -0
  178. data/man/ri.1 +2 -0
  179. data/rdoc-logo.svg +43 -0
  180. data/rdoc.gemspec +25 -200
  181. metadata +120 -53
  182. data/CONTRIBUTING.rdoc +0 -220
  183. data/ExampleMarkdown.md +0 -37
  184. data/ExampleRDoc.rdoc +0 -208
  185. data/Gemfile +0 -12
  186. data/README.rdoc +0 -129
  187. data/RI.rdoc +0 -57
  188. data/Rakefile +0 -101
  189. data/bin/console +0 -7
  190. data/bin/setup +0 -6
  191. data/lib/rdoc/anon_class.rb +0 -11
  192. data/lib/rdoc/context/section.rb +0 -232
  193. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  194. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  195. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  196. data/lib/rdoc/generator/template/json_index/.document +0 -1
  197. data/lib/rdoc/ghost_method.rb +0 -7
  198. data/lib/rdoc/markup/attr_changer.rb +0 -23
  199. data/lib/rdoc/markup/attr_span.rb +0 -36
  200. data/lib/rdoc/markup/attribute_manager.rb +0 -409
  201. data/lib/rdoc/markup/attributes.rb +0 -71
  202. data/lib/rdoc/markup/regexp_handling.rb +0 -41
  203. data/lib/rdoc/meta_method.rb +0 -7
  204. data/lib/rdoc/parser/ripper_state_lex.rb +0 -590
  205. data/lib/rdoc/parser/ruby_tools.rb +0 -167
@@ -1,232 +0,0 @@
1
- # frozen_string_literal: true
2
- ##
3
- # A section of documentation like:
4
- #
5
- # # :section: The title
6
- # # The body
7
- #
8
- # Sections can be referenced multiple times and will be collapsed into a
9
- # single section.
10
-
11
- class RDoc::Context::Section
12
-
13
- include RDoc::Text
14
-
15
- MARSHAL_VERSION = 0 # :nodoc:
16
-
17
- ##
18
- # Section comment
19
-
20
- attr_reader :comment
21
-
22
- ##
23
- # Section comments
24
-
25
- attr_reader :comments
26
-
27
- ##
28
- # Context this Section lives in
29
-
30
- attr_reader :parent
31
-
32
- ##
33
- # Section title
34
-
35
- attr_reader :title
36
-
37
- ##
38
- # Creates a new section with +title+ and +comment+
39
-
40
- def initialize parent, title, comment
41
- @parent = parent
42
- @title = title ? title.strip : title
43
-
44
- @comments = []
45
-
46
- add_comment comment
47
- end
48
-
49
- ##
50
- # Sections are equal when they have the same #title
51
-
52
- def == other
53
- self.class === other and @title == other.title
54
- end
55
-
56
- alias eql? ==
57
-
58
- ##
59
- # Adds +comment+ to this section
60
-
61
- def add_comment comment
62
- comment = extract_comment comment
63
-
64
- return if comment.empty?
65
-
66
- case comment
67
- when RDoc::Comment then
68
- @comments << comment
69
- when RDoc::Markup::Document then
70
- @comments.concat comment.parts
71
- when Array then
72
- @comments.concat comment
73
- else
74
- raise TypeError, "unknown comment type: #{comment.inspect}"
75
- end
76
- end
77
-
78
- ##
79
- # Anchor reference for linking to this section
80
-
81
- def aref
82
- title = @title || '[untitled]'
83
-
84
- CGI.escape(title).gsub('%', '-').sub(/^-/, '')
85
- end
86
-
87
- ##
88
- # Extracts the comment for this section from the original comment block.
89
- # If the first line contains :section:, strip it and use the rest.
90
- # Otherwise remove lines up to the line containing :section:, and look
91
- # for those lines again at the end and remove them. This lets us write
92
- #
93
- # # :section: The title
94
- # # The body
95
-
96
- def extract_comment comment
97
- case comment
98
- when Array then
99
- comment.map do |c|
100
- extract_comment c
101
- end
102
- when nil
103
- RDoc::Comment.new ''
104
- when RDoc::Comment then
105
- if comment.text =~ /^#[ \t]*:section:.*\n/ then
106
- start = $`
107
- rest = $'
108
-
109
- comment.text = if start.empty? then
110
- rest
111
- else
112
- rest.sub(/#{start.chomp}\Z/, '')
113
- end
114
- end
115
-
116
- comment
117
- when RDoc::Markup::Document then
118
- comment
119
- else
120
- raise TypeError, "unknown comment #{comment.inspect}"
121
- end
122
- end
123
-
124
- def inspect # :nodoc:
125
- "#<%s:0x%x %p>" % [self.class, object_id, title]
126
- end
127
-
128
- def hash # :nodoc:
129
- @title.hash
130
- end
131
-
132
- ##
133
- # The files comments in this section come from
134
-
135
- def in_files
136
- return [] if @comments.empty?
137
-
138
- case @comments
139
- when Array then
140
- @comments.map do |comment|
141
- comment.file
142
- end
143
- when RDoc::Markup::Document then
144
- @comment.parts.map do |document|
145
- document.file
146
- end
147
- else
148
- raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
149
- end
150
- end
151
-
152
- ##
153
- # Serializes this Section. The title and parsed comment are saved, but not
154
- # the section parent which must be restored manually.
155
-
156
- def marshal_dump
157
- [
158
- MARSHAL_VERSION,
159
- @title,
160
- parse,
161
- ]
162
- end
163
-
164
- ##
165
- # De-serializes this Section. The section parent must be restored manually.
166
-
167
- def marshal_load array
168
- @parent = nil
169
-
170
- @title = array[1]
171
- @comments = array[2]
172
- end
173
-
174
- ##
175
- # Parses +comment_location+ into an RDoc::Markup::Document composed of
176
- # multiple RDoc::Markup::Documents with their file set.
177
-
178
- def parse
179
- case @comments
180
- when String then
181
- super
182
- when Array then
183
- docs = @comments.map do |comment, location|
184
- doc = super comment
185
- doc.file = location if location
186
- doc
187
- end
188
-
189
- RDoc::Markup::Document.new(*docs)
190
- when RDoc::Comment then
191
- doc = super @comments.text, comments.format
192
- doc.file = @comments.location
193
- doc
194
- when RDoc::Markup::Document then
195
- return @comments
196
- else
197
- raise ArgumentError, "unknown comment class #{comments.class}"
198
- end
199
- end
200
-
201
- ##
202
- # The section's title, or 'Top Section' if the title is nil.
203
- #
204
- # This is used by the table of contents template so the name is silly.
205
-
206
- def plain_html
207
- @title || 'Top Section'
208
- end
209
-
210
- ##
211
- # Removes a comment from this section if it is from the same file as
212
- # +comment+
213
-
214
- def remove_comment comment
215
- return if @comments.empty?
216
-
217
- case @comments
218
- when Array then
219
- @comments.delete_if do |my_comment|
220
- my_comment.file == comment.file
221
- end
222
- when RDoc::Markup::Document then
223
- @comments.parts.delete_if do |document|
224
- document.file == comment.file.name
225
- end
226
- else
227
- raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
228
- end
229
- end
230
-
231
- end
232
-
File without changes
@@ -1,19 +0,0 @@
1
- <%- if !svninfo.empty? then %>
2
- <div id="file-svninfo-section" class="nav-section">
3
- <h3>VCS Info</h3>
4
-
5
- <div class="section-body">
6
- <dl class="svninfo">
7
- <dt>Rev
8
- <dd><%= svninfo[:rev] %>
9
-
10
- <dt>Last Checked In
11
- <dd><%= svninfo[:commitdate].strftime('%Y-%m-%d %H:%M:%S') %>
12
- (<%= svninfo[:commitdelta] %> ago)
13
-
14
- <dt>Checked in by
15
- <dd><%= svninfo[:committer] %>
16
- </dl>
17
- </div>
18
- </div>
19
- <%- end -%>
@@ -1,9 +0,0 @@
1
- <div id="file-list-section" class="nav-section">
2
- <h3>Defined In</h3>
3
-
4
- <ul>
5
- <%- klass.in_files.each do |tl| -%>
6
- <li><%= h tl.relative_name %>
7
- <%- end -%>
8
- </ul>
9
- </div>
@@ -1 +0,0 @@
1
- # ignore all files in this directory
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
- ##
3
- # GhostMethod represents a method referenced only by a comment
4
-
5
- class RDoc::GhostMethod < RDoc::AnyMethod
6
- end
7
-
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
- class RDoc::Markup
3
-
4
- AttrChanger = Struct.new :turn_on, :turn_off # :nodoc:
5
-
6
- end
7
-
8
- ##
9
- # An AttrChanger records a change in attributes. It contains a bitmap of the
10
- # attributes to turn on, and a bitmap of those to turn off.
11
-
12
- class RDoc::Markup::AttrChanger
13
-
14
- def to_s # :nodoc:
15
- "Attr: +#{turn_on}/-#{turn_off}"
16
- end
17
-
18
- def inspect # :nodoc:
19
- '+%d/-%d' % [turn_on, turn_off]
20
- end
21
-
22
- end
23
-
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
- ##
3
- # An array of attributes which parallels the characters in a string.
4
-
5
- class RDoc::Markup::AttrSpan
6
-
7
- ##
8
- # Creates a new AttrSpan for +length+ characters
9
-
10
- def initialize(length, exclusive)
11
- @attrs = Array.new(length, 0)
12
- @exclusive = exclusive
13
- end
14
-
15
- ##
16
- # Toggles +bits+ from +start+ to +length+
17
- def set_attrs(start, length, bits)
18
- updated = false
19
- for i in start ... (start+length)
20
- if (@exclusive & @attrs[i]) == 0 || (@exclusive & bits) != 0
21
- @attrs[i] |= bits
22
- updated = true
23
- end
24
- end
25
- updated
26
- end
27
-
28
- ##
29
- # Accesses flags for character +n+
30
-
31
- def [](n)
32
- @attrs[n]
33
- end
34
-
35
- end
36
-