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
@@ -12,274 +12,278 @@
12
12
 
13
13
  require 'rdoc/markup/inline_parser'
14
14
 
15
- class RDoc::Markup::Formatter
15
+ module RDoc
16
+ class Markup
17
+ class Formatter
16
18
 
17
- ##
18
- # Converts a target url to one that is relative to a given path
19
+ ##
20
+ # Converts a target url to one that is relative to a given path
19
21
 
20
- def self.gen_relative_url(path, target)
21
- from = File.dirname path
22
- to, to_file = File.split target
22
+ def self.gen_relative_url(path, target)
23
+ from = File.dirname path
24
+ to, to_file = File.split target
23
25
 
24
- from = from.split "/"
25
- to = to.split "/"
26
+ from = from.split "/"
27
+ to = to.split "/"
26
28
 
27
- from.delete '.'
28
- to.delete '.'
29
+ from.delete '.'
30
+ to.delete '.'
29
31
 
30
- while from.size > 0 and to.size > 0 and from[0] == to[0] do
31
- from.shift
32
- to.shift
33
- end
34
-
35
- from.fill ".."
36
- from.concat to
37
- from << to_file
38
- File.join(*from)
39
- end
40
-
41
- ##
42
- # Creates a new Formatter
32
+ while from.size > 0 and to.size > 0 and from[0] == to[0] do
33
+ from.shift
34
+ to.shift
35
+ end
43
36
 
44
- def initialize
45
- @markup = RDoc::Markup.new
37
+ from.fill ".."
38
+ from.concat to
39
+ from << to_file
40
+ File.join(*from)
41
+ end
46
42
 
47
- @from_path = '.'
48
- end
43
+ ##
44
+ # Creates a new Formatter
49
45
 
50
- ##
51
- # Adds +document+ to the output
46
+ def initialize
47
+ @markup = Markup.new
52
48
 
53
- def accept_document(document)
54
- document.parts.each do |item|
55
- case item
56
- when RDoc::Markup::Document then # HACK
57
- accept_document item
58
- else
59
- item.accept self
49
+ @from_path = '.'
60
50
  end
61
- end
62
- end
63
51
 
64
- ##
65
- # Adds a regexp handling for links of the form rdoc-...:
52
+ ##
53
+ # Adds +document+ to the output
54
+
55
+ def accept_document(document)
56
+ document.parts.each do |item|
57
+ case item
58
+ when Markup::Document # HACK
59
+ accept_document item
60
+ else
61
+ item.accept self
62
+ end
63
+ end
64
+ end
66
65
 
67
- def add_regexp_handling_RDOCLINK
68
- @markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
69
- end
66
+ ##
67
+ # Adds a regexp handling for links of the form rdoc-...:
70
68
 
71
- ##
72
- # Allows +tag+ to be decorated with additional information.
69
+ def add_regexp_handling_RDOCLINK
70
+ @markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
71
+ end
73
72
 
74
- def annotate(tag)
75
- tag
76
- end
73
+ ##
74
+ # Allows +tag+ to be decorated with additional information.
77
75
 
78
- ##
79
- # Marks up +content+
76
+ def annotate(tag)
77
+ tag
78
+ end
80
79
 
81
- def convert(content)
82
- @markup.convert content, self
83
- end
80
+ ##
81
+ # Marks up +content+
84
82
 
85
- # Applies regexp handling to +text+ and returns an array of [text, converted?] pairs.
83
+ def convert(content)
84
+ @markup.convert content, self
85
+ end
86
86
 
87
- def apply_regexp_handling(text)
88
- matched = []
89
- @markup.regexp_handlings.each_with_index do |(pattern, name), priority|
90
- text.scan(pattern) do
91
- m = Regexp.last_match
92
- idx = m[1] ? 1 : 0
93
- matched << [m.begin(idx), m.end(idx), m[idx], name, priority]
87
+ # Applies regexp handling to +text+ and returns an array of [text, converted?] pairs.
88
+
89
+ def apply_regexp_handling(text)
90
+ matched = []
91
+ @markup.regexp_handlings.each_with_index do |(pattern, name), priority|
92
+ text.scan(pattern) do
93
+ m = Regexp.last_match
94
+ idx = m[1] ? 1 : 0
95
+ matched << [m.begin(idx), m.end(idx), m[idx], name, priority]
96
+ end
97
+ end
98
+ # If the start positions are the same, prefer the earlier-registered one
99
+ # (lower numeric priority from each_with_index).
100
+ matched.sort_by! {|beg_pos, _, _, _, priority| [beg_pos, priority] }
101
+
102
+ pos = 0
103
+ output = []
104
+ matched.each do |beg_pos, end_pos, s, name|
105
+ next if beg_pos < pos
106
+
107
+ output << [text[pos...beg_pos], false] if beg_pos != pos
108
+ handled = public_send(:"handle_regexp_#{name}", s)
109
+ output << [handled, true]
110
+ pos = end_pos
111
+ end
112
+
113
+ output << [text[pos..], false] if pos < text.size
114
+ output
94
115
  end
