hanna-nouveau 1.0.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a9fdbf2235e5a770c5a3d2f119e7c824aede1f5a
4
- data.tar.gz: 0142d1446ac32c57a7317adf3459ec985b8e871f
2
+ SHA256:
3
+ metadata.gz: b034a18db202c97ad31b676e96922ad039ae319fba935e0f3d8d94fe4e20f453
4
+ data.tar.gz: 3249c6b9b4a593b4d1b57ed4314868bb2ed6004fd8bf106129dd5f004c5d3705
5
5
  SHA512:
6
- metadata.gz: 88f2aba92fb99a8702a07e408ade319ff1618b7297d7ee165af1a2dead65c35506294c3da238336e7542599469ed90870292f2ec43ff6ae8c7c98fb29c4588a9
7
- data.tar.gz: b78f3cdde8011b926025cee79934e974d150f468bbad0ac75ae986c4681c5194c5b5215b3f64e4ead53d438cc95718d7c647176e0ca8f718164f78dd44314189
6
+ metadata.gz: 813b0b2c4e7f467d8db20641fd1976eea53f52b0a9d138a3b5a3817af451b591d579cafac703fbde94abcb001a9a17265754b3b99734e4beae7b640f1cad2943
7
+ data.tar.gz: ecf57c820b6f19bae2b476796cbc5e1cb4de29fe8c38b3f08682ccf43decfafba0c833282624e020d8ee68a2d11e356a34ff1b0e402d31aa04edc4f580f365e2
data/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  Copyright (c) 2009 Mislav Marohnić
2
2
  Copyright (c) 2010, 2011 Erik Hollensbe
3
+ Copyright (c) 2011-2021 Jeremy Evans
3
4
 
4
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
5
6
  this software and associated documentation files (the "Software"), to deal in
data/README.rdoc CHANGED
@@ -1,12 +1,11 @@
1
- = Hanna Nouveau — a better RDoc template, now for RDoc 4.
1
+ = Hanna-nouveau
2
2
 
3
3
  Based on the original Hanna by Mislav.
4
4
 
5
- Hanna is an RDoc generator that scales. It's implemented in Haml, making the
6
- sources clean and readable. It's built with simplicity, beauty and ease of
7
- browsing in mind.
5
+ Hanna-nouveau is an RDoc generator built with simplicity, beauty
6
+ and ease of browsing in mind.
8
7
 
9
- Hanna gem is available from http://rubygems.org:
8
+ Hanna-nouveau is distributed as a ruby gem:
10
9
 
11
10
  gem install hanna-nouveau
12
11
 
@@ -24,7 +23,7 @@ has seen contributions from:
24
23
 
25
24
  == Usage
26
25
 
