epub-parser 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +5 -4
- data/CHANGELOG.adoc +4 -0
- data/Gemfile +6 -0
- data/README.adoc +4 -0
- data/Rakefile +19 -28
- data/docs/Home.adoc +1 -1
- data/epub-parser.gemspec +2 -1
- data/lib/epub/content_document/xhtml.rb +6 -0
- data/lib/epub/ocf/physical_container/archive_zip.rb +1 -1
- data/lib/epub/parser/content_document.rb +4 -4
- data/lib/epub/parser/version.rb +1 -1
- data/lib/epub/parser/xml_document.rb +10 -7
- data/lib/epub/parser/xml_document/refinements/oga.rb +77 -0
- data/lib/epub/searcher/publication.rb +1 -1
- data/lib/epub/searcher/xhtml.rb +2 -2
- data/test/helper.rb +3 -0
- data/test/test_parser_publication.rb +1 -1
- data/test/test_parser_xmldocument.rb +58 -54
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db9d1db7323d581efa9dd08265ed17adc0aff3c176ef87c783968c99dc8b14b2
|
4
|
+
data.tar.gz: c8eed1c594124b4bf9ba8bed18562840a9199c4e8dcac234e0cbc615601c16a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb742185c933cfdbee595d9d777cef56a928933838e66d68383a1cdddb330b28ce514808ef292d1d90d5885957ff0cd2e8bd7905d0319b9e8f4548bb4c23fe17
|
7
|
+
data.tar.gz: 4fc71e9d5a20a1a8e1c610c8c0dd389639f4fe9ad01212944f5a11ab1e29be980bb296049d3f99228db9e595183911e13cb22c6a30e6437d5aca8f6ad71621cd
|
data/.gitlab-ci.yml
CHANGED
@@ -7,7 +7,7 @@ before_script:
|
|
7
7
|
|
8
8
|
test:2.3:
|
9
9
|
image: ruby:2.3
|
10
|
-
script: bundle exec rake test
|
10
|
+
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri
|
11
11
|
except:
|
12
12
|
- tags
|
13
13
|
cache:
|
@@ -17,7 +17,7 @@ test:2.3:
|
|
17
17
|
|
18
18
|
test:2.4:
|
19
19
|
image: ruby:2.4
|
20
|
-
script: bundle exec rake test
|
20
|
+
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri
|
21
21
|
except:
|
22
22
|
- tags
|
23
23
|
cache:
|
@@ -27,7 +27,7 @@ test:2.4:
|
|
27
27
|
|
28
28
|
test:2.5:
|
29
29
|
image: ruby:2.5
|
30
|
-
script: bundle exec rake test
|
30
|
+
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri
|
31
31
|
except:
|
32
32
|
- tags
|
33
33
|
artifacts:
|
@@ -40,7 +40,7 @@ test:2.5:
|
|
40
40
|
|
41
41
|
test:2.6:
|
42
42
|
image: ruby:2.6
|
43
|
-
script: bundle exec rake test
|
43
|
+
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri
|
44
44
|
except:
|
45
45
|
- tags
|
46
46
|
cache:
|
@@ -50,6 +50,7 @@ test:2.6:
|
|
50
50
|
|
51
51
|
pages:
|
52
52
|
stage: deploy
|
53
|
+
image: ruby:2.6
|
53
54
|
dependencies:
|
54
55
|
- test:2.6
|
55
56
|
script:
|
data/CHANGELOG.adoc
CHANGED
data/Gemfile
CHANGED
data/README.adoc
CHANGED
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ require 'yard'
|
|
5
5
|
require 'rdoc/task'
|
6
6
|
require 'epub/parser/version'
|
7
7
|
require 'archive/zip'
|
8
|
-
require 'stringio'
|
9
8
|
require 'epub/maker'
|
9
|
+
require "tmpdir"
|
10
10
|
|
11
11
|
task :default => :test
|
12
12
|
task :test => 'test:default'
|
@@ -14,30 +14,19 @@ task :test => 'test:default'
|
|
14
14
|
namespace :test do
|
15
15
|
task :default => [:build, :test]
|
16
16
|
|
17
|
-
desc 'Run all tests'
|
18
|
-
task :all => [:build, :test]
|
19
|
-
|
20
17
|
desc 'Build test fixture EPUB file'
|
21
|
-
task :build => :clean
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
File.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
z_out << entry
|
31
|
-
end
|
32
|
-
entry = Archive::Zip::Entry::File.new("OPS/CASE-SENSITIVE.xhtml")
|
33
|
-
entry.file_data = StringIO.new(small_file.sub('small file name', 'LARGE FILE NAME'))
|
34
|
-
z_out << entry
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
18
|
+
task :build => [:clean, "test/fixtures/book.epub"]
|
19
|
+
|
20
|
+
file "test/fixtures/book.epub" => "test/fixtures/book" do |task|
|
21
|
+
EPUB::Maker.archive task.source
|
22
|
+
small_file = File.read("#{task.source}/OPS/case-sensitive.xhtml")
|
23
|
+
Dir.mktmpdir do |dir|
|
24
|
+
upcase_file_path = File.join(dir, "CASE-SENSITIVE.xhtml")
|
25
|
+
File.write upcase_file_path, small_file.sub('small file name', 'LARGE FILE NAME')
|
26
|
+
Archive::Zip.archive task.name, upcase_file_path, path_prefix: "OPS"
|
38
27
|
end
|
39
|
-
File.rename "#{input_dir}.epub.tmp", "#{input_dir}.epub"
|
40
28
|
end
|
29
|
+
CLEAN.include "test/fixtures/book.epub"
|
41
30
|
|
42
31
|
Rake::TestTask.new do |task|
|
43
32
|
task.test_files = FileList['test/**/test_*.rb']
|
@@ -53,12 +42,14 @@ namespace :doc do
|
|
53
42
|
|
54
43
|
YARD::Rake::YardocTask.new
|
55
44
|
Rake::RDocTask.new do |rdoc|
|
56
|
-
rdoc.rdoc_files
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
45
|
+
rdoc.rdoc_files.include %w[
|
46
|
+
lib/**/*.rb
|
47
|
+
README.adoc
|
48
|
+
CHANGELOG.adoc
|
49
|
+
MIT-LICENSE
|
50
|
+
docs/**/*.adoc
|
51
|
+
docs/**/*.md
|
52
|
+
]
|
62
53
|
end
|
63
54
|
end
|
64
55
|
|
data/docs/Home.adoc
CHANGED
@@ -118,7 +118,7 @@ ret == book # => true; this API is not good I feel... Welcome suggestion!
|
|
118
118
|
|
119
119
|
==== Switching XML Library
|
120
120
|
|
121
|
-
EPUB Parser
|
121
|
+
EPUB Parser tries to load https://gitlab.com/yorickpeterse/oga[Oga] a fast XML parser at first. If Oga is not available, then it tries https://www.nokogiri.org/[Nokogiri], a Ruby bindings for http://xmlsoft.org/[Libxml2] and http://xmlsoft.org/XSLT/[Libxslt] and more. If both are not available, it fallbacks to https://ruby-doc.org/stdlib-2.5.3/libdoc/rexml/rdoc/index.html[REXML], a standard-bundled library. You can also specify REXML explicitly:
|
122
122
|
|
123
123
|
----
|
124
124
|
EPUB::Parser::XMLDocument.backend = :REXML
|
data/epub-parser.gemspec
CHANGED
@@ -40,7 +40,8 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.add_development_dependency 'pretty_backtrace'
|
41
41
|
s.add_development_dependency 'epub-maker'
|
42
42
|
s.add_development_dependency 'asciidoctor'
|
43
|
-
s.add_development_dependency 'nokogiri', '>= 1.6.0', '< 1.
|
43
|
+
s.add_development_dependency 'nokogiri', '>= 1.6.0', '< 1.11'
|
44
|
+
s.add_development_dependency 'oga', '>= 2.16'
|
44
45
|
|
45
46
|
s.add_runtime_dependency 'archive-zip'
|
46
47
|
s.add_runtime_dependency 'addressable', '>= 2.3.5'
|
@@ -32,6 +32,12 @@ module EPUB
|
|
32
32
|
@rexml ||= REXML::Document.new(raw_document)
|
33
33
|
end
|
34
34
|
|
35
|
+
# @return [Oga::XML::Document] content as Oga::XML::Document object
|
36
|
+
def oga
|
37
|
+
require "oga"
|
38
|
+
@oga ||= Oga.parse_xml(raw_document)
|
39
|
+
end
|
40
|
+
|
35
41
|
# @return [Nokogiri::XML::Document] content as Nokogiri::XML::Document object
|
36
42
|
def nokogiri
|
37
43
|
require 'nokogiri'
|
@@ -35,7 +35,7 @@ module EPUB
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
next if index < @last_iterated_entry_index
|
38
|
-
# We can force encoding UTF-8
|
38
|
+
# We can force encoding UTF-8 because EPUB spec allows only UTF-8 filenames
|
39
39
|
entry_path = entry.zip_path.force_encoding('UTF-8')
|
40
40
|
@entries[entry_path] = index
|
41
41
|
@last_iterated_entry_index = index
|
@@ -35,13 +35,13 @@ module EPUB
|
|
35
35
|
content_document
|
36
36
|
end
|
37
37
|
|
38
|
-
# @param [XMLDocument, REXML::Document, Nokogiri::HTML::Document] document HTML document or element including nav
|
38
|
+
# @param [XMLDocument, REXML::Document, Oga::XML::Document, Nokogiri::HTML::Document] document HTML document or element including nav
|
39
39
|
# @return [Array<EPUB::ContentDocument::Navigation::Nav>] navs array of Nav 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
|
-
# @param [REXML::Element, Nokogiri::XML::Element] element nav element
|
44
|
+
# @param [REXML::Element, Oga::XML::Element, Nokogiri::XML::Element] element nav element
|
45
45
|
# @return [EPUB::ContentDocument::Navigation::Nav] nav Nav object
|
46
46
|
def parse_navigation(element)
|
47
47
|
nav = EPUB::ContentDocument::Navigation::Navigation.new
|
@@ -56,7 +56,7 @@ module EPUB
|
|
56
56
|
nav
|
57
57
|
end
|
58
58
|
|
59
|
-
# @param [REXML::Element, Nokogiri::XML::Element] element li element
|
59
|
+
# @param [REXML::Element, Oga::XML::Element, Nokogiri::XML::Element] element li element
|
60
60
|
def parse_navigation_item(element)
|
61
61
|
item = EPUB::ContentDocument::Navigation::Item.new
|
62
62
|
a_or_span = element.each_element_by_xpath('./xhtml:a[1]|xhtml:span[1]', EPUB::NAMESPACES).first
|
@@ -90,7 +90,7 @@ module EPUB
|
|
90
90
|
|
91
91
|
private
|
92
92
|
|
93
|
-
# @param [REXML::Element, Nokogiri::XML::Element] element nav element
|
93
|
+
# @param [REXML::Element, Oga::XML::Element, Nokogiri::XML::Element] element nav element
|
94
94
|
# @return [String] heading heading text
|
95
95
|
def find_heading(element)
|
96
96
|
heading = element.each_element_by_xpath('./xhtml:h1|xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6|xhtml:hgroup', EPUB::NAMESPACES).first
|
data/lib/epub/parser/version.rb
CHANGED
@@ -5,7 +5,10 @@ module EPUB
|
|
5
5
|
attr_accessor :backend
|
6
6
|
|
7
7
|
def new(xml)
|
8
|
-
|
8
|
+
case backend
|
9
|
+
when :Oga
|
10
|
+
Oga.parse_xml(xml)
|
11
|
+
when :Nokogiri
|
9
12
|
Nokogiri.XML(xml)
|
10
13
|
else
|
11
14
|
REXML::Document.new(xml)
|
@@ -16,10 +19,10 @@ module EPUB
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
|
-
|
20
|
-
begin
|
21
|
-
|
22
|
-
|
23
|
-
rescue LoadError
|
24
|
-
|
22
|
+
%i[Nokogiri Oga REXML].each do |backend|
|
23
|
+
begin
|
24
|
+
require "epub/parser/xml_document/refinements/#{backend.downcase}"
|
25
|
+
EPUB::Parser::XMLDocument.backend ||= backend
|
26
|
+
rescue LoadError
|
27
|
+
end
|
25
28
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "oga"
|
2
|
+
|
3
|
+
module EPUB
|
4
|
+
class Parser
|
5
|
+
class XMLDocument
|
6
|
+
module Refinements
|
7
|
+
module Oga
|
8
|
+
[::Oga::XML::Document, ::Oga::XML::Node].each do |klass|
|
9
|
+
refine klass do
|
10
|
+
[
|
11
|
+
[:document, ::Oga::XML::Document],
|
12
|
+
[:element, ::Oga::XML::Element],
|
13
|
+
[:text, ::Oga::XML::Text]
|
14
|
+
].each do |(type, klass)|
|
15
|
+
define_method "#{type}?" do
|
16
|
+
kind_of? klass
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def root
|
21
|
+
# Couldn't use find(&:element?) for Rubies under 2.6
|
22
|
+
root_node.children.find {|child| child.element?}
|
23
|
+
end
|
24
|
+
|
25
|
+
def elements
|
26
|
+
# Couldn't use find(&:element?) for Rubies under 2.6
|
27
|
+
children.select {|child| child.element?}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Need for Rubies under 2.6
|
31
|
+
def respond_to?(name, include_all = false)
|
32
|
+
[:root, :elements].include?(name) || super
|
33
|
+
end
|
34
|
+
|
35
|
+
def each_element_by_xpath(xpath, namespaces = nil, &block)
|
36
|
+
xpath(xpath, namespaces: namespaces).each &block
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
refine ::Oga::XML::Element do
|
42
|
+
def attribute_with_prefix(name, prefix = nil)
|
43
|
+
name = prefix ? "#{prefix}:#{name}" : name
|
44
|
+
get(name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def each_element(xpath = nil, &block)
|
48
|
+
each_node do |node|
|
49
|
+
throw :skip_children unless node.kind_of?(::Oga::XML::Element)
|
50
|
+
block.call node
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def namespace_uri
|
55
|
+
namespace&.uri
|
56
|
+
end
|
57
|
+
|
58
|
+
alias original_namespaces namespaces
|
59
|
+
def namespaces
|
60
|
+
original_namespaces.each_with_object({}) {|(name, namespace), nss|
|
61
|
+
nss[name] = namespace.uri
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
alias content text
|
66
|
+
end
|
67
|
+
|
68
|
+
refine ::Oga::XML::Text do
|
69
|
+
alias content text
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
include Oga
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -42,7 +42,7 @@ module EPUB
|
|
42
42
|
|
43
43
|
# @todo: Refactoring
|
44
44
|
# @return [Array<Hash>] An array of rearch results. Each result is composed of:
|
45
|
-
# * +:element+: [REXML::Element, Nokogiri::XML::ELement] Found element
|
45
|
+
# * +:element+: [REXML::Element, Oga::XML::Element, Nokogiri::XML::ELement] Found element
|
46
46
|
# * +:itemref+: [EPUB::Publication::Package::Spine::Itemref] Itemref that element's document belongs to
|
47
47
|
# * +:location+: [EPUB::CFI::Location] CFI that indicates the element
|
48
48
|
# * +:package+: [EPUB::Publication::Package] Package that the element belongs to
|
data/lib/epub/searcher/xhtml.rb
CHANGED
@@ -9,7 +9,7 @@ module EPUB
|
|
9
9
|
ALGORITHMS = {}
|
10
10
|
|
11
11
|
class << self
|
12
|
-
# @param element [REXML::Element, REXML::Document, Nokogiri::XML::Element, Nokogiri::XML::Document]
|
12
|
+
# @param element [REXML::Element, REXML::Document, Oga::XML::ELement, Oga::XML::Document, Nokogiri::XML::Element, Nokogiri::XML::Document]
|
13
13
|
# @param word [String]
|
14
14
|
# @return [Array<Result>]
|
15
15
|
def search_text(element, word)
|
@@ -23,7 +23,7 @@ module EPUB
|
|
23
23
|
end
|
24
24
|
|
25
25
|
class Restricted < self
|
26
|
-
# @param element [REXML::Element, Nokogiri::XML::Element]
|
26
|
+
# @param element [REXML::Element, Oga::XML::Element, Nokogiri::XML::Element]
|
27
27
|
# @return [Array<Result>]
|
28
28
|
def search_text(word, element=nil)
|
29
29
|
results = []
|
data/test/helper.rb
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path 'helper', File.dirname(__FILE__)
|
|
4
4
|
class TestParserPublication < Test::Unit::TestCase
|
5
5
|
def setup
|
6
6
|
opf = File.read("test/fixtures/book/OPS/ルートファイル.opf")
|
7
|
-
@opf =
|
7
|
+
@opf = EPUB::Parser::XMLDocument.new(opf)
|
8
8
|
@parser = EPUB::Parser::Publication.new(opf)
|
9
9
|
@package = @parser.parse_package(@opf)
|
10
10
|
end
|
@@ -6,77 +6,81 @@ class TestParserXMLDocument < Test::Unit::TestCase
|
|
6
6
|
@container = File.read("test/fixtures/book/META-INF/container.xml")
|
7
7
|
@opf = File.read("test/fixtures/book/OPS/ルートファイル.opf")
|
8
8
|
@nav = File.read("test/fixtures/book/OPS/nav.xhtml")
|
9
|
+
@backends = [:REXML, :Nokogiri, :Oga]
|
9
10
|
end
|
10
11
|
|
11
12
|
def test_parse_container
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
assert_equal rootfile.full_path, rf.full_path
|
21
|
-
assert_equal rootfile.media_type, rf.media_type
|
13
|
+
assert_equal_results @backends do
|
14
|
+
container = EPUB::Parser::OCF.new(nil).parse_container(@container)
|
15
|
+
[
|
16
|
+
container.rootfiles.length,
|
17
|
+
container.rootfiles.collect {|rootfile|
|
18
|
+
[rootfile.full_path, rootfile.media_type]
|
19
|
+
}
|
20
|
+
]
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
24
|
def test_parse_package_document
|
26
|
-
|
27
|
-
|
28
|
-
EPUB::Parser::XMLDocument.backend = :Nokogiri
|
29
|
-
nokogiri_package = EPUB::Parser::Publication.new(@opf).parse
|
25
|
+
assert_equal_results @backends do
|
26
|
+
result = []
|
30
27
|
|
31
|
-
|
32
|
-
assert_equal rexml_package.send(attr), nokogiri_package.send(attr)
|
33
|
-
end
|
28
|
+
package = EPUB::Parser::Publication.new(@opf).parse
|
34
29
|
|
35
|
-
|
36
|
-
rexml_attr = rexml_package.metadata.send(attr)
|
37
|
-
nokogiri_attr = nokogiri_package.metadata.send(attr)
|
30
|
+
result << %i[version prefix xml_lang dir id].collect {|attr| package.send(attr)}
|
38
31
|
|
39
|
-
|
32
|
+
result << EPUB::Metadata::DC_ELEMS.collect {|attr|
|
33
|
+
attr = package.metadata.send(attr)
|
34
|
+
[
|
35
|
+
attr.length,
|
36
|
+
attr.collect {|model|
|
37
|
+
%i[content id lang dir].collect {|a| model.send(a)}
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
40
41
|
|
41
|
-
|
42
|
-
%i[
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
42
|
+
result << package.metadata.metas.collect {|meta|
|
43
|
+
%i[property id scheme content name meta_content].collect {|attr| meta.send(attr)}
|
44
|
+
}
|
47
45
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
46
|
+
result << package.metadata.links.collect {|link|
|
47
|
+
%i[href rel id media_type].collect {|attr| link.send(attr)}
|
48
|
+
}
|
53
49
|
|
54
|
-
|
55
|
-
%i[href rel id media_type].each do |attr|
|
56
|
-
assert_equal link.send(attr), nokogiri_package.metadata.links[index].send(attr)
|
57
|
-
end
|
50
|
+
result
|
58
51
|
end
|
59
52
|
end
|
60
53
|
|
61
54
|
def test_parse_navigation
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
55
|
+
assert_equal_results @backends do
|
56
|
+
result = []
|
57
|
+
|
58
|
+
nav = EPUB::Parser.parse("test/fixtures/book.epub").nav.content_document
|
59
|
+
|
60
|
+
result << nav.navigations.length
|
61
|
+
|
62
|
+
result << nav.navigations.collect {|item|
|
63
|
+
%i[text content_document type].collect {|attr| item.send(attr)}
|
64
|
+
|
65
|
+
item.items.collect {|i|
|
66
|
+
%i[text content_document].collect {|attr| i.send(attr)}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
result
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def assert_equal_results(backends)
|
77
|
+
results = backends.collect {|backend|
|
78
|
+
EPUB::Parser::XMLDocument.backend = backend
|
79
|
+
yield
|
80
|
+
}
|
81
|
+
expected = results.shift
|
82
|
+
results.each do |actual|
|
83
|
+
assert_equal expected, actual
|
80
84
|
end
|
81
85
|
end
|
82
86
|
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.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -229,7 +229,7 @@ dependencies:
|
|
229
229
|
version: 1.6.0
|
230
230
|
- - "<"
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
version: '1.
|
232
|
+
version: '1.11'
|
233
233
|
type: :development
|
234
234
|
prerelease: false
|
235
235
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -239,7 +239,21 @@ dependencies:
|
|
239
239
|
version: 1.6.0
|
240
240
|
- - "<"
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version: '1.
|
242
|
+
version: '1.11'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: oga
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '2.16'
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '2.16'
|
243
257
|
- !ruby/object:Gem::Dependency
|
244
258
|
name: archive-zip
|
245
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -365,6 +379,7 @@ files:
|
|
365
379
|
- lib/epub/parser/version.rb
|
366
380
|
- lib/epub/parser/xml_document.rb
|
367
381
|
- lib/epub/parser/xml_document/refinements/nokogiri.rb
|
382
|
+
- lib/epub/parser/xml_document/refinements/oga.rb
|
368
383
|
- lib/epub/parser/xml_document/refinements/rexml.rb
|
369
384
|
- lib/epub/publication.rb
|
370
385
|
- lib/epub/publication/fixed_layout.rb
|