95
- end
96
- # If the start positions are the same, prefer the earlier-registered one
97
- # (lower numeric priority from each_with_index).
98
- matched.sort_by! {|beg_pos, _, _, _, priority| [beg_pos, priority] }
99
-
100
- pos = 0
101
- output = []
102
- matched.each do |beg_pos, end_pos, s, name|
103
- next if beg_pos < pos
104
-
105
- output << [text[pos...beg_pos], false] if beg_pos != pos
106
- handled = public_send(:"handle_regexp_#{name}", s)
107
- output << [handled, true]
108
- pos = end_pos
109
- end
110
116
 
111
- output << [text[pos..], false] if pos < text.size
112
- output
113
- end
117
+ # Called when processing plain text while traversing inline nodes from handle_inline.
118
+ # +text+ may need proper escaping.
114
119
 
115
- # Called when processing plain text while traversing inline nodes from handle_inline.
116
- # +text+ may need proper escaping.
120
+ def handle_PLAIN_TEXT(text)
121
+ end
117
122
 
118
- def handle_PLAIN_TEXT(text)
119
- end
123
+ # Called when processing regexp-handling-processed text while traversing inline nodes from handle_inline.
124
+ # +text+ may contain markup tags.
120
125
 
121
- # Called when processing regexp-handling-processed text while traversing inline nodes from handle_inline.
122
- # +text+ may contain markup tags.
126
+ def handle_REGEXP_HANDLING_TEXT(text)
127
+ end
123
128
 
124
- def handle_REGEXP_HANDLING_TEXT(text)
125
- end
129
+ # Called when processing text node while traversing inline nodes from handle_inline.
130
+ # Apply regexp handling and dispatch to the appropriate handler: handle_REGEXP_HANDLING_TEXT or handle_PLAIN_TEXT.
131
+
132
+ def handle_TEXT(text)
133
+ apply_regexp_handling(text).each do |part, converted|
134
+ if converted
135
+ handle_REGEXP_HANDLING_TEXT(part)
136
+ else
137
+ handle_PLAIN_TEXT(part)
138
+ end
139
+ end
140
+ end
126
141
 
127
- # Called when processing text node while traversing inline nodes from handle_inline.
128
- # Apply regexp handling and dispatch to the appropriate handler: handle_REGEXP_HANDLING_TEXT or handle_PLAIN_TEXT.
142
+ # Called when processing a hard break while traversing inline nodes from handle_inline.
129
143
 
130
- def handle_TEXT(text)
131
- apply_regexp_handling(text).each do |part, converted|
132
- if converted
133
- handle_REGEXP_HANDLING_TEXT(part)
134
- else
135
- handle_PLAIN_TEXT(part)
144
+ def handle_HARD_BREAK
136
145
  end
137
- end
138
- end
139
146
 
140
- # Called when processing a hard break while traversing inline nodes from handle_inline.
147
+ # Called when processing bold nodes while traversing inline nodes from handle_inline.
148
+ # Traverse the children nodes and dispatch to the appropriate handlers.
141
149
 
142
- def handle_HARD_BREAK
143
- end
150
+ def handle_BOLD(nodes)
151
+ traverse_inline_nodes(nodes)
152
+ end
144
153
 
145
- # Called when processing bold nodes while traversing inline nodes from handle_inline.
146
- # Traverse the children nodes and dispatch to the appropriate handlers.
154
+ # Called when processing emphasis nodes while traversing inline nodes from handle_inline.
155
+ # Traverse the children nodes and dispatch to the appropriate handlers.
147
156
 
148
- def handle_BOLD(nodes)
149
- traverse_inline_nodes(nodes)
150
- end
157
+ def handle_EM(nodes)
158
+ traverse_inline_nodes(nodes)
159
+ end
151
160
 
