rdoc 6.11.0 → 6.13.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdoc/code_object/alias.rb +2 -9
  3. data/lib/rdoc/code_object/any_method.rb +7 -12
  4. data/lib/rdoc/code_object/attr.rb +4 -7
  5. data/lib/rdoc/code_object/class_module.rb +37 -19
  6. data/lib/rdoc/code_object/constant.rb +1 -1
  7. data/lib/rdoc/code_object/context/section.rb +10 -68
  8. data/lib/rdoc/code_object/context.rb +4 -46
  9. data/lib/rdoc/code_object/method_attr.rb +2 -22
  10. data/lib/rdoc/code_object/require.rb +1 -1
  11. data/lib/rdoc/code_object/top_level.rb +4 -24
  12. data/lib/rdoc/code_object.rb +3 -35
  13. data/lib/rdoc/comment.rb +12 -5
  14. data/lib/rdoc/generator/darkfish.rb +92 -108
  15. data/lib/rdoc/generator/json_index.rb +1 -17
  16. data/lib/rdoc/generator/markup.rb +2 -2
  17. data/lib/rdoc/generator/pot/message_extractor.rb +2 -2
  18. data/lib/rdoc/generator/pot.rb +0 -5
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
  20. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  21. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  22. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
  23. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +13 -0
  24. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -4
  25. data/lib/rdoc/markdown.kpeg +7 -5
  26. data/lib/rdoc/markdown.rb +34 -21
  27. data/lib/rdoc/markup/heading.rb +7 -1
  28. data/lib/rdoc/markup/to_html.rb +6 -1
  29. data/lib/rdoc/parser/c.rb +5 -8
  30. data/lib/rdoc/parser/changelog.rb +3 -2
  31. data/lib/rdoc/parser/prism_ruby.rb +109 -45
  32. data/lib/rdoc/parser/ruby.rb +8 -11
  33. data/lib/rdoc/parser/simple.rb +1 -1
  34. data/lib/rdoc/parser.rb +3 -3
  35. data/lib/rdoc/rdoc.rb +3 -18
  36. data/lib/rdoc/ri/driver.rb +28 -19
  37. data/lib/rdoc/rubygems_hook.rb +1 -7
  38. data/lib/rdoc/servlet.rb +8 -7
  39. data/lib/rdoc/stats.rb +2 -2
  40. data/lib/rdoc/store.rb +9 -13
  41. data/lib/rdoc/text.rb +2 -2
  42. data/lib/rdoc/version.rb +1 -1
  43. metadata +2 -4
  44. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  45. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
@@ -21,9 +21,10 @@
21
21
  # * RDoc::MetaMethod
22
22
  # * RDoc::Alias
23
23
  # * RDoc::Constant
24
+ # * RDoc::Require
24
25
  # * RDoc::Mixin
25
- # * RDoc::Require
26
26
  # * RDoc::Include
27
+ # * RDoc::Extend
27
28
 
28
29
  class RDoc::CodeObject
29
30
 
@@ -89,13 +90,6 @@ class RDoc::CodeObject
89
90
 
90
91
  attr_reader :store
91
92
 
92
- ##
93
- # We are the model of the code, but we know that at some point we will be
94
- # worked on by viewers. By implementing the Viewable protocol, viewers can
95
- # associated themselves with these objects.
96
-
97
- attr_accessor :viewer
98
-
99
93
  ##
100
94
  # When mixed-in to a class, this points to the Context in which it was originally defined.
101
95
 
@@ -141,7 +135,6 @@ class RDoc::CodeObject
141
135
  def comment=(comment)
142
136
  @comment = case comment
143
137
  when NilClass then ''
144
- when RDoc::Markup::Document then comment
145
138
  when RDoc::Comment then comment.normalize
146
139
  else
147
140
  if comment and not comment.empty? then
@@ -217,20 +210,6 @@ class RDoc::CodeObject
217
210
  @document_children = @document_self
218
211
  end
219
212
 
