rdoc 3.10.pre.1 → 3.10.pre.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

data.tar.gz.sig CHANGED
Binary file
@@ -1,17 +1,18 @@
1
1
  === 3.10 / ??
2
2
 
3
3
  * Major enhancements
4
- * RDoc HTML output has been reorganized.
4
+ * RDoc HTML output has been improved:
5
5
  * The search from Володя Колесников's sdoc has been integrated.
6
6
 
7
7
  The search index generation is a reusable component through
8
8
  RDoc::Generator::JsonIndex
9
9
  * The table of contents is now a separate page and now shows links to
10
- headings inside a page or class.
10
+ headings and sections inside a page or class.
11
11
  * Class pages no longer show the namespace and no longer have file info
12
12
  pages.
13
- * HTML output is now using HTML 5.
14
- * RDoc supports additional documentation types:
13
+ * HTML output is HTML 5.
14
+ * Static files can be copied into RDoc using --copy-files
15
+ * RDoc supports additional documentation formats:
15
16
  * TomDoc 1.0.0-rc1
16
17
  * RD format
17
18
 
@@ -22,6 +23,8 @@
22
23
  it is used as the default for the entire file. For other comments it
23
24
  overrides the default markup format.
24
25
 
26
+ The markup format can be set for rake tasks using RDoc::Task#markup
27
+
25
28
  * Minor enhancements
26
29
  * HTML headings now have ids matching their titles.
27
30
 
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ Hoe.plugin :rdoc_tags
16
16
 
17
17
  $rdoc_rakefile = true
18
18
 
19
- Hoe.spec 'rdoc' do
19
+ hoe = Hoe.spec 'rdoc' do
20
20
  developer 'Eric Hodel', 'drbrain@segment7.net'
21
21
  developer 'Dave Thomas', ''
22
22
  developer 'Phil Hagelberg', 'technomancy@gmail.com'
@@ -50,7 +50,7 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
50
50
  spec_extras['homepage'] = 'http://docs.seattlerb.org/rdoc'
51
51
  end
52
52
 
53
- task 'generate' => PARSER_FILES
53
+ task :generate => PARSER_FILES
54
54
 
55
55
  rule '.rb' => '.ry' do |t|
56
56
  racc = Gem.bin_path 'racc', 'racc'
@@ -58,6 +58,16 @@ rule '.rb' => '.ry' do |t|
58
58
  ruby "-rubygems #{racc} -l -o #{t.name} #{t.source}"
59
59
  end
60
60
 
61
+ path = "pkg/#{hoe.spec.full_name}"
62
+
63
+ package_parser_files = PARSER_FILES.map do |parser_file|
64
+ package_parser_file = "#{path}/#{parser_file}"
65
+ file package_parser_file => parser_file # ensure copy runs before racc
66
+ package_parser_file
67
+ end
68
+
69
+ task "#{path}.gem" => package_parser_files
70
+
61
71
  # These tasks expect to have the following directory structure:
62
72
  #
63
73
  # git/git.rubini.us/code # Rubinius git HEAD checkout
data/TODO.rdoc CHANGED
@@ -1,10 +1,5 @@
1
1
  Some file contains some things that might happen in RDoc, or might not
2
2
 
3
- === RDoc 3.10
4
-
5
- * Copy static files into doc dir for HTML
6
- * Add sections to the ToC
7
-
8
3
  === RDoc 3.11
9
4
 
10
5
  * Reload the RDoc tree from an RI store
@@ -13,6 +8,9 @@ Some file contains some things that might happen in RDoc, or might not
13
8
  * Page of Glory (or Shame) in HTML output showing documentation coverage
14
9
  statistics.
15
10
  * Link to the parent-class implementation of methods that use super
11
+ * Add direct accessor to RDoc::Options to RDoc::Task
12
+ * Remove Public in HTML output if there are only public methods
13
+ * Method markup support for rd documentation
16
14
 
17
15
  === RDoc 4
18
16
 
@@ -653,7 +653,9 @@ class RDoc::Context < RDoc::CodeObject
653
653
  # Iterator for methods
654
654
 
655
655
  def each_method # :yields: method
656
- @method_list.sort.each {|m| yield m}
656
+ return enum_for __method__ unless block_given?
657
+
658
+ @method_list.sort.each { |m| yield m }
657
659
  end