152
- # Called when processing emphasis nodes while traversing inline nodes from handle_inline.
153
- # Traverse the children nodes and dispatch to the appropriate handlers.
161
+ # Called when processing bold word nodes while traversing inline nodes from handle_inline.
162
+ # +word+ may need proper escaping.
154
163
 
155
- def handle_EM(nodes)
156
- traverse_inline_nodes(nodes)
157
- end
164
+ def handle_BOLD_WORD(word)
165
+ handle_PLAIN_TEXT(word)
166
+ end
158
167
 
159
- # Called when processing bold word nodes while traversing inline nodes from handle_inline.
160
- # +word+ may need proper escaping.
168
+ # Called when processing emphasis word nodes while traversing inline nodes from handle_inline.
169
+ # +word+ may need proper escaping.
161
170
 
162
- def handle_BOLD_WORD(word)
163
- handle_PLAIN_TEXT(word)
164
- end
171
+ def handle_EM_WORD(word)
172
+ handle_PLAIN_TEXT(word)
173
+ end
165
174
 
166
- # Called when processing emphasis word nodes while traversing inline nodes from handle_inline.
167
- # +word+ may need proper escaping.
175
+ # Called when processing tt nodes while traversing inline nodes from handle_inline.
176
+ # +code+ may need proper escaping.
168
177
 
169
- def handle_EM_WORD(word)
170
- handle_PLAIN_TEXT(word)
171
- end
178
+ def handle_TT(code)
179
+ handle_PLAIN_TEXT(code)
180
+ end
172
181
 
173
- # Called when processing tt nodes while traversing inline nodes from handle_inline.
174
- # +code+ may need proper escaping.
182
+ # Called when processing strike nodes while traversing inline nodes from handle_inline.
183
+ # Traverse the children nodes and dispatch to the appropriate handlers.
175
184
 
176
- def handle_TT(code)
177
- handle_PLAIN_TEXT(code)
178
- end
185
+ def handle_STRIKE(nodes)
186
+ traverse_inline_nodes(nodes)
187
+ end
179
188
 
180
- # Called when processing strike nodes while traversing inline nodes from handle_inline.
181
- # Traverse the children nodes and dispatch to the appropriate handlers.
189
+ # Called when processing tidylink nodes while traversing inline nodes from handle_inline.
190
+ # +label_part+ is an array of strings or nodes representing the link label.
191
+ # +url+ is the link URL.
192
+ # Traverse the label_part nodes and dispatch to the appropriate handlers.
182
193
 
183
- def handle_STRIKE(nodes)
184
- traverse_inline_nodes(nodes)
185
- end
194
+ def handle_TIDYLINK(label_part, url)
195
+ traverse_inline_nodes(label_part)
196
+ end
186
197
 
187
- # Called when processing tidylink nodes while traversing inline nodes from handle_inline.
188
- # +label_part+ is an array of strings or nodes representing the link label.
189
- # +url+ is the link URL.
190
- # Traverse the label_part nodes and dispatch to the appropriate handlers.
198
+ # Parses inline +text+, traverse the resulting nodes, and calls the appropriate handler methods.
191
199
 
192
- def handle_TIDYLINK(label_part, url)
193
- traverse_inline_nodes(label_part)
194
- end
200
+ def handle_inline(text)
201
+ nodes = Markup::InlineParser.new(text).parse
202
+ traverse_inline_nodes(nodes)
203
+ end
195
204
 
196
- # Parses inline +text+, traverse the resulting nodes, and calls the appropriate handler methods.
205
+ # Traverses +nodes+ and calls the appropriate handler methods
206
+ # Nodes formats are described in RDoc::Markup::InlineParser#parse
207
+
208
+ def traverse_inline_nodes(nodes)
209
+ nodes.each do |node|
210
+ next handle_TEXT(node) if String === node
211
+ case node[:type]
212
+ when :TIDYLINK
213
+ handle_TIDYLINK(node[:children], node[:url])
214
+ when :HARD_BREAK
215
+ handle_HARD_BREAK
216
+ when :BOLD
217
+ handle_BOLD(node[:children])
218
+ when :BOLD_WORD
219
+ handle_BOLD_WORD(node[:children][0] || '')
220
+ when :EM
221
+ handle_EM(node[:children])
222
+ when :EM_WORD
223
+ handle_EM_WORD(node[:children][0] || '')
224
+ when :TT
225
+ handle_TT(node[:children][0] || '')
226
+ when :STRIKE
227
+ handle_STRIKE(node[:children])
228
+ end
229
+ end
230
+ end
197
231
 
198
- def handle_inline(text)
199
- nodes = RDoc::Markup::InlineParser.new(text).parse
200
- traverse_inline_nodes(nodes)
201
- end
232
+ ##
233
+ # Converts a string to be fancier if desired
202
234
 
203
- # Traverses +nodes+ and calls the appropriate handler methods
204
- # Nodes formats are described in RDoc::Markup::InlineParser#parse
205
-
206
- def traverse_inline_nodes(nodes)
207
- nodes.each do |node|
208
- next handle_TEXT(node) if String === node
209
- case node[:type]
210
- when :TIDYLINK
211
- handle_TIDYLINK(node[:children], node[:url])
212
- when :HARD_BREAK
213
- handle_HARD_BREAK
214
- when :BOLD
215
- handle_BOLD(node[:children])
216
- when :BOLD_WORD
217
- handle_BOLD_WORD(node[:children][0] || '')
218
- when :EM
219
- handle_EM(node[:children])
220
- when :EM_WORD
221
- handle_EM_WORD(node[:children][0] || '')
222
- when :TT
223
- handle_TT(node[:children][0] || '')
224
- when :STRIKE
225
- handle_STRIKE(node[:children])
235
+ def convert_string(string)
236
+ string
226
237
  end
227
- end
228
- end
229
238
 
230
- ##
231
- # Converts a string to be fancier if desired
239
+ ##
240
+ # Use ignore in your subclass to ignore the content of a node.
241
+ #
242
+ # ##
243
+ # # We don't support raw nodes in ToNoRaw
244
+ #
245
+ # alias accept_raw ignore
232
246
 
233
- def convert_string(string)
234
- string
235
- end
247
+ def ignore(*node)
248
+ end
236
249
 
237
- ##
238
- # Use ignore in your subclass to ignore the content of a node.
239
- #
240
- # ##
241
- # # We don't support raw nodes in ToNoRaw
242
- #
243
- # alias accept_raw ignore
250
+ ##
251
+ # Extracts and a scheme, url and an anchor id from +url+ and returns them.
252
+
253
+ def parse_url(url)
254
+ case url
255
+ when /^rdoc-label:([^:]*)(?::(.*))?/
256
+ scheme = 'link'
257
+ path = "##{$1}"
258
+ id = " id=\"#{$2}\"" if $2
259
+ when /([A-Za-z]+):(.*)/
260
+ scheme = $1.downcase
261
+ path = $2
262
+ when /^#/
263
+ else
264
+ scheme = 'http'
265
+ path = url
266
+ url = url
267
+ end
268
+
269
+ if scheme == 'link'
270
+ url = if path[0, 1] == '#' # is this meaningful?
271
+ path
272
+ else
273
+ self.class.gen_relative_url @from_path, path
274
+ end
275
+ end
276
+
277
+ [scheme, url, id]
278
+ end
244
279
 
245
- def ignore(*node)
246
- end
280
+ ##
281
+ # Is +tag+ a tt tag?
247
282
 
248
- ##
249
- # Extracts and a scheme, url and an anchor id from +url+ and returns them.
250
-
251
- def parse_url(url)
252
- case url
253
- when /^rdoc-label:([^:]*)(?::(.*))?/ then
254
- scheme = 'link'
255
- path = "##{$1}"
256
- id = " id=\"#{$2}\"" if $2
257
- when /([A-Za-z]+):(.*)/ then
258
- scheme = $1.downcase
259
- path = $2
260
- when /^#/ then
261
- else
262
- scheme = 'http'
263
- path = url
264
- url = url
265
- end
283
+ def tt?(tag)
284
+ tag.bit == @tt_bit
285
+ end
266
286
 
267
- if scheme == 'link' then
268
- url = if path[0, 1] == '#' then # is this meaningful?
269
- path
270
- else
271
- self.class.gen_relative_url @from_path, path
272
- end
273
287
  end
274
-
275
- [scheme, url, id]
276
288
  end
277
-
278
- ##
279
- # Is +tag+ a tt tag?
280
-
281
- def tt?(tag)
282
- tag.bit == @tt_bit
283
- end
284
-
285
289
  end
