epub-parser 0.4.8 → 0.4.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33ec17f68d55ead850d39f0df0ec73f0d9cda4901cdc4ee83612ebd95c0b1927
4
- data.tar.gz: 580741918f923319e665203b8334725e48afb1c69bdb2fe7ca412cefed3477d6
3
+ metadata.gz: 399a60256947a87d2dc3ada4b348cffeb99ac9d3ed9dcbe5159b4d6ca02d1dff
4
+ data.tar.gz: f9ed100e463cc3a60071b7074ebc4a6dd141fac397762697b39b549bb13025f9
5
5
  SHA512:
6
- metadata.gz: 7683c526bc654bf55556db4d2be9efeccebc25ad29524ab14f264c85513649c0741b6b281eaa100e0cdbf93706ab1115ffca4522408299964cf1ef36136bc3be
7
- data.tar.gz: 7522670e7f7126a33a1ea19a89577382b5f25d0555974cf1b014184d30a44be5a475467b95772f2d5386ac76f2ab4fc6720cea91f68c7ae07e562a1c3229e186
6
+ metadata.gz: 3f320d4d2ed30d1d2b65db4bf67f4c66dfb4aea66911bd2de9b1b6b8d93e1caa093f4c4cf9c1d595d81744633c4333f5e126c0ae3f6573d9b7fb9c3702987bf3
7
+ data.tar.gz: 95cf359e907036d9f4046c4eb7c1bc8eec577c3c78ef31629cae8b9cfd3b8f8c81190ac18b7d639918ccaabc054ca2c5dcddf7f05733c2e05f7b9170463e9bbd
data/.gitignore CHANGED
@@ -8,6 +8,9 @@ coverage/*
8
8
  samples/*
9
9
  doc/*
10
10
  html/*
11
+ man/*
12
+ !man/epubinfo.1.ronn
11
13
  NOTE
12
14
  test/fixtures/book.epub
13
15
  *~
16
+ /.gem_rbs_collection/
data/.gitlab-ci.yml CHANGED
@@ -1,20 +1,9 @@
1
1
  before_script:
2
2
  - ruby -v
3
3
  - which ruby
4
- - gem install bundler --no-document
5
4
  - bundle install --jobs=$(nproc) --path=deps "${FLAGS[@]}"
6
5
  - bundle clean
7
6
 
8
- test:2.6:
9
- image: ruby:2.6
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 2>/dev/null
11
- except:
12
- - tags
13
- cache:
14
- key: ruby:2.6
15
- paths:
16
- - deps
17
-
18
7
  test:2.7:
19
8
  image: ruby:2.7
20
9
  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 2>/dev/null
@@ -55,11 +44,31 @@ test:3.2:
55
44
  paths:
56
45
  - deps
57
46
 
47
+ test:3.3:
48
+ image: ruby:3.3
49
+ 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 2>/dev/null
50
+ except:
51
+ - tags
52
+ cache:
53
+ key: ruby:3.3
54
+ paths:
55
+ - deps
56
+
57
+ test:3.4:
58
+ image: ruby:3.4
59
+ 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 2>/dev/null
60
+ except:
61
+ - tags
62
+ cache:
63
+ key: ruby:3.4
64
+ paths:
65
+ - deps
66
+
58
67
  pages:
59
68
  stage: deploy
60
- image: ruby:2.7
69
+ image: ruby:3.4
61
70
  dependencies:
62
- - test:2.6
71
+ - test:3.4
63
72
  script:
64
73
  - bundle exec rake test doc:yard
65
74
  - mv doc public
@@ -70,6 +79,6 @@ pages:
70
79
  only:
71
80
  - master
72
81
  cache:
73
- key: ruby:2.7
82
+ key: ruby:3.4
74
83
  paths:
75
84
  - deps
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,13 @@
1
1
  = CHANGELOG
2
2
 
3
+ == 0.4.9
4
+
5
+ * Restructure test
6
+ * Restructure Rake tasks
7
+ * Update required Ruby version to 2.6
8
+ * Follow Ruby 3.5 inspection change
9
+ * Follow Archive::Zip API change
10
+
3
11
  == 0.4.8
4
12
 
5
13
  * Add Rubyzip adapter
data/Gemfile CHANGED
@@ -1,12 +1,20 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
- if ENV['EDGE_MAKER'] == '1'
5
- group :development do
6
- gem 'epub-maker', path: '../epub-maker'
4
+ group :development do
5
+ if ENV["EPUB_CFI_PATH"]
6
+ gem "epub-cfi", path: ENV["EPUB_CFI_PATH"]
7
+ end
8
+
9
+ if ENV['EPUB_MAKER_PATH']
10
+ gem 'epub-maker', path: ENV["EPUB_MAKER_PATH"]
11
+ end
12
+
13
+ if RUBY_PLATFORM.match /darwin/
14
+ gem 'terminal-notifier'
7
15
  end
8
16
  end
9
17
 
10
- if RUBY_PLATFORM.match /darwin/
11
- gem 'terminal-notifier'
18
+ group :development, :test do
19
+ gem "ffi", "~> 1.16.3" if RbConfig::CONFIG["MAJOR"] == "2"
12
20
  end
data/README.adoc CHANGED
@@ -176,6 +176,14 @@ If you find other gems, please tell me or request a pull request.
176
176
 
177
177
  == RECENT CHANGES
178
178
 
179
+ === 0.4.9
180
+
181
+ * Restructure test
182
+ * Restructure Rake tasks
183
+ * Update required Ruby version to 2.6
184
+ * Follow Ruby 3.5 inspection change
185
+ * Follow Archive::Zip API change
186
+
179
187
  === 0.4.8
180
188
 
181
189
  * Add Rubyzip adapter
@@ -184,12 +192,6 @@ If you find other gems, please tell me or request a pull request.
184
192
 
185
193
  * [BUG FIX]Fix a bug that epubinfo doesn't handle navigation properly
186
194
 
187
- === 0.4.6
188
-
189
- * [BUG FIX]Prevent epubinfo tool raise exception when no nav elements
190
- * Tiny modifcation on Zip archive manipulation
191
- * Remove version specification from Nokogiri to migrate to Ruby 3.1
192
-
193
195
  See {file:CHANGELOG.adoc} for older changelogs and details.
194
196
 
195
197
  == TODOS
data/Rakefile CHANGED
@@ -1,60 +1,7 @@
1
1
  require 'rake/clean'
2
- require 'rake/testtask'
3
2
  require 'rubygems/tasks'
4
- require 'yard'
5
- require 'rdoc/task'
6
- require 'archive/zip'
7
- require 'epub/maker'
8
- require "tmpdir"
9
3
 
10
4
  task :default => :test
11
- task :test => 'test:default'
12
5
 
13
- namespace :test do
14
- task :default => [:build, :test]
15
-
16
- desc 'Build test fixture EPUB file'
17
- task :build => [:clean, "test/fixtures/book.epub"]
18
-
19
- file "test/fixtures/book.epub" => "test/fixtures/book" do |task|
20
- EPUB::Maker.archive task.source
21
- # We cannot include "CASE-SENSITIVE.xhtml" in Git repository because
22
- # macOS remove it or case-sensitive.xhtml from file system.
23
- small_file = File.read("#{task.source}/OPS/case-sensitive.xhtml")
24
- Dir.mktmpdir do |dir|
25
- upcase_file_path = File.join(dir, "CASE-SENSITIVE.xhtml")
26
- File.write upcase_file_path, small_file.sub('small file name', 'LARGE FILE NAME')
27
- Archive::Zip.archive task.name, upcase_file_path, path_prefix: "OPS"
28
- end
29
- end
30
- CLEAN.include "test/fixtures/book.epub"
31
-
32
- Rake::TestTask.new do |task|
33
- task.test_files = FileList['test/**/test_*.rb']
34
- task.warning = true
35
- task.options = '--no-show-detail-immediately --verbose'
36
- end
37
- end
38
-
39
- task :doc => 'doc:default'
40
-
41
- namespace :doc do
42
- task :default => [:yard, :rdoc]
43
-
44
- YARD::Rake::YardocTask.new
45
- Rake::RDocTask.new do |rdoc|
46
- rdoc.rdoc_files.include %w[
47
- lib/**/*.rb
48
- README.adoc
49
- CHANGELOG.adoc
50
- MIT-LICENSE
51
- docs/**/*.adoc
52
- docs/**/*.md
53
- ]
54
- end
55
- end
56
-
57
- Gem::Tasks.new do |tasks|
58
- tasks.console.command = 'pry'
59
- end
6
+ Gem::Tasks.new
60
7
  task :build => :clean
