mislav-hanna 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -120,6 +120,15 @@ table
120
120
  :font = "small-caps 1.2em" !title_font
121
121
  :color #333
122
122
  :border-bottom 1px solid gray
123
+ form
124
+ :margin 0
125
+ :padding 0
126
+ input
127
+ :margin .4em
128
+ :margin-bottom 0
129
+ :width 90%
130
+ #search.untouched
131
+ :color #777777
123
132
  ol
124
133
  :padding .4em .5em
125
134
  li
@@ -134,6 +143,14 @@ table
134
143
  :font-weight bold
135
144
  .parent
136
145
  :font-weight normal
146
+ #index-entries.methods, #search-results.methods
147
+ li
148
+ :margin-bottom 0.2em
149
+ a
150
+ .method_name
151
+ :margin-right 0.25em
152
+ .module_name
153
+ :color #666666
137
154
 
138
155
  div.header
139
156
  :font-size 80%
@@ -16,6 +16,17 @@ module Hanna
16
16
  text
17
17
  end
18
18
  end
19
+
20
+ # +method_text+ is in the form of "ago (ActiveSupport::TimeWithZone)".
21
+ def link_to_method(method_text, url = nil, classname = nil)
22
+ method_text =~ /\A(.+) \((.+)\)\Z/
23
+ method_name, module_name = $1, $2
24
+ link_to %Q(<span class="method_name">#{h method_name}</span> <span class="module_name">(#{h module_name})</span>), url, classname
25
+ end
26
+
27
+ def read(*names)
28
+ RDoc::Generator::HTML::HANNA.read(*names)
29
+ end
19
30
 
20
31
  # We need to suppress warnings before calling into HAML because
21
32
  # HAML has lots of uninitialized instance variable accesses.
@@ -38,6 +49,23 @@ module Hanna
38
49
  def h(html)
39
50
  CGI::escapeHTML(html)
40
51
  end
52
+
53
+ # +entries+ is an array of hashes, each which has a "name" and "href" element.
54
+ # An entry name is in the form of "ago (ActiveSupport::TimeWithZone)".
55
+ # +entries+ must be already sorted by name.
56
+ def build_javascript_search_index(entries)
57
+ result = "var search_index = [\n"
58
+ entries.each do |entry|
59
+ entry["name"] =~ /\A(.+) \((.+)\)\Z/
60
+ method_name, module_name = $1, $2
61
+ html = link_to_method(entry["name"], entry["href"])
62
+ result << " { method: '#{method_name.downcase}', " <<
63
+ "module: '#{module_name.downcase}', " <<
64
+ "html: '#{html}' },\n"
65
+ end
66
+ result << "]"
67
+ result
68
+ end
41
69
 
42
70
  def methods_from_sections(sections)
43
71
  sections.inject(Hash.new {|h, k| h[k] = []}) do |methods, section|
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mislav-hanna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Mislav Marohni\xC4\x87"
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- date: 2008-09-21 21:00:00 -07:00
12
- default_executable:
10
+ cert_chain: []
11
+
12
+ date: 2008-11-24 00:00:00 -08:00
13
+ default_executable: hanna
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rdoc
16
- type: :runtime
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
@@ -23,17 +23,15 @@ dependencies:
23
23
  version:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: haml
26
- type: :runtime
27
26
  version_requirement:
28
27
  version_requirements: !ruby/object:Gem::Requirement
29
28
  requirements:
30
29
  - - ~>
31
30
  - !ruby/object:Gem::Version
32
- version: "2.0"
31
+ version: 2.0.4
33
32
  version:
34
33
  - !ruby/object:Gem::Dependency
35
34
  name: rake
36
- type: :runtime
37
35
  version_requirement:
38
36
  version_requirements: !ruby/object:Gem::Requirement
39
37
  requirements:
@@ -43,7 +41,6 @@ dependencies:
43
41
  version:
44
42
  - !ruby/object:Gem::Dependency
45
43
  name: echoe
46
- type: :development
47
44
  version_requirement:
48
45
  version_requirements: !ruby/object:Gem::Requirement
49
46
  requirements:
@@ -70,6 +67,8 @@ extra_rdoc_files:
70
67
  - lib/hanna/template_files/page.haml
71
68
  - lib/hanna/template_files/sections.haml
72
69
  - lib/hanna/template_files/styles.sass
70
+ - lib/hanna/template_files/prototype-1.6.0.3.js
71
+ - lib/hanna/template_files/method_search.js
73
72
  - lib/hanna/template_helpers.rb
74
73
  - lib/hanna/template_page_patch.rb
75
74
  - lib/hanna.rb
@@ -88,6 +87,8 @@ files:
88
87
  - lib/hanna/template_files/page.haml
89
88
  - lib/hanna/template_files/sections.haml
90
89
  - lib/hanna/template_files/styles.sass
90
+ - lib/hanna/template_files/prototype-1.6.0.3.js
91
+ - lib/hanna/template_files/method_search.js
91
92
  - lib/hanna/template_helpers.rb
92
93
  - lib/hanna/template_page_patch.rb
93
94
  - lib/hanna.rb
@@ -114,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
115
  version:
115
116
  required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  requirements:
117
- - - "="
118
+ - - ">="
118
119
  - !ruby/object:Gem::Version
119
120
  version: "1.2"
120
121
  version: