hanna-bootstrap 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -18
- data/Rakefile +1 -0
- data/hanna-bootstrap.gemspec +12 -11
- data/lib/hanna-bootstrap.rb +66 -34
- data/lib/hanna-bootstrap/template_files/application.coffee +3 -2
- data/lib/hanna-bootstrap/template_files/application.sass +43 -5
- data/lib/hanna-bootstrap/template_files/coderay.css +141 -0
- data/lib/hanna-bootstrap/template_files/file_index.haml +1 -7
- data/lib/hanna-bootstrap/template_files/layout.haml +2 -2
- data/lib/hanna-bootstrap/template_files/method_list.haml +6 -31
- data/lib/hanna-bootstrap/template_files/page.haml +70 -39
- data/lib/hanna-bootstrap/template_files/sections.haml +51 -37
- data/lib/hanna-bootstrap/version.rb +7 -0
- metadata +25 -7
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Hanna Bootstrap —
|
1
|
+
= Hanna Bootstrap — Twitter Bootstrap theme for RDoc
|
2
2
|
|
3
3
|
Based on the original Hanna by Mislav, Hanna Nouveau by Erik.
|
4
4
|
|
@@ -9,25 +9,18 @@ wiki}[http://github.com/mislav/hanna/wikis/home].)
|
|
9
9
|
|
10
10
|
Hanna gem is available from http://rubygems.org:
|
11
11
|
|
12
|
-
gem install hanna-
|
12
|
+
gem install hanna-bootstrap
|
13
13
|
|
14
|
-
The template was created by {
|
14
|
+
The template was created by {Atsushi Nagase}[http://ngs.io/] and since then
|
15
15
|
has seen contributions from:
|
16
16
|
|
17
|
-
1. {Tony Strauss}[http://github.com/DesigningPatterns], who participated from
|
18
|
-
the early start and made tons of fixes and enhancements to the template;
|
19
|
-
2. {Hongli Lai}[http://blog.phusion.nl/] with the search filter for methods.
|
20
|
-
3. {Erik Hollensbe}[http://github.com/erikh] a serious refactoring and up to
|
21
|
-
date with RDoc 2.5.x and 3.x, now named 'hanna-nouveau'.
|
22
|
-
4. {James Tucker}[http://github.com/raggi] minor cleanups for Erik.
|
23
|
-
|
24
17
|
== Usage
|
25
18
|
|
26
|
-
rdoc -o doc -f
|
19
|
+
rdoc -o doc -f bootstrap lib/*.rb
|
27
20
|
|
28
21
|
An alternative is to set the `RDOCOPT` environment variable:
|
29
22
|
|
30
|
-
RDOCOPT="-f
|
23
|
+
RDOCOPT="-f bootstrap"
|
31
24
|
|
32
25
|
This will make RDoc always use Hanna unless it is explicitly overridden.
|
33
26
|
|
@@ -36,10 +29,10 @@ This will make RDoc always use Hanna unless it is explicitly overridden.
|
|
36
29
|
Another neat trick is to put the following line in your .gemrc, this will make
|
37
30
|
RubyGems use Hanna for all rdoc generation:
|
38
31
|
|
39
|
-
rdoc: -f
|
32
|
+
rdoc: -f bootstrap
|
40
33
|
|
41
34
|
This will make RubyGems use Hanna when generating documentation for installed
|
42
|
-
gems. Remember, if you wish to have all your gems be formatted in
|
35
|
+
gems. Remember, if you wish to have all your gems be formatted in bootstrap:
|
43
36
|
|
44
37
|
gem rdoc --all --overwrite
|
45
38
|
|
@@ -50,15 +43,15 @@ The first time. To easily browse your newly created documentation, use:
|
|
50
43
|
== Rake task
|
51
44
|
|
52
45
|
For repeated generation of API docs, it's better to set up a Rake task. Simply
|
53
|
-
add the
|
46
|
+
add the bootstrap format argument to your RDoc::Task options:
|
54
47
|
|
55
48
|
gem 'rdoc'
|
56
49
|
require 'rdoc/task'
|
57
50
|
RDoc::Task.new do |rdoc|
|
58
51
|
# this only works with RDoc 3.1 or greater
|
59
|
-
rdoc.generator = '
|
52
|
+
rdoc.generator = 'bootstrap'
|
60
53
|
# this is what you use pre RDoc 3.1:
|
61
|
-
rdoc.options.push '-f', '
|
54
|
+
rdoc.options.push '-f', 'bootstrap'
|
62
55
|
end
|
63
56
|
|
64
57
|
Tip: you can do this in the Rakefile of your Rails project before running
|
@@ -72,7 +65,7 @@ library}[http://github.com/rdbi/rdbi/tree/master/Rakefile]:
|
|
72
65
|
RDoc::Task.new do |rdoc|
|
73
66
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
74
67
|
|
75
|
-
rdoc.generator = '
|
68
|
+
rdoc.generator = 'bootstrap'
|
76
69
|
rdoc.main = 'README.rdoc'
|
77
70
|
rdoc.rdoc_dir = 'rdoc'
|
78
71
|
rdoc.title = "RDBI #{version} Documentation"
|
data/Rakefile
CHANGED
data/hanna-bootstrap.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
|
4
|
-
require 'hanna-bootstrap'
|
3
|
+
require 'hanna-bootstrap/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{hanna-bootstrap}
|
@@ -9,23 +8,25 @@ Gem::Specification.new do |s|
|
|
9
8
|
|
10
9
|
s.authors = ["Atsushi Nagase", "Erik Hollensbe", "James Tucker", "Mislav Marohnic"]
|
11
10
|
s.date = Time.now.strftime("%Y-%m-%d")
|
11
|
+
s.summary = %q{Twitter Boostrap theme for RDoc}
|
12
12
|
s.description = %q{}
|
13
13
|
s.email = %q{a@ngs.io}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
|
-
s.files = `git ls-files`.split("\n").reject{|f| f =~ /^(\..+|Gemfile.*|Guardfile|)$/}
|
19
18
|
s.homepage = %q{http://github.com/ngs/hanna-bootstrap}
|
20
19
|
s.licenses = ["MIT"]
|
21
|
-
s.require_paths = ["lib"]
|
22
|
-
s.summary = %q{Twitter Boostrap theme for RDoc}
|
23
20
|
|
24
|
-
s.
|
25
|
-
s.
|
26
|
-
s.
|
27
|
-
s.
|
28
|
-
s.
|
29
|
-
s.
|
21
|
+
s.add_dependency 'bundler'
|
22
|
+
s.add_dependency 'coderay'
|
23
|
+
s.add_dependency 'coffee-script'
|
24
|
+
s.add_dependency 'haml'
|
25
|
+
s.add_dependency 'json'
|
26
|
+
s.add_dependency 'rake'
|
27
|
+
s.add_dependency 'sass'
|
28
|
+
|
29
|
+
s.files = `git ls-files`.split("\n").reject{|f| f =~ /^(\..+|Gemfile.*|Guardfile|)$/}
|
30
|
+
s.require_paths = ["lib"]
|
30
31
|
end
|
31
32
|
|
data/lib/hanna-bootstrap.rb
CHANGED
@@ -10,18 +10,19 @@
|
|
10
10
|
# Tony Strauss (http://github.com/DesigningPatterns)
|
11
11
|
# Michael Granger <ged@FaerieMUD.org>, who had maintained the original RDoc template
|
12
12
|
|
13
|
-
require '
|
14
|
-
require '
|
15
|
-
require 'sass'
|
16
|
-
require 'rdoc/rdoc'
|
17
|
-
require 'rdoc/generator'
|
13
|
+
require 'coderay'
|
14
|
+
require 'coderay/helpers/file_type'
|
18
15
|
require 'coffee-script'
|
16
|
+
require 'haml'
|
17
|
+
require 'hanna-bootstrap/version'
|
19
18
|
require 'json'
|
19
|
+
require 'pathname'
|
20
|
+
require 'rdoc/generator'
|
21
|
+
require 'rdoc/rdoc'
|
22
|
+
require 'sass'
|
20
23
|
|
21
24
|
class RDoc::Generator::Bootstrap
|
22
25
|
|
23
|
-
VERSION = '0.0.1'
|
24
|
-
|
25
26
|
LAYOUT = 'layout.haml'
|
26
27
|
|
27
28
|
CLASS_PAGE = 'page.haml'
|
@@ -52,8 +53,7 @@ class RDoc::Generator::Bootstrap
|
|
52
53
|
|
53
54
|
def initialize( options )
|
54
55
|
@options = options
|
55
|
-
|
56
|
-
@templatedir = Pathname.new File.expand_path('../hanna-bootstrap/template_files', __FILE__)
|
56
|
+
@templatedir = Pathname.new(options.template_dir || File.expand_path('../hanna-bootstrap/template_files', __FILE__))
|
57
57
|
|
58
58
|
@files = nil
|
59
59
|
@classes = nil
|
@@ -65,16 +65,17 @@ class RDoc::Generator::Bootstrap
|
|
65
65
|
|
66
66
|
def default_values( path )
|
67
67
|
{
|
68
|
-
stylesheets:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
68
|
+
stylesheets: %w{
|
69
|
+
bootstrap.min
|
70
|
+
application
|
71
|
+
coderay
|
72
|
+
}.map {|f|outpath(File.join('css', "#{f}.css"), path)},
|
73
|
+
javascripts: %w{
|
74
|
+
jquery
|
75
|
+
bootstrap.min
|
76
|
+
index
|
77
|
+
application
|
78
|
+
}.map {|f|outpath(File.join('js', "#{f}.js"), path)},
|
78
79
|
mainpage: outpath('', path),
|
79
80
|
files: @files,
|
80
81
|
classes: @classes,
|
@@ -96,7 +97,7 @@ class RDoc::Generator::Bootstrap
|
|
96
97
|
|
97
98
|
# Now actually write the output
|
98
99
|
write_static_files
|
99
|
-
|
100
|
+
|
100
101
|
generate_class_files
|
101
102
|
generate_file_files
|
102
103
|
generate_indexes
|
@@ -139,6 +140,7 @@ class RDoc::Generator::Bootstrap
|
|
139
140
|
|
140
141
|
FileUtils.cp %w{
|
141
142
|
bootstrap.min.css
|
143
|
+
coderay.css
|
142
144
|
}.map{|f| templjoin f }, css_dir
|
143
145
|
|
144
146
|
end
|
@@ -162,7 +164,7 @@ class RDoc::Generator::Bootstrap
|
|
162
164
|
|
163
165
|
index = haml_file(templjoin(templfile))
|
164
166
|
|
165
|
-
File.open(path, 'w') do |f|
|
167
|
+
File.open(path, 'w') do |f|
|
166
168
|
f << with_layout(values) do
|
167
169
|
index.to_html(binding, values)
|
168
170
|
end
|
@@ -183,18 +185,18 @@ class RDoc::Generator::Bootstrap
|
|
183
185
|
method_list_page = haml_file(templjoin(METHOD_LIST_PAGE))
|
184
186
|
|
185
187
|
path = Pathname.new(path || file.path)
|
186
|
-
values = default_values(path).merge({
|
187
|
-
:file => file,
|
188
|
+
values = default_values(path).merge({
|
189
|
+
:file => file,
|
188
190
|
:entry => file,
|
189
|
-
:classmod => nil,
|
190
|
-
:title => file.base_name,
|
191
|
+
:classmod => nil,
|
192
|
+
:title => file.base_name,
|
191
193
|
:list_title => nil,
|
192
194
|
:description => file.description
|
193
195
|
})
|
194
196
|
|
195
|
-
result = with_layout(values) do
|
196
|
-
file_page.to_html(binding, :values => values) do
|
197
|
-
method_list_page.to_html(binding, values)
|
197
|
+
result = with_layout(values) do
|
198
|
+
file_page.to_html(binding, :values => values) do
|
199
|
+
method_list_page.to_html(binding, values)
|
198
200
|
end
|
199
201
|
end
|
200
202
|
|
@@ -232,8 +234,8 @@ class RDoc::Generator::Bootstrap
|
|
232
234
|
|
233
235
|
path = Pathname.new(klass.path)
|
234
236
|
|
235
|
-
values = default_values(path).merge({
|
236
|
-
:file => klass.path,
|
237
|
+
values = default_values(path).merge({
|
238
|
+
:file => klass.path,
|
237
239
|
:entry => klass,
|
238
240
|
:classmod => klass.type,
|
239
241
|
:title => klass.full_name,
|
@@ -242,9 +244,9 @@ class RDoc::Generator::Bootstrap
|
|
242
244
|
:sections => sections
|
243
245
|
})
|
244
246
|
|
245
|
-
result = with_layout(values) do
|
247
|
+
result = with_layout(values) do
|
246
248
|
h = {:values => values}
|
247
|
-
class_page.to_html(binding, h) do
|
249
|
+
class_page.to_html(binding, h) do
|
248
250
|
method_list_page.to_html(binding, h) + sections_page.to_html(binding, h)
|
249
251
|
end
|
250
252
|
end
|
@@ -312,7 +314,7 @@ class RDoc::Generator::Bootstrap
|
|
312
314
|
out
|
313
315
|
end
|
314
316
|
end
|
315
|
-
|
317
|
+
|
316
318
|
def build_javascript_search_index(entries)
|
317
319
|
'var searchIndex = ' + (entries.map { |entry|
|
318
320
|
method_name = entry.name
|
@@ -365,4 +367,34 @@ class RDoc::Generator::Bootstrap
|
|
365
367
|
def haml_file(file)
|
366
368
|
Haml::Engine.new(File.read(file))
|
367
369
|
end
|
368
|
-
|
370
|
+
|
371
|
+
def highlighted_code_block(method)
|
372
|
+
lang = CodeRay::FileType.fetch(method.file.name, :text, true)
|
373
|
+
src = method.token_stream.map(&:text).join
|
374
|
+
|
375
|
+
# from RDoc::Generator::Markup#markup_code
|
376
|
+
indent = src.length
|
377
|
+
lines = src.lines.to_a
|
378
|
+
start = 0
|
379
|
+
if src =~ /\A.*#\ *File/i # remove '# File' comment
|
380
|
+
line = lines.shift
|
381
|
+
line.sub!(/\A(.*)(, line (\d+))/, '\1')
|
382
|
+
start = $3.to_i
|
383
|
+
end
|
384
|
+
lines.each do |line|
|
385
|
+
if line =~ /^ *(?=\S)/
|
386
|
+
n = $&.length
|
387
|
+
indent = n if n < indent
|
388
|
+
break if n == 0
|
389
|
+
end
|
390
|
+
end
|
391
|
+
src = lines.join
|
392
|
+
src.gsub!(/^#{' ' * indent}/, '') if indent > 0
|
393
|
+
|
394
|
+
CodeRay.highlight(src, lang,
|
395
|
+
:line_numbers => @options.line_numbers ? :table : nil,
|
396
|
+
:line_number_anchors => "#{method.aref}-source-",
|
397
|
+
:line_number_start => start
|
398
|
+
)
|
399
|
+
end
|
400
|
+
end
|
@@ -3,7 +3,7 @@ do(window, $) -> $ ->
|
|
3
3
|
resultList = $ '#search-results'
|
4
4
|
searchIndex = window.searchIndex
|
5
5
|
input = $ '#search-query'
|
6
|
-
base = $("script[src$='index.js']").attr('src').replace(/^([^j]
|
6
|
+
base = $("script[src$='index.js']").attr('src').replace(/^([^j]*)js.*/, (a, b) -> b)
|
7
7
|
|
8
8
|
search = ->
|
9
9
|
val = input.val()
|
@@ -42,4 +42,5 @@ do(window, $) -> $ ->
|
|
42
42
|
$('navbar-search').bind('submit', -> false)
|
43
43
|
|
44
44
|
|
45
|
-
|
45
|
+
|
46
|
+
|
@@ -1,8 +1,4 @@
|
|
1
|
-
body
|
2
|
-
background: #eee
|
3
|
-
|
4
1
|
#main
|
5
|
-
background: #fff
|
6
2
|
@media (min-width: 980px)
|
7
3
|
padding: 80px 0
|
8
4
|
padding: 0 0 50px 0
|
@@ -13,6 +9,12 @@ body
|
|
13
9
|
.parent
|
14
10
|
opacity: 0.5
|
15
11
|
|
12
|
+
|
13
|
+
.navbar
|
14
|
+
.dropdown-menu
|
15
|
+
max-height: 400px
|
16
|
+
overflow: auto
|
17
|
+
|
16
18
|
#search-results
|
17
19
|
li
|
18
20
|
strong, span
|
@@ -27,4 +29,40 @@ footer
|
|
27
29
|
a
|
28
30
|
color: #999
|
29
31
|
text-align: right
|
30
|
-
padding: 20px 0
|
32
|
+
padding: 20px 0
|
33
|
+
|
34
|
+
#methods
|
35
|
+
section, article
|
36
|
+
padding-top: 50px
|
37
|
+
margin-top: -30px
|
38
|
+
h2, h3
|
39
|
+
margin: 0
|
40
|
+
.synopsis
|
41
|
+
.arguments
|
42
|
+
font-size: 80%
|
43
|
+
font-weight: normal
|
44
|
+
color: #999
|
45
|
+
.source
|
46
|
+
.collapse
|
47
|
+
overflow: auto
|
48
|
+
.source-toggle
|
49
|
+
margin-bottom: 10px
|
50
|
+
.hide, &.collapsed .show
|
51
|
+
display: inline
|
52
|
+
.show, &.collapsed .hide
|
53
|
+
display: none
|
54
|
+
|
55
|
+
h1.name
|
56
|
+
.type
|
57
|
+
font-size: 80%
|
58
|
+
font-weight: normal
|
59
|
+
color: #999
|
60
|
+
|
61
|
+
#class-list
|
62
|
+
.type
|
63
|
+
font-size: 15px
|
64
|
+
color: #999
|
65
|
+
a
|
66
|
+
font-weight: bold
|
67
|
+
font-size: 18px
|
68
|
+
|
@@ -0,0 +1,141 @@
|
|
1
|
+
.CodeRay pre {
|
2
|
+
margin: 0px;
|
3
|
+
font-size: 11px;
|
4
|
+
line-height: 15px;
|
5
|
+
}
|
6
|
+
|
7
|
+
span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
|
8
|
+
|
9
|
+
table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; }
|
10
|
+
table.CodeRay td { padding: 2px 4px; vertical-align: top; }
|
11
|
+
|
12
|
+
.CodeRay .line-numbers {
|
13
|
+
color: gray;
|
14
|
+
text-align: right;
|
15
|
+
-webkit-user-select: none;
|
16
|
+
-moz-user-select: none;
|
17
|
+
user-select: none;
|
18
|
+
padding-right: 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.CodeRay .line-numbers strong {
|
22
|
+
font-weight: normal;
|
23
|
+
}
|
24
|
+
|
25
|
+
.CodeRay .line-numbers pre {
|
26
|
+
border-radius: 4px 0 0 4px;
|
27
|
+
border-right: 0;
|
28
|
+
background-color: #eee;
|
29
|
+
}
|
30
|
+
|
31
|
+
.CodeRay td.code {
|
32
|
+
padding-left: 0;
|
33
|
+
overflow: auto;
|
34
|
+
}
|
35
|
+
|
36
|
+
.CodeRay td.code pre {
|
37
|
+
border-radius: 0 4px 4px 0;
|
38
|
+
border-left: 0;
|
39
|
+
white-space: pre;
|
40
|
+
}
|
41
|
+
|
42
|
+
.CodeRay .line-numbers a {
|
43
|
+
color: #ccc;
|
44
|
+
text-decoration: none !important;
|
45
|
+
white-space: nowrap;
|
46
|
+
}
|
47
|
+
.CodeRay .line-numbers a:target { color: blue !important; }
|
48
|
+
.CodeRay .line-numbers .highlighted { color: red !important; }
|
49
|
+
.CodeRay .line-numbers .highlighted a { color: red !important; }
|
50
|
+
.CodeRay span.line-numbers { padding: 0px 4px; }
|
51
|
+
.CodeRay .line { display: block; float: left; width: 100%; }
|
52
|
+
.CodeRay .code { width: 100%; }
|
53
|
+
|
54
|
+
.CodeRay .debug { color: white !important; background: blue !important; }
|
55
|
+
|
56
|
+
.CodeRay .annotation { color:#007 }
|
57
|
+
.CodeRay .attribute-name { color:#b48 }
|
58
|
+
.CodeRay .attribute-value { color:#700 }
|
59
|
+
.CodeRay .binary { color:#509 }
|
60
|
+
.CodeRay .char .content { color:#D20 }
|
61
|
+
.CodeRay .char .delimiter { color:#710 }
|
62
|
+
.CodeRay .char { color:#D20 }
|
63
|
+
.CodeRay .class { color:#B06; font-weight:bold }
|
64
|
+
.CodeRay .class-variable { color:#369 }
|
65
|
+
.CodeRay .color { color:#0A0 }
|
66
|
+
.CodeRay .comment { color:#777 }
|
67
|
+
.CodeRay .comment .char { color:#444 }
|
68
|
+
.CodeRay .comment .delimiter { color:#444 }
|
69
|
+
.CodeRay .complex { color:#A08 }
|
70
|
+
.CodeRay .constant { color:#036; font-weight:bold }
|
71
|
+
.CodeRay .decorator { color:#B0B }
|
72
|
+
.CodeRay .definition { color:#099; font-weight:bold }
|
73
|
+
.CodeRay .delimiter { color:black }
|
74
|
+
.CodeRay .directive { color:#088; font-weight:bold }
|
75
|
+
.CodeRay .doc { color:#970 }
|
76
|
+
.CodeRay .doc-string { color:#D42; font-weight:bold }
|
77
|
+
.CodeRay .doctype { color:#34b }
|
78
|
+
.CodeRay .entity { color:#800; font-weight:bold }
|
79
|
+
.CodeRay .error { color:#F00; background-color:#FAA }
|
80
|
+
.CodeRay .escape { color:#666 }
|
81
|
+
.CodeRay .exception { color:#C00; font-weight:bold }
|
82
|
+
.CodeRay .float { color:#60E }
|
83
|
+
.CodeRay .function { color:#06B; font-weight:bold }
|
84
|
+
.CodeRay .global-variable { color:#d70 }
|
85
|
+
.CodeRay .hex { color:#02b }
|
86
|
+
.CodeRay .imaginary { color:#f00 }
|
87
|
+
.CodeRay .include { color:#B44; font-weight:bold }
|
88
|
+
.CodeRay .inline { background-color: hsla(0,0%,0%,0.07); color: black }
|
89
|
+
.CodeRay .inline-delimiter { font-weight: bold; color: #666 }
|
90
|
+
.CodeRay .instance-variable { color:#33B }
|
91
|
+
.CodeRay .integer { color:#00D }
|
92
|
+
.CodeRay .key .char { color: #60f }
|
93
|
+
.CodeRay .key .delimiter { color: #404 }
|
94
|
+
.CodeRay .key { color: #606 }
|
95
|
+
.CodeRay .keyword { color:#080; font-weight:bold }
|
96
|
+
.CodeRay .label { color:#970; font-weight:bold }
|
97
|
+
.CodeRay .local-variable { color:#963 }
|
98
|
+
.CodeRay .namespace { color:#707; font-weight:bold }
|
99
|
+
.CodeRay .octal { color:#40E }
|
100
|
+
.CodeRay .operator { }
|
101
|
+
.CodeRay .predefined { color:#369; font-weight:bold }
|
102
|
+
.CodeRay .predefined-constant { color:#069 }
|
103
|
+
.CodeRay .predefined-type { color:#0a5; font-weight:bold }
|
104
|
+
.CodeRay .preprocessor { color:#579 }
|
105
|
+
.CodeRay .pseudo-class { color:#00C; font-weight:bold }
|
106
|
+
.CodeRay .regexp .content { color:#808 }
|
107
|
+
.CodeRay .regexp .delimiter { color:#404 }
|
108
|
+
.CodeRay .regexp .modifier { color:#C2C }
|
109
|
+
.CodeRay .regexp { background-color:hsla(300,100%,50%,0.06); }
|
110
|
+
.CodeRay .reserved { color:#080; font-weight:bold }
|
111
|
+
.CodeRay .shell .content { color:#2B2 }
|
112
|
+
.CodeRay .shell .delimiter { color:#161 }
|
113
|
+
.CodeRay .shell { background-color:hsla(120,100%,50%,0.06); }
|
114
|
+
.CodeRay .string .char { color: #b0b }
|
115
|
+
.CodeRay .string .content { color: #D20 }
|
116
|
+
.CodeRay .string .delimiter { color: #710 }
|
117
|
+
.CodeRay .string .modifier { color: #E40 }
|
118
|
+
.CodeRay .string { background-color:hsla(0,100%,50%,0.05); }
|
119
|
+
.CodeRay .symbol .content { color:#A60 }
|
120
|
+
.CodeRay .symbol .delimiter { color:#630 }
|
121
|
+
.CodeRay .symbol { color:#A60 }
|
122
|
+
.CodeRay .tag { color:#070 }
|
123
|
+
.CodeRay .type { color:#339; font-weight:bold }
|
124
|
+
.CodeRay .value { color: #088; }
|
125
|
+
.CodeRay .variable { color:#037 }
|
126
|
+
|
127
|
+
.CodeRay .insert { background: hsla(120,100%,50%,0.12) }
|
128
|
+
.CodeRay .delete { background: hsla(0,100%,50%,0.12) }
|
129
|
+
.CodeRay .change { color: #bbf; background: #007; }
|
130
|
+
.CodeRay .head { color: #f8f; background: #505 }
|
131
|
+
.CodeRay .head .filename { color: white; }
|
132
|
+
|
133
|
+
.CodeRay .delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; }
|
134
|
+
.CodeRay .insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; }
|
135
|
+
|
136
|
+
.CodeRay .insert .insert { color: #0c0; background:transparent; font-weight:bold }
|
137
|
+
.CodeRay .delete .delete { color: #c00; background:transparent; font-weight:bold }
|
138
|
+
.CodeRay .change .change { color: #88f }
|
139
|
+
.CodeRay .head .head { color: #f4f }
|
140
|
+
|
141
|
+
table.CodeRay { width: auto }
|
@@ -3,10 +3,4 @@
|
|
3
3
|
|
4
4
|
%ol#index-entries{ :class => 'files' }
|
5
5
|
- values[:files].each do |file|
|
6
|
-
|
7
|
-
- any_hidden = true if hide
|
8
|
-
%li{ :class => hide ? 'other' : nil }= link_to file.name, file.path
|
9
|
-
|
10
|
-
- if any_hidden
|
11
|
-
%li
|
12
|
-
%a.show{ :href => '#', :onclick => 'this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false' } show all
|
6
|
+
%li= link_to file.name, '../' + file.path
|
@@ -9,7 +9,7 @@
|
|
9
9
|
%link{ :rel => "stylesheet", :href => f, :type => "text/css", :media => "screen" }
|
10
10
|
- values[:javascripts].each do |f|
|
11
11
|
%script{ :type => 'text/javascript', :src => f }
|
12
|
-
|
12
|
+
|
13
13
|
%body{ :class => values[:classmod] ? 'class' : 'file' }
|
14
14
|
.navbar.navbar-fixed-top
|
15
15
|
.navbar-inner
|
@@ -52,5 +52,5 @@
|
|
52
52
|
\.
|
53
53
|
%p
|
54
54
|
Generated with the
|
55
|
-
= link_to "Hanna Bootstrap RDoc Generator #{RDoc::Generator::Bootstrap::VERSION}", 'http://github.com/ngs/hanna-
|
55
|
+
= link_to "Hanna Bootstrap RDoc Generator #{RDoc::Generator::Bootstrap::VERSION}", 'http://github.com/ngs/hanna-bootstrap'
|
56
56
|
\.
|
@@ -1,51 +1,27 @@
|
|
1
1
|
- entry = values[:entry]
|
2
2
|
- sections = values[:sections].keys if values.has_key?(:sections)
|
3
|
-
- methods = entry.method_list + entry.attributes
|
4
|
-
- unless methods.empty?
|
5
|
-
#method-list
|
6
|
-
%h2 Methods
|
7
|
-
- %w[attr attr_accessor attr_reader attr_writer class instance].each do |type|
|
8
|
-
- (RDoc::VISIBILITIES rescue RDoc::Context::VISIBILITIES).each do |vis|
|
9
|
-
-# FIXME ugly
|
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
|
-
- unless list.empty?
|
12
|
-
- type_result = ""
|
13
|
-
- if type =~ /^attr_/
|
14
|
-
- type_result += type.sub(/^attr_/, '').capitalize
|
15
|
-
- else
|
16
|
-
- type_result += type.capitalize
|
17
|
-
- type_result = "#{vis.to_s.capitalize} #{type_result}"
|
18
|
-
%h3= type_result
|
19
|
-
%ol
|
20
|
-
- list.each do |method|
|
21
|
-
- if method.respond_to?(:aref)
|
22
|
-
- if method.name.to_s.empty? && method.call_seq
|
23
|
-
%li= link_to method.call_seq.gsub(/<br\s*\/?>/, "").split(/[\r\n]+/).map{ |s| s.split(/([({]+|\[\{|\s+(#?=>|→)\s+)/).first.sub(/^[A-Za-z0-9_:]+\./, "").sub(/\s+=\s+.*/, "=").strip }.uniq.join("<br />\n"), '#' + method.aref
|
24
|
-
- else
|
25
|
-
%li= link_to method.name, '#' + method.aref
|
26
|
-
- elsif method.respond_to?(:html_name)
|
27
|
-
%li= link_to method.name, "#method-#{method.html_name}"
|
28
|
-
- else
|
29
|
-
%li= method.name
|
30
3
|
|
31
4
|
- if entry.requires or sections or entry.includes
|
32
5
|
#context
|
33
6
|
- unless entry.requires.empty?
|
34
|
-
|
7
|
+
- no_content = false
|
8
|
+
%section#requires
|
35
9
|
%h2 Required files
|
36
10
|
%ol
|
37
11
|
- entry.requires.each do |req|
|
38
12
|
%li= req.name
|
39
13
|
|
40
14
|
- if sections && (sections.length > 1 || sections.first.title.to_s != '')
|
41
|
-
|
15
|
+
- no_content = false
|
16
|
+
%section#contents
|
42
17
|
%h2 Contents
|
43
18
|
%ol
|
44
19
|
- sections.sort_by{|s| s.title.to_s}.each do |section|
|
45
20
|
%li= link_to section.title, "##{section.aref}"
|
46
21
|
|
47
22
|
- unless entry.includes.empty?
|
48
|
-
|
23
|
+
- no_content = false
|
24
|
+
%section#includes
|
49
25
|
%h2 Included modules
|
50
26
|
%ol
|
51
27
|
- entry.includes.each do |inc|
|
@@ -53,4 +29,3 @@
|
|
53
29
|
%li= inc.name
|
54
30
|
- else
|
55
31
|
%li= link_to inc.name, entry.aref_to(mod.path)
|
56
|
-
|
@@ -1,46 +1,77 @@
|
|
1
|
+
- entry = values[:entry]
|
1
2
|
- file_page = !values[:classmod]
|
2
|
-
-
|
3
|
+
- methods = entry.method_list + entry.attributes
|
4
|
+
- description = entry.description
|
5
|
+
- title_in_description = description && (description =~ /<h(1|2[^>]*?)>/i)
|
6
|
+
- description.gsub!(%r{<h(1|2)[^>]*?>(?<tag>.*?)</h(1|2)>}){|m| %Q[<div class="page-header">#{m}</div>] }
|
7
|
+
- title = capture_haml do
|
8
|
+
- if file_page
|
9
|
+
= values[:title]
|
10
|
+
- else
|
11
|
+
%span.type= values[:classmod]
|
12
|
+
= values[:entry].full_name
|
3
13
|
|
4
|
-
|
5
|
-
.
|
6
|
-
- title = capture_haml do
|
7
|
-
- if file_page
|
8
|
-
= values[:file].name
|
9
|
-
- else
|
10
|
-
%span.type= values[:classmod]
|
11
|
-
= values[:entry].full_name
|
14
|
+
.row
|
15
|
+
.span9
|
12
16
|
- if title_in_description
|
13
17
|
.name= title
|
14
18
|
- else
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
.page-header
|
20
|
+
%h1.name
|
21
|
+
= title
|
22
|
+
%section#content
|
23
|
+
#text
|
24
|
+
- if values[:description]
|
25
|
+
#description~ sanitize_code_blocks values[:description]
|
26
|
+
= content = yield
|
27
|
+
-# empty = content.gsub(/[\s\n]/, '').gsub(%r{</?[^>]+?>}, '').empty? && values[:description].empty?
|
28
|
+
|
29
|
+
.span3
|
30
|
+
%ul.nav.nav-list
|
31
|
+
|
32
|
+
- if file_page
|
33
|
+
%li.nav-header Path
|
34
|
+
%li= values[:file].relative_name
|
35
|
+
|
36
|
+
- else
|
37
|
+
%li.nav-header Defined IN
|
22
38
|
- values[:entry].in_files.each_with_index do |file, index|
|
23
|
-
%li{ :class => index > 0 ? 'other' : nil }
|
24
|
-
-# FIXME cleanup
|
25
|
-
= link_to file.full_name, Pathname.new(file.path).relative_path_from(Pathname.new(values[:entry].path).dirname)
|
26
|
-
- if values[:entry].in_files.size > 1
|
27
39
|
%li
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
= link_to file.full_name, Pathname.new(file.path).relative_path_from(Pathname.new(values[:entry].path).dirname)
|
41
|
+
|
42
|
+
- if values[:entry].parent
|
43
|
+
%li.nav-header Parent
|
44
|
+
%li
|
45
|
+
%strong
|
46
|
+
= link_to values[:entry].parent.name, Pathname.new(class_dir) + Pathname.new(values[:entry].parent.path).relative_path_from(Pathname.new values[:entry].path)
|
47
|
+
|
48
|
+
- if values[:entry].respond_to?(:last_modified) and values[:entry].last_modified
|
49
|
+
%li.nav-header Last Update
|
50
|
+
%li
|
51
|
+
%span.datetime= values[:entry].last_modified
|
52
|
+
|
53
|
+
- unless methods.empty?
|
54
|
+
%li.divider
|
55
|
+
- %w[attr attr_accessor attr_reader attr_writer class instance].each do |type|
|
56
|
+
- (RDoc::VISIBILITIES rescue RDoc::Context::VISIBILITIES).each do |vis|
|
57
|
+
- 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
|
58
|
+
- unless list.empty?
|
59
|
+
- type_result = ""
|
60
|
+
- if type =~ /^attr_/
|
61
|
+
- type_result += type.sub(/^attr_/, '').capitalize
|
62
|
+
- else
|
63
|
+
- type_result += type.capitalize
|
64
|
+
- type_result = "#{vis.to_s.capitalize} #{type_result}"
|
65
|
+
%li.nav-header= type_result
|
66
|
+
- list.each do |method|
|
67
|
+
- if method.respond_to?(:aref)
|
68
|
+
- if method.name.to_s.empty? && method.call_seq
|
69
|
+
%li= link_to method.call_seq.gsub(/<br\s*\/?>/, "").split(/[\r\n]+/).map{ |s| s.split(/([({]+|\[\{|\s+(#?=>|→)\s+)/).first.sub(/^[A-Za-z0-9_:]+\./, "").sub(/\s+=\s+.*/, "=").strip }.uniq.join("<br />\n"), '#' + method.aref
|
70
|
+
- else
|
71
|
+
%li= link_to method.name, '#' + method.aref
|
72
|
+
- elsif method.respond_to?(:html_name)
|
73
|
+
%li= link_to method.name, "#method-#{method.html_name}"
|
74
|
+
- else
|
75
|
+
%li= method.name
|
76
|
+
|
77
|
+
|
@@ -1,33 +1,39 @@
|
|
1
1
|
- unless values[:entry].classes_and_modules.empty?
|
2
2
|
#class-list
|
3
3
|
%h2 Classes and Modules
|
4
|
-
%
|
5
|
-
-
|
6
|
-
%li
|
4
|
+
%ul
|
5
|
+
- values[:entry].modules.sort.each do |mod|
|
6
|
+
%li
|
7
|
+
%span.type MODULE
|
8
|
+
= link_to mod.full_name, values[:entry].aref_to(mod.path)
|
9
|
+
- values[:entry].classes.sort.each do |mod|
|
10
|
+
%li
|
11
|
+
%span.type CLASS
|
12
|
+
= link_to mod.full_name, values[:entry].aref_to(mod.path)
|
7
13
|
|
8
14
|
- values[:sections].sort_by{|s, h| s.title.to_s}.each do |section, h|
|
9
15
|
- constants, attributes, alias_types, method_types = h.values_at(:constants, :attributes, :alias_types, :method_types)
|
10
16
|
#section
|
11
17
|
- if section.title.to_s != ''
|
12
|
-
%h2
|
18
|
+
%h2
|
13
19
|
%a{ :name =>section.aref }= section.title
|
14
20
|
- if section.comment
|
15
21
|
.section-comment= section.description
|
16
|
-
|
22
|
+
|
17
23
|
- unless constants.empty?
|
18
24
|
#constants-list
|
19
25
|
%h2 Constants
|
20
26
|
.name-list
|
21
|
-
%table{ :summary => "Constants" }
|
27
|
+
%table.table-striped.table{ :summary => "Constants" }
|
22
28
|
- constants.each do |const|
|
23
29
|
%tr.top-aligned-row.context-row
|
24
|
-
%
|
30
|
+
%th.context-item-name= const.name
|
25
31
|
%td =
|
26
32
|
%td.context-item-value= const.value
|
27
33
|
- if const.description then
|
28
34
|
%td
|
29
35
|
%td.context-item-desc= const.description
|
30
|
-
|
36
|
+
|
31
37
|
- unless alias_types.empty?
|
32
38
|
- alias_types.each do |type, aliases|
|
33
39
|
#aliases-list
|
@@ -41,7 +47,7 @@
|
|
41
47
|
%td.context-item-value= link_to alia.is_alias_for.name, "##{alia.is_alias_for.aref}"
|
42
48
|
- unless alia.description.empty?
|
43
49
|
%td.context-item-desc= alia.description
|
44
|
-
|
50
|
+
|
45
51
|
- unless attributes.empty?
|
46
52
|
#attribute-list
|
47
53
|
%h2.section-bar Attributes
|
@@ -53,36 +59,44 @@
|
|
53
59
|
%a{:name => attrib.aref}=attrib.name
|
54
60
|
%td.context-item-value= attrib.rw ? "[#{attrib.rw}]" : ' '
|
55
61
|
%td.context-item-desc~ sanitize_code_blocks(attrib.description)
|
56
|
-
|
62
|
+
|
57
63
|
- unless method_types.empty?
|
58
64
|
#methods
|
59
65
|
- method_types.each do |type, list|
|
60
66
|
- unless list.empty?
|
61
|
-
%
|
62
|
-
|
63
|
-
|
64
|
-
.
|
67
|
+
%article{ id: "#{type.downcase}-methods" }
|
68
|
+
%h2== #{type} methods
|
69
|
+
|
70
|
+
- list.each do |method|
|
65
71
|
%a{ :name => method.aref }
|
66
|
-
.
|
67
|
-
|
68
|
-
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
.description
|
82
|
-
|
83
|
-
|
84
|
-
.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
72
|
+
%section.method{ :id => "method-#{method.aref}", :class => "#{type.gsub(/\s+/, '-')}".downcase }
|
73
|
+
%h3.synopsis
|
74
|
+
- method_html = capture_haml do
|
75
|
+
- if method.call_seq
|
76
|
+
%span.name
|
77
|
+
- method.call_seq.split(/\r?\n/).each do |seq|
|
78
|
+
%div=seq
|
79
|
+
- else
|
80
|
+
%span.name= method.name
|
81
|
+
%span.arguments= method.params
|
82
|
+
-#- if method[:codeurl]
|
83
|
+
-#%a.method-signature{ :href => method[:codeurl], :onclick => "popupCode(this.href); return false", :target => "Code" }
|
84
|
+
-#= method_html
|
85
|
+
-#- else
|
86
|
+
= method_html
|
87
|
+
- if method.description
|
88
|
+
.description
|
89
|
+
~ sanitize_code_blocks method.description
|
90
|
+
- if method.markup_code
|
91
|
+
.source
|
92
|
+
- name = "#{method.aref}-source"
|
93
|
+
%a.btn.btn-mini.source-toggle.collapsed{ href: "##{name}", data: { toggle: 'collapse' } }
|
94
|
+
%span.show
|
95
|
+
%span.icon-resize-full
|
96
|
+
Show
|
97
|
+
%span.hide
|
98
|
+
%span.icon-resize-small
|
99
|
+
Hide
|
100
|
+
Source
|
101
|
+
%div.collapse{ id: name }
|
102
|
+
= highlighted_code_block method
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanna-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -22,7 +22,23 @@ dependencies:
|
|
22
22
|
- - ! '>='
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '0'
|
25
|
-
type: :
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: coderay
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
26
42
|
prerelease: false
|
27
43
|
version_requirements: !ruby/object:Gem::Requirement
|
28
44
|
none: false
|
@@ -38,7 +54,7 @@ dependencies:
|
|
38
54
|
- - ! '>='
|
39
55
|
- !ruby/object:Gem::Version
|
40
56
|
version: '0'
|
41
|
-
type: :
|
57
|
+
type: :runtime
|
42
58
|
prerelease: false
|
43
59
|
version_requirements: !ruby/object:Gem::Requirement
|
44
60
|
none: false
|
@@ -54,7 +70,7 @@ dependencies:
|
|
54
70
|
- - ! '>='
|
55
71
|
- !ruby/object:Gem::Version
|
56
72
|
version: '0'
|
57
|
-
type: :
|
73
|
+
type: :runtime
|
58
74
|
prerelease: false
|
59
75
|
version_requirements: !ruby/object:Gem::Requirement
|
60
76
|
none: false
|
@@ -70,7 +86,7 @@ dependencies:
|
|
70
86
|
- - ! '>='
|
71
87
|
- !ruby/object:Gem::Version
|
72
88
|
version: '0'
|
73
|
-
type: :
|
89
|
+
type: :runtime
|
74
90
|
prerelease: false
|
75
91
|
version_requirements: !ruby/object:Gem::Requirement
|
76
92
|
none: false
|
@@ -86,7 +102,7 @@ dependencies:
|
|
86
102
|
- - ! '>='
|
87
103
|
- !ruby/object:Gem::Version
|
88
104
|
version: '0'
|
89
|
-
type: :
|
105
|
+
type: :runtime
|
90
106
|
prerelease: false
|
91
107
|
version_requirements: !ruby/object:Gem::Requirement
|
92
108
|
none: false
|
@@ -102,7 +118,7 @@ dependencies:
|
|
102
118
|
- - ! '>='
|
103
119
|
- !ruby/object:Gem::Version
|
104
120
|
version: '0'
|
105
|
-
type: :
|
121
|
+
type: :runtime
|
106
122
|
prerelease: false
|
107
123
|
version_requirements: !ruby/object:Gem::Requirement
|
108
124
|
none: false
|
@@ -129,6 +145,7 @@ files:
|
|
129
145
|
- lib/hanna-bootstrap/template_files/bootstrap.min.css
|
130
146
|
- lib/hanna-bootstrap/template_files/bootstrap.min.js
|
131
147
|
- lib/hanna-bootstrap/template_files/class_index.haml
|
148
|
+
- lib/hanna-bootstrap/template_files/coderay.css
|
132
149
|
- lib/hanna-bootstrap/template_files/file_index.haml
|
133
150
|
- lib/hanna-bootstrap/template_files/glyphicons-halflings-white.png
|
134
151
|
- lib/hanna-bootstrap/template_files/glyphicons-halflings.png
|
@@ -138,6 +155,7 @@ files:
|
|
138
155
|
- lib/hanna-bootstrap/template_files/method_list.haml
|
139
156
|
- lib/hanna-bootstrap/template_files/page.haml
|
140
157
|
- lib/hanna-bootstrap/template_files/sections.haml
|
158
|
+
- lib/hanna-bootstrap/version.rb
|
141
159
|
- lib/rdoc/discover.rb
|
142
160
|
homepage: http://github.com/ngs/hanna-bootstrap
|
143
161
|
licenses:
|