data/docs/Searcher.adoc CHANGED
@@ -77,7 +77,7 @@ You can also use *restricted* searcher, which means that it can search from only
77
77
  </html>
78
78
  ----
79
79
 
80
- But cannot from document below:
80
+ But cannot do so from document below:
81
81
 
82
82
  ----
83
83
  <html>
data/epub-parser.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = %q{EPUB 3 Parser}
12
12
  s.description = %q{Parse EPUB 3 book loosely}
13
13
  s.license = 'MIT'
14
- s.required_ruby_version = '>= 2.3'
14
+ s.required_ruby_version = '>= 2.6'
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  .push('test/fixtures/book/OPS/ルートファイル.opf')
@@ -27,10 +27,8 @@ Gem::Specification.new do |s|
27
27
 
28
28
  s.add_development_dependency 'rake'
29
29
  s.add_development_dependency 'rubygems-tasks'
30
- s.add_development_dependency 'zipruby' unless RUBY_PLATFORM.match /mingw|arm64-darwin/
31
- s.add_development_dependency 'rubyzip', '>= 3.0.0.alpha'
32
- s.add_development_dependency 'pry'
33
- s.add_development_dependency 'pry-doc'
30
+ s.add_development_dependency 'zipruby'
31
+ s.add_development_dependency 'rubyzip', '>= 2.0.0'
34
32
  s.add_development_dependency 'test-unit'
