epub-parser 0.4.2 → 0.4.3
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/CHANGELOG.adoc +4 -0
- data/README.adoc +4 -0
- data/lib/epub/parser.rb +8 -0
- data/lib/epub/parser/content_document.rb +2 -2
- data/lib/epub/parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22b0c7a7a4fb22182c41f6217122834955ef051f226eee8e14b42e8a8fa40c1e
|
4
|
+
data.tar.gz: 2a1bc2ef861abf2ce1667d853503205aa334c3c47b07166ded676313c34f3800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bf25532e42f17130e300090393cb25d58fafe2f7c6bac6a68ae7d814f01973f10b4f0eba450fc03521b9829ae664b5ca27b60fec56821e2340f9768149464eb
|
7
|
+
data.tar.gz: 6caf668c9ff71c7d2a12abc285103020763a984aeb90d85fbb897ca505bd95ed7c3ee407b7901a55df61fc2518de1387e636c4c52c901e8442bba7d7b768d0d8
|
data/CHANGELOG.adoc
CHANGED
data/README.adoc
CHANGED
@@ -174,6 +174,10 @@ If you find other gems, please tell me or request a pull request.
|
|
174
174
|
|
175
175
|
== RECENT CHANGES
|
176
176
|
|
177
|
+
=== 0.4.3
|
178
|
+
|
179
|
+
* Encode file name passed from file system on Unix
|
180
|
+
|
177
181
|
=== 0.4.2
|
178
182
|
|
179
183
|
* [BUG FIX]Fix a bug that epub-cover refers out of scope variable
|
data/lib/epub/parser.rb
CHANGED
@@ -41,6 +41,14 @@ module EPUB
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def initialize(filepath, container_adapter: nil, book: nil, initialize_with: nil, **options)
|
44
|
+
if filepath.encoding == Encoding::ASCII_8BIT
|
45
|
+
# On Windows and macOS, encoding of file name is set by Ruby,
|
46
|
+
# but on UNIX, always is ASCII-8BIT
|
47
|
+
# See https://docs.ruby-lang.org/ja/2.7.0/class/IO.html
|
48
|
+
filepath = filepath.dup
|
49
|
+
require "nkf"
|
50
|
+
filepath.force_encoding NKF.guess(filepath)
|
51
|
+
end
|
44
52
|
path_is_uri = (container_adapter == EPUB::OCF::PhysicalContainer::UnpackedURI or
|
45
53
|
container_adapter == :UnpackedURI or
|
46
54
|
EPUB::OCF::PhysicalContainer.adapter == EPUB::OCF::PhysicalContainer::UnpackedURI)
|
@@ -36,13 +36,13 @@ module EPUB
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# @param [XMLDocument, REXML::Document, Oga::XML::Document, Nokogiri::HTML::Document] document HTML document or element including nav
|
39
|
-
# @return [Array<EPUB::ContentDocument::Navigation::
|
39
|
+
# @return [Array<EPUB::ContentDocument::Navigation::Navigation>] navs array of Navigation object
|
40
40
|
def parse_navigations(document)
|
41
41
|
document.each_element_by_xpath('/xhtml:html/xhtml:body//xhtml:nav', EPUB::NAMESPACES).collect {|elem| parse_navigation elem}
|
42
42
|
end
|
43
43
|
|
44
44
|
# @param [REXML::Element, Oga::XML::Element, Nokogiri::XML::Element] element nav element
|
45
|
-
# @return [EPUB::ContentDocument::Navigation::
|
45
|
+
# @return [EPUB::ContentDocument::Navigation::Navigation] nav Navigation object
|
46
46
|
def parse_navigation(element)
|
47
47
|
nav = EPUB::ContentDocument::Navigation::Navigation.new
|
48
48
|
nav.text = find_heading(element)
|
data/lib/epub/parser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|