220
- ##
221
- # Yields each parent of this CodeObject. See also
222
- # RDoc::ClassModule#each_ancestor
223
-
224
- def each_parent
225
- code_object = self
226
-
227
- while code_object = code_object.parent do
228
- yield code_object
229
- end
230
-
231
- self
232
- end
233
-
234
213
  ##
235
214
  # File name where this CodeObject was found.
236
215
  #
@@ -301,11 +280,7 @@ class RDoc::CodeObject
301
280
  # This is used by Text#snippet
302
281
 
303
282
  def options
304
- if @store and @store.rdoc then
305
- @store.rdoc.options
306
- else
307
- RDoc::Options.new
308
- end
283
+ @store&.options || RDoc::Options.new
309
284
  end
310
285
 
311
286
  ##
@@ -331,13 +306,6 @@ class RDoc::CodeObject
331
306
  end
332
307
  end
333
308
 
334
- ##
335
- # File name of our parent
336
-
337
- def parent_file_name
338
- @parent ? @parent.base_name : '(unknown)'
339
- end
340
-
341
309
  ##
342
310
  # Name of our parent
343
311
 
data/lib/rdoc/comment.rb CHANGED
@@ -92,7 +92,7 @@ class RDoc::Comment
92
92
  # # ARGF.to_a(limit) -> array
93
93
  # # ARGF.to_a(sep, limit) -> array
94
94
 
95
- def extract_call_seq method
95
+ def extract_call_seq
96
96
  # we must handle situations like the above followed by an unindented first
97
97
  # comment. The difficulty is to make sure not to match lines starting
98
98
  # with ARGF at the same indent, but that are after the first description
@@ -116,17 +116,14 @@ class RDoc::Comment
116
116
  @text.slice! all_start...all_stop
117
117
 
118
118
  seq.gsub!(/^\s*/, '')
119
- method.call_seq = seq
120
119
  end
121
-
122
- method
123
120
  end
124
121
 
125
122
  ##
126
123
  # A comment is empty if its text String is empty.
127
124
 
128
125
  def empty?
129
- @text.empty?
126
+ @text.empty? && (@document.nil? || @document.empty?)
130
127
  end
131
128
 
132
129
  ##
@@ -226,4 +223,14 @@ class RDoc::Comment
226
223
  @format == 'tomdoc'
227
224
  end
228
225
 
226
+ ##
227
+ # Create a new parsed comment from a document
228
+
229
+ def self.from_document(document) # :nodoc:
230
+ comment = RDoc::Comment.new('')
231
+ comment.document = document
232
+ comment.location = RDoc::TopLevel.new(document.file) if document.file
233
+ comment
234
+ end
235
+
229
236
  end
@@ -73,12 +73,6 @@ class RDoc::Generator::Darkfish
73
73
  css/rdoc.css
74
74
  ]
75
75
 
76
- ##
77
- # Path to this file's parent directory. Used to find templates and other
78
- # resources.
79
-
80
- GENERATOR_DIR = File.join 'rdoc', 'generator'
81
-
82
76
  ##
83
77
  # Release Version
84
78
 
@@ -184,22 +178,6 @@ class RDoc::Generator::Darkfish
184
178
  $stderr.puts(*msg)
185
179
  end
186
180
 
187
- ##
188
- # Directory where generated class HTML files live relative to the output
189
- # dir.
190
-
191
- def class_dir
192
- nil
193
- end
194
-
195
- ##
196
- # Directory where generated class HTML files live relative to the output
197
- # dir.
198
-
199
- def file_dir
200
- nil
201
- end
202
-
203
181
  ##
204
182
  # Create the directories the generated docs will live in if they don't
205
183
  # already exist.
@@ -301,8 +279,6 @@ class RDoc::Generator::Darkfish
301
279
  # Generate an index page which lists all the classes which are documented.
302
280
 
303
281
  def generate_index
304
- setup
305
-
306
282
  template_file = @template_dir + 'index.rhtml'
