hanna-nouveau 1.0.4 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/hanna-nouveau.rb CHANGED
@@ -1,62 +1,28 @@
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
- require 'haml'
16
- require 'sass'
17
- require 'rdoc/rdoc'
6
+ require 'erb'
7
+ # :nocov:
8
+ require 'rdoc/rdoc' unless defined?(RDoc::Markup::ToHtml)
9
+ # :nocov:
18
10
  require 'rdoc/generator'
19
11
 
20
- class RDoc::Markup::ToHtml
21
- LIST_TYPE_TO_HTML[:LABEL] = ['<table class="rdoc-list label-list"><tbody>', '</tbody></table>']
22
- LIST_TYPE_TO_HTML[:NOTE] = ['<table class="rdoc-list note-list"><tbody>', '</tbody></table>']
23
-
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
- def list_end_for(list_type)
36
- case list_type
37
- when :BULLET, :LALPHA, :NUMBER, :UALPHA then
38
- "</li>"
39
- when :LABEL, :NOTE then
40
- "</td></tr>"
41
- else
42
- raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
43
- end
44
- end
45
- end
46
-
12
+ # Hanna version of RDoc::Generator
47
13
  class RDoc::Generator::Hanna
48
- STYLE = 'styles.sass'
49
- LAYOUT = 'layout.haml'
14
+ STYLE = 'styles.css'
15
+ LAYOUT = 'layout.erb'
50
16
 
51
- INDEX_PAGE = 'index.haml'
52
- CLASS_PAGE = 'page.haml'
53
- METHOD_LIST_PAGE = 'method_list.haml'
17
+ INDEX_PAGE = 'index.erb'
18
+ CLASS_PAGE = 'page.erb'
19
+ METHOD_LIST_PAGE = 'method_list.erb'
54
20
  FILE_PAGE = CLASS_PAGE
55
- SECTIONS_PAGE = 'sections.haml'
21
+ SECTIONS_PAGE = 'sections.erb'
56
22
 
57
- FILE_INDEX = 'file_index.haml'
58
- CLASS_INDEX = 'class_index.haml'
59
- METHOD_INDEX = 'method_index.haml'
23
+ FILE_INDEX = 'file_index.erb'
24
+ CLASS_INDEX = 'class_index.erb'
25
+ METHOD_INDEX = 'method_index.erb'
60
26
 
61
27
  CLASS_DIR = 'classes'
62
28
  FILE_DIR = 'files'
@@ -67,13 +33,14 @@ class RDoc::Generator::Hanna
67
33
  METHOD_INDEX_OUT = 'fr_method_index.html'
68
34
  STYLE_OUT = File.join('css', 'style.css')
69
35
 
70
- DESCRIPTION = 'a HAML-based HTML generator that scales'
36
+ METHOD_SEARCH_JS = "method_search.js"
37
+
38
+ DESCRIPTION = 'RDoc generator designed with simplicity, beauty and ease of browsing in mind'
71
39
 
72
- # EPIC CUT AND PASTE TIEM NAO -- GG
73
40
  RDoc::RDoc.add_generator( self )
74
41
 
75
- def self::for( options )
76
- new( options )
42
+ class << self
43
+ alias for new
77
44
  end
78
45
 
79
46
  def initialize( store, options )
@@ -103,30 +70,23 @@ class RDoc::Generator::Hanna
103
70
  generate_indexes
104
71
  generate_class_files
105
72
  generate_file_files
106
-
107
- rescue StandardError => err
108
- p [ err.class.name, err.message, err.backtrace.join("\n ") ]
109
- raise
110
73
  end
111
74
 
112
75
  def write_static_files
113
76
  css_dir = outjoin('css')
114
-
115
- unless File.directory?(css_dir)
116
- FileUtils.mkdir css_dir
117
- end
118
-
119
- File.open(File.join(css_dir, 'style.css'), 'w') { |f| f << Sass::Engine.new(File.read(templjoin(STYLE))).to_css }
77
+ FileUtils.mkdir_p css_dir
78
+ File.binwrite(File.join(css_dir, 'style.css'), File.read(templjoin(STYLE)))
120
79
  end
121
80
 
122
- # FIXME refactor
123
81
  def generate_indexes
124
82
  @main_page_uri = @files.find { |f| f.name == @options.main_page }.path rescue ''
125
- File.open(outjoin(INDEX_OUT), 'w') { |f| f << haml_file(templjoin(INDEX_PAGE)).to_html(binding) }
83
+ File.binwrite(outjoin(INDEX_OUT), erb_template(templjoin(INDEX_PAGE)).to_html(binding))
126
84
 
