rdoc 6.13.0 → 6.17.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +1 -1
  3. data/README.md +112 -0
  4. data/RI.md +1 -1
  5. data/lib/rdoc/code_object/any_method.rb +4 -4
  6. data/lib/rdoc/code_object/attr.rb +3 -3
  7. data/lib/rdoc/code_object/class_module.rb +18 -16
  8. data/lib/rdoc/code_object/constant.rb +5 -5
  9. data/lib/rdoc/code_object/context/section.rb +8 -7
  10. data/lib/rdoc/code_object/context.rb +19 -19
  11. data/lib/rdoc/code_object/method_attr.rb +7 -6
  12. data/lib/rdoc/code_object/mixin.rb +3 -3
  13. data/lib/rdoc/code_object/normal_class.rb +1 -1
  14. data/lib/rdoc/code_object/normal_module.rb +1 -1
  15. data/lib/rdoc/code_object/single_class.rb +1 -1
  16. data/lib/rdoc/code_object/top_level.rb +28 -33
  17. data/lib/rdoc/code_object.rb +3 -3
  18. data/lib/rdoc/comment.rb +196 -14
  19. data/lib/rdoc/cross_reference.rb +4 -4
  20. data/lib/rdoc/encoding.rb +4 -4
  21. data/lib/rdoc/erb_partial.rb +1 -1
  22. data/lib/rdoc/erbio.rb +2 -2
  23. data/lib/rdoc/generator/aliki.rb +42 -0
  24. data/lib/rdoc/generator/darkfish.rb +20 -16
  25. data/lib/rdoc/generator/json_index.rb +3 -3
  26. data/lib/rdoc/generator/markup.rb +12 -0
  27. data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
  28. data/lib/rdoc/generator/pot/po.rb +1 -1
  29. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  30. data/lib/rdoc/generator/pot.rb +1 -1
  31. data/lib/rdoc/generator/ri.rb +1 -1
  32. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  33. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  34. data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
  35. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  36. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  37. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  38. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  39. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
  40. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
  41. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  42. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  43. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  44. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  45. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  46. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  47. data/lib/rdoc/generator/template/aliki/class.rhtml +220 -0
  48. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1737 -0
  49. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  50. data/lib/rdoc/generator/template/aliki/js/aliki.js +483 -0
  51. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  52. data/lib/rdoc/generator/template/aliki/js/search.js +120 -0
  53. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  54. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  55. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  56. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  57. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  58. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -16
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
  68. data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -60
  69. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
  70. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
  71. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
  72. data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
  73. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
  74. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
  75. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
  76. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
  77. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  78. data/lib/rdoc/generator.rb +1 -0
  79. data/lib/rdoc/markdown.kpeg +72 -18
  80. data/lib/rdoc/markdown.rb +411 -547
  81. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  82. data/lib/rdoc/markup/attributes.rb +3 -3
  83. data/lib/rdoc/markup/blank_line.rb +2 -2
  84. data/lib/rdoc/markup/block_quote.rb +1 -1
  85. data/lib/rdoc/markup/document.rb +8 -8
  86. data/lib/rdoc/markup/formatter.rb +12 -12
  87. data/lib/rdoc/markup/hard_break.rb +3 -3
  88. data/lib/rdoc/markup/heading.rb +4 -4
  89. data/lib/rdoc/markup/include.rb +3 -3
  90. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  91. data/lib/rdoc/markup/list.rb +4 -4
  92. data/lib/rdoc/markup/list_item.rb +4 -4
  93. data/lib/rdoc/markup/paragraph.rb +2 -2
  94. data/lib/rdoc/markup/parser.rb +11 -11
  95. data/lib/rdoc/markup/pre_process.rb +39 -15
  96. data/lib/rdoc/markup/raw.rb +5 -5
  97. data/lib/rdoc/markup/rule.rb +2 -2
  98. data/lib/rdoc/markup/table.rb +4 -4
  99. data/lib/rdoc/markup/to_ansi.rb +7 -3
  100. data/lib/rdoc/markup/to_bs.rb +10 -6
  101. data/lib/rdoc/markup/to_html.rb +182 -30
  102. data/lib/rdoc/markup/to_html_crossref.rb +58 -28
  103. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  104. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  105. data/lib/rdoc/markup/to_label.rb +6 -5
  106. data/lib/rdoc/markup/to_markdown.rb +12 -12
  107. data/lib/rdoc/markup/to_rdoc.rb +40 -31
  108. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  109. data/lib/rdoc/markup/to_test.rb +1 -1
  110. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  111. data/lib/rdoc/markup/verbatim.rb +3 -3
  112. data/lib/rdoc/markup.rb +3 -3
  113. data/lib/rdoc/options.rb +53 -23
  114. data/lib/rdoc/parser/c.rb +31 -62
  115. data/lib/rdoc/parser/changelog.rb +9 -9
  116. data/lib/rdoc/parser/prism_ruby.rb +122 -114
  117. data/lib/rdoc/parser/ruby.rb +51 -51
  118. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  119. data/lib/rdoc/parser/simple.rb +5 -22
  120. data/lib/rdoc/parser.rb +8 -8
  121. data/lib/rdoc/rd/inline.rb +4 -4
  122. data/lib/rdoc/rd.rb +1 -1
  123. data/lib/rdoc/rdoc.rb +9 -8
  124. data/lib/rdoc/ri/driver.rb +49 -49
  125. data/lib/rdoc/ri/paths.rb +2 -2
  126. data/lib/rdoc/ri/task.rb +3 -3
  127. data/lib/rdoc/rubygems_hook.rb +14 -11
  128. data/lib/rdoc/servlet.rb +15 -15
  129. data/lib/rdoc/stats/normal.rb +1 -1
  130. data/lib/rdoc/stats/quiet.rb +1 -1
  131. data/lib/rdoc/stats/verbose.rb +3 -3
  132. data/lib/rdoc/stats.rb +12 -12
  133. data/lib/rdoc/store.rb +32 -32
  134. data/lib/rdoc/task.rb +6 -6
  135. data/lib/rdoc/text.rb +11 -11
  136. data/lib/rdoc/token_stream.rb +14 -2
  137. data/lib/rdoc/tom_doc.rb +8 -8
  138. data/lib/rdoc/version.rb +1 -1
  139. data/man/ri.1 +2 -0
  140. data/rdoc.gemspec +72 -0
  141. metadata +61 -6
  142. data/README.rdoc +0 -142