35
33
  s.add_development_dependency 'test-unit-rr'
36
34
  s.add_development_dependency 'test-unit-notify'
@@ -38,12 +36,12 @@ Gem::Specification.new do |s|
38
36
  s.add_development_dependency 'yard'
39
37
  s.add_development_dependency 'gem-man'
40
38
  s.add_development_dependency 'ronn-ng'
41
- s.add_development_dependency 'pretty_backtrace'
42
39
  s.add_development_dependency 'epub-maker'
43
40
  s.add_development_dependency 'asciidoctor'
44
41
  s.add_development_dependency 'nokogiri'
45
42
  s.add_development_dependency 'oga', '>= 2.16'
46
43
  s.add_development_dependency 'packnga'
44
+ s.add_development_dependency "steep"
47
45
 
48
46
  s.add_runtime_dependency 'archive-zip'
49
47
  s.add_runtime_dependency 'rexml'
@@ -3,8 +3,6 @@ require "set"
3
3
  module EPUB
4
4
  module ContentDocument
5
5
  module Typable
6
- attr_reader :types
7
-
8
6
  def types
9
7
  @types ||= Set.new
10
8
  end
@@ -29,7 +29,7 @@ module EPUB
29
29
  @archive.each.with_index do |entry, index|
30
30
  if target_index
31
31
  if target_index == index
32
- return entry.file_data.read
32
+ return read_content(entry)
33
33
  else
34
34
  next
35
35
  end
@@ -40,7 +40,7 @@ module EPUB
40
40
  @entries[entry_path] = index
41
41
  @last_iterated_entry_index = index
42
42
  if entry_path == path_name
43
- return entry.file_data.read
43
+ return read_content(entry)
44
44
  end
45
45
  end
46
46
 
@@ -49,6 +49,20 @@ module EPUB
49
49
  open {|container| container.read(path_name)}
50
50
  end
51
51
  end
52
+
53
+ private
54
+
55
+ def read_content(entry)
56
+ file_data = entry.file_data
57
+ content = ""
58
+ begin
59
+ loop do
60
+ content << file_data.read(8192)
61
+ end
62
+ rescue EOFError
63
+ end
64
+ content
65
+ end
52
66
  end
