rdoc 3.9.5 → 3.10.pre.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (183) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +6 -3
  3. data/History.txt +63 -13
  4. data/LICENSE.rdoc +57 -0
  5. data/Manifest.txt +60 -6
  6. data/Rakefile +24 -12
  7. data/TODO.rdoc +30 -0
  8. data/bin/rdoc +0 -2
  9. data/lib/rdoc.rb +55 -2
  10. data/lib/rdoc/alias.rb +0 -2
  11. data/lib/rdoc/anon_class.rb +0 -2
  12. data/lib/rdoc/any_method.rb +0 -3
  13. data/lib/rdoc/attr.rb +0 -2
  14. data/lib/rdoc/class_module.rb +40 -7
  15. data/lib/rdoc/code_object.rb +1 -3
  16. data/lib/rdoc/code_objects.rb +3 -21
  17. data/lib/rdoc/comment.rb +225 -0
  18. data/lib/rdoc/constant.rb +0 -2
  19. data/lib/rdoc/context.rb +37 -120
  20. data/lib/rdoc/context/section.rb +114 -0
  21. data/lib/rdoc/cross_reference.rb +16 -7
  22. data/lib/rdoc/encoding.rb +0 -2
  23. data/lib/rdoc/gauntlet.rb +1 -1
  24. data/lib/rdoc/generator.rb +7 -2
  25. data/lib/rdoc/generator/darkfish.rb +126 -20
  26. data/lib/rdoc/generator/json_index.rb +240 -0
  27. data/lib/rdoc/generator/markup.rb +17 -54
  28. data/lib/rdoc/generator/ri.rb +0 -3
  29. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  30. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -0
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +18 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +9 -0
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +8 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +16 -0
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +12 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +7 -0
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +12 -0
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +10 -0
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +10 -0
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +10 -0
  41. data/lib/rdoc/generator/template/darkfish/class.rhtml +161 -0
  42. data/lib/rdoc/generator/template/darkfish/fileinfo.rhtml +32 -0
  43. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  44. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/index.rhtml +16 -61
  48. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +99 -64
  49. data/lib/rdoc/generator/template/darkfish/js/jquery.js +15 -29
  50. data/lib/rdoc/generator/template/darkfish/js/search.js +94 -0
  51. data/lib/rdoc/generator/template/darkfish/page.rhtml +16 -0
  52. data/lib/rdoc/generator/template/darkfish/rdoc.css +126 -286
  53. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +50 -0
  54. data/lib/rdoc/generator/template/json_index/js/navigation.js +142 -0
  55. data/lib/rdoc/generator/template/json_index/js/searcher.js +228 -0
  56. data/lib/rdoc/ghost_method.rb +0 -2
  57. data/lib/rdoc/include.rb +0 -2
  58. data/lib/rdoc/markup.rb +204 -43
  59. data/lib/rdoc/markup/attr_changer.rb +25 -0
  60. data/lib/rdoc/markup/attr_span.rb +29 -0
  61. data/lib/rdoc/markup/attribute.rb +51 -0
  62. data/lib/rdoc/markup/document.rb +22 -1
  63. data/lib/rdoc/markup/formatter.rb +4 -11
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -2
  65. data/lib/rdoc/markup/heading.rb +44 -0
  66. data/lib/rdoc/markup/include.rb +42 -0
  67. data/lib/rdoc/markup/inline.rb +1 -144
  68. data/lib/rdoc/markup/list.rb +2 -1
  69. data/lib/rdoc/markup/parser.rb +6 -16
  70. data/lib/rdoc/markup/pre_process.rb +64 -10
  71. data/lib/rdoc/markup/raw.rb +1 -1
  72. data/lib/rdoc/markup/special.rb +40 -0
  73. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -2
  74. data/lib/rdoc/markup/to_ansi.rb +0 -2
  75. data/lib/rdoc/markup/to_bs.rb +0 -2
  76. data/lib/rdoc/markup/to_html.rb +102 -34
  77. data/lib/rdoc/markup/to_html_crossref.rb +36 -5
  78. data/lib/rdoc/markup/to_html_snippet.rb +270 -0
  79. data/lib/rdoc/markup/to_label.rb +55 -0
  80. data/lib/rdoc/markup/to_rdoc.rb +0 -3
  81. data/lib/rdoc/markup/to_table_of_contents.rb +62 -0
  82. data/lib/rdoc/markup/to_test.rb +0 -3
  83. data/lib/rdoc/markup/to_tt_only.rb +0 -3
  84. data/lib/rdoc/markup/verbatim.rb +18 -0
  85. data/lib/rdoc/meta_method.rb +0 -2
  86. data/lib/rdoc/method_attr.rb +17 -1
  87. data/lib/rdoc/normal_class.rb +0 -2
  88. data/lib/rdoc/normal_module.rb +0 -2
  89. data/lib/rdoc/options.rb +18 -3
  90. data/lib/rdoc/parser.rb +74 -42
  91. data/lib/rdoc/parser/c.rb +79 -118
  92. data/lib/rdoc/parser/rd.rb +22 -0
  93. data/lib/rdoc/parser/ruby.rb +86 -54
  94. data/lib/rdoc/parser/simple.rb +21 -9
  95. data/lib/rdoc/parser/text.rb +11 -0
  96. data/lib/rdoc/rd.rb +95 -0
  97. data/lib/rdoc/rd/block_parser.ry +638 -0
  98. data/lib/rdoc/rd/inline.rb +71 -0
  99. data/lib/rdoc/rd/inline_parser.ry +575 -0
  100. data/lib/rdoc/rdoc.rb +8 -23
  101. data/lib/rdoc/require.rb +0 -2
  102. data/lib/rdoc/ri.rb +4 -2
  103. data/lib/rdoc/ri/driver.rb +2 -6
  104. data/lib/rdoc/ri/store.rb +0 -1
  105. data/lib/rdoc/ruby_lex.rb +43 -20
  106. data/lib/rdoc/ruby_token.rb +44 -2
  107. data/lib/rdoc/single_class.rb +0 -2
  108. data/lib/rdoc/stats.rb +0 -5
  109. data/lib/rdoc/task.rb +2 -6
  110. data/lib/rdoc/test_case.rb +59 -0
  111. data/lib/rdoc/text.rb +42 -30
  112. data/lib/rdoc/token_stream.rb +45 -0
  113. data/lib/rdoc/tom_doc.rb +232 -0
  114. data/lib/rdoc/top_level.rb +36 -4
  115. data/test/test_attribute_manager.rb +26 -29
  116. data/test/test_rdoc_any_method.rb +2 -26
  117. data/test/test_rdoc_attr.rb +4 -4
  118. data/test/test_rdoc_class_module.rb +95 -12
  119. data/test/test_rdoc_code_object.rb +10 -3
  120. data/test/test_rdoc_comment.rb +504 -0
  121. data/test/test_rdoc_context.rb +60 -11
  122. data/test/test_rdoc_context_section.rb +16 -17
  123. data/test/test_rdoc_cross_reference.rb +17 -2
  124. data/test/test_rdoc_encoding.rb +4 -7
  125. data/test/test_rdoc_generator_darkfish.rb +12 -11
  126. data/test/test_rdoc_generator_json_index.rb +255 -0
  127. data/test/test_rdoc_generator_markup.rb +56 -0
  128. data/test/test_rdoc_generator_ri.rb +8 -11
  129. data/test/test_rdoc_markup.rb +9 -5
  130. data/test/test_rdoc_markup_attribute_manager.rb +5 -8
  131. data/test/test_rdoc_markup_document.rb +34 -6
  132. data/test/test_rdoc_markup_formatter.rb +11 -13
  133. data/test/test_rdoc_markup_heading.rb +20 -0
  134. data/test/test_rdoc_markup_include.rb +19 -0
  135. data/test/test_rdoc_markup_indented_paragraph.rb +4 -5
  136. data/test/test_rdoc_markup_paragraph.rb +2 -5
  137. data/test/test_rdoc_markup_parser.rb +87 -7
  138. data/test/test_rdoc_markup_pre_process.rb +60 -9
  139. data/test/test_rdoc_markup_raw.rb +4 -6
  140. data/test/test_rdoc_markup_to_ansi.rb +1 -4
  141. data/test/test_rdoc_markup_to_bs.rb +1 -4
  142. data/test/test_rdoc_markup_to_html.rb +170 -31
  143. data/test/test_rdoc_markup_to_html_crossref.rb +89 -11
  144. data/test/test_rdoc_markup_to_html_snippet.rb +668 -0
  145. data/test/test_rdoc_markup_to_label.rb +50 -0
  146. data/test/test_rdoc_markup_to_rdoc.rb +1 -4
  147. data/test/test_rdoc_markup_to_table_of_contents.rb +90 -0
  148. data/test/test_rdoc_markup_to_tt_only.rb +1 -4
  149. data/test/test_rdoc_markup_verbatim.rb +16 -0
  150. data/test/test_rdoc_method_attr.rb +16 -1
  151. data/test/test_rdoc_options.rb +17 -7
  152. data/test/test_rdoc_parser.rb +75 -6
  153. data/test/test_rdoc_parser_c.rb +56 -104
  154. data/test/test_rdoc_parser_rd.rb +52 -0
  155. data/test/test_rdoc_parser_ruby.rb +264 -323
  156. data/test/test_rdoc_parser_simple.rb +33 -17
  157. data/test/test_rdoc_rd.rb +30 -0
  158. data/test/test_rdoc_rd_block_parser.rb +527 -0
  159. data/test/test_rdoc_rd_inline.rb +63 -0
  160. data/test/test_rdoc_rd_inline_parser.rb +173 -0
  161. data/test/test_rdoc_rdoc.rb +7 -9
  162. data/test/test_rdoc_ri_driver.rb +10 -15
  163. data/test/test_rdoc_ri_paths.rb +6 -6
  164. data/test/test_rdoc_ri_store.rb +6 -13
  165. data/test/test_rdoc_ruby_lex.rb +53 -5
  166. data/test/test_rdoc_rubygems_hook.rb +2 -1
  167. data/test/test_rdoc_stats.rb +83 -103
  168. data/test/test_rdoc_task.rb +5 -4
  169. data/test/test_rdoc_text.rb +156 -11
  170. data/test/test_rdoc_token_stream.rb +42 -0
  171. data/test/test_rdoc_tom_doc.rb +458 -0
  172. data/test/test_rdoc_top_level.rb +49 -2
  173. data/test/xref_test_case.rb +4 -8
  174. metadata +217 -111
  175. metadata.gz.sig +0 -0
  176. checksums.yaml +0 -7
  177. checksums.yaml.gz.sig +0 -0
  178. data/CVE-2013-0256.rdoc +0 -49
  179. data/LICENSE.txt +0 -57
  180. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -321
  181. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -124
  182. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  183. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