27
- rdoc -o doc -f hanna lib/*.rb
26
+ rdoc -o doc -f hanna lib
28
27
 
29
28
  An alternative is to set the `RDOCOPT` environment variable:
30
29
 
@@ -56,10 +55,7 @@ add the hanna format argument to your RDoc::Task options:
56
55
  gem 'rdoc'
57
56
  require 'rdoc/task'
58
57
  RDoc::Task.new do |rdoc|
59
- # this only works with RDoc 3.1 or greater
60
58
  rdoc.generator = 'hanna'
61
- # this is what you use pre RDoc 3.1:
62
- rdoc.options.push '-f', 'hanna'
63
59
  end
64
60
 
65
61
  Tip: you can do this in the Rakefile of your Rails project before running
data/Rakefile CHANGED
@@ -6,7 +6,8 @@ RDoc::Task.new do |rdoc|
6
6
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
7
7
 
8
8
  rdoc.rdoc_dir = 'rdoc'
9
+ rdoc.generator = 'hanna'
9
10
  rdoc.title = "hanna-nouveau #{version}"
10
- rdoc.options = ['-f', 'hanna']
11
- rdoc.rdoc_files.add %w"README.rdoc LICENSE lib/hanna-nouveau.rb"
11
+ rdoc.options = ['--main', 'README.rdoc', '--title', 'Hanna-nouveau: RDoc generator designed with simplicity, beauty and ease of browsing in mind']
12
+ rdoc.rdoc_files.add %w"README.rdoc LICENSE lib"
12
13
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.2.0
@@ -0,0 +1,4 @@
1
+ <h1><%=h values[:list_title] %></h1>
2
+ <ol class='classes' id='index-entries'>
3
+ <%= render_class_tree(values[:classes].select{|x| x.full_name !~ /::/}) %>
4
+ </ol>
@@ -0,0 +1,9 @@
1
+ <h1>File Index</h1><% any_hidden = false %>
2
+ <ol class='files' id='index-entries'>
3
+ <% values[:files].each do |file|
4
+ hide = file.name =~ /\.rb$/
5
+ any_hidden = true if hide %><li<%= " class='other'" if hide %>><%= link_to(file.name, file.path) %></li>
6
+ <% end %><% if any_hidden %><li>
7
+ <a class='show' href='#' onclick='this.parentNode.parentNode.className += &quot; expanded&quot;; this.parentNode.removeChild(this); return false'>show all</a>
8
+ </li><% end %>
9
+ </ol>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title><%=h @options.title %></title>
5
+ <meta content='text/html; charset=<%=h @options.charset %>' http-equiv='Content-Type'>
6
+ </head>
7
+ <frameset border='1' bordercolor='gray' cols='20%, *' frameborder='1'>
8
+ <frameset rows='15%, 35%, 50%'>
9
+ <frame name='Files' src='fr_file_index.html' title='Files'>
10
+ <frame name='Classes' src='fr_class_index.html'>
11
+ <frame name='Methods' src='fr_method_index.html'>
12
+ </frameset>
13
+ <frame name='docwin' src='<%=h @main_page_uri %>'></frame>
14
+ </frameset>
15
+ </html>
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><% values = values[:values]; index = values[:list_title] %>
2
+ <html lang='en'>
3
+ <head>
4
+ <title><%= h(values[:title]) if values[:title] %></title>
5
+ <meta content='text/html; charset=<%=h @options.charset %>' http-equiv='Content-Type'>
6
+ <link href='<%=h values[:stylesheet] %>' media='screen' rel='stylesheet' type='text/css'>
7
+ <% if index %><base target='docwin'>
8
+ <% else %><script type='text/javascript'>
9
+ function popupCode(url) {
10
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
+ }
12
+
13
+ function toggleCode(id) {
14
+ var code = document.getElementById(id)
15
+
16
+ code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
+ return true
18
+ }
19
+
20
+ // Make codeblocks hidden by default
21
+ document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
+ </script>
23
+ <% end %></head>
24
+ <body class='<%= index ? 'list' : 'page' %>'>
25
+ <% if index %><div id='index'><%= yield %></div>
26
+ <% else %><div class='<%= values[:classmod] ? 'class' : 'file' %>' id='wrapper'>
27
+ <%= yield %>
28
+ <div id='footer-push'></div>
29
+ </div>
30
+ <div id='footer'>
31
+ <a href="https://github.com/jeremyevans/hanna-nouveau"><strong>Hanna Nouveau</strong> RDoc template</a>
32
+ </div>
33
+ <% end %></body>
34
+ </html>
@@ -0,0 +1,11 @@
1
+ <h1><%=h values[:list_title] %></h1>
2
+ <form id='search_form'>
3
+ <input autocomplete='off' class='untouched' id='search' placeholder='Enter search terms...' type='text'>
4
+ <span class='clear_button' id='clear_button'>
5
+ x
6
+ </span>
7
+ </form>
8
+ <ol class='methods' id='index-entries'>
9
+ <% (values[:attributes] + values[:methods]).uniq.each do |entry| %><li><%= link_to_method(entry, [classfile(entry.parent), entry.aref].join('#')) %></li>
10
+ <% end %></ol>
11
+ <script src='method_search.js' type='text/javascript'></script>
@@ -0,0 +1,58 @@
1
+ <%
2
+ values = values[:values] if values[:values]
3
+ entry = values[:entry]
4
+ sections = values[:sections].keys if values.has_key?(:sections)
5
+ methods = entry.method_list + entry.attributes
6
+ unless methods.empty? %><div id='method-list'>
7
+ <h2>Methods</h2>
8
+ <% %w[attr attr_accessor attr_reader attr_writer class instance].each do |type|
9
+ (RDoc::VISIBILITIES rescue RDoc::Context::VISIBILITIES).each do |vis|
10
+ list = methods.reject { |x| x.respond_to?(:is_alias_for) && x.is_alias_for }.select { |x| x.visibility == vis && x.type == type.to_s }.sort
11
+ next if list.empty?
12
+ type_result = ""
13
+ if type =~ /^attr_/
14
+ type_result += type.sub(/^attr_/, '').capitalize
15
+ else
16
+ type_result += type.capitalize
17
+ end
18
+ type_result = "#{vis.to_s.capitalize} #{type_result}"
19
+ %><h3><%=h type_result %></h3>
20
+ <ol>
21
+ <%
22
+ list.each do |method|
23
+ if method.respond_to?(:aref)
24
+ if method.name.to_s.empty? && method.call_seq %><li><%= link_to(method.call_seq.gsub(/<br\s*\/?>/, "").split(/[\r\n]+/).map{ |s| s.split(/([({]+|\[\{|\s+(#?=>|&rarr;)\s+)/).first.sub(/^[A-Za-z0-9_:]+\./, "").sub(/\s+=\s+.*/, "=").strip }.uniq.join("<br />\n"), '#' + method.aref) %></li>
25
+ <% else %><li><%= link_to(method.name, '#' + method.aref) %></li>
26
+ <% end
27
+ elsif method.respond_to?(:html_name) %><li><%= link_to(method.name, "#method-#{method.html_name}") %></li>
28
+ <% else %><li><%=h method.name %></li>
29
+ <% end
30
+ end %></ol>
31
+ <% end
32
+ end %></div>
33
+ <%
34
+ end
35
+ if entry.requires or sections or entry.includes %><div id='context'>
36
+ <% unless entry.requires.empty? %><div id='requires'>
37
+ <h2>Required files</h2>
38
+ <ol>
39
+ <% entry.requires.each do |req| %><li><%=h req.name %></li>
40
+ <% end %></ol>
41
+ </div>
42
+ <% end
43
+ if sections && (sections.length > 1 || sections.first.title.to_s != '')
44
+ %><div id='contents'>
45
+ <h2>Contents</h2>
46
+ <ol>
47
+ <% sections.sort_by{|s| s.title.to_s}.each do |section| %><li><%= link_to(section.title, "##{section.aref}") %></li>
48
+ <% end %></ol>
49
+ </div>
50
+ <% end
51
+ unless entry.includes.empty?
52
+ %><div id='includes'>
53
+ <h2>Included modules</h2>
54
+ <ol>
55
+ <% entry.includes.each do |inc| %><li><%= (mod = inc.module).is_a?(String) ? h(inc.name) : link_to(inc.name, entry.aref_to(mod.path)) %></li>
56
+ <% end %></ol>
57
+ </div>
58
+ <% end %></div><% end %>
@@ -1,63 +1,45 @@
1
- $(document).observe('dom:loaded', function() {
2
- // Setup search-during-typing.
3
- new Form.Element.Observer('search', 0.3, function(element, value) {
4
- performSearch();
5
- });
6
-
7
- // Remove the default search box value when the user puts the focus on
8
- // the search box for the first time.
9
- var search_box = $('search');
10
- if ($F('search') == 'Enter search terms...') {
11
- search_box.observe('focus', function() {
12
- if (search_box.hasClassName('untouched')) {
13
- search_box.removeClassName('untouched');
14
- search_box.value = '';
15
- }
16
- });
17
- } else {
18
- search_box.removeClassName('untouched');
19
- }
20
-
21
- search_box.insert({
22
- after: new Element('span', { 'class': 'clear_button' }).update('x').observe('click', function(e) {
23
- e.stopPropagation()
24
- search_box.setValue('')
25
- search_box.focus()
26
- })
27
- })
28
- });
29
-
30
- function searchInIndex(query) {
31
- var i;
32
- var results = [];
33
- query = query.toLowerCase();
34
- for (i = 0; i < search_index.length; i++) {
35
- if (search_index[i].method.indexOf(query) != -1) {
36
- results.push(search_index[i]);
37
- }
38
- }
39
- return results;
40
- }
1
+ var search_box = document.getElementById('search');
2
+ var search_timeout;
3
+ var search_value = search_box.value;
41
4
 