53
67
  end
54
68
  end
@@ -28,7 +28,7 @@ module EPUB
28
28
  language = build_model(child, :DCMES, ['id'])
29
29
  metadata.languages << language
30
30
  language
31
- when 'title', 'contributor', 'coverage', 'creator', 'date', 'description', 'format', 'publisher', 'relation', 'source', 'subject', 'rights', 'type'
31
+ when 'contributor', 'coverage', 'creator', 'date', 'description', 'format', 'publisher', 'relation', 'source', 'subject', 'rights', 'type'
32
32
  attr = elem_name == 'rights' ? elem_name : elem_name + 's'
33
33
  dcmes = build_model(child)
34
34
  metadata.__send__(attr) << dcmes
@@ -1,5 +1,5 @@
1
1
  module EPUB
2
2
  class Parser
3
- VERSION = "0.4.8"
3
+ VERSION = "0.4.9"
4
4
  end
5
5
  end
@@ -91,6 +91,7 @@ module EPUB
91
91
  # @param [EPUB::CFI] cfi
92
92
  # @return [Array] Path in EPUB Rendition
93
93
  def search_by_cfi(cfi)
94
+ raise NotImplementedError, "Currently, #{__method__} doesn't support deeper DOM tree such as including <iframe>" if cfi.paths[2]
94
95
  path_in_package = cfi.paths.first
95
96
  spine = @package.spine
96
97
  model = [@package.metadata, @package.manifest, spine, @package.guide, @package.bindings].compact[path_in_package.steps.first.value / 2 - 1]
@@ -119,8 +120,6 @@ module EPUB
119
120
  end
120
121
  end
121
122
 
122
- raise NotImplementedError, "Currently, #{__method__} doesn't support deeper DOM tree such as including <iframe>" if cfi.paths[2]
123
-
124
123
  [itemref, current_node]
125
124
  end
126
125
 
data/rakelib/doc.rake ADDED
@@ -0,0 +1,30 @@
1
+ require 'yard'
2
+ require 'rdoc/task'
3
+
4
+ task :doc => 'doc:default'
5
+
6
+ namespace :doc do
7
+ task :default => [:yard, :rdoc]
8
+
9
+ YARD::Rake::YardocTask.new
10
+ Rake::RDocTask.new do |rdoc|
11
+ rdoc.rdoc_files.include %w[
12
+ lib/**/*.rb
13
+ README.adoc
14
+ CHANGELOG.adoc
15
+ MIT-LICENSE
16
+ docs/**/*.adoc
17
+ docs/**/*.md
18
+ ]
19
+ end
20
+
21
+ desc "Build man page for epubinfo command"
22
+ file "man/epubinfo.1" => :ronn
23
+
24
+ desc "Build HTML man page for epubinfo command"
25
+ file "man/epubinfo.1.html" => :ronn
26
+
27
+ task ronn: "man/epubinfo.1.ronn" do |t|
28
+ sh "ronn #{t.source}"
29
+ end
30
+ end
data/rakelib/test.rake ADDED
@@ -0,0 +1,45 @@
1
+ require 'rake/clean'
2
+ require 'rake/testtask'
3
+ require 'epub/maker'
4
+ require "tmpdir"
5
+ require 'archive/zip'
6
+
7
+ task :test => 'test:default'
8
+
9
+ namespace :test do
10
+ task :default => [:test, :test_ocf_physical_container_zipruby, :test_ocf_physical_container_rubyzip]
11
+
12
+ desc 'Build test fixture EPUB file'
13
+ task :build => [:clean, "test/fixtures/book.epub"]
14
+
15
+ file "test/fixtures/book.epub" => "test/fixtures/book" do |task|
16
+ EPUB::Maker.archive task.source
17
+ # We cannot include "CASE-SENSITIVE.xhtml" in Git repository because
18
+ # macOS remove it or case-sensitive.xhtml from file system.
19
+ small_file = File.read("#{task.source}/OPS/case-sensitive.xhtml")
20
+ Dir.mktmpdir do |dir|
21
+ upcase_file_path = File.join(dir, "CASE-SENSITIVE.xhtml")
22
+ File.write upcase_file_path, small_file.sub('small file name', 'LARGE FILE NAME')
23
+ Archive::Zip.archive task.name, upcase_file_path, path_prefix: "OPS"
24
+ end
25
+ end
26
+ CLEAN.include "test/fixtures/book.epub"
27
+
28
+ Rake::TestTask.new test: :build do |task|
29
+ task.test_files = FileList['test/**/test_*.rb'].exclude "test/test_ocf_physical_container_*.rb"
30
+ task.warning = true
31
+ task.options = '--no-show-detail-immediately --verbose'
32
+ end
33
+
34
+ Rake::TestTask.new test_ocf_physical_container_zipruby: :build do |task|
35
+ task.test_files = FileList["test/test_ocf_physical_container_zipruby.rb"]
36
+ task.warning = true
37
+ task.options = "--no-show-detail-immediately --verbose"
38
+ end
39
+
40
+ Rake::TestTask.new test_ocf_physical_container_rubyzip: :build do |task|
41
+ task.test_files = FileList["test/test_ocf_physical_container_rubyzip.rb"]
42
+ task.warning = true
43
+ task.options = "--no-show-detail-immediately --verbose"
44
+ end
45
+ end
@@ -0,0 +1,19 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ # gems:
17
+ # # If you want to avoid installing rbs files for gems, you can specify them here.
18
+ # - name: GEM_NAME
19
+ # ignore: true
data/test/helper.rb CHANGED
@@ -8,13 +8,38 @@ require 'pp'
8
8
  require 'test/unit'