307
283
  return unless template_file.exist?
308
284
 
@@ -316,11 +292,14 @@ class RDoc::Generator::Darkfish
316
292
  asset_rel_prefix = rel_prefix + @asset_rel_path
317
293
 
318
294
  @title = @options.title
295
+ @main_page = @files.find { |f| f.full_name == @options.main_page }
319
296
 
320
297
  render_template template_file, out_file do |io|
321
298
  here = binding
322
299
  # suppress 1.9.3 warning
323
300
  here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
301
+ # some partials rely on the presence of current variable to render
302
+ here.local_variable_set(:current, @main_page) if @main_page
324
303
  here
325
304
  end
326
305
  rescue => e
@@ -335,8 +314,6 @@ class RDoc::Generator::Darkfish
335
314
  # Generates a class file for +klass+
336
315
 
337
316
  def generate_class klass, template_file = nil
338
- setup
339
-
340
317
  current = klass
341
318
 
342
319
  template_file ||= @template_dir + 'class.rhtml'
@@ -348,7 +325,9 @@ class RDoc::Generator::Darkfish
348
325
  search_index_rel_prefix += @asset_rel_path if @file_output
349
326
 
350
327
  asset_rel_prefix = rel_prefix + @asset_rel_path
351
- svninfo = get_svninfo(current)
328
+
329
+ breadcrumb = # used in templates
330
+ breadcrumb = generate_nesting_namespaces_breadcrumb(current, rel_prefix)
352
331
 
353
332
  @title = "#{klass.type} #{klass.full_name} - #{@options.title}"
354
333
 
@@ -357,7 +336,6 @@ class RDoc::Generator::Darkfish
357
336
  here = binding
358
337
  # suppress 1.9.3 warning
359
338
  here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
360
- here.local_variable_set(:svninfo, svninfo)
361
339
  here
362
340
  end
363
341
  end
@@ -366,8 +344,6 @@ class RDoc::Generator::Darkfish
366
344
  # Generate a documentation file for each class and module
367
345
 
368
346
  def generate_class_files
369
- setup
370
-
371
347
  template_file = @template_dir + 'class.rhtml'
372
348
  template_file = @template_dir + 'classpage.rhtml' unless
373
349
  template_file.exist?
@@ -393,8 +369,6 @@ class RDoc::Generator::Darkfish
393
369
  # Generate a documentation file for each file
394
370
 
395
371
  def generate_file_files
396
- setup
397
-
398
372
  page_file = @template_dir + 'page.rhtml'
399
373
  fileinfo_file = @template_dir + 'fileinfo.rhtml'
400
374
 
@@ -462,8 +436,6 @@ class RDoc::Generator::Darkfish
462
436
  # Generate a page file for +file+
463
437
 
464
438
  def generate_page file
465
- setup
466
-
467
439
  template_file = @template_dir + 'page.rhtml'
468
440
 
469
441
  out_file = @outputdir + file.path
@@ -491,8 +463,6 @@ class RDoc::Generator::Darkfish
491
463
  # Generates the 404 page for the RDoc servlet
492
464
 
493
465
  def generate_servlet_not_found message
494
- setup
495
-
496
466
  template_file = @template_dir + 'servlet_not_found.rhtml'
497
467
  return unless template_file.exist?
498
468
 
@@ -524,8 +494,6 @@ class RDoc::Generator::Darkfish
524
494
  # Generates the servlet root page for the RDoc servlet
525
495
 
526
496
  def generate_servlet_root installed
527
- setup
528
-
529
497
  template_file = @template_dir + 'servlet_root.rhtml'
530
498
  return unless template_file.exist?
531
499
 
@@ -551,8 +519,6 @@ class RDoc::Generator::Darkfish
551
519
  # Generate an index page which lists all the classes which are documented.
552
520
 
553
521
  def generate_table_of_contents
554
- setup
555
-
556
522
  template_file = @template_dir + 'table_of_contents.rhtml'
557
523
  return unless template_file.exist?