127
85
  generate_index(FILE_INDEX_OUT, FILE_INDEX, 'File', { :files => @files})
128
86
  generate_index(CLASS_INDEX_OUT, CLASS_INDEX, 'Class', { :classes => @classes })
129
87
  generate_index(METHOD_INDEX_OUT, METHOD_INDEX, 'Method', { :methods => @methods, :attributes => @attributes })
88
+
89
+ File.binwrite(outjoin(METHOD_SEARCH_JS), File.binread(templjoin(METHOD_SEARCH_JS)))
130
90
  end
131
91
 
132
92
  def generate_index(outfile, templfile, index_name, values)
@@ -135,20 +95,15 @@ class RDoc::Generator::Hanna
135
95
  :list_title => "#{index_name} Index"
136
96
  })
137
97
 
138
- index = haml_file(templjoin(templfile))
98
+ index = erb_template(templjoin(templfile))
139
99
 
140
- File.open(outjoin(outfile), 'w') do |f|
141
- f << with_layout(values) do
142
- index.to_html(binding, values)
143
- end
144
- end
100
+ File.binwrite(outjoin(outfile), with_layout(values){index.to_html(binding, values)})
145
101
  end
146
102
 
147
103
  def generate_file_files
148
- file_page = haml_file(templjoin(FILE_PAGE))
149
- method_list_page = haml_file(templjoin(METHOD_LIST_PAGE))
104
+ file_page = erb_template(templjoin(FILE_PAGE))
105
+ method_list_page = erb_template(templjoin(METHOD_LIST_PAGE))
150
106
 
151
- # FIXME non-Ruby files
152
107
  @files.each do |file|
153
108
  path = Pathname.new(file.path)
154
109
  stylesheet = Pathname.new(STYLE_OUT).relative_path_from(path.dirname)
@@ -169,21 +124,16 @@ class RDoc::Generator::Hanna
169
124
  end
170
125
  end
171
126
 
172
- # FIXME XXX sanity check
173
127
  dir = path.dirname
174
- unless File.directory? dir
175
- FileUtils.mkdir_p dir
176
- end
177
-
178
- File.open(outjoin(file.path), 'w') { |f| f << result }
128
+ FileUtils.mkdir_p dir
129
+ File.binwrite(outjoin(file.path), result)
179
130
  end
180
131
  end
181
132
 
182
133
  def generate_class_files
183
- class_page = haml_file(templjoin(CLASS_PAGE))
184
- method_list_page = haml_file(templjoin(METHOD_LIST_PAGE))
185
- sections_page = haml_file(templjoin(SECTIONS_PAGE))
186
- # FIXME refactor
134
+ class_page = erb_template(templjoin(CLASS_PAGE))
135
+ method_list_page = erb_template(templjoin(METHOD_LIST_PAGE))
136
+ sections_page = erb_template(templjoin(SECTIONS_PAGE))
187
137
 
188
138
  @classes.each do |klass|
189
139
  outfile = classfile(klass)
@@ -220,35 +170,19 @@ class RDoc::Generator::Hanna
220
170
  end
221
171
  end
222
172
 
223
- # FIXME XXX sanity check
224
173
  dir = outfile.dirname
225
- unless File.directory? dir
226
- FileUtils.mkdir_p dir
227
- end
228
-
229
- File.open(outfile, 'w') { |f| f << result }
174
+ FileUtils.mkdir_p dir
175
+ File.binwrite(outfile, result)
230
176
  end
231
177
  end
232
178
 
233
179
  def with_layout(values)
234
- layout = haml_file(templjoin(LAYOUT))
180
+ layout = erb_template(templjoin(LAYOUT))
235
181
  layout.to_html(binding, :values => values) { yield }
236
182
  end
237
183
 
