ramaze 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. data/Rakefile +360 -0
  2. data/bin/ramaze +152 -0
  3. data/doc/CHANGELOG +2021 -0
  4. data/doc/COPYING +56 -0
  5. data/doc/COPYING.ja +51 -0
  6. data/doc/README +275 -0
  7. data/doc/TODO +33 -0
  8. data/doc/allison/LICENSE +184 -0
  9. data/doc/allison/README +37 -0
  10. data/doc/allison/allison.css +300 -0
  11. data/doc/allison/allison.gif +0 -0
  12. data/doc/allison/allison.js +307 -0
  13. data/doc/allison/allison.rb +287 -0
  14. data/doc/allison/cache/BODY +588 -0
  15. data/doc/allison/cache/CLASS_INDEX +4 -0
  16. data/doc/allison/cache/CLASS_PAGE +1 -0
  17. data/doc/allison/cache/FILE_INDEX +4 -0
  18. data/doc/allison/cache/FILE_PAGE +1 -0
  19. data/doc/allison/cache/FONTS +1 -0
  20. data/doc/allison/cache/FR_INDEX_BODY +1 -0
  21. data/doc/allison/cache/IMGPATH +1 -0
  22. data/doc/allison/cache/INDEX +1 -0
  23. data/doc/allison/cache/JAVASCRIPT +307 -0
  24. data/doc/allison/cache/METHOD_INDEX +4 -0
  25. data/doc/allison/cache/METHOD_LIST +1 -0
  26. data/doc/allison/cache/SRC_PAGE +1 -0
  27. data/doc/allison/cache/STYLE +322 -0
  28. data/doc/allison/cache/URL +1 -0
  29. data/examples/blog/main.rb +16 -0
  30. data/examples/blog/public/screen.css +106 -0
  31. data/examples/blog/src/controller.rb +50 -0
  32. data/examples/blog/src/element.rb +53 -0
  33. data/examples/blog/src/model.rb +29 -0
  34. data/examples/blog/template/edit.xhtml +6 -0
  35. data/examples/blog/template/index.xhtml +24 -0
  36. data/examples/blog/template/new.xhtml +5 -0
  37. data/examples/blog/template/view.xhtml +15 -0
  38. data/examples/blog/test/tc_entry.rb +18 -0
  39. data/examples/caching.rb +23 -0
  40. data/examples/element.rb +40 -0
  41. data/examples/hello.rb +23 -0
  42. data/examples/simple.rb +60 -0
  43. data/examples/templates/template/external.haml +21 -0
  44. data/examples/templates/template/external.liquid +28 -0
  45. data/examples/templates/template/external.mab +27 -0
  46. data/examples/templates/template/external.rhtml +29 -0
  47. data/examples/templates/template/external.rmze +24 -0
  48. data/examples/templates/template_erubis.rb +50 -0
  49. data/examples/templates/template_haml.rb +48 -0
  50. data/examples/templates/template_liquid.rb +64 -0
  51. data/examples/templates/template_markaby.rb +52 -0
  52. data/examples/templates/template_ramaze.rb +49 -0
  53. data/examples/whywiki/main.rb +56 -0
  54. data/examples/whywiki/template/edit.xhtml +14 -0
  55. data/examples/whywiki/template/show.xhtml +17 -0
  56. data/lib/proto/conf/benchmark.yaml +35 -0
  57. data/lib/proto/conf/debug.yaml +34 -0
  58. data/lib/proto/conf/live.yaml +33 -0
  59. data/lib/proto/conf/silent.yaml +31 -0
  60. data/lib/proto/conf/stage.yaml +33 -0
  61. data/lib/proto/main.rb +18 -0
  62. data/lib/proto/public/404.jpg +0 -0
  63. data/lib/proto/public/css/coderay.css +105 -0
  64. data/lib/proto/public/css/ramaze_error.css +42 -0
  65. data/lib/proto/public/error.xhtml +74 -0
  66. data/lib/proto/public/favicon.ico +0 -0
  67. data/lib/proto/public/js/jquery.js +1923 -0
  68. data/lib/proto/public/ramaze.png +0 -0
  69. data/lib/proto/src/controller/main.rb +7 -0
  70. data/lib/proto/src/element/page.rb +16 -0
  71. data/lib/proto/src/model.rb +5 -0
  72. data/lib/proto/template/index.xhtml +6 -0
  73. data/lib/ramaze.rb +317 -0
  74. data/lib/ramaze/adapter/mongrel.rb +111 -0
  75. data/lib/ramaze/adapter/webrick.rb +161 -0
  76. data/lib/ramaze/cache.rb +11 -0
  77. data/lib/ramaze/cache/memcached.rb +52 -0
  78. data/lib/ramaze/cache/memory.rb +6 -0
  79. data/lib/ramaze/cache/yaml_store.rb +37 -0
  80. data/lib/ramaze/controller.rb +10 -0
  81. data/lib/ramaze/dispatcher.rb +315 -0
  82. data/lib/ramaze/error.rb +11 -0
  83. data/lib/ramaze/gestalt.rb +108 -0
  84. data/lib/ramaze/global.rb +120 -0
  85. data/lib/ramaze/helper.rb +32 -0
  86. data/lib/ramaze/helper/aspect.rb +189 -0
  87. data/lib/ramaze/helper/auth.rb +120 -0
  88. data/lib/ramaze/helper/cache.rb +52 -0
  89. data/lib/ramaze/helper/feed.rb +135 -0
  90. data/lib/ramaze/helper/form.rb +204 -0
  91. data/lib/ramaze/helper/link.rb +80 -0
  92. data/lib/ramaze/helper/redirect.rb +48 -0
  93. data/lib/ramaze/helper/stack.rb +67 -0
  94. data/lib/ramaze/http_status.rb +66 -0
  95. data/lib/ramaze/inform.rb +166 -0
  96. data/lib/ramaze/snippets.rb +5 -0
  97. data/lib/ramaze/snippets/hash/keys_to_sym.rb +19 -0
  98. data/lib/ramaze/snippets/kernel/aquire.rb +22 -0
  99. data/lib/ramaze/snippets/kernel/autoreload.rb +79 -0
  100. data/lib/ramaze/snippets/kernel/caller_lines.rb +58 -0
  101. data/lib/ramaze/snippets/kernel/constant.rb +24 -0
  102. data/lib/ramaze/snippets/kernel/rescue_require.rb +12 -0
  103. data/lib/ramaze/snippets/kernel/self_method.rb +41 -0
  104. data/lib/ramaze/snippets/kernel/silently.rb +13 -0
  105. data/lib/ramaze/snippets/object/traits.rb +60 -0
  106. data/lib/ramaze/snippets/openstruct/temp.rb +10 -0
  107. data/lib/ramaze/snippets/string/DIVIDE.rb +16 -0
  108. data/lib/ramaze/snippets/string/camel_case.rb +14 -0
  109. data/lib/ramaze/snippets/string/snake_case.rb +12 -0
  110. data/lib/ramaze/snippets/symbol/to_proc.rb +14 -0
  111. data/lib/ramaze/snippets/thread/deadQUESTIONMARK.rb +11 -0
  112. data/lib/ramaze/store/default.rb +48 -0
  113. data/lib/ramaze/template.rb +102 -0
  114. data/lib/ramaze/template/amrita2.rb +40 -0
  115. data/lib/ramaze/template/erubis.rb +58 -0
  116. data/lib/ramaze/template/haml.rb +65 -0
  117. data/lib/ramaze/template/haml/actionview_stub.rb +20 -0
  118. data/lib/ramaze/template/liquid.rb +74 -0
  119. data/lib/ramaze/template/markaby.rb +68 -0
  120. data/lib/ramaze/template/ramaze.rb +177 -0
  121. data/lib/ramaze/template/ramaze/element.rb +166 -0
  122. data/lib/ramaze/template/ramaze/morpher.rb +156 -0
  123. data/lib/ramaze/tool/create.rb +70 -0
  124. data/lib/ramaze/tool/tidy.rb +71 -0
  125. data/lib/ramaze/trinity.rb +38 -0
  126. data/lib/ramaze/trinity/request.rb +244 -0
  127. data/lib/ramaze/trinity/response.rb +41 -0
  128. data/lib/ramaze/trinity/session.rb +129 -0
  129. data/lib/ramaze/version.rb +14 -0
  130. data/spec/spec_all.rb +73 -0
  131. data/spec/spec_helper.rb +215 -0
  132. data/spec/tc_adapter_mongrel.rb +24 -0
  133. data/spec/tc_adapter_webrick.rb +22 -0
  134. data/spec/tc_cache.rb +79 -0
  135. data/spec/tc_controller.rb +39 -0
  136. data/spec/tc_element.rb +100 -0
  137. data/spec/tc_error.rb +23 -0
  138. data/spec/tc_gestalt.rb +90 -0
  139. data/spec/tc_global.rb +46 -0
  140. data/spec/tc_helper_aspect.rb +65 -0
  141. data/spec/tc_helper_auth.rb +61 -0
  142. data/spec/tc_helper_cache.rb +81 -0
  143. data/spec/tc_helper_feed.rb +129 -0
  144. data/spec/tc_helper_form.rb +146 -0
  145. data/spec/tc_helper_link.rb +58 -0
  146. data/spec/tc_helper_redirect.rb +51 -0
  147. data/spec/tc_helper_stack.rb +55 -0
  148. data/spec/tc_morpher.rb +90 -0
  149. data/spec/tc_params.rb +84 -0
  150. data/spec/tc_request.rb +111 -0
  151. data/spec/tc_session.rb +56 -0
  152. data/spec/tc_store.rb +25 -0
  153. data/spec/tc_template_amrita2.rb +34 -0
  154. data/spec/tc_template_erubis.rb +41 -0
  155. data/spec/tc_template_haml.rb +44 -0
  156. data/spec/tc_template_liquid.rb +98 -0
  157. data/spec/tc_template_markaby.rb +74 -0
  158. data/spec/tc_template_ramaze.rb +54 -0
  159. data/spec/tc_tidy.rb +14 -0
  160. data/spec/template/amrita2/data.html +6 -0
  161. data/spec/template/amrita2/index.html +1 -0
  162. data/spec/template/amrita2/sum.html +1 -0
  163. data/spec/template/erubis/sum.rhtml +1 -0
  164. data/spec/template/haml/index.haml +5 -0
  165. data/spec/template/haml/with_vars.haml +4 -0
  166. data/spec/template/liquid/index.liquid +1 -0
  167. data/spec/template/liquid/products.liquid +45 -0
  168. data/spec/template/markaby/external.mab +8 -0
  169. data/spec/template/markaby/sum.mab +1 -0
  170. data/spec/template/ramaze/file_only.rmze +1 -0
  171. data/spec/template/ramaze/index.rmze +1 -0
  172. data/spec/template/ramaze/nested.rmze +1 -0
  173. data/spec/template/ramaze/sum.rmze +1 -0
  174. metadata +317 -0