@@ -1,42 +1,46 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A file included at generation time. Objects of this class are created by
4
- # RDoc::RD for an extension-less include.
5
- #
6
- # This implementation in incomplete.
2
+ module RDoc
3
+ class Markup
4
+ ##
5
+ # A file included at generation time. Objects of this class are created by
6
+ # RDoc::RD for an extension-less include.
7
+ #
8
+ # This implementation in incomplete.
7
9
 
8
- class RDoc::Markup::Include
10
+ class Include
9
11
 
10
- ##
11
- # The filename to be included, without extension
12
+ ##
13
+ # The filename to be included, without extension
12
14
 
13
- attr_reader :file
15
+ attr_reader :file
14
16
 
15
- ##
16
- # Directories to search for #file
17
+ ##
18
+ # Directories to search for #file
17
19
 
18
- attr_reader :include_path
20
+ attr_reader :include_path
19
21
 
20
- ##
21
- # Creates a new include that will import +file+ from +include_path+
22
+ ##
23
+ # Creates a new include that will import +file+ from +include_path+
22
24
 
23
- def initialize(file, include_path)
24
- @file = file
25
- @include_path = include_path
26
- end
25
+ def initialize(file, include_path)
26
+ @file = file
27
+ @include_path = include_path
28
+ end
27
29
 
28
- def ==(other) # :nodoc:
29
- self.class === other and
30
- @file == other.file and @include_path == other.include_path
31
- end
30
+ def ==(other) # :nodoc:
31
+ self.class === other and
32
+ @file == other.file and @include_path == other.include_path
33
+ end
34
+
35
+ def pretty_print(q) # :nodoc:
36
+ q.group 2, '[incl ', ']' do
37
+ q.text file
38
+ q.breakable
39
+ q.text 'from '
40
+ q.pp include_path
41
+ end
42
+ end
32
43
 
33
- def pretty_print(q) # :nodoc:
34
- q.group 2, '[incl ', ']' do
35
- q.text file
36
- q.breakable
37
- q.text 'from '
38
- q.pp include_path
39
44
  end
40
45
  end
41
-
42
46
  end
@@ -1,47 +1,51 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # An Indented Paragraph of text
2
+ module RDoc
3
+ class Markup
4
+ ##
5
+ # An Indented Paragraph of text
4
6
 
5
- class RDoc::Markup::IndentedParagraph < RDoc::Markup::Raw
7
+ class IndentedParagraph < Markup::Raw
6
8
 
7
- ##
8
- # The indent in number of spaces
9
+ ##
10
+ # The indent in number of spaces
9
11
 
10
- attr_reader :indent
12
+ attr_reader :indent
11
13
 
12
- ##
13
- # Creates a new IndentedParagraph containing +parts+ indented with +indent+
14
- # spaces
14
+ ##
15
+ # Creates a new IndentedParagraph containing +parts+ indented with +indent+
16
+ # spaces
15
17
 
16
- def initialize(indent, *parts)
17
- @indent = indent
18
+ def initialize(indent, *parts)
19
+ @indent = indent
18
20
 
19
- super(*parts)
20
- end
21
+ super(*parts)
22
+ end
21
23
 
22
- def ==(other) # :nodoc:
23
- super and indent == other.indent
24
- end
24
+ def ==(other) # :nodoc:
25
+ super and indent == other.indent
26
+ end
25
27
 
26
- ##
27
- # Calls #accept_indented_paragraph on +visitor+
28
+ ##
29
+ # Calls #accept_indented_paragraph on +visitor+
28
30
 
29
- def accept(visitor)
30
- visitor.accept_indented_paragraph self
31
- end
32
-
33
- ##
34
- # Joins the raw paragraph text and converts inline HardBreaks to the
35
- # +hard_break+ text followed by the indent.
31
+ def accept(visitor)
32
+ visitor.accept_indented_paragraph self
33
+ end
36
34
 
37
- def text(hard_break = nil)
38
- @parts.map do |part|
39
- if RDoc::Markup::HardBreak === part then
40
- '%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break
41
- else
42
- part
35
+ ##
36
+ # Joins the raw paragraph text and converts inline HardBreaks to the
37
+ # +hard_break+ text followed by the indent.
38
+
39
+ def text(hard_break = nil)
40
+ @parts.map do |part|
41
+ if Markup::HardBreak === part
42
+ '%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break
43
+ else
44
+ part
45
+ end
46
+ end.join
43
47
  end
44
- end.join
45
- end
46
48
 
49
+ end
50
+ end
47
51
  end