sword2ruby 1.0.0

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 (92) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +30 -0
  4. data/LICENCE +35 -0
  5. data/README.md +43 -0
  6. data/Rakefile +53 -0
  7. data/doc/Atom/Collection.html +837 -0
  8. data/doc/Atom/Element.html +197 -0
  9. data/doc/Atom/Entry.html +1795 -0
  10. data/doc/Atom/Feed.html +297 -0
  11. data/doc/Atom/Service.html +363 -0
  12. data/doc/Atom.html +158 -0
  13. data/doc/Gemfile.html +125 -0
  14. data/doc/Object.html +165 -0
  15. data/doc/REXML/Element.html +493 -0
  16. data/doc/REXML.html +158 -0
  17. data/doc/Rakefile.html +123 -0
  18. data/doc/Sword2Ruby/Atom.html +169 -0
  19. data/doc/Sword2Ruby/AutoDiscover.html +327 -0
  20. data/doc/Sword2Ruby/Connection.html +274 -0
  21. data/doc/Sword2Ruby/DepositReceipt.html +331 -0
  22. data/doc/Sword2Ruby/Exception.html +168 -0
  23. data/doc/Sword2Ruby/SwordAccept.html +169 -0
  24. data/doc/Sword2Ruby/SwordStatementOAIORE.html +277 -0
  25. data/doc/Sword2Ruby/User.html +272 -0
  26. data/doc/Sword2Ruby/Utility.html +1101 -0
  27. data/doc/Sword2Ruby.html +213 -0
  28. data/doc/created.rid +29 -0
  29. data/doc/images/add.png +0 -0
  30. data/doc/images/brick.png +0 -0
  31. data/doc/images/brick_link.png +0 -0
  32. data/doc/images/bug.png +0 -0
  33. data/doc/images/bullet_black.png +0 -0
  34. data/doc/images/bullet_toggle_minus.png +0 -0
  35. data/doc/images/bullet_toggle_plus.png +0 -0
  36. data/doc/images/date.png +0 -0
  37. data/doc/images/delete.png +0 -0
  38. data/doc/images/find.png +0 -0
  39. data/doc/images/loadingAnimation.gif +0 -0
  40. data/doc/images/macFFBgHack.png +0 -0
  41. data/doc/images/package.png +0 -0
  42. data/doc/images/page_green.png +0 -0
  43. data/doc/images/page_white_text.png +0 -0
  44. data/doc/images/page_white_width.png +0 -0
  45. data/doc/images/plugin.png +0 -0
  46. data/doc/images/ruby.png +0 -0
  47. data/doc/images/tag_blue.png +0 -0
  48. data/doc/images/tag_green.png +0 -0
  49. data/doc/images/transparent.png +0 -0
  50. data/doc/images/wrench.png +0 -0
  51. data/doc/images/wrench_orange.png +0 -0
  52. data/doc/images/zoom.png +0 -0
  53. data/doc/index.html +118 -0
  54. data/doc/js/darkfish.js +153 -0
  55. data/doc/js/jquery.js +18 -0
  56. data/doc/js/navigation.js +142 -0
  57. data/doc/js/search.js +94 -0
  58. data/doc/js/search_index.js +1 -0
  59. data/doc/js/searcher.js +228 -0
  60. data/doc/rdoc.css +543 -0
  61. data/doc/spec/fixtures/example_txt.html +125 -0
  62. data/doc/table_of_contents.html +267 -0
  63. data/lib/sword2ruby/auto_discover.rb +71 -0
  64. data/lib/sword2ruby/collection.rb +261 -0
  65. data/lib/sword2ruby/connection.rb +37 -0
  66. data/lib/sword2ruby/constant.rb +35 -0
  67. data/lib/sword2ruby/deposit_receipt.rb +52 -0
  68. data/lib/sword2ruby/element.rb +12 -0
  69. data/lib/sword2ruby/entry.rb +602 -0
  70. data/lib/sword2ruby/exception.rb +7 -0
  71. data/lib/sword2ruby/feed.rb +34 -0
  72. data/lib/sword2ruby/rexml_element.rb +79 -0
  73. data/lib/sword2ruby/service.rb +79 -0
  74. data/lib/sword2ruby/sword_accept.rb +10 -0
  75. data/lib/sword2ruby/sword_statement_oai_ore.rb +38 -0
  76. data/lib/sword2ruby/user.rb +25 -0
  77. data/lib/sword2ruby/utility.rb +232 -0
  78. data/lib/sword2ruby/version.rb +4 -0
  79. data/lib/sword2ruby.rb +32 -0
  80. data/spec/auto_discover_spec.rb +30 -0
  81. data/spec/collection_spec.rb +33 -0
  82. data/spec/connection_spec.rb +21 -0
  83. data/spec/end_to_end_spec.rb +235 -0
  84. data/spec/fixtures/example.txt +3 -0
  85. data/spec/fixtures/snowflake.png +0 -0
  86. data/spec/fixtures/zip-test.zip +0 -0
  87. data/spec/service_spec.rb +38 -0
  88. data/spec/statement_spec.rb +53 -0
  89. data/spec/test_constants.rb +32 -0
  90. data/sword2ruby.gemspec +42 -0
  91. data/sword2ruby.tmproj +27 -0
  92. metadata +197 -0
