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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -3
- data/RI.md +75 -75
- data/exe/rdoc +2 -2
- data/lib/rdoc/code_object/alias.rb +71 -69
- data/lib/rdoc/code_object/any_method.rb +305 -303
- data/lib/rdoc/code_object/attr.rb +150 -148
- data/lib/rdoc/code_object/class_module.rb +798 -792
- data/lib/rdoc/code_object/constant.rb +175 -173
- data/lib/rdoc/code_object/context/section.rb +142 -138
- data/lib/rdoc/code_object/context.rb +926 -958
- data/lib/rdoc/code_object/extend.rb +7 -5
- data/lib/rdoc/code_object/include.rb +7 -5
- data/lib/rdoc/code_object/method_attr.rb +326 -319
- data/lib/rdoc/code_object/mixin.rb +97 -95
- data/lib/rdoc/code_object/normal_class.rb +77 -78
- data/lib/rdoc/code_object/normal_module.rb +61 -59
- data/lib/rdoc/code_object/require.rb +23 -39
- data/lib/rdoc/code_object/single_class.rb +21 -19
- data/lib/rdoc/code_object/top_level.rb +212 -219
- data/lib/rdoc/code_object.rb +305 -303
- data/lib/rdoc/comment.rb +275 -273
- data/lib/rdoc/cross_reference.rb +192 -190
- data/lib/rdoc/encoding.rb +105 -103
- data/lib/rdoc/erb_partial.rb +13 -11
- data/lib/rdoc/erbio.rb +29 -27
- data/lib/rdoc/generator/aliki.rb +161 -153
- data/lib/rdoc/generator/darkfish.rb +645 -635
- data/lib/rdoc/generator/json_index.rb +233 -229
- data/lib/rdoc/generator/markup.rb +164 -146
- data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
- data/lib/rdoc/generator/pot/po.rb +52 -51
- data/lib/rdoc/generator/pot/po_entry.rb +138 -132
- data/lib/rdoc/generator/pot.rb +85 -81
- data/lib/rdoc/generator/ri.rb +23 -19
- data/lib/rdoc/generator/template/aliki/DESIGN.md +6 -4
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +10 -10
- data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +207 -178
- data/lib/rdoc/generator/template/aliki/js/aliki.js +60 -84
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
- data/lib/rdoc/generator.rb +48 -46
- data/lib/rdoc/i18n/locale.rb +99 -95
- data/lib/rdoc/i18n/text.rb +109 -105
- data/lib/rdoc/i18n.rb +7 -5
- data/lib/rdoc/markdown/byte_runtime.rb +80 -0
- data/lib/rdoc/markdown.kpeg +15 -11
- data/lib/rdoc/markdown.rb +40 -47
- data/lib/rdoc/markup/block_quote.rb +12 -8
- data/lib/rdoc/markup/document.rb +127 -123
- data/lib/rdoc/markup/formatter.rb +219 -215
- data/lib/rdoc/markup/include.rb +33 -29
- data/lib/rdoc/markup/indented_paragraph.rb +37 -33
- data/lib/rdoc/markup/inline_parser.rb +281 -277
- data/lib/rdoc/markup/list.rb +80 -88
- data/lib/rdoc/markup/list_item.rb +73 -85
- data/lib/rdoc/markup/paragraph.rb +23 -19
- data/lib/rdoc/markup/parser.rb +501 -497
- data/lib/rdoc/markup/pre_process.rb +283 -279
- data/lib/rdoc/markup/raw.rb +2 -2
- data/lib/rdoc/markup/rule.rb +16 -12
- data/lib/rdoc/markup/to_ansi.rb +143 -139
- data/lib/rdoc/markup/to_bs.rb +72 -68
- data/lib/rdoc/markup/to_html.rb +594 -565
- data/lib/rdoc/markup/to_html_crossref.rb +234 -230
- data/lib/rdoc/markup/to_html_snippet.rb +232 -227
- data/lib/rdoc/markup/to_joined_paragraph.rb +36 -32
- data/lib/rdoc/markup/to_label.rb +63 -59
- data/lib/rdoc/markup/to_markdown.rb +212 -208
- data/lib/rdoc/markup/to_rdoc.rb +336 -332
- data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
- data/lib/rdoc/markup/to_test.rb +60 -56
- data/lib/rdoc/markup/to_tt_only.rb +84 -80
- data/lib/rdoc/markup/verbatim.rb +62 -58
- data/lib/rdoc/markup.rb +198 -196
- data/lib/rdoc/options.rb +1063 -1061
- data/lib/rdoc/parser/c.rb +1039 -1037
- data/lib/rdoc/parser/changelog.rb +319 -315
- data/lib/rdoc/parser/markdown.rb +17 -13
- data/lib/rdoc/parser/rbs.rb +239 -235
- data/lib/rdoc/parser/rd.rb +17 -13
- data/lib/rdoc/parser/ruby.rb +1245 -1124
- data/lib/rdoc/parser/ruby_colorizer.rb +263 -213
- data/lib/rdoc/parser/simple.rb +31 -27
- data/lib/rdoc/parser/text.rb +12 -8
- data/lib/rdoc/parser.rb +228 -220
- data/lib/rdoc/rbs_helper.rb +1 -1
- data/lib/rdoc/rd/inline.rb +57 -53
- data/lib/rdoc/rd.rb +90 -88
- data/lib/rdoc/rdoc.rb +500 -491
- data/lib/rdoc/ri/driver.rb +1140 -1135
- data/lib/rdoc/ri/formatter.rb +7 -3
- data/lib/rdoc/ri/paths.rb +140 -136
- data/lib/rdoc/ri/servlet.rb +354 -350
- data/lib/rdoc/ri/store.rb +4 -2
- data/lib/rdoc/ri/task.rb +55 -51
- data/lib/rdoc/ri.rb +14 -12
- data/lib/rdoc/rubygems_hook.rb +183 -181
- data/lib/rdoc/server.rb +349 -347
- data/lib/rdoc/stats/normal.rb +46 -42
- data/lib/rdoc/stats/quiet.rb +39 -35
- data/lib/rdoc/stats/verbose.rb +35 -31
- data/lib/rdoc/stats.rb +365 -363
- data/lib/rdoc/store.rb +888 -902
- data/lib/rdoc/task.rb +260 -256
- data/lib/rdoc/text.rb +135 -133
- data/lib/rdoc/token_stream.rb +101 -93
- data/lib/rdoc/tom_doc.rb +203 -201
- data/lib/rdoc/version.rb +1 -1
- metadata +4 -5
- data/lib/rdoc/markdown/literals.kpeg +0 -21
- 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
|
-
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
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
|
|
16
|
+
class Section
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
include Text
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
MARSHAL_VERSION = 0 # :nodoc:
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
##
|
|
23
|
+
# Section comments
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
attr_reader :comments
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
##
|
|
28
|
+
# Context this Section lives in
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
attr_reader :parent
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
##
|
|
33
|
+
# Section title
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
attr_reader :title
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
##
|
|
38
|
+
# The RDoc::Store for this object.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
attr_reader :store
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
##
|
|
43
|
+
# Creates a new section with +title+ and +comment+
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
def initialize(parent, title, comment, store = nil)
|
|
46
|
+
@parent = parent
|
|
47
|
+
@title = title ? title.strip : title
|
|
48
|
+
@store = store
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
@comments = []
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
add_comment comment
|
|
53
|
+
end
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
##
|
|
56
|
+
# Sections are equal when they have the same #title
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
def ==(other)
|
|
59
|
+
self.class === other and @title == other.title
|
|
60
|
+
end
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
alias eql? ==
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
##
|
|
65
|
+
# Adds +comment+ to this section
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
+
def aref
|
|
84
|
+
title = @title || '[untitled]'
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
Text.to_anchor(title)
|
|
87
|
+
end
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
+
def legacy_aref
|
|
98
|
+
title = @title || '[untitled]'
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
CGI.escape(title).gsub('%', '-').sub(/^-/, '')
|
|
101
|
+
end
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
def inspect # :nodoc:
|
|
104
|
+
"#<%s:0x%x %p>" % [self.class, object_id, title]
|
|
105
|
+
end
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
##
|
|
110
|
-
# The files comments in this section come from
|
|
107
|
+
def hash # :nodoc:
|
|
108
|
+
@title.hash
|
|
109
|
+
end
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
end
|
|
111
|
+
##
|
|
112
|
+
# The files comments in this section come from
|
|
115
113
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
def in_files
|
|
115
|
+
@comments.map(&:file)
|
|
116
|
+
end
|
|
119
117
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
122
|
+
def marshal_dump
|
|
123
|
+
[
|
|
124
|
+
MARSHAL_VERSION,
|
|
125
|
+
@title,
|
|
126
|
+
to_document,
|
|
127
|
+
]
|
|
128
|
+
end
|
|
130
129
|
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
##
|
|
131
|
+
# De-serializes this Section. The section parent must be restored manually.
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
end
|
|
133
|
+
def marshal_load(array)
|
|
134
|
+
@parent = nil
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
@title = array[1]
|
|
137
|
+
@comments = array[2].parts.map { |doc| Comment.from_document(doc) }
|
|
138
|
+
end
|
|
141
139
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|