@@ -150,7 +150,7 @@ class RDoc::Generator::Darkfish
150
150
  ##
151
151
  # Initialize a few instance variables before we start
152
152
 
153
- def initialize store, options
153
+ def initialize(store, options)
154
154
  @store = store
155
155
  @options = options
156
156
 
@@ -269,7 +269,7 @@ class RDoc::Generator::Darkfish
269
269
  # Return a list of the documented modules sorted by salience first, then
270
270
  # by name.
271
271
 
272
- def get_sorted_module_list classes
272
+ def get_sorted_module_list(classes)
273
273
  classes.select do |klass|
274
274
  klass.display?
275
275
  end.sort
@@ -313,7 +313,9 @@ class RDoc::Generator::Darkfish
313
313
  ##
314
314
  # Generates a class file for +klass+
315
315
 
316
- def generate_class klass, template_file = nil
316
+ def generate_class(klass, template_file = nil)
317
+ # This is used to auto-collapse Pages section on class/module pages
318
+ @inside_class_file = true
317
319
  current = klass
318
320
 
319
321
  template_file ||= @template_dir + 'class.rhtml'
@@ -338,6 +340,8 @@ class RDoc::Generator::Darkfish
338
340
  here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
339
341
  here
340
342
  end
343
+ ensure
344
+ @inside_class_file = false
341
345
  end
342
346
 
343
347
  ##
@@ -435,7 +439,7 @@ class RDoc::Generator::Darkfish
435
439
  ##
436
440
  # Generate a page file for +file+
437
441
 
438
- def generate_page file
442
+ def generate_page(file)
439
443
  template_file = @template_dir + 'page.rhtml'
440
444
 
441
445
  out_file = @outputdir + file.path
@@ -462,7 +466,7 @@ class RDoc::Generator::Darkfish
462
466
  ##
463
467
  # Generates the 404 page for the RDoc servlet