@@ -0,0 +1,7 @@
1
+ <nav id="home-section" class="section">
2
+ <h3 class="section-header">
3
+ <a href="<%= rel_prefix %>/index.html">Home</a>
4
+ <a href="<%= rel_prefix %>/table_of_contents.html#classes">Classes</a>
5
+ <a href="<%= rel_prefix %>/table_of_contents.html#methods">Methods</a>
6
+ </h3>
7
+ </nav>
@@ -0,0 +1,12 @@
1
+ <% simple_files = @files.select { |f| f.text? } %>
2
+ <% unless simple_files.empty? then %>
3
+ <nav id="fileindex-section" class="section project-section">
4
+ <h3 class="section-header">Pages</h3>
5
+
6
+ <ul>
7
+ <% simple_files.each do |f| %>
8
+ <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
9
+ <% end %>
10
+ </ul>
11
+ </nav>
12
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% if klass.type == 'class' then %>
2
+ <nav id="parent-class-section" class="section">
3
+ <h3 class="section-header">Parent</h3>
4
+ <% if klass.superclass and not String === klass.superclass then %>
5
+ <p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a>
6
+ <% else %>
7
+ <p class="link"><%= klass.superclass %>
8
+ <% end %>
9
+ </nav>
10
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <nav id="search-section" class="section project-section" class="initially-hidden">
2
+ <form action="#" method="get" accept-charset="utf-8">
3
+ <h3 class="section-header">
4
+ <input type="text" name="search" placeholder="Search" id="search-field"
5
+ title="Type to search, Up and Down to navigate, Enter to load">
6
+ </h3>
7
+ </form>
8
+
9
+ <ul id="search-results" class="initially-hidden"></ul>
10
+ </nav>
@@ -0,0 +1,10 @@
1
+ <% unless klass.sections.length == 1 then %>
2
+ <nav id="sections-section" class="section">
3
+ <h3 class="section-header">Sections</h3>
4
+ <ul class="link-list">
5
+ <% klass.sort_sections.each do |section| %>
6
+ <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
7
+ <% end %>
8
+ </ul>
9
+ </nav>
10
+ <% end %>
@@ -0,0 +1,161 @@
1
+ <body id="top" class="<%= klass.type %>">
2
+ <nav id="metadata">
3
+ <%= render '_sidebar_navigation.rhtml' %>
4
+
5
+ <%= render '_sidebar_search.rhtml' %>
6
+
7
+ <div id="file-metadata">
8
+ <%= render '_sidebar_in_files.rhtml' %>
9
+ <%= render '_sidebar_VCS_info.rhtml' %>
10
+ </div>
11
+
12
+ <div id="class-metadata">
13
+ <%= render '_sidebar_sections.rhtml' %>
14
+ <%= render '_sidebar_parent.rhtml' %>
15
+ <%= render '_sidebar_includes.rhtml' %>
16
+ <%= render '_sidebar_methods.rhtml' %>
17
+ </div>
18
+
19
+ <div id="project-metadata">
20
+ <%= render '_sidebar_pages.rhtml' %>
21
+ <%= render '_sidebar_classes.rhtml' %>
22
+ </div>
23
+ </nav>
24
+
25
+ <div id="documentation">
26
+ <h1 class="<%= klass.type %>"><%= klass.type %> <%= klass.full_name %></h1>
27
+
28
+ <div id="description" class="description">
29
+ <%= klass.description %>
30
+ </div><!-- description -->
31
+
32
+ <% klass.each_section do |section, constants, attributes| %>
33
+ <% constants = constants.select { |const| const.display? } %>
34
+ <% attributes = attributes.select { |attr| attr.display? } %>
35
+ <section id="<%= section.aref %>" class="documentation-section">
36
+ <% if section.title then %>
37
+ <div class="documentation-section-title">
38
+ <h2 class="section-header">
39
+ <%= section.title %>
40
+ </h2>
41
+ <span class="section-click-top">
42
+ <a href="#top">&uarr; top</a>
43
+ </span>
44
+ </div>
45
+ <% end %>
46
+
47
+ <% if section.comment then %>
48
+ <div class="description">
49
+ <%= section.description %>
50
+ </div>
51
+ <% end %>
52
+
53
+ <% unless constants.empty? then %>
54
+ <!-- Constants -->
55
+ <section id="constants-list" class="section">
56
+ <h3 class="section-header">Constants</h3>
57
+ <dl>
58
+ <% constants.each do |const| %>
59
+ <dt id="<%= const.name %>"><%= const.name %>
60
+ <% if const.comment then %>
61
+ <dd class="description"><%= const.description.strip %>
62
+ <% else %>
63
+ <dd class="description missing-docs">(Not documented)
64
+ <% end %>
65
+ <% end %>
66
+ </dl>
67
+ </section>
68
+ <% end %>
69
+
70
+ <% unless attributes.empty? then %>
71
+ <!-- Attributes -->
72
+ <section id="attribute-method-details" class="method-section section">
73
+ <h3 class="section-header">Attributes</h3>
74
+
75
+ <% attributes.each do |attrib| %>
76
+ <div id="<%= attrib.aref %>" class="method-detail">
77
+ <div class="method-heading attribute-method-heading">
78
+ <span class="method-name"><%= h attrib.name %></span><span
79
+ class="attribute-access-type">[<%= attrib.rw %>]</span>
80
+ </div>
81
+
82
+ <div class="method-description">
83
+ <% if attrib.comment then %>
84
+ <%= attrib.description.strip %>
85
+ <% else %>
86
+ <p class="missing-docs">(Not documented)
87
+ <% end %>
88
+ </div>
89
+ </div>
90
+ <% end %>
91
+ </section><!-- attribute-method-details -->
92
+ <% end %>
93
+
94
+ <!-- Methods -->
95
+ <% klass.methods_by_type(section).each do |type, visibilities|
96
+ next if visibilities.empty?
97
+ visibilities.each do |visibility, methods|
98
+ next if methods.empty? %>
99
+ <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section section">
100
+ <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
101
+
102
+ <% methods.each do |method| %>
103
+ <div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
104
+ <% if method.call_seq then %>
105
+ <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
106
+ <div class="method-heading">
107
+ <span class="method-callseq"><%= h call_seq.strip.gsub(/->/, '&rarr;').gsub( /^\w+\./m, '') %></span>
108
+ <% if i == 0 then %>
109
+ <span class="method-click-advice">click to toggle source</span>
110
+ <% end %>
111
+ </div>
112
+ <% end %>
113
+ <% else %>
114
+ <div class="method-heading">
115
+ <span class="method-name"><%= h method.name %></span><span
116
+ class="method-args"><%= method.params %></span>
117
+ <span class="method-click-advice">click to toggle source</span>
118
+ </div>
119
+ <% end %>
120
+
121
+ <div class="method-description">
122
+ <% if method.comment then %>
123
+ <%= method.description.strip %>
124
+ <% else %>
125
+ <p class="missing-docs">(Not documented)
126
+ <% end %>
127
+
128
+ <% if method.token_stream then %>
129
+ <div class="method-source-code" id="<%= method.html_name %>-source">
130
+ <pre><%= method.markup_code %></pre>
131
+ </div><!-- <%= method.html_name %>-source -->
132
+ <% end %>
133
+ </div>
134
+
135
+ <% unless method.aliases.empty? then %>
136
+ <div class="aliases">
137
+ Also aliased as: <%= method.aliases.map do |aka|
138
+ if aka.parent then # HACK lib/rexml/encodings
139
+ %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
140
+ else
141
+ h aka.name
142
+ end
143
+ end.join ", " %>
144
+ </div>
145
+ <% end %>
146
+
147
+ <% if method.is_alias_for then %>
148
+ <div class="aliases">
149
+ Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
150
+ </div>
151
+ <% end %>
152
+ </div><!-- <%= method.html_name %>-method -->
153
+
154
+ <% end %>
155
+ </section><!-- <%= visibility %>-<%= type %>-method-details -->
156
+ <% end
157
+ end %>
158
+ </section><!-- <%= section.aref %> -->
159
+ <% end %>
160
+
161
+ </div><!-- documentation -->
@@ -0,0 +1,32 @@
1
+ <body class="file file-popup">
2
+ <nav id="metadata">
3
+ <dl>
4
+ <dt class="modified-date">Last Modified
5
+ <dd class="modified-date"><%= file.last_modified %>
6
+
7
+ <% if file.requires %>
8
+ <dt class="requires">Requires
9
+ <dd class="requires">
10
+ <ul>
11
+ <% file.requires.each do |require| %>
12
+ <li><%= require.name %>
13
+ <% end %>
14
+ </ul>
15
+ <% end %>
16
+
17
+ <% if @options.webcvs %>
18
+ <dt class="scs-url">Trac URL
19
+ <dd class="scs-url"><a target="_top"
20
+ href="<%= file.cvs_url %>"><%= file.cvs_url %></a>
21
+ <% end %>
22
+ </dl>
23
+ </nav>
24
+
25
+ <div id="documentation">
26
+ <% if file.comment %>
27
+ <div class="description">
28
+ <h2>Description</h2>
29
+ <%= file.description %>
30
+ </div>
31
+ <% end %>
32
+ </div>
@@ -1,64 +1,19 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1
+ <body>
2
+ <nav id="metadata">
3
+ <%= render '_sidebar_navigation.rhtml' %>
4
4
 