9
9
  require 'test/unit/rr'
10
10
  require 'test/unit/notify'
11
- require 'pry'
12
- if ENV["PRETTY_BACKTRACE"]
13
- require 'pretty_backtrace'
14
- PrettyBacktrace.enable
15
- end
16
11
 
17
12
  require 'epub/parser'
18
13
  if ENV["XML_BACKEND"]
19
14
  EPUB::Parser::XMLDocument.backend = ENV["XML_BACKEND"].to_sym
20
15
  end
16
+
17
+ module ConcreteContainer
18
+ def test_class_method_open
19
+ @class.open @container_path do |container|
20
+ assert_instance_of @class, container
21
+ assert_equal @content, container.read(@path).force_encoding('UTF-8')
22
+ assert_equal File.read('test/fixtures/book/OPS/日本語.xhtml'), container.read('OPS/日本語.xhtml').force_encoding('UTF-8')
23
+ end
24
+ end
25
+
26
+ def test_class_method_read
27
+ assert_equal @content, @class.read(@container_path, @path).force_encoding('UTF-8')
28
+ end
29
+
30
+ def test_open_yields_over_container_with_opened_archive
31
+ @container.open do |container|
32
+ assert_instance_of @class, container
33
+ end
34
+ end
35
+
36
+ def test_container_in_open_block_can_readable
37
+ @container.open do |container|
38
+ assert_equal @content, container.read(@path).force_encoding('UTF-8')
39
+ end
40
+ end
41
+
42
+ def test_read
43
+ assert_equal @content, @container.read(@path).force_encoding('UTF-8')
44
+ end
45
+ end
@@ -47,7 +47,16 @@ class TestContentDocument < Test::Unit::TestCase
47
47
 
48
48
  def test_title_returns_empty_string_when_title_element_not_exist
49
49
  content_doc = XHTML.new
50
- stub(content_doc).raw_document {'content'}
50
+ stub(content_doc).raw_document {
51
+ <<~EOS
52
+ <?xml version="1.0" encoding="UTF-8"?>
53
+ <!DOCTYPE html>
54
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
55
+ <head></head>
56
+ <body></body>
57
+ </html>
58
+ EOS
59
+ }
51
60
  assert_equal '', content_doc.title
52
61
  end
53
62
 
data/test/test_inspect.rb CHANGED
@@ -18,7 +18,7 @@ class TestInspect < Test::Unit::TestCase
18
18
  @package.prefix = {'foaf' => 'http://xmlns.com/foaf/spec/'}
