epub-parser 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d2b5eaf4a6fef5b3d223872db25abb9a087c3ba4e3aabc8dae4f5e854313e42
4
- data.tar.gz: 94f742b2babd8fb916ff2ac38af7e6989fdb7ffad4da0be72ffefbb0015464d4
3
+ metadata.gz: 22b0c7a7a4fb22182c41f6217122834955ef051f226eee8e14b42e8a8fa40c1e
4
+ data.tar.gz: 2a1bc2ef861abf2ce1667d853503205aa334c3c47b07166ded676313c34f3800
5
5
  SHA512:
6
- metadata.gz: 6f79e57d8876ddaad3a43ac633e09e313926272e9d028b33075decb2ca6180c22ca16698d311be958834f83c01c67ce976e53e34a63ef05fa6f326e47a994222
7
- data.tar.gz: f21296e38086c227e4cb2423e3961e80099404b43a9a13327ddd350e1642152ff19bb08f23d4b21b4bc4873d2fb0bc9ed20cd8febfbbcb6f51e4c4cafb5a51dd
6
+ metadata.gz: 5bf25532e42f17130e300090393cb25d58fafe2f7c6bac6a68ae7d814f01973f10b4f0eba450fc03521b9829ae664b5ca27b60fec56821e2340f9768149464eb
7
+ data.tar.gz: 6caf668c9ff71c7d2a12abc285103020763a984aeb90d85fbb897ca505bd95ed7c3ee407b7901a55df61fc2518de1387e636c4c52c901e8442bba7d7b768d0d8
@@ -1,5 +1,9 @@
1
1
  = CHANGELOG
2
2
 
3
+ == 0.4.3
4
+
5
+ * Encode file name passed from file system on Unix
6
+
3
7
  == 0.4.2
4
8
 
5
9
  * [BUG FIX]Fix a bug that epub-cover refers out of scope variable
@@ -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
@@ -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::Nav>] navs array of Nav object
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::Nav] nav Nav object
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)
@@ -1,5 +1,5 @@
1
1
  module EPUB
2
2
  class Parser
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
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.2
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 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake