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
data/lib/rdoc/markup/document.rb
CHANGED
|
@@ -1,164 +1,168 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
module RDoc
|
|
3
|
+
class Markup
|
|
4
|
+
##
|
|
5
|
+
# A Document containing lists, headings, paragraphs, etc.
|
|
4
6
|
|
|
5
|
-
class
|
|
7
|
+
class Document
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
include Enumerable
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
##
|
|
12
|
+
# The file this document was created from. See also
|
|
13
|
+
# RDoc::ClassModule#add_comment
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
attr_reader :file
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
##
|
|
18
|
+
# If a heading is below the given level it will be omitted from the
|
|
19
|
+
# table_of_contents
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
attr_accessor :omit_headings_below
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
##
|
|
24
|
+
# The parts of the Document
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
attr_reader :parts
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
##
|
|
29
|
+
# Creates a new Document with +parts+
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
def initialize(*parts)
|
|
32
|
+
@parts = []
|
|
33
|
+
@parts.concat parts
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
##
|
|
38
|
-
# Appends +part+ to the document
|
|
35
|
+
@file = nil
|
|
36
|
+
@omit_headings_from_table_of_contents_below = nil
|
|
37
|
+
end
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
##
|
|
40
|
+
# Appends +part+ to the document
|
|
41
|
+
|
|
42
|
+
def <<(part)
|
|
43
|
+
case part
|
|
44
|
+
when Markup::Document
|
|
45
|
+
unless part.empty?
|
|
46
|
+
parts.concat part.parts
|
|
47
|
+
parts << Markup::BlankLine.new
|
|
48
|
+
end
|
|
49
|
+
when String
|
|
50
|
+
raise ArgumentError,
|
|
51
|
+
"expected RDoc::Markup::Document and friends, got String" unless
|
|
52
|
+
part.empty?
|
|
53
|
+
else
|
|
54
|
+
parts << part
|
|
55
|
+
end
|
|
46
56
|
end
|
|
47
|
-
when String then
|
|
48
|
-
raise ArgumentError,
|
|
49
|
-
"expected RDoc::Markup::Document and friends, got String" unless
|
|
50
|
-
part.empty?
|
|
51
|
-
else
|
|
52
|
-
parts << part
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
def ==(other) # :nodoc:
|
|
59
|
+
self.class == other.class and
|
|
60
|
+
@file == other.file and
|
|
61
|
+
@parts == other.parts
|
|
62
|
+
end
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
##
|
|
65
|
+
# Runs this document and all its #items through +visitor+
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
def accept(visitor)
|
|
68
|
+
visitor.start_accepting
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
visitor.accept_document self
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
visitor.end_accepting
|
|
73
|
+
end
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
##
|
|
76
|
+
# Concatenates the given +parts+ onto the document
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
def concat(parts)
|
|
79
|
+
self.parts.concat parts
|
|
80
|
+
end
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
##
|
|
83
|
+
# Enumerator for the parts of this document
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
def each(&block)
|
|
86
|
+
@parts.each(&block)
|
|
87
|
+
end
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
##
|
|
90
|
+
# Does this document have no parts?
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
def empty?
|
|
93
|
+
@parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)
|
|
94
|
+
end
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
##
|
|
97
|
+
# The file this Document was created from.
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
##
|
|
107
|
-
# When this is a collection of documents (#file is not set and this document
|
|
108
|
-
# contains only other documents as its direct children) #merge replaces
|
|
109
|
-
# documents in this class with documents from +other+ when the file matches
|
|
110
|
-
# and adds documents from +other+ when the files do not.
|
|
111
|
-
#
|
|
112
|
-
# The information in +other+ is preferred over the receiver
|
|
113
|
-
|
|
114
|
-
def merge(other)
|
|
115
|
-
if empty? then
|
|
116
|
-
@parts = other.parts
|
|
117
|
-
return self
|
|
118
|
-
end
|
|
99
|
+
def file=(location)
|
|
100
|
+
@file = case location
|
|
101
|
+
when TopLevel
|
|
102
|
+
location.relative_name
|
|
103
|
+
else
|
|
104
|
+
location
|
|
105
|
+
end
|
|
106
|
+
end
|
|
119
107
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
##
|
|
109
|
+
# When this is a collection of documents (#file is not set and this document
|
|
110
|
+
# contains only other documents as its direct children) #merge replaces
|
|
111
|
+
# documents in this class with documents from +other+ when the file matches
|
|
112
|
+
# and adds documents from +other+ when the files do not.
|
|
113
|
+
#
|
|
114
|
+
# The information in +other+ is preferred over the receiver
|
|
115
|
+
|
|
116
|
+
def merge(other)
|
|
117
|
+
if empty?
|
|
118
|
+
@parts = other.parts
|
|
119
|
+
return self
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
other.parts.each do |other_part|
|
|
123
|
+
self.parts.delete_if do |self_part|
|
|
124
|
+
self_part.file and self_part.file == other_part.file
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
self.parts << other_part
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
self
|
|
123
131
|
end
|
|
124
132
|
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
##
|
|
134
|
+
# Does this Document contain other Documents?
|
|
127
135
|
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
def merged?
|
|
137
|
+
Markup::Document === @parts.first
|
|
138
|
+
end
|
|
130
139
|
|
|
131
|
-
|
|
132
|
-
|
|
140
|
+
def pretty_print(q) # :nodoc:
|
|
141
|
+
start = @file ? "[doc (#{@file}): " : '[doc: '
|
|
133
142
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
q.group 2, start, ']' do
|
|
144
|
+
q.seplist @parts do |part|
|
|
145
|
+
q.pp part
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
137
149
|
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
##
|
|
151
|
+
# Appends +parts+ to the document
|
|
140
152
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
q.pp part
|
|
153
|
+
def push(*parts)
|
|
154
|
+
self.parts.concat parts
|
|
144
155
|
end
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
156
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
self.parts.concat parts
|
|
153
|
-
end
|
|
157
|
+
##
|
|
158
|
+
# Returns an Array of headings in the document.
|
|
159
|
+
#
|
|
160
|
+
# Require 'rdoc/markup/formatter' before calling this method.
|
|
154
161
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
# Require 'rdoc/markup/formatter' before calling this method.
|
|
162
|
+
def table_of_contents
|
|
163
|
+
accept Markup::ToTableOfContents.to_toc
|
|
164
|
+
end
|
|
159
165
|
|
|
160
|
-
|
|
161
|
-
accept RDoc::Markup::ToTableOfContents.to_toc
|
|
166
|
+
end
|
|
162
167
|
end
|
|
163
|
-
|
|
164
168
|
end
|