19
19
 
20
20
  assert_match %Q|@xml_lang="zh"|, @package.inspect
21
- assert_match %Q|@prefix={"foaf"=>"http://xmlns.com/foaf/spec/"}|, @package.inspect
21
+ assert_match %r|@prefix={"foaf"\s*=>\s*"http://xmlns.com/foaf/spec/"}|, @package.inspect
22
22
  end
23
23
 
24
24
  def test_package_inspects_content_models
@@ -1,63 +1,11 @@
1
1
  # coding: utf-8
2
- require_relative 'helper'
3
- require 'epub/ocf/physical_container'
4
-
5
- class TestOCFPhysicalContainer < Test::Unit::TestCase
6
- def setup
7
- @container_path = 'test/fixtures/book.epub'
8
- @path = 'OPS/nav.xhtml'
9
- @content = File.read(File.join('test/fixtures/book', @path))
10
- end
2
+ require_relative "test_ocf_physical_container_base"
11
3
 
4
+ class TestOCFPhysicalContainer < TestOCFPhysicalContainerBase
12
5
  def test_read
13
6
  assert_equal @content, EPUB::OCF::PhysicalContainer.read(@container_path, @path).force_encoding('UTF-8')
14
7
  end
15
8
 
16
- module ConcreteContainer
17
- def test_class_method_open
18
- @class.open @container_path do |container|
19
- assert_instance_of @class, container
20
- assert_equal @content, container.read(@path).force_encoding('UTF-8')
21
- assert_equal File.read('test/fixtures/book/OPS/日本語.xhtml'), container.read('OPS/日本語.xhtml').force_encoding('UTF-8')
22
- end
23
- end
24
-
25
- def test_class_method_read
26
- assert_equal @content, @class.read(@container_path, @path).force_encoding('UTF-8')
27
- end
28
-
29
- def test_open_yields_over_container_with_opened_archive
30
- @container.open do |container|
31
- assert_instance_of @class, container
32
- end
33
- end
34
-
35
- def test_container_in_open_block_can_readable
36
- @container.open do |container|
37
- assert_equal @content, container.read(@path).force_encoding('UTF-8')
38
- end
39
- end
40
-
41
- def test_read
42
- assert_equal @content, @container.read(@path).force_encoding('UTF-8')
43
- end
44
- end
45
-
46
- begin
47
- require 'epub/ocf/physical_container/zipruby'
48
- class TestZipruby < self
49
- include ConcreteContainer
50
-
51
- def setup
52
- super
53
- @class = EPUB::OCF::PhysicalContainer::Zipruby
54
- @container = @class.new(@container_path)
55
- end
56
- end
57
- rescue LoadError
58
- warn "Skip TestOPFPhysicalContainer::TestZipRuby"
59
- end
60
-
61
9
  class TestUnpackedDirectory < self
62
10
  include ConcreteContainer
63
11
 
@@ -86,17 +34,6 @@ class TestOCFPhysicalContainer < Test::Unit::TestCase
86
34
  end
87
35
  end
88
36
 
89
- require "epub/ocf/physical_container/rubyzip"
90
- class TestRubyzip < self
91
- include ConcreteContainer
92
-
93
- def setup
94
- super
95
- @class = EPUB::OCF::PhysicalContainer::Rubyzip
96
- @container = @class.new(@container_path)
97
- end
98
- end
99
-
100
37
  class TestUnpackedURI < self
101
38
  def setup
102
39
  super
