hanna-nouveau 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +109 -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/layout.erb +1 -0
- 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 +35 -14
- data/lib/hanna-nouveau.rb +64 -116
- metadata +37 -9
- 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: 52755db97cb250d4385d7f839ed8950910cfb1337f63ce41d2a951d91b8746d1
|
4
|
+
data.tar.gz: 8f26757a43140bf3842d132c06f0d4305fdbd509136ef4b0eb091b43cc8c1514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5585d843b226869da0135ab78b42a3223ff6ec6c1e406aa801591acf411caff98a6053a43da95f4d6fdc5419b57a3194b741cdc309bf26ce3b6388b7bfa1a92f
|
7
|
+
data.tar.gz: b5ef4af2677a2ad9bede9317e6e78b2e13764160ccd1d7d75aeec3966a8e94f59c92c226266170c435b077ffb57d2abe5040c1278feb9957776b5f452ef17e4d
|
data/CHANGELOG
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# 1.4.0 (2023-01-10)
|
2
|
+
|
3
|
+
* Improve style for mobile devices (janko) (#18, #19)
|
4
|
+
|
5
|
+
# 1.3.0 (2022-06-27)
|
6
|
+
|
7
|
+
* Use details/summary for class index (jeremyevans)
|
8
|
+
|
9
|
+
* Optimize render_class_tree, and avoid creation of O(n^2) regexps (jeremyevans)
|
10
|
+
|
11
|
+
* Use target="_top" for https links as well as http links (jeremyevans)
|
12
|
+
|
13
|
+
# 1.2.0 (2021-12-23)
|
14
|
+
|
15
|
+
* Remove dependency on haml, by switching to stdlib erb (jeremyevans)
|
16
|
+
|
17
|
+
* Remove use of prototype.js for the method index, switching to plain javascript (jeremyevans)
|
18
|
+
|
19
|
+
# 1.1.0 (2021-12-15)
|
20
|
+
|
21
|
+
* Remove dependency on sass, by converting the stylesheet to CSS (jeremyevans)
|
22
|
+
|
23
|
+
* Avoid Ruby verbose mode warnings (jeremyevans)
|
24
|
+
|
25
|
+
# 1.0.4 (2020-06-24)
|
26
|
+
|
27
|
+
* Avoid whitespace between method name and argument list (jeremyevans)
|
28
|
+
|
29
|
+
# 1.0.3 (2018-02-15)
|
30
|
+
|
31
|
+
* Avoid using deprecated sass color operators (jeremyevans)
|
32
|
+
|
33
|
+
# 1.0.2 (2017-07-01)
|
34
|
+
|
35
|
+
* Handle documenting BasicObject (jeremyevans)
|
36
|
+
|
37
|
+
# 1.0.1 (2016-10-12)
|
38
|
+
|
39
|
+
* Remove unneeded and harmful target="docwin" from links (jeremyevans)
|
40
|
+
|
41
|
+
# 1.0.0 (2016-09-21)
|
42
|
+
|
43
|
+
* Support haml 4+ and rdoc 5+ (jeremyevans)
|
44
|
+
|
45
|
+
* Remove no longer needed override of parseable? in rdoc (jeremyevans)
|
46
|
+
|
47
|
+
# 0.4.2 (2014-11-26)
|
48
|
+
|
49
|
+
* Use ruby's built-in syntax parser instead of parser gem to check for valid syntax (jeremyevans)
|
50
|
+
|
51
|
+
# 0.4.1 (2014-08-29)
|
52
|
+
|
53
|
+
* Update syntax highlighting color for comments and strings (jeremyevans)
|
54
|
+
|
55
|
+
# 0.4.0 (2014-08-19)
|
56
|
+
|
57
|
+
* Add parser as a dependency for checking for valid Ruby syntax (jeremyevans)
|
58
|
+
|
59
|
+
* Use table instead of dl for better styling of label/note lists (jeremyevans)
|
60
|
+
|
61
|
+
* Syntax highlight ruby code blocks, not just method source (jeremyevans)
|
62
|
+
|
63
|
+
# 0.3.0 (2014-06-18)
|
64
|
+
|
65
|
+
* Show superclass instead of parent for classes (Quintus, jeremyevans)
|
66
|
+
|
67
|
+
* Add support for RDoc 4 (Atsushi Nagase, jeremyevans)
|
68
|
+
|
69
|
+
# 0.2.7 (2013-03-23)
|
70
|
+
|
71
|
+
* Remove duplicate entries from method index (jeremyevans)
|
72
|
+
|
73
|
+
* Fix attribute links (jeremyevans)
|
74
|
+
|
75
|
+
# 0.2.6 (2013-03-01)
|
76
|
+
|
77
|
+
* Fix homepage in gem (erikh)
|
78
|
+
|
79
|
+
# 0.2.5 (2013-03-01)
|
80
|
+
|
81
|
+
* Restrict rdoc version in gem to ~> 3.1, since the gem doesn't work with RDoc 4 (jeremyevans)
|
82
|
+
|
83
|
+
# 0.2.4 (2011-07-24)
|
84
|
+
|
85
|
+
* Respect markup in section comments (jeremyevans)
|
86
|
+
|
87
|
+
* Fix class/singleton attribute anchors (jeremyevans)
|
88
|
+
|
89
|
+
* Work with RDoc 3.8+ (jeremyevans)
|
90
|
+
|
91
|
+
* Support RDoc sections (jeremyevans)
|
92
|
+
|
93
|
+
* Automatically link classes, modules, included modules, and attributes (jeremyevans)
|
94
|
+
|
95
|
+
# 0.2.3 (2011-05-12)
|
96
|
+
|
97
|
+
* Sort method, aliases, and attribute lists (jeremyevans)
|
98
|
+
|
99
|
+
# 0.2.2 (2010-12-28)
|
100
|
+
|
101
|
+
* Work with RDoc 3.1+ (erikh)
|
102
|
+
|
103
|
+
# 0.2.1 (2010-12-23)
|
104
|
+
|
105
|
+
* Rename internal files to hanna-nouveau (erikh)
|
106
|
+
|
107
|
+
# 0.2.0 (2010-12-23)
|
108
|
+
|
109
|
+
* 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.
|
@@ -2,6 +2,7 @@
|
|
2
2
|
<html lang='en'>
|
3
3
|
<head>
|
4
4
|
<title><%= h(values[:title]) if values[:title] %></title>
|
5
|
+
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
5
6
|
<meta content='text/html; charset=<%=h @options.charset %>' http-equiv='Content-Type'>
|
6
7
|
<link href='<%=h values[:stylesheet] %>' media='screen' rel='stylesheet' type='text/css'>
|
7
8
|
<% if index %><base target='docwin'>
|
@@ -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,17 +153,24 @@ 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
|
|
159
165
|
div.header {
|
160
166
|
font-size: 80%;
|
161
|
-
padding: 0.5em
|
167
|
+
padding: 0.5em 1rem;
|
162
168
|
font-family: Arial, Helvetica, sans-serif;
|
163
169
|
border-bottom: 1px solid silver; }
|
164
170
|
div.header .name {
|
165
171
|
font-size: 1.6em;
|
166
|
-
font-family: Georgia, serif;
|
172
|
+
font-family: Georgia, serif;
|
173
|
+
overflow-wrap: break-word; }
|
167
174
|
div.header .name .type {
|
168
175
|
color: #666666;
|
169
176
|
font-size: 80%;
|
@@ -181,12 +188,10 @@ div.header {
|
|
181
188
|
color: #484848; }
|
182
189
|
|
183
190
|
#content {
|
184
|
-
padding: 12px
|
185
|
-
div.class #content {
|
186
|
-
position: relative;
|
187
|
-
width: 72%; }
|
191
|
+
padding: 12px 1rem; }
|
188
192
|
#content pre, #content .method .synopsis {
|
189
|
-
font: 14px Monaco, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
|
193
|
+
font: 14px Monaco, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
|
194
|
+
overflow-wrap: break-word; }
|
190
195
|
#content pre {
|
191
196
|
color: black;
|
192
197
|
background: #eeeeee;
|
@@ -239,7 +244,10 @@ div.header {
|
|
239
244
|
white-space: normal; }
|
240
245
|
#content table.rdoc-list {
|
241
246
|
border-collapse: collapse;
|
242
|
-
border-spacing: 0;
|
247
|
+
border-spacing: 0;
|
248
|
+
width: 100%;
|
249
|
+
overflow: auto;
|
250
|
+
display: block; }
|
243
251
|
#content table.rdoc-list tr {
|
244
252
|
background-color: white; }
|
245
253
|
#content table.rdoc-list tr:nth-child(2n) {
|
@@ -251,14 +259,12 @@ div.header {
|
|
251
259
|
padding: 6px 13px; }
|
252
260
|
|
253
261
|
#method-list {
|
254
|
-
|
255
|
-
top: 0px;
|
256
|
-
right: -33%;
|
257
|
-
width: 28%;
|
262
|
+
max-height: 30rem;
|
258
263
|
background: #eeeeee;
|
259
264
|
border: 1px solid silver;
|
260
265
|
padding: 0.4em 1%;
|
261
|
-
overflow:
|
266
|
+
overflow-y: auto;
|
267
|
+
overflow-x: hidden; }
|
262
268
|
#method-list h2 {
|
263
269
|
font-size: 1.3em; }
|
264
270
|
#method-list h3 {
|
@@ -280,6 +286,9 @@ div.header {
|
|
280
286
|
color: #444444;
|
281
287
|
margin: 1em 0 0.2em 0; }
|
282
288
|
|
289
|
+
.name-list, #class-list ol, #context ol {
|
290
|
+
overflow: auto; }
|
291
|
+
|
283
292
|
#methods .method {
|
284
293
|
border: 1px solid silver;
|
285
294
|
margin-top: 0.5em;
|
@@ -310,7 +319,6 @@ div.header {
|
|
310
319
|
#content .method .source pre, #content pre.ruby, #methods .method .description pre.ruby {
|
311
320
|
background: #262626;
|
312
321
|
color: #ffdead;
|
313
|
-
margin: 1em;
|
314
322
|
padding: 0.5em;
|
315
323
|
border: 1px dashed #999999;
|
316
324
|
overflow: auto; }
|
@@ -345,3 +353,16 @@ div.header {
|
|
345
353
|
#content .method .source pre .ruby-value, #content pre.ruby .ruby-value, #methods .method .description pre.ruby .ruby-value {
|
346
354
|
color: #7fffd4;
|
347
355
|
background: transparent; }
|
356
|
+
|
357
|
+
@media (min-width: 640px) {
|
358
|
+
div.class #content {
|
359
|
+
position: relative;
|
360
|
+
width: 72%; }
|
361
|
+
|
362
|
+
#method-list {
|
363
|
+
position: absolute;
|
364
|
+
top: 0px;
|
365
|
+
right: -33%;
|
366
|
+
width: 28%;
|
367
|
+
}
|
368
|
+
}
|
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,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanna-nouveau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
- Erik Hollensbe
|
9
9
|
- James Tucker
|
10
10
|
- Mislav Marohnic
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-01-10 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
|
@@ -59,7 +87,7 @@ metadata:
|
|
59
87
|
bug_tracker_uri: https://github.com/jeremyevans/hanna-nouveau/issues
|
60
88
|
mailing_list_uri: https://github.com/jeremyevans/hanna-nouveau/discussions
|
61
89
|
source_code_uri: https://github.com/jeremyevans/hanna-nouveau
|
62
|
-
post_install_message:
|
90
|
+
post_install_message:
|
63
91
|
rdoc_options: []
|
64
92
|
require_paths:
|
65
93
|
- lib
|
@@ -67,15 +95,15 @@ 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.
|
78
|
-
signing_key:
|
105
|
+
rubygems_version: 3.4.1
|
106
|
+
signing_key:
|
79
107
|
specification_version: 4
|
80
108
|
summary: RDoc generator designed with simplicity, beauty and ease of browsing in mind
|
81
109
|
test_files: []
|
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
|