5
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
- <head>
7
- <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" />
5
+ <%= render '_sidebar_search.rhtml' %>
8
6
 
9
- <title><%= h @options.title %></title>
10
-
11
- <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
12
-
13
- <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
14
- <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
15
- <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
16
- <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
17
-
18
- </head>
19
- <body class="indexpage">
20
-
21
- <% $stderr.sync = true %>
22
- <h1><%= h @options.title %></h1>
23
-
24
- <% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %>
25
- <div id="main">
26
- <%= main_page.description.sub(%r{^\s*<h1.*?/h1>}i, '') %>
27
- </div>
28
- <% else %>
29
- <p>This is the API documentation for '<%= @options.title %>'.</p>
30
- <% end %>
31
-
32
- <% simple_files = @files.select {|tl| tl.parser == RDoc::Parser::Simple } %>
33
- <% unless simple_files.empty? then %>
34
- <h2>Files</h2>
35
- <ul>
36
- <% simple_files.sort.each do |file| %>
37
- <li class="file"><a href="<%= file.path %>"><%= h file.base_name %></a></li>
38
- <% end %>
39
- </ul>
40
- <% end %>
41
-
42
- <h2 id="classes">Classes/Modules</h2>
43
- <ul>
44
- <% @modsort.each do |klass| %>
45
- <li class="<%= klass.type %>"><a href="<%= klass.path %>"><%= klass.full_name %></a></li>
46
- <% end %>
47
- </ul>
48
-
49
- <h2 id="methods">Methods</h2>
50
- <ul>
51
- <% RDoc::TopLevel.all_classes_and_modules.map do |mod|
52
- mod.method_list
53
- end.flatten.sort.each do |method| %>
54
- <li><a href="<%= method.path %>"><%= method.pretty_name %> &mdash; <%= method.parent.full_name %></a></li>
55
- <% end %>
56
- </ul>
57
-
58
- <div id="validator-badges">
59
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
60
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
61
- Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
7
+ <div id="project-metadata">
8
+ <%= render '_sidebar_pages.rhtml' %>
9
+ <%= render '_sidebar_classes.rhtml' %>
62
10
  </div>