@@ -0,0 +1,10 @@
1
+ require_relative "helper"
2
+ require "epub/ocf/physical_container"
3
+
4
+ class TestOCFPhysicalContainerBase < Test::Unit::TestCase
5
+ def setup
6
+ @container_path = 'test/fixtures/book.epub'
7
+ @path = 'OPS/nav.xhtml'
8
+ @content = File.read(File.join('test/fixtures/book', @path))
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "helper"
2
+ require_relative "test_ocf_physical_container_base"
3
+ require "epub/ocf/physical_container/rubyzip"
4
+
5
+ class TestRubyzip < TestOCFPhysicalContainerBase
6
+ include ConcreteContainer
7
+
8
+ def setup
9
+ super
10
+ @class = EPUB::OCF::PhysicalContainer::Rubyzip
11
+ @container = @class.new(@container_path)
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ begin
2
+ require "epub/ocf/physical_container/zipruby"
3
+ require_relative "test_ocf_physical_container_base"
4
+
5
+ class TestZipruby < TestOCFPhysicalContainerBase
6
+ include ConcreteContainer
7
+
8
+ def setup
9
+ super
10
+ @class = EPUB::OCF::PhysicalContainer::Zipruby
11
+ @container = @class.new(@container_path)
12
+ end
13
+ end
14
+ rescue LoadError
15
+ warn "Skip TestOPFPhysicalContainer::TestZipruby"
16
+ end
@@ -22,15 +22,15 @@ class TestParserOCF < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  def test_parse_encryption_do_nothing_excluding_to_have_content
25
- encryption = @parser.parse_encryption('content')
25
+ encryption = @parser.parse_encryption('<root>content</root>')
26
26
 
27
- assert_equal 'content', encryption.content
27
+ assert_equal '<root>content</root>', encryption.content
28
28
  end
29
29
 
30
30
  def test_parse_metadata_with_unknown_format_do_nothing_excluding_to_have_content
31
- metadata = @parser.parse_metadata('content')
31
+ metadata = @parser.parse_metadata('<root>content</root>')
32
32
 
33
- assert_equal 'content', metadata.content
33
+ assert_equal '<root>content</root>', metadata.content
34
34
  end
35
35
 
36
36
  def test_parse_metadata_with_multiple_rendition_format_returns_metadata
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epub-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - KITAITI Makoto
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-11-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -39,21 +38,7 @@ dependencies:
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
40
  - !ruby/object:Gem::Dependency
42
- name: rubyzip
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 3.0.0.alpha
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 3.0.0.alpha
55
- - !ruby/object:Gem::Dependency
56
- name: pry
41
+ name: zipruby
57
42
  requirement: !ruby/object:Gem::Requirement
58
43
  requirements:
59
44
  - - ">="
@@ -67,19 +52,19 @@ dependencies:
67
52
  - !ruby/object:Gem::Version
68
53
  version: '0'
69
54
  - !ruby/object:Gem::Dependency
70
- name: pry-doc
55
+ name: rubyzip
71
56
  requirement: !ruby/object:Gem::Requirement
72
57
  requirements:
73
58
  - - ">="
74
59
  - !ruby/object:Gem::Version
75
- version: '0'
60
+ version: 2.0.0
76
61
  type: :development
77
62
  prerelease: false
78
63
  version_requirements: !ruby/object:Gem::Requirement
79
64
  requirements:
80
65
  - - ">="
81
66
  - !ruby/object:Gem::Version
82
- version: '0'
67
+ version: 2.0.0
83
68
  - !ruby/object:Gem::Dependency
84
69
  name: test-unit
85
70
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +164,7 @@ dependencies:
179
164
  - !ruby/object:Gem::Version
180
165
  version: '0'
181
166
  - !ruby/object:Gem::Dependency
182
- name: pretty_backtrace
167
+ name: epub-maker
183
168
  requirement: !ruby/object:Gem::Requirement
184
169
  requirements:
185
170
  - - ">="
@@ -193,7 +178,7 @@ dependencies:
193
178
  - !ruby/object:Gem::Version
194
179
  version: '0'
195
180
  - !ruby/object:Gem::Dependency
196
- name: epub-maker
181
+ name: asciidoctor
197
182
  requirement: !ruby/object:Gem::Requirement
198
183
  requirements:
199
184
  - - ">="
@@ -207,7 +192,7 @@ dependencies:
207
192
  - !ruby/object:Gem::Version
208
193
  version: '0'
209
194
  - !ruby/object:Gem::Dependency
210
- name: asciidoctor
195
+ name: nokogiri
211
196
  requirement: !ruby/object:Gem::Requirement