658
660
 
659
661
  ##
@@ -1007,10 +1009,10 @@ class RDoc::Context < RDoc::CodeObject
1007
1009
  end
1008
1010
 
1009
1011
  ##
1010
- # Tries to resolve unmatched aliases when a method
1011
- # or attribute has just been added.
1012
+ # Tries to resolve unmatched aliases when a method or attribute has just
1013
+ # been added.
1012
1014
 
1013
- def resolve_aliases(added)
1015
+ def resolve_aliases added
1014
1016
  # resolve any pending unmatched aliases
1015
1017
  key = added.pretty_name
1016
1018
  unmatched_alias_list = @unmatched_alias_lists[key]
@@ -1022,6 +1024,31 @@ class RDoc::Context < RDoc::CodeObject
1022
1024
  @unmatched_alias_lists.delete key
1023
1025
  end
1024
1026
 
1027
+ ##
1028
+ # Returns RDoc::Context::Section objects referenced in this context for use
1029
+ # in a table of contents.
1030
+
1031
+ def section_contents
1032
+ used_sections = {}
1033
+
1034
+ each_method do |method|
1035
+ next unless method.display?
1036
+
1037
+ used_sections[method.section] = true
1038
+ end
1039
+
1040
+ # order found sections
1041
+ sections = sort_sections.select do |section|
1042
+ used_sections[section]
1043
+ end
1044
+
1045
+ # only the default section is used
1046
+ return [] if
1047
+ sections.length == 1 and not sections.first.title
1048
+
1049
+ sections
1050
+ end
1051
+
1025
1052
  ##
1026
1053
  # Sections in this context
1027
1054
 
@@ -102,6 +102,15 @@ class RDoc::Context::Section
102
102
  "#<%s:0x%x %p>" % [self.class, object_id, title]
103
103
  end
104
104
 
105
+ ##
106
+ # The section's title, or 'Top Section' if the title is nil.
107
+ #
108
+ # This is used by the table of contents template so the name is silly.
109
+
110
+ def plain_html
111
+ @title || 'Top Section'
112
+ end
113
+
105
114
  ##
106
115
  # Section sequence number (deprecated)
107
116
 
@@ -177,6 +177,8 @@ class RDoc::Generator::Darkfish
177
177
  generate_table_of_contents
178
178
  @json_index.generate top_levels
179
179
 
180
+ copy_static
181
+
180
182
  rescue => e