464
468
 
465
- def generate_servlet_not_found message
469
+ def generate_servlet_not_found(message)
466
470
  template_file = @template_dir + 'servlet_not_found.rhtml'
467
471
  return unless template_file.exist?
468
472
 
@@ -493,7 +497,7 @@ class RDoc::Generator::Darkfish
493
497
  ##
494
498
  # Generates the servlet root page for the RDoc servlet
495
499
 
496
- def generate_servlet_root installed
500
+ def generate_servlet_root(installed)
497
501
  template_file = @template_dir + 'servlet_root.rhtml'
498
502
  return unless template_file.exist?
499
503
 
@@ -547,7 +551,7 @@ class RDoc::Generator::Darkfish
547
551
  raise error
548
552
  end
549
553
 
550
- def install_rdoc_static_file source, destination, options # :nodoc:
554
+ def install_rdoc_static_file(source, destination, options) # :nodoc:
551
555
  return unless source.exist?
552
556
 
553
557
  begin
@@ -586,7 +590,7 @@ class RDoc::Generator::Darkfish
586
590
  # For backwards compatibility, if +body_file+ contains "<html" the body is
587
591
  # used directly.
588
592
 
589
- def assemble_template body_file
593
+ def assemble_template(body_file)
590
594
  body = body_file.read
591
595
  return body if body =~ /<html/
592
596
 
@@ -595,7 +599,7 @@ class RDoc::Generator::Darkfish
595
599
  <<-TEMPLATE
596
600
  <!DOCTYPE html>
597
601
 
598
- <html>
602
+ <html lang="#{@options.locale&.name || 'en'}">
599
603
  <head>
600
604
  #{head_file.read}
601
605
 
@@ -607,7 +611,7 @@ class RDoc::Generator::Darkfish
607
611
  # Renders the ERb contained in +file_name+ relative to the template
608
612
  # directory and returns the result based on the current context.
609
613
 
610
- def render file_name
614
+ def render(file_name)
611
615
  template_file = @template_dir + file_name
612
616
 
613
617
  template = template_for template_file, false, RDoc::ERBPartial
@@ -625,7 +629,7 @@ class RDoc::Generator::Darkfish
625
629
  #
626
630
  # An io will be yielded which must be captured by binding in the caller.
627
631
 
628
- def render_template template_file, out_file = nil # :yield: io
632
+ def render_template(template_file, out_file = nil) # :yield: io
629
633
  io_output = out_file && !@dry_run && @file_output
630
634
  erb_klass = io_output ? RDoc::ERBIO : ERB
631
635
 
@@ -659,7 +663,7 @@ class RDoc::Generator::Darkfish
659
663
  # Creates the result for +template+ with +context+. If an error is raised a
660
664
  # Pathname +template_file+ will indicate the file where the error occurred.
661
665
 
662
- def template_result template, context, template_file
666
+ def template_result(template, context, template_file)
663
667
  template.filename = template_file.to_s
664
668
  template.result context
665
669
  rescue NoMethodError => e
@@ -672,7 +676,7 @@ class RDoc::Generator::Darkfish
672
676
  ##
673
677
  # Retrieves a cache template for +file+, if present, or fills the cache.
674
678
 
675
- def template_for file, page = true, klass = ERB
679
+ def template_for(file, page = true, klass = ERB)
676
680
  template = @template_cache[file]
677
681
 
678
682
  return template if template
@@ -764,7 +768,7 @@ class RDoc::Generator::Darkfish
764
768
  end
765
769
 
766
770
  def traverse_classes(klasses, grouped_classes, rel_prefix, solo = false)
767
- content = +'<ul class="link-list">'
771
+ content = +'<ul class="link-list nav-list">'
768
772
 
769
773
  klasses.each do |index_klass|
770
774
  if children = grouped_classes[index_klass.full_name]
@@ -793,7 +797,7 @@ class RDoc::Generator::Darkfish
793
797
 
794
798
  private
795
799
 
796
- def nesting_namespaces_to_class_modules klass
800
+ def nesting_namespaces_to_class_modules(klass)
797
801
  tree = {}
798
802
 