238
- def sanitize_code_blocks(text)
239
- text.gsub(/<pre>(.+?)<\/pre>/m) do
240
- code = $1.sub(/^\s*\n/, '')
241
- indent = code.gsub(/\n[ \t]*\n/, "\n").scan(/^ */).map{ |i| i.size }.min
242
- code.gsub!(/^#{' ' * indent}/, '') if indent > 0
243
-
244
- "<pre>#{code}</pre>"
245
- end
246
- end
247
-
248
- # probably should bring in nokogiri/libxml2 to do this right.. not sure if
249
- # it's worth it.
250
184
  def frame_link(content)
251
- content.gsub(%r!<a href="http://[^>]*>!).each do |tag|
185
+ content.gsub(%r!<a[ \n]href="https?://[^>]*>!).each do |tag|
252
186
  a_tag, rest = tag.split(' ', 2)
253
187
  rest.gsub!(/target="[^"]*"/, '')
254
188
  a_tag + ' target="_top" ' + rest
@@ -264,75 +198,48 @@ class RDoc::Generator::Hanna
264
198
  end
265
199
 
266
200
  def h(html)
267
- CGI::escapeHTML(html)
201
+ CGI::escapeHTML(html.to_s)
268
202
  end
269
203
 
270
- # XXX may my sins be not visited upon my sons.
271
- def render_class_tree(entries, parent=nil)
204
+ def render_class_tree(entries, prefix=nil, out=String.new)
272
205
  namespaces = { }
273
206
 
274
- entries.sort.inject('') do |out, klass|
275
- unless namespaces[klass.full_name]
276
- if parent
277
- text = '<span class="parent">%s::</span>%s' % [parent.full_name, klass.name]
278
- else
279
- text = klass.name
280
- end
281
-
282
- if klass.document_self
283
- out << '<li>'
284
- out << link_to(text, classfile(klass))
285
- end
286
-
287
- subentries = @classes.select { |x| x.full_name[/^#{klass.full_name}::/] }
288
- subentries.each { |x| namespaces[x.full_name] = true }
289
- out << "\n<ol>" + render_class_tree(subentries, klass) + "\n</ol>"
290
-
291
- if klass.document_self
292
- out << '</li>'
293
- 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>"
294
226
  end
295
-
296
- out
297
227
  end
228
+
229
+ out
298
230
  end
299
231
 
300
- def build_javascript_search_index(entries)
301
- result = "var search_index = [\n"
302
- entries.each do |entry|
303
- method_name = entry.name
304
- module_name = entry.parent_name
305
- # FIXME link
306
- html = link_to_method(entry, [classfile(entry.parent), (entry.aref rescue "method-#{entry.html_name}")].join('#'))
307
- result << " { method: '#{method_name.downcase}', " +
308
- "module: '#{module_name.downcase}', " +
309
- "html: '#{html}' },\n"
310
- end
311
- result << "]"
312
- result
232
+ def link_to(text, url)
233
+ %[<a href="#{url}">#{text}</a>]
313
234
  end
314
235
 
315
- def link_to(text, url = nil, classname = nil)
316
- class_attr = classname ? ' class="%s"' % classname : ''
317
-
318
- if url
319
- %[<a href="#{url}"#{class_attr}>#{text}</a>]
320
- elsif classname
321
- %[<span#{class_attr}>#{text}</span>]
322
- else
323
- text
324
- end
325
- end
326
-
327
- # +method_text+ is in the form of "ago (ActiveSupport::TimeWithZone)".
328
- def link_to_method(entry, url = nil, classname = nil)
236
+ def link_to_method(entry, url)
329
237
  method_name = entry.pretty_name rescue entry.name
330
238
  module_name = entry.parent_name rescue entry.name
331
- link_to %Q(<span class="method_name">#{h method_name}</span> <span class="module_name">(#{h module_name})</span>), url, classname
239
+ link_to %Q(<span class="method_name" value="#{entry.name}">#{h method_name}</span> <span class="module_name">(#{h module_name})</span>), url
332
240
  end
333
241
 
334
242
  def classfile(klass)
335
- # FIXME sloooooooow
336
243
  Pathname.new(File.join(CLASS_DIR, klass.full_name.split('::')) + '.html')
337
244
  end
338
245
 
@@ -344,7 +251,50 @@ class RDoc::Generator::Hanna
344
251
  File.join(@templatedir, name)
345
252
  end
346
253
 
347
- def haml_file(file)
348
- Haml::Engine.new(File.read(file), :format => :html4)
254
+ class ERB < ::ERB
255
+ def to_html(binding, values = nil, &block)
256
+ local_values = {}
257
+ binding.local_variables.each do |lv|
258
+ local_values[lv] = binding.local_variable_get(lv)
259
+ end
260
+ binding.local_variable_set(:values, values) if values
261
+ binding.local_variable_set(:block, block) if block
262
+ html = result(binding)
263
+ local_values.each do |lv, val|
264
+ binding.local_variable_set(lv, val)
265
+ end
266
+ html
267
+ end
268
+ end
269
+
270
+ def erb_template(file)
271
+ ERB.new(File.read(file))
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
349
292
  end
350
293
  end
294
+
295
+ class RDoc::Markup::ToHtml
296
+ LIST_TYPE_TO_HTML[:LABEL] = ['<table class="rdoc-list label-list"><tbody>', '</tbody></table>']
297
+ LIST_TYPE_TO_HTML[:NOTE] = ['<table class="rdoc-list note-list"><tbody>', '</tbody></table>']
298
+
299
+ prepend RDoc::Generator::Hanna::LabelListTable
300
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanna-nouveau
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -11,10 +11,10 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-06-24 00:00:00.000000000 Z
14
+ date: 2022-06-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: haml
17
+ name: rdoc
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - ">="
@@ -28,13 +28,13 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4'
30
30
  - !ruby/object:Gem::Dependency
31
- name: sass
31
+ name: minitest-hooks
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0'
37
- type: :runtime
37
+ type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
@@ -42,52 +42,51 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  - !ruby/object:Gem::Dependency
45
- name: rdoc
45
+ name: minitest-global_expectations
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: '4'
51
- type: :runtime
50
+ version: '0'
51
+ type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: '4'
58
- description: |
59
- RDoc generator designed with simplicity, beauty and ease of browsing in mind
60
-
61
- Based on the original Hanna by Mislav, with many changes so it works
62
- on modern verions of RDoc, Haml, and Sass.
57
+ version: '0'
58
+ description: RDoc generator designed with simplicity, beauty and ease of browsing
59
+ in mind
63
60
  email: code@jeremyevans.net
64
61
  executables: []
65
62
  extensions: []
66
63
  extra_rdoc_files:
67
64
  - LICENSE
68
65
  - README.rdoc
66
+ - CHANGELOG
69
67
  files:
68
+ - CHANGELOG
70
69
  - LICENSE
71
70
  - README.rdoc
72
- - Rakefile
73
- - VERSION
74
71
  - lib/hanna-nouveau.rb
75
- - lib/hanna-nouveau/template_files/class_index.haml
76
- - lib/hanna-nouveau/template_files/file_index.haml
77
- - lib/hanna-nouveau/template_files/index.haml
78
- - lib/hanna-nouveau/template_files/layout.haml
79
- - lib/hanna-nouveau/template_files/method_index.haml
80
- - lib/hanna-nouveau/template_files/method_list.haml
72
+ - lib/hanna-nouveau/template_files/class_index.erb
73
+ - lib/hanna-nouveau/template_files/file_index.erb
74
+ - lib/hanna-nouveau/template_files/index.erb
75
+ - lib/hanna-nouveau/template_files/layout.erb
76
+ - lib/hanna-nouveau/template_files/method_index.erb
77
+ - lib/hanna-nouveau/template_files/method_list.erb
81
78
  - lib/hanna-nouveau/template_files/method_search.js
82
- - lib/hanna-nouveau/template_files/page.haml
83
- - lib/hanna-nouveau/template_files/prototype-1.6.0.3.js
84
- - lib/hanna-nouveau/template_files/sections.haml
85
- - lib/hanna-nouveau/template_files/styles.sass
79
+ - lib/hanna-nouveau/template_files/page.erb
80
+ - lib/hanna-nouveau/template_files/sections.erb
81
+ - lib/hanna-nouveau/template_files/styles.css
86
82
  - lib/rdoc/discover.rb
87
83
  homepage: https://github.com/jeremyevans/hanna-nouveau
88
84
  licenses:
89
85
  - MIT
90
- metadata: {}
86
+ metadata:
87
+ bug_tracker_uri: https://github.com/jeremyevans/hanna-nouveau/issues
88
+ mailing_list_uri: https://github.com/jeremyevans/hanna-nouveau/discussions
89
+ source_code_uri: https://github.com/jeremyevans/hanna-nouveau
91
90
  post_install_message:
92
91
  rdoc_options: []
93
92
  require_paths:
@@ -96,14 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
95
  requirements:
97
96
  - - ">="
98
97
  - !ruby/object:Gem::Version
99
- version: '0'
98
+ version: '2.2'
100
99
  required_rubygems_version: !ruby/object:Gem::Requirement
101
100
  requirements:
102
101
  - - ">="
103
102
  - !ruby/object:Gem::Version
104
103
  version: '0'
105
104
  requirements: []
106
- rubygems_version: 3.1.2
105
+ rubygems_version: 3.3.7
107
106
  signing_key:
108
107
  specification_version: 4
109
108
  summary: RDoc generator designed with simplicity, beauty and ease of browsing in mind
data/Rakefile DELETED
@@ -1,13 +0,0 @@
1
- require "rake/clean"
2
- CLEAN.include ["rdoc", "*.gem"]
3
-
4
- require "rdoc/task"
5
- RDoc::Task.new do |rdoc|
6
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
7
-
8
- rdoc.rdoc_dir = 'rdoc'
9
- rdoc.generator = 'hanna'
10
- rdoc.title = "hanna-nouveau #{version}"
11
- rdoc.options = ['--main', 'README.rdoc', '--title', 'Hanna-nouveau: RDoc generator designed with simplicity, beauty and ease of browsing in mind']
12
- rdoc.rdoc_files.add %w"README.rdoc LICENSE lib"
13
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.4
@@ -1,3 +0,0 @@
1
- %h1= values[:list_title]
2
- %ol#index-entries.classes
3
- = render_class_tree values[:classes].select { |x| x.full_name !~ /::/ }
@@ -1,12 +0,0 @@
1
- %h1= values[:list_title]
2
- - any_hidden = false
3
-
4
- %ol#index-entries{ :class => 'files' }
5
- - values[:files].each do |file|
6
- - hide = file.name =~ /\.rb$/
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
@@ -1,11 +0,0 @@
1
- !!! Frameset
2
- %html{ "xml:lang" => "en", :lang => "en", :xmlns => "http://www.w3.org/1999/xhtml" }
3
- %head
4
- %title= @options.title
5
- %meta{ :content => "text/html; charset=#{@options.charset}", "http-equiv" => "Content-Type" }
6
- %frameset{ :cols => "20%, *", :border => "1", :frameborder => "1", :bordercolor => "gray" }
7
- %frameset{ :rows => "15%, 35%, 50%" }
8
- %frame{ :name => "Files", :title => "Files", :src => "fr_file_index.html" }
9
- %frame{ :name => "Classes", :src => "fr_class_index.html" }
10
- %frame{ :name => "Methods", :src => "fr_method_index.html" }
11
- %frame{ :name => "docwin", :src => @main_page_uri }=""
@@ -1,34 +0,0 @@
1
- !!! strict
2
- - index = values[:list_title]
3
- %html{ :lang => "en" }
4
- %head
5
- %title= values[:title]
6
- %meta{ 'http-equiv' => "Content-Type", :content => "text/html; charset=#{@options.charset}" }
7
- %link{ :rel => "stylesheet", :href => values[:stylesheet], :type => "text/css", :media => "screen" }
8
- - unless index
9
- :javascript
10
- function popupCode(url) {
11
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
12
- }
13
-
14
- function toggleCode(id) {
15
- var code = document.getElementById(id)
16
-
17
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
18
- return true
19
- }
20
-
21
- // Make codeblocks hidden by default
22
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
23
- - else
24
- %base{ :target => 'docwin' }/
25
-
26
- %body{ :class => index ? 'list' : 'page' }
27
- - if index
28
- #index= yield
29
- - else
30
- #wrapper{ :class => values[:classmod] ? 'class' : 'file' }
31
- = yield
32
- #footer-push
33
- #footer
34
- = link_to '<strong>Hanna Nouveau</strong> RDoc template', 'https://github.com/rdoc/hanna-nouveau'
@@ -1,13 +0,0 @@
1
- %h1= values[:list_title]
2
-
3
- %script{:type => 'text/javascript'}
4
- = File.read(File.join(@templatedir, "prototype-1.6.0.3.js"))
5
- = build_javascript_search_index(values[:methods] + values[:attributes])
6
- = File.read(File.join(@templatedir, "method_search.js"))
7
- %form{:onsubmit => 'return performSearch()'}
8
- %input{:type => 'text', :id => 'search', :class => 'untouched', :value => 'Enter search terms...'}
9
- %ol#search-results{ :class => 'methods', :style => 'display: none' }
10
-
11
- %ol#index-entries{ :class => 'methods' }
12
- - (values[:attributes] + values[:methods]).uniq.each do |entry|
13
- %li= link_to_method entry, [classfile(entry.parent), entry.aref].join('#')
@@ -1,56 +0,0 @@
1
- - entry = values[:entry]
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+(#?=>|&rarr;)\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
-
31
- - if entry.requires or sections or entry.includes
32
- #context
33
- - unless entry.requires.empty?
34
- #requires
35
- %h2 Required files
36
- %ol
37
- - entry.requires.each do |req|
38
- %li= req.name
39
-
40
- - if sections && (sections.length > 1 || sections.first.title.to_s != '')
41
- #contents
42
- %h2 Contents
43
- %ol
44
- - sections.sort_by{|s| s.title.to_s}.each do |section|
45
- %li= link_to section.title, "##{section.aref}"
46
-
47
- - unless entry.includes.empty?
48
- #includes
49
- %h2 Included modules
50
- %ol
51
- - entry.includes.each do |inc|
52
- - if (mod = inc.module).is_a?(String)
53
- %li= inc.name
54
- - else
55
- %li= link_to inc.name, entry.aref_to(mod.path)
56
-