63
- </body>
64
- </html>
11
+ </nav>
12
+
13
+ <% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %>
14
+ <div id="documentation" class="description">
15
+ <%= main_page.description %>
16
+ </div>
17
+ <% else %>
18
+ <p>This is the API documentation for <%= @title %>.
19
+ <% end %>
@@ -9,12 +9,12 @@
9
9
 
10
10
  /* Provide console simulation for firebug-less environments */
11
11
  if (!("console" in window) || !("firebug" in console)) {
12
- var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
13
  "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
14
 
15
- window.console = {};
16
- for (var i = 0; i < names.length; ++i)
17
- window.console[names[i]] = function() {};
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
18
  };
19
19
 
20
20
 
@@ -23,96 +23,131 @@ if (!("console" in window) || !("firebug" in console)) {
23
23
  */
24
24
  $.fn.unwrap = function( expr ) {
25
25
  return this.each( function() {
26
- $(this).parents( expr ).eq( 0 ).after( this ).remove();
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
27
  });
28
28
  };
29
29
 
30
30
 
31
31
  function showSource( e ) {
32
- var target = e.target;
33
- var codeSections = $(target).
34
- parents('.method-detail').
35
- find('.method-source-code');
36
-
37
- $(target).
38
- parents('.method-detail').
39
- find('.method-source-code').
40
- slideToggle();
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
41
  };
42
42
 
43
43
  function hookSourceViews() {
44
- $('.method-description,.method-heading').click( showSource );
44
+ $('.method-heading').click( showSource );
45
45
  };
46
46
 
47
47
  function toggleDebuggingSection() {
48
- $('.debugging-section').slideToggle();
48
+ $('.debugging-section').slideToggle();
49
49
  };
50
50
 
51
51
  function hookDebuggingToggle() {
52
- $('#debugging-toggle img').click( toggleDebuggingSection );
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
53
  };
54
54
 
55
- function hookQuickSearch() {
56
- $('.quicksearch-field').each( function() {
57
- var searchElems = $(this).parents('.section').find( 'li' );
58
- var toggle = $(this).parents('.section').find('h3 .search-toggle');
59
- // console.debug( "Toggle is: %o", toggle );
60
- var qsbox = $(this).parents('form').get( 0 );
61
-
62
- $(this).quicksearch( this, searchElems, {
63
- noSearchResultsIndicator: 'no-class-search-results',
64
- focusOnLoad: false
65
- });
66
- $(toggle).click( function() {
67
- // console.debug( "Toggling qsbox: %o", qsbox );
68
- $(qsbox).toggle();
69
- });
70
- });
55
+ function hookTableOfContentsToggle() {
56
+ $('.indexpage li .toc-toggle').each( function() {
57
+ $(this).click( function() {
58
+ $(this).toggleClass('open');
59
+ });
60
+
61
+ var section = $(this).next();
62
+
63
+ $(this).click( function() {
64
+ section.slideToggle();
65
+ });
66
+ });
67
+ }
68
+
69
+ function hookSearch() {
70
+ var input = $('#search-field').eq(0);
71
+ var result = $('#search-results').eq(0);
72
+ $(result).show();
73
+
74
+ var search_section = $('#search-section').get(0);
75
+ $(search_section).show();
76
+
77
+ var search = new Search(search_data, input, result);
78
+
79
+ search.renderItem = function(result) {
80
+ var li = document.createElement('li');
81
+ var html = '';
82
+
83
+ // TODO add relative path to <script> per-page
84
+ html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
85
+ if (result.params)
86
+ html += '<span class="params">' + result.params + '</span>';
87
+ html += '</a>';
88
+
89
+
90
+ if (result.namespace)
91
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
92
+
93
+ if (result.snippet)
94
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
95
+
96
+ li.innerHTML = html;
97
+
98
+ return li;
99
+ }
100
+
101
+ search.select = function(result) {
102
+ var result_element = result.get(0);
103
+ window.location.href = result_element.firstChild.firstChild.href;
104
+ }
105
+
106
+ search.scrollIntoView = search.scrollInWindow;
71
107
  };
72
108
 
73
109
  function highlightTarget( anchor ) {
74
- console.debug( "Highlighting target '%s'.", anchor );
75
-
76
- $("a[name]").each( function() {
77
- if ( $(this).attr("name") == anchor ) {
78
- if ( !$(this).parent().parent().hasClass('target-section') ) {
79
- console.debug( "Wrapping the target-section" );
80
- $('div.method-detail').unwrap( 'div.target-section' );
81
- $(this).parent().wrap( '<div class="target-section"></div>' );
82
- } else {
83
- console.debug( "Already wrapped." );
84
- }
85
- }
86
- });
110
+ console.debug( "Highlighting target '%s'.", anchor );
111
+
112
+ $("a[name=" + anchor + "]").each( function() {
113
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
114
+ console.debug( "Wrapping the target-section" );
115
+ $('div.method-detail').unwrap( 'div.target-section' );
116
+ $(this).parent().wrap( '<div class="target-section"></div>' );
117
+ } else {
118
+ console.debug( "Already wrapped." );
119
+ }
120
+ });
87
121
  };
88
122
 
89
123
  function highlightLocationTarget() {
90
- console.debug( "Location hash: %s", window.location.hash );
91
- if ( ! window.location.hash || window.location.hash.length == 0 ) return;
124
+ console.debug( "Location hash: %s", window.location.hash );
125
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
92
126
 
93
- var anchor = window.location.hash.substring(1);
94
- console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
127
+ var anchor = window.location.hash.substring(1);
128
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
95
129
 
96
- highlightTarget( anchor );
130
+ highlightTarget( anchor );
97
131
  };
98
132
 
99
133
  function highlightClickTarget( event ) {
100
- console.debug( "Highlighting click target for event %o", event.target );
101
- try {
102
- var anchor = $(event.target).attr( 'href' ).substring(1);
103
- console.debug( "Found target anchor: %s", anchor );
104
- highlightTarget( anchor );
105
- } catch ( err ) {
106
- console.error( "Exception while highlighting: %o", err );
107
- };
134
+ console.debug( "Highlighting click target for event %o", event.target );
135
+ try {
136
+ var anchor = $(event.target).attr( 'href' ).substring(1);
137
+ console.debug( "Found target anchor: %s", anchor );
138
+ highlightTarget( anchor );
139
+ } catch ( err ) {
140
+ console.error( "Exception while highlighting: %o", err );
141
+ };
108
142
  };
109
143
 
110
144
 
111
145
  $(document).ready( function() {
112
- hookSourceViews();
113
- hookDebuggingToggle();
114
- hookQuickSearch();
115
- highlightLocationTarget();
146
+ hookSourceViews();
147
+ hookDebuggingToggle();
148
+ hookSearch();
149
+ highlightLocationTarget();
150
+ hookTableOfContentsToggle();
116
151
 
117
- $('ul.link-list a').bind( "click", highlightClickTarget );
152
+ $('ul.link-list a').bind( "click", highlightClickTarget );
118
153
  });