558
524
 
@@ -614,58 +580,6 @@ class RDoc::Generator::Darkfish
614
580
  @modsort = get_sorted_module_list @classes
615
581
  end
616
582
 
617
- ##
618
- # Return a string describing the amount of time in the given number of
619
- # seconds in terms a human can understand easily.
620
-
621
- def time_delta_string seconds
622
- return 'less than a minute' if seconds < 60
623
- return "#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}" if
624
- seconds < 3000 # 50 minutes
625
- return 'about one hour' if seconds < 5400 # 90 minutes
626
- return "#{seconds / 3600} hours" if seconds < 64800 # 18 hours
627
- return 'one day' if seconds < 86400 # 1 day
628
- return 'about one day' if seconds < 172800 # 2 days
629
- return "#{seconds / 86400} days" if seconds < 604800 # 1 week
630
- return 'about one week' if seconds < 1209600 # 2 week
631
- return "#{seconds / 604800} weeks" if seconds < 7257600 # 3 months
632
- return "#{seconds / 2419200} months" if seconds < 31536000 # 1 year
633
- return "#{seconds / 31536000} years"
634
- end
635
-
636
- # %q$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $"
637
- SVNID_PATTERN = /
638
- \$Id:\s
639
- (\S+)\s # filename
640
- (\d+)\s # rev
641
- (\d{4}-\d{2}-\d{2})\s # Date (YYYY-MM-DD)
642
- (\d{2}:\d{2}:\d{2}Z)\s # Time (HH:MM:SSZ)
643
- (\w+)\s # committer
644
- \$$
645
- /x
646
-
647
- ##
648
- # Try to extract Subversion information out of the first constant whose
649
- # value looks like a subversion Id tag. If no matching constant is found,
650
- # and empty hash is returned.
651
-
652
- def get_svninfo klass
653
- constants = klass.constants or return {}
654
-
655
- constants.find { |c| c.value =~ SVNID_PATTERN } or return {}
656
-
657
- filename, rev, date, time, committer = $~.captures
658
- commitdate = Time.parse "#{date} #{time}"
659
-
660
- return {
661
- :filename => filename,
662
- :rev => Integer(rev),
663
- :commitdate => commitdate,
664
- :commitdelta => time_delta_string(Time.now - commitdate),
665
- :committer => committer,
666
- }
667
- end
668
-
669
583
  ##
670
584
  # Creates a template from its components and the +body_file+.
671
585
  #
@@ -780,32 +694,39 @@ class RDoc::Generator::Darkfish
780
694
  template
781
695
  end
782
696
 
783
- # Returns an excerpt of the content for usage in meta description tags
784
- def excerpt(content)
785
- text = case content
697
+ # :stopdoc:
698
+ ParagraphExcerptRegexpOther = %r[\b\w[^./:]++\.]
699
+ # use \p/\P{letter} instead of \w/\W in Unicode
700
+ ParagraphExcerptRegexpUnicode = %r[\b\p{letter}[^./:]++\.]
701
+ # :startdoc:
702
+
703
+ # Returns an excerpt of the comment for usage in meta description tags
704
+ def excerpt(comment)
705
+ text = case comment
786
706
  when RDoc::Comment
787
- content.text
788
- when RDoc::Markup::Document
789
- # This case is for page files that are not markdown nor rdoc
790
- # We convert them to markdown for now as it's easier to extract the text
791
- formatter = RDoc::Markup::ToMarkdown.new
792
- formatter.start_accepting
793
- formatter.accept_document(content)
794
- formatter.end_accepting
707
+ comment.text
795
708
  else
796
- content
709
+ comment
797
710
  end
798
711
 
799
712
  # Match from a capital letter to the first period, discarding any links, so
800
713
  # that we don't end up matching badges in the README
