epub-parser 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/MIT-LICENSE +1 -1
- data/README +7 -0
- data/lib/epub/book.rb +7 -1
- data/lib/epub/constants.rb +29 -0
- data/lib/epub/parser.rb +11 -3
- data/lib/epub/parser/publication.rb +14 -3
- data/lib/epub/parser/version.rb +1 -1
- data/lib/epub/publication/package.rb +6 -1
- data/lib/epub/publication/package/guide.rb +37 -2
- data/lib/epub/publication/package/manifest.rb +41 -4
- data/test/fixtures/book.epub +0 -0
- data/test/fixtures/book/OPS//343/203/253/343/203/274/343/203/210/343/203/225/343/202/241/343/202/244/343/203/253.opf +12 -2
- data/test/test_parser_publication.rb +73 -4
- metadata +26 -73
- data/doc/EPUB.html +0 -143
- data/doc/EPUB/Book.html +0 -616
- data/doc/EPUB/Constants.html +0 -130
- data/doc/EPUB/Constants/Type.html +0 -118
- data/doc/EPUB/ContentDocument.html +0 -108
- data/doc/EPUB/ContentDocument/Navigation.html +0 -673
- data/doc/EPUB/ContentDocument/Navigation/Nav.html +0 -563
- data/doc/EPUB/ContentDocument/Navigation/Nav/Ol.html +0 -285
- data/doc/EPUB/ContentDocument/Navigation/Nav/Ol/A.html +0 -354
- data/doc/EPUB/ContentDocument/Navigation/Nav/Ol/Span.html +0 -354
- data/doc/EPUB/OCF.html +0 -135
- data/doc/EPUB/OCF/Container.html +0 -358
- data/doc/EPUB/OCF/Container/Rootfile.html +0 -257
- data/doc/EPUB/OCF/Encryption.html +0 -111
- data/doc/EPUB/OCF/Manifest.html +0 -111
- data/doc/EPUB/OCF/Metadata.html +0 -111
- data/doc/EPUB/OCF/Rights.html +0 -111
- data/doc/EPUB/OCF/Signatures.html +0 -111
- data/doc/EPUB/Parser.html +0 -448
- data/doc/EPUB/Parser/ContentDocument.html +0 -531
- data/doc/EPUB/Parser/OCF.html +0 -635
- data/doc/EPUB/Parser/Publication.html +0 -640
- data/doc/EPUB/Publication.html +0 -108
- data/doc/EPUB/Publication/Package.html +0 -751
- data/doc/EPUB/Publication/Package/Bindings.html +0 -267
- data/doc/EPUB/Publication/Package/Bindings/MediaType.html +0 -257
- data/doc/EPUB/Publication/Package/Guide.html +0 -111
- data/doc/EPUB/Publication/Package/Manifest.html +0 -578
- data/doc/EPUB/Publication/Package/Manifest/Item.html +0 -669
- data/doc/EPUB/Publication/Package/Metadata.html +0 -257
- data/doc/EPUB/Publication/Package/Spine.html +0 -755
- data/doc/EPUB/Publication/Package/Spine/Itemref.html +0 -558
- data/doc/EPUB/Type.html +0 -118
- data/doc/_index.html +0 -422
- data/doc/class_list.html +0 -47
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -55
- data/doc/css/style.css +0 -322
- data/doc/file.README.html +0 -76
- data/doc/file_list.html +0 -49
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -76
- data/doc/js/app.js +0 -205
- data/doc/js/full_list.js +0 -167
- data/doc/js/jquery.js +0 -16
- data/doc/method_list.html +0 -902
- data/doc/top-level-namespace.html +0 -103
data/doc/EPUB/Parser.html
DELETED
@@ -1,448 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: EPUB::Parser
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '..';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="../_index.html">Index (P)</a> »
|
37
|
-
<span class='title'><span class='object_link'><a href="../EPUB.html" title="EPUB (module)">EPUB</a></span></span>
|
38
|
-
»
|
39
|
-
<span class="title">Parser</span>
|
40
|
-
|
41
|
-
|
42
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<div id="search">
|
46
|
-
|
47
|
-
<a id="class_list_link" href="#">Class List</a>
|
48
|
-
|
49
|
-
<a id="method_list_link" href="#">Method List</a>
|
50
|
-
|
51
|
-
<a id="file_list_link" href="#">File List</a>
|
52
|
-
|
53
|
-
</div>
|
54
|
-
<div class="clear"></div>
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<iframe id="search_frame"></iframe>
|
58
|
-
|
59
|
-
<div id="content"><h1>Class: EPUB::Parser
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</h1>
|
64
|
-
|
65
|
-
<dl class="box">
|
66
|
-
|
67
|
-
<dt class="r1">Inherits:</dt>
|
68
|
-
<dd class="r1">
|
69
|
-
<span class="inheritName">Object</span>
|
70
|
-
|
71
|
-
<ul class="fullTree">
|
72
|
-
<li>Object</li>
|
73
|
-
|
74
|
-
<li class="next">EPUB::Parser</li>
|
75
|
-
|
76
|
-
</ul>
|
77
|
-
<a href="#" class="inheritanceTree">show all</a>
|
78
|
-
|
79
|
-
</dd>
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<dt class="r2 last">Defined in:</dt>
|
90
|
-
<dd class="r2 last">lib/epub/parser.rb<span class="defines">,<br />
|
91
|
-
lib/epub/parser/ocf.rb,<br /> lib/epub/parser/version.rb,<br /> lib/epub/parser/publication.rb,<br /> lib/epub/parser/content_document.rb</span>
|
92
|
-
</dd>
|
93
|
-
|
94
|
-
</dl>
|
95
|
-
<div class="clear"></div>
|
96
|
-
|
97
|
-
<h2>Defined Under Namespace</h2>
|
98
|
-
<p class="children">
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Parser/ContentDocument.html" title="EPUB::Parser::ContentDocument (class)">ContentDocument</a></span>, <span class='object_link'><a href="Parser/OCF.html" title="EPUB::Parser::OCF (class)">OCF</a></span>, <span class='object_link'><a href="Parser/Publication.html" title="EPUB::Parser::Publication (class)">Publication</a></span>
|
104
|
-
|
105
|
-
|
106
|
-
</p>
|
107
|
-
|
108
|
-
<h2>Constant Summary</h2>
|
109
|
-
|
110
|
-
<dl class="constants">
|
111
|
-
|
112
|
-
<dt id="VERSION-constant" class="">VERSION =
|
113
|
-
|
114
|
-
</dt>
|
115
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.2</span><span class='tstring_end'>"</span></span></pre></dd>
|
116
|
-
|
117
|
-
</dl>
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
<h2>
|
126
|
-
Instance Method Summary
|
127
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
128
|
-
</h2>
|
129
|
-
|
130
|
-
<ul class="summary">
|
131
|
-
|
132
|
-
<li class="public ">
|
133
|
-
<span class="summary_signature">
|
134
|
-
|
135
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Parser) <strong>initialize</strong>(filepath, root_directory, options = {}) </a>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
</span>
|
140
|
-
|
141
|
-
<span class="note title constructor">constructor</span>
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<span class="summary_desc"><div class='inline'>
|
151
|
-
<p>A new instance of Parser.</p>
|
152
|
-
</div></span>
|
153
|
-
|
154
|
-
</li>
|
155
|
-
|
156
|
-
|
157
|
-
<li class="public ">
|
158
|
-
<span class="summary_signature">
|
159
|
-
|
160
|
-
<a href="#parse-instance_method" title="#parse (instance method)">- (Object) <strong>parse</strong> </a>
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
</span>
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
174
|
-
|
175
|
-
</li>
|
176
|
-
|
177
|
-
|
178
|
-
<li class="public ">
|
179
|
-
<span class="summary_signature">
|
180
|
-
|
181
|
-
<a href="#parse_content_document-instance_method" title="#parse_content_document (instance method)">- (Object) <strong>parse_content_document</strong> </a>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
</span>
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
195
|
-
|
196
|
-
</li>
|
197
|
-
|
198
|
-
|
199
|
-
<li class="public ">
|
200
|
-
<span class="summary_signature">
|
201
|
-
|
202
|
-
<a href="#parse_ocf-instance_method" title="#parse_ocf (instance method)">- (Object) <strong>parse_ocf</strong> </a>
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
</span>
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
216
|
-
|
217
|
-
</li>
|
218
|
-
|
219
|
-
|
220
|
-
<li class="public ">
|
221
|
-
<span class="summary_signature">
|
222
|
-
|
223
|
-
<a href="#parse_publication-instance_method" title="#parse_publication (instance method)">- (Object) <strong>parse_publication</strong> </a>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
</span>
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
237
|
-
|
238
|
-
</li>
|
239
|
-
|
240
|
-
|
241
|
-
</ul>
|
242
|
-
|
243
|
-
|
244
|
-
<div id="constructor_details" class="method_details_list">
|
245
|
-
<h2>Constructor Details</h2>
|
246
|
-
|
247
|
-
<div class="method_details first">
|
248
|
-
<p class="signature first" id="initialize-instance_method">
|
249
|
-
|
250
|
-
- (<tt><span class='object_link'><a href="" title="EPUB::Parser (class)">Parser</a></span></tt>) <strong>initialize</strong>(filepath, root_directory, options = {})
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
</p><div class="docstring">
|
255
|
-
<div class="discussion">
|
256
|
-
|
257
|
-
<p>A new instance of Parser</p>
|
258
|
-
|
259
|
-
|
260
|
-
</div>
|
261
|
-
</div>
|
262
|
-
<div class="tags">
|
263
|
-
|
264
|
-
|
265
|
-
</div><table class="source_code">
|
266
|
-
<tr>
|
267
|
-
<td>
|
268
|
-
<pre class="lines">
|
269
|
-
|
270
|
-
|
271
|
-
11
|
272
|
-
12
|
273
|
-
13
|
274
|
-
14
|
275
|
-
15
|
276
|
-
16
|
277
|
-
17
|
278
|
-
18
|
279
|
-
19
|
280
|
-
20
|
281
|
-
21
|
282
|
-
22
|
283
|
-
23
|
284
|
-
24</pre>
|
285
|
-
</td>
|
286
|
-
<td>
|
287
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser.rb', line 11</span>
|
288
|
-
|
289
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_filepath'>filepath</span><span class='comma'>,</span> <span class='id identifier rubyid_root_directory'>root_directory</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
290
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>File #{filepath} not readable</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable_real?'>readable_real?</span> <span class='id identifier rubyid_filepath'>filepath</span>
|
291
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>File #{root_directory} already exists</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_file?'>file?</span> <span class='id identifier rubyid_root_directory'>root_directory</span>
|
292
|
-
|
293
|
-
<span class='ivar'>@filepath</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_realpath'>realpath</span> <span class='id identifier rubyid_filepath'>filepath</span>
|
294
|
-
<span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_mkdir'>mkdir</span><span class='lparen'>(</span><span class='id identifier rubyid_root_directory'>root_directory</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span> <span class='id identifier rubyid_root_directory'>root_directory</span>
|
295
|
-
<span class='ivar'>@dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_realpath'>realpath</span> <span class='id identifier rubyid_root_directory'>root_directory</span>
|
296
|
-
|
297
|
-
<span class='ivar'>@book</span> <span class='op'>=</span> <span class='const'>Book</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
298
|
-
|
299
|
-
<span class='id identifier rubyid_unzip_cmd'>unzip_cmd</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>unzip-command</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>unzip</span><span class='tstring_end'>'</span></span>
|
300
|
-
<span class='id identifier rubyid_unzip_cmd'>unzip_cmd</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@filepath</span><span class='rbrace'>}</span><span class='tstring_content'> -d </span><span class='embexpr_beg'>#{</span><span class='ivar'>@dir</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
301
|
-
<span class='id identifier rubyid_system'>system</span> <span class='id identifier rubyid_unzip_cmd'>unzip_cmd</span>
|
302
|
-
<span class='kw'>end</span></pre>
|
303
|
-
</td>
|
304
|
-
</tr>
|
305
|
-
</table>
|
306
|
-
</div>
|
307
|
-
|
308
|
-
</div>
|
309
|
-
|
310
|
-
|
311
|
-
<div id="instance_method_details" class="method_details_list">
|
312
|
-
<h2>Instance Method Details</h2>
|
313
|
-
|
314
|
-
|
315
|
-
<div class="method_details first">
|
316
|
-
<p class="signature first" id="parse-instance_method">
|
317
|
-
|
318
|
-
- (<tt>Object</tt>) <strong>parse</strong>
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
</p><table class="source_code">
|
323
|
-
<tr>
|
324
|
-
<td>
|
325
|
-
<pre class="lines">
|
326
|
-
|
327
|
-
|
328
|
-
26
|
329
|
-
27
|
330
|
-
28
|
331
|
-
29
|
332
|
-
30
|
333
|
-
31
|
334
|
-
32
|
335
|
-
33</pre>
|
336
|
-
</td>
|
337
|
-
<td>
|
338
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser.rb', line 26</span>
|
339
|
-
|
340
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span>
|
341
|
-
<span class='ivar'>@book</span><span class='period'>.</span><span class='id identifier rubyid_ocf'>ocf</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_ocf'>parse_ocf</span>
|
342
|
-
<span class='ivar'>@book</span><span class='period'>.</span><span class='id identifier rubyid_package'>package</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_publication'>parse_publication</span>
|
343
|
-
<span class='ivar'>@book</span><span class='period'>.</span><span class='id identifier rubyid_content_document'>content_document</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_content_document'>parse_content_document</span>
|
344
|
-
<span class='comment'># ...
|
345
|
-
</span>
|
346
|
-
<span class='ivar'>@book</span>
|
347
|
-
<span class='kw'>end</span></pre>
|
348
|
-
</td>
|
349
|
-
</tr>
|
350
|
-
</table>
|
351
|
-
</div>
|
352
|
-
|
353
|
-
<div class="method_details ">
|
354
|
-
<p class="signature " id="parse_content_document-instance_method">
|
355
|
-
|
356
|
-
- (<tt>Object</tt>) <strong>parse_content_document</strong>
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
</p><table class="source_code">
|
361
|
-
<tr>
|
362
|
-
<td>
|
363
|
-
<pre class="lines">
|
364
|
-
|
365
|
-
|
366
|
-
43
|
367
|
-
44
|
368
|
-
45</pre>
|
369
|
-
</td>
|
370
|
-
<td>
|
371
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser.rb', line 43</span>
|
372
|
-
|
373
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_content_document'>parse_content_document</span>
|
374
|
-
<span class='comment'># ContentDocument.parse @dir
|
375
|
-
</span><span class='kw'>end</span></pre>
|
376
|
-
</td>
|
377
|
-
</tr>
|
378
|
-
</table>
|
379
|
-
</div>
|
380
|
-
|
381
|
-
<div class="method_details ">
|
382
|
-
<p class="signature " id="parse_ocf-instance_method">
|
383
|
-
|
384
|
-
- (<tt>Object</tt>) <strong>parse_ocf</strong>
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
</p><table class="source_code">
|
389
|
-
<tr>
|
390
|
-
<td>
|
391
|
-
<pre class="lines">
|
392
|
-
|
393
|
-
|
394
|
-
35
|
395
|
-
36
|
396
|
-
37</pre>
|
397
|
-
</td>
|
398
|
-
<td>
|
399
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser.rb', line 35</span>
|
400
|
-
|
401
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_ocf'>parse_ocf</span>
|
402
|
-
<span class='const'>OCF</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='ivar'>@dir</span>
|
403
|
-
<span class='kw'>end</span></pre>
|
404
|
-
</td>
|
405
|
-
</tr>
|
406
|
-
</table>
|
407
|
-
</div>
|
408
|
-
|
409
|
-
<div class="method_details ">
|
410
|
-
<p class="signature " id="parse_publication-instance_method">
|
411
|
-
|
412
|
-
- (<tt>Object</tt>) <strong>parse_publication</strong>
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
</p><table class="source_code">
|
417
|
-
<tr>
|
418
|
-
<td>
|
419
|
-
<pre class="lines">
|
420
|
-
|
421
|
-
|
422
|
-
39
|
423
|
-
40
|
424
|
-
41</pre>
|
425
|
-
</td>
|
426
|
-
<td>
|
427
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser.rb', line 39</span>
|
428
|
-
|
429
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_publication'>parse_publication</span>
|
430
|
-
<span class='const'>Publication</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='ivar'>@dir</span><span class='comma'>,</span> <span class='ivar'>@book</span><span class='period'>.</span><span class='id identifier rubyid_rootfile_path'>rootfile_path</span><span class='rparen'>)</span>
|
431
|
-
<span class='kw'>end</span></pre>
|
432
|
-
</td>
|
433
|
-
</tr>
|
434
|
-
</table>
|
435
|
-
</div>
|
436
|
-
|
437
|
-
</div>
|
438
|
-
|
439
|
-
</div>
|
440
|
-
|
441
|
-
<div id="footer">
|
442
|
-
Generated on Fri Dec 30 08:49:44 2011 by
|
443
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
444
|
-
0.7.4 (ruby-1.9.3).
|
445
|
-
</div>
|
446
|
-
|
447
|
-
</body>
|
448
|
-
</html>
|
@@ -1,531 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: EPUB::Parser::ContentDocument
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '../..';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="../../_index.html">Index (C)</a> »
|
37
|
-
<span class='title'><span class='object_link'><a href="../../EPUB.html" title="EPUB (module)">EPUB</a></span></span> » <span class='title'><span class='object_link'><a href="../Parser.html" title="EPUB::Parser (class)">Parser</a></span></span>
|
38
|
-
»
|
39
|
-
<span class="title">ContentDocument</span>
|
40
|
-
|
41
|
-
|
42
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<div id="search">
|
46
|
-
|
47
|
-
<a id="class_list_link" href="#">Class List</a>
|
48
|
-
|
49
|
-
<a id="method_list_link" href="#">Method List</a>
|
50
|
-
|
51
|
-
<a id="file_list_link" href="#">File List</a>
|
52
|
-
|
53
|
-
</div>
|
54
|
-
<div class="clear"></div>
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<iframe id="search_frame"></iframe>
|
58
|
-
|
59
|
-
<div id="content"><h1>Class: EPUB::Parser::ContentDocument
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</h1>
|
64
|
-
|
65
|
-
<dl class="box">
|
66
|
-
|
67
|
-
<dt class="r1">Inherits:</dt>
|
68
|
-
<dd class="r1">
|
69
|
-
<span class="inheritName">Object</span>
|
70
|
-
|
71
|
-
<ul class="fullTree">
|
72
|
-
<li>Object</li>
|
73
|
-
|
74
|
-
<li class="next">EPUB::Parser::ContentDocument</li>
|
75
|
-
|
76
|
-
</ul>
|
77
|
-
<a href="#" class="inheritanceTree">show all</a>
|
78
|
-
|
79
|
-
</dd>
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<dt class="r2 last">Defined in:</dt>
|
90
|
-
<dd class="r2 last">lib/epub/parser/content_document.rb</dd>
|
91
|
-
|
92
|
-
</dl>
|
93
|
-
<div class="clear"></div>
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<h2>
|
102
|
-
Class Method Summary
|
103
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
104
|
-
</h2>
|
105
|
-
|
106
|
-
<ul class="summary">
|
107
|
-
|
108
|
-
<li class="public ">
|
109
|
-
<span class="summary_signature">
|
110
|
-
|
111
|
-
<a href="#parse-class_method" title="parse (class method)">+ (Object) <strong>parse</strong>(root_directory) </a>
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
</span>
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
125
|
-
|
126
|
-
</li>
|
127
|
-
|
128
|
-
|
129
|
-
</ul>
|
130
|
-
|
131
|
-
<h2>
|
132
|
-
Instance Method Summary
|
133
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
134
|
-
</h2>
|
135
|
-
|
136
|
-
<ul class="summary">
|
137
|
-
|
138
|
-
<li class="public ">
|
139
|
-
<span class="summary_signature">
|
140
|
-
|
141
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (ContentDocument) <strong>initialize</strong>(root_directory) </a>
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
</span>
|
146
|
-
|
147
|
-
<span class="note title constructor">constructor</span>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<span class="summary_desc"><div class='inline'>
|
157
|
-
<p>A new instance of ContentDocument.</p>
|
158
|
-
</div></span>
|
159
|
-
|
160
|
-
</li>
|
161
|
-
|
162
|
-
|
163
|
-
<li class="public ">
|
164
|
-
<span class="summary_signature">
|
165
|
-
|
166
|
-
<a href="#parse-instance_method" title="#parse (instance method)">- (Object) <strong>parse</strong> </a>
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
</span>
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
180
|
-
|
181
|
-
</li>
|
182
|
-
|
183
|
-
|
184
|
-
<li class="public ">
|
185
|
-
<span class="summary_signature">
|
186
|
-
|
187
|
-
<a href="#parse_navigation-instance_method" title="#parse_navigation (instance method)">- (EPUB::ContentDocument::Navigation::Nav) <strong>parse_navigation</strong>(element) </a>
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
</span>
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
<span class="summary_desc"><div class='inline'>
|
201
|
-
<p>Nav Nav object.</p>
|
202
|
-
</div></span>
|
203
|
-
|
204
|
-
</li>
|
205
|
-
|
206
|
-
|
207
|
-
<li class="public ">
|
208
|
-
<span class="summary_signature">
|
209
|
-
|
210
|
-
<a href="#parse_navigations-instance_method" title="#parse_navigations (instance method)">- (Array<EPUB::ContentDocument::Navigation::Nav>) <strong>parse_navigations</strong>(document) </a>
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
</span>
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
<span class="summary_desc"><div class='inline'>
|
224
|
-
<p>Navs array of Nav object.</p>
|
225
|
-
</div></span>
|
226
|
-
|
227
|
-
</li>
|
228
|
-
|
229
|
-
|
230
|
-
</ul>
|
231
|
-
|
232
|
-
|
233
|
-
<div id="constructor_details" class="method_details_list">
|
234
|
-
<h2>Constructor Details</h2>
|
235
|
-
|
236
|
-
<div class="method_details first">
|
237
|
-
<p class="signature first" id="initialize-instance_method">
|
238
|
-
|
239
|
-
- (<tt><span class='object_link'><a href="" title="EPUB::Parser::ContentDocument (class)">ContentDocument</a></span></tt>) <strong>initialize</strong>(root_directory)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
</p><div class="docstring">
|
244
|
-
<div class="discussion">
|
245
|
-
|
246
|
-
<p>A new instance of ContentDocument</p>
|
247
|
-
|
248
|
-
|
249
|
-
</div>
|
250
|
-
</div>
|
251
|
-
<div class="tags">
|
252
|
-
|
253
|
-
|
254
|
-
</div><table class="source_code">
|
255
|
-
<tr>
|
256
|
-
<td>
|
257
|
-
<pre class="lines">
|
258
|
-
|
259
|
-
|
260
|
-
14
|
261
|
-
15
|
262
|
-
16</pre>
|
263
|
-
</td>
|
264
|
-
<td>
|
265
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser/content_document.rb', line 14</span>
|
266
|
-
|
267
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_root_directory'>root_directory</span><span class='rparen'>)</span>
|
268
|
-
<span class='ivar'>@dir</span> <span class='op'>=</span> <span class='id identifier rubyid_root_directory'>root_directory</span>
|
269
|
-
<span class='kw'>end</span></pre>
|
270
|
-
</td>
|
271
|
-
</tr>
|
272
|
-
</table>
|
273
|
-
</div>
|
274
|
-
|
275
|
-
</div>
|
276
|
-
|
277
|
-
|
278
|
-
<div id="class_method_details" class="method_details_list">
|
279
|
-
<h2>Class Method Details</h2>
|
280
|
-
|
281
|
-
|
282
|
-
<div class="method_details first">
|
283
|
-
<p class="signature first" id="parse-class_method">
|
284
|
-
|
285
|
-
+ (<tt>Object</tt>) <strong>parse</strong>(root_directory)
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
</p><table class="source_code">
|
290
|
-
<tr>
|
291
|
-
<td>
|
292
|
-
<pre class="lines">
|
293
|
-
|
294
|
-
|
295
|
-
9
|
296
|
-
10
|
297
|
-
11</pre>
|
298
|
-
</td>
|
299
|
-
<td>
|
300
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser/content_document.rb', line 9</span>
|
301
|
-
|
302
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_root_directory'>root_directory</span><span class='rparen'>)</span>
|
303
|
-
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_root_directory'>root_directory</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span>
|
304
|
-
<span class='kw'>end</span></pre>
|
305
|
-
</td>
|
306
|
-
</tr>
|
307
|
-
</table>
|
308
|
-
</div>
|
309
|
-
|
310
|
-
</div>
|
311
|
-
|
312
|
-
<div id="instance_method_details" class="method_details_list">
|
313
|
-
<h2>Instance Method Details</h2>
|
314
|
-
|
315
|
-
|
316
|
-
<div class="method_details first">
|
317
|
-
<p class="signature first" id="parse-instance_method">
|
318
|
-
|
319
|
-
- (<tt>Object</tt>) <strong>parse</strong>
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
</p><table class="source_code">
|
324
|
-
<tr>
|
325
|
-
<td>
|
326
|
-
<pre class="lines">
|
327
|
-
|
328
|
-
|
329
|
-
18
|
330
|
-
19
|
331
|
-
20</pre>
|
332
|
-
</td>
|
333
|
-
<td>
|
334
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser/content_document.rb', line 18</span>
|
335
|
-
|
336
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span>
|
337
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Not implemented yet</span><span class='tstring_end'>'</span></span>
|
338
|
-
<span class='kw'>end</span></pre>
|
339
|
-
</td>
|
340
|
-
</tr>
|
341
|
-
</table>
|
342
|
-
</div>
|
343
|
-
|
344
|
-
<div class="method_details ">
|
345
|
-
<p class="signature " id="parse_navigation-instance_method">
|
346
|
-
|
347
|
-
- (<tt><span class='object_link'><a href="../ContentDocument/Navigation/Nav.html" title="EPUB::ContentDocument::Navigation::Nav (class)">EPUB::ContentDocument::Navigation::Nav</a></span></tt>) <strong>parse_navigation</strong>(element)
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
</p><div class="docstring">
|
352
|
-
<div class="discussion">
|
353
|
-
|
354
|
-
<p>Nav Nav object</p>
|
355
|
-
|
356
|
-
|
357
|
-
</div>
|
358
|
-
</div>
|
359
|
-
<div class="tags">
|
360
|
-
<h3>Parameters:</h3>
|
361
|
-
<ul class="param">
|
362
|
-
|
363
|
-
<li>
|
364
|
-
|
365
|
-
<span class='name'>nav</span>
|
366
|
-
|
367
|
-
|
368
|
-
<span class='type'>(<tt>Nokogiri::XML::Element</tt>)</span>
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
—
|
373
|
-
<div class='inline'>
|
374
|
-
<p>nav element</p>
|
375
|
-
</div>
|
376
|
-
|
377
|
-
</li>
|
378
|
-
|
379
|
-
</ul>
|
380
|
-
|
381
|
-
<h3>Returns:</h3>
|
382
|
-
<ul class="return">
|
383
|
-
|
384
|
-
<li>
|
385
|
-
|
386
|
-
|
387
|
-
<span class='type'>(<tt><span class='object_link'><a href="../ContentDocument/Navigation/Nav.html" title="EPUB::ContentDocument::Navigation::Nav (class)">EPUB::ContentDocument::Navigation::Nav</a></span></tt>)</span>
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
—
|
392
|
-
<div class='inline'>
|
393
|
-
<p>nav Nav object</p>
|
394
|
-
</div>
|
395
|
-
|
396
|
-
</li>
|
397
|
-
|
398
|
-
</ul>
|
399
|
-
|
400
|
-
</div><table class="source_code">
|
401
|
-
<tr>
|
402
|
-
<td>
|
403
|
-
<pre class="lines">
|
404
|
-
|
405
|
-
|
406
|
-
30
|
407
|
-
31
|
408
|
-
32
|
409
|
-
33
|
410
|
-
34
|
411
|
-
35
|
412
|
-
36
|
413
|
-
37
|
414
|
-
38
|
415
|
-
39
|
416
|
-
40
|
417
|
-
41
|
418
|
-
42
|
419
|
-
43</pre>
|
420
|
-
</td>
|
421
|
-
<td>
|
422
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser/content_document.rb', line 30</span>
|
423
|
-
|
424
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_navigation'>parse_navigation</span><span class='lparen'>(</span><span class='id identifier rubyid_element'>element</span><span class='rparen'>)</span>
|
425
|
-
<span class='id identifier rubyid_nav'>nav</span> <span class='op'>=</span> <span class='const'>EPUB</span><span class='op'>::</span><span class='const'>ContentDocument</span><span class='op'>::</span><span class='const'>Navigation</span><span class='op'>::</span><span class='const'>Nav</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
426
|
-
<span class='id identifier rubyid_nav'>nav</span><span class='period'>.</span><span class='id identifier rubyid_heading'>heading</span> <span class='op'>=</span> <span class='id identifier rubyid_find_heading'>find_heading</span> <span class='id identifier rubyid_element'>element</span>
|
427
|
-
|
428
|
-
<span class='comment'># to find type, need to use strict xpath for handling namespaces?
|
429
|
-
</span> <span class='comment'># And if so, where should the namespaces be defined?
|
430
|
-
</span> <span class='comment'># nav.type = element['epub:type']
|
431
|
-
</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_namespaces'>namespaces</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>epub</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://www.idpf.org/2007/ops</span><span class='tstring_end'>"</span></span>
|
432
|
-
<span class='id identifier rubyid_p'>p</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_namespaces'>namespaces</span>
|
433
|
-
<span class='id identifier rubyid_nav'>nav</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_element'>element</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>epub:type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
434
|
-
<span class='id identifier rubyid_p'>p</span> <span class='id identifier rubyid_nav'>nav</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span>
|
435
|
-
|
436
|
-
<span class='id identifier rubyid_nav'>nav</span>
|
437
|
-
<span class='kw'>end</span></pre>
|
438
|
-
</td>
|
439
|
-
</tr>
|
440
|
-
</table>
|
441
|
-
</div>
|
442
|
-
|
443
|
-
<div class="method_details ">
|
444
|
-
<p class="signature " id="parse_navigations-instance_method">
|
445
|
-
|
446
|
-
- (<tt>Array<<span class='object_link'><a href="../ContentDocument/Navigation/Nav.html" title="EPUB::ContentDocument::Navigation::Nav (class)">EPUB::ContentDocument::Navigation::Nav</a></span>></tt>) <strong>parse_navigations</strong>(document)
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
</p><div class="docstring">
|
451
|
-
<div class="discussion">
|
452
|
-
|
453
|
-
<p>Navs array of Nav object</p>
|
454
|
-
|
455
|
-
|
456
|
-
</div>
|
457
|
-
</div>
|
458
|
-
<div class="tags">
|
459
|
-
<h3>Parameters:</h3>
|
460
|
-
<ul class="param">
|
461
|
-
|
462
|
-
<li>
|
463
|
-
|
464
|
-
<span class='name'>document</span>
|
465
|
-
|
466
|
-
|
467
|
-
<span class='type'>(<tt>Nokogiri::HTML::Document</tt>)</span>
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
—
|
472
|
-
<div class='inline'>
|
473
|
-
<p>HTML document or element including nav</p>
|
474
|
-
</div>
|
475
|
-
|
476
|
-
</li>
|
477
|
-
|
478
|
-
</ul>
|
479
|
-
|
480
|
-
<h3>Returns:</h3>
|
481
|
-
<ul class="return">
|
482
|
-
|
483
|
-
<li>
|
484
|
-
|
485
|
-
|
486
|
-
<span class='type'>(<tt>Array<<span class='object_link'><a href="../ContentDocument/Navigation/Nav.html" title="EPUB::ContentDocument::Navigation::Nav (class)">EPUB::ContentDocument::Navigation::Nav</a></span>></tt>)</span>
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
—
|
491
|
-
<div class='inline'>
|
492
|
-
<p>navs array of Nav object</p>
|
493
|
-
</div>
|
494
|
-
|
495
|
-
</li>
|
496
|
-
|
497
|
-
</ul>
|
498
|
-
|
499
|
-
</div><table class="source_code">
|
500
|
-
<tr>
|
501
|
-
<td>
|
502
|
-
<pre class="lines">
|
503
|
-
|
504
|
-
|
505
|
-
24
|
506
|
-
25
|
507
|
-
26</pre>
|
508
|
-
</td>
|
509
|
-
<td>
|
510
|
-
<pre class="code"><span class="info file"># File 'lib/epub/parser/content_document.rb', line 24</span>
|
511
|
-
|
512
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_navigations'>parse_navigations</span><span class='lparen'>(</span><span class='id identifier rubyid_document'>document</span><span class='rparen'>)</span>
|
513
|
-
<span class='id identifier rubyid_navs'>navs</span> <span class='op'>=</span> <span class='id identifier rubyid_document'>document</span><span class='period'>.</span><span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/xhtml:html/xhtml:body//xhtml:nav</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='const'>EPUB</span><span class='op'>::</span><span class='const'>NAMESPACES</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span> <span class='id identifier rubyid_parse_navigation'>parse_navigation</span> <span class='id identifier rubyid_elem'>elem</span><span class='rbrace'>}</span>
|
514
|
-
<span class='kw'>end</span></pre>
|
515
|
-
</td>
|
516
|
-
</tr>
|
517
|
-
</table>
|
518
|
-
</div>
|
519
|
-
|
520
|
-
</div>
|
521
|
-
|
522
|
-
</div>
|
523
|
-
|
524
|
-
<div id="footer">
|
525
|
-
Generated on Fri Dec 30 08:49:44 2011 by
|
526
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
527
|
-
0.7.4 (ruby-1.9.3).
|
528
|
-
</div>
|
529
|
-
|
530
|
-
</body>
|
531
|
-
</html>
|