rdoc 6.7.0 → 6.11.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/ExampleMarkdown.md +2 -0
  3. data/ExampleRDoc.rdoc +2 -0
  4. data/History.rdoc +64 -62
  5. data/LICENSE.rdoc +2 -0
  6. data/README.rdoc +13 -0
  7. data/RI.md +842 -0
  8. data/TODO.rdoc +8 -7
  9. data/lib/rdoc/{alias.rb → code_object/alias.rb} +1 -1
  10. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +68 -1
  11. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +17 -5
  12. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +4 -4
  13. data/lib/rdoc/code_object.rb +6 -0
  14. data/lib/rdoc/generator/darkfish.rb +45 -3
  15. data/lib/rdoc/generator/pot/message_extractor.rb +1 -1
  16. data/lib/rdoc/generator/pot/po_entry.rb +1 -1
  17. data/lib/rdoc/generator/template/darkfish/_head.rhtml +23 -0
  18. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -0
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
  20. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +3 -8
  21. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  22. data/lib/rdoc/generator/template/darkfish/class.rhtml +69 -43
  23. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +380 -399
  24. data/lib/rdoc/generator/template/darkfish/index.rhtml +7 -6
  25. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +24 -1
  26. data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
  27. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
  28. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +5 -2
  29. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +11 -0
  30. data/lib/rdoc/markdown.kpeg +1 -1
  31. data/lib/rdoc/markdown.rb +21 -11
  32. data/lib/rdoc/markup/attribute_manager.rb +2 -2
  33. data/lib/rdoc/markup/formatter.rb +19 -12
  34. data/lib/rdoc/markup/pre_process.rb +26 -6
  35. data/lib/rdoc/markup/to_bs.rb +1 -1
  36. data/lib/rdoc/markup/to_html.rb +1 -1
  37. data/lib/rdoc/markup/to_html_crossref.rb +63 -12
  38. data/lib/rdoc/markup/to_rdoc.rb +5 -5
  39. data/lib/rdoc/markup.rb +18 -13
  40. data/lib/rdoc/options.rb +78 -12
  41. data/lib/rdoc/parser/c.rb +25 -1
  42. data/lib/rdoc/parser/changelog.rb +2 -2
  43. data/lib/rdoc/parser/prism_ruby.rb +1028 -0
  44. data/lib/rdoc/parser/ripper_state_lex.rb +7 -305
  45. data/lib/rdoc/parser/ruby.rb +15 -6
  46. data/lib/rdoc/parser.rb +2 -1
  47. data/lib/rdoc/rd/block_parser.rb +3 -3
  48. data/lib/rdoc/rd/inline_parser.rb +3 -3
  49. data/lib/rdoc/rdoc.rb +6 -3
  50. data/lib/rdoc/ri/driver.rb +58 -14
  51. data/lib/rdoc/rubygems_hook.rb +90 -8
  52. data/lib/rdoc/store.rb +12 -0
  53. data/lib/rdoc/task.rb +2 -3
  54. data/lib/rdoc/tom_doc.rb +1 -7
  55. data/lib/rdoc/version.rb +1 -1
  56. data/lib/rdoc.rb +22 -24
  57. data/lib/rubygems_plugin.rb +23 -0
  58. metadata +27 -26
  59. data/RI.rdoc +0 -57
  60. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  61. data/lib/rdoc/generator/template/json_index/.document +0 -1
  62. /data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +0 -0
  63. /data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +0 -0
  64. /data/lib/rdoc/{attr.rb → code_object/attr.rb} +0 -0
  65. /data/lib/rdoc/{constant.rb → code_object/constant.rb} +0 -0
  66. /data/lib/rdoc/{context → code_object/context}/section.rb +0 -0
  67. /data/lib/rdoc/{context.rb → code_object/context.rb} +0 -0
  68. /data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -0
  69. /data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +0 -0
  70. /data/lib/rdoc/{include.rb → code_object/include.rb} +0 -0
  71. /data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +0 -0
  72. /data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +0 -0
  73. /data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +0 -0
  74. /data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +0 -0
  75. /data/lib/rdoc/{require.rb → code_object/require.rb} +0 -0
  76. /data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +0 -0