801
- first_paragraph_match = text.match(/[A-Z][^\.:\/]+\./)
802
- return text[0...150].gsub(/\n/, " ").squeeze(" ") unless first_paragraph_match
714
+ pattern = ParagraphExcerptRegexpUnicode
715
+ begin
716
+ first_paragraph_match = text.match(pattern)
717
+ rescue Encoding::CompatibilityError
718
+ # The doc is non-ASCII text and encoded in other than Unicode base encodings.
719
+ raise if pattern == ParagraphExcerptRegexpOther
720
+ pattern = ParagraphExcerptRegexpOther
721
+ retry
722
+ end
723
+ return text[0...150].tr_s("\n", " ").squeeze(" ") unless first_paragraph_match
803
724
 
804
725
  extracted_text = first_paragraph_match[0]
805
- second_paragraph = first_paragraph_match.post_match.match(/[A-Z][^\.:\/]+\./)
726
+ second_paragraph = text.match(pattern, first_paragraph_match.end(0))
806
727
  extracted_text << " " << second_paragraph[0] if second_paragraph
807
728
 
808
- extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
729
+ extracted_text[0...150].tr_s("\n", " ").squeeze(" ")
809
730
  end
810
731
 
811
732
  def generate_ancestor_list(ancestors, klass)
@@ -825,4 +746,67 @@ class RDoc::Generator::Darkfish
825
746
 
826
747
  content << '</li></ul>'
827
748
  end