181
183
  debug_msg "%s: %s\n %s" % [
182
184
  e.class.name, e.message, e.backtrace.join("\n ")
@@ -187,6 +189,34 @@ class RDoc::Generator::Darkfish
187
189
 
188
190
  protected
189
191
 
192
+ ##
193
+ # Copies static files from the static_path into the output directory
194
+
195
+ def copy_static
196
+ return if @options.static_path.empty?
197
+
198
+ fu_options = { :verbose => $DEBUG_RDOC, :noop => @options.dry_run }
199
+
200
+ @options.static_path.each do |path|
201
+ unless File.directory? path then
202
+ FileUtils.install path, @base_dir, fu_options.merge(:mode => 0644)
203
+ next
204
+ end
205
+
206
+ Dir.chdir path do
207
+ Dir[File.join('**', '*')].each do |entry|
208
+ dest_file = @base_dir + entry
209
+
210
+ if File.directory? entry then
211
+ FileUtils.mkdir_p entry, fu_options
212
+ else
213
+ FileUtils.install entry, dest_file, fu_options.merge(:mode => 0644)
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
219
+
190
220
  ##
191
221
  # Return a list of the documented modules sorted by salience first, then
192
222
  # by name.
@@ -8,12 +8,14 @@
8
8
  <% simple_files.sort.each do |file| %>
9
9
  <li class="file">
10
10
  <a href="<%= file.path %>"><%= h file.page_name %></a>
11
- <% table = file.parse(file.comment).table_of_contents # HACK
11
+ <%
12
+ # HACK table_of_contents should not exist on Document
13
+ table = file.parse(file.comment).table_of_contents
12
14
  unless table.empty? then %>
13
15
  <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
14
16
  <ul class="initially-hidden">
15
17
  <% table.each do |heading| %>
16
- <li><a href="<%= file.path %>#<%= heading.label %>"><%= heading.plain_html %></a>
18
+ <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
17
19
  <% end %>
18
20
  </ul>
19
21
  <% end %>
@@ -27,12 +29,15 @@
27
29
  <% @modsort.each do |klass| %>
28
30
  <li class="<%= klass.type %>">
29
31
  <a href="<%= klass.path %>"><%= klass.full_name %></a>
30
- <% table = klass.parse(klass.comment).table_of_contents # HACK
32
+ <% table = []
33
+ table.push(*klass.parse(klass.comment).table_of_contents)
34
+ table.push(*klass.section_contents)
35
+
31
36
  unless table.empty? then %>
32
37
  <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
33
38
  <ul class="initially-hidden">
34
- <% table.each do |heading| %>
35
- <li><a href="<%= klass.path %>#<%= heading.label %>"><%= heading.plain_html %></a>
39
+ <% table.each do |item| %>
40
+ <li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
36
41
  <% end %>
37
42
  </ul>
38
43
  <% end %>
@@ -114,6 +114,17 @@ class RDoc::Markup::Formatter
114
114
  string
115
115
  end
116
116
 
117
+ ##
118
+ # Use ignore in your subclass to ignore the content of a node.
119
+ #
120
+ # ##
121
+ # # We don't support raw nodes in ToNoRaw
122
+ #
123
+ # alias accept_raw ignore
124
+
125
+ def ignore node
126
+ end
127
+
117
128
  ##
118
129
  # Are we currently inside tt tags?
119
130
 
@@ -40,9 +40,9 @@ class RDoc::Markup::Heading < Struct.new :level, :text
40
40
  end
41
41
 
42
42
  ##
43
- # An HTML-safe label for this header.
43
+ # An HTML-safe anchor reference for this header.
44
44
 
45
- def label
45
+ def aref
46
46
  "label-#{self.class.to_label.convert text.dup}"
47
47
  end
48
48
 
@@ -268,7 +268,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
268
268
  def accept_heading heading
269
269
  level = [6, heading.level].min
270
270
 
271
- label = heading.label
271
+ label = heading.aref
272
272
  label = [@code_object.aref, label].compact.join '-' if
273
273
  @code_object and @code_object.respond_to? :aref
274
274
 
@@ -56,16 +56,14 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
56
56
  end
57
57
 
58
58
  ##
59
- # Raw content is untrusted and ignored.
59
+ # Raw sections are untrusted and ignored
60
60
 
61
- def accept_raw raw
62
- end
61
+ alias accept_raw ignore
63
62
 
64
63
  ##
65
64
  # Rules are ignored
66
65
 
67
- def accept_rule rule
68
- end
66
+ alias accept_rule ignore
69
67
 
70
68
  def accept_paragraph paragraph
71
69
  para = @in_list_entry.last || "<p>"
@@ -39,12 +39,6 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
39
39
  @res = []
40
40
  end
41
41
 
42
- ##
43
- # Ignores the content of nodes that aren't headings
44
-
45
- def ignore node
46
- end
47
-
48
42
  # :stopdoc:
49
43
  alias accept_raw ignore
50
44
  alias accept_rule ignore
@@ -22,10 +22,15 @@ class RDoc::Options
22
22
  '--ri-system' => 'Ruby installers use other techniques',
23
23
  }
24
24
 
25
+ ##
26
+ # Path option validator for OptionParser
27
+
28
+ Path = Object.new
29
+
25
30
  ##
26
31
  # Template option validator for OptionParser
27
32
 
28
- Template = nil
33
+ Template = Object.new
29
34
 
30
35
  ##
31
36
  # Character-set for HTML output. #encoding is preferred over #charset
@@ -132,6 +137,11 @@ class RDoc::Options
132
137
 
133
138
  attr_accessor :show_hash
134
139
 
140
+ ##
141
+ # Directory to copy static files from
142
+
143
+ attr_accessor :static_path
144
+
135
145
  ##
136
146
  # The number of columns in a tab
137
147
 
@@ -192,6 +202,7 @@ class RDoc::Options
192
202
  @pipe = false
193
203
  @rdoc_include = []
194
204
  @show_hash = false
205
+ @static_path = []
195
206
  @stylesheet_url = nil
