eepub 0.2.0 → 0.3.0

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
  SHA1:
3
- metadata.gz: 17b04605903997480b36c48aa960bf80095fb696
4
- data.tar.gz: 195e16dfea1d1fb68d9bd457a48aa31405048e54
3
+ metadata.gz: 1a03a7f0d557df85b37ddfe0d051d7a8ad7c1237
4
+ data.tar.gz: c959ec316cc35d15bf4ff5a161ded27973a825ca
5
5
  SHA512:
6
- metadata.gz: 18a2a82aa4336a89d8d2ad72819db5d6cae49a1daec5ecd990652544b14b7c3dbb198b283add247ca98af050c4ccc7587f01fc8e2e6575369ad1112eda9f53f4
7
- data.tar.gz: 777e60cd6b7373f3297ca3919052c77af2eaad3113d65439d7a297ea9c962db5f424577c46489c5c63f3f5218b0f96be59883f9795a760a435ee4a253c528b7e
6
+ metadata.gz: 3639ea2af82b48b313435f3dfba5597a32e7fcc74d108677ea7c24208923fa81f266a12e5e1f7077d7a3a4777f090521fe334d5ecd02f2148040be5523fbe12f
7
+ data.tar.gz: 56e6fd6e9becee705928da1bd5d7ee7662ddbcc389eb053d0d431461163dd933aa5a6cf39c4967668724527cd34d559f5ce5ac5c11d33d9158daa02b4fef2972
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.add_runtime_dependency 'nokogiri'
20
19
  spec.add_runtime_dependency 'rubyzip'
21
20
 
22
21
  spec.add_development_dependency 'bundler', '~> 1.15'
@@ -1,6 +1,6 @@
1
- require 'nokogiri'
2
- require 'zip'
3
1
  require 'fileutils'
2
+ require 'rexml/document'
3
+ require 'zip'
4
4
 
5
5
  module Eepub
6
6
  class Epub
@@ -12,9 +12,9 @@ module Eepub
12
12
 
13
13
  def title
14
14
  @title ||= Zip::File.open(@path) {|zip|
15
- package_xml = Nokogiri::XML.parse(package_entry(zip).get_input_stream)
15
+ package_xml = REXML::Document.new(package_entry(zip).get_input_stream)
16
16
 
17
- package_xml.at_xpath('//dc:title/text()', dc: 'http://purl.org/dc/elements/1.1/').content
17
+ package_xml.elements['//dc:title'].text
18
18
  }
19
19
  end
20
20
 
@@ -25,10 +25,10 @@ module Eepub
25
25
 
26
26
  Zip::File.open to do |zip|
27
27
  entry = package_entry(zip)
28
- xml = Nokogiri::XML.parse(entry.get_input_stream)
29
- title_node = xml.at_xpath('//dc:title', dc: 'http://purl.org/dc/elements/1.1/')
28
+ xml = REXML::Document.new(entry.get_input_stream)
29
+ title_node = xml.elements['//dc:title']
30
30
 
31
- title_node.content = title
31
+ title_node.text = title
32
32
 
33
33
  zip.get_output_stream entry.name do |stream|
34
34
  stream.write xml.to_s
@@ -41,15 +41,11 @@ module Eepub
41
41
  private
42
42
 
43
43
  def package_entry(zip)
44
- container_xml = Nokogiri::XML.parse(container_entry(zip).get_input_stream)
45
-
46
- path = container_xml.at_xpath('//container:rootfile/@full-path', container: 'urn:oasis:names:tc:opendocument:xmlns:container').value
44
+ container_entry = zip.find_entry('META-INF/container.xml')
45
+ container_xml = REXML::Document.new(container_entry.get_input_stream)
46
+ path = container_xml.elements['//rootfile/@full-path'].value
47
47
 
48
48
  zip.find_entry(path)
49
49
  end
50
-
51
- def container_entry(zip)
52
- zip.find_entry('META-INF/container.xml')
53
- end
54
50
  end
55
51
  end
@@ -1,3 +1,3 @@
1
1
  module Eepub
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: nokogiri
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rubyzip
29
15
  requirement: !ruby/object:Gem::Requirement