hanna-nouveau 1.2.0 → 1.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG +105 -0
- data/LICENSE +1 -1
- data/README.rdoc +21 -44
- data/lib/hanna-nouveau/template_files/class_index.erb +2 -2
- data/lib/hanna-nouveau/template_files/page.erb +1 -1
- data/lib/hanna-nouveau/template_files/sections.erb +2 -2
- data/lib/hanna-nouveau/template_files/styles.css +6 -0
- data/lib/hanna-nouveau.rb +64 -116
- metadata +34 -6
- data/Rakefile +0 -13
- data/VERSION +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 618aada01805b659609dcabd6e8c099dd467bdfa0d246061ea805f95b56f709b
|
|
4
|
+
data.tar.gz: bc0abba0135a0abb07f3066ec7516b0766443956769bb5737ab9f4a48a639e58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c5a7ce4269b1f81e05f6f2586a99967c75aaecb8f0904c37a873216542674aab5f6f30d1aef0be46a5e75921cd27757074eea42b5dab86eb737ab0657281fbd
|
|
7
|
+
data.tar.gz: bedd7d8efa55a9f60c5a0ab2935a14071ba93cb03457245a782eef618d87c6d485f30a9f5af06390188e66034f65ca8a0b866c09847b95cdc386caa93960396d
|
data/CHANGELOG
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# 1.3.0 (2022-06-27)
|
|
2
|
+
|
|
3
|
+
* Use details/summary for class index (jeremyevans)
|
|
4
|
+
|
|
5
|
+
* Optimize render_class_tree, and avoid creation of O(n^2) regexps (jeremyevans)
|
|
6
|
+
|
|
7
|
+
* Use target="_top" for https links as well as http links (jeremyevans)
|
|
8
|
+
|
|
9
|
+
# 1.2.0 (2021-12-23)
|
|
10
|
+
|
|
11
|
+
* Remove dependency on haml, by switching to stdlib erb (jeremyevans)
|
|
12
|
+
|
|
13
|
+
* Remove use of prototype.js for the method index, switching to plain javascript (jeremyevans)
|
|
14
|
+
|
|
15
|
+
# 1.1.0 (2021-12-15)
|
|
16
|
+
|
|
17
|
+
* Remove dependency on sass, by converting the stylesheet to CSS (jeremyevans)
|
|
18
|
+
|
|
19
|
+
* Avoid Ruby verbose mode warnings (jeremyevans)
|
|
20
|
+
|
|
21
|
+
# 1.0.4 (2020-06-24)
|
|
22
|
+
|
|
23
|
+
* Avoid whitespace between method name and argument list (jeremyevans)
|
|
24
|
+
|
|
25
|
+
# 1.0.3 (2018-02-15)
|
|
26
|
+
|
|
27
|
+
* Avoid using deprecated sass color operators (jeremyevans)
|
|
28
|
+
|
|
29
|
+
# 1.0.2 (2017-07-01)
|
|
30
|
+
|
|
31
|
+
* Handle documenting BasicObject (jeremyevans)
|
|
32
|
+
|
|
33
|
+
# 1.0.1 (2016-10-12)
|
|
34
|
+
|
|
35
|
+
* Remove unneeded and harmful target="docwin" from links (jeremyevans)
|
|
36
|
+
|
|
37
|
+
# 1.0.0 (2016-09-21)
|
|
38
|
+
|
|
39
|
+
* Support haml 4+ and rdoc 5+ (jeremyevans)
|
|
40
|
+
|
|
41
|
+
* Remove no longer needed override of parseable? in rdoc (jeremyevans)
|
|
42
|
+
|
|
43
|
+
# 0.4.2 (2014-11-26)
|
|
44
|
+
|
|
45
|
+
* Use ruby's built-in syntax parser instead of parser gem to check for valid syntax (jeremyevans)
|
|
46
|
+
|
|
47
|
+
# 0.4.1 (2014-08-29)
|
|
48
|
+
|
|
49
|
+
* Update syntax highlighting color for comments and strings (jeremyevans)
|
|
50
|
+
|
|
51
|
+
# 0.4.0 (2014-08-19)
|
|
52
|
+
|
|
53
|
+
* Add parser as a dependency for checking for valid Ruby syntax (jeremyevans)
|
|
54
|
+
|
|
55
|
+
* Use table instead of dl for better styling of label/note lists (jeremyevans)
|
|
56
|
+
|
|
57
|
+
* Syntax highlight ruby code blocks, not just method source (jeremyevans)
|
|
58
|
+
|
|
59
|
+
# 0.3.0 (2014-06-18)
|
|
60
|
+
|
|
61
|
+
* Show superclass instead of parent for classes (Quintus, jeremyevans)
|
|
62
|
+
|
|
63
|
+
* Add support for RDoc 4 (Atsushi Nagase, jeremyevans)
|
|
64
|
+
|
|
65
|
+
# 0.2.7 (2013-03-23)
|
|
66
|
+
|
|
67
|
+
* Remove duplicate entries from method index (jeremyevans)
|
|
68
|
+
|
|
69
|
+
* Fix attribute links (jeremyevans)
|
|
70
|
+
|
|
71
|
+
# 0.2.6 (2013-03-01)
|
|
72
|
+
|
|
73
|
+
* Fix homepage in gem (erikh)
|
|
74
|
+
|
|
75
|
+
# 0.2.5 (2013-03-01)
|
|
76
|
+
|
|
77
|
+
* Restrict rdoc version in gem to ~> 3.1, since the gem doesn't work with RDoc 4 (jeremyevans)
|
|
78
|
+
|
|
79
|
+
# 0.2.4 (2011-07-24)
|
|
80
|
+
|
|
81
|
+
* Respect markup in section comments (jeremyevans)
|
|
82
|
+
|
|
83
|
+
* Fix class/singleton attribute anchors (jeremyevans)
|
|
84
|
+
|
|
85
|
+
* Work with RDoc 3.8+ (jeremyevans)
|
|
86
|
+
|
|
87
|
+
* Support RDoc sections (jeremyevans)
|
|
88
|
+
|
|
89
|
+
* Automatically link classes, modules, included modules, and attributes (jeremyevans)
|
|
90
|
+
|
|
91
|
+
# 0.2.3 (2011-05-12)
|
|
92
|
+
|
|
93
|
+
* Sort method, aliases, and attribute lists (jeremyevans)
|
|
94
|
+
|
|
95
|
+
# 0.2.2 (2010-12-28)
|
|
96
|
+
|
|
97
|
+
* Work with RDoc 3.1+ (erikh)
|
|
98
|
+
|
|
99
|
+
# 0.2.1 (2010-12-23)
|
|
100
|
+
|
|
101
|
+
* Rename internal files to hanna-nouveau (erikh)
|
|
102
|
+
|
|
103
|
+
# 0.2.0 (2010-12-23)
|
|
104
|
+
|
|
105
|
+
* Initial release
|
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Copyright (c) 2009 Mislav Marohnić
|
|
2
2
|
Copyright (c) 2010, 2011 Erik Hollensbe
|
|
3
|
-
Copyright (c) 2011-
|
|
3
|
+
Copyright (c) 2011-2022 Jeremy Evans
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.rdoc
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
= Hanna-nouveau
|
|
2
2
|
|
|
3
|
-
Based on the original Hanna by Mislav.
|
|
4
|
-
|
|
5
3
|
Hanna-nouveau is an RDoc generator built with simplicity, beauty
|
|
6
4
|
and ease of browsing in mind.
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
== Installation
|
|
9
7
|
|
|
10
8
|
gem install hanna-nouveau
|
|
11
9
|
|
|
12
|
-
The template was created by {Mislav}[http://mislav.uniqpath.com/] and since then
|
|
13
|
-
has seen contributions from:
|
|
14
|
-
|
|
15
|
-
1. {Tony Strauss}[http://github.com/DesigningPatterns], who participated from
|
|
16
|
-
the early start and made tons of fixes and enhancements to the template;
|
|
17
|
-
2. {Hongli Lai}[http://blog.phusion.nl/] with the search filter for methods.
|
|
18
|
-
3. {Erik Hollensbe}[http://github.com/erikh] a serious refactoring and up to
|
|
19
|
-
date with RDoc 2.5.x and 3.x, now named 'hanna-nouveau'.
|
|
20
|
-
4. {James Tucker}[http://github.com/raggi] minor cleanups for Erik.
|
|
21
|
-
5. {Jeremy Evans}[http://github.com/jeremyevans] RDoc 4 support, maintenance
|
|
22
|
-
since 2014.
|
|
23
|
-
|
|
24
10
|
== Usage
|
|
25
11
|
|
|
26
12
|
rdoc -o doc -f hanna lib
|
|
@@ -33,48 +19,24 @@ This will make RDoc always use hanna-nouveau unless it is explicitly overridden.
|
|
|
33
19
|
|
|
34
20
|
== Integrating with RubyGems
|
|
35
21
|
|
|
36
|
-
|
|
22
|
+
If you put the following line in your .gemrc, this will make
|
|
37
23
|
RubyGems use Hanna for all rdoc generation:
|
|
38
24
|
|
|
39
25
|
rdoc: -f hanna
|
|
40
26
|
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
After doing this, if you wish to have documentation for all your installed gems
|
|
28
|
+
to be formatted in hanna:
|
|
43
29
|
|
|
44
30
|
gem rdoc --all --overwrite
|
|
45
31
|
|
|
46
|
-
The first time. To easily browse your newly created documentation, use:
|
|
47
|
-
|
|
48
|
-
gem server
|
|
49
|
-
|
|
50
32
|
== Rake task
|
|
51
33
|
|
|
52
|
-
For repeated generation of API docs,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
gem 'rdoc'
|
|
56
|
-
require 'rdoc/task'
|
|
57
|
-
RDoc::Task.new do |rdoc|
|
|
58
|
-
rdoc.generator = 'hanna'
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
Tip: you can do this in the Rakefile of your Rails project before running
|
|
62
|
-
`rake doc:rails`.
|
|
34
|
+
For repeated generation of API docs, you can set up a Rake task. Set
|
|
35
|
+
hanna as the RDoc generator:
|
|
63
36
|
|
|
64
|
-
Here is an example of a task for the {rdbi
|
|
65
|
-
library}[http://github.com/rdbi/rdbi/tree/master/Rakefile]:
|
|
66
|
-
|
|
67
|
-
gem 'rdoc'
|
|
68
37
|
require 'rdoc/task'
|
|
69
38
|
RDoc::Task.new do |rdoc|
|
|
70
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
71
|
-
|
|
72
39
|
rdoc.generator = 'hanna'
|
|
73
|
-
rdoc.main = 'README.rdoc'
|
|
74
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
75
|
-
rdoc.title = "RDBI #{version} Documentation"
|
|
76
|
-
rdoc.rdoc_files.include('README*')
|
|
77
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
78
40
|
end
|
|
79
41
|
|
|
80
42
|
== Modification to RDoc
|
|
@@ -84,3 +46,18 @@ friendly documentation. It changes label lists to use a table
|
|
|
84
46
|
instead of a description list, since it is very difficult to
|
|
85
47
|
get visually appealing styling for description lists without
|
|
86
48
|
cutting corners (like using fixed widths).
|
|
49
|
+
|
|
50
|
+
== Contributors
|
|
51
|
+
|
|
52
|
+
The Hanna template was created by {Mislav}[http://mislav.uniqpath.com/] and
|
|
53
|
+
since then has seen contributions from:
|
|
54
|
+
|
|
55
|
+
1. {Tony Strauss}[https://github.com/DesigningPatterns], who participated from
|
|
56
|
+
the early start and made tons of fixes and enhancements to the template.
|
|
57
|
+
2. {Michael Granger}[https://github.com/ged] who maintained the original RDoc template.
|
|
58
|
+
3. {Hongli Lai}[https://blog.phusion.nl/] with the search filter for methods.
|
|
59
|
+
4. {Erik Hollensbe}[https://github.com/erikh] a serious refactoring and up to
|
|
60
|
+
date with RDoc 2.5.x and 3.x, now named 'hanna-nouveau'.
|
|
61
|
+
5. {James Tucker}[https://github.com/raggi] minor cleanups and RubyGems integration
|
|
62
|
+
6. {Jeremy Evans}[https://github.com/jeremyevans] RDoc 4+ support, switch from
|
|
63
|
+
haml/sass to erb, maintenance since 2014.
|
|
@@ -42,7 +42,7 @@ Last Update:
|
|
|
42
42
|
<% end %></div>
|
|
43
43
|
<div id='content'>
|
|
44
44
|
<div id='text'>
|
|
45
|
-
<% if values[:description] %><div id='description'><%=
|
|
45
|
+
<% if values[:description] %><div id='description'><%= frame_link(values[:description]) %></div>
|
|
46
46
|
<% end %><%= frame_link(block.call) %>
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
@@ -57,7 +57,7 @@ values[:sections].sort_by{|s, h| s.title.to_s}.each do |section, h|
|
|
|
57
57
|
<a name='<%=h attrib.aref %>'><%= attrib.name %></a>
|
|
58
58
|
</td>
|
|
59
59
|
<td class='context-item-value'><%= attrib.rw ? "[#{attrib.rw}]" : ' ' %></td>
|
|
60
|
-
<td class='context-item-desc'><%=
|
|
60
|
+
<td class='context-item-desc'><%= attrib.description %></td>
|
|
61
61
|
</tr>
|
|
62
62
|
<% end %></table>
|
|
63
63
|
</div>
|
|
@@ -76,7 +76,7 @@ values[:sections].sort_by{|s, h| s.title.to_s}.each do |section, h|
|
|
|
76
76
|
|
|
77
77
|
<% end %></div>
|
|
78
78
|
<% if method.description %><div class='description'>
|
|
79
|
-
<%=
|
|
79
|
+
<%= method.description %>
|
|
80
80
|
</div>
|
|
81
81
|
<% end
|
|
82
82
|
if method.markup_code
|
|
@@ -153,6 +153,12 @@ table {
|
|
|
153
153
|
#index #index-entries.methods li a:hover .module_name, #index #search-results.methods li a:hover .module_name {
|
|
154
154
|
color: #dddddd; }
|
|
155
155
|
|
|
156
|
+
#index div#index-entries.classes details > summary { list-style: none; white-space: nowrap; }
|
|
157
|
+
#index div#index-entries.classes details > summary::marker { content: none; }
|
|
158
|
+
#index div#index-entries.classes details > summary:after { content: " \25B6"; }
|
|
159
|
+
#index div#index-entries.classes details[open] > summary:after { content: " \25BC"; }
|
|
160
|
+
#index div#index-entries.classes span.class-link { display: block; white-space: nowrap; }
|
|
161
|
+
|
|
156
162
|
#attribute-list .context-item-name {
|
|
157
163
|
font-weight: bold; }
|
|
158
164
|
|
data/lib/hanna-nouveau.rb
CHANGED
|
@@ -1,50 +1,15 @@
|
|
|
1
|
+
# frozen-string-literal: true
|
|
2
|
+
|
|
1
3
|
# = A better RDoc HTML template
|
|
2
|
-
#
|
|
3
|
-
# Code rewritten by:
|
|
4
|
-
# Erik Hollensbe <erik@hollensbe.org>
|
|
5
|
-
#
|
|
6
|
-
# RubyGems integration properly done by:
|
|
7
|
-
# James Tucker (aka raggi)
|
|
8
|
-
#
|
|
9
|
-
# Original Authors:
|
|
10
|
-
# Mislav Marohnic <mislav.marohnic@gmail.com>
|
|
11
|
-
# Tony Strauss (http://github.com/DesigningPatterns)
|
|
12
|
-
# Michael Granger <ged@FaerieMUD.org>, who had maintained the original RDoc template
|
|
13
4
|
|
|
14
5
|
require 'pathname'
|
|
15
6
|
require 'erb'
|
|
7
|
+
# :nocov:
|
|
16
8
|
require 'rdoc/rdoc' unless defined?(RDoc::Markup::ToHtml)
|
|
9
|
+
# :nocov:
|
|
17
10
|
require 'rdoc/generator'
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
LIST_TYPE_TO_HTML[:LABEL] = ['<table class="rdoc-list label-list"><tbody>', '</tbody></table>']
|
|
21
|
-
LIST_TYPE_TO_HTML[:NOTE] = ['<table class="rdoc-list note-list"><tbody>', '</tbody></table>']
|
|
22
|
-
|
|
23
|
-
alias list_item_start list_item_start
|
|
24
|
-
def list_item_start(list_item, list_type)
|
|
25
|
-
case list_type
|
|
26
|
-
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
|
|
27
|
-
"<li>"
|
|
28
|
-
when :LABEL, :NOTE then
|
|
29
|
-
"<tr><td class='label'>#{Array(list_item.label).map{|label| to_html(label)}.join("<br />")}</td><td>"
|
|
30
|
-
else
|
|
31
|
-
raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
alias list_end_for list_end_for
|
|
36
|
-
def list_end_for(list_type)
|
|
37
|
-
case list_type
|
|
38
|
-
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
|
|
39
|
-
"</li>"
|
|
40
|
-
when :LABEL, :NOTE then
|
|
41
|
-
"</td></tr>"
|
|
42
|
-
else
|
|
43
|
-
raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
12
|
+
# Hanna version of RDoc::Generator
|
|
48
13
|
class RDoc::Generator::Hanna
|
|
49
14
|
STYLE = 'styles.css'
|
|
50
15
|
LAYOUT = 'layout.erb'
|
|
@@ -72,11 +37,10 @@ class RDoc::Generator::Hanna
|
|
|
72
37
|
|
|
73
38
|
DESCRIPTION = 'RDoc generator designed with simplicity, beauty and ease of browsing in mind'
|
|
74
39
|
|
|
75
|
-
# EPIC CUT AND PASTE TIEM NAO -- GG
|
|
76
40
|
RDoc::RDoc.add_generator( self )
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
|
|
42
|
+
class << self
|
|
43
|
+
alias for new
|
|
80
44
|
end
|
|
81
45
|
|
|
82
46
|
def initialize( store, options )
|
|
@@ -106,23 +70,14 @@ class RDoc::Generator::Hanna
|
|
|
106
70
|
generate_indexes
|
|
107
71
|
generate_class_files
|
|
108
72
|
generate_file_files
|
|
109
|
-
|
|
110
|
-
rescue StandardError => err
|
|
111
|
-
p [ err.class.name, err.message, err.backtrace.join("\n ") ]
|
|
112
|
-
raise
|
|
113
73
|
end
|
|
114
74
|
|
|
115
75
|
def write_static_files
|
|
116
76
|
css_dir = outjoin('css')
|
|
117
|
-
|
|
118
|
-
unless File.directory?(css_dir)
|
|
119
|
-
FileUtils.mkdir css_dir
|
|
120
|
-
end
|
|
121
|
-
|
|
77
|
+
FileUtils.mkdir_p css_dir
|
|
122
78
|
File.binwrite(File.join(css_dir, 'style.css'), File.read(templjoin(STYLE)))
|
|
123
79
|
end
|
|
124
80
|
|
|
125
|
-
# FIXME refactor
|
|
126
81
|
def generate_indexes
|
|
127
82
|
@main_page_uri = @files.find { |f| f.name == @options.main_page }.path rescue ''
|
|
128
83
|
File.binwrite(outjoin(INDEX_OUT), erb_template(templjoin(INDEX_PAGE)).to_html(binding))
|
|
@@ -149,7 +104,6 @@ class RDoc::Generator::Hanna
|
|
|
149
104
|
file_page = erb_template(templjoin(FILE_PAGE))
|
|
150
105
|
method_list_page = erb_template(templjoin(METHOD_LIST_PAGE))
|
|
151
106
|
|
|
152
|
-
# FIXME non-Ruby files
|
|
153
107
|
@files.each do |file|
|
|
154
108
|
path = Pathname.new(file.path)
|
|
155
109
|
stylesheet = Pathname.new(STYLE_OUT).relative_path_from(path.dirname)
|
|
@@ -170,12 +124,8 @@ class RDoc::Generator::Hanna
|
|
|
170
124
|
end
|
|
171
125
|
end
|
|
172
126
|
|
|
173
|
-
# FIXME XXX sanity check
|
|
174
127
|
dir = path.dirname
|
|
175
|
-
|
|
176
|
-
FileUtils.mkdir_p dir
|
|
177
|
-
end
|
|
178
|
-
|
|
128
|
+
FileUtils.mkdir_p dir
|
|
179
129
|
File.binwrite(outjoin(file.path), result)
|
|
180
130
|
end
|
|
181
131
|
end
|
|
@@ -184,7 +134,6 @@ class RDoc::Generator::Hanna
|
|
|
184
134
|
class_page = erb_template(templjoin(CLASS_PAGE))
|
|
185
135
|
method_list_page = erb_template(templjoin(METHOD_LIST_PAGE))
|
|
186
136
|
sections_page = erb_template(templjoin(SECTIONS_PAGE))
|
|
187
|
-
# FIXME refactor
|
|
188
137
|
|
|
189
138
|
@classes.each do |klass|
|
|
190
139
|
outfile = classfile(klass)
|
|
@@ -221,12 +170,8 @@ class RDoc::Generator::Hanna
|
|
|
221
170
|
end
|
|
222
171
|
end
|
|
223
172
|
|
|
224
|
-
# FIXME XXX sanity check
|
|
225
173
|
dir = outfile.dirname
|
|
226
|
-
|
|
227
|
-
FileUtils.mkdir_p dir
|
|
228
|
-
end
|
|
229
|
-
|
|
174
|
+
FileUtils.mkdir_p dir
|
|
230
175
|
File.binwrite(outfile, result)
|
|
231
176
|
end
|
|
232
177
|
end
|
|
@@ -236,20 +181,8 @@ class RDoc::Generator::Hanna
|
|
|
236
181
|
layout.to_html(binding, :values => values) { yield }
|
|
237
182
|
end
|
|
238
183
|
|
|
239
|
-
def sanitize_code_blocks(text)
|
|
240
|
-
text.gsub(/<pre>(.+?)<\/pre>/m) do
|
|
241
|
-
code = $1.sub(/^\s*\n/, '')
|
|
242
|
-
indent = code.gsub(/\n[ \t]*\n/, "\n").scan(/^ */).map{ |i| i.size }.min
|
|
243
|
-
code.gsub!(/^#{' ' * indent}/, '') if indent > 0
|
|
244
|
-
|
|
245
|
-
"<pre>#{code}</pre>"
|
|
246
|
-
end
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
# probably should bring in nokogiri/libxml2 to do this right.. not sure if
|
|
250
|
-
# it's worth it.
|
|
251
184
|
def frame_link(content)
|
|
252
|
-
content.gsub(%r!<a href="
|
|
185
|
+
content.gsub(%r!<a[ \n]href="https?://[^>]*>!).each do |tag|
|
|
253
186
|
a_tag, rest = tag.split(' ', 2)
|
|
254
187
|
rest.gsub!(/target="[^"]*"/, '')
|
|
255
188
|
a_tag + ' target="_top" ' + rest
|
|
@@ -268,57 +201,45 @@ class RDoc::Generator::Hanna
|
|
|
268
201
|
CGI::escapeHTML(html.to_s)
|
|
269
202
|
end
|
|
270
203
|
|
|
271
|
-
|
|
272
|
-
def render_class_tree(entries, parent=nil)
|
|
204
|
+
def render_class_tree(entries, prefix=nil, out=String.new)
|
|
273
205
|
namespaces = { }
|
|
274
206
|
|
|
275
|
-
entries.sort.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
out <<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
end
|
|
207
|
+
entries.sort.each do |klass|
|
|
208
|
+
full_name = klass.full_name
|
|
209
|
+
next if namespaces[full_name]
|
|
210
|
+
|
|
211
|
+
class_prefix = "#{full_name}::"
|
|
212
|
+
subentries = @classes.select{|c| c.full_name.start_with?(class_prefix)}
|
|
213
|
+
subentries.each { |x| namespaces[x.full_name] = true }
|
|
214
|
+
|
|
215
|
+
text = prefix ? (prefix + klass.name) : klass.name
|
|
216
|
+
link = link_to(text, classfile(klass))
|
|
217
|
+
|
|
218
|
+
if subentries.empty?
|
|
219
|
+
out << "<span class=\"class-link\">" << link << "</span>\n"
|
|
220
|
+
else
|
|
221
|
+
out << '<details'
|
|
222
|
+
out << ' open' if full_name.count(':') == 0
|
|
223
|
+
out << '><summary>' << link << "</summary>\n"
|
|
224
|
+
render_class_tree(subentries, "<span class=\"parent\">#{full_name}::</span>", out)
|
|
225
|
+
out << "</details>"
|
|
295
226
|
end
|
|
296
|
-
|
|
297
|
-
out
|
|
298
227
|
end
|
|
228
|
+
|
|
229
|
+
out
|
|
299
230
|
end
|
|
300
231
|
|
|
301
|
-
def link_to(text, url
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if url
|
|
305
|
-
%[<a href="#{url}"#{class_attr}>#{text}</a>]
|
|
306
|
-
elsif classname
|
|
307
|
-
%[<span#{class_attr}>#{text}</span>]
|
|
308
|
-
else
|
|
309
|
-
text
|
|
310
|
-
end
|
|
232
|
+
def link_to(text, url)
|
|
233
|
+
%[<a href="#{url}">#{text}</a>]
|
|
311
234
|
end
|
|
312
235
|
|
|
313
|
-
|
|
314
|
-
def link_to_method(entry, url = nil, classname = nil)
|
|
236
|
+
def link_to_method(entry, url)
|
|
315
237
|
method_name = entry.pretty_name rescue entry.name
|
|
316
238
|
module_name = entry.parent_name rescue entry.name
|
|
317
|
-
link_to %Q(<span class="method_name" value="#{entry.name}">#{h method_name}</span> <span class="module_name">(#{h module_name})</span>), url
|
|
239
|
+
link_to %Q(<span class="method_name" value="#{entry.name}">#{h method_name}</span> <span class="module_name">(#{h module_name})</span>), url
|
|
318
240
|
end
|
|
319
241
|
|
|
320
242
|
def classfile(klass)
|
|
321
|
-
# FIXME sloooooooow
|
|
322
243
|
Pathname.new(File.join(CLASS_DIR, klass.full_name.split('::')) + '.html')
|
|
323
244
|
end
|
|
324
245
|
|
|
@@ -349,4 +270,31 @@ class RDoc::Generator::Hanna
|
|
|
349
270
|
def erb_template(file)
|
|
350
271
|
ERB.new(File.read(file))
|
|
351
272
|
end
|
|
273
|
+
|
|
274
|
+
module LabelListTable
|
|
275
|
+
def list_item_start(list_item, list_type)
|
|
276
|
+
case list_type
|
|
277
|
+
when :LABEL, :NOTE
|
|
278
|
+
"<tr><td class='label'>#{Array(list_item.label).map{|label| to_html(label)}.join("<br />")}</td><td>"
|
|
279
|
+
else
|
|
280
|
+
super
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def list_end_for(list_type)
|
|
285
|
+
case list_type
|
|
286
|
+
when :LABEL, :NOTE then
|
|
287
|
+
"</td></tr>"
|
|
288
|
+
else
|
|
289
|
+
super
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
end
|
|
352
293
|
end
|
|
294
|
+
|
|
295
|
+
class RDoc::Markup::ToHtml
|
|
296
|
+
LIST_TYPE_TO_HTML[:LABEL] = ['<table class="rdoc-list label-list"><tbody>', '</tbody></table>']
|
|
297
|
+
LIST_TYPE_TO_HTML[:NOTE] = ['<table class="rdoc-list note-list"><tbody>', '</tbody></table>']
|
|
298
|
+
|
|
299
|
+
prepend RDoc::Generator::Hanna::LabelListTable
|
|
300
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hanna-nouveau
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Evans
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rdoc
|
|
@@ -27,6 +27,34 @@ dependencies:
|
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
29
|
version: '4'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: minitest-hooks
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '0'
|
|
37
|
+
type: :development
|
|
38
|
+
prerelease: false
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
- !ruby/object:Gem::Dependency
|
|
45
|
+
name: minitest-global_expectations
|
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '0'
|
|
51
|
+
type: :development
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '0'
|
|
30
58
|
description: RDoc generator designed with simplicity, beauty and ease of browsing
|
|
31
59
|
in mind
|
|
32
60
|
email: code@jeremyevans.net
|
|
@@ -35,11 +63,11 @@ extensions: []
|
|
|
35
63
|
extra_rdoc_files:
|
|
36
64
|
- LICENSE
|
|
37
65
|
- README.rdoc
|
|
66
|
+
- CHANGELOG
|
|
38
67
|
files:
|
|
68
|
+
- CHANGELOG
|
|
39
69
|
- LICENSE
|
|
40
70
|
- README.rdoc
|
|
41
|
-
- Rakefile
|
|
42
|
-
- VERSION
|
|
43
71
|
- lib/hanna-nouveau.rb
|
|
44
72
|
- lib/hanna-nouveau/template_files/class_index.erb
|
|
45
73
|
- lib/hanna-nouveau/template_files/file_index.erb
|
|
@@ -67,14 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
67
95
|
requirements:
|
|
68
96
|
- - ">="
|
|
69
97
|
- !ruby/object:Gem::Version
|
|
70
|
-
version:
|
|
98
|
+
version: '2.2'
|
|
71
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
100
|
requirements:
|
|
73
101
|
- - ">="
|
|
74
102
|
- !ruby/object:Gem::Version
|
|
75
103
|
version: '0'
|
|
76
104
|
requirements: []
|
|
77
|
-
rubygems_version: 3.
|
|
105
|
+
rubygems_version: 3.3.7
|
|
78
106
|
signing_key:
|
|
79
107
|
specification_version: 4
|
|
80
108
|
summary: RDoc generator designed with simplicity, beauty and ease of browsing in mind
|
data/Rakefile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require "rake/clean"
|
|
2
|
-
CLEAN.include ["rdoc", "*.gem"]
|
|
3
|
-
|
|
4
|
-
require "rdoc/task"
|
|
5
|
-
RDoc::Task.new do |rdoc|
|
|
6
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
7
|
-
|
|
8
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
9
|
-
rdoc.generator = 'hanna'
|
|
10
|
-
rdoc.title = "hanna-nouveau #{version}"
|
|
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"
|
|
13
|
-
end
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.2.0
|