212
197
  requirements:
213
198
  - - ">="
@@ -221,35 +206,35 @@ dependencies:
221
206
  - !ruby/object:Gem::Version
222
207
  version: '0'
223
208
  - !ruby/object:Gem::Dependency
224
- name: nokogiri
209
+ name: oga
225
210
  requirement: !ruby/object:Gem::Requirement
226
211
  requirements:
227
212
  - - ">="
228
213
  - !ruby/object:Gem::Version
229
- version: '0'
214
+ version: '2.16'
230
215
  type: :development
231
216
  prerelease: false
232
217
  version_requirements: !ruby/object:Gem::Requirement
233
218
  requirements:
234
219
  - - ">="
235
220
  - !ruby/object:Gem::Version
236
- version: '0'
221
+ version: '2.16'
237
222
  - !ruby/object:Gem::Dependency
238
- name: oga
223
+ name: packnga
239
224
  requirement: !ruby/object:Gem::Requirement
240
225
  requirements:
241
226
  - - ">="
242
227
  - !ruby/object:Gem::Version
243
- version: '2.16'
228
+ version: '0'
244
229
  type: :development
245
230
  prerelease: false
246
231
  version_requirements: !ruby/object:Gem::Requirement
247
232
  requirements:
248
233
  - - ">="
249
234
  - !ruby/object:Gem::Version
250
- version: '2.16'
235
+ version: '0'
251
236
  - !ruby/object:Gem::Dependency
252
- name: packnga
237
+ name: steep
253
238
  requirement: !ruby/object:Gem::Requirement
254
239
  requirements:
255
240
  - - ">="
@@ -421,6 +406,9 @@ files:
421
406
  - lib/epub/searcher/result.rb
422
407
  - lib/epub/searcher/xhtml.rb
423
408
  - man/epubinfo.1.ronn
409
+ - rakelib/doc.rake
410
+ - rakelib/test.rake
411
+ - rbs_collection.yaml
424
412
  - sig/epub-parser.rbs
425
413
  - test/fixtures/book/META-INF/container.xml
426
414
  - test/fixtures/book/META-INF/metadata.xml
@@ -447,6 +435,9 @@ files:
447
435
  - test/test_fixed_layout.rb
448
436
  - test/test_inspect.rb
449
437
  - test/test_ocf_physical_container.rb
438
+ - test/test_ocf_physical_container_base.rb
439
+ - test/test_ocf_physical_container_rubyzip.rb
440
+ - test/test_ocf_physical_container_zipruby.rb
450
441
  - test/test_parser.rb
451
442
  - test/test_parser_content_document.rb
452
443
  - test/test_parser_fixed_layout.rb
@@ -460,7 +451,6 @@ licenses:
460
451
  - MIT
461
452
  metadata:
462
453
  yard.run: yard
463
- post_install_message:
464
454
  rdoc_options: []
465
455
  require_paths:
466
456
  - lib
@@ -468,15 +458,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
468
458
  requirements:
469
459
  - - ">="
470
460
  - !ruby/object:Gem::Version
471
- version: '2.3'
461
+ version: '2.6'
472
462
  required_rubygems_version: !ruby/object:Gem::Requirement
473
463
  requirements:
474
464
  - - ">="
475
465
  - !ruby/object:Gem::Version
476
466
  version: '0'
477
467
  requirements: []
478
- rubygems_version: 3.4.22
479
- signing_key:
468
+ rubygems_version: 3.6.7
480
469
  specification_version: 4
481
470
  summary: EPUB 3 Parser
482
471
  test_files:
@@ -486,6 +475,9 @@ test_files:
486
475
  - test/test_fixed_layout.rb
487
476
  - test/test_inspect.rb
488
477
  - test/test_ocf_physical_container.rb
478
+ - test/test_ocf_physical_container_base.rb
479
+ - test/test_ocf_physical_container_rubyzip.rb
480
+ - test/test_ocf_physical_container_zipruby.rb
489
481
  - test/test_parser.rb
490
482
  - test/test_parser_content_document.rb
491
483
  - test/test_parser_fixed_layout.rb