diff --git a/extras/rdoc/generator/singledarkfish.rb b/extras/rdoc/generator/singledarkfish.rb index 2508730..4819985 100644 --- a/extras/rdoc/generator/singledarkfish.rb +++ b/extras/rdoc/generator/singledarkfish.rb @@ -63,7 +63,7 @@ class RDoc::Generator::SingleDarkfish < RDoc::Generator::Darkfish org = instance_method(:http_url) define_method(:http_url) do |prefix| if RDoc::Generator::SingleDarkfish.current? - prefix + full_name + prefix + full_name.gsub("::", '-') else org.bind(self).call(prefix) end @@ -74,7 +74,7 @@ class RDoc::Generator::SingleDarkfish < RDoc::Generator::Darkfish org = instance_method(:path) define_method(:path) do if RDoc::Generator::SingleDarkfish.current? - "##{@aref}" + "/api.html##{@aref}" else org.bind(self).call end @@ -115,7 +115,7 @@ def initialize( options ) ###### def class_dir - '#class-' + '/api.html#class-' end def template(name) @@ -164,6 +164,18 @@ def generate_thing(name, to) render_template(templatefile, binding, outfile) end + def methods_for(klass) + klass.methods_by_type.each do |type, visibilities| + next if visibilities.empty? + visibilities.each do |visibility, methods| + next if methods.empty? + methods.each do |method| + yield method, type, visibility + end + end + end + end + ## For book.rhtml def chapters diff --git a/extras/rdoc/generator/template/flipbook/js/camping.js b/extras/rdoc/generator/template/flipbook/js/camping.js index 22839f5..72b72b9 100644 --- a/extras/rdoc/generator/template/flipbook/js/camping.js +++ b/extras/rdoc/generator/template/flipbook/js/camping.js @@ -1,3 +1,4 @@ +// I know, I know. $(function() { $('.source-link a').click(function() { var link = $(this); @@ -11,4 +12,68 @@ $(function() { } return false; }); + + if ($('.ref')[0]) { + + $('.mod').hide(); + $('.method').hide(); + + var hash = window.location.hash.replace(/--$/, ''); + + if (hash.substring(0, 2) == "#M") { + // Show the method and the section + m(hash).show(); + } else if (hash.substring(0, 7) == "#class-") { + // Show the section. + s(hash).show(); + } else { + // Show the first section. + s("h2:first").show(); + } + + // We need to scroll! + if (hash != window.location.hash) { + window.location.hash = hash; + } + + $('a[href*="#class-"]').click(function() { + var link = this.href; + var id = link.substring(link.indexOf("#")); + if ($(this).parent().is("h2")) { + // We're in a headline + s(id).toggle(); + window.location.hash = id + "--"; + return false; + } else { + // A normal link + s(id).show(); + } + }); + + $('a[href*="#M"]').click(function() { + var link = this.href; + var id = link.substring(link.indexOf("#")); + if ($(this).parent().is("h4")) { + // We're in a headline + window.location.hash = id + "--"; + s(id).toggle(); + return false; + } else { + // Normal link + m(id).show(); + } + }); + + // #M0001 -> $(the section + the method body) + function m(name) { + var base = $(name); + return base.parent().add(base.next()); + } + + // #class-something -> $(the section below) + function s(name) { + return $(name).next(); + } + } + }); \ No newline at end of file diff --git a/extras/rdoc/generator/template/flipbook/page.rhtml b/extras/rdoc/generator/template/flipbook/page.rhtml index ed5e5a9..f83ea1f 100644 --- a/extras/rdoc/generator/template/flipbook/page.rhtml +++ b/extras/rdoc/generator/template/flipbook/page.rhtml @@ -12,8 +12,8 @@
Camping <%= VERS %>
diff --git a/extras/rdoc/generator/template/flipbook/rdoc.css b/extras/rdoc/generator/template/flipbook/rdoc.css index 3f91e12..f7ddc8b 100644 --- a/extras/rdoc/generator/template/flipbook/rdoc.css +++ b/extras/rdoc/generator/template/flipbook/rdoc.css @@ -19,7 +19,6 @@ h1 { font-size: 36px; margin: 1em; } h2 { font-size: 24px } h3, p#version { font-size: 19px } h4 { font-size: 17px; font-weight: normal; } -h4.ruled { border-bottom: solid 1px #CC9; } h2.ruled { padding-top: 35px; border-top: solid 1px #AA5; } /* Link styles */ @@ -71,14 +70,33 @@ h2.ruled { padding-top: 35px; border-top: solid 1px #AA5; } text-align: center; } -.permalink { - background-image: url(images/permalink.gif); - text-indent: -1000px; - height: 11px; - width: 11px; - display: inline-block; +.ref h2 a { + background-color: #eee; + color: black; + display: block; + text-align: left; + text-decoration: none; + padding: 0.5em 1em; } +.ref h2 a:hover { + text-decoration: underline; +} + +.ref h4 a { + border-bottom: solid 1px #CC9; + color: #000; + display: block; + text-decoration: none; +} + +.ref h4 a:hover { + border-color: #694; +} + +.ref .mod { + padding: 0 2em; +} pre { font-weight: bold; color: #730; } tt { color: #703; font-size: 12pt; } diff --git a/extras/rdoc/generator/template/flipbook/readme.rhtml b/extras/rdoc/generator/template/flipbook/readme.rhtml index 580f1ec..aef6f3c 100644 --- a/extras/rdoc/generator/template/flipbook/readme.rhtml +++ b/extras/rdoc/generator/template/flipbook/readme.rhtml @@ -11,8 +11,8 @@Camping <%= VERS %>
diff --git a/extras/rdoc/generator/template/flipbook/reference.rhtml b/extras/rdoc/generator/template/flipbook/reference.rhtml index 2344b2f..4f688d9 100644 --- a/extras/rdoc/generator/template/flipbook/reference.rhtml +++ b/extras/rdoc/generator/template/flipbook/reference.rhtml @@ -11,53 +11,60 @@Camping <%= VERS %>
<%= Time.now %>
[ show source ]
+[ show source ]
<%= method.markup_code %>- <% end - end - end - end %> +