@@ -0,0 +1,213 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module Sword2Ruby - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/sword2ruby/auto_discover.rb
51
+ <li>lib/sword2ruby/collection.rb
52
+ <li>lib/sword2ruby/connection.rb
53
+ <li>lib/sword2ruby/constant.rb
54
+ <li>lib/sword2ruby/deposit_receipt.rb
55
+ <li>lib/sword2ruby/element.rb
56
+ <li>lib/sword2ruby/entry.rb
57
+ <li>lib/sword2ruby/exception.rb
58
+ <li>lib/sword2ruby/feed.rb
59
+ <li>lib/sword2ruby/rexml_element.rb
60
+ <li>lib/sword2ruby/service.rb
61
+ <li>lib/sword2ruby/sword_accept.rb
62
+ <li>lib/sword2ruby/sword_statement_oai_ore.rb
63
+ <li>lib/sword2ruby/user.rb
64
+ <li>lib/sword2ruby/utility.rb
65
+ <li>lib/sword2ruby/version.rb
66
+ <li>lib/sword2ruby.rb
67
+ </ul>
68
+ </nav>
69
+
70
+
71
+ </div>
72
+
73
+ <div id="class-metadata">
74
+
75
+
76
+
77
+
78
+ </div>
79
+
80
+ <div id="project-metadata">
81
+ <nav id="fileindex-section" class="section project-section">
82
+ <h3 class="section-header">Pages</h3>
83
+
84
+ <ul>
85
+
86
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
87
+
88
+ <li class="file"><a href="./Rakefile.html">Rakefile</a>
89
+
90
+ <li class="file"><a href="./spec/fixtures/example_txt.html">example</a>
91
+
92
+ </ul>
93
+ </nav>
94
+
95
+ <nav id="classindex-section" class="section project-section">
96
+ <h3 class="section-header">Class and Module Index</h3>
97
+
98
+ <ul class="link-list">
99
+
100
+ <li><a href="./Sword2Ruby.html">Sword2Ruby</a>
101
+
102
+ <li><a href="./Sword2Ruby/Atom.html">Sword2Ruby::Atom</a>
103
+
104
+ <li><a href="./Sword2Ruby/AutoDiscover.html">Sword2Ruby::AutoDiscover</a>
105
+
106
+ <li><a href="./Sword2Ruby/Connection.html">Sword2Ruby::Connection</a>
107
+
108
+ <li><a href="./Sword2Ruby/DepositReceipt.html">Sword2Ruby::DepositReceipt</a>
109
+
110
+ <li><a href="./Sword2Ruby/Exception.html">Sword2Ruby::Exception</a>
111
+
112
+ <li><a href="./Sword2Ruby/SwordAccept.html">Sword2Ruby::SwordAccept</a>
113
+
114
+ <li><a href="./Sword2Ruby/SwordStatementOAIORE.html">Sword2Ruby::SwordStatementOAIORE</a>
115
+
116
+ <li><a href="./Sword2Ruby/User.html">Sword2Ruby::User</a>
117
+
118
+ <li><a href="./Sword2Ruby/Utility.html">Sword2Ruby::Utility</a>
119
+
120
+ <li><a href="./Atom.html">Atom</a>
121
+
122
+ <li><a href="./Atom/Collection.html">Atom::Collection</a>
123
+
124
+ <li><a href="./Atom/Element.html">Atom::Element</a>
125
+
126
+ <li><a href="./Atom/Entry.html">Atom::Entry</a>
127
+
128
+ <li><a href="./Atom/Feed.html">Atom::Feed</a>
129
+
130
+ <li><a href="./Atom/Service.html">Atom::Service</a>
131
+
132
+ <li><a href="./REXML.html">REXML</a>
133
+
134
+ <li><a href="./REXML/Element.html">REXML::Element</a>
135
+
136
+ <li><a href="./Object.html">Object</a>
137
+
138
+ </ul>
139
+ </nav>
140
+
141
+ </div>
142
+ </nav>
143
+
144
+ <div id="documentation">
145
+ <h1 class="module">module Sword2Ruby</h1>
146
+
147
+ <div id="description" class="description">
148
+
149
+ <p><a href="Sword2Ruby.html">Sword2Ruby</a> module</p>
150
+
151
+ </div><!-- description -->
152
+
153
+
154
+
155
+
156
+ <section id="5Buntitled-5D" class="documentation-section">
157
+
158
+
159
+
160
+
161
+
162
+ <!-- Constants -->
163
+ <section id="constants-list" class="section">
164
+ <h3 class="section-header">Constants</h3>
165
+ <dl>
166
+
167
+ <dt id="ATOM_PUBLISHING_PROTOCOL_NAMESPACE">ATOM_PUBLISHING_PROTOCOL_NAMESPACE
168
+
169
+ <dd class="description"><p><a href="Sword2Ruby/Atom.html">Atom</a> Publishing Protocol namespace: <a
170
+ href="http://www.w3.org/2007/app">www.w3.org/2007/app</a></p>
171
+
172
+
173
+ <dt id="ATOM_SYNDICATION_FORMAT_NAMESPACE">ATOM_SYNDICATION_FORMAT_NAMESPACE
174
+
175
+ <dd class="description"><p>The <a href="Sword2Ruby/Atom.html">Atom</a> Syndication Format namespace:
176
+ <a href="http://www.w3.org/2005/Atom">www.w3.org/2005/Atom</a></p>
177
+
178
+
179
+ <dt id="NIL_LAMBDA">NIL_LAMBDA
180
+
181
+ <dd class="description"><p>A special lambda object representing the nil object, used by find() when
182
+ parsing XML which may or may not contain specific elements and attributes</p>
183
+
184
+
185
+ <dt id="VALID_URI_SCHEMES">VALID_URI_SCHEMES
186
+
187
+ <dd class="description"><p>An array of valid URL schemes: http://, https:// and file://</p>
188
+
189
+
190
+ <dt id="VERSION">VERSION
191
+
192
+ <dd class="description"><p>The version of the <a href="Sword2Ruby.html">Sword2Ruby</a> library</p>
193
+
194
+
195
+ </dl>
196
+ </section>
197
+
198
+
199
+
200
+
201
+ <!-- Methods -->
202
+
203
+ </section><!-- 5Buntitled-5D -->
204
+
205
+ </div><!-- documentation -->
206
+
207
+
208
+ <footer id="validator-badges">
209
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
210
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
211
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
212
+ </footer>
213
+
data/doc/created.rid ADDED
@@ -0,0 +1,29 @@
1
+ Wed, 11 Apr 2012 23:09:20 +0100
2
+ ./Gemfile Mon, 05 Mar 2012 11:53:08 +0000
3
+ ./lib/sword2ruby/auto_discover.rb Wed, 11 Apr 2012 18:05:50 +0100
4
+ ./lib/sword2ruby/collection.rb Sun, 08 Apr 2012 19:40:20 +0100
5
+ ./lib/sword2ruby/connection.rb Tue, 03 Apr 2012 19:31:30 +0100
6
+ ./lib/sword2ruby/constant.rb Tue, 27 Mar 2012 13:11:22 +0100
7
+ ./lib/sword2ruby/deposit_receipt.rb Mon, 09 Apr 2012 19:25:12 +0100
8
+ ./lib/sword2ruby/element.rb Sun, 08 Apr 2012 19:42:21 +0100
9
+ ./lib/sword2ruby/entry.rb Mon, 09 Apr 2012 19:39:13 +0100
10
+ ./lib/sword2ruby/exception.rb Tue, 03 Apr 2012 13:48:46 +0100
11
+ ./lib/sword2ruby/feed.rb Tue, 03 Apr 2012 19:30:04 +0100
12
+ ./lib/sword2ruby/rexml_element.rb Wed, 04 Apr 2012 11:09:21 +0100
13
+ ./lib/sword2ruby/service.rb Wed, 11 Apr 2012 18:52:31 +0100
14
+ ./lib/sword2ruby/sword_accept.rb Tue, 03 Apr 2012 19:29:27 +0100
15
+ ./lib/sword2ruby/sword_statement_oai_ore.rb Tue, 03 Apr 2012 13:49:14 +0100
16
+ ./lib/sword2ruby/user.rb Tue, 03 Apr 2012 13:49:18 +0100
17
+ ./lib/sword2ruby/utility.rb Tue, 03 Apr 2012 16:01:28 +0100
18
+ ./lib/sword2ruby/version.rb Sun, 08 Apr 2012 19:50:18 +0100
19
+ ./lib/sword2ruby.rb Tue, 03 Apr 2012 16:36:34 +0100
20
+ ./Rakefile Mon, 05 Mar 2012 11:53:08 +0000
21
+ ./spec/auto_discover_spec.rb Wed, 11 Apr 2012 18:32:47 +0100
22
+ ./spec/collection_spec.rb Wed, 11 Apr 2012 18:46:42 +0100
23
+ ./spec/connection_spec.rb Tue, 06 Mar 2012 14:37:06 +0000
24
+ ./spec/end_to_end_spec.rb Wed, 11 Apr 2012 18:20:50 +0100
25
+ ./spec/fixtures/example.txt Wed, 28 Mar 2012 15:10:34 +0100
26
+ ./spec/service_spec.rb Wed, 11 Apr 2012 19:01:04 +0100
27
+ ./spec/statement_spec.rb Wed, 11 Apr 2012 23:09:02 +0100
28
+ ./spec/test_constants.rb Wed, 11 Apr 2012 22:59:55 +0100
29
+ ./spec/test_spec.rb Wed, 28 Mar 2012 15:36:14 +0100
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/index.html ADDED
@@ -0,0 +1,118 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body>
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
53
+
54
+ <li class="file"><a href="./Rakefile.html">Rakefile</a>
55
+
56
+ <li class="file"><a href="./spec/fixtures/example_txt.html">example</a>
57
+
58
+ </ul>
59
+ </nav>
60
+
61
+ <nav id="classindex-section" class="section project-section">
62
+ <h3 class="section-header">Class and Module Index</h3>
63
+
64
+ <ul class="link-list">
65
+
66
+ <li><a href="./Sword2Ruby.html">Sword2Ruby</a>
67
+
68
+ <li><a href="./Sword2Ruby/Atom.html">Sword2Ruby::Atom</a>
69
+
70
+ <li><a href="./Sword2Ruby/AutoDiscover.html">Sword2Ruby::AutoDiscover</a>
71
+
72
+ <li><a href="./Sword2Ruby/Connection.html">Sword2Ruby::Connection</a>
73
+
74
+ <li><a href="./Sword2Ruby/DepositReceipt.html">Sword2Ruby::DepositReceipt</a>
75
+
76
+ <li><a href="./Sword2Ruby/Exception.html">Sword2Ruby::Exception</a>
77
+
78
+ <li><a href="./Sword2Ruby/SwordAccept.html">Sword2Ruby::SwordAccept</a>
79
+
80
+ <li><a href="./Sword2Ruby/SwordStatementOAIORE.html">Sword2Ruby::SwordStatementOAIORE</a>
81
+
82
+ <li><a href="./Sword2Ruby/User.html">Sword2Ruby::User</a>
83
+
84
+ <li><a href="./Sword2Ruby/Utility.html">Sword2Ruby::Utility</a>
85
+
86
+ <li><a href="./Atom.html">Atom</a>
87
+
88
+ <li><a href="./Atom/Collection.html">Atom::Collection</a>
89
+
90
+ <li><a href="./Atom/Element.html">Atom::Element</a>
91
+
92
+ <li><a href="./Atom/Entry.html">Atom::Entry</a>
93
+
94
+ <li><a href="./Atom/Feed.html">Atom::Feed</a>
95
+
96
+ <li><a href="./Atom/Service.html">Atom::Service</a>
97
+
98
+ <li><a href="./REXML.html">REXML</a>
99
+
100
+ <li><a href="./REXML/Element.html">REXML::Element</a>
101
+
102
+ <li><a href="./Object.html">Object</a>
103
+
104
+ </ul>
105
+ </nav>
106
+
107
+ </div>
108
+ </nav>
109
+
110
+ <p>This is the API documentation for RDoc Documentation.
111
+
112
+
113
+ <footer id="validator-badges">
114
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
115
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
116
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
117
+ </footer>
118
+
@@ -0,0 +1,153 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
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();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
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;
107
+ };
108
+
109
+ function highlightTarget( anchor ) {
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
+ });
121
+ };
122
+
123
+ function highlightLocationTarget() {
124
+ console.debug( "Location hash: %s", window.location.hash );
125
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
126
+
127
+ var anchor = window.location.hash.substring(1);
128
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
129
+
130
+ highlightTarget( anchor );
131
+ };
132
+
133
+ function highlightClickTarget( event ) {
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
+ };
142
+ };
143
+
144
+
145
+ $(document).ready( function() {
146
+ hookSourceViews();
147
+ hookDebuggingToggle();
148
+ hookSearch();
149
+ highlightLocationTarget();
150
+ hookTableOfContentsToggle();
151
+
152
+ $('ul.link-list a').bind( "click", highlightClickTarget );
153
+ });