749
+
750
+ def generate_class_link(klass, rel_prefix)
751
+ if klass.display?
752
+ %(<code><a href="#{rel_prefix}/#{klass.path}">#{klass.name}</a></code>)
753
+ else
754
+ %(<code>#{klass.name}</code>)
755
+ end
756
+ end
757
+
758
+ def generate_class_index_content(classes, rel_prefix)
759
+ grouped_classes = group_classes_by_namespace_for_sidebar(classes)
760
+ return '' unless top = grouped_classes[nil]
761
+
762
+ solo = top.one? { |klass| klass.display? }
763
+ traverse_classes(top, grouped_classes, rel_prefix, solo)
764
+ end
765
+
766
+ def traverse_classes(klasses, grouped_classes, rel_prefix, solo = false)
767
+ content = +'<ul class="link-list">'
768
+
769
+ klasses.each do |index_klass|
770
+ if children = grouped_classes[index_klass.full_name]
771
+ content << %(<li><details#{solo ? ' open' : ''}><summary>#{generate_class_link(index_klass, rel_prefix)}</summary>)
772
+ content << traverse_classes(children, grouped_classes, rel_prefix)
773
+ content << '</details></li>'
774
+ solo = false
775
+ elsif index_klass.display?
776
+ content << %(<li>#{generate_class_link(index_klass, rel_prefix)}</li>)
777
+ end
778
+ end
779
+
780
+ "#{content}</ul>"
781
+ end
782
+
783
+ def group_classes_by_namespace_for_sidebar(classes)
784
+ grouped_classes = classes.group_by do |klass|
785
+ klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
786
+ end.select do |_, klasses|
787
+ klasses.any?(&:display?)
788
+ end
789
+
790
+ grouped_classes.values.each(&:uniq!)
791
+ grouped_classes
792
+ end
793
+
794
+ private
795
+
796
+ def nesting_namespaces_to_class_modules klass
797
+ tree = {}
798
+
799
+ klass.nesting_namespaces.zip(klass.fully_qualified_nesting_namespaces) do |ns, fqns|
800
+ tree[ns] = @store.classes_hash[fqns] || @store.modules_hash[fqns]
801
+ end
802
+
803
+ tree
804
+ end
805
+
806
+ def generate_nesting_namespaces_breadcrumb klass, rel_prefix
807
+ nesting_namespaces_to_class_modules(klass).map do |namespace, class_module|
808
+ path = class_module ? (rel_prefix + class_module.path).to_s : ""
809
+ { name: namespace, path: path, self: klass.full_name == class_module&.full_name }
810
+ end
811
+ end
828
812
  end
@@ -86,9 +86,7 @@ class RDoc::Generator::JsonIndex
86
86
  attr_reader :index # :nodoc:
87
87
 
88
88
  ##
89
- # Creates a new generator. +parent_generator+ is used to determine the
90
- # class_dir and file_dir of links in the output index.
91
- #
89
+ # Creates a new generator.
92
90
  # +options+ are the same options passed to the parent generator.
93
91
 
94
92
  def initialize parent_generator, options
@@ -265,20 +263,6 @@ class RDoc::Generator::JsonIndex
265
263
  end
266
264
  end
267
265
 
268
- ##
269
- # The directory classes are written to
270
-
271
- def class_dir
272
- @parent_generator.class_dir
273
- end
274
-
275
- ##
276
- # The directory files are written to
277
-
278
- def file_dir
279
- @parent_generator.file_dir
280
- end
281
-
282
266
  def reset files, classes # :nodoc:
283
267
  @files = files
284
268
  @classes = classes
@@ -34,7 +34,7 @@ module RDoc::Generator::Markup
34
34
  def formatter
35
35
  return @formatter if defined? @formatter
36
36
 
37
- options = @store.rdoc.options
37
+ options = @store.options
38
38
  this = RDoc::Context === self ? self : @parent
39
39
 
40
40
  @formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this
@@ -147,7 +147,7 @@ class RDoc::TopLevel
147
147
  # command line option to set.
148
148
 
149
149
  def cvs_url
150
- url = @store.rdoc.options.webcvs
150
+ url = @store.options.webcvs
151
151
 
152
152
  if /%s/ =~ url then
153
153
  url % @relative_name
@@ -35,11 +35,11 @@ class RDoc::Generator::POT::MessageExtractor
35
35
  end
36
36
  end
37
37
 
38
- klass.each_constant do |constant|
38
+ klass.constants.each do |constant|
39
39
  extract_text(constant.comment, constant.full_name)
40
40
  end
41
41
 
42
- klass.each_attribute do |attribute|
42
+ klass.attributes.each do |attribute|
43
43
  extract_text(attribute.comment, attribute.full_name)
44
44
  end
45
45
 
@@ -81,11 +81,6 @@ class RDoc::Generator::POT
81
81
  end
82
82
  end
83
83
 
84
- # :nodoc:
85
- def class_dir
86
- nil
87
- end
88
-
89
84
  private
90
85
  def extract_messages
91
86
  extractor = MessageExtractor.new(@store)
@@ -1,34 +1,5 @@
1
1
  <div id="classindex-section" class="nav-section">
2
2
  <h3>Class and Module Index</h3>
3
3
 
4
- <%-
5
- all_classes = @classes.group_by do |klass|
6
- klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
7
- end.delete_if do |_, klasses|
8
- !klasses.any?(&:display?)
9
- end
10
- link = proc do |index_klass, display = index_klass.display?|
11
- if display
12
- -%><code><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a></code><%-
13
- else
14
- -%><code><%= index_klass.name %></code><%-
15
- end
16
- end
17
- if top = all_classes[nil]
18
- solo = top.one? {|klass| klass.display?}
19
- traverse = proc do |klasses| -%>
20
- <ul class="link-list">
21
- <%- klasses.uniq!(&:full_name) -%>
22
- <%- klasses.each do |index_klass| -%>
23
- <%- if children = all_classes[index_klass.full_name] -%>
24
- <li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
25
- <%- traverse.call(children) -%>
26
- </ul></details>
27
- <%- elsif index_klass.display? -%>
28
- <li><% link.call(index_klass, true) %>
29
- <%- end -%>
30
- <%- end -%>
31
- <%- end -%>
32
- <%- traverse.call(top) -%>
33
- <%- end -%>
4
+ <%= generate_class_index_content(@classes, rel_prefix) %>
34
5
  </div>
@@ -3,7 +3,7 @@
3
3
  <h3>Extended With Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <%- klass.each_extend do |ext| -%>
6
+ <%- klass.extends.each do |ext| -%>
7
7
  <%- unless String === ext.module then -%>
8
8
  <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
9
9
  <%- else -%>
@@ -3,7 +3,7 @@
3
3
  <h3>Included Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <%- klass.each_include do |inc| -%>
6
+ <%- klass.includes.each do |inc| -%>
7
7
  <%- unless String === inc.module then -%>
8
8
  <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
9
9
  <%- else -%>
@@ -18,6 +18,21 @@
18
18
  </nav>
19
19
 
20
20
  <main role="main" aria-labelledby="<%=h klass.aref %>">
21
+ <%# If nesting level is 1, breadcrumb list is not needed %>
22
+ <% if breadcrumb.size > 1 %>
23
+ <ol role="navigation" aria-label="breadcrumb" class="breadcrumb">
24
+ <% breadcrumb.each do |namespace| %>
25
+ <li>
26
+ <% if namespace[:self] %>
27
+ <span><%= namespace[:name] %></span>
28
+ <% else %>
29
+ <a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span>::</span>
30
+ <% end %>
31
+ </li>
32
+ <% end %>
33
+ </ol>
34
+ <% end %>
35
+
21
36
  <h1 id="<%=h klass.aref %>" class="anchor-link <%= klass.type %>">
22
37
  <%= klass.type %> <%= klass.full_name %>
23
38
  </h1>
@@ -199,6 +199,19 @@ nav h3,
199
199
  font-size: 1em;
200
200
  }
201
201
 
202
+ ol.breadcrumb {
203
+ display: flex;
204
+
205
+ padding: 0;
206
+ margin: 0 0 1em;
207
+ }
208
+
209
+ ol.breadcrumb li {
210
+ display: block;
211
+ list-style: none;
212
+ font-size: 125%;
213
+ }
214
+
202
215
  nav ul,
203
216
  nav dl,
204
217
  nav p {
@@ -7,6 +7,7 @@
7
7
  <%= render '_sidebar_search.rhtml' %>
8
8
  </div>
9
9
 
10
+ <%= render '_sidebar_table_of_contents.rhtml' if defined?(current) %>
10
11
  <%= render '_sidebar_pages.rhtml' %>
11
12
  <%= render '_sidebar_classes.rhtml' %>
12
13
 
@@ -14,10 +15,9 @@
14
15
  </nav>
15
16
 
16
17
  <main role="main">
17
- <%- if @options.main_page and
18
- main_page = @files.find { |f| f.full_name == @options.main_page } then %>
19
- <%= main_page.description %>
18
+ <%- if @main_page %>
19
+ <%= @main_page.description %>
20
20
  <%- else -%>
21
- <p>This is the API documentation for <%= h @title %>.
21
+ <p>This is the API documentation for <%= h @title %>.
22
22
  <%- end -%>
23
23
  </main>
@@ -992,9 +992,8 @@ Strike = &{ strike? }
992
992
  "~~"
993
993
  { strike a.join }
994
994
 
995
- # TODO alt text support
996
- Image = "!" ( ExplicitLink | ReferenceLink ):a
997
- { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
995
+ Image = "!" ExplicitLinkWithLabel:a
996
+ { "rdoc-image:#{a[:link]}:#{a[:label]}" }
998
997
 
999
998
  Link = ExplicitLink | ReferenceLink | AutoLink
1000
999
 
@@ -1006,8 +1005,11 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label
1006
1005
  ReferenceLinkSingle = Label:content < (Spnl "[]")? >
1007
1006
  { link_to content, content, text }
1008
1007
 
1009
- ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")"
1010
- { "{#{l}}[#{s}]" }
1008
+ ExplicitLink = ExplicitLinkWithLabel:a
1009
+ { "{#{a[:label]}}[#{a[:link]}]" }
1010
+
1011
+ ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")"
1012
+ { { label: label, link: link } }
1011
1013
 
1012
1014
  Source = ( "<" < SourceContents > ">" | < SourceContents > )
1013
1015
  { text }