@@ -0,0 +1,287 @@
1
+ # Allison RDoc template
2
+ # Copyright 2006 Cloudburst LLC
3
+
4
+ class String
5
+ # fuck this stupid rdoc templater system
6
+ def if_exists (item = nil)
7
+ unless item
8
+ self unless self =~ /(%(\w+)%)/
9
+ "\nIF:#{$2}\n#{self}\nENDIF:#{$2}\n"
10
+ else
11
+ "\nIF:#{item}\n#{self}\nENDIF:#{item}\n"
12
+ end
13
+ end
14
+ def loop(item)
15
+ "\nSTART:#{item}\n#{self}\nEND:#{item}\n"
16
+ end
17
+ end
18
+
19
+ module RDoc
20
+ module Page
21
+
22
+ puts "Invoking Allison template..."
23
+
24
+ require 'pathname'
25
+ CACHE_DIR = Pathname.new(__FILE__).dirname.to_s + "/cache"
26
+
27
+ begin
28
+ require 'rubygems'
29
+ gem 'markaby', '>= 0.5' # how come this isn't activate_gem(), since that's what it does?
30
+ require 'markaby'
31
+ require 'base64'
32
+
33
+ module Allison
34
+ # markaby page says markaby is better in its own module...
35
+
36
+ URL = "http://blog.evanweaver.com/articles/2006/06/02/allison"
37
+ IMGPATH = 'allison.gif'
38
+
39
+ FONTS = METHOD_LIST = SRC_PAGE = FILE_PAGE = CLASS_PAGE = ""
40
+
41
+ FR_INDEX_BODY = "!INCLUDE!" # who knows
42
+
43
+ STYLE, JAVASCRIPT = ["css", "js"].map do |extension|
44
+ s = File.open(File.dirname(__FILE__) + "/allison.#{extension}").read
45
+ # programmatic css, because we're so badass
46
+ if extension == "css"
47
+ puts "Compiling CSS..."
48
+ s_lines = s.split("\n")
49
+ meths = []
50
+ s_lines.collect! do |line|
51
+ line = line.squeeze(" ").strip
52
+ if line =~ /(\w+)/ and meths.include? $1
53
+ line = instance_eval line
54
+ #puts "Called method #{$1}"
55
+ elsif line !~ /\*\/|\/\*/ and line =~ /(@.*|^def (\w+).*)/
56
+ #printf "Evalled #{$1}"
57
+ result = instance_eval $1
58
+ #puts " to #{result.inspect}"
59
+ result = (result.is_a?(Fixnum) ? result.to_s + "px" : result.to_s)
60
+ line = (line == $1 ? "" : line.gsub($1, result))
61
+ meths.push $2 if $2
62
+ elsif line =~ /\%#{IMGPATH}\%/
63
+ img = Base64.encode64(File.open(File.dirname(__FILE__) + "/#{IMGPATH}") {|f| f.read}).gsub("\n", '')
64
+ line.sub!(/\%#{IMGPATH}\%/, img)
65
+ end
66
+ line !~ /^\s*$|\s*^\/\*.*\*\/\s*$|\{|\}/ ? line + ";" : line
67
+ end
68
+ s = s_lines.join("\n")
69
+ else
70
+ puts "Inlining Javascript..."
71
+ end
72
+ s
73
+ end
74
+
75
+ puts "Compiling XHTML..."
76
+
77
+ INDEX = Markaby::Builder.new.xhtml_strict do
78
+ head do
79
+ title '%title%'
80
+ link :rel => 'stylesheet', :type => 'text/css', :href => 'rdoc-style.css', :media => 'screen'
81
+ tag! :meta, 'http-equiv' => 'refresh', 'content' => '0;url=%initial_page%'
82
+ end
83
+ body do
84
+ div.container! do
85
+ 10.times {|n| div('', :class => "curve", :id => "preheader_curve_#{n}") }
86
+ div.header! do
87
+ span.title! do
88
+ p { ' ' }
89
+ h1 "Ruby Documentation"
90
+ end
91
+ end
92
+ div.clear {}
93
+ div.redirect! do
94
+ a :href => '%initial_page%' do
95
+ h1 "Redirect"
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end.to_s
101
+
102
+ FILE_INDEX = METHOD_INDEX = CLASS_INDEX = Markaby::Builder.new.capture do
103
+ a :href => '%href%' do
104
+ self << '%name%'
105
+ br
106
+ end
107
+ end.loop('entries')
108
+
109
+ BODY = Markaby::Builder.new.xhtml_strict do
110
+ head do
111
+ title "%title%"
112
+ link :rel => 'stylesheet', :type => 'text/css', :href => '%style_url%', :media => 'screen'
113
+ script :type => 'text/javascript' do
114
+ JAVASCRIPT
115
+ end
116
+ end
117
+ body do
118
+ div.container! do
119
+ 10.times {|n| div('', :class => "curve", :id => "preheader_curve_#{n}") }
120
+ div.header! do
121
+ p {'%full_path%'.if_exists}
122
+ span do
123
+ h1.title! '%title%'.if_exists
124
+ end
125
+ self << "!INCLUDE!" # always empty
126
+ end
127
+ div.clear {}
128
+ div.left! do
129
+ self << (div.navigation.dark.top.child_of! do
130
+ # death to you, horrible templater >:(
131
+ h3 "Child of"
132
+ self << "<span>\n#{"<a href='%par_url%'>".if_exists}%parent%#{"</a>".if_exists('par_url')}</span>"
133
+ end).if_exists('parent')
134
+
135
+ self << div.navigation.dark.top.defined_in! do
136
+ h3('Defined in')
137
+ self << a('%full_path%', :href => '%full_path_url%').if_exists.loop('infiles')
138
+ end.if_exists('infiles')
139
+
140
+ ['includes', 'requires', 'methods'].each do |item|
141
+ self << div.navigation.top(:id => item) do
142
+ self << h3(item.capitalize)
143
+ self << "<span class='bpink'>\n#{"<a href='%aref%'>".if_exists}%name%#{br}#{"</a>".if_exists('aref')}</span>".if_exists('name').loop(item)
144
+ end.if_exists(item)
145
+ end
146
+
147
+ div.spacer! ''
148
+
149
+ # for the javascript ajaxy includes
150
+ ['class', 'file', 'method'].each do |item|
151
+ div.navigation.dark.index :id => "#{item}_wrapper" do
152
+ div.list_header do
153
+ h3 'All ' + (item == 'class' ? 'classes' : item + 's')
154
+ end
155
+ div.list_header_link do
156
+ a((item == 'method' ? 'Show...' : 'Hide...'),
157
+ :id => "#{item}_link", :href => "#",
158
+ :onclick=> "toggle('#{item}'); toggleText('#{item}_link'); return false;")
159
+ end
160
+ div.clear {}
161
+ div(:id => item) do
162
+ form do
163
+ label(:for => "filter_#{item}") { 'Filter:' + '&nbsp;' * 2 }
164
+ input '', :type => 'text', :id => "filter_#{item}",
165
+ :onKeyUp => "return filterList('#{item}', this.value, event);",
166
+ :onKeyPress => "return disableSubmit(event);"
167
+ end
168
+ end
169
+ end
170
+ end
171
+
172
+ 10.times {|n| div('', :class => "curve", :id => "left_curve_#{n}") }
173
+ end
174
+
175
+ div.content! do
176
+ self << capture do
177
+ h1.item_name! '%title%'
178
+ end.if_exists('title')
179
+
180
+ self << capture do
181
+ h1 'Description'
182
+ self << '%description%'
183
+ end.if_exists('description')
184
+
185
+ self << capture do
186
+ self << h1 {a '%sectitle%', :name => '%secsequence%'}.if_exists('sectitle')
187
+ self << p {'%seccomment%'}.if_exists
188
+
189
+ self << capture do
190
+ h1 "Child modules and classes"
191
+ p '%classlist%'
192
+ end.if_exists('classlist')
193
+
194
+ ['constants', 'aliases', 'attributes'].each do |item|
195
+ self << capture do
196
+ h1(item.capitalize)
197
+ p do
198
+ table do
199
+ fields = %w[name value old_name new_name rw desc a_desc]
200
+ self << tr do
201
+ # header row
202
+ th.first " "
203
+ if item == 'constants'
204
+ th 'Name'
205
+ th 'Value'
206
+ elsif item == 'aliases'
207
+ th 'Old name'
208
+ th 'New name'
209
+ elsif item == 'attributes'
210
+ th 'Name'
211
+ th 'Read/write?'
212
+ end
213
+ th.description(:colspan => 2){"Description"}
214
+ end
215
+ self << tr do
216
+ # looped item rows
217
+ td.first " "
218
+ fields.each do |field|
219
+ if field !~ /desc/
220
+ self << td('%' + field + '%', :class => field =~ /^old|^name/ ? "highlight" : "normal").if_exists
221
+ else
222
+ self << td(('%' + field+ '%').if_exists)
223
+ end
224
+ end
225
+ end.loop(item)
226
+ end
227
+ end
228
+ end.if_exists(item)
229
+ end
230
+
231
+ self << capture do
232
+ div.section_spacer ''
233
+ h1('%type% %category% methods')
234
+ self << capture do
235
+ self << a.small(:name => '%aref%') {br}.if_exists
236
+ div.a_method do
237
+ div do
238
+ h3 { "<a href='#%aref%'>".if_exists + '%callseq%'.if_exists + '%name%'.if_exists + '%params%'.if_exists + "</a>".if_exists('aref')}
239
+ self << '%m_desc%'.if_exists
240
+
241
+ self << capture do
242
+ p.source_link :id => '%aref%-show-link' do
243
+ a "Show source...", :id => '%aref%-link', :href => "#",
244
+ :onclick=> "toggle('%aref%-source'); toggleText('%aref%-link'); return false;"
245
+ end
246
+ div.source :id => '%aref%-source' do
247
+ pre { '%sourcecode%' }
248
+ end
249
+ end.if_exists('sourcecode')
250
+ end
251
+ end
252
+
253
+ end.loop('methods').if_exists('methods')
254
+ end.loop('method_list').if_exists('method_list')
255
+
256
+ end.loop('sections').if_exists('sections')
257
+
258
+ end
259
+ end
260
+
261
+ div.footer!.clear do
262
+ a 'Allison', :href => URL
263
+ end
264
+
265
+ end
266
+ end.to_s
267
+ end
268
+
269
+ Allison.constants.each do |c|
270
+ eval "#{c} = Allison::#{c}" # jump out of the namespace
271
+ File.open("#{CACHE_DIR}/#{c}", 'w') do |f|
272
+ f.puts eval(c) # write cache
273
+ end
274
+ end
275
+
276
+ rescue LoadError => e
277
+ # guess we don't have some dependency. hope the cache is fresh!
278
+ lib = (e.to_s[/(.*)\(/, 1] or e.to_s).split(" ").last.capitalize
279
+ puts "Loading from cache (#{lib} was missing)..."
280
+ Dir[CACHE_DIR + '/*'].each do |filename|
281
+ eval("#{filename.split("/").last} = File.open(filename) {|s| s.read}")
282
+ end
283
+ end
284
+
285
+ end
286
+
287
+ end
@@ -0,0 +1,588 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>%title%</title><link rel="stylesheet" href="%style_url%" media="screen" type="text/css"/><script type="text/javascript">
2
+ // Javascript for Allison RDoc template
3
+ // Copyright 2006 Cloudburst LLC
4
+ // Some sections originally from public domain material
5
+
6
+ var href_base = '%style_url%'.replace(/(.*\/).*/, '$1'); // haha! inline js is good for something
7
+
8
+ function $(id) {
9
+ if (document.getElementById)
10
+ elem = document.getElementById(id);
11
+ else if ( document.all )
12
+ elem = eval("document.all." + id);
13
+ else
14
+ return false;
15
+ return elem;
16
+ }
17
+
18
+ function toggle(id) {
19
+ elem = $(id);
20
+ elemStyle = elem.style;
21
+ if (elemStyle.display == "block") {
22
+ elemStyle.display = "none"
23
+ } else {
24
+ elemStyle.display = "block"
25
+ }
26
+ return true;
27
+ }
28
+
29
+ function toggleText(id) {
30
+ elem = $(id)
31
+ if (m = elem.innerHTML.match(/(Hide)(.*)/)) {
32
+ elem.innerHTML = "Show" + m[2];
33
+ } else if (m = elem.innerHTML.match(/(Show)(.*)/)) {
34
+ elem.innerHTML = "Hide" + m[2];
35
+ }
36
+ return true;
37
+ }
38
+
39
+ function span(s, klass) {
40
+ return '<span class="' + klass + '">' + s + '</span>';
41
+ }
42
+
43
+ function highlightSymbols() {
44
+ pres = document.getElementsByTagName('pre');
45
+ for(var i = 0; i < pres.length; i++) {
46
+ pre = pres[i];
47
+ spans = pre.getElementsByTagName('span');
48
+ for(var k = 0; k < spans.length; k++) {
49
+ span = spans[k];
50
+ if (span.className.match(/ruby-identifier/)) {
51
+ if (span.innerHTML.match(/^:/)) {
52
+ span.className += " ruby-symbol";
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ function hasClass(obj) {
60
+ var result = false;
61
+ if (obj.getAttributeNode("class") != null) {
62
+ result = obj.getAttributeNode("class").value;
63
+ }
64
+ return result;
65
+ }
66
+
67
+ function stripe() {
68
+ var even = true;
69
+ var color = "#f4eefd";
70
+ var tables = document.getElementsByTagName('table');
71
+ if (tables.length == 0) { return; }
72
+ for (var h = 0; h < tables.length; h++) {
73
+ var trs = tables[h].getElementsByTagName("tr");
74
+ for (var i = 0; i < trs.length; i++) {
75
+ var tds = trs[i].getElementsByTagName("td");
76
+ for (var j = 0; j < tds.length; j++) {
77
+ if (hasClass(tds[j]) != "first") {
78
+ var mytd = tds[j];
79
+ if (even) {
80
+ mytd.style.backgroundColor = color;
81
+ }
82
+ }
83
+ }
84
+ even = ! even;
85
+ }
86
+ }
87
+ }
88
+
89
+ function ajaxGet(url) {
90
+ url = (href_base + url).replace('/./', '/')
91
+ var req = false;
92
+
93
+ if (window.ActiveXObject) {
94
+ try {
95
+ // stupid hack because IE7 disables local Ajax with the native xmlhttprequest object
96
+ // for security purposes. Yet ActiveX still works. Thanks, Microsoft. I hate you. Die.
97
+ req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
98
+ } catch (e) {
99
+ try {
100
+ /* IE 6 and maybe 5, don't know, don't care */
101
+ req = new ActiveXObject("Msxml2.XMLHTTP");
102
+ } catch (e) {
103
+ try {
104
+ req = new ActiveXObject("Microsoft.XMLHTTP");
105
+ } catch (e) {
106
+ req = false;
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ /* real browsers */
113
+ if (!req && window.XMLHttpRequest) {
114
+ try {
115
+ req = new XMLHttpRequest();
116
+ } catch (e) {
117
+ req = false;
118
+ }
119
+ }
120
+
121
+ if (req) {
122
+ req.open('GET', url, false);
123
+ req.send(null);
124
+ return req.responseText;
125
+ } else {
126
+ return "Ajax error";
127
+ }
128
+ }
129
+
130
+
131
+ function addEvent(elm, evType, fn, useCapture) {
132
+ if (elm.addEventListener) {
133
+ elm.addEventListener(evType, fn, useCapture);
134
+ return true;
135
+ } else if (elm.attachEvent) {
136
+ var r = elm.attachEvent('on' + evType, fn);
137
+ return r;
138
+ } else {
139
+ elm['on' + evType] = fn;
140
+ }
141
+ }
142
+
143
+ function insertIndices() {
144
+ pages = ["class", "file", "method"]
145
+ for (x in pages) {
146
+ $(pages[x]).innerHTML += ajaxGet('fr_' + pages[x] + '_index.html').replace(/(href=")/g, '$1' + href_base);
147
+ }
148
+ /* mouseoverify method links */
149
+ links = $('method').getElementsByTagName('a');
150
+ for (var x = 0; x < links.length; x++) {
151
+ if (m = links[x].innerHTML.match(/(.*)\s\((.*)\)/)) {
152
+ links[x].innerHTML = m[1] + '<br>';
153
+ links[x].title = m[2];
154
+ }
155
+ }
156
+ /* this is stupid */
157
+ $('class').style.display = "block";
158
+ $('file').style.display = "block";
159
+
160
+ /* has to be here because IE7 does not guarantee the onLoad callback order */
161
+ abbreviateIndicesInner(["class", "file"], 25, "a");
162
+ /* same, linkTitle() depends on the class link list */
163
+ linkTitle();
164
+ }
165
+
166
+ function abbreviateIndices() {
167
+ abbreviateIndicesInner(["defined_in", "child_of", "includes"], 20, 'a');
168
+ abbreviateIndicesInner(["defined_in", "requires", "child_of", "includes"], 20, 'span');
169
+ }
170
+
171
+ function abbreviateIndicesInner(indices, amount, tag) {
172
+ for (var x = 0; x < indices.length; x++) {
173
+ var the_index = $(indices[x]);
174
+ if (the_index) {
175
+ links = the_index.getElementsByTagName(tag);
176
+ for (var y = 0; y < links.length; y++) {
177
+ var link = links[y];
178
+ if (link.getElementsByTagName('span').length == 0 && link.getElementsByTagName('a').length == 0) {
179
+ // avoid nesting
180
+ link.innerHTML = abbreviate(link.innerHTML, amount);
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }
186
+
187
+ function linkTitle() {
188
+ /* grab the correct title element from the index */
189
+ var index_page = ajaxGet('index.html');
190
+ title_text = index_page.match(/<title>(.*)<\/title>/m)[1];
191
+ document.title = title_text + " - " + document.title;
192
+ var p = $('header').getElementsByTagName('p')[0]
193
+ if (p.innerHTML.match(/^\s*$/)) {
194
+ p.innerHTML = title_text;
195
+ } else {
196
+ p.innerHTML = title_text + ": " + p.innerHTML;
197
+ }
198
+ /* set the link properly */
199
+ title_link = index_page.match(/<a\s+href="(.*?)"/)[1];
200
+ var element = $('title');
201
+ var item_type = "";
202
+ var item_name = "";
203
+ if (m = element.innerHTML.match(/(Class:|Module:|File:)\s*(.*)/)) {
204
+ item_type = m[1];
205
+ item_name = m[2];
206
+ } else {
207
+ item_name = element.innerHTML;
208
+ }
209
+ element.innerHTML = '<a href="' + href_base + title_link + '">' + item_type + " " + abbreviate(item_name, 25) + '</a>';
210
+ /* breadcrumb navigation for the win */
211
+ items = item_name.split("::");
212
+ items_new = item_name.split("::");
213
+ var s = ""
214
+ file_links = $('class').getElementsByTagName('a');
215
+ for (var x = 0; x < items.length - 1; x++ ){
216
+ var item = items[x];
217
+ link = ("/classes/" + items.slice(0,x).join("/") + "/" + item + ".html").replace('//', '/');
218
+ regex = new RegExp(RegExp.escape(link) + '$');
219
+ for (var y = 0; y < file_links.length; y++) {
220
+ if (file_links[y].href.match(regex)) {
221
+ items_new[x] = '<a href="' + href_base + link + '">' + item + '</a>';
222
+ break;
223
+ }
224
+ }
225
+ }
226
+ $('item_name').innerHTML = item_type + ' ' + items_new.join(" :: ");
227
+ }
228
+
229
+ function abbreviate(s, size) {
230
+ while (s.length > size) {
231
+ var old_s = s;
232
+ s = s.replace(/\s|\n/mg, '');
233
+ s = s.replace(/([A-Z])[a-z]+/m, '$1');
234
+ if (!s || old_s == s) {
235
+ return "..." + s.substring(s.length - size, s.length);
236
+ }
237
+ }
238
+ return s;
239
+ }
240
+
241
+ function disableSubmit(event) {
242
+ var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
243
+ if (keyCode == 13) {
244
+ return false;
245
+ } else {
246
+ return true;
247
+ }
248
+ }
249
+
250
+ function filterList(id, s, event) {
251
+
252
+ /* some half-assed escaping */
253
+ s = s.replace(/[^\w\d\.\_\-\/\:\=\[\]\?\!]/g, '');
254
+ s = RegExp.escape(s);
255
+
256
+ var show_all = false;
257
+ if (s.match(/^\s*$/)) {
258
+ show_all = true;
259
+ }
260
+
261
+ links = $(id).getElementsByTagName('a')
262
+ regex = new RegExp(s, 'i');
263
+
264
+ for (var x = 0; x < links.length; x++) {
265
+ var link = links[x];
266
+ if (show_all) {
267
+ link.style.display = 'inline';
268
+ } else {
269
+ if (link.innerHTML.match(regex)) {
270
+ link.style.display = 'inline';
271
+ } else {
272
+ link.style.display = 'none';
273
+ }
274
+ }
275
+ }
276
+ return true;
277
+ }
278
+
279
+ RegExp.escape = function(text) {
280
+ if (!arguments.callee.sRE) {
281
+ var specials = [
282
+ '/', '.', '*', '+', '?', '|',
283
+ '(', ')', '[', ']', '{', '}', '\\\\'
284
+ ];
285
+ arguments.callee.sRE = new RegExp(
286
+ '(\\\\' + specials.join('|\\\\') + ')', 'g'
287
+ );
288
+ }
289
+ return text.replace(arguments.callee.sRE, '\\\\$1');
290
+ }
291
+
292
+
293
+ function hacks() {
294
+ // show the spacer if necessary,
295
+ divs = document.getElementsByTagName('div');
296
+ for (x in divs) {
297
+ if (divs[x].className && divs[x].className.match(/top/)) {
298
+ document.getElementById('spacer').style.display = 'block';
299
+ }
300
+ }
301
+ }
302
+
303
+ addEvent(window, 'load', insertIndices, false);
304
+ addEvent(window, 'load', abbreviateIndices, false);
305
+ addEvent(window, 'load', stripe, false);
306
+ addEvent(window, 'load', highlightSymbols, false);
307
+ addEvent(window, 'load', hacks, false);
308
+ </script></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div class="curve" id="preheader_curve_6"></div><div class="curve" id="preheader_curve_7"></div><div class="curve" id="preheader_curve_8"></div><div class="curve" id="preheader_curve_9"></div><div id="header"><p>
309
+ IF:full_path
310
+ %full_path%
311
+ ENDIF:full_path
312
+ </p><span><h1 id="title">
313
+ IF:title
314
+ %title%
315
+ ENDIF:title
316
+ </h1></span>!INCLUDE!</div><div class="clear"></div><div id="left">
317
+ IF:parent
318
+ <div class="navigation dark top" id="child_of"><h3>Child of</h3><span>
319
+
320
+ IF:par_url
321
+ <a href='%par_url%'>
322
+ ENDIF:par_url
323
+ %parent%
324
+ IF:par_url
325
+ </a>
326
+ ENDIF:par_url
327
+ </span></div>
328
+ ENDIF:parent
329
+
330
+ IF:infiles
331
+ <div class="navigation dark top" id="defined_in"><h3>Defined in</h3>
332
+ START:infiles
333
+
334
+ IF:full_path_url
335
+ <a href="%full_path_url%">%full_path%</a>
336
+ ENDIF:full_path_url
337
+
338
+ END:infiles
339
+ </div>
340
+ ENDIF:infiles
341
+
342
+ IF:includes
343
+ <div class="navigation top" id="includes"><h3>Includes</h3>
344
+ START:includes
345
+
346
+ IF:name
347
+ <span class='bpink'>
348
+
349
+ IF:aref
350
+ <a href='%aref%'>
351
+ ENDIF:aref
352
+ %name%<br/>
353
+ IF:aref
354
+ </a>
355
+ ENDIF:aref
356
+ </span>
357
+ ENDIF:name
358
+
359
+ END:includes
360
+ </div>
361
+ ENDIF:includes
362
+
363
+ IF:requires
364
+ <div class="navigation top" id="requires"><h3>Requires</h3>
365
+ START:requires
366
+
367
+ IF:name
368
+ <span class='bpink'>
369
+
370
+ IF:aref
371
+ <a href='%aref%'>
372
+ ENDIF:aref
373
+ %name%<br/>
374
+ IF:aref
375
+ </a>
376
+ ENDIF:aref
377
+ </span>
378
+ ENDIF:name
379
+
380
+ END:requires
381
+ </div>
382
+ ENDIF:requires
383
+
384
+ IF:methods
385
+ <div class="navigation top" id="methods"><h3>Methods</h3>
386
+ START:methods
387
+
388
+ IF:name
389
+ <span class='bpink'>
390
+
391
+ IF:aref
392
+ <a href='%aref%'>
393
+ ENDIF:aref
394
+ %name%<br/>
395
+ IF:aref
396
+ </a>
397
+ ENDIF:aref
398
+ </span>
399
+ ENDIF:name
400
+
401
+ END:methods
402
+ </div>
403
+ ENDIF:methods
404
+ <div id="spacer"></div><div class="navigation dark index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" id="class_link" onclick="toggle('class'); toggleText('class_link'); return false;">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter:&nbsp;&nbsp;</label><input onKeyPress="return disableSubmit(event);" id="filter_class" type="text" onKeyUp="return filterList('class', this.value, event);"></input></form></div></div><div class="navigation dark index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" id="file_link" onclick="toggle('file'); toggleText('file_link'); return false;">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter:&nbsp;&nbsp;</label><input onKeyPress="return disableSubmit(event);" id="filter_file" type="text" onKeyUp="return filterList('file', this.value, event);"></input></form></div></div><div class="navigation dark index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" id="method_link" onclick="toggle('method'); toggleText('method_link'); return false;">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter:&nbsp;&nbsp;</label><input onKeyPress="return disableSubmit(event);" id="filter_method" type="text" onKeyUp="return filterList('method', this.value, event);"></input></form></div></div><div class="curve" id="left_curve_0"></div><div class="curve" id="left_curve_1"></div><div class="curve" id="left_curve_2"></div><div class="curve" id="left_curve_3"></div><div class="curve" id="left_curve_4"></div><div class="curve" id="left_curve_5"></div><div class="curve" id="left_curve_6"></div><div class="curve" id="left_curve_7"></div><div class="curve" id="left_curve_8"></div><div class="curve" id="left_curve_9"></div></div><div id="content">
405
+ IF:title
406
+ <h1 id="item_name">%title%</h1>
407
+ ENDIF:title
408
+
409
+ IF:description
410
+ <h1>Description</h1>%description%
411
+ ENDIF:description
412
+
413
+ IF:sections
414
+
415
+ START:sections
416
+
417
+ IF:sectitle
418
+ <h1><a name="%secsequence%">%sectitle%</a></h1>
419
+ ENDIF:sectitle
420
+
421
+ IF:seccomment
422
+ <p>%seccomment%</p>
423
+ ENDIF:seccomment
424
+
425
+ IF:classlist
426
+ <h1>Child modules and classes</h1><p>%classlist%</p>
427
+ ENDIF:classlist
428
+
429
+ IF:constants
430
+ <h1>Constants</h1><p><table><tr><th class="first"> </th><th>Name</th><th>Value</th><th class="description" colspan="2">Description</th></tr>
431
+ START:constants
432
+ <tr><td class="first"> </td>
433
+ IF:name
434
+ <td class="highlight">%name%</td>
435
+ ENDIF:name
436
+
437
+ IF:value
438
+ <td class="normal">%value%</td>
439
+ ENDIF:value
440
+
441
+ IF:old_name
442
+ <td class="highlight">%old_name%</td>
443
+ ENDIF:old_name
444
+
445
+ IF:new_name
446
+ <td class="normal">%new_name%</td>
447
+ ENDIF:new_name
448
+
449
+ IF:rw
450
+ <td class="normal">%rw%</td>
451
+ ENDIF:rw
452
+ <td>
453
+ IF:desc
454
+ %desc%
455
+ ENDIF:desc
456
+ </td><td>
457
+ IF:a_desc
458
+ %a_desc%
459
+ ENDIF:a_desc
460
+ </td></tr>
461
+ END:constants
462
+ </table></p>
463
+ ENDIF:constants
464
+
465
+ IF:aliases
466
+ <h1>Aliases</h1><p><table><tr><th class="first"> </th><th>Old name</th><th>New name</th><th class="description" colspan="2">Description</th></tr>
467
+ START:aliases
468
+ <tr><td class="first"> </td>
469
+ IF:name
470
+ <td class="highlight">%name%</td>
471
+ ENDIF:name
472
+
473
+ IF:value
474
+ <td class="normal">%value%</td>
475
+ ENDIF:value
476
+
477
+ IF:old_name
478
+ <td class="highlight">%old_name%</td>
479
+ ENDIF:old_name
480
+
481
+ IF:new_name
482
+ <td class="normal">%new_name%</td>
483
+ ENDIF:new_name
484
+
485
+ IF:rw
486
+ <td class="normal">%rw%</td>
487
+ ENDIF:rw
488
+ <td>
489
+ IF:desc
490
+ %desc%
491
+ ENDIF:desc
492
+ </td><td>
493
+ IF:a_desc
494
+ %a_desc%
495
+ ENDIF:a_desc
496
+ </td></tr>
497
+ END:aliases
498
+ </table></p>
499
+ ENDIF:aliases
500
+
501
+ IF:attributes
502
+ <h1>Attributes</h1><p><table><tr><th class="first"> </th><th>Name</th><th>Read/write?</th><th class="description" colspan="2">Description</th></tr>
503
+ START:attributes
504
+ <tr><td class="first"> </td>
505
+ IF:name
506
+ <td class="highlight">%name%</td>
507
+ ENDIF:name
508
+
509
+ IF:value
510
+ <td class="normal">%value%</td>
511
+ ENDIF:value
512
+
513
+ IF:old_name
514
+ <td class="highlight">%old_name%</td>
515
+ ENDIF:old_name
516
+
517
+ IF:new_name
518
+ <td class="normal">%new_name%</td>
519
+ ENDIF:new_name
520
+
521
+ IF:rw
522
+ <td class="normal">%rw%</td>
523
+ ENDIF:rw
524
+ <td>
525
+ IF:desc
526
+ %desc%
527
+ ENDIF:desc
528
+ </td><td>
529
+ IF:a_desc
530
+ %a_desc%
531
+ ENDIF:a_desc
532
+ </td></tr>
533
+ END:attributes
534
+ </table></p>
535
+ ENDIF:attributes
536
+
537
+ IF:method_list
538
+
539
+ START:method_list
540
+ <div class="section_spacer"></div><h1>%type% %category% methods</h1>
541
+ IF:methods
542
+
543
+ START:methods
544
+
545
+ IF:aref
546
+ <a class="small" name="%aref%"><br/></a>
547
+ ENDIF:aref
548
+ <div class="a_method"><div><h3>
549
+ IF:aref
550
+ <a href='#%aref%'>
551
+ ENDIF:aref
552
+
553
+ IF:callseq
554
+ %callseq%
555
+ ENDIF:callseq
556
+
557
+ IF:name
558
+ %name%
559
+ ENDIF:name
560
+
561
+ IF:params
562
+ %params%
563
+ ENDIF:params
564
+
565
+ IF:aref
566
+ </a>
567
+ ENDIF:aref
568
+ </h3>
569
+ IF:m_desc
570
+ %m_desc%
571
+ ENDIF:m_desc
572
+
573
+ IF:sourcecode
574
+ <p class="source_link" id="%aref%-show-link"><a href="#" id="%aref%-link" onclick="toggle('%aref%-source'); toggleText('%aref%-link'); return false;">Show source...</a></p><div class="source" id="%aref%-source"><pre>%sourcecode%</pre></div>
575
+ ENDIF:sourcecode
576
+ </div></div>
577
+ END:methods
578
+
579
+ ENDIF:methods
580
+
581
+ END:method_list
582
+
583
+ ENDIF:method_list
584
+
585
+ END:sections
586
+
587
+ ENDIF:sections
588
+ </div></div><div class="clear" id="footer"><a href="http://blog.evanweaver.com/articles/2006/06/02/allison">Allison</a></div></body></html>