42
- function buildHtmlForResults(results) {
43
- var html = "";
44
- var i;
45
- for (i = 0; i < results.length; i++) {
46
- html += '<li>' + results[i].html + '</li>';
47
- }
48
- return html;
49
- }
5
+ function performSearch(e) {
6
+ if (e) {
7
+ e.preventDefault();
8
+ }
9
+ if (search.value === search_value) {
10
+ return;
11
+ }
12
+ search_value = search_box.value;
50
13
 
51
- function performSearch() {
52
- var query = $F('search');
53
- if (query == '') {
54
- $('index-entries').show();
55
- $('search-results').hide();
14
+ if (search_value == '') {
15
+ document.querySelectorAll("#index-entries li.hide").forEach(elem => {
16
+ elem.classList.remove('hide');
17
+ });
56
18
  } else {
57
- var results = searchInIndex(query);
58
- $('search-results').update(buildHtmlForResults(results));
59
- $('index-entries').hide();
60
- $('search-results').show();
61
- }
62
- return false;
19
+ document.querySelectorAll("#index-entries span.method_name").forEach(elem => {
20
+ var value = elem.getAttribute('value');
21
+ var li_classes = elem.parentElement.parentElement.classList;
22
+ if (value && value.includes(search_value)) {
23
+ li_classes.remove('hide');
24
+ } else {
25
+ li_classes.add('hide');
26
+ }
27
+ });
28
+ }
63
29
  }
30
+
31
+ document.getElementById('search_form').onsubmit = performSearch;
32
+
33
+ search.oninput = function(e) {
34
+ if (search_timeout) {
35
+ clearTimeout(search_timeout);
36
+ }
37
+ search_timeout = setTimeout(performSearch, 300);
38
+ };
39
+
40
+ document.getElementById('clear_button').onclick = function(e) {
41
+ e.stopPropagation();
42
+ search_box.value = '';
43
+ performSearch();
44
+ search_box.focus();
45
+ };
@@ -0,0 +1,48 @@
1
+ <%
2
+ values = values[:values] if values[:values]
3
+ file_page = !values[:classmod]
4
+ title_in_description = values[:entry].description && values[:entry].description =~ /^\s*<h1>/m
5
+ %><div class='header'>
6
+ <%
7
+ title = if file_page
8
+ h(values[:file].name)
9
+ else
10
+ "<span class='type'>#{values[:classmod]}</span>\n#{h values[:entry].full_name}"
11
+ end
12
+
13
+ if title_in_description %><div class='name'><%= title %></div>
14
+ <% else %><h1 class='name'><%= title %>
15
+ </h1>
16
+ <% end
17
+
18
+ if file_page %><div class='paths'>
19
+ <%=h values[:file].relative_name %>
20
+ </div>
21
+ <% else %><ol class='paths'>
22
+ <% values[:entry].in_files.each_with_index do |file, index| %><li<%= " class='other'" if index > 0 %>>
23
+ <%= link_to(file.full_name, Pathname.new(file.path).relative_path_from(Pathname.new(values[:entry].path).dirname)) %>
24
+ </li>
25
+ <% end
26
+ if values[:entry].in_files.size > 1 %><li>
27
+ <a class='show' href='#' onclick='this.parentNode.parentNode.className += &quot; expanded&quot;; this.parentNode.removeChild(this); return false'>show all</a>
28
+ </li>
29
+ <% end %></ol>
30
+ <% end
31
+
32
+ if !file_page && values[:entry].type == "class" %><div class='parent'>
33
+ Superclass:
34
+ <strong><%= (values[:entry].superclass.kind_of?(String) || !values[:entry].superclass) ? h(values[:entry].superclass) : link_to(values[:entry].superclass.name, Pathname.new(class_dir) + Pathname.new(values[:entry].superclass.path).relative_path_from(Pathname.new values[:entry].path)) %></strong>
35
+ </div>
36
+ <% end
37
+
38
+ if values[:entry].respond_to?(:last_modified) and values[:entry].last_modified %><div class='last-update'>
39
+ Last Update:
40
+ <span class='datetime'><%=h values[:entry].last_modified %></span>
41
+ </div>
42
+ <% end %></div>
43
+ <div id='content'>
44
+ <div id='text'>
45
+ <% if values[:description] %><div id='description'><%= sanitize_code_blocks(frame_link(values[:description])) %></div>
46
+ <% end %><%= frame_link(block.call) %>
47
+ </div>
48
+ </div>
@@ -0,0 +1,92 @@
1
+ <%
2
+ values = values[:values] if values[:values]
3
+ unless values[:entry].classes_and_modules.empty? %><div id='class-list'>
4
+ <h2>Classes and Modules</h2>
5
+ <ol>
6
+ <% (values[:entry].modules.sort + values[:entry].classes.sort).each do |mod| %><li><%= link_to(mod.full_name, values[:entry].aref_to(mod.path)) %></li>
7
+ <% end %></ol>
8
+ </div>
9
+ <% end
10
+
11
+ values[:sections].sort_by{|s, h| s.title.to_s}.each do |section, h|
12
+ constants, attributes, alias_types, method_types = h.values_at(:constants, :attributes, :alias_types, :method_types)
13
+ %><div id='section'>
14
+ <% if section.title.to_s != '' %><h2>
15
+ <a name='<%=h section.aref %>'><%=h section.title %></a>
16
+ <% if section.comment %><div class='section-comment'><%= section.description %></div>
17
+ <% end %></h2>
18
+ <% end
19
+ unless constants.empty? %><div id='constants-list'>
20
+ <h2>Constants</h2>
21
+ <div class='name-list'>
22
+ <table summary='Constants'>
23
+ <% constants.each do |const| %><tr class='top-aligned-row context-row'>
24
+ <td class='context-item-name'><%= const.name %></td>
25
+ <td>=</td>
26
+ <td class='context-item-value'><%= const.value %></td>
27
+ <% if const.description %><td>&nbsp;</td>
28
+ <td class='context-item-desc'><%= const.description %></td>
29
+ <% end %></tr>
30
+ <% end %></table>
31
+ </div>
32
+ </div>
33
+ <% end
34
+ unless alias_types.empty?
35
+ alias_types.each do |type, aliases|
36
+ %><div id='aliases-list'>
37
+ <h2><%= type %> Aliases</h2>
38
+ <div class='name-list'>
39
+ <table summary='<%= type %> Aliases'>
40
+ <% aliases.each do |alia| %><tr class='top-aligned-row context-row'>
41
+ <td class='context-item-name'><%= alia.name %></td>
42
+ <td>-&gt;</td>
43
+ <td class='context-item-value'><%= link_to(alia.is_alias_for.name, "##{alia.is_alias_for.aref}") %></td>
44
+ <% unless alia.description.empty? %><td class='context-item-desc'><%= alia.description %></td>
45
+ <% end %></tr>
46
+ <% end %></table>
47
+ </div>
48
+ </div>
49
+ <% end
50
+ end
51
+ unless attributes.empty? %><div id='attribute-list'>
52
+ <h2 class='section-bar'>Attributes</h2>
53
+ <div class='name-list'>
54
+ <table>
55
+ <% attributes.each do |attrib| %><tr class='top-aligned-row context-row'>
56
+ <td class='context-item-name'>
57
+ <a name='<%=h attrib.aref %>'><%= attrib.name %></a>
58
+ </td>
59
+ <td class='context-item-value'><%= attrib.rw ? "[#{attrib.rw}]" : '&nbsp;' %></td>
60
+ <td class='context-item-desc'><%= sanitize_code_blocks(attrib.description) %></td>
61
+ </tr>
62
+ <% end %></table>
63
+ </div>
64
+ </div>
65
+ <% end
66
+ unless method_types.empty? %><div id='methods'>
67
+ <% method_types.each do |type, list| next if list.empty? %><h2><%= type %> methods</h2>
68
+ <% list.each do |method| %><div class='method <%= "#{type.gsub(/\s+/, '-')}".downcase %>' id='method-<%= method.aref %>'>
69
+ <a name='<%= method.aref %>'></a>
70
+ <div class='synopsis'>
71
+ <% if method.call_seq %><span class='name'>
72
+ <% method.call_seq.split(/\r?\n/).each do |seq| %><div><%= seq %></div>
73
+ </span>
74
+ <% end
75
+ else %><span class='name'><%= method.name %></span><span class='arguments'><%= method.params %></span>
76
+
77
+ <% end %></div>
78
+ <% if method.description %><div class='description'>
79
+ <%= sanitize_code_blocks(method.description) %>
80
+ </div>
81
+ <% end
82
+ if method.markup_code
83
+ name = "#{method.aref}-source" %><div class='source'>
84
+ <a class='source-toggle' href='#' onclick='toggleCode(&#39;<%= name %>&#39;); return false'>
85
+ [show source]
86
+ </a>
87
+ <pre id='<%= name %>'><%= method.markup_code %></pre>
88
+ </div>
89
+ <% end %></div>
90
+ <% end
91
+ end %></div>
92
+ <% end %></div><% end %>