rdoc 6.12.0 → 6.14.1
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/README.rdoc +3 -1
- data/lib/rdoc/code_object/alias.rb +2 -9
- data/lib/rdoc/code_object/any_method.rb +9 -14
- data/lib/rdoc/code_object/attr.rb +6 -9
- data/lib/rdoc/code_object/class_module.rb +40 -23
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +8 -7
- data/lib/rdoc/code_object/context.rb +23 -65
- data/lib/rdoc/code_object/method_attr.rb +9 -28
- data/lib/rdoc/code_object/mixin.rb +3 -3
- data/lib/rdoc/code_object/normal_class.rb +1 -1
- data/lib/rdoc/code_object/normal_module.rb +1 -1
- data/lib/rdoc/code_object/require.rb +1 -1
- data/lib/rdoc/code_object/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +12 -30
- data/lib/rdoc/code_object.rb +6 -37
- data/lib/rdoc/comment.rb +7 -10
- data/lib/rdoc/cross_reference.rb +3 -3
- data/lib/rdoc/encoding.rb +4 -4
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/darkfish.rb +97 -109
- data/lib/rdoc/generator/json_index.rb +4 -20
- data/lib/rdoc/generator/markup.rb +14 -2
- data/lib/rdoc/generator/pot/message_extractor.rb +6 -6
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +7 -7
- data/lib/rdoc/generator/pot.rb +1 -6
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +15 -0
- data/lib/rdoc/markdown.kpeg +7 -5
- data/lib/rdoc/markdown.rb +34 -21
- data/lib/rdoc/markup/attribute_manager.rb +5 -5
- data/lib/rdoc/markup/attributes.rb +3 -3
- data/lib/rdoc/markup/blank_line.rb +2 -2
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +8 -8
- data/lib/rdoc/markup/formatter.rb +12 -12
- data/lib/rdoc/markup/hard_break.rb +3 -3
- data/lib/rdoc/markup/heading.rb +11 -5
- data/lib/rdoc/markup/include.rb +3 -3
- data/lib/rdoc/markup/indented_paragraph.rb +3 -3
- data/lib/rdoc/markup/list.rb +4 -4
- data/lib/rdoc/markup/list_item.rb +4 -4
- data/lib/rdoc/markup/paragraph.rb +2 -2
- data/lib/rdoc/markup/parser.rb +11 -11
- data/lib/rdoc/markup/pre_process.rb +6 -6
- data/lib/rdoc/markup/raw.rb +5 -5
- data/lib/rdoc/markup/rule.rb +2 -2
- data/lib/rdoc/markup/table.rb +4 -4
- data/lib/rdoc/markup/to_ansi.rb +3 -3
- data/lib/rdoc/markup/to_bs.rb +6 -6
- data/lib/rdoc/markup/to_html.rb +25 -16
- data/lib/rdoc/markup/to_html_crossref.rb +5 -5
- data/lib/rdoc/markup/to_html_snippet.rb +17 -17
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_label.rb +6 -5
- data/lib/rdoc/markup/to_markdown.rb +12 -12
- data/lib/rdoc/markup/to_rdoc.rb +29 -28
- data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +8 -8
- data/lib/rdoc/markup/verbatim.rb +3 -3
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/options.rb +31 -12
- data/lib/rdoc/parser/c.rb +20 -23
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +9 -16
- data/lib/rdoc/parser/ruby.rb +50 -53
- data/lib/rdoc/parser/simple.rb +2 -2
- data/lib/rdoc/parser.rb +8 -8
- data/lib/rdoc/rd/inline.rb +4 -4
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +11 -26
- data/lib/rdoc/ri/driver.rb +60 -52
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +14 -17
- data/lib/rdoc/servlet.rb +23 -22
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +3 -3
- data/lib/rdoc/stats.rb +14 -14
- data/lib/rdoc/store.rb +39 -43
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +13 -13
- data/lib/rdoc/token_stream.rb +1 -1
- data/lib/rdoc/tom_doc.rb +7 -7
- data/lib/rdoc/version.rb +1 -1
- data/man/ri.1 +2 -0
- data/rdoc.gemspec +69 -0
- metadata +18 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
data/lib/rdoc/parser/ruby.rb
CHANGED
@@ -200,7 +200,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
200
200
|
# Retrieves the read token stream and replaces +pattern+ with +replacement+
|
201
201
|
# using gsub. If the result is only a ";" returns an empty string.
|
202
202
|
|
203
|
-
def get_tkread_clean
|
203
|
+
def get_tkread_clean(pattern, replacement) # :nodoc:
|
204
204
|
read = get_tkread.gsub(pattern, replacement).strip
|
205
205
|
return '' if read == ';'
|
206
206
|
read
|
@@ -214,7 +214,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
214
214
|
# +singleton+ if the methods following should be converted to singleton
|
215
215
|
# methods.
|
216
216
|
|
217
|
-
def get_visibility_information
|
217
|
+
def get_visibility_information(tk, single) # :nodoc:
|
218
218
|
vis_type = tk[:text]
|
219
219
|
singleton = single == SINGLE
|
220
220
|
|
@@ -292,8 +292,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
292
292
|
##
|
293
293
|
# Creates a new attribute in +container+ with +name+.
|
294
294
|
|
295
|
-
def create_attr
|
296
|
-
att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
|
295
|
+
def create_attr(container, single, name, rw, comment) # :nodoc:
|
296
|
+
att = RDoc::Attr.new get_tkread, name, rw, comment, singleton: single == SINGLE
|
297
297
|
record_location att
|
298
298
|
|
299
299
|
container.add_attribute att
|
@@ -306,7 +306,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
306
306
|
# Creates a module alias in +container+ at +rhs_name+ (or at the top-level
|
307
307
|
# for "::") with the name from +constant+.
|
308
308
|
|
309
|
-
def create_module_alias
|
309
|
+
def create_module_alias(container, constant, rhs_name) # :nodoc:
|
310
310
|
mod = if rhs_name =~ /^::/ then
|
311
311
|
@store.find_class_or_module rhs_name
|
312
312
|
else
|
@@ -346,7 +346,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
346
346
|
# with :: separated named) and return the ultimate name, the associated
|
347
347
|
# container, and the given name (with the ::).
|
348
348
|
|
349
|
-
def get_class_or_module
|
349
|
+
def get_class_or_module(container, ignore_constants = false)
|
350
350
|
skip_tkspace
|
351
351
|
name_t = get_tk
|
352
352
|
given_name = ''.dup
|
@@ -564,7 +564,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
564
564
|
# We see the RPAREN as the next token, so we need to exit early. This still
|
565
565
|
# won't catch all cases (such as "a = yield + 1"
|
566
566
|
|
567
|
-
def get_end_token
|
567
|
+
def get_end_token(tk) # :nodoc:
|
568
568
|
case tk[:kind]
|
569
569
|
when :on_lparen
|
570
570
|
token = RDoc::Parser::RipperStateLex::Token.new
|
@@ -584,7 +584,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
584
584
|
##
|
585
585
|
# Retrieves the method container for a singleton method.
|
586
586
|
|
587
|
-
def get_method_container
|
587
|
+
def get_method_container(container, name_t) # :nodoc:
|
588
588
|
prev_container = container
|
589
589
|
container = container.find_module_named(name_t[:text])
|
590
590
|
|
@@ -652,7 +652,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
652
652
|
##
|
653
653
|
# Marks containers between +container+ and +ancestor+ as ignored
|
654
654
|
|
655
|
-
def suppress_parents
|
655
|
+
def suppress_parents(container, ancestor) # :nodoc:
|
656
656
|
while container and container != ancestor do
|
657
657
|
container.suppress unless container.documented?
|
658
658
|
container = container.parent
|
@@ -667,7 +667,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
667
667
|
#
|
668
668
|
# This routine modifies its +comment+ parameter.
|
669
669
|
|
670
|
-
def look_for_directives_in
|
670
|
+
def look_for_directives_in(container, comment)
|
671
671
|
@preprocess.handle comment, container do |directive, param|
|
672
672
|
case directive
|
673
673
|
when 'method', 'singleton-method',
|
@@ -687,7 +687,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
687
687
|
##
|
688
688
|
# Adds useful info about the parser to +message+
|
689
689
|
|
690
|
-
def make_message
|
690
|
+
def make_message(message)
|
691
691
|
prefix = "#{@file_name}:".dup
|
692
692
|
|
693
693
|
tk = peek_tk
|
@@ -699,7 +699,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
699
699
|
##
|
700
700
|
# Creates a comment with the correct format
|
701
701
|
|
702
|
-
def new_comment
|
702
|
+
def new_comment(comment, line_no = nil)
|
703
703
|
c = RDoc::Comment.new comment, @top_level, :ruby
|
704
704
|
c.line = line_no
|
705
705
|
c.format = @markup
|
@@ -792,8 +792,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
792
792
|
return
|
793
793
|
end
|
794
794
|
|
795
|
-
al = RDoc::Alias.new(get_tkread, old_name, new_name, comment,
|
796
|
-
single == SINGLE)
|
795
|
+
al = RDoc::Alias.new(get_tkread, old_name, new_name, comment, singleton: single == SINGLE)
|
797
796
|
record_location al
|
798
797
|
al.line = line_no
|
799
798
|
|
@@ -852,7 +851,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
852
851
|
##
|
853
852
|
# Parses a class in +context+ with +comment+
|
854
853
|
|
855
|
-
def parse_class
|
854
|
+
def parse_class(container, single, tk, comment)
|
856
855
|
line_no = tk[:line_no]
|
857
856
|
|
858
857
|
declaration_context = container
|
@@ -886,8 +885,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
886
885
|
##
|
887
886
|
# Parses and creates a regular class
|
888
887
|
|
889
|
-
def parse_class_regular
|
890
|
-
name_t, given_name, comment
|
888
|
+
def parse_class_regular(container, declaration_context, single, # :nodoc:
|
889
|
+
name_t, given_name, comment)
|
891
890
|
superclass = '::Object'
|
892
891
|
|
893
892
|
if given_name =~ /^::/ then
|
@@ -926,7 +925,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
926
925
|
# Parses a singleton class in +container+ with the given +name+ and
|
927
926
|
# +comment+.
|
928
927
|
|
929
|
-
def parse_class_singleton
|
928
|
+
def parse_class_singleton(container, name, comment) # :nodoc:
|
930
929
|
other = @store.find_class_named name
|
931
930
|
|
932
931
|
unless other then
|
@@ -965,7 +964,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
965
964
|
# Parses a constant in +context+ with +comment+. If +ignore_constants+ is
|
966
965
|
# true, no found constants will be added to RDoc.
|
967
966
|
|
968
|
-
def parse_constant
|
967
|
+
def parse_constant(container, tk, comment, ignore_constants = false)
|
969
968
|
line_no = tk[:line_no]
|
970
969
|
|
971
970
|
name = tk[:text]
|
@@ -1032,7 +1031,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1032
1031
|
true
|
1033
1032
|
end
|
1034
1033
|
|
1035
|
-
def parse_constant_body
|
1034
|
+
def parse_constant_body(container, constant, is_array_or_hash) # :nodoc:
|
1036
1035
|
nest = 0
|
1037
1036
|
rhs_name = ''.dup
|
1038
1037
|
|
@@ -1091,7 +1090,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1091
1090
|
# Generates an RDoc::Method or RDoc::Attr from +comment+ by looking for
|
1092
1091
|
# :method: or :attr: directives in +comment+.
|
1093
1092
|
|
1094
|
-
def parse_comment
|
1093
|
+
def parse_comment(container, tk, comment)
|
1095
1094
|
return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc'
|
1096
1095
|
column = tk[:char_no]
|
1097
1096
|
line_no = comment.line.nil? ? tk[:line_no] : comment.line
|
@@ -1119,7 +1118,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1119
1118
|
# Parse a comment that is describing an attribute in +container+ with the
|
1120
1119
|
# given +name+ and +comment+.
|
1121
1120
|
|
1122
|
-
def parse_comment_attr
|
1121
|
+
def parse_comment_attr(container, type, name, comment) # :nodoc:
|
1123
1122
|
return if name.empty?
|
1124
1123
|
|
1125
1124
|
rw = case type
|
@@ -1131,8 +1130,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1131
1130
|
create_attr container, NORMAL, name, rw, comment
|
1132
1131
|
end
|
1133
1132
|
|
1134
|
-
def parse_comment_ghost
|
1135
|
-
comment
|
1133
|
+
def parse_comment_ghost(container, text, name, column, line_no, # :nodoc:
|
1134
|
+
comment)
|
1136
1135
|
name = nil if name.empty?
|
1137
1136
|
|
1138
1137
|
meth = RDoc::GhostMethod.new get_tkread, name
|
@@ -1153,7 +1152,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1153
1152
|
end
|
1154
1153
|
|
1155
1154
|
comment.normalize
|
1156
|
-
comment.extract_call_seq
|
1155
|
+
meth.call_seq = comment.extract_call_seq
|
1157
1156
|
|
1158
1157
|
return unless meth.name
|
1159
1158
|
|
@@ -1170,7 +1169,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1170
1169
|
# Creates an RDoc::Method on +container+ from +comment+ if there is a
|
1171
1170
|
# Signature section in the comment
|
1172
1171
|
|
1173
|
-
def parse_comment_tomdoc
|
1172
|
+
def parse_comment_tomdoc(container, tk, comment)
|
1174
1173
|
return unless signature = RDoc::TomDoc.signature(comment)
|
1175
1174
|
column = tk[:char_no]
|
1176
1175
|
line_no = tk[:line_no]
|
@@ -1205,7 +1204,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1205
1204
|
# Parses an +include+ or +extend+, indicated by the +klass+ and adds it to
|
1206
1205
|
# +container+ # with +comment+
|
1207
1206
|
|
1208
|
-
def parse_extend_or_include
|
1207
|
+
def parse_extend_or_include(klass, container, comment) # :nodoc:
|
1209
1208
|
loop do
|
1210
1209
|
skip_tkspace_comment
|
1211
1210
|
|
@@ -1225,7 +1224,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1225
1224
|
##
|
1226
1225
|
# Parses an +included+ with a block feature of ActiveSupport::Concern.
|
1227
1226
|
|
1228
|
-
def parse_included_with_activesupport_concern
|
1227
|
+
def parse_included_with_activesupport_concern(container, comment) # :nodoc:
|
1229
1228
|
skip_tkspace_without_nl
|
1230
1229
|
tk = get_tk
|
1231
1230
|
unless tk[:kind] == :on_lbracket || (tk[:kind] == :on_kw && tk[:text] == 'do')
|
@@ -1243,7 +1242,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1243
1242
|
#
|
1244
1243
|
# Returns true if the comment was not consumed.
|
1245
1244
|
|
1246
|
-
def parse_identifier
|
1245
|
+
def parse_identifier(container, single, tk, comment) # :nodoc:
|
1247
1246
|
case tk[:text]
|
1248
1247
|
when 'private', 'protected', 'public', 'private_class_method',
|
1249
1248
|
'public_class_method', 'module_function' then
|
@@ -1358,10 +1357,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1358
1357
|
|
1359
1358
|
return unless name
|
1360
1359
|
|
1361
|
-
meth = RDoc::MetaMethod.new get_tkread, name
|
1360
|
+
meth = RDoc::MetaMethod.new get_tkread, name, singleton: singleton
|
1362
1361
|
record_location meth
|
1363
1362
|
meth.line = line_no
|
1364
|
-
meth.singleton = singleton
|
1365
1363
|
|
1366
1364
|
remove_token_listener self
|
1367
1365
|
|
@@ -1387,7 +1385,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1387
1385
|
# determine the name while +tk+ is used in an error message if the name
|
1388
1386
|
# cannot be determined.
|
1389
1387
|
|
1390
|
-
def parse_meta_method_name
|
1388
|
+
def parse_meta_method_name(comment, tk) # :nodoc:
|
1391
1389
|
if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
|
1392
1390
|
return $1 unless $1.empty?
|
1393
1391
|
end
|
@@ -1411,13 +1409,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1411
1409
|
##
|
1412
1410
|
# Parses the parameters and block for a meta-programmed method.
|
1413
1411
|
|
1414
|
-
def parse_meta_method_params
|
1412
|
+
def parse_meta_method_params(container, single, meth, tk, comment) # :nodoc:
|
1415
1413
|
token_listener meth do
|
1416
1414
|
meth.params = ''
|
1417
1415
|
|
1418
1416
|
look_for_directives_in meth, comment
|
1419
1417
|
comment.normalize
|
1420
|
-
comment.extract_call_seq
|
1418
|
+
meth.call_seq = comment.extract_call_seq
|
1421
1419
|
|
1422
1420
|
container.add_method meth
|
1423
1421
|
|
@@ -1461,9 +1459,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1461
1459
|
|
1462
1460
|
return unless name
|
1463
1461
|
|
1464
|
-
meth = RDoc::AnyMethod.new get_tkread, name
|
1462
|
+
meth = RDoc::AnyMethod.new get_tkread, name, singleton: single == SINGLE ? true : singleton
|
1465
1463
|
look_for_directives_in meth, comment
|
1466
|
-
meth.singleton = single == SINGLE ? true : singleton
|
1467
1464
|
if singleton
|
1468
1465
|
# `current_line_visibility' is useless because it works against
|
1469
1466
|
# the normal method named as same as the singleton method, after
|
@@ -1485,7 +1482,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1485
1482
|
parse_method_params_and_body container, single, meth, added_container
|
1486
1483
|
|
1487
1484
|
comment.normalize
|
1488
|
-
comment.extract_call_seq
|
1485
|
+
meth.call_seq = comment.extract_call_seq
|
1489
1486
|
|
1490
1487
|
meth.comment = comment
|
1491
1488
|
|
@@ -1498,7 +1495,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1498
1495
|
##
|
1499
1496
|
# Parses the parameters and body of +meth+
|
1500
1497
|
|
1501
|
-
def parse_method_params_and_body
|
1498
|
+
def parse_method_params_and_body(container, single, meth, added_container)
|
1502
1499
|
token_listener meth do
|
1503
1500
|
parse_method_parameters meth
|
1504
1501
|
|
@@ -1528,7 +1525,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1528
1525
|
##
|
1529
1526
|
# Parses a method that needs to be ignored.
|
1530
1527
|
|
1531
|
-
def parse_method_dummy
|
1528
|
+
def parse_method_dummy(container)
|
1532
1529
|
dummy = RDoc::Context.new
|
1533
1530
|
dummy.parent = container
|
1534
1531
|
dummy.store = container.store
|
@@ -1541,7 +1538,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1541
1538
|
# Returns the method name, the container it is in (for def Foo.name) and if
|
1542
1539
|
# it is a singleton or regular method.
|
1543
1540
|
|
1544
|
-
def parse_method_name
|
1541
|
+
def parse_method_name(container) # :nodoc:
|
1545
1542
|
skip_tkspace
|
1546
1543
|
name_t = get_tk
|
1547
1544
|
back_tk = skip_tkspace_without_nl
|
@@ -1568,7 +1565,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1568
1565
|
# For the given +container+ and initial name token +name_t+ the method name
|
1569
1566
|
# is parsed from the token stream for a regular method.
|
1570
1567
|
|
1571
|
-
def parse_method_name_regular
|
1568
|
+
def parse_method_name_regular(container, name_t) # :nodoc:
|
1572
1569
|
if :on_op == name_t[:kind] && (%w{* & [] []= <<}.include?(name_t[:text])) then
|
1573
1570
|
name_t[:text]
|
1574
1571
|
else
|
@@ -1586,7 +1583,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1586
1583
|
# and the new +container+ (if necessary) are parsed from the token stream
|
1587
1584
|
# for a singleton method.
|
1588
1585
|
|
1589
|
-
def parse_method_name_singleton
|
1586
|
+
def parse_method_name_singleton(container, name_t) # :nodoc:
|
1590
1587
|
skip_tkspace
|
1591
1588
|
name_t2 = get_tk
|
1592
1589
|
|
@@ -1697,7 +1694,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1697
1694
|
#
|
1698
1695
|
# and add this as the block_params for the method
|
1699
1696
|
|
1700
|
-
def parse_method_parameters
|
1697
|
+
def parse_method_parameters(method)
|
1701
1698
|
res = parse_method_or_yield_parameters method
|
1702
1699
|
|
1703
1700
|
res = "(#{res})" unless res =~ /\A\(/
|
@@ -1712,7 +1709,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1712
1709
|
##
|
1713
1710
|
# Parses an RDoc::NormalModule in +container+ with +comment+
|
1714
1711
|
|
1715
|
-
def parse_module
|
1712
|
+
def parse_module(container, single, tk, comment)
|
1716
1713
|
container, name_t, = get_class_or_module container
|
1717
1714
|
|
1718
1715
|
name = name_t[:text]
|
@@ -1992,7 +1989,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1992
1989
|
# Parses up to +no+ symbol arguments surrounded by () and places them in
|
1993
1990
|
# +args+.
|
1994
1991
|
|
1995
|
-
def parse_symbol_arg_paren
|
1992
|
+
def parse_symbol_arg_paren(no) # :nodoc:
|
1996
1993
|
args = []
|
1997
1994
|
|
1998
1995
|
loop do
|
@@ -2020,7 +2017,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2020
2017
|
# Parses up to +no+ symbol arguments separated by spaces and places them in
|
2021
2018
|
# +args+.
|
2022
2019
|
|
2023
|
-
def parse_symbol_arg_space
|
2020
|
+
def parse_symbol_arg_space(no, tk) # :nodoc:
|
2024
2021
|
args = []
|
2025
2022
|
|
2026
2023
|
unget_tk tk
|
@@ -2068,7 +2065,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2068
2065
|
##
|
2069
2066
|
# Parses statements in the top-level +container+
|
2070
2067
|
|
2071
|
-
def parse_top_level_statements
|
2068
|
+
def parse_top_level_statements(container)
|
2072
2069
|
comment = collect_first_comment
|
2073
2070
|
|
2074
2071
|
look_for_directives_in container, comment
|
@@ -2146,7 +2143,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2146
2143
|
# the name is in +allowed+. A directive can be found anywhere up to the end
|
2147
2144
|
# of the current line.
|
2148
2145
|
|
2149
|
-
def read_directive
|
2146
|
+
def read_directive(allowed)
|
2150
2147
|
tokens = []
|
2151
2148
|
|
2152
2149
|
while tk = get_tk do
|
@@ -2178,7 +2175,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2178
2175
|
#
|
2179
2176
|
# See also RDoc::Markup::PreProcess#handle_directive
|
2180
2177
|
|
2181
|
-
def read_documentation_modifiers
|
2178
|
+
def read_documentation_modifiers(context, allowed)
|
2182
2179
|
skip_tkspace_without_nl
|
2183
2180
|
directive, value = read_directive allowed
|
2184
2181
|
|
@@ -2197,7 +2194,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2197
2194
|
# Records the location of this +container+ in the file for this parser and
|
2198
2195
|
# adds it to the list of classes and modules in the file.
|
2199
2196
|
|
2200
|
-
def record_location
|
2197
|
+
def record_location(container) # :nodoc:
|
2201
2198
|
case container
|
2202
2199
|
when RDoc::ClassModule then
|
2203
2200
|
@top_level.add_to_classes_or_modules container
|
@@ -2308,7 +2305,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2308
2305
|
##
|
2309
2306
|
# Skips the next method in +container+
|
2310
2307
|
|
2311
|
-
def skip_method
|
2308
|
+
def skip_method(container)
|
2312
2309
|
meth = RDoc::AnyMethod.new "", "anon"
|
2313
2310
|
parse_method_parameters meth
|
2314
2311
|
parse_statements container, false, meth
|
@@ -2329,7 +2326,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2329
2326
|
##
|
2330
2327
|
# Updates visibility in +container+ from +vis_type+ and +vis+.
|
2331
2328
|
|
2332
|
-
def update_visibility
|
2329
|
+
def update_visibility(container, vis_type, vis, singleton) # :nodoc:
|
2333
2330
|
new_methods = []
|
2334
2331
|
|
2335
2332
|
case vis_type
|
@@ -2374,7 +2371,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2374
2371
|
##
|
2375
2372
|
# Prints +message+ to +$stderr+ unless we're being quiet
|
2376
2373
|
|
2377
|
-
def warn
|
2374
|
+
def warn(message)
|
2378
2375
|
@options.warn make_message message
|
2379
2376
|
end
|
2380
2377
|
|
data/lib/rdoc/parser/simple.rb
CHANGED
@@ -38,7 +38,7 @@ class RDoc::Parser::Simple < RDoc::Parser
|
|
38
38
|
##
|
39
39
|
# Removes the encoding magic comment from +text+
|
40
40
|
|
41
|
-
def remove_coding_comment
|
41
|
+
def remove_coding_comment(text)
|
42
42
|
text.sub(/\A# .*coding[=:].*$/, '')
|
43
43
|
end
|
44
44
|
|
@@ -49,7 +49,7 @@ class RDoc::Parser::Simple < RDoc::Parser
|
|
49
49
|
# dashes at the beginning of the line. Three or more dashes are considered
|
50
50
|
# to be a rule and ignored.
|
51
51
|
|
52
|
-
def remove_private_comment
|
52
|
+
def remove_private_comment(comment)
|
53
53
|
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
|
54
54
|
empty = ''
|
55
55
|
empty = RDoc::Encoding.change_encoding empty, comment.encoding
|
data/lib/rdoc/parser.rb
CHANGED
@@ -91,7 +91,7 @@ class RDoc::Parser
|
|
91
91
|
# Checks if +file+ is a zip file in disguise. Signatures from
|
92
92
|
# http://www.garykessler.net/library/file_sigs.html
|
93
93
|
|
94
|
-
def self.zip?
|
94
|
+
def self.zip?(file)
|
95
95
|
zip_signature = File.read file, 4
|
96
96
|
|
97
97
|
zip_signature == "PK\x03\x04" or
|
@@ -104,7 +104,7 @@ class RDoc::Parser
|
|
104
104
|
##
|
105
105
|
# Return a parser that can handle a particular extension
|
106
106
|
|
107
|
-
def self.can_parse
|
107
|
+
def self.can_parse(file_name)
|
108
108
|
parser = can_parse_by_name file_name
|
109
109
|
|
110
110
|
# HACK Selenium hides a jar file using a .txt extension
|
@@ -117,7 +117,7 @@ class RDoc::Parser
|
|
117
117
|
# Returns a parser that can handle the extension for +file_name+. This does
|
118
118
|
# not depend upon the file being readable.
|
119
119
|
|
120
|
-
def self.can_parse_by_name
|
120
|
+
def self.can_parse_by_name(file_name)
|
121
121
|
_, parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }
|
122
122
|
|
123
123
|
# The default parser must not parse binary files
|
@@ -140,7 +140,7 @@ class RDoc::Parser
|
|
140
140
|
##
|
141
141
|
# Returns the file type from the modeline in +file_name+
|
142
142
|
|
143
|
-
def self.check_modeline
|
143
|
+
def self.check_modeline(file_name)
|
144
144
|
line = File.open file_name do |io|
|
145
145
|
io.gets
|
146
146
|
end
|
@@ -166,7 +166,7 @@ class RDoc::Parser
|
|
166
166
|
# Finds and instantiates the correct parser for the given +file_name+ and
|
167
167
|
# +content+.
|
168
168
|
|
169
|
-
def self.for
|
169
|
+
def self.for(top_level, content, options, stats)
|
170
170
|
file_name = top_level.absolute_name
|
171
171
|
return if binary? file_name
|
172
172
|
|
@@ -208,7 +208,7 @@ class RDoc::Parser
|
|
208
208
|
##
|
209
209
|
# Removes an emacs-style modeline from the first line of the document
|
210
210
|
|
211
|
-
def self.remove_modeline
|
211
|
+
def self.remove_modeline(content)
|
212
212
|
content.sub(/\A.*-\*-\s*(.*?\S)\s*-\*-.*\r?\n/, '')
|
213
213
|
end
|
214
214
|
|
@@ -229,7 +229,7 @@ class RDoc::Parser
|
|
229
229
|
#
|
230
230
|
# Any comment style may be used to hide the markup comment.
|
231
231
|
|
232
|
-
def self.use_markup
|
232
|
+
def self.use_markup(content)
|
233
233
|
markup = content.lines.first(3).grep(/markup:\s+(\w+)/) { $1 }.first
|
234
234
|
|
235
235
|
return unless markup
|
@@ -252,7 +252,7 @@ class RDoc::Parser
|
|
252
252
|
# RDoc::Markup::PreProcess object is created which allows processing of
|
253
253
|
# directives.
|
254
254
|
|
255
|
-
def initialize
|
255
|
+
def initialize(top_level, content, options, stats)
|
256
256
|
@top_level = top_level
|
257
257
|
@top_level.parser = self.class
|
258
258
|
@store = @top_level.store
|
data/lib/rdoc/rd/inline.rb
CHANGED
@@ -20,7 +20,7 @@ class RDoc::RD::Inline
|
|
20
20
|
# +rdoc+ may be another Inline or a String. If +reference+ is not given it
|
21
21
|
# will use the text from +rdoc+.
|
22
22
|
|
23
|
-
def self.new
|
23
|
+
def self.new(rdoc, reference = rdoc)
|
24
24
|
if self === rdoc and reference.equal? rdoc then
|
25
25
|
rdoc
|
26
26
|
else
|
@@ -31,7 +31,7 @@ class RDoc::RD::Inline
|
|
31
31
|
##
|
32
32
|
# Initializes the Inline with +rdoc+ and +inline+
|
33
33
|
|
34
|
-
def initialize
|
34
|
+
def initialize(rdoc, reference) # :not-new:
|
35
35
|
@reference = reference.equal?(rdoc) ? reference.dup : reference
|
36
36
|
|
37
37
|
# unpack
|
@@ -39,7 +39,7 @@ class RDoc::RD::Inline
|
|
39
39
|
@rdoc = rdoc
|
40
40
|
end
|
41
41
|
|
42
|
-
def ==
|
42
|
+
def ==(other) # :nodoc:
|
43
43
|
self.class === other and
|
44
44
|
@reference == other.reference and @rdoc == other.rdoc
|
45
45
|
end
|
@@ -47,7 +47,7 @@ class RDoc::RD::Inline
|
|
47
47
|
##
|
48
48
|
# Appends +more+ to this inline. +more+ may be a String or another Inline.
|
49
49
|
|
50
|
-
def append
|
50
|
+
def append(more)
|
51
51
|
case more
|
52
52
|
when String then
|
53
53
|
@reference += more
|
data/lib/rdoc/rd.rb
CHANGED
@@ -75,7 +75,7 @@ class RDoc::RD
|
|
75
75
|
# Parses +rd+ source and returns an RDoc::Markup::Document. If the
|
76
76
|
# <tt>=begin</tt> or <tt>=end</tt> lines are missing they will be added.
|
77
77
|
|
78
|
-
def self.parse
|
78
|
+
def self.parse(rd)
|
79
79
|
rd = rd.lines.to_a
|
80
80
|
|
81
81
|
if rd.find { |i| /\S/ === i } and !rd.find{|i| /^=begin\b/ === i } then
|
data/lib/rdoc/rdoc.rb
CHANGED
@@ -69,7 +69,7 @@ class RDoc::RDoc
|
|
69
69
|
##
|
70
70
|
# The current documentation store
|
71
71
|
|
72
|
-
|
72
|
+
attr_accessor :store
|
73
73
|
|
74
74
|
##
|
75
75
|
# Add +klass+ that can generate output after parsing
|
@@ -89,7 +89,7 @@ class RDoc::RDoc
|
|
89
89
|
##
|
90
90
|
# Sets the active RDoc::RDoc instance
|
91
91
|
|
92
|
-
def self.current=
|
92
|
+
def self.current=(rdoc)
|
93
93
|
@current = rdoc
|
94
94
|
end
|
95
95
|
|
@@ -118,7 +118,7 @@ class RDoc::RDoc
|
|
118
118
|
# Gathers a set of parseable files from the files and directories listed in
|
119
119
|
# +files+.
|
120
120
|
|
121
|
-
def gather_files
|
121
|
+
def gather_files(files)
|
122
122
|
files = [@options.root.to_s] if files.empty?
|
123
123
|
|
124
124
|
file_list = normalized_file_list files, true, @options.exclude
|
@@ -208,15 +208,6 @@ option)
|
|
208
208
|
last
|
209
209
|
end
|
210
210
|
|
211
|
-
##
|
212
|
-
# Sets the current documentation tree to +store+ and sets the store's rdoc
|
213
|
-
# driver to this instance.
|
214
|
-
|
215
|
-
def store= store
|
216
|
-
@store = store
|
217
|
-
@store.rdoc = self
|
218
|
-
end
|
219
|
-
|
220
211
|
##
|
221
212
|
# Update the flag file in an output directory.
|
222
213
|
|
@@ -246,7 +237,7 @@ option)
|
|
246
237
|
# representing candidates for documentation. It may also contain comments
|
247
238
|
# (starting with '#')
|
248
239
|
|
249
|
-
def parse_dot_doc_file
|
240
|
+
def parse_dot_doc_file(in_dir, filename)
|
250
241
|
# read and strip comments
|
251
242
|
patterns = File.read(filename).gsub(/#.*/, '')
|
252
243
|
|
@@ -320,7 +311,7 @@ option)
|
|
320
311
|
# files. However we may well contain subdirectories which must be tested
|
321
312
|
# for .document files.
|
322
313
|
|
323
|
-
def list_files_in_directory
|
314
|
+
def list_files_in_directory(dir)
|
324
315
|
files = Dir.glob File.join(dir, "*")
|
325
316
|
|
326
317
|
normalized_file_list files, false, @options.exclude
|
@@ -329,7 +320,7 @@ option)
|
|
329
320
|
##
|
330
321
|
# Parses +filename+ and returns an RDoc::TopLevel
|
331
322
|
|
332
|
-
def parse_file
|
323
|
+
def parse_file(filename)
|
333
324
|
encoding = @options.encoding
|
334
325
|
filename = filename.encode encoding
|
335
326
|
|
@@ -400,7 +391,7 @@ The internal error was:
|
|
400
391
|
##
|
401
392
|
# Parse each file on the command line, recursively entering directories.
|
402
393
|
|
403
|
-
def parse_files
|
394
|
+
def parse_files(files)
|
404
395
|
file_list = gather_files files
|
405
396
|
@stats = RDoc::Stats.new @store, file_list.length, @options.verbosity
|
406
397
|
|
@@ -427,7 +418,7 @@ The internal error was:
|
|
427
418
|
# Removes file extensions known to be unparseable from +files+ and TAGS
|
428
419
|
# files for emacs and vim.
|
429
420
|
|
430
|
-
def remove_unparseable
|
421
|
+
def remove_unparseable(files)
|
431
422
|
files.reject do |file, *|
|
432
423
|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
|
433
424
|
(file =~ /tags$/i and
|
@@ -449,9 +440,7 @@ The internal error was:
|
|
449
440
|
# By default, output will be stored in a directory called "doc" below the
|
450
441
|
# current directory, so make sure you're somewhere writable before invoking.
|
451
442
|
|
452
|
-
def document
|
453
|
-
self.store = RDoc::Store.new
|
454
|
-
|
443
|
+
def document(options)
|
455
444
|
if RDoc::Options === options then
|
456
445
|
@options = options
|
457
446
|
else
|
@@ -460,6 +449,8 @@ The internal error was:
|
|
460
449
|
end
|
461
450
|
@options.finish
|
462
451
|
|
452
|
+
@store = RDoc::Store.new(@options)
|
453
|
+
|
463
454
|
if @options.pipe then
|
464
455
|
handle_pipe
|
465
456
|
exit
|
@@ -469,12 +460,6 @@ The internal error was:
|
|
469
460
|
@last_modified = setup_output_dir @options.op_dir, @options.force_update
|
470
461
|
end
|
471
462
|
|
472
|
-
@store.encoding = @options.encoding
|
473
|
-
@store.dry_run = @options.dry_run
|
474
|
-
@store.main = @options.main_page
|
475
|
-
@store.title = @options.title
|
476
|
-
@store.path = @options.op_dir
|
477
|
-
|
478
463
|
@start_time = Time.now
|
479
464
|
|
480
465
|
@store.load_cache
|