196
207
  @tab_width = 8
197
208
  @template = nil
@@ -378,6 +389,14 @@ Usage: #{opt.program_name} [options] [names...]
378
389
  end
379
390
  end
380
391
 
392
+ opt.accept Path do |directory|
393
+ directory = File.expand_path directory
394
+
395
+ raise OptionParser::InvalidArgument unless File.exist? directory
396
+
397
+ directory
398
+ end
399
+
381
400
  opt.separator nil
382
401
  opt.separator "Parsing options:"
383
402
  opt.separator nil
@@ -591,6 +610,18 @@ Usage: #{opt.program_name} [options] [names...]
591
610
 
592
611
  opt.separator nil
593
612
 
613
+ opt.on("--copy-files=PATH", Path,
614
+ "Specify a file or directory to copy static",
615
+ "files from.",
616
+ "If a file is given it will be copied into",
617
+ "the output dir. If a directory is given the",
618
+ "entire directory will be copied.",
619
+ "You can use this multiple times") do |value|
620
+ @static_path << value
621
+ end
622
+
623
+ opt.separator nil
624
+
594
625
  opt.on("--webcvs=URL", "-W",
595
626
  "Specify a URL for linking to a web frontend",
596
627
  "to CVS. If the URL contains a '\%s', the",
@@ -526,7 +526,7 @@ end
526
526
  private :set_term_to_element
527
527
 
528
528
  ##
529
- # Raises a ParseError
529
+ # Raises a ParseError when invalid formatting is found
530
530
 
531
531
  def on_error(et, ev, _values)
532
532
  prv, cur, nxt = format_line_num(@i, @i+1, @i+2)
@@ -422,25 +422,28 @@ OTHER_RE = Regexp.new(
422
422
 
423
423
  # :startdoc:
424
424
 
425
+ ##
426
+ # Creates a new parser for inline markup in the rd format. The +block_parser+
427
+ # is used to for footnotes and labels in the inline text.
428
+
425
429
  def initialize block_parser
426
430
  @block_parser = block_parser
427
431
  end
428
432
 
433
+ ##
434
+ # Parses the +inline+ text from RD format into RDoc format.
435
+
429
436
  def parse inline
430
437
  @inline = inline
431
438
  @src = StringScanner.new inline
432
439
  @pre = ""
433
440
  @yydebug = true
434
441
  do_parse.to_s
435
- rescue
436
- puts $!
437
- puts
438
- puts @inline[0, @src.pos].inspect
439
- puts @src.rest[0..40]
440
- puts
441
- raise
442
442
  end
443
443
 
444
+ ##
445
+ # Returns the next token from the inline text
446
+
444
447
  def next_token
445
448
  return [false, false] if @src.eos?
446
449
  # p @src.rest if @yydebug
@@ -518,6 +521,9 @@ def next_token
518
521
  end
519
522
  end
520
523
 
524
+ ##
525
+ # Raises a ParseError when invalid formatting is found
526
+
521
527
  def on_error(et, ev, values)
522
528
  lines_of_rest = @src.rest.lines.to_a.length
523
529
  prev_words = prev_words_on_error(ev)
@@ -532,6 +538,9 @@ RD syntax error: line #{@block_parser.line_index - lines_of_rest}:
532
538
  raise ParseError, message
533
539
  end
534
540
 
541
+ ##
542
+ # Returns words before the error
543
+
535
544
  def prev_words_on_error(ev)
536
545
  pre = @pre
537
546
  if ev and /#{Regexp.quote(ev)}$/ =~ pre
@@ -540,6 +549,9 @@ def prev_words_on_error(ev)
540
549
  last_line(pre)
541
550
  end
542
551
 
552
+ ##
553
+ # Returns the last line of +src+
554
+
543
555
  def last_line(src)
544
556
  if n = src.rindex("\n")
545
557
  src[(n+1) .. -1]
@@ -549,6 +561,9 @@ def last_line(src)
549
561
  end
550
562
  private :last_line
551
563
 
564
+ ##
565
+ # Returns words following an error
566
+
552
567
  def next_words_on_error
553
568
  if n = @src.rest.index("\n")
554
569
  @src.rest[0 .. (n-1)]
@@ -557,6 +572,9 @@ def next_words_on_error
557
572
  end
558
573
  end
559
574
 
575
+ ##
576
+ # Creates a new RDoc::RD::Inline for the +rdoc+ markup and the raw +reference+
577
+
560
578
  def inline rdoc, reference = rdoc
561
579
  RDoc::RD::Inline.new rdoc, reference
562
580
  end
@@ -20,14 +20,14 @@ require "stringio"
20
20
 
21
21
  class RDoc::RubyLex
22
22
 
23
- # :stopdoc:
24
-
25
23
  ##
26
24
  # Raised upon invalid input
27
25
 
28
26
  class Error < RDoc::Error
29
27
  end
30
28
 
29
+ # :stopdoc:
30
+
31
31
  extend Exception2MessageMapper
32
32
 
33
33
  def_exception(:AlreadyDefinedToken, "Already defined token(%s)")
@@ -55,11 +55,17 @@ class RDoc::RubyLex
55
55
  end
56
56
 
57
57
  self.debug_level = 0
58
+
59
+ # :startdoc:
58
60
 
59
- def self.tokenize text, options
61
+ ##
62
+ # Returns an Array of +ruby+ tokens. See ::new for a description of
63
+ # +options+.
64
+
65
+ def self.tokenize ruby, options
60
66
  tokens = []
61
67
 
62
- scanner = RDoc::RubyLex.new text, options
68
+ scanner = RDoc::RubyLex.new ruby, options
63
69
  scanner.exception_on_syntax_error = true
64
70
 
65
71
  while token = scanner.token do
@@ -69,6 +75,10 @@ class RDoc::RubyLex
69
75
  tokens
70
76
  end
71
77
 
78
+ ##
79
+ # Creates a new lexer for +content+. +options+ is an RDoc::Options, only
80
+ # +tab_width is used.
81
+
72
82
  def initialize(content, options)
73
83
  lex_init
74
84
 
@@ -112,6 +122,8 @@ class RDoc::RubyLex
112
122
  @ltype = nil
113
123
  end
114
124
 
125
+ # :stopdoc:
126
+
115
127
  def inspect # :nodoc:
116
128
  "#<%s:0x%x pos %d lex_state %p space_seen %p>" % [
117
129
  self.class, object_id,
@@ -158,7 +158,8 @@ class RDoc::Stats
158
158
  # Returns the length and number of undocumented items in +collection+.
159
159
 
160
160
  def doc_stats collection
161
- [collection.length, collection.count { |item| not item.documented? }]
161
+ visible = collection.select { |item| item.display? }
162
+ [visible.length, visible.count { |item| not item.documented? }]
162
163
  end
163
164
 
164
165
  ##
@@ -266,6 +267,7 @@ class RDoc::Stats
266
267
 
267
268
  def report_class_module cm
268
269
  return if cm.fully_documented? and @coverage_level.zero?
270
+ return unless cm.display?
269
271
 
270
272
  report = []
271
273
 
@@ -100,6 +100,12 @@ class RDoc::Task < Rake::TaskLib
100
100
 
101
101
  attr_accessor :name
102
102
 
103
+ ##
104
+ # Comment markup format. rdoc, rd and tomdoc are supported. (default is
105
+ # 'rdoc')
106
+
107
+ attr_accessor :markup
108
+
103
109
  ##
104
110
  # Name of directory to receive the html output files. (default is "html")
105
111
 
@@ -249,11 +255,12 @@ class RDoc::Task < Rake::TaskLib
249
255
 
250
256
  def option_list
251
257
  result = @options.dup
252
- result << "-o" << @rdoc_dir
253
- result << "--main" << main if main
254
- result << "--title" << title if title
255
- result << "-T" << template if template
256
- result << '-f' << generator if generator
258
+ result << "-o" << @rdoc_dir
259
+ result << "--main" << main if main
260
+ result << "--markup" << markup if markup
261
+ result << "--title" << title if title
262
+ result << "-T" << template if template
263
+ result << '-f' << generator if generator
257
264
  result
258
265
  end
259
266
 
@@ -364,6 +364,10 @@ class TestRDocContext < XrefTestCase
364
364
  refute_equal @c2_c3, @c3
365
365
  end
366
366
 
367
+ def test_each_method_enumerator
368
+ assert_kind_of Enumerator, @c1.each_method
369
+ end
370
+
367
371
  def test_each_section
368
372
  sects = []
369
373
  consts = []
@@ -392,6 +396,10 @@ class TestRDocContext < XrefTestCase
392
396
  assert_equal expected_attrs, attrs
393
397
  end
394
398
 
399
+ def test_each_section_enumerator
400
+ assert_kind_of Enumerator, @c1.each_section
401
+ end
402
+
395
403
  def test_find_attribute_named
396
404
  assert_equal nil, @c1.find_attribute_named('none')
397
405
  assert_equal 'R', @c1.find_attribute_named('attr').rw
@@ -667,6 +675,43 @@ class TestRDocContext < XrefTestCase
667
675
  assert_equal [@pub, @prot, @priv], methods
668
676
  end
669
677
 
678
+ def test_section_contents
679
+ default = @context.sections.first
680
+ @context.add_method RDoc::AnyMethod.new(nil, 'm1')
681
+
682
+ b = @context.add_section 'B'
683
+ m = @context.add_method RDoc::AnyMethod.new(nil, 'm2')
684
+ m.section = b
685
+
686
+ assert_equal [default, b], @context.section_contents
687
+ end
688
+
689
+ def test_section_contents_no_default
690
+ @context = RDoc::Context.new
691
+ b = @context.add_section 'B'
692
+ m = @context.add_method RDoc::AnyMethod.new(nil, 'm')
693
+ m.section = b
694
+
695
+ assert_equal [b], @context.section_contents
696
+ end
697
+
698
+ def test_section_contents_only_default
699
+ @context = RDoc::Context.new
700
+
701
+ @context.add_method RDoc::AnyMethod.new(nil, 'm')
702
+
703
+ assert_empty @context.section_contents
704
+ end
705
+
706
+ def test_section_contents_unused
707
+ @context = RDoc::Context.new
708
+
709
+ @context.add_method RDoc::AnyMethod.new(nil, 'm')
710
+ b = @context.add_section 'B'
711
+
712
+ assert_empty @context.section_contents
713
+ end
714
+
670
715
  def test_set_current_section
671
716
  default_section = @context.sections.first
672
717
 
@@ -104,6 +104,35 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
104
104
  refute_file 'file_rb.html'
105
105
  end
106
106
 
107
+ def test_generate_static
108
+ FileUtils.mkdir_p 'dir/images'
109
+ FileUtils.touch 'dir/images/image.png'
110
+ FileUtils.mkdir_p 'file'
111
+ FileUtils.touch 'file/file.txt'
112
+
113
+ @options.static_path = [
114
+ File.expand_path('dir'),
115
+ File.expand_path('file/file.txt'),
116
+ ]
117
+
118
+ @g.generate [@top_level]
119
+
120
+ assert_file 'images/image.png'
121
+ assert_file 'file.txt'
122
+ end
123
+
124
+ def test_generate_static_dry_run
125
+ FileUtils.mkdir 'static'
126
+ FileUtils.touch 'static/image.png'
127
+
128
+ @options.static_path = [File.expand_path('static')]
129
+ @options.dry_run = true
130
+
131
+ @g.generate [@top_level]
132
+
133
+ refute_file 'image.png'
134
+ end
135
+
107
136
  def test_template_for
108
137
  classpage = Pathname.new @options.template_dir + 'class.rhtml'
109
138
 
@@ -8,8 +8,8 @@ class TestRDocMarkupHeading < RDoc::TestCase
8
8
  @h = RDoc::Markup::Heading.new 1, 'Hello *Friend*!'
9
9
  end
10
10
 
11
- def test_label
12
- assert_equal 'label-Hello+Friend%21', @h.label
11
+ def test_aref
12
+ assert_equal 'label-Hello+Friend%21', @h.aref
13
13
  end
14
14
 
15
15
  def test_plain_html
@@ -66,6 +66,35 @@ file 'unreadable' not readable
66
66
  assert_equal expected, @options.generator_descriptions
67
67
  end
68
68
 
69
+ def test_parse_copy_files_file_relative
70
+ file = File.basename __FILE__
71
+ expected = File.expand_path __FILE__
72
+
73
+ Dir.chdir File.expand_path('..', __FILE__) do
74
+ @options.parse %W[--copy-files #{file}]
75
+
76
+ assert_equal [expected], @options.static_path
77
+ end
78
+ end
79
+
80
+ def test_parse_copy_files_file_absolute
81
+ @options.parse %W[--copy-files #{File.expand_path __FILE__}]
82
+
83
+ assert_equal [File.expand_path(__FILE__)], @options.static_path
84
+ end
85
+
86
+ def test_parse_copy_files_directory_relative
87
+ @options.parse %w[--copy-files .]
88
+
89
+ assert_equal [@pwd], @options.static_path
90
+ end
91
+
92
+ def test_parse_copy_files_directory_absolute
93
+ @options.parse %w[--copy-files /]
94
+
95
+ assert_equal ['/'], @options.static_path
96
+ end
97
+
69
98
  def test_parse_coverage
70
99
  @options.parse %w[--dcov]
71
100
 
@@ -2356,6 +2356,25 @@ end
2356
2356
  assert_equal expected, m.comment.parse
2357
2357
  end
2358
2358
 
2359
+ def test_scan_stopdoc
2360
+ util_parser <<-RUBY
2361
+ class C
2362
+ # :stopdoc:
2363
+ class Hidden
2364
+ end
2365
+ end
2366
+ RUBY
2367
+
2368
+ @parser.scan
2369
+
2370
+ c = @top_level.classes.first
2371
+
2372
+ hidden = c.classes.first
2373
+
2374
+ refute hidden.document_self
2375
+ assert hidden.ignored?
2376
+ end
2377
+
2359
2378
  def test_stopdoc_after_comment
2360
2379
  util_parser <<-EOS
2361
2380
  module Bar
@@ -11,6 +11,26 @@ class TestRDocStats < RDoc::TestCase
11
11
  @tl.parser = RDoc::Parser::Ruby
12
12
  end
13
13
 
14
+ def test_doc_stats
15
+ c = RDoc::CodeObject.new
16
+
17
+ assert_equal [1, 1], @s.doc_stats([c])
18
+ end
19
+
20
+ def test_doc_stats_documented
21
+ c = RDoc::CodeObject.new
22
+ c.comment = comment 'x'
23
+
24
+ assert_equal [1, 0], @s.doc_stats([c])
25
+ end
26
+
27
+ def test_doc_stats_display_eh
28
+ c = RDoc::CodeObject.new
29
+ c.ignore
30
+
31
+ assert_equal [0, 0], @s.doc_stats([c])
32
+ end
33
+
14
34
  def test_report_attr
15
35
  c = @tl.add_class RDoc::NormalClass, 'C'
16
36
  c.record_location @tl
@@ -266,6 +286,17 @@ end
266
286
  assert_equal expected, report
267
287
  end
268
288
 
289
+ def test_report_class_module_ignore
290
+ c = @tl.add_class RDoc::NormalClass, 'C'
291
+ c.ignore
292
+
293
+ RDoc::TopLevel.complete :public
294
+
295
+ report = @s.report_class_module c
296
+
297
+ assert_nil report
298
+ end
299
+
269
300
  def test_report_empty
270
301
  RDoc::TopLevel.complete :public
271
302
 
@@ -33,6 +33,14 @@ class TestRDocTask < RDoc::TestCase
33
33
  end
34
34
  end
35
35
 
36
+ def test_markup_option
37
+ rdoc_task = RDoc::Task.new do |rd|
38
+ rd.markup = "tomdoc"
39
+ end
40
+
41
+ assert_equal %w[-o html --markup tomdoc], rdoc_task.option_list
42
+ end
43
+
36
44
  def test_tasks_creation
37
45
  RDoc::Task.new
38
46
  assert Rake::Task[:rdoc]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923831867
4
+ hash: 1923831869
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 10
9
9
  - pre
10
- - 1
11
- version: 3.10.pre.1
10
+ - 2
11
+ version: 3.10.pre.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Eric Hodel
@@ -40,7 +40,7 @@ cert_chain:
40
40
  x52qPcexcYZR7w==
41
41
  -----END CERTIFICATE-----
42
42
 
43
- date: 2011-09-27 00:00:00 Z
43
+ date: 2011-09-28 00:00:00 Z
44
44
  dependencies:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: json
metadata.gz.sig CHANGED
Binary file