epub-parser 0.3.6 → 0.3.7
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.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +51 -1
- data/.yardopts +5 -3
- data/{CHANGELOG.markdown → CHANGELOG.adoc} +49 -84
- data/README.adoc +228 -0
- data/Rakefile +3 -1
- data/bin/epub-cover +51 -0
- data/docs/EpubCover.adoc +46 -0
- data/docs/Examples.adoc +9 -0
- data/docs/Home.adoc +224 -0
- data/docs/Searcher.adoc +132 -0
- data/epub-parser.gemspec +2 -1
- data/lib/epub/book/features.rb +7 -1
- data/lib/epub/metadata.rb +9 -1
- data/lib/epub/parser/metadata.rb +4 -2
- data/lib/epub/parser/version.rb +1 -1
- data/lib/epub/publication/package/manifest.rb +1 -1
- data/lib/epub/searcher/xhtml.rb +1 -0
- data/test/helper.rb +1 -1
- metadata +26 -8
- data/README.markdown +0 -219
- data/docs/Home.markdown +0 -196
- data/docs/Searcher.markdown +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac4cf6d94841545616b908ef95b0028d8ba6e6ad266b48b1a616c67f18c881b
|
4
|
+
data.tar.gz: 630f88dbacaba24a28364a5cb87d98b6778fdb1504eba785b470495cb8823bda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 827f7b42fedec851ee5f3146bba19477cb80b457fdb2c98c69dff872772175bb70a877d686e851eb90744b1cf14974de46300494c5a810fcf7d9c873e2b537b1
|
7
|
+
data.tar.gz: 6607c5d2a5cbd63c4d9bca7eecaa7b71dfc5be49c828f0d8fdc44fd3cb4e3ee825bbb5e2adb5b06023b54ff2900ef9624cd2a3625a3f77376db12c762f3b42a0
|
data/.gitlab-ci.yml
CHANGED
@@ -2,16 +2,66 @@ before_script:
|
|
2
2
|
- ruby -v
|
3
3
|
- which ruby
|
4
4
|
- gem install bundler --no-document
|
5
|
-
- bundle install --jobs=$(nproc) "${FLAGS[@]}"
|
5
|
+
- bundle install --jobs=$(nproc) --path=deps "${FLAGS[@]}"
|
6
|
+
- bundle clean
|
6
7
|
|
7
8
|
test:2.3:
|
8
9
|
image: ruby:2.3
|
9
10
|
script: bundle exec rake test
|
11
|
+
except:
|
12
|
+
- tags
|
13
|
+
cache:
|
14
|
+
key: ruby:2.3
|
15
|
+
paths:
|
16
|
+
- deps
|
10
17
|
|
11
18
|
test:2.4:
|
12
19
|
image: ruby:2.4
|
13
20
|
script: bundle exec rake test
|
21
|
+
except:
|
22
|
+
- tags
|
23
|
+
cache:
|
24
|
+
key: ruby:2.4
|
25
|
+
paths:
|
26
|
+
- deps
|
14
27
|
|
15
28
|
test:2.5:
|
16
29
|
image: ruby:2.5
|
17
30
|
script: bundle exec rake test
|
31
|
+
except:
|
32
|
+
- tags
|
33
|
+
artifacts:
|
34
|
+
paths:
|
35
|
+
- coverage
|
36
|
+
cache:
|
37
|
+
key: ruby:2.5
|
38
|
+
paths:
|
39
|
+
- deps
|
40
|
+
|
41
|
+
test:2.6:
|
42
|
+
image: ruby:2.6-rc
|
43
|
+
script: bundle exec rake test
|
44
|
+
except:
|
45
|
+
- tags
|
46
|
+
cache:
|
47
|
+
key: ruby:2.6
|
48
|
+
paths:
|
49
|
+
- deps
|
50
|
+
|
51
|
+
pages:
|
52
|
+
stage: deploy
|
53
|
+
dependencies:
|
54
|
+
- test:2.5
|
55
|
+
script:
|
56
|
+
- rake doc:yard
|
57
|
+
- mv doc public
|
58
|
+
- mv coverage public/
|
59
|
+
artifacts:
|
60
|
+
paths:
|
61
|
+
- public
|
62
|
+
only:
|
63
|
+
- master
|
64
|
+
cache:
|
65
|
+
key: ruby:2.5
|
66
|
+
paths:
|
67
|
+
- deps
|
data/.yardopts
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--load docs/yard-forwardable_def_delegators_handler.rb
|
2
2
|
-
|
3
|
-
CHANGELOG.
|
3
|
+
CHANGELOG.adoc
|
4
4
|
MIT-LICENSE
|
5
|
-
docs/Home.
|
5
|
+
docs/Home.adoc
|
6
6
|
docs/Publication.markdown
|
7
7
|
docs/Item.markdown
|
8
8
|
docs/FixedLayout.markdown
|
9
9
|
docs/Epubinfo.markdown
|
10
10
|
docs/EpubOpen.markdown
|
11
|
+
docs/EpubCover.adoc
|
11
12
|
docs/Navigation.markdown
|
12
|
-
docs/Searcher.
|
13
|
+
docs/Searcher.adoc
|
13
14
|
docs/UnpackedArchive.markdown
|
14
15
|
docs/AggregateContentsFromWeb.markdown
|
15
16
|
docs/MultipleRenditions.markdown
|
17
|
+
docs/Examples.adoc
|
16
18
|
examples/aggregate-contents-from-web.rb
|
17
19
|
examples/exctract-content-using-cfi.rb
|
18
20
|
examples/find-elements-and-cfis.rb
|
@@ -1,71 +1,64 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
|
1
|
+
= CHANGELOG
|
2
|
+
|
3
|
+
== 0.3.7
|
4
|
+
|
5
|
+
* Strip leading and trailing white spaces from identifiers. See http://www.idpf.org/epub/31/spec/epub-packages.html#sec-opf-dcidentifier for details.
|
6
|
+
* Change home page and documentation from rubydoc.info to GitLab Pages
|
7
|
+
* Parse `package/metadata/meta@name` and `@content` to allow EPUB 2 meta info
|
8
|
+
* Add {EPUB::Metadata#cover_image Metadata#cover_image}
|
9
|
+
* Make {EPUB::Book::Features#cover_image Book::Features#cover_image} return EPUB 2 cover image if EPUB 3's not available
|
10
|
+
* Add `epub-cover` command-line tool. See {file:docs/EpubCover.adoc} for details.
|
11
|
+
|
12
|
+
== 0.3.6
|
3
13
|
|
4
|
-
0.3.6
|
5
|
-
-----
|
6
14
|
* [BUG FIX]Ignore fragment when find item by relative IRI
|
7
|
-
* Enable [PrettyBacktrace]
|
15
|
+
* Enable https://github.com/ko1/pretty_backtrace[PrettyBacktrace] only when specified by env var for testing performance
|
8
16
|
|
9
|
-
|
17
|
+
== 0.3.5
|
10
18
|
|
11
|
-
|
12
|
-
-----
|
13
|
-
* [BUG FIX]Fix a bug that {EPUB::ContentDocument::Navigation::Item#item} is `nil` when `href` includes double dots(`..`)(Thanks [aelkiss][]!)
|
19
|
+
* [BUG FIX]Fix a bug that {EPUB::ContentDocument::Navigation::Item#item} is `nil` when `href` includes double dots(`..`)(Thanks https://gitlab.com/aelkiss[aelkiss]!)
|
14
20
|
|
15
|
-
0.3.4
|
16
|
-
-----
|
21
|
+
== 0.3.4
|
17
22
|
|
18
23
|
* Add {EPUB::Publication::Package#full_path} and {EPUB::Publication::Package#rootfile}
|
19
|
-
* [BUG FIX]Fix a bug that {EPUB::ContentDocument::Navigation::Item#item} doesn't return correct {EPUB::Publication::Package::Manifest::Item Item}(Thanks [aelkiss]
|
24
|
+
* [BUG FIX]Fix a bug that {EPUB::ContentDocument::Navigation::Item#item} doesn't return correct {EPUB::Publication::Package::Manifest::Item Item}(Thanks https://gitlab.com/aelkiss[aelkiss]!)
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
0.3.3
|
24
|
-
-----
|
26
|
+
== 0.3.3
|
25
27
|
|
26
28
|
* [BUG FIX]Use UnpackedURI adapter for URI
|
27
29
|
* [BREAKING CHANGE]Remove deprecated second argument from `EPUB::Parser::Publication#initialize`
|
28
30
|
* Add `detect_encoding` keyword argument to `Publication::Package::Manifest::Item#read` and `ContentDocument::XHTML#read`
|
29
31
|
|
30
|
-
0.3.2
|
31
|
-
-----
|
32
|
+
== 0.3.2
|
32
33
|
|
33
34
|
* Use epub-cfi gem for EPUB CFI
|
34
35
|
|
35
|
-
0.3.1
|
36
|
-
-----
|
36
|
+
== 0.3.1
|
37
37
|
|
38
38
|
* Load epub/parser.rb in epub/parser/cfi.rb to allow to use Parser::CFI independently
|
39
39
|
* Make `CFI` comparable. Now can call `CFI#==`
|
40
40
|
* Include `Publication::Package::Spine::Itemref` in `Searcher.search_element`'s result
|
41
41
|
|
42
|
-
0.3.0
|
43
|
-
-----
|
42
|
+
== 0.3.0
|
44
43
|
|
45
44
|
* Wrong release. I'm sorry.
|
46
45
|
|
47
|
-
0.2.9
|
48
|
-
-----
|
46
|
+
== 0.2.9
|
49
47
|
|
50
48
|
* Fix a bug that `Searcher.search_element` returns wrong CFI
|
51
49
|
* Add `Searcher.search_by_cfi`
|
52
50
|
|
53
|
-
0.2.8
|
54
|
-
-----
|
51
|
+
== 0.2.8
|
55
52
|
|
56
53
|
* Change Searcher API: #search -> #search_text
|
57
54
|
* Add Searcher.search_element
|
58
55
|
|
59
|
-
0.2.7
|
60
|
-
-----
|
56
|
+
== 0.2.7
|
61
57
|
|
62
58
|
* Add `EPUB::Metadata#children` to keep all child emements to count them on CFI search
|
63
|
-
* Allow class including `EPUB` to intialize with extra arguments(Thanks, [skukx]
|
64
|
-
|
65
|
-
[skukx]: https://github.com/skukx
|
59
|
+
* Allow class including `EPUB` to intialize with extra arguments(Thanks, https://github.com/skukx[skukx]!)
|
66
60
|
|
67
|
-
0.2.6
|
68
|
-
-----
|
61
|
+
== 0.2.6
|
69
62
|
|
70
63
|
* Add `EPUB::Publication::Package::Metadata#package_identifier` as alias of `#release_identifier`, which is defined in EPUB Publication 3.0 spec
|
71
64
|
* [BUG FIX]Metadata#modified returns modified with no refiners
|
@@ -76,16 +69,14 @@ CHANGELOG
|
|
76
69
|
|
77
70
|
[multi-rendition]: http://www.idpf.org/epub/renditions/multiple/
|
78
71
|
|
79
|
-
0.2.5
|
80
|
-
-----
|
72
|
+
== 0.2.5
|
81
73
|
|
82
74
|
* [BUG FIX]Don't load Zip/Ruby if unneccessary
|
83
75
|
* Raise error when PhysicalContainer::ArchiveZip fails find entry
|
84
76
|
* Remove unused files in schemas directory
|
85
77
|
* Add `EPUB::CFI::PhysicalContainer.find_adapter`
|
86
78
|
|
87
|
-
0.2.4
|
88
|
-
-----
|
79
|
+
== 0.2.4
|
89
80
|
|
90
81
|
* Bug fix for `EPUB::CFI::Location#<=>`
|
91
82
|
* Change default physical container adapter from `EPUB::OCF::PhysicalContainer::ZipRuby` to `EPUB::OCF::PhysicalContainer::ArchiveZip`
|
@@ -93,72 +84,57 @@ CHANGELOG
|
|
93
84
|
* Change attribute name: `EPUB::CFI::Step#step` -> `EPUB::CFI::Step#value`, `EPUB::CFI::CharacterOffset#offset` -> `EPUB::CFI::CharacterOffset#value`
|
94
85
|
* Show modified on `epubinfo` command
|
95
86
|
|
96
|
-
0.2.3
|
97
|
-
-----
|
87
|
+
== 0.2.3
|
98
88
|
|
99
89
|
* Change the name of physical container adapter for file system: :File -> :UnpackedDirectory
|
100
90
|
* Add `EPUB::Publication::Package::Manifest::Item#full_path`
|
101
91
|
* Make #href= acceptable String
|
102
92
|
* Implement `EPUB::CFI` and `EPUB::Parser::CFI`
|
103
|
-
* Remove [nokogumbo]
|
93
|
+
* Remove https://github.com/rubys/nokogumbo/[nokogumbo] from dependencies. It ommits `head` and `body` elements
|
104
94
|
* Remove Cucumber and Cucumber features
|
105
95
|
* Add `EPUB::Publication::Package::Metadata#modified` and `EPUB::Book::Features#modified`
|
106
96
|
* Add `EPUB::Book::Features#release_identifier`
|
107
97
|
|
108
|
-
0.2.2
|
109
|
-
-----
|
98
|
+
== 0.2.2
|
110
99
|
|
111
100
|
* [BUGFIX]Item#entry_name returns normalized IRI
|
112
101
|
|
113
|
-
0.2.1
|
114
|
-
-----
|
102
|
+
== 0.2.1
|
115
103
|
|
116
104
|
* Remove deprecated `EPUB::Constants::MediaType::UnsupportedError`. Use `UnsupportedMediatType` instead.
|
117
|
-
* Make it possible to use [archive-zip]
|
105
|
+
* Make it possible to use https://github.com/javanthropus/archive-zip[archive-zip] gem to extract contents from EPUB package via `EPUB::OCF::PhysicalContainer::ArchiveZip`
|
118
106
|
* Add warning about default physical container adapter change
|
119
107
|
* Make it possible to extract contents from the web via `EPUB::OCF::PhysicalContainer::UnpackedURI`. See {file:ExtractContentsFromWeb.markdown} for details.
|
120
108
|
|
121
|
-
|
122
|
-
|
123
|
-
0.2.0
|
124
|
-
-----
|
109
|
+
== 0.2.0
|
125
110
|
|
126
111
|
* Introduce abstraction layer for OCF physical container
|
127
112
|
* Add `EPUB::OCF::PhysicalContainer::File` and make it possible to parse file system directory as an EPUB file. See {file:docs/UnpackedArchive.markdown} for details.
|
128
113
|
* Remove `EPUB::Parser::OCF::CONTAINER_FILE` and other constants
|
129
114
|
|
130
|
-
0.1.9
|
131
|
-
-----
|
115
|
+
== 0.1.9
|
132
116
|
|
133
|
-
* Introduce [Nokogumbo]
|
117
|
+
* Introduce https://github.com/rubys/nokogumbo/[Nokogumbo] for XHTML Content Documents
|
134
118
|
* Stop support for Ruby 1.9
|
135
119
|
* Remove `EPUB.included` method. Now including `EPUB` module empowers nothing of EPUB features. Include `EPUB::Book::Features` instead.
|
136
120
|
* Add `EPUB::Searcher::XHTML::Seamless` and make it default searcher
|
137
121
|
* Add `EPUB::Publication::Package::Manifest#each_nav`
|
138
122
|
* Stop to use enumerabler gem
|
139
123
|
|
140
|
-
|
124
|
+
== 0.1.8
|
141
125
|
|
142
|
-
|
143
|
-
-----
|
126
|
+
* Explicity #close each zip member file that has been opened via #fopen(Thanks, https://github.com/xunker[xunker]!)
|
144
127
|
|
145
|
-
|
146
|
-
|
147
|
-
[xunker]: https://github.com/xunker
|
148
|
-
|
149
|
-
0.1.7.1
|
150
|
-
-------
|
128
|
+
== 0.1.7.1
|
151
129
|
|
152
130
|
* Don't set encoding when content is not text
|
153
131
|
|
154
|
-
0.1.7
|
155
|
-
-----
|
132
|
+
== 0.1.7
|
156
133
|
|
157
134
|
* [Experimental]Add `EPUB::Searcher` module. See {file:Searcher.markdown} for details
|
158
135
|
* Detect and set character encoding in `EPUB::Publication::Package::Item#read`
|
159
136
|
|
160
|
-
0.1.6
|
161
|
-
-----
|
137
|
+
== 0.1.6
|
162
138
|
* Remove `EPUB.parse` method
|
163
139
|
* Remove `EPUB::Publication::Package::Metadata#to_hash`
|
164
140
|
* Add `EPUB::Publication::Package::Metadata::Identifier` for ad-hoc `scheme` attribute and `#isbn?` method
|
@@ -168,15 +144,12 @@ CHANGELOG
|
|
168
144
|
* Add exception class `EPUB::Constants::MediaType::UnsupportedMediaType`
|
169
145
|
* Make `EPUB::Constants::MediaType::UnsupportedError` deprecated. Use `UnsupportedMediatType` instead
|
170
146
|
* Add `EPUB::Publication::Package::Item#cover_image?`
|
171
|
-
* Add `EPUB::Book::Features` module and move methods of `EPUB` module to it(Thanks, [takahashim]
|
147
|
+
* Add `EPUB::Book::Features` module and move methods of `EPUB` module to it(Thanks, https://github.com/takahashim[takahashim]!)
|
172
148
|
* Make including `EPUB` deprecated
|
173
149
|
* Parse `hidden` attribute of `nav` elements
|
174
150
|
* [Experimental]Add `EPUB::ContentDocument::Navigation::Item#traverse`
|
175
151
|
|
176
|
-
|
177
|
-
|
178
|
-
0.1.5
|
179
|
-
-----
|
152
|
+
== 0.1.5
|
180
153
|
* Add `ContentDocument::XHTML#title`
|
181
154
|
* Add `Manifest::Item#xhtml?`
|
182
155
|
* Add `--words` and `--chars` options to `epubinfo` command which count words and charactors of XHTMLs in EPUB file
|
@@ -185,33 +158,25 @@ CHANGELOG
|
|
185
158
|
* Add `ContentDocument::XHTML#nokogiri` which returns document as `Nokogiri::XML::Document` object
|
186
159
|
* Inspect more readbly
|
187
160
|
|
188
|
-
0.1.4
|
189
|
-
|
190
|
-
* [Fixed-Layout Documents][fixed-layout] support
|
161
|
+
== 0.1.4
|
162
|
+
* http://www.idpf.org/epub/fxl/[Fixed-Layout Documents] support
|
191
163
|
* Define `ContentDocument::XHTML#top_level?`
|
192
164
|
* Define `Spine::Itemref#page_spread` and `#page_spread=`
|
193
165
|
* Define some utility methods around `Manifest::Item` and `Spine::Itemref`
|
194
166
|
* `Manifest::Item#itemref`
|
195
167
|
* `Spine::Itemref#item=`
|
196
168
|
|
197
|
-
|
198
|
-
|
199
|
-
0.1.3
|
200
|
-
-----
|
169
|
+
== 0.1.3
|
201
170
|
* Add `EPUB::Parser::Utils` module
|
202
171
|
* Add a command-line tool `epub-open`
|
203
172
|
* Add support for XHTML Navigation Document
|
204
173
|
* Make `EPUB::Publication::Package::Metadata#to_hash` obsolete. Use `#to_h` instead
|
205
174
|
* Add utility methods `EPUB#description`, `EPUB#date` and `EPUB#unique_identifier`
|
206
175
|
|
207
|
-
0.1.2
|
208
|
-
|
209
|
-
* Fix a bug that `Item#read` couldn't read file when `href` is percent-encoded(Thanks, [gambhiro][]!)
|
210
|
-
|
211
|
-
[gambhiro]: https://github.com/gambhiro
|
176
|
+
== 0.1.2
|
177
|
+
* Fix a bug that `Item#read` couldn't read file when `href` is percent-encoded(Thanks, https://github.com/gambhiro[gambhiro]!)
|
212
178
|
|
213
|
-
0.1.1
|
214
|
-
-----
|
179
|
+
== 0.1.1
|
215
180
|
* Parse package@prefix and attach it as `Package#prefix`
|
216
181
|
* `Manifest::Item#iri` was removed. It have existed for files in unzipped epub books but now EPUB Parser retrieves files from zip archive directly. `#href` now returns `Addressable::URI` object.
|
217
182
|
* `Metadata::Link#iri`: ditto.
|
data/README.adoc
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
= EPUB Parser
|
2
|
+
|
3
|
+
= {doctitle}
|
4
|
+
|
5
|
+
image:https://gitlab.com/KitaitiMakoto/epub-parser/badges/master/build.svg[link="https://gitlab.com/KitaitiMakoto/epub-parser/commits/master", title="pipeline status"]
|
6
|
+
image:https://gemnasium.com/KitaitiMakoto/epub-parser.png[link="https://gitlab.com/KitaitiMakoto/epub-parser/commits/master",title="Dependency Status"]
|
7
|
+
image:https://badge.fury.io/rb/epub-parser.svg[link="https://gemnasium.com/KitaitiMakoto/epub-parser",title="Gem Version"]
|
8
|
+
image:https://gitlab.com/KitaitiMakoto/epub-parser/badges/master/coverage.svg[link="https://kitaitimakoto.gitlab.io/epub-parser/coverage/",title="coverage report"]
|
9
|
+
|
10
|
+
* https://kitaitimakoto.gitlab.io/epub-parser/file.Home.html[Homepage]
|
11
|
+
* https://kitaitimakoto.gitlab.io/epub-parser/[Documentation]
|
12
|
+
* https://gitlab.com/KitaitiMakoto/epub-parser[Source Code]
|
13
|
+
* https://kitaitimakoto.gitlab.io/epub-parser/coverage/[Test Coverage]
|
14
|
+
|
15
|
+
== INSTALLATION
|
16
|
+
|
17
|
+
----
|
18
|
+
gem install epub-parser
|
19
|
+
----
|
20
|
+
|
21
|
+
== USAGE
|
22
|
+
|
23
|
+
=== As a library
|
24
|
+
|
25
|
+
----
|
26
|
+
require 'epub/parser'
|
27
|
+
|
28
|
+
book = EPUB::Parser.parse('book.epub')
|
29
|
+
book.metadata.titles # => Array of EPUB::Publication::Package::Metadata::Title. Main title, subtitle, etc...
|
30
|
+
book.metadata.title # => Title string including all titles
|
31
|
+
book.metadata.creators # => Creators(authors)
|
32
|
+
book.each_page_on_spine do |page|
|
33
|
+
page.media_type # => "application/xhtml+xml"
|
34
|
+
page.entry_name # => "OPS/nav.xhtml" entry name in EPUB package(zip archive)
|
35
|
+
page.read # => raw content document
|
36
|
+
page.content_document.nokogiri # => Nokogiri::XML::Document. The same to Nokogiri.XML(page.read)
|
37
|
+
# do something more
|
38
|
+
# :
|
39
|
+
end
|
40
|
+
book.cover_image # => EPUB::Publication::Package::Manifest::Item which represents cover image file
|
41
|
+
----
|
42
|
+
|
43
|
+
See document's {file:docs/Home.markdown} or https://kitaitimakoto.gitlab.io/epub-parser/[API Documentation] for more info.
|
44
|
+
|
45
|
+
=== `epubinfo` command-line tool
|
46
|
+
|
47
|
+
`epubinfo` tool extracts and shows the metadata of specified EPUB book.
|
48
|
+
|
49
|
+
----
|
50
|
+
$ epubinfo ~/Documebts/Books/build_awesome_command_line_applications_in_ruby.epub
|
51
|
+
Title: Build Awesome Command-Line Applications in Ruby (for KITAITI MAKOTO)
|
52
|
+
Identifiers: 978-1-934356-91-3
|
53
|
+
Titles: Build Awesome Command-Line Applications in Ruby (for KITAITI MAKOTO)
|
54
|
+
Languages: en
|
55
|
+
Contributors:
|
56
|
+
Coverages:
|
57
|
+
Creators: David Bryant Copeland
|
58
|
+
Dates:
|
59
|
+
Descriptions:
|
60
|
+
Formats:
|
61
|
+
Publishers: The Pragmatic Bookshelf, LLC (338304)
|
62
|
+
Relations:
|
63
|
+
Rights: Copyright © 2012 Pragmatic Programmers, LLC
|
64
|
+
Sources:
|
65
|
+
Subjects: Pragmatic Bookshelf
|
66
|
+
Types:
|
67
|
+
Unique identifier: 978-1-934356-91-3
|
68
|
+
Epub version: 2.0
|
69
|
+
----
|
70
|
+
|
71
|
+
See {file:docs/Epubinfo.markdown} for more info.
|
72
|
+
|
73
|
+
=== `epub-open` command-line tool
|
74
|
+
|
75
|
+
`epub-open` tool provides interactive shell(IRB) which helps you research about EPUB book.
|
76
|
+
|
77
|
+
----
|
78
|
+
epub-open path/to/book.epub
|
79
|
+
----
|
80
|
+
|
81
|
+
IRB starts. `self` becomes the EPUB book and can access to methods of `EPUB`.
|
82
|
+
|
83
|
+
----
|
84
|
+
title
|
85
|
+
=> "Title of the book"
|
86
|
+
metadata.creators
|
87
|
+
=> [Author 1, Author2, ...]
|
88
|
+
resources.first.properties
|
89
|
+
=> #<Set: {"nav"}> # You know that first resource of this book is nav document
|
90
|
+
nav = resources.first
|
91
|
+
=> ...
|
92
|
+
nav.href
|
93
|
+
=> #<Addressable::URI:0x15ce350 URI:nav.xhtml>
|
94
|
+
nav.media_type
|
95
|
+
=> "application/xhtml+xml"
|
96
|
+
puts nav.read
|
97
|
+
<?xml version="1.0"?>
|
98
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
|
99
|
+
:
|
100
|
+
:
|
101
|
+
:
|
102
|
+
</html>
|
103
|
+
=> nil
|
104
|
+
exit # Enter "exit" when exit the session
|
105
|
+
----
|
106
|
+
|
107
|
+
See {file:docs/EpubOpen.markdown} for more info.
|
108
|
+
|
109
|
+
=== `epub-cover` command-line tool
|
110
|
+
|
111
|
+
`epub-cover` tool extract cover image from EPUB book.
|
112
|
+
|
113
|
+
----
|
114
|
+
% epub-cover childrens-literature.epub
|
115
|
+
Cover image output to cover.png
|
116
|
+
----
|
117
|
+
|
118
|
+
See {file:docs/EpubCover.adoc} for details.
|
119
|
+
|
120
|
+
== DOCUMENTATION
|
121
|
+
|
122
|
+
Documentation is available in https://kitaitimakoto.gitlab.io/epub-parser/file.Home.html[homepage].
|
123
|
+
|
124
|
+
If you installed EPUB Parser by gem command, you can also generate documentaiton yourself(https://rubygems.org/gems/rubygems-yardoc[rubygems-yardoc] gem is needed):
|
125
|
+
|
126
|
+
----
|
127
|
+
$ gem install epub-parser
|
128
|
+
$ gem yardoc epub-parser
|
129
|
+
...
|
130
|
+
Files: 33
|
131
|
+
Modules: 20 ( 20 undocumented)
|
132
|
+
Classes: 45 ( 44 undocumented)
|
133
|
+
Constants: 31 ( 31 undocumented)
|
134
|
+
Methods: 292 ( 88 undocumented)
|
135
|
+
52.84% documented
|
136
|
+
YARD documentation is generated to:
|
137
|
+
/path/to/gempath/ruby/2.2.0/doc/epub-parser-0.2.0/yardoc
|
138
|
+
----
|
139
|
+
|
140
|
+
It will show you path to generated documentation(`/path/to/gempath/ruby/2.2.0/doc/epub-parser-0.2.0/yardoc` here) at the end.
|
141
|
+
|
142
|
+
Or, generating by yardoc command is possible, too:
|
143
|
+
|
144
|
+
----
|
145
|
+
$ git clone https://gitlab.com/KitaitiMakoto/epub-parser.git
|
146
|
+
$ cd epub-parser
|
147
|
+
$ bundle install --path=deps
|
148
|
+
$ bundle exec rake doc:yard
|
149
|
+
...
|
150
|
+
Files: 33
|
151
|
+
Modules: 20 ( 20 undocumented)
|
152
|
+
Classes: 45 ( 44 undocumented)
|
153
|
+
Constants: 31 ( 31 undocumented)
|
154
|
+
Methods: 292 ( 88 undocumented)
|
155
|
+
52.84% documented
|
156
|
+
----
|
157
|
+
|
158
|
+
Then documentation will be available in `doc` directory.
|
159
|
+
|
160
|
+
== REQUIREMENTS
|
161
|
+
|
162
|
+
* Ruby 2.3.0 or later
|
163
|
+
* `patch` command to install Nokogiri
|
164
|
+
* C compiler to compile Nokogiri
|
165
|
+
|
166
|
+
== SIMILAR EFFORTS
|
167
|
+
|
168
|
+
* https://github.com/skoji/gepub[gepub] - a generic EPUB library for Ruby
|
169
|
+
* https://github.com/chdorner/epubinfo[epubinfo] - Extracts metadata information from EPUB files. Supports EPUB2 and EPUB3 formats.
|
170
|
+
* https://github.com/kmuto/review[ReVIEW] - ReVIEW is a easy-to-use digital publishing system for books and ebooks.
|
171
|
+
* https://github.com/takahashim/epzip[epzip] - epzip is EPUB packing tool. It's just only doing 'zip.' :)
|
172
|
+
* https://github.com/jugyo/eeepub[eeepub] - EeePub is a Ruby ePub generator
|
173
|
+
* https://gitlab.com/KitaitiMakoto/epub-maker[epub-maker] - This library supports making and editing EPUB books based on this EPUB Parser library
|
174
|
+
* https://gitlab.com/KitaitiMakoto/epub-cfi[epub-cfi] - EPUB CFI library extracted this EPUB Parser library.
|
175
|
+
|
176
|
+
If you find other gems, please tell me or request a pull request.
|
177
|
+
|
178
|
+
== RECENT CHANGES
|
179
|
+
|
180
|
+
=== 0.3.7
|
181
|
+
|
182
|
+
* Strip leading and trailing white spaces from identifiers
|
183
|
+
* Change home page and documentation from rubydoc.info to GitLab Pages
|
184
|
+
* Make {EPUB::Book::Features#cover_image Book::Features#cover_image} return EPUB 2 cover image if EPUB 3's not available
|
185
|
+
* Add `epub-cover` command-line tool. See {file:docs/EpubCover.adoc} for details.
|
186
|
+
|
187
|
+
=== 0.3.6
|
188
|
+
|
189
|
+
* [BUG FIX]Ignore fragment when find item by relative IRI
|
190
|
+
* Disable https://github.com/ko1/pretty_backtrace[PrettyBacktrace] by default
|
191
|
+
|
192
|
+
=== 0.3.5
|
193
|
+
|
194
|
+
* [BUG FIX]Fix a bug that {EPUB::ContentDocument::Navigation::Item#item} is `nil` when `href` includes double dots(`..`)(Thanks https://gitlab.com/aelkiss[aelkiss]!)
|
195
|
+
|
196
|
+
See {file:CHANGELOG.adoc} for older changelogs and details.
|
197
|
+
|
198
|
+
== TODOS
|
199
|
+
|
200
|
+
* Consider to implement IRI feature instead of to use Addressable
|
201
|
+
* EPUB 3.0.1
|
202
|
+
* EPUB 3.1
|
203
|
+
* Help features for `epub-open` tool
|
204
|
+
* Vocabulary Association Mechanisms
|
205
|
+
* Implementing navigation document and so on
|
206
|
+
* Media Overlays
|
207
|
+
* Content Document
|
208
|
+
* Digital Signature
|
209
|
+
* Using SAX on parsing
|
210
|
+
* Abstraction of XML parser(making it possible to use REXML, standard bundled XML library of Ruby)
|
211
|
+
* Handle with encodings other than UTF-8
|
212
|
+
|
213
|
+
== DONE
|
214
|
+
|
215
|
+
* Simple inspect for `epub-open` tool
|
216
|
+
* Using zip library instead of `unzip` command, which has security issue
|
217
|
+
* Modify methods around fallback to see `bindings` element in the package
|
218
|
+
* Content Document(only for Navigation Documents)
|
219
|
+
* Fixed Layout
|
220
|
+
* Vocabulary Association Mechanisms(only for itemref)
|
221
|
+
* Archive library abstraction
|
222
|
+
* Extracting and organizing common behavior from some classes to modules
|
223
|
+
* Multiple rootfiles
|
224
|
+
|
225
|
+
== LICENSE
|
226
|
+
|
227
|
+
This library is distribuetd under the term of the MIT License.
|
228
|
+
See {file:MIT-LICENSE} file for more info.
|