data/TODO.rdoc CHANGED
@@ -1,9 +1,10 @@
1
+ = TODO
1
2
  This file contains some things that might happen in RDoc, or might not.
2
3
  Forward Looking Statements applies.
3
4
 
4
- === RDoc::VERSION.succ
5
+ == RDoc::VERSION.succ
5
6
 
6
- Blockers:
7
+ === Blockers:
7
8
 
8
9
  * Update LICENSE to match ruby's switch
9
10
  * The alias keyword should not be bidirectional
@@ -13,7 +14,7 @@ Blockers:
13
14
  * Fix consumption of , after link like: RDoc[rdoc-ref:RDoc], <- comma here
14
15
  * Remove support for links like Matrix[*rows]
15
16
 
16
- Nice to have:
17
+ === Nice to have:
17
18
 
18
19
  * Parse only changed files (like in ruby)
19
20
  * Page of Glory (or Shame) in HTML output showing documentation coverage
@@ -26,9 +27,9 @@ Nice to have:
26
27
  * Global variable support
27
28
  * Provide the code_object to directive handlers
28
29
 
29
- === More Future
30
+ == More Future
30
31
 
31
- API changes to RDoc
32
+ === API changes to RDoc
32
33
 
33
34
  * RDoc::TopLevel#add_method should automatically create the appropriate method
34
35
  class rather than requiring one be passed in.
@@ -36,7 +37,7 @@ API changes to RDoc
36
37
  * Add versions to RDoc::Markup syntax tree marshal format
37
38
  * Comments can no longer be Strings
38
39
 
39
- === Crazy Ideas
40
+ == Crazy Ideas
40
41
 
41
42
  * Auto-normalize heading levels to look OK. It's weird to see an <h1> in
42
43
  the middle of a method section.
@@ -46,7 +47,7 @@ API changes to RDoc
46
47
  * Rename Context to Container
47
48
  * Rename NormalClass to Class
48
49
 
49
- === Accessibility
50
+ == Accessibility
50
51
 
51
52
  Page title in right hand side
52
53
 
@@ -70,7 +70,7 @@ class RDoc::Alias < RDoc::CodeObject
70
70
  # HTML id-friendly version of +#new_name+.
71
71
 
72
72
  def html_name
