rdoc 6.13.1 → 6.14.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/README.rdoc +3 -1
- data/lib/rdoc/code_object/any_method.rb +4 -4
- data/lib/rdoc/code_object/attr.rb +3 -3
- data/lib/rdoc/code_object/class_module.rb +15 -15
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +7 -7
- data/lib/rdoc/code_object/context.rb +19 -19
- data/lib/rdoc/code_object/method_attr.rb +6 -6
- 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/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +7 -7
- data/lib/rdoc/code_object.rb +3 -3
- data/lib/rdoc/comment.rb +6 -6
- 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 +15 -15
- data/lib/rdoc/generator/json_index.rb +3 -3
- data/lib/rdoc/generator/markup.rb +12 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- 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 -1
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
- 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 +4 -4
- 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 +21 -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 +5 -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 +19 -12
- data/lib/rdoc/parser/c.rb +16 -16
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +1 -1
- data/lib/rdoc/parser/ruby.rb +43 -43
- 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 +8 -8
- data/lib/rdoc/ri/driver.rb +49 -49
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +14 -11
- data/lib/rdoc/servlet.rb +15 -15
- 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 +12 -12
- data/lib/rdoc/store.rb +30 -30
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +11 -11
- 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
- metadata +17 -3
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,7 +292,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
292
292
|
##
|
293
293
|
# Creates a new attribute in +container+ with +name+.
|
294
294
|
|
295
|
-
def create_attr
|
295
|
+
def create_attr(container, single, name, rw, comment) # :nodoc:
|
296
296
|
att = RDoc::Attr.new get_tkread, name, rw, comment, singleton: single == SINGLE
|
297
297
|
record_location att
|
298
298
|
|
@@ -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
|
@@ -851,7 +851,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
851
851
|
##
|
852
852
|
# Parses a class in +context+ with +comment+
|
853
853
|
|
854
|
-
def parse_class
|
854
|
+
def parse_class(container, single, tk, comment)
|
855
855
|
line_no = tk[:line_no]
|
856
856
|
|
857
857
|
declaration_context = container
|
@@ -885,8 +885,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
885
885
|
##
|
886
886
|
# Parses and creates a regular class
|
887
887
|
|
888
|
-
def parse_class_regular
|
889
|
-
name_t, given_name, comment
|
888
|
+
def parse_class_regular(container, declaration_context, single, # :nodoc:
|
889
|
+
name_t, given_name, comment)
|
890
890
|
superclass = '::Object'
|
891
891
|
|
892
892
|
if given_name =~ /^::/ then
|
@@ -925,7 +925,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
925
925
|
# Parses a singleton class in +container+ with the given +name+ and
|
926
926
|
# +comment+.
|
927
927
|
|
928
|
-
def parse_class_singleton
|
928
|
+
def parse_class_singleton(container, name, comment) # :nodoc:
|
929
929
|
other = @store.find_class_named name
|
930
930
|
|
931
931
|
unless other then
|
@@ -964,7 +964,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
964
964
|
# Parses a constant in +context+ with +comment+. If +ignore_constants+ is
|
965
965
|
# true, no found constants will be added to RDoc.
|
966
966
|
|
967
|
-
def parse_constant
|
967
|
+
def parse_constant(container, tk, comment, ignore_constants = false)
|
968
968
|
line_no = tk[:line_no]
|
969
969
|
|
970
970
|
name = tk[:text]
|
@@ -1031,7 +1031,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1031
1031
|
true
|
1032
1032
|
end
|
1033
1033
|
|
1034
|
-
def parse_constant_body
|
1034
|
+
def parse_constant_body(container, constant, is_array_or_hash) # :nodoc:
|
1035
1035
|
nest = 0
|
1036
1036
|
rhs_name = ''.dup
|
1037
1037
|
|
@@ -1090,7 +1090,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1090
1090
|
# Generates an RDoc::Method or RDoc::Attr from +comment+ by looking for
|
1091
1091
|
# :method: or :attr: directives in +comment+.
|
1092
1092
|
|
1093
|
-
def parse_comment
|
1093
|
+
def parse_comment(container, tk, comment)
|
1094
1094
|
return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc'
|
1095
1095
|
column = tk[:char_no]
|
1096
1096
|
line_no = comment.line.nil? ? tk[:line_no] : comment.line
|
@@ -1118,7 +1118,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1118
1118
|
# Parse a comment that is describing an attribute in +container+ with the
|
1119
1119
|
# given +name+ and +comment+.
|
1120
1120
|
|
1121
|
-
def parse_comment_attr
|
1121
|
+
def parse_comment_attr(container, type, name, comment) # :nodoc:
|
1122
1122
|
return if name.empty?
|
1123
1123
|
|
1124
1124
|
rw = case type
|
@@ -1130,8 +1130,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1130
1130
|
create_attr container, NORMAL, name, rw, comment
|
1131
1131
|
end
|
1132
1132
|
|
1133
|
-
def parse_comment_ghost
|
1134
|
-
comment
|
1133
|
+
def parse_comment_ghost(container, text, name, column, line_no, # :nodoc:
|
1134
|
+
comment)
|
1135
1135
|
name = nil if name.empty?
|
1136
1136
|
|
1137
1137
|
meth = RDoc::GhostMethod.new get_tkread, name
|
@@ -1169,7 +1169,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1169
1169
|
# Creates an RDoc::Method on +container+ from +comment+ if there is a
|
1170
1170
|
# Signature section in the comment
|
1171
1171
|
|
1172
|
-
def parse_comment_tomdoc
|
1172
|
+
def parse_comment_tomdoc(container, tk, comment)
|
1173
1173
|
return unless signature = RDoc::TomDoc.signature(comment)
|
1174
1174
|
column = tk[:char_no]
|
1175
1175
|
line_no = tk[:line_no]
|
@@ -1204,7 +1204,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1204
1204
|
# Parses an +include+ or +extend+, indicated by the +klass+ and adds it to
|
1205
1205
|
# +container+ # with +comment+
|
1206
1206
|
|
1207
|
-
def parse_extend_or_include
|
1207
|
+
def parse_extend_or_include(klass, container, comment) # :nodoc:
|
1208
1208
|
loop do
|
1209
1209
|
skip_tkspace_comment
|
1210
1210
|
|
@@ -1224,7 +1224,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1224
1224
|
##
|
1225
1225
|
# Parses an +included+ with a block feature of ActiveSupport::Concern.
|
1226
1226
|
|
1227
|
-
def parse_included_with_activesupport_concern
|
1227
|
+
def parse_included_with_activesupport_concern(container, comment) # :nodoc:
|
1228
1228
|
skip_tkspace_without_nl
|
1229
1229
|
tk = get_tk
|
1230
1230
|
unless tk[:kind] == :on_lbracket || (tk[:kind] == :on_kw && tk[:text] == 'do')
|
@@ -1242,7 +1242,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1242
1242
|
#
|
1243
1243
|
# Returns true if the comment was not consumed.
|
1244
1244
|
|
1245
|
-
def parse_identifier
|
1245
|
+
def parse_identifier(container, single, tk, comment) # :nodoc:
|
1246
1246
|
case tk[:text]
|
1247
1247
|
when 'private', 'protected', 'public', 'private_class_method',
|
1248
1248
|
'public_class_method', 'module_function' then
|
@@ -1385,7 +1385,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1385
1385
|
# determine the name while +tk+ is used in an error message if the name
|
1386
1386
|
# cannot be determined.
|
1387
1387
|
|
1388
|
-
def parse_meta_method_name
|
1388
|
+
def parse_meta_method_name(comment, tk) # :nodoc:
|
1389
1389
|
if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
|
1390
1390
|
return $1 unless $1.empty?
|
1391
1391
|
end
|
@@ -1409,7 +1409,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1409
1409
|
##
|
1410
1410
|
# Parses the parameters and block for a meta-programmed method.
|
1411
1411
|
|
1412
|
-
def parse_meta_method_params
|
1412
|
+
def parse_meta_method_params(container, single, meth, tk, comment) # :nodoc:
|
1413
1413
|
token_listener meth do
|
1414
1414
|
meth.params = ''
|
1415
1415
|
|
@@ -1495,7 +1495,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1495
1495
|
##
|
1496
1496
|
# Parses the parameters and body of +meth+
|
1497
1497
|
|
1498
|
-
def parse_method_params_and_body
|
1498
|
+
def parse_method_params_and_body(container, single, meth, added_container)
|
1499
1499
|
token_listener meth do
|
1500
1500
|
parse_method_parameters meth
|
1501
1501
|
|
@@ -1525,7 +1525,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1525
1525
|
##
|
1526
1526
|
# Parses a method that needs to be ignored.
|
1527
1527
|
|
1528
|
-
def parse_method_dummy
|
1528
|
+
def parse_method_dummy(container)
|
1529
1529
|
dummy = RDoc::Context.new
|
1530
1530
|
dummy.parent = container
|
1531
1531
|
dummy.store = container.store
|
@@ -1538,7 +1538,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1538
1538
|
# Returns the method name, the container it is in (for def Foo.name) and if
|
1539
1539
|
# it is a singleton or regular method.
|
1540
1540
|
|
1541
|
-
def parse_method_name
|
1541
|
+
def parse_method_name(container) # :nodoc:
|
1542
1542
|
skip_tkspace
|
1543
1543
|
name_t = get_tk
|
1544
1544
|
back_tk = skip_tkspace_without_nl
|
@@ -1565,7 +1565,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1565
1565
|
# For the given +container+ and initial name token +name_t+ the method name
|
1566
1566
|
# is parsed from the token stream for a regular method.
|
1567
1567
|
|
1568
|
-
def parse_method_name_regular
|
1568
|
+
def parse_method_name_regular(container, name_t) # :nodoc:
|
1569
1569
|
if :on_op == name_t[:kind] && (%w{* & [] []= <<}.include?(name_t[:text])) then
|
1570
1570
|
name_t[:text]
|
1571
1571
|
else
|
@@ -1583,7 +1583,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1583
1583
|
# and the new +container+ (if necessary) are parsed from the token stream
|
1584
1584
|
# for a singleton method.
|
1585
1585
|
|
1586
|
-
def parse_method_name_singleton
|
1586
|
+
def parse_method_name_singleton(container, name_t) # :nodoc:
|
1587
1587
|
skip_tkspace
|
1588
1588
|
name_t2 = get_tk
|
1589
1589
|
|
@@ -1694,7 +1694,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1694
1694
|
#
|
1695
1695
|
# and add this as the block_params for the method
|
1696
1696
|
|
1697
|
-
def parse_method_parameters
|
1697
|
+
def parse_method_parameters(method)
|
1698
1698
|
res = parse_method_or_yield_parameters method
|
1699
1699
|
|
1700
1700
|
res = "(#{res})" unless res =~ /\A\(/
|
@@ -1709,7 +1709,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1709
1709
|
##
|
1710
1710
|
# Parses an RDoc::NormalModule in +container+ with +comment+
|
1711
1711
|
|
1712
|
-
def parse_module
|
1712
|
+
def parse_module(container, single, tk, comment)
|
1713
1713
|
container, name_t, = get_class_or_module container
|
1714
1714
|
|
1715
1715
|
name = name_t[:text]
|
@@ -1989,7 +1989,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
1989
1989
|
# Parses up to +no+ symbol arguments surrounded by () and places them in
|
1990
1990
|
# +args+.
|
1991
1991
|
|
1992
|
-
def parse_symbol_arg_paren
|
1992
|
+
def parse_symbol_arg_paren(no) # :nodoc:
|
1993
1993
|
args = []
|
1994
1994
|
|
1995
1995
|
loop do
|
@@ -2017,7 +2017,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2017
2017
|
# Parses up to +no+ symbol arguments separated by spaces and places them in
|
2018
2018
|
# +args+.
|
2019
2019
|
|
2020
|
-
def parse_symbol_arg_space
|
2020
|
+
def parse_symbol_arg_space(no, tk) # :nodoc:
|
2021
2021
|
args = []
|
2022
2022
|
|
2023
2023
|
unget_tk tk
|
@@ -2065,7 +2065,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2065
2065
|
##
|
2066
2066
|
# Parses statements in the top-level +container+
|
2067
2067
|
|
2068
|
-
def parse_top_level_statements
|
2068
|
+
def parse_top_level_statements(container)
|
2069
2069
|
comment = collect_first_comment
|
2070
2070
|
|
2071
2071
|
look_for_directives_in container, comment
|
@@ -2143,7 +2143,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2143
2143
|
# the name is in +allowed+. A directive can be found anywhere up to the end
|
2144
2144
|
# of the current line.
|
2145
2145
|
|
2146
|
-
def read_directive
|
2146
|
+
def read_directive(allowed)
|
2147
2147
|
tokens = []
|
2148
2148
|
|
2149
2149
|
while tk = get_tk do
|
@@ -2175,7 +2175,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2175
2175
|
#
|
2176
2176
|
# See also RDoc::Markup::PreProcess#handle_directive
|
2177
2177
|
|
2178
|
-
def read_documentation_modifiers
|
2178
|
+
def read_documentation_modifiers(context, allowed)
|
2179
2179
|
skip_tkspace_without_nl
|
2180
2180
|
directive, value = read_directive allowed
|
2181
2181
|
|
@@ -2194,7 +2194,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2194
2194
|
# Records the location of this +container+ in the file for this parser and
|
2195
2195
|
# adds it to the list of classes and modules in the file.
|
2196
2196
|
|
2197
|
-
def record_location
|
2197
|
+
def record_location(container) # :nodoc:
|
2198
2198
|
case container
|
2199
2199
|
when RDoc::ClassModule then
|
2200
2200
|
@top_level.add_to_classes_or_modules container
|
@@ -2305,7 +2305,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2305
2305
|
##
|
2306
2306
|
# Skips the next method in +container+
|
2307
2307
|
|
2308
|
-
def skip_method
|
2308
|
+
def skip_method(container)
|
2309
2309
|
meth = RDoc::AnyMethod.new "", "anon"
|
2310
2310
|
parse_method_parameters meth
|
2311
2311
|
parse_statements container, false, meth
|
@@ -2326,7 +2326,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2326
2326
|
##
|
2327
2327
|
# Updates visibility in +container+ from +vis_type+ and +vis+.
|
2328
2328
|
|
2329
|
-
def update_visibility
|
2329
|
+
def update_visibility(container, vis_type, vis, singleton) # :nodoc:
|
2330
2330
|
new_methods = []
|
2331
2331
|
|
2332
2332
|
case vis_type
|
@@ -2371,7 +2371,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2371
2371
|
##
|
2372
2372
|
# Prints +message+ to +$stderr+ unless we're being quiet
|
2373
2373
|
|
2374
|
-
def warn
|
2374
|
+
def warn(message)
|
2375
2375
|
@options.warn make_message message
|
2376
2376
|
end
|
2377
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
@@ -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
|
@@ -237,7 +237,7 @@ option)
|
|
237
237
|
# representing candidates for documentation. It may also contain comments
|
238
238
|
# (starting with '#')
|
239
239
|
|
240
|
-
def parse_dot_doc_file
|
240
|
+
def parse_dot_doc_file(in_dir, filename)
|
241
241
|
# read and strip comments
|
242
242
|
patterns = File.read(filename).gsub(/#.*/, '')
|
243
243
|
|
@@ -311,7 +311,7 @@ option)
|
|
311
311
|
# files. However we may well contain subdirectories which must be tested
|
312
312
|
# for .document files.
|
313
313
|
|
314
|
-
def list_files_in_directory
|
314
|
+
def list_files_in_directory(dir)
|
315
315
|
files = Dir.glob File.join(dir, "*")
|
316
316
|
|
317
317
|
normalized_file_list files, false, @options.exclude
|
@@ -320,7 +320,7 @@ option)
|
|
320
320
|
##
|
321
321
|
# Parses +filename+ and returns an RDoc::TopLevel
|
322
322
|
|
323
|
-
def parse_file
|
323
|
+
def parse_file(filename)
|
324
324
|
encoding = @options.encoding
|
325
325
|
filename = filename.encode encoding
|
326
326
|
|
@@ -391,7 +391,7 @@ The internal error was:
|
|
391
391
|
##
|
392
392
|
# Parse each file on the command line, recursively entering directories.
|
393
393
|
|
394
|
-
def parse_files
|
394
|
+
def parse_files(files)
|
395
395
|
file_list = gather_files files
|
396
396
|
@stats = RDoc::Stats.new @store, file_list.length, @options.verbosity
|
397
397
|
|
@@ -418,7 +418,7 @@ The internal error was:
|
|
418
418
|
# Removes file extensions known to be unparseable from +files+ and TAGS
|
419
419
|
# files for emacs and vim.
|
420
420
|
|
421
|
-
def remove_unparseable
|
421
|
+
def remove_unparseable(files)
|
422
422
|
files.reject do |file, *|
|
423
423
|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
|
424
424
|
(file =~ /tags$/i and
|
@@ -440,7 +440,7 @@ The internal error was:
|
|
440
440
|
# By default, output will be stored in a directory called "doc" below the
|
441
441
|
# current directory, so make sure you're somewhere writable before invoking.
|
442
442
|
|
443
|
-
def document
|
443
|
+
def document(options)
|
444
444
|
if RDoc::Options === options then
|
445
445
|
@options = options
|
446
446
|
else
|