799
803
  klass.nesting_namespaces.zip(klass.fully_qualified_nesting_namespaces) do |ns, fqns|
@@ -803,7 +807,7 @@ class RDoc::Generator::Darkfish
803
807
  tree
804
808
  end
805
809
 
806
- def generate_nesting_namespaces_breadcrumb klass, rel_prefix
810
+ def generate_nesting_namespaces_breadcrumb(klass, rel_prefix)
807
811
  nesting_namespaces_to_class_modules(klass).map do |namespace, class_module|
808
812
  path = class_module ? (rel_prefix + class_module.path).to_s : ""
809
813
  { name: namespace, path: path, self: klass.full_name == class_module&.full_name }
@@ -89,7 +89,7 @@ class RDoc::Generator::JsonIndex
89
89
  # Creates a new generator.
90
90
  # +options+ are the same options passed to the parent generator.
91
91
 
92
- def initialize parent_generator, options
92
+ def initialize(parent_generator, options)
93
93
  @parent_generator = parent_generator
94
94
  @store = parent_generator.store
95
95
  @options = options
@@ -263,7 +263,7 @@ class RDoc::Generator::JsonIndex
263
263
  end
264
264
  end
265
265
 
266
- def reset files, classes # :nodoc:
266
+ def reset(files, classes) # :nodoc:
267
267
  @files = files
268
268
  @classes = classes
269
269
 
@@ -277,7 +277,7 @@ class RDoc::Generator::JsonIndex
277
277
  ##
278
278
  # Removes whitespace and downcases +string+
279
279
 
280
- def search_string string
280
+ def search_string(string)
281
281
  string.downcase.gsub(/\s/, '')
282
282
  end
283
283
 
@@ -55,6 +55,18 @@ module RDoc::Generator::Markup
55
55
  end
56
56
  end
57
57
 
58
+ ##
59
+ # The preferred URL for this object.
60
+
61
+ def canonical_url
62
+ options = @store.options
63
+ if path
64
+ File.join(options.canonical_root, path.to_s)
65
+ else
66
+ options.canonical_root
67
+ end
68
+ end
69
+
58
70
  end
59
71
 
60
72
  class RDoc::CodeObject
@@ -7,7 +7,7 @@ class RDoc::Generator::POT::MessageExtractor
7
7
  ##
8
8
  # Creates a message extractor for +store+.
9
9
 
10
- def initialize store
10
+ def initialize(store)
11
11
  @store = store
12
12
  @po = RDoc::Generator::POT::PO.new
13
13
  end
@@ -25,7 +25,7 @@ class RDoc::Generator::POT::MessageExtractor
25
25
 
26
26
  private
27
27
 
28
- def extract_from_klass klass
28
+ def extract_from_klass(klass)
29
29
  extract_text(klass.comment_location, klass.full_name)
30
30
 
31
31
  klass.each_section do |section, constants, attributes|
@@ -48,7 +48,7 @@ class RDoc::Generator::POT::MessageExtractor
48
48
  end
49
49
  end
50
50
 
51
- def extract_text text, comment, location = nil
51
+ def extract_text(text, comment, location = nil)
52
52
  return if text.nil?
53
53
 
