epub-parser 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -0
- data/.yardopts +3 -0
- data/Gemfile +1 -1
- data/MIT-LICENSE +1 -1
- data/README.markdown +64 -11
- data/Rakefile +16 -6
- data/bin/epub-open +25 -0
- data/bin/epubinfo +1 -1
- data/epub-parser.gemspec +1 -2
- data/lib/epub.rb +1 -2
- data/lib/epub/constants.rb +3 -1
- data/lib/epub/content_document/navigation.rb +31 -42
- data/lib/epub/content_document/xhtml.rb +12 -0
- data/lib/epub/parser.rb +36 -6
- data/lib/epub/parser/content_document.rb +74 -6
- data/lib/epub/parser/ocf.rb +4 -1
- data/lib/epub/parser/publication.rb +34 -26
- data/lib/epub/parser/utils.rb +20 -0
- data/lib/epub/parser/version.rb +1 -1
- data/lib/epub/publication/package/manifest.rb +12 -3
- data/lib/epub/publication/package/metadata.rb +29 -1
- data/test/helper.rb +1 -0
- data/test/test_parser.rb +0 -1
- data/test/test_parser_content_document.rb +17 -4
- data/test/test_parser_ocf.rb +0 -1
- data/test/test_parser_publication.rb +0 -1
- data/test/test_publication.rb +20 -0
- metadata +140 -101
data/test/test_parser_ocf.rb
CHANGED
data/test/test_publication.rb
CHANGED
@@ -29,4 +29,24 @@ class TestPublication < Test::Unit::TestCase
|
|
29
29
|
assert_same refinee.refiners.first, refiner
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
class TestManifest < TestPublication
|
34
|
+
class TestItem < TestManifest
|
35
|
+
def test_content_document_returns_nil_when_not_xhtml_nor_svg
|
36
|
+
item = EPUB::Publication::Package::Manifest::Item.new
|
37
|
+
item.media_type = 'some/media'
|
38
|
+
assert_nil item.content_document
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_content_document_returns_navigation_document_when_nav
|
42
|
+
item = EPUB::Publication::Package::Manifest::Item.new
|
43
|
+
item.media_type = 'application/xhtml+xml'
|
44
|
+
item.properties = %w[nav]
|
45
|
+
stub(item).read {File.read(File.expand_path('../fixtures/book/OPS/nav.xhtml', __FILE__))}
|
46
|
+
stub(item).manifest.stub!.items {[]}
|
47
|
+
|
48
|
+
assert_instance_of EPUB::ContentDocument::Navigation, item.content_document
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
32
52
|
end
|
metadata
CHANGED
@@ -1,218 +1,272 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- KITAITI Makoto
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rubygems-test
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rake
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: pry
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - '>='
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: pry-doc
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: test-unit-full
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
|
-
- -
|
73
|
+
- - '>='
|
64
74
|
- !ruby/object:Gem::Version
|
65
75
|
version: '0'
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: simplecov
|
71
|
-
requirement:
|
72
|
-
none: false
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
73
86
|
requirements:
|
74
|
-
- -
|
87
|
+
- - '>='
|
75
88
|
- !ruby/object:Gem::Version
|
76
89
|
version: '0'
|
77
90
|
type: :development
|
78
91
|
prerelease: false
|
79
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
80
97
|
- !ruby/object:Gem::Dependency
|
81
98
|
name: thin
|
82
|
-
requirement:
|
83
|
-
none: false
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
84
100
|
requirements:
|
85
|
-
- -
|
101
|
+
- - '>='
|
86
102
|
- !ruby/object:Gem::Version
|
87
103
|
version: '0'
|
88
104
|
type: :development
|
89
105
|
prerelease: false
|
90
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
91
111
|
- !ruby/object:Gem::Dependency
|
92
112
|
name: yard
|
93
|
-
requirement:
|
94
|
-
none: false
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
95
114
|
requirements:
|
96
|
-
- -
|
115
|
+
- - '>='
|
97
116
|
- !ruby/object:Gem::Version
|
98
117
|
version: '0'
|
99
118
|
type: :development
|
100
119
|
prerelease: false
|
101
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
102
125
|
- !ruby/object:Gem::Dependency
|
103
126
|
name: gem-man
|
104
|
-
requirement:
|
105
|
-
none: false
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
106
128
|
requirements:
|
107
|
-
- -
|
129
|
+
- - '>='
|
108
130
|
- !ruby/object:Gem::Version
|
109
131
|
version: '0'
|
110
132
|
type: :development
|
111
133
|
prerelease: false
|
112
|
-
version_requirements:
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
113
139
|
- !ruby/object:Gem::Dependency
|
114
140
|
name: ronn
|
115
|
-
requirement:
|
116
|
-
none: false
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
117
142
|
requirements:
|
118
|
-
- -
|
143
|
+
- - '>='
|
119
144
|
- !ruby/object:Gem::Version
|
120
145
|
version: '0'
|
121
146
|
type: :development
|
122
147
|
prerelease: false
|
123
|
-
version_requirements:
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
124
153
|
- !ruby/object:Gem::Dependency
|
125
154
|
name: epzip
|
126
|
-
requirement:
|
127
|
-
none: false
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
|
-
- -
|
157
|
+
- - '>='
|
130
158
|
- !ruby/object:Gem::Version
|
131
159
|
version: '0'
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
|
-
version_requirements:
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
135
167
|
- !ruby/object:Gem::Dependency
|
136
168
|
name: epubcheck
|
137
|
-
requirement:
|
138
|
-
none: false
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
139
170
|
requirements:
|
140
|
-
- -
|
171
|
+
- - '>='
|
141
172
|
- !ruby/object:Gem::Version
|
142
173
|
version: '0'
|
143
174
|
type: :development
|
144
175
|
prerelease: false
|
145
|
-
version_requirements:
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
146
181
|
- !ruby/object:Gem::Dependency
|
147
182
|
name: epub_validator
|
148
|
-
requirement:
|
149
|
-
none: false
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
150
184
|
requirements:
|
151
|
-
- -
|
185
|
+
- - '>='
|
152
186
|
- !ruby/object:Gem::Version
|
153
187
|
version: '0'
|
154
188
|
type: :development
|
155
189
|
prerelease: false
|
156
|
-
version_requirements:
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - '>='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
157
195
|
- !ruby/object:Gem::Dependency
|
158
196
|
name: aruba
|
159
|
-
requirement:
|
160
|
-
none: false
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
161
198
|
requirements:
|
162
|
-
- -
|
199
|
+
- - '>='
|
163
200
|
- !ruby/object:Gem::Version
|
164
201
|
version: '0'
|
165
202
|
type: :development
|
166
203
|
prerelease: false
|
167
|
-
version_requirements:
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
168
209
|
- !ruby/object:Gem::Dependency
|
169
210
|
name: enumerabler
|
170
|
-
requirement:
|
171
|
-
none: false
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
172
212
|
requirements:
|
173
|
-
- -
|
213
|
+
- - '>='
|
174
214
|
- !ruby/object:Gem::Version
|
175
215
|
version: '0'
|
176
216
|
type: :runtime
|
177
217
|
prerelease: false
|
178
|
-
version_requirements:
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - '>='
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
179
223
|
- !ruby/object:Gem::Dependency
|
180
224
|
name: zipruby
|
181
|
-
requirement:
|
182
|
-
none: false
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
183
226
|
requirements:
|
184
|
-
- -
|
227
|
+
- - '>='
|
185
228
|
- !ruby/object:Gem::Version
|
186
229
|
version: '0'
|
187
230
|
type: :runtime
|
188
231
|
prerelease: false
|
189
|
-
version_requirements:
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - '>='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
190
237
|
- !ruby/object:Gem::Dependency
|
191
238
|
name: nokogiri
|
192
|
-
requirement:
|
193
|
-
none: false
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
194
240
|
requirements:
|
195
|
-
- -
|
241
|
+
- - '='
|
196
242
|
- !ruby/object:Gem::Version
|
197
|
-
version:
|
243
|
+
version: 1.5.8
|
198
244
|
type: :runtime
|
199
245
|
prerelease: false
|
200
|
-
version_requirements:
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - '='
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 1.5.8
|
201
251
|
- !ruby/object:Gem::Dependency
|
202
252
|
name: addressable
|
203
|
-
requirement:
|
204
|
-
none: false
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
205
254
|
requirements:
|
206
|
-
- -
|
255
|
+
- - '>='
|
207
256
|
- !ruby/object:Gem::Version
|
208
257
|
version: '0'
|
209
258
|
type: :runtime
|
210
259
|
prerelease: false
|
211
|
-
version_requirements:
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - '>='
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
212
265
|
description: Parse EPUB 3 book loosely
|
213
266
|
email:
|
214
267
|
- KitaitiMakoto@gmail.com
|
215
268
|
executables:
|
269
|
+
- epub-open
|
216
270
|
- epubinfo
|
217
271
|
extensions: []
|
218
272
|
extra_rdoc_files: []
|
@@ -220,10 +274,13 @@ files:
|
|
220
274
|
- .gemtest
|
221
275
|
- .gitignore
|
222
276
|
- .gitmodules
|
277
|
+
- .travis.yml
|
278
|
+
- .yardopts
|
223
279
|
- Gemfile
|
224
280
|
- MIT-LICENSE
|
225
281
|
- README.markdown
|
226
282
|
- Rakefile
|
283
|
+
- bin/epub-open
|
227
284
|
- bin/epubinfo
|
228
285
|
- epub-parser.gemspec
|
229
286
|
- features/epubinfo.feature
|
@@ -234,6 +291,7 @@ files:
|
|
234
291
|
- lib/epub/constants.rb
|
235
292
|
- lib/epub/content_document.rb
|
236
293
|
- lib/epub/content_document/navigation.rb
|
294
|
+
- lib/epub/content_document/xhtml.rb
|
237
295
|
- lib/epub/ocf.rb
|
238
296
|
- lib/epub/ocf/container.rb
|
239
297
|
- lib/epub/ocf/encryption.rb
|
@@ -245,6 +303,7 @@ files:
|
|
245
303
|
- lib/epub/parser/content_document.rb
|
246
304
|
- lib/epub/parser/ocf.rb
|
247
305
|
- lib/epub/parser/publication.rb
|
306
|
+
- lib/epub/parser/utils.rb
|
248
307
|
- lib/epub/parser/version.rb
|
249
308
|
- lib/epub/publication.rb
|
250
309
|
- lib/epub/publication/package.rb
|
@@ -277,49 +336,29 @@ files:
|
|
277
336
|
- test/fixtures/book/OPS/日本語.xhtml
|
278
337
|
- wiki/Home.md
|
279
338
|
- wiki/Item.md
|
280
|
-
- doc/method_list.html
|
281
|
-
- doc/EPUB.html
|
282
|
-
- doc/file.README.html
|
283
|
-
- doc/file.Item.html
|
284
|
-
- doc/index.html
|
285
|
-
- doc/AcceptHashAndYieldSlef.html
|
286
|
-
- doc/file.Home.html
|
287
|
-
- doc/_index.html
|
288
|
-
- doc/file_list.html
|
289
|
-
- doc/AcceptHashAndYieldSelf.html
|
290
|
-
- doc/frames.html
|
291
|
-
- doc/class_list.html
|
292
|
-
- doc/top-level-namespace.html
|
293
339
|
homepage: https://github.com/KitaitiMakoto/epub-parser
|
294
340
|
licenses:
|
295
341
|
- MIT
|
342
|
+
metadata: {}
|
296
343
|
post_install_message:
|
297
344
|
rdoc_options: []
|
298
345
|
require_paths:
|
299
346
|
- lib
|
300
347
|
required_ruby_version: !ruby/object:Gem::Requirement
|
301
|
-
none: false
|
302
348
|
requirements:
|
303
|
-
- -
|
349
|
+
- - '>='
|
304
350
|
- !ruby/object:Gem::Version
|
305
351
|
version: '0'
|
306
|
-
segments:
|
307
|
-
- 0
|
308
|
-
hash: -1959705838620689710
|
309
352
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
310
|
-
none: false
|
311
353
|
requirements:
|
312
|
-
- -
|
354
|
+
- - '>='
|
313
355
|
- !ruby/object:Gem::Version
|
314
356
|
version: '0'
|
315
|
-
segments:
|
316
|
-
- 0
|
317
|
-
hash: -1959705838620689710
|
318
357
|
requirements: []
|
319
358
|
rubyforge_project:
|
320
|
-
rubygems_version:
|
359
|
+
rubygems_version: 2.0.0
|
321
360
|
signing_key:
|
322
|
-
specification_version:
|
361
|
+
specification_version: 4
|
323
362
|
summary: EPUB 3 Parser
|
324
363
|
test_files:
|
325
364
|
- features/epubinfo.feature
|