73
- CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
73
+ CGI.escape(@new_name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
74
74
  end
75
75
 
76
76
  def inspect # :nodoc:
@@ -223,6 +223,7 @@ class RDoc::ClassModule < RDoc::Context
223
223
  def complete min_visibility
224
224
  update_aliases
225
225
  remove_nodoc_children
226
+ embed_mixins
226
227
  update_includes
227
228
  remove_invisible min_visibility
228
229
  end
@@ -704,10 +705,37 @@ class RDoc::ClassModule < RDoc::Context
704
705
 
705
706
  ##
706
707
  # Set the superclass of this class to +superclass+
708
+ #
709
+ # where +superclass+ is one of:
710
+ #
711
+ # - +nil+
712
+ # - a String containing the full name of the superclass
713
+ # - the RDoc::ClassModule representing the superclass
707
714
 
708
715
  def superclass=(superclass)
709
716
  raise NoMethodError, "#{full_name} is a module" if module?
710
- @superclass = superclass
717
+ case superclass
718
+ when RDoc::ClassModule
719
+ @superclass = superclass.full_name
720
+ when nil, String
721
+ @superclass = superclass
722
+ else
723
+ raise TypeError, "superclass must be a String or RDoc::ClassModule, not #{superclass.class}"
724
+ end
725
+ end
726
+
727
+ ##
728
+ # Get all super classes of this class in an array. The last element might be
729
+ # a string if the name is unknown.
730
+
731
+ def super_classes
732
+ result = []
733
+ parent = self
734
+ while parent = parent.superclass
735
+ result << parent
736
+ return result if parent.is_a?(String)
737
+ end
738
+ result
711
739
  end
712
740
 
713
741
  def to_s # :nodoc:
@@ -798,4 +826,43 @@ class RDoc::ClassModule < RDoc::Context
798
826
  extends.uniq!
799
827
  end
800
828
 
829
+ def embed_mixins
830
+ return unless options.embed_mixins
831
+
832
+ includes.each do |include|
833
+ next if String === include.module
834
+ include.module.method_list.each do |code_object|
835
+ add_method(prepare_to_embed(code_object))
836
+ end
837
+ include.module.constants.each do |code_object|
838
+ add_constant(prepare_to_embed(code_object))
839
+ end
840
+ include.module.attributes.each do |code_object|
841
+ add_attribute(prepare_to_embed(code_object))
842
+ end
843
+ end
844
+
845
+ extends.each do |ext|
846
+ next if String === ext.module
847
+ ext.module.method_list.each do |code_object|
848
+ add_method(prepare_to_embed(code_object, true))
849
+ end
850
+ ext.module.attributes.each do |code_object|
851
+ add_attribute(prepare_to_embed(code_object, true))
852
+ end
853
+ end
854
+ end
855
+
856
+ private
857
+
858
+ def prepare_to_embed(code_object, singleton=false)
859
+ code_object = code_object.dup
860
+ code_object.mixin_from = code_object.parent
861
+ code_object.singleton = true if singleton
862
+ set_current_section(code_object.section.title, code_object.section.comment)
863
+ # add_method and add_attribute will reassign self's visibility back to the method/attribute
864
+ # so we need to sync self's visibility with the object's to properly retain that information
865
+ self.visibility = code_object.visibility
866
+ code_object
867
+ end
801
868
  end
@@ -114,8 +114,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
114
114
  return unless other.respond_to?(:singleton) &&
115
115
  other.respond_to?(:name)
116
116
 
117
- [ @singleton ? 0 : 1, name] <=>
118
- [other.singleton ? 0 : 1, other.name]
117
+ [@singleton ? 0 : 1, name_ord_range, name] <=>
118
+ [other.singleton ? 0 : 1, other.name_ord_range, other.name]
119
119
  end
120
120
 
121
121
  def == other # :nodoc:
@@ -268,8 +268,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
268
268
  when 'const_get' then 'const'
269
269
  when 'new' then
270
270
  $1.split('::').last. # ClassName => class_name
271
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
272
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
271
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
272
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
273
273
  downcase
274
274
  else
275
275
  $2
@@ -291,7 +291,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
291
291
  def html_name
292
292
  require 'cgi/util'
293
293
 
294
- CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
294
+ CGI.escape(@name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
295
295
  end
296
296
 
297
297
  ##
@@ -415,4 +415,16 @@ class RDoc::MethodAttr < RDoc::CodeObject
415
415
  end
416
416
  end
417
417
 
418
+ def name_ord_range # :nodoc:
419
+ case name.ord
420
+ when 0..64 # anything below "A"
421
+ 1
422
+ when 91..96 # the symbols between "Z" and "a"
423
+ 2
424
+ when 123..126 # 7-bit symbols above "z": "{", "|", "}", "~"
425
+ 3
426
+ else # everythig else can be sorted as normal
427
+ 4
428
+ end
429
+ end
418
430
  end
@@ -183,8 +183,8 @@ class RDoc::TopLevel < RDoc::Context
183
183
  "#<%s:0x%x %p modules: %p classes: %p>" % [
184
184
  self.class, object_id,
185
185
  base_name,
186
- @modules.map { |n,m| m },
187
- @classes.map { |n,c| c }
186
+ @modules.map { |n, m| m },
187
+ @classes.map { |n, c| c }
188
188
  ]
189
189
  end
190
190
 
@@ -254,8 +254,8 @@ class RDoc::TopLevel < RDoc::Context
254
254
  q.text "base name: #{base_name.inspect}"
255
255
  q.breakable
256
256
 
257
- items = @modules.map { |n,m| m }
258
- items.concat @modules.map { |n,c| c }
257
+ items = @modules.map { |n, m| m }
258
+ items.concat @modules.map { |n, c| c }
259
259
  q.seplist items do |mod| q.pp mod end
260
260
  end
261
261
  end
@@ -96,6 +96,11 @@ class RDoc::CodeObject
96
96
 
97
97
  attr_accessor :viewer
98
98
 
99
+ ##
100
+ # When mixed-in to a class, this points to the Context in which it was originally defined.
101
+
102
+ attr_accessor :mixin_from
103
+
99
104
  ##
100
105
  # Creates a new CodeObject that will document itself and its children
101
106
 
@@ -111,6 +116,7 @@ class RDoc::CodeObject
111
116
  @full_name = nil
112
117
  @store = nil
113
118
  @track_visibility = true
119
+ @mixin_from = nil
114
120
 
115
121
  initialize_visibility
116
122
  end
@@ -677,7 +677,6 @@ class RDoc::Generator::Darkfish
677
677
  return body if body =~ /<html/
678
678
 
679
679
  head_file = @template_dir + '_head.rhtml'
680
- footer_file = @template_dir + '_footer.rhtml'
681
680
 
682
681
  <<-TEMPLATE
683
682
  <!DOCTYPE html>
@@ -687,8 +686,6 @@ class RDoc::Generator::Darkfish
687
686
  #{head_file.read}
688
687
 
689
688
  #{body}
690
-
691
- #{footer_file.read}
692
689
  TEMPLATE
693
690
  end
694
691
 
@@ -783,4 +780,49 @@ class RDoc::Generator::Darkfish
783
780
  template
784
781
  end
785
782
 
783
+ # Returns an excerpt of the content for usage in meta description tags
784
+ def excerpt(content)
785
+ text = case content
786
+ 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
795
+ else
796
+ content
797
+ end
798
+
799
+ # Match from a capital letter to the first period, discarding any links, so
800
+ # 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
803
+
804
+ extracted_text = first_paragraph_match[0]
805
+ second_paragraph = first_paragraph_match.post_match.match(/[A-Z][^\.:\/]+\./)
806
+ extracted_text << " " << second_paragraph[0] if second_paragraph
807
+
808
+ extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
809
+ end
810
+
811
+ def generate_ancestor_list(ancestors, klass)
812
+ return '' if ancestors.empty?
813
+
814
+ ancestor = ancestors.shift
815
+ content = +'<ul><li>'
816
+
817
+ if ancestor.is_a?(RDoc::NormalClass)
818
+ content << "<a href=\"#{klass.aref_to ancestor.path}\">#{ancestor.full_name}</a>"
819
+ else
820
+ content << ancestor.to_s
821
+ end
822
+
823
+ # Recursively call the method for the remaining ancestors
824
+ content << generate_ancestor_list(ancestors, klass)
825
+
826
+ content << '</li></ul>'
827
+ end
786
828
  end
@@ -29,7 +29,7 @@ class RDoc::Generator::POT::MessageExtractor
29
29
  extract_text(klass.comment_location, klass.full_name)
30
30
 
31
31
  klass.each_section do |section, constants, attributes|
32
- extract_text(section.title ,"#{klass.full_name}: section title")
32
+ extract_text(section.title, "#{klass.full_name}: section title")
33
33
  section.comments.each do |comment|
34
34
  extract_text(comment, "#{klass.full_name}: #{section.title}")
35
35
  end
@@ -23,7 +23,7 @@ class RDoc::Generator::POT::POEntry
23
23
  attr_reader :flags
24
24
 
25
25
  ##
26
- # Creates a PO entry for +msgid+. Other valus can be specified by
26
+ # Creates a PO entry for +msgid+. Other values can be specified by
27
27
  # +options+.
28
28
 
29
29
  def initialize msgid, options = {}
@@ -1,7 +1,30 @@
1
1
  <meta charset="<%= @options.charset %>">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
2
3
 
3
4
  <title><%= h @title %></title>
4
5
 
6
+ <%- if defined?(klass) -%>
7
+ <meta name="keywords" content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>">
8
+
9
+ <%- if klass.comment.empty? -%>
10
+ <meta name="description" content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>">
11
+ <%- else -%>
12
+ <meta name="description" content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>">
13
+ <%- end -%>
14
+ <%- elsif defined?(file) -%>
15
+ <meta name="keywords" content="ruby,documentation,<%= h file.page_name %>">
16
+ <meta name="description" content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>">
17
+ <%- elsif @title -%>
18
+ <meta name="keywords" content="ruby,documentation,<%= h @title %>">
19
+
20
+ <%- if @options.main_page and
21
+ main_page = @files.find { |f| f.full_name == @options.main_page } then %>
22
+ <meta name="description" content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>">
23
+ <%- else -%>
24
+ <meta name="description" content="Documentation for <%= h @title %>">
25
+ <%- end -%>
26
+ <%- end -%>
27
+
5
28
  <script type="text/javascript">
6
29
  var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
7
30
  var index_rel_prefix = "<%= h rel_prefix %>/";
@@ -18,6 +18,7 @@
18
18
  solo = top.one? {|klass| klass.display?}
19
19
  traverse = proc do |klasses| -%>
20
20
  <ul class="link-list">
21
+ <%- klasses.uniq!(&:full_name) -%>
21
22
  <%- klasses.each do |index_klass| -%>
22
23
  <%- if children = all_classes[index_klass.full_name] -%>
23
24
  <li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
@@ -1,12 +1,21 @@
1
- <%- unless klass.method_list.empty? then %>
2
- <!-- Method Quickref -->
3
- <div id="method-list-section" class="nav-section">
4
- <h3>Methods</h3>
1
+ <% if (class_methods = klass.class_method_list.sort).any? %>
2
+ <div class="nav-section">
3
+ <h3>Class Methods</h3>
4
+ <ul class="link-list" role="directory">
5
+ <%- class_methods.each do |meth| -%>
6
+ <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name -%></a></li>
7
+ <%- end -%>
8
+ </ul>
9
+ </div>
10
+ <% end %>
5
11
 
6
- <ul class="link-list" role="directory">
7
- <%- klass.each_method do |meth| -%>
8
- <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= h meth.name -%></a>
9
- <%- end -%>
10
- </ul>
11
- </div>
12
- <%- end -%>
12
+ <% if (instance_methods = klass.instance_methods.sort).any? %>
13
+ <div class="nav-section">
14
+ <h3>Instance Methods</h3>
15
+ <ul class="link-list" role="directory">
16
+ <%- instance_methods.each do |meth| -%>
17
+ <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name -%></a></li>
18
+ <%- end -%>
19
+ </ul>
20
+ </div>
21
+ <% end %>
@@ -1,11 +1,6 @@
1
- <%- if klass.type == 'class' then %>
1
+ <%- if klass.type == 'class' && (ancestors = klass.super_classes).any? -%>
2
2
  <div id="parent-class-section" class="nav-section">
3
- <h3>Parent</h3>
4
-
5
- <%- if klass.superclass and not String === klass.superclass then -%>
6
- <p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a>
7
- <%- else -%>
8
- <p class="link"><%= klass.superclass %>
9
- <%- end -%>
3
+ <h3>Ancestors</h3>
4
+ <%= generate_ancestor_list(ancestors, klass) %>
10
5
  </div>
11
6
  <%- end -%>
@@ -0,0 +1,3 @@
1
+ <div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
2
+ <span aria-hidden="true">&#9776;</span>
3
+ </div>
@@ -1,23 +1,24 @@
1
1
  <body id="top" role="document" class="<%= klass.type %>">
2
- <nav role="navigation">
2
+ <%= render '_sidebar_toggle.rhtml' %>
3
+
4
+ <nav id="navigation" role="navigation">
3
5
  <div id="project-navigation">
4
6
  <%= render '_sidebar_navigation.rhtml' %>
5
7
  <%= render '_sidebar_search.rhtml' %>
6
8
  </div>
7
9
 
8
10
  <%= render '_sidebar_table_of_contents.rhtml' %>
11
+ <%= render '_sidebar_sections.rhtml' %>
12
+ <%= render '_sidebar_parent.rhtml' %>
13
+ <%= render '_sidebar_includes.rhtml' %>
14
+ <%= render '_sidebar_extends.rhtml' %>
15
+ <%= render '_sidebar_methods.rhtml' %>
9
16
 
10
- <div id="class-metadata">
11
- <%= render '_sidebar_sections.rhtml' %>
12
- <%= render '_sidebar_parent.rhtml' %>
13
- <%= render '_sidebar_includes.rhtml' %>
14
- <%= render '_sidebar_extends.rhtml' %>
15
- <%= render '_sidebar_methods.rhtml' %>
16
- </div>
17
+ <%= render '_footer.rhtml' %>
17
18
  </nav>
18
19
 
19
20
  <main role="main" aria-labelledby="<%=h klass.aref %>">
20
- <h1 id="<%=h klass.aref %>" class="<%= klass.type %>">
21
+ <h1 id="<%=h klass.aref %>" class="anchor-link <%= klass.type %>">
21
22
  <%= klass.type %> <%= klass.full_name %>
22
23
  </h1>
23
24
 
@@ -26,7 +27,7 @@
26
27
  </section>
27
28
 
28
29
  <%- klass.each_section do |section, constants, attributes| -%>
29
- <section id="<%= section.aref %>" class="documentation-section">
30
+ <section id="<%= section.aref %>" class="documentation-section anchor-link">
30
31
  <%- if section.title then -%>
31
32
  <header class="documentation-section-title">
32
33
  <h2>
@@ -53,7 +54,13 @@
53
54
  <%- constants.each do |const| -%>
54
55
  <dt id="<%= const.name %>"><%= const.name %>
55
56
  <%- if const.comment then -%>
56
- <dd><%= const.description.strip %>
57
+ <dd>
58
+ <%- if const.mixin_from then -%>
59
+ <div class="mixin-from">
60
+ Included from <a href="<%= klass.aref_to(const.mixin_from.path)%>"><%= const.mixin_from.full_name %></a>
61
+ </div>
62
+ <%- end -%>
63
+ <%= const.description.strip %>
57
64
  <%- else -%>
58
65
  <dd class="missing-docs">(Not documented)
59
66
  <%- end -%>
@@ -69,13 +76,20 @@
69
76
  </header>
70
77
 
71
78
  <%- attributes.each do |attrib| -%>
72
- <div id="<%= attrib.aref %>" class="method-detail">
79
+ <div id="<%= attrib.aref %>" class="method-detail anchor-link">
73
80
  <div class="method-heading attribute-method-heading">
74
- <span class="method-name"><%= h attrib.name %></span><span
75
- class="attribute-access-type">[<%= attrib.rw %>]</span>
81
+ <a href="#<%= attrib.aref %>" title="Link to this attribute">
82
+ <span class="method-name"><%= h attrib.name %></span>
83
+ <span class="attribute-access-type">[<%= attrib.rw %>]</span>
84
+ </a>
76
85
  </div>
77
86
 
78
87
  <div class="method-description">
88
+ <%- if attrib.mixin_from then -%>
89
+ <div class="mixin-from">
90
+ <%= attrib.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(attrib.mixin_from.path)%>"><%= attrib.mixin_from.full_name %></a>
91
+ </div>
92
+ <%- end -%>
79
93
  <%- if attrib.comment then -%>
80
94
  <%= attrib.description.strip %>
81
95
  <%- else -%>
@@ -91,44 +105,62 @@
91
105
  next if visibilities.empty?
92
106
  visibilities.each do |visibility, methods|
93
107
  next if methods.empty? %>
94
- <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section">
108
+ <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section anchor-link">
95
109
  <header>
96
110
  <h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
97
111
  </header>
98
112
 
99
113
  <%- methods.each do |method| -%>
100
- <div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
114
+ <div id="<%= method.aref %>" class="method-detail anchor-link <%= method.is_alias_for ? "method-alias" : '' %>">
101
115
  <div class="method-header">
102
116
  <%- if (call_seq = method.call_seq) then -%>
103
- <%- call_seq.strip.split("\n").each_with_index do |call_seq, i| -%>
104
- <div class="method-heading">
105
- <span class="method-callseq">
106
- <%= h(call_seq.strip.
107
- gsub( /^\w+\./m, '')).
108
- gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
109
- </span>
110
- <%- if i == 0 and method.token_stream then -%>
111
- <span class="method-click-advice">click to toggle source</span>
117
+ <%- call_seq.strip.split("\n").each_with_index do |call_seq, i| -%>
118
+ <div class="method-heading">
119
+ <a href="#<%= method.aref %>" title="Link to this method">
120
+ <span class="method-callseq">
121
+ <%= h(call_seq.strip.
122
+ gsub( /^\w+\./m, '')).
123
+ gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
124
+ </span>
125
+ </a>
126
+ </div>
112
127
  <%- end -%>
113
- </div>
114
- <%- end -%>
115
128
  <%- elsif method.has_call_seq? then -%>
116
- <div class="method-heading">
117
- <span class="method-name"><%= h method.name %></span>
118
- </div>
129
+ <div class="method-heading">
130
+ <a href="#<%= method.aref %>" title="Link to this method">
131
+ <span class="method-name"><%= h method.name %></span>
132
+ </a>
133
+ </div>
119
134
  <%- else -%>
120
- <div class="method-heading">
121
- <span class="method-name"><%= h method.name %></span><span
122
- class="method-args"><%= h method.param_seq %></span>
123
- <%- if method.token_stream then -%>
124
- <span class="method-click-advice">click to toggle source</span>
125
- <%- end -%>
126
- </div>
135
+ <div class="method-heading">
136
+ <a href="#<%= method.aref %>" title="Link to this method">
137
+ <span class="method-name"><%= h method.name %></span>
138
+ <span class="method-args"><%= h method.param_seq %></span>
139
+ </a>
140
+ </div>
127
141
  <%- end -%>
128
142
  </div>
129
143
 
144
+ <%- if method.token_stream -%>
145
+ <div class="method-controls">
146
+ <details class="method-source-toggle">
147
+ <summary>Source</summary>
148
+ </details>
149
+ </div>
150
+ <%- end -%>
151
+
130
152
  <%- unless method.skip_description? then -%>
131
153
  <div class="method-description">
154
+ <%- if method.token_stream then -%>
155
+ <div class="method-source-code" id="<%= method.html_name %>-source">
156
+ <pre><%= method.markup_code %></pre>
157
+ </div>
158
+ <%- end -%>
159
+ <%- if method.mixin_from then -%>
160
+ <div class="mixin-from">
161
+ <%= method.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(method.mixin_from.path)%>"><%= method.mixin_from.full_name %></a>
162
+ </div>
163
+ <%- end -%>
132
164
  <%- if method.comment then -%>
133
165
  <%= method.description.strip %>
134
166
  <%- else -%>
@@ -143,12 +175,6 @@
143
175
  %>
144
176
  </div>
145
177
  <%- end -%>
146
-
147
- <%- if method.token_stream then -%>
148
- <div class="method-source-code" id="<%= method.html_name %>-source">
149
- <pre><%= method.markup_code %></pre>
150
- </div>
151
- <%- end -%>
152
178
  </div>
153
179
  <%- end -%>
154
180