54
54
  options = {
@@ -61,7 +61,7 @@ class RDoc::Generator::POT::MessageExtractor
61
61
  end
62
62
  end
63
63
 
64
- def entry msgid, options
64
+ def entry(msgid, options)
65
65
  RDoc::Generator::POT::POEntry.new(msgid, options)
66
66
  end
67
67
 
@@ -15,7 +15,7 @@ class RDoc::Generator::POT::PO
15
15
  ##
16
16
  # Adds a PO entry to the PO.
17
17
 
18
- def add entry
18
+ def add(entry)
19
19
  existing_entry = @entries[entry.msgid]
20
20
  if existing_entry
21
21
  entry = existing_entry.merge(entry)
@@ -26,7 +26,7 @@ class RDoc::Generator::POT::POEntry
26
26
  # Creates a PO entry for +msgid+. Other values can be specified by
27
27
  # +options+.
28
28
 
29
- def initialize msgid, options = {}
29
+ def initialize(msgid, options = {})
30
30
  @msgid = msgid
31
31
  @msgstr = options[:msgstr] || ""
32
32
  @translator_comment = options[:translator_comment]
@@ -53,7 +53,7 @@ msgstr #{format_message(@msgstr)}
53
53
  ##
54
54
  # Merges the PO entry with +other_entry+.
55
55
 
56
- def merge other_entry
56
+ def merge(other_entry)
57
57
  options = {
58
58
  :extracted_comment => merge_string(@extracted_comment,
59
59
  other_entry.extracted_comment),
@@ -69,7 +69,7 @@ msgstr #{format_message(@msgstr)}
69
69
 
70
70
  private
71
71
 
72
- def format_comment mark, comment
72
+ def format_comment(mark, comment)
73
73
  return '' unless comment
74
74
  return '' if comment.empty?
75
75
 
@@ -106,7 +106,7 @@ msgstr #{format_message(@msgstr)}
106
106
  "\#, #{formatted_flags}\n"
107
107
  end
108
108
 
109
- def format_message message
109
+ def format_message(message)
110
110
  return "\"#{escape(message)}\"" unless message.include?("\n")
111
111
 
112
112
  formatted_message = '""'
@@ -117,7 +117,7 @@ msgstr #{format_message(@msgstr)}
117
117
  formatted_message
118
118
  end
119
119
 
120
- def escape string
120
+ def escape(string)
121
121
  string.gsub(/["\\\t\n]/) do |special_character|
122
122
  case special_character
123
123
  when "\t"
@@ -130,11 +130,11 @@ msgstr #{format_message(@msgstr)}
130
130
  end
131
131
  end
132
132
 
133
- def merge_string string1, string2
133
+ def merge_string(string1, string2)
134
134
  [string1, string2].compact.join("\n")
135
135
  end
136
136
 
137
- def merge_array array1, array2
137
+ def merge_array(array1, array2)
138
138
  (array1 + array2).uniq
139
139
  end
140
140
 
@@ -65,7 +65,7 @@ class RDoc::Generator::POT
65
65
  ##
66
66
  # Set up a new .pot generator
67
67
 
68
- def initialize store, options #:not-new:
68
+ def initialize(store, options) #:not-new:
69
69
  @options = options
70
70
  @store = store
71
71
  end
@@ -14,7 +14,7 @@ class RDoc::Generator::RI
14
14
  ##
15
15
  # Set up a new ri generator
16
16
 
17
- def initialize store, options #:not-new:
17
+ def initialize(store, options) #:not-new:
18
18
  @options = options
19
19
  @store = store
20
20
  @store.path = '.'
@@ -0,0 +1,8 @@
1
+ <aside class="table-of-contents" role="complementary" aria-label="Table of Contents">
2
+ <div class="toc-sticky">
3
+ <h3 class="toc-heading">On This Page</h3>
4
+ <nav class="toc-nav" id="toc-nav" aria-label="Page sections">
5
+ <!-- Generated by JavaScript based on page headings -->
6
+ </nav>
7
+ </div>
8
+ </aside>
@@ -0,0 +1,23 @@
1
+ <footer class="site-footer">
2
+ <% if @options.footer_content && !@options.footer_content.empty? %>
3
+ <div class="footer-content">
4
+ <% @options.footer_content.each do |column_title, links| %>
5
+ <div>
6
+ <h3><%= h column_title %></h3>
7
+ <ul>
8
+ <% links.each do |text, url| %>
9
+ <li><a href="<%= h url %>"><%= h text %></a></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+
17
+ <div class="footer-bottom">
18
+ <p>
19
+ Generated by <a href="https://ruby.github.io/rdoc/">RDoc <%= RDoc::VERSION %></a>
20
+ using the Aliki theme by <a href="http://st0012.dev">Stan Lo</a>
21
+ </p>
22
+ </div>
23
+ </footer>
@@ -0,0 +1,158 @@
1
+ <meta charset="<%= @options.charset %>">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+
4
+ <title><%= h @title %></title>
5
+
6
+ <%- if defined?(klass) %>
7
+ <meta
8
+ name="keywords"
9
+ content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>"
10
+ >
11
+ <%- if klass.comment.empty? %>
12
+ <meta
13
+ name="description"
14
+ content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>"
15
+ >
16
+ <%- else %>
17
+ <meta
18
+ name="description"
19
+ content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>"
20
+ >
21
+ <%- end %>
22
+ <%- elsif defined?(file) %>
23
+ <meta name="keywords" content="ruby,documentation,<%= h file.page_name %>">
24
+ <meta
25
+ name="description"
26
+ content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>"
27
+ >
28
+ <%- elsif @title %>
29
+ <meta name="keywords" content="ruby,documentation,<%= h @title %>">
30
+ <%- if @options.main_page and
31
+ main_page = @files.find { |f| f.full_name == @options.main_page } then %>
32
+ <meta
33
+ name="description"
34
+ content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>"
35
+ >
36
+ <%- else %>
37
+ <meta name="description" content="Documentation for <%= h @title %>">
38
+ <%- end %>
39
+ <%- end %>
40
+
41
+ <%- if canonical_url = @options.canonical_root %>
42
+ <% canonical_url = current.canonical_url if defined?(current) %>
43
+ <link rel="canonical" href="<%= canonical_url %>">
44
+ <%- end %>
45
+
46
+ <!-- Open Graph / Facebook -->
47
+ <meta property="og:type" content="website">
48
+ <meta property="og:title" content="<%= h @title %>">
49
+
50
+ <%- if defined?(klass) %>
51
+ <%- if klass.comment.empty? %>
52
+ <meta
53
+ property="og:description"
54
+ content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples"
55
+ >
56
+ <%- else %>
57
+ <meta property="og:description" content="<%= h excerpt(klass.comment) %>">
58
+ <%- end %>
59
+ <%- elsif defined?(file) %>
60
+ <%- if file.comment.empty? %>
61
+ <meta
62
+ property="og:description"
63
+ content="<%= h file.page_name %> - <%= h @title %> documentation"
64
+ >
65
+ <%- else %>
66
+ <meta property="og:description" content="<%= h excerpt(file.comment) %>">
67
+ <%- end %>
68
+ <%- else %>
69
+ <meta
70
+ property="og:description"
71
+ content="API documentation for <%= h @title %> - Browse classes, modules, and methods"
72
+ >
73
+ <%- end %>
74
+
75
+ <%- if canonical_url = @options.canonical_root %>
76
+ <% canonical_url = current.canonical_url if defined?(current) %>
77
+ <meta property="og:url" content="<%= canonical_url %>">
78
+ <%- end %>
79
+
80
+ <!-- Twitter -->
81
+ <meta name="twitter:card" content="summary">
82
+ <meta name="twitter:title" content="<%= h @title %>">
83
+
84
+ <%- if defined?(klass) %>
85
+ <%- if klass.comment.empty? %>
86
+ <meta
87
+ name="twitter:description"
88
+ content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples"
89
+ >
90
+ <%- else %>
91
+ <meta name="twitter:description" content="<%= h excerpt(klass.comment) %>">
92
+ <%- end %>
93
+ <%- elsif defined?(file) %>
94
+ <%- if file.comment.empty? %>
95
+ <meta
96
+ name="twitter:description"
97
+ content="<%= h file.page_name %> - <%= h @title %> documentation"
98
+ >
99
+ <%- else %>
100
+ <meta name="twitter:description" content="<%= h excerpt(file.comment) %>">
101
+ <%- end %>
102
+ <%- else %>
103
+ <meta
104
+ name="twitter:description"
105
+ content="API documentation for <%= h @title %> - Browse classes, modules, and methods"
106
+ >
107
+ <%- end %>
108
+
109
+ <script type="text/javascript">
110
+ var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
111
+ var index_rel_prefix = "<%= h rel_prefix %>/";
112
+ </script>
113
+
114
+ <script
115
+ src="<%= h asset_rel_prefix %>/js/theme-toggle.js?v=<%= h RDoc::VERSION %>"
116
+ ></script>
117
+
118
+ <script
119
+ src="<%= h asset_rel_prefix %>/js/navigation.js?v=<%= h RDoc::VERSION %>"
120
+ defer
121
+ ></script>
122
+
123
+ <script
124
+ src="<%= h asset_rel_prefix %>/js/search.js?v=<%= h RDoc::VERSION %>"
125
+ defer
126
+ ></script>
127
+
128
+ <script
129
+ src="<%= h asset_rel_prefix %>/js/search_index.js?v=<%= h RDoc::VERSION %>"
130
+ defer
131
+ ></script>
132
+
133
+ <script
134
+ src="<%= h asset_rel_prefix %>/js/searcher.js?v=<%= h RDoc::VERSION %>"
135
+ defer
136
+ ></script>
137
+
138
+ <script
139
+ src="<%= h asset_rel_prefix %>/js/c_highlighter.js?v=<%= h RDoc::VERSION %>"
140
+ defer
141
+ ></script>
142
+
143
+ <script
144
+ src="<%= h asset_rel_prefix %>/js/aliki.js?v=<%= h RDoc::VERSION %>"
145
+ defer
146
+ ></script>
147
+
148
+ <link
149
+ href="<%= h asset_rel_prefix %>/css/rdoc.css?v=<%= h RDoc::VERSION %>"
150
+ rel="stylesheet"
151
+ >
152
+
153
+ <%- @options.template_stylesheets.each do |stylesheet| %>
154
+ <link
155
+ href="<%= h asset_rel_prefix %>/<%= h File.basename stylesheet %>?v=<%= h RDoc::VERSION %>"
156
+ rel="stylesheet"
157
+ >
158
+ <%- end %>
@@ -0,0 +1,56 @@
1
+ <header class="top-navbar">
2
+ <a href="<%= rel_prefix %>/index.html" class="navbar-brand">
3
+ <%= h @options.title %>
4
+ </a>
5
+
6
+ <!-- Desktop search bar -->
7
+ <div class="navbar-search navbar-search-desktop" role="search">
8
+ <form action="#" method="get" accept-charset="utf-8">
9
+ <input id="search-field" role="combobox" aria-label="Search"
10
+ aria-autocomplete="list" aria-controls="search-results"
11
+ type="text" name="search" placeholder="Search (/) for a class, method..."
12
+ spellcheck="false" autocomplete="off"
13
+ title="Type to search, Up and Down to navigate, Enter to load">
14
+ <ul id="search-results" aria-label="Search Results"
15
+ aria-busy="false" aria-expanded="false"
16
+ aria-atomic="false" class="initially-hidden"></ul>
17
+ </form>
18
+ </div>
19
+
20
+ <!-- Mobile search icon button -->
21
+ <button id="search-toggle" class="navbar-search-mobile" aria-label="Open search" type="button">
22
+ <span aria-hidden="true">🔍</span>
23
+ </button>
24
+
25
+ <!-- Theme toggle button -->
26
+ <button id="theme-toggle" class="theme-toggle" aria-label="Switch to dark mode" type="button">
27
+ <span class="theme-toggle-icon" aria-hidden="true">🌙</span>
28
+ </button>
29
+ </header>
30
+
31
+ <!-- Search Modal (Mobile) -->
32
+ <div id="search-modal" class="search-modal" hidden aria-modal="true" role="dialog" aria-label="Search">
33
+ <div class="search-modal-backdrop"></div>
34
+ <div class="search-modal-content">
35
+ <div class="search-modal-header">
36
+ <form class="search-modal-form" action="#" method="get" accept-charset="utf-8">
37
+ <span class="search-modal-icon" aria-hidden="true">🔍</span>
38
+ <input id="search-field-mobile" role="combobox" aria-label="Search"
39
+ aria-autocomplete="list" aria-controls="search-results-mobile"
40
+ type="text" name="search" placeholder="Search documentation"
41
+ spellcheck="false" autocomplete="off">
42
+ <button type="button" class="search-modal-close" aria-label="Close search" id="search-modal-close">
43
+ <span aria-hidden="true">esc</span>
44
+ </button>
45
+ </form>
46
+ </div>
47
+ <div class="search-modal-body">
48
+ <ul id="search-results-mobile" aria-label="Search Results"
49
+ aria-busy="false" aria-expanded="false"
50
+ aria-atomic="false" class="search-modal-results initially-hidden"></ul>
51
+ <div class="search-modal-empty">
52
+ <p>No recent searches</p>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>