rdoc 6.15.1 → 6.16.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +1 -1
  3. data/lib/rdoc/code_object/top_level.rb +18 -17
  4. data/lib/rdoc/comment.rb +190 -8
  5. data/lib/rdoc/generator/aliki.rb +42 -0
  6. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  7. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  8. data/lib/rdoc/generator/template/aliki/_head.rhtml +91 -0
  9. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  10. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +6 -0
  11. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +5 -0
  12. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +15 -0
  13. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +15 -0
  14. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  15. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +21 -0
  16. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +37 -0
  17. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  18. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +11 -0
  19. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  20. data/lib/rdoc/generator/template/aliki/class.rhtml +219 -0
  21. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1612 -0
  22. data/lib/rdoc/generator/template/aliki/index.rhtml +21 -0
  23. data/lib/rdoc/generator/template/aliki/js/aliki.js +483 -0
  24. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  25. data/lib/rdoc/generator/template/aliki/js/search.js +120 -0
  26. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  27. data/lib/rdoc/generator/template/aliki/page.rhtml +17 -0
  28. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  29. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  30. data/lib/rdoc/generator/template/darkfish/_head.rhtml +2 -7
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  32. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +1 -1
  33. data/lib/rdoc/generator/template/json_index/js/searcher.js +5 -1
  34. data/lib/rdoc/generator.rb +1 -0
  35. data/lib/rdoc/markup/pre_process.rb +34 -10
  36. data/lib/rdoc/markup/to_html.rb +6 -4
  37. data/lib/rdoc/options.rb +21 -10
  38. data/lib/rdoc/parser/c.rb +15 -46
  39. data/lib/rdoc/parser/prism_ruby.rb +121 -113
  40. data/lib/rdoc/parser/ruby.rb +8 -8
  41. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  42. data/lib/rdoc/parser/simple.rb +4 -21
  43. data/lib/rdoc/rdoc.rb +1 -0
  44. data/lib/rdoc/text.rb +1 -1
  45. data/lib/rdoc/token_stream.rb +13 -1
  46. data/lib/rdoc/tom_doc.rb +1 -1
  47. data/lib/rdoc/version.rb +1 -1
  48. metadata +27 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed79e2cda1c5cd7113829e3fcfbbece5c1d5332e9046778c2581d28059afd9e7
4
- data.tar.gz: cc77a3249231ee94df7d06090d9a683e0c7f71f5924186e2f0dcae5b01ec5b74
3
+ metadata.gz: fa98c965593046c0c9af98c9eaf740890b115d1c0f3369d8d64dd59394392115
4
+ data.tar.gz: bb1f994cab604f974f60d5f6c4baba5de48cd88a2fa687c6aac9a3e503b3a4aa
5
5
  SHA512:
6
- metadata.gz: 43bd516f9ffb4f33e76c6186c8b0429525d4729172a25de895a2f1d69f7c523bdc8868c42dc55dc17863f6daa927a56d1aaefbb9edc5519a4885f2a5b60e0cbf
7
- data.tar.gz: 368780ba1a40869aa6a26e2a5734d13bb5ec25e4d47dcea78cb0de2c117bad7b8e964ea69b857aadc799f492f72d51a7d68a7259f357c2d23c9a13064c33ce3b
6
+ metadata.gz: 7aa9297f36a9bc40ee2b3296489b7706a08301a596aa73d7c68c937ea48b6e945307a702ebafae5e007b3908e9cae917d03f195aa75ef23f5b4ac509d24d6301
7
+ data.tar.gz: 36cd5ac61a955a73f2206461eb676aa0426c16beb102256cc553969fba4176e7e27b9449b4cf02709455fea4fb44f6f2c6a78e2a1b4db11892edac60938ac2ce
data/History.rdoc CHANGED
@@ -163,7 +163,7 @@
163
163
  * Moved old DEVELOPERS file to CONTRIBUTING to match github conventions.
164
164
  * TomDoc output now has a "Returns" heading. Issue #234 by Brian Henderson
165
165
  * Metaprogrammed methods can now use the :args: directive in addition to the
166
- :call-seq: directive. Issue #236 by Mike Moore.
166
+ \:call-seq: directive. Issue #236 by Mike Moore.
167
167
  * Sections can be linked to using "@" like labels. If a section and a label
168
168
  have the same name the section will be preferred. Issue #233 by Brian
169
169
  Henderson.
@@ -16,6 +16,16 @@ class RDoc::TopLevel < RDoc::Context
16
16
 
17
17
  attr_accessor :absolute_name
18
18
 
19
+ ##
20
+ # Base name of this file
21
+
22
+ attr_reader :base_name
23
+
24
+ ##
25
+ # Base name of this file without the extension
26
+
27
+ attr_reader :page_name
28
+
19
29
  ##
20
30
  # All the classes or modules that were declared in
21
31
  # this file. These are assigned to either +#classes_hash+
@@ -40,6 +50,14 @@ class RDoc::TopLevel < RDoc::Context
40
50
  @relative_name = relative_name
41
51
  @parser = nil
42
52
 
53
+ if relative_name
54
+ @base_name = File.basename(relative_name)
55
+ @page_name = @base_name.sub(/\.(rb|rdoc|txt|md)\z/i, '')
56
+ else
57
+ @base_name = nil
58
+ @page_name = nil
59
+ end
60
+
43
61
  @classes_or_modules = []
44
62
  end
45
63
 
@@ -105,13 +123,6 @@ class RDoc::TopLevel < RDoc::Context
105
123
  @classes_or_modules << mod
106
124
  end
107
125
 
108
- ##
109
- # Base name of this file
110
-
111
- def base_name
112
- File.basename @relative_name
113
- end
114
-
115
126
  alias name base_name
116
127
 
117
128
  ##
@@ -204,16 +215,6 @@ class RDoc::TopLevel < RDoc::Context
204
215
  end
205
216
  end
206
217
 
207
- ##
208
- # Base name of this file without the extension
209
-
210
- def page_name
211
- basename = File.basename @relative_name
212
- basename =~ /\.(rb|rdoc|txt|md)$/i
213
-
214
- $` || basename
215
- end
216
-
217
218
  ##
218
219
  # Path to this file for use with HTML generator output.
219
220
 
data/lib/rdoc/comment.rb CHANGED
@@ -162,6 +162,12 @@ class RDoc::Comment
162
162
  self
163
163
  end
164
164
 
165
+ # Change normalized, when creating already normalized comment.
166
+
167
+ def normalized=(value)
168
+ @normalized = value
169
+ end
170
+
165
171
  ##
166
172
  # Was this text normalized?
167
173
 
@@ -223,14 +229,190 @@ class RDoc::Comment
223
229
  @format == 'tomdoc'
224
230
  end
225
231
 
226
- ##
227
- # Create a new parsed comment from a document
232
+ MULTILINE_DIRECTIVES = %w[call-seq].freeze # :nodoc:
228
233
 
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
234
+ # There are more, but already handled by RDoc::Parser::C
235
+ COLON_LESS_DIRECTIVES = %w[call-seq Document-method].freeze # :nodoc:
236
+
237
+ DIRECTIVE_OR_ESCAPED_DIRECTIV_REGEXP = /\A(?<colon>\\?:|:?)(?<directive>[\w-]+):(?<param>.*)/
238
+
239
+ private_constant :MULTILINE_DIRECTIVES, :COLON_LESS_DIRECTIVES, :DIRECTIVE_OR_ESCAPED_DIRECTIV_REGEXP
240
+
241
+ class << self
242
+
243
+ ##
244
+ # Create a new parsed comment from a document
235
245
 
246
+ def from_document(document) # :nodoc:
247
+ comment = RDoc::Comment.new('')
248
+ comment.document = document
249
+ comment.location = RDoc::TopLevel.new(document.file) if document.file
250
+ comment
251
+ end
252
+
253
+ # Parse comment, collect directives as an attribute and return [normalized_comment_text, directives_hash]
254
+ # This method expands include and removes everything not needed in the document text, such as
255
+ # private section, directive line, comment characters `# /* * */` and indent spaces.
256
+ #
257
+ # RDoc comment consists of include, directive, multiline directive, private section and comment text.
258
+ #
259
+ # Include
260
+ # # :include: filename
261
+ #
262
+ # Directive
263
+ # # :directive-without-value:
264
+ # # :directive-with-value: value
265
+ #
266
+ # Multiline directive (only :call-seq:)
267
+ # # :multiline-directive:
268
+ # # value1
269
+ # # value2
270
+ #
271
+ # Private section
272
+ # #--
273
+ # # private comment
274
+ # #++
275
+
276
+ def parse(text, filename, line_no, type, &include_callback)
277
+ case type
278
+ when :ruby
279
+ text = text.gsub(/^#+/, '') if text.start_with?('#')
280
+ private_start_regexp = /^-{2,}$/
281
+ private_end_regexp = /^\+{2}$/
282
+ indent_regexp = /^\s*/
283
+ when :c
284
+ private_start_regexp = /^(\s*\*)?-{2,}$/
285
+ private_end_regexp = /^(\s*\*)?\+{2}$/
286
+ indent_regexp = /^\s*(\/\*+|\*)?\s*/
287
+ text = text.gsub(/\s*\*+\/\s*\z/, '')
288
+ when :simple
289
+ # Unlike other types, this implementation only looks for two dashes at
290
+ # the beginning of the line. Three or more dashes are considered to be
291
+ # a rule and ignored.
292
+ private_start_regexp = /^-{2}$/
293
+ private_end_regexp = /^\+{2}$/
294
+ indent_regexp = /^\s*/
295
+ end
296
+
297
+ directives = {}
298
+ lines = text.split("\n")
299
+ in_private = false
300
+ comment_lines = []
301
+ until lines.empty?
302
+ line = lines.shift
303
+ read_lines = 1
304
+ if in_private
305
+ # If `++` appears in a private section that starts with `--`, private section ends.
306
+ in_private = false if line.match?(private_end_regexp)
307
+ line_no += read_lines
308
+ next
309
+ elsif line.match?(private_start_regexp)
310
+ # If `--` appears in a line, private section starts.
311
+ in_private = true
312
+ line_no += read_lines
313
+ next
314
+ end
315
+
316
+ prefix = line[indent_regexp]
317
+ prefix_indent = ' ' * prefix.size
318
+ line = line.byteslice(prefix.bytesize..)
319
+
320
+ if (directive_match = DIRECTIVE_OR_ESCAPED_DIRECTIV_REGEXP.match(line))
321
+ colon = directive_match[:colon]
322
+ directive = directive_match[:directive]
323
+ raw_param = directive_match[:param]
324
+ param = raw_param.strip
325
+ else
326
+ colon = directive = raw_param = param = nil
327
+ end
328
+
329
+ if !directive
330
+ comment_lines << prefix_indent + line
331
+ elsif colon == '\\:'
332
+ # If directive is escaped, unescape it
333
+ comment_lines << prefix_indent + line.sub('\\:', ':')
334
+ elsif raw_param.start_with?(':') || (colon.empty? && !COLON_LESS_DIRECTIVES.include?(directive))
335
+ # Something like `:toto::` is not a directive
336
+ # Only few directives allows to start without a colon
337
+ comment_lines << prefix_indent + line
338
+ elsif directive == 'include'
339
+ filename_to_include = param
340
+ include_callback.call(filename_to_include, prefix_indent).lines.each { |l| comment_lines << l.chomp }
341
+ elsif MULTILINE_DIRECTIVES.include?(directive)
342
+ value_lines = take_multiline_directive_value_lines(directive, filename, line_no, lines, prefix_indent.size, indent_regexp, !param.empty?)
343
+ read_lines += value_lines.size
344
+ lines.shift(value_lines.size)
345
+ unless param.empty?
346
+ # Accept `:call-seq: first-line\n second-line` for now
347
+ value_lines.unshift(param)
348
+ end
349
+ value = value_lines.join("\n")
350
+ directives[directive] = [value.empty? ? nil : value, line_no]
351
+ else
352
+ directives[directive] = [param.empty? ? nil : param, line_no]
353
+ end
354
+ line_no += read_lines
355
+ end
356
+
357
+ normalized_comment = String.new(encoding: text.encoding) << normalize_comment_lines(comment_lines).join("\n")
358
+ [normalized_comment, directives]
359
+ end
360
+
361
+ # Remove preceding indent spaces and blank lines from the comment lines
362
+
363
+ private def normalize_comment_lines(lines)
364
+ blank_line_regexp = /\A\s*\z/
365
+ lines = lines.dup
366
+ lines.shift while lines.first&.match?(blank_line_regexp)
367
+ lines.pop while lines.last&.match?(blank_line_regexp)
368
+
369
+ min_spaces = lines.map do |l|
370
+ l.match(/\A *(?=\S)/)&.end(0)
371
+ end.compact.min
372
+ if min_spaces && min_spaces > 0
373
+ lines.map { |l| l[min_spaces..] || '' }
374
+ else
375
+ lines
376
+ end
377
+ end
378
+
379
+ # Take value lines of multiline directive
380
+
381
+ private def take_multiline_directive_value_lines(directive, filename, line_no, lines, base_indent_size, indent_regexp, has_param)
382
+ return [] if lines.empty?
383
+
384
+ first_indent_size = lines.first.match(indent_regexp).end(0)
385
+
386
+ # Blank line or unindented line is not part of multiline-directive value
387
+ return [] if first_indent_size <= base_indent_size
388
+
389
+ if has_param
390
+ # :multiline-directive: line1
391
+ # line2
392
+ # line3
393
+ #
394
+ value_lines = lines.take_while do |l|
395
+ l.rstrip.match(indent_regexp).end(0) > base_indent_size
396
+ end
397
+ min_indent = value_lines.map { |l| l.match(indent_regexp).end(0) }.min
398
+ value_lines.map { |l| l[min_indent..] }
399
+ else
400
+ # Take indented lines accepting blank lines between them
401
+ value_lines = lines.take_while do |l|
402
+ l = l.rstrip
403
+ indent = l[indent_regexp]
404
+ if indent == l || indent.size >= first_indent_size
405
+ true
406
+ end
407
+ end
408
+ value_lines.map! { |l| (l[first_indent_size..] || '').chomp }
409
+
410
+ if value_lines.size != lines.size && !value_lines.last.empty?
411
+ warn "#{filename}:#{line_no} Multiline directive :#{directive}: should end with a blank line."
412
+ end
413
+ value_lines.pop while value_lines.last&.empty?
414
+ value_lines
415
+ end
416
+ end
417
+ end
236
418
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Aliki theme for RDoc documentation
5
+ #
6
+ # Author: Stan Lo
7
+ #
8
+
9
+ class RDoc::Generator::Aliki < RDoc::Generator::Darkfish
10
+ RDoc::RDoc.add_generator self
11
+
12
+ def initialize(store, options)
13
+ super
14
+ aliki_template_dir = File.expand_path(File.join(__dir__, 'template', 'aliki'))
15
+ @template_dir = Pathname.new(aliki_template_dir)
16
+ end
17
+
18
+ ##
19
+ # Copy only the static assets required by the Aliki theme. Unlike Darkfish we
20
+ # don't ship embedded fonts or image sprites, so limit the asset list to keep
21
+ # generated documentation lightweight.
22
+
23
+ def write_style_sheet
24
+ debug_msg "Copying Aliki static files"
25
+ options = { verbose: $DEBUG_RDOC, noop: @dry_run }
26
+
27
+ install_rdoc_static_file @template_dir + 'css/rdoc.css', "./css/rdoc.css", options
28
+
29
+ unless @options.template_stylesheets.empty?
30
+ FileUtils.cp @options.template_stylesheets, '.', **options
31
+ end
32
+
33
+ Dir[(@template_dir + 'js/**/*').to_s].each do |path|
34
+ next if File.directory?(path)
35
+ next if File.basename(path).start_with?('.')
36
+
37
+ dst = Pathname.new(path).relative_path_from(@template_dir)
38
+
39
+ install_rdoc_static_file @template_dir + path, dst, options
40
+ end
41
+ end
42
+ end
@@ -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,91 @@
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 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
+
28
+ <%- if canonical_url = @options.canonical_root %>
29
+ <% canonical_url = current.canonical_url if defined?(current) %>
30
+ <link rel="canonical" href="<%= canonical_url %>">
31
+ <%- end %>
32
+
33
+ <!-- Open Graph / Facebook -->
34
+ <meta property="og:type" content="website">
35
+ <meta property="og:title" content="<%= h @title %>">
36
+ <%- if defined?(klass) %>
37
+ <%- if klass.comment.empty? %>
38
+ <meta property="og:description" content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples">
39
+ <%- else %>
40
+ <meta property="og:description" content="<%= h excerpt(klass.comment) %>">
41
+ <%- end %>
42
+ <%- elsif defined?(file) %>
43
+ <%- if file.comment.empty? %>
44
+ <meta property="og:description" content="<%= h file.page_name %> - <%= h @title %> documentation">
45
+ <%- else %>
46
+ <meta property="og:description" content="<%= h excerpt(file.comment) %>">
47
+ <%- end %>
48
+ <%- else %>
49
+ <meta property="og:description" content="API documentation for <%= h @title %> - Browse classes, modules, and methods">
50
+ <%- end %>
51
+ <%- if canonical_url = @options.canonical_root %>
52
+ <% canonical_url = current.canonical_url if defined?(current) %>
53
+ <meta property="og:url" content="<%= canonical_url %>">
54
+ <%- end %>
55
+
56
+ <!-- Twitter -->
57
+ <meta name="twitter:card" content="summary">
58
+ <meta name="twitter:title" content="<%= h @title %>">
59
+ <%- if defined?(klass) %>
60
+ <%- if klass.comment.empty? %>
61
+ <meta name="twitter:description" content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples">
62
+ <%- else %>
63
+ <meta name="twitter:description" content="<%= h excerpt(klass.comment) %>">
64
+ <%- end %>
65
+ <%- elsif defined?(file) %>
66
+ <%- if file.comment.empty? %>
67
+ <meta name="twitter:description" content="<%= h file.page_name %> - <%= h @title %> documentation">
68
+ <%- else %>
69
+ <meta name="twitter:description" content="<%= h excerpt(file.comment) %>">
70
+ <%- end %>
71
+ <%- else %>
72
+ <meta name="twitter:description" content="API documentation for <%= h @title %> - Browse classes, modules, and methods">
73
+ <%- end %>
74
+
75
+ <script type="text/javascript">
76
+ var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
77
+ var index_rel_prefix = "<%= h rel_prefix %>/";
78
+ </script>
79
+
80
+ <script src="<%= h asset_rel_prefix %>/js/theme-toggle.js"></script>
81
+ <script src="<%= h asset_rel_prefix %>/js/navigation.js" defer></script>
82
+ <script src="<%= h asset_rel_prefix %>/js/search.js" defer></script>
83
+ <script src="<%= h asset_rel_prefix %>/js/search_index.js" defer></script>
84
+ <script src="<%= h asset_rel_prefix %>/js/searcher.js" defer></script>
85
+ <script src="<%= h asset_rel_prefix %>/js/c_highlighter.js" defer></script>
86
+ <script src="<%= h asset_rel_prefix %>/js/aliki.js" defer></script>
87
+
88
+ <link href="<%= h asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
89
+ <%- @options.template_stylesheets.each do |stylesheet| %>
90
+ <link href="<%= h asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
91
+ <%- 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>
@@ -0,0 +1,6 @@
1
+ <%- if klass.type == 'class' && (ancestors = klass.super_classes).any? %>
2
+ <div id="parent-class-section" class="nav-section">
3
+ <h3>Ancestors</h3>
4
+ <%= generate_ancestor_list(ancestors, klass) %>
5
+ </div>
6
+ <%- end %>
@@ -0,0 +1,5 @@
1
+ <div id="classindex-section" class="nav-section">
2
+ <h3>Class and Module Index</h3>
3
+
4
+ <%= generate_class_index_content(@classes, rel_prefix) %>
5
+ </div>
@@ -0,0 +1,15 @@
1
+ <%- unless klass.extends.empty? then %>
2
+ <div id="extends-section" class="nav-section">
3
+ <h3>Extended With Modules</h3>
4
+
5
+ <ul class="link-list">
6
+ <%- klass.extends.each do |ext| %>
7
+ <%- unless String === ext.module then %>
8
+ <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a></li>
9
+ <%- else %>
10
+ <li><span class="extend"><%= ext.name %></span></li>
11
+ <%- end %>
12
+ <%- end %>
13
+ </ul>
14
+ </div>
15
+ <%- end %>
@@ -0,0 +1,15 @@
1
+ <%- unless klass.includes.empty? then %>
2
+ <div id="includes-section" class="nav-section">
3
+ <h3>Included Modules</h3>
4
+
5
+ <ul class="link-list">
6
+ <%- klass.includes.each do |inc| %>
7
+ <%- unless String === inc.module then %>
8
+ <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
9
+ <%- else %>
10
+ <li><span class="include"><%= inc.name %></span></li>
11
+ <%- end %>
12
+ <%- end %>
13
+ </ul>
14
+ </div>
15
+ <%- end %>
@@ -0,0 +1,16 @@
1
+ <div id="home-section" class="nav-section">
2
+ <h3>Documentation</h3>
3
+
4
+ <ul>
5
+ <%- installed.each do |name, href, exists, type, _| %>
6
+ <%- next if type == :extra %>
7
+ <li class="folder">
8
+ <%- if exists then %>
9
+ <a href="<%= href %>"><%= h name %></a>
10
+ <%- else %>
11
+ <%= h name %>
12
+ <%- end %>
13
+ </li>
14
+ <%- end %>
15
+ </ul>
16
+ </div>
@@ -0,0 +1,21 @@
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 %>
11
+
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 %>
@@ -0,0 +1,37 @@
1
+ <%- simple_files = @files.select { |f| f.text? } %>
2
+ <%- if defined?(current) && current.respond_to?(:page_name) %>
3
+ <%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name %>
4
+ <%- end %>
5
+ <%- unless simple_files.empty? then %>
6
+ <div id="fileindex-section" class="nav-section">
7
+ <h3>Pages</h3>
8
+
9
+ <ul class="link-list">
10
+ <%- grouped_files = simple_files.group_by { |f| f.full_name[%r{\A[^/]+(?=/)}] || f.page_name } %>
11
+ <%- grouped_files.each do |n, files| %>
12
+ <%- f = files.shift %>
13
+ <%- if files.empty? %>
14
+ <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a></li>
15
+ <%- next %>
16
+ <%- end %>
17
+ <li>
18
+ <details <%= dir == n ? ' open' : '' %>>
19
+ <summary>
20
+ <% if n == f.page_name %>
21
+ <a href="<%= rel_prefix %>/<%= h f.path %>"><%= h n %></a>
22
+ <% else %>
23
+ <%= h n %>
24
+ <% files.unshift(f) %>
25
+ <% end %>
26
+ </summary>
27
+ <ul class="link-list">
28
+ <%- files.each do |f| %>
29
+ <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a></li>
30
+ <%- end %>
31
+ </ul>
32
+ </details>
33
+ </li>
34
+ <%- end %>
35
+ </ul>
36
+ </div>
37
+ <%- end %>
@@ -0,0 +1,15 @@
1
+ <div id="search-section" role="search" class="project-section initially-hidden">
2
+ <form action="#" method="get" accept-charset="utf-8">
3
+ <div id="search-field-wrapper">
4
+ <input id="search-field" role="combobox" aria-label="Search"
5
+ aria-autocomplete="list" aria-controls="search-results"
6
+ type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
7
+ autocomplete="off"
8
+ title="Type to search, Up and Down to navigate, Enter to load">
9
+ </div>
10
+
11
+ <ul id="search-results" aria-label="Search Results"
12
+ aria-busy="false" aria-expanded="false"
13
+ aria-atomic="false" class="initially-hidden"></ul>
14
+ </form>
15
+ </div>