gepub 1.0.17 → 2.0.0

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: d52fcb6d981cf377756f9f81200afee16dcb27ccc50ab56f9c7eadb956efa4e8
4
- data.tar.gz: cabf27d5b82a4cebc292cbce13a61f92bbbb510193913d9fc13159785f92140f
3
+ metadata.gz: e598be44339748d797d96c3b16f9aa5c41e85a58a885089e01ab8edc62649101
4
+ data.tar.gz: 51115282e5410e6f3c147fa78f0c5a9828a1b300ca653b4c04457910c5509479
5
5
  SHA512:
6
- metadata.gz: a48073e42445dc12752eff196f6781df927bc57d5e0ac77f0496674dba4da5756189f7a40eb1dbd41ab062bcbc3f355ab5e98a499960fef15ec2d4379efcc354
7
- data.tar.gz: 9d6d43549a1ce8757cce93e4fd80e4367e8344017f43cc8ad9de552efa1278f4b8d43d2334ef2cb34bc0724de4860f47bccfe9e106f326d8fc59454b806caac0
6
+ metadata.gz: 759ec57e6d7ca1b7437a397965dd38ce090c22202772848becd829e2be9dfc0a9fd067e54e1e5ccd63c53d1926d30814eb3cd7dbe1ed46452c62e628adbe3b81
7
+ data.tar.gz: 722b4a3aa538cef1d56a29a5e88e460dc54f7caef634460604fc4e6e47a58e37e5ad6755a313c47454371a39af783b57ffd5218758ec8a07f1fe52fb7f19675f
@@ -0,0 +1,21 @@
1
+ name: Dependabot auto-merge
2
+ on: pull_request_target
3
+
4
+ permissions:
5
+ contents: write
6
+ pull-requests: write
7
+ checks: read
8
+
9
+ jobs:
10
+ dependabot:
11
+ runs-on: ubuntu-latest
12
+ if: github.actor == 'dependabot[bot]'
13
+ steps:
14
+ # Removed the unused Dependabot metadata step to simplify the workflow.
15
+
16
+ - name: Enable auto-merge for Dependabot PRs
17
+ run: |
18
+ echo "Enabling auto-merge for PR #${{ github.event.pull_request.number }}"
19
+ gh pr merge --auto --squash ${{ github.event.pull_request.number }}
20
+ env:
21
+ GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -12,9 +12,9 @@ jobs:
12
12
  steps:
13
13
  - uses: actions/checkout@master
14
14
  - name: Set up Ruby
15
- uses: actions/setup-ruby@v1
15
+ uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: 3.1.x
17
+ ruby-version: 3.4
18
18
 
19
19
  - name: Publish to GPR
20
20
  run: |
@@ -4,7 +4,7 @@ jobs:
4
4
  test:
5
5
  strategy:
6
6
  matrix:
7
- ruby: [2.7, 3.0, 3.1, 3.2, 3.3, jruby]
7
+ ruby: [3.2, 3.3, 3.4, jruby]
8
8
  platform: [ubuntu-latest, macos-latest, windows-latest]
9
9
  runs-on: ${{ matrix.platform }}
10
10
  env:
@@ -17,13 +17,5 @@ jobs:
17
17
  ruby-version: ${{ matrix.ruby }}
18
18
  - name: setup gems
19
19
  run: bundle install --jobs 4 --retry 3
20
- - name: run test and publish code coverage
21
- if: runner.os == 'Linux' && matrix.ruby == '3.3' && env.CC_TEST_REPORTER_ID != ''
22
- uses: paambaati/codeclimate-action@v5.0.0
23
- env:
24
- CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
25
- with:
26
- coverageCommand: bundle exec rake spec
27
20
  - name: run test
28
- if: runner.os != 'Linux' || matrix.ruby != '3.3' || env.CC_TEST_REPORTER_ID == ''
29
21
  run: bundle exec rake spec
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/gepub.gemspec CHANGED
@@ -12,12 +12,14 @@ Gem::Specification.new do |s|
12
12
  s.description = %q{gepub is a generic EPUB parser/generator. Generates and parse EPUB2 and EPUB3}
13
13
  s.license = "BSD-3-Clause"
14
14
 
15
+ s.required_ruby_version = ">= 3.2"
16
+
15
17
  s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^spec/}) }
16
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
19
  s.require_paths = ["lib"]
18
20
 
19
21
  s.add_runtime_dependency "nokogiri", ">= 1.8.2", "< 2.0"
20
- s.add_runtime_dependency "rubyzip", "> 1.1.1", "< 2.4"
22
+ s.add_runtime_dependency "rubyzip", ">= 3.0", "< 3.1"
21
23
  s.add_development_dependency "epubcheck-ruby"
22
24
  s.add_development_dependency "rake"
23
25
  s.add_development_dependency "rspec"
data/lib/gepub/book.rb CHANGED
@@ -4,7 +4,7 @@ require 'nokogiri'
4
4
  require 'zip'
5
5
  require 'fileutils'
6
6
 
7
- # = GEPUB
7
+ # = GEPUB
8
8
  # Author:: KOJIMA Satoshi
9
9
  # namespace for gepub library.
10
10
  # The core class is GEPUB::Book. It holds metadata and contents of EPUB file. metadata and contents can be accessed
@@ -14,7 +14,7 @@ require 'fileutils'
14
14
 
15
15
  module GEPUB
16
16
  # Book is the class to hold data in EPUB files.
17
- #
17
+ #
18
18
  # It can generate and parse EPUB2/EPUB3 files.
19
19
  #
20
20
  # Book delegates many methods to objects in other class, so you can't find
@@ -74,7 +74,7 @@ module GEPUB
74
74
  # === Book#lastmodified (delegated to Metadata#lastmodified)
75
75
  # returns Meta object contains last modified time.
76
76
  # === setting and reading other metadata: publisher, language, coverage, date, description, format, relation, rights, source, subject, type (delegated to Metadata)
77
- # they all have methods like: publisher(which returns 'main' publisher), add_publisher(content, id) (which add publisher), publisher= (clears and set publisher), and publisher_list(returns publisher Meta object in display-seq order).
77
+ # they all have methods like: publisher(which returns 'main' publisher), add_publisher(content, id) (which add publisher), publisher= (clears and set publisher), and publisher_list(returns publisher Meta object in display-seq order).
78
78
  # === Book#page_progression_direction= (delegated to Spine#page_progression_direction=)
79
79
  # set page-proression-direction attribute to spine.
80
80
 
@@ -123,7 +123,7 @@ module GEPUB
123
123
  @toc = []
124
124
  @landmarks = []
125
125
  if block
126
- block.arity < 1 ? instance_eval(&block) : block[self]
126
+ block.arity < 1 ? instance_eval(&block) : block[self]
127
127
  end
128
128
  end
129
129
 
@@ -142,7 +142,7 @@ module GEPUB
142
142
  io.binmode
143
143
  (@optional_files ||= {})[path] = io.read
144
144
  end
145
-
145
+
146
146
  def set_singleton_methods_to_item(item)
147
147
  toc = @toc
148
148
  metaclass = (class << item;self;end)
@@ -157,11 +157,11 @@ module GEPUB
157
157
  metaclass.send(:define_method, :bindings, Proc.new {
158
158
  bindings
159
159
  })
160
-
160
+
161
161
  end
162
-
163
162
 
164
- # get handler item which defined in bindings for media type,
163
+
164
+ # get handler item which defined in bindings for media type,
165
165
  def get_handler_of(media_type)
166
166
  items[@package.bindings.handler_by_media_type[media_type]]
167
167
  end
@@ -176,8 +176,8 @@ module GEPUB
176
176
  @package.ordered(&block)
177
177
  end
178
178
 
179
- # clenup and maintain consistency of metadata and items included in the Book
180
- # object.
179
+ # cleanup and maintain consistency of metadata and items included in the Book
180
+ # object.
181
181
  def cleanup
182
182
  cleanup_for_epub2
183
183
  cleanup_for_epub3
@@ -191,8 +191,8 @@ module GEPUB
191
191
  mod_time = Zip::DOSTime.local(tm.year, tm.month, tm.day, tm.hour, tm.min, tm.sec)
192
192
  end
193
193
 
194
- mimetype_entry = Zip::Entry.new(nil, 'mimetype', nil, nil, nil, nil, nil, nil, mod_time)
195
- epub.put_next_entry(mimetype_entry, nil, nil, Zip::Entry::STORED)
194
+ mimetype_entry = Zip::Entry.new(nil, 'mimetype', time: mod_time, compression_method: Zip::Entry::STORED)
195
+ epub.put_next_entry(mimetype_entry)
196
196
  epub << "application/epub+zip"
197
197
 
198
198
  entries = {}
@@ -212,7 +212,7 @@ module GEPUB
212
212
 
213
213
  entries.sort_by { |k,_v| k }.each {
214
214
  |k,v|
215
- zip_entry = Zip::Entry.new(nil, k, nil, nil, nil, nil, nil, nil, mod_time)
215
+ zip_entry = Zip::Entry.new(nil, k, time: mod_time)
216
216
  epub.put_next_entry(zip_entry)
217
217
  epub << v.force_encoding('us-ascii')
218
218
  }
@@ -221,9 +221,18 @@ module GEPUB
221
221
  # generates and returns StringIO contains EPUB.
222
222
  def generate_epub_stream
223
223
  cleanup
224
- Zip::OutputStream::write_buffer(StringIO.new) do
225
- |epub|
226
- write_to_epub_container(epub)
224
+ # Save current Zip64 setting and disable it for EPUB compatibility
225
+ original_zip64_support = Zip.write_zip64_support
226
+ Zip.write_zip64_support = false
227
+
228
+ begin
229
+ Zip::OutputStream::write_buffer(StringIO.new) do
230
+ |epub|
231
+ write_to_epub_container(epub)
232
+ end
233
+ ensure
234
+ # Restore original Zip64 setting
235
+ Zip.write_zip64_support = original_zip64_support
227
236
  end
228
237
  end
229
238
 
@@ -231,10 +240,20 @@ module GEPUB
231
240
  def generate_epub(path_to_epub)
232
241
  cleanup
233
242
  File.delete(path_to_epub) if File.exist?(path_to_epub)
234
- Zip::OutputStream::open(path_to_epub) {
235
- |epub|
236
- write_to_epub_container(epub)
237
- }
243
+
244
+ # Save current Zip64 setting and disable it for EPUB compatibility
245
+ original_zip64_support = Zip.write_zip64_support
246
+ Zip.write_zip64_support = false
247
+
248
+ begin
249
+ Zip::OutputStream::open(path_to_epub) {
250
+ |epub|
251
+ write_to_epub_container(epub)
252
+ }
253
+ ensure
254
+ # Restore original Zip64 setting
255
+ Zip.write_zip64_support = original_zip64_support
256
+ end
238
257
  end
239
258
 
240
259
  def container_xml
@@ -249,7 +268,7 @@ EOF
249
268
  end
250
269
 
251
270
 
252
- # add tocdata like this : [ {link: chapter1.xhtml, text: 'Capter 1', level: 1} ] .
271
+ # add tocdata like this : [ {link: chapter1.xhtml, text: 'Chapter 1', level: 1} ] .
253
272
  # if item corresponding to the link does not exists, error will be thrown.
254
273
  def add_tocdata(toc_yaml)
255
274
  newtoc = []
@@ -261,11 +280,11 @@ EOF
261
280
  end
262
281
  @toc = @toc + newtoc
263
282
  end
264
-
283
+
265
284
  def generate_nav_doc(title = 'Table of Contents')
266
285
  add_item('nav.xhtml', id: 'nav', content: StringIO.new(nav_doc(title))).add_property('nav')
267
286
  end
268
-
287
+
269
288
  def nav_doc(title = 'Table of Contents')
270
289
  # handle cascaded toc
271
290
  start_level = @toc && !@toc.empty? && @toc[0][:level] || 1
@@ -285,7 +304,7 @@ EOF
285
304
  current_stack[:tocs].push toc_entry
286
305
  current_stack
287
306
  end
288
- # write toc
307
+ # write toc
289
308
  def write_toc xml_doc, tocs
290
309
  return if tocs.empty?
291
310
  xml_doc.ol {
@@ -348,7 +367,7 @@ EOF
348
367
  |xml|
349
368
  xml.ncx('xmlns' => 'http://www.daisy.org/z3986/2005/ncx/', 'version' => '2005-1') {
350
369
  xml.head {
351
- xml.meta('name' => 'dtb:uid', 'content' => "#{self.identifier}")
370
+ xml.meta('name' => 'dtb:uid', 'content' => "#{self.identifier}")
352
371
  xml.meta('name' => 'dtb:depth', 'content' => '1')
353
372
  xml.meta('name' => 'dtb:totalPageCount','content' => '0')
354
373
  xml.meta('name' => 'dtb:maxPageNumber', 'content' => '0')
@@ -377,9 +396,9 @@ EOF
377
396
  }
378
397
  builder.to_xml(:encoding => 'utf-8')
379
398
  end
380
-
399
+
381
400
  private
382
- def self.parse_container(zip_file, files)
401
+ def self.parse_container(zip_file, files)
383
402
  package_path = nil
384
403
  package = nil
385
404
  zip_file.each do |entry|
@@ -406,15 +425,15 @@ EOF
406
425
 
407
426
  def self.check_consistency_of_package(package, package_path)
408
427
  if package.nil?
409
- raise 'this container do not cotains publication information file'
428
+ raise 'this container do not contains publication information file'
410
429
  end
411
430
 
412
431
  if package_path != package.path
413
- warn "inconsistend EPUB file: container says opf is #{package_path}, but actually #{package.path}"
432
+ warn "inconsistent EPUB file: container says opf is #{package_path}, but actually #{package.path}"
414
433
  end
415
434
  end
416
435
  private_class_method :check_consistency_of_package
417
-
436
+
418
437
  def self.parse_files_into_package(files, package)
419
438
  files.each {
420
439
  |k, content|
@@ -426,7 +445,7 @@ EOF
426
445
  }
427
446
  end
428
447
  private_class_method :parse_files_into_package
429
-
448
+
430
449
  def cleanup_for_epub2
431
450
  if version.to_f < 3.0 || @package.epub_backward_compat
432
451
  if @package.manifest.item_list.select {
@@ -443,14 +462,14 @@ EOF
443
462
  def cleanup_for_epub3
444
463
  if version.to_f >=3.0
445
464
  @package.metadata.modified_now unless @package.metadata.lastmodified_updated?
446
-
465
+
447
466
  if @package.manifest.item_list.select {
448
467
  |_href, item|
449
468
  (item.properties||[]).member? 'nav'
450
469
  }.size == 0
451
470
  generate_nav_doc
452
471
  end
453
-
472
+
454
473
  @package.spine.remove_with_idlist @package.manifest.item_list.map {
455
474
  |_href, item|
456
475
  item.fallback
@@ -462,7 +481,7 @@ EOF
462
481
 
463
482
  def add_item_internal(href, content: nil, item_attributes: , attributes: {}, ordered: )
464
483
  id = item_attributes.delete(:id)
465
- item =
484
+ item =
466
485
  if ordered
467
486
  @package.add_ordered_item(href,attributes: attributes, id:id, content: content)
468
487
  else
@@ -483,27 +502,6 @@ EOF
483
502
  item
484
503
  end
485
504
 
486
- def handle_deprecated_add_item_arguments(deprecated_content, deprecated_id, deprecated_attributes, content, id, attributes)
487
- if deprecated_content
488
- msg = 'deprecated argument; use content keyword argument instead of 2nd argument'
489
- fail msg if content
490
- warn msg
491
- content = deprecated_content
492
- end
493
- if deprecated_id
494
- msg = 'deprecated argument; use id keyword argument instead of 3rd argument'
495
- fail msg if id
496
- warn msg
497
- id = deprecated_id
498
- end
499
- if deprecated_attributes
500
- msg = 'deprecated argument; use argument keyword attributes instead of 4th argument'
501
- fail msg if attributes.size > 0
502
- warn msg
503
- attributes = deprecated_attributes
504
- end
505
- return content, id, attributes
506
- end
507
505
 
508
506
  end
509
507
  end
@@ -4,18 +4,16 @@ module GEPUB
4
4
  class Book
5
5
  # add an item(i.e. html, images, audios, etc) to Book.
6
6
  # the added item will be referenced by the first argument in the EPUB container.
7
- def add_item(href, deprecated_content = nil, deprecated_id = nil, deprecated_attributes = nil, content: nil,
7
+ def add_item(href, content: nil,
8
8
  id: nil,media_type: nil,fallback: nil,properties: nil,media_overlay: nil,toc_text: nil,property: nil,
9
9
  attributes: {})
10
- content, id, attributes = handle_deprecated_add_item_arguments(deprecated_content, deprecated_id, deprecated_attributes, content, id, attributes)
11
10
  add_item_internal(href, content: content, item_attributes: { id: id,media_type: media_type,fallback: fallback,properties: properties,media_overlay: media_overlay,toc_text: toc_text,property: property }, attributes: attributes, ordered: false)
12
11
  end
13
12
 
14
13
  # same as add_item, but the item will be added to spine of the EPUB.
15
- def add_ordered_item(href, deprecated_content = nil, deprecated_id = nil, deprecated_attributes = nil, content:nil,
14
+ def add_ordered_item(href, content:nil,
16
15
  id: nil,media_type: nil,fallback: nil,properties: nil,media_overlay: nil,toc_text: nil,property: nil,
17
16
  attributes: {})
18
- content, id, attributes = handle_deprecated_add_item_arguments(deprecated_content, deprecated_id, deprecated_attributes, content, id, attributes)
19
17
  add_item_internal(href, content: content, item_attributes: { id: id,media_type: media_type,fallback: fallback,properties: properties,media_overlay: media_overlay,toc_text: toc_text,property: property }, attributes: attributes, ordered: true)
20
18
  end
21
19
  end
data/lib/gepub/builder.rb CHANGED
@@ -5,7 +5,7 @@ module GEPUB
5
5
  #
6
6
  # * Builder is obsolete on v0.7 and after. We will continue to support GEPUB::Builder works fine on version 1.x, but Builder will not be updated any more. For example, landmarks are not supported with Builder.
7
7
  #
8
- # = Synopsys
8
+ # = Synopsis
9
9
  # # -*- coding: utf-8 -*-
10
10
  # # GEPUB::Builder example.
11
11
  # require 'ruby gem'
@@ -63,7 +63,7 @@ module GEPUB
63
63
  # glob 'img/*.jpg' # means files(Dir.glob('img/*.jpg'))
64
64
  #
65
65
  # # Reads from file. will be placed at path indicated by key.
66
- # files('img/image.jpg' => 'imgage.jpg')
66
+ # files('img/image.jpg' => 'image.jpg')
67
67
  #
68
68
  # # Read from IO object.
69
69
  # files('img/image.png' => supplied_io, 'img/image2.png' => supplied_io2)
@@ -8,7 +8,7 @@ module GEPUB
8
8
  if !(@last_defined_item[0].apply_one_to_multi ||
9
9
  @last_defined_item.size != 1) &&
10
10
  @last_defined_item.size != args.size
11
- warn "appling #{args} to #{@last_defined_item}: length differs."
11
+ warn "applying #{args} to #{@last_defined_item}: length differs."
12
12
  end
13
13
 
14
14
  @last_defined_item.each_with_index {
@@ -164,11 +164,7 @@ module GEPUB
164
164
  identifier
165
165
  end
166
166
 
167
- def add_date(date, deprecated_id = nil, id: nil)
168
- if deprecated_id
169
- warn "secound argument is deprecated. use id: keyword argument"
170
- id = deprecated_id
171
- end
167
+ def add_date(date, id: nil)
172
168
  add_metadata('date', date, id: id, itemclass: DateMeta)
173
169
  end
174
170
 
@@ -14,16 +14,12 @@ module GEPUB
14
14
 
15
15
  next if node == 'title'
16
16
 
17
- define_method(node, ->(content=UNASSIGNED, deprecated_id=nil, id:nil,
17
+ define_method(node, ->(content=UNASSIGNED, id:nil,
18
18
  title_type: nil,identifier_type: nil,display_seq: nil,file_as: nil,group_position: nil,role: nil,
19
19
  lang: nil, alternates: {}) {
20
20
  if unassigned?(content)
21
21
  get_first_node(node)
22
22
  else
23
- if deprecated_id
24
- warn "secound argument is deprecated. use id: keyword argument"
25
- id = deprecated_id
26
- end
27
23
  send(node + "_clear")
28
24
  add_metadata(node, content, id: id, title_type: title_type,identifier_type: identifier_type,display_seq: display_seq,file_as: file_as,group_position: group_position,role: role, lang: lang, alternates: alternates)
29
25
  end
@@ -48,17 +44,9 @@ module GEPUB
48
44
  }
49
45
  }
50
46
 
51
- def add_title(content, deprecated_id = nil, deprecated_title_type = nil, id: nil,
47
+ def add_title(content, id: nil,
52
48
  title_type: nil,identifier_type: nil,display_seq: nil,file_as: nil,group_position: nil,role: nil,
53
49
  lang: nil, alternates: {})
54
- if deprecated_id
55
- warn 'second argument for add_title is deprecated. use id: instead'
56
- id = deprecated_id
57
- end
58
- if deprecated_title_type
59
- warn 'third argument for add_title is deprecated. use title_type: instead'
60
- title_type = deprecated_title_type
61
- end
62
50
  meta = add_metadata('title', content, id: id,
63
51
  title_type: title_type,identifier_type: identifier_type,display_seq: display_seq,file_as: file_as,group_position: group_position,role: role,
64
52
  lang: lang, alternates: alternates)
@@ -66,17 +54,9 @@ module GEPUB
66
54
  meta
67
55
  end
68
56
 
69
- def add_person(name, content, deprecated_id = nil, deprecated_role = nil, id: nil,
57
+ def add_person(name, content, id: nil,
70
58
  title_type: nil,identifier_type: nil,display_seq: nil,file_as: nil,group_position: nil,role: nil,
71
59
  lang: nil, alternates: {})
72
- if deprecated_id
73
- warn 'second argument for add_person is deprecated. use id: instead'
74
- id = deprecated_id
75
- end
76
- if deprecated_role
77
- warn 'third argument for add_person is deprecated. use role: instead'
78
- role = deprecated_role
79
- end
80
60
  meta = add_metadata(name, content, id: id,
81
61
  title_type: title_type,identifier_type: identifier_type,display_seq: display_seq,file_as: file_as,group_position: group_position,role: role,
82
62
  lang: lang, alternates: alternates)
@@ -84,17 +64,9 @@ module GEPUB
84
64
  meta
85
65
  end
86
66
 
87
- def add_creator(content, deprecated_id = nil, deprecated_role = nil, id: nil,
67
+ def add_creator(content, id: nil,
88
68
  title_type: nil,identifier_type: nil,display_seq: nil,file_as: nil,group_position: nil,role: nil,
89
69
  lang: nil, alternates: {})
90
- if deprecated_id
91
- warn 'second argument for add_creator is deprecated. use id: instead'
92
- id = deprecated_id
93
- end
94
- if deprecated_role
95
- warn 'third argument for add_creator is deprecated. use role: instead'
96
- role = deprecated_role
97
- end
98
70
  role = 'aut' if role.nil?
99
71
  meta = add_person('creator', content, id: id,
100
72
  title_type: title_type,identifier_type: identifier_type,display_seq: display_seq,file_as: file_as,group_position: group_position,role: role,
@@ -103,17 +75,9 @@ module GEPUB
103
75
  meta
104
76
  end
105
77
 
106
- def add_contributor(content, deprecated_id = nil, deprecated_role = nil, id: nil,
78
+ def add_contributor(content, id: nil,
107
79
  title_type: nil,identifier_type: nil,display_seq: nil,file_as: nil,group_position: nil,role: nil,
108
80
  lang: nil, alternates: {})
109
- if deprecated_id
110
- warn 'second argument for add_contributor is deprecated. use id: instead'
111
- id = deprecated_id
112
- end
113
- if deprecated_role
114
- warn 'third argument for add_contributor is deprecated. use role: instead'
115
- role = deprecated_role
116
- end
117
81
  meta = add_person('contributor', content, id: id,
118
82
  title_type: title_type,identifier_type: identifier_type,display_seq: display_seq,file_as: file_as,group_position: group_position,role: role,
119
83
  lang: lang, alternates: alternates)
data/lib/gepub/package.rb CHANGED
@@ -216,7 +216,7 @@ module GEPUB
216
216
  end
217
217
 
218
218
  def set_version(val)
219
- warn 'set_version is obsolete: use verion instead.'
219
+ warn 'set_version is obsolete: use version instead.'
220
220
  @attributes['version'] = val
221
221
  @metadata.opf_version = val
222
222
  @manifest.opf_version = val
data/lib/gepub/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module GEPUB
2
2
  # GEPUB gem version
3
- VERSION = "1.0.17"
3
+ VERSION = "2.0.0"
4
4
  end
data/lib/gepub.rb CHANGED
@@ -1,6 +1,3 @@
1
- def ruby2_keywords(*)
2
- end if RUBY_VERSION < "2.7" && !(defined? ruby2_keywords)
3
-
4
1
  require 'gepub/version'
5
2
  require 'gepub/dsl_util'
6
3
  require 'gepub/xml_util'
@@ -16,18 +16,16 @@ module GEPUB
16
16
  class Book
17
17
  # add an item(i.e. html, images, audios, etc) to Book.
18
18
  # the added item will be referenced by the first argument in the EPUB container.
19
- def add_item(href, deprecated_content = nil, deprecated_id = nil, deprecated_attributes = nil, content: nil,
19
+ def add_item(href, content: nil,
20
20
  #{attrs_arguments_string},
21
21
  attributes: {})
22
- content, id, attributes = handle_deprecated_add_item_arguments(deprecated_content, deprecated_id, deprecated_attributes, content, id, attributes)
23
22
  add_item_internal(href, content: content, item_attributes: #{attrs_internal_string}, attributes: attributes, ordered: false)
24
23
  end
25
24
 
26
25
  # same as add_item, but the item will be added to spine of the EPUB.
27
- def add_ordered_item(href, deprecated_content = nil, deprecated_id = nil, deprecated_attributes = nil, content:nil,
26
+ def add_ordered_item(href, content:nil,
28
27
  #{attrs_arguments_string},
29
28
  attributes: {})
30
- content, id, attributes = handle_deprecated_add_item_arguments(deprecated_content, deprecated_id, deprecated_attributes, content, id, attributes)
31
29
  add_item_internal(href, content: content, item_attributes: #{attrs_internal_string}, attributes: attributes, ordered: true)
32
30
  end
33
31
  end
@@ -65,16 +63,12 @@ module GEPUB
65
63
 
66
64
  next if node == 'title'
67
65
 
68
- define_method(node, ->(content=UNASSIGNED, deprecated_id=nil, id:nil,
66
+ define_method(node, ->(content=UNASSIGNED, id:nil,
69
67
  #{refiners_arguments_string},
70
68
  #{meta_attr_arguments_string}) {
71
69
  if unassigned?(content)
72
70
  get_first_node(node)
73
71
  else
74
- if deprecated_id
75
- warn "secound argument is deprecated. use id: keyword argument"
76
- id = deprecated_id
77
- end
78
72
  send(node + "_clear")
79
73
  add_metadata(node, content, id: id, #{refiners_arguments_set_string}, #{meta_attr_arguments_set_string})
80
74
  end
@@ -99,17 +93,9 @@ module GEPUB
99
93
  }
100
94
  }
101
95
 
102
- def add_title(content, deprecated_id = nil, deprecated_title_type = nil, id: nil,
96
+ def add_title(content, id: nil,
103
97
  #{refiners_arguments_string},
104
98
  #{meta_attr_arguments_string})
105
- if deprecated_id
106
- warn 'second argument for add_title is deprecated. use id: instead'
107
- id = deprecated_id
108
- end
109
- if deprecated_title_type
110
- warn 'third argument for add_title is deprecated. use title_type: instead'
111
- title_type = deprecated_title_type
112
- end
113
99
  meta = add_metadata('title', content, id: id,
114
100
  #{refiners_arguments_set_string},
115
101
  #{meta_attr_arguments_set_string})
@@ -117,17 +103,9 @@ module GEPUB
117
103
  meta
118
104
  end
119
105
 
120
- def add_person(name, content, deprecated_id = nil, deprecated_role = nil, id: nil,
106
+ def add_person(name, content, id: nil,
121
107
  #{refiners_arguments_string},
122
108
  #{meta_attr_arguments_string})
123
- if deprecated_id
124
- warn 'second argument for add_person is deprecated. use id: instead'
125
- id = deprecated_id
126
- end
127
- if deprecated_role
128
- warn 'third argument for add_person is deprecated. use role: instead'
129
- role = deprecated_role
130
- end
131
109
  meta = add_metadata(name, content, id: id,
132
110
  #{refiners_arguments_set_string},
133
111
  #{meta_attr_arguments_set_string})
@@ -135,17 +113,9 @@ module GEPUB
135
113
  meta
136
114
  end
137
115
 
138
- def add_creator(content, deprecated_id = nil, deprecated_role = nil, id: nil,
116
+ def add_creator(content, id: nil,
139
117
  #{refiners_arguments_string},
140
118
  #{meta_attr_arguments_string})
141
- if deprecated_id
142
- warn 'second argument for add_creator is deprecated. use id: instead'
143
- id = deprecated_id
144
- end
145
- if deprecated_role
146
- warn 'third argument for add_creator is deprecated. use role: instead'
147
- role = deprecated_role
148
- end
149
119
  role = 'aut' if role.nil?
150
120
  meta = add_person('creator', content, id: id,
151
121
  #{refiners_arguments_set_string},
@@ -154,17 +124,9 @@ module GEPUB
154
124
  meta
155
125
  end
156
126
 
157
- def add_contributor(content, deprecated_id = nil, deprecated_role = nil, id: nil,
127
+ def add_contributor(content, id: nil,
158
128
  #{refiners_arguments_string},
159
129
  #{meta_attr_arguments_string})
160
- if deprecated_id
161
- warn 'second argument for add_contributor is deprecated. use id: instead'
162
- id = deprecated_id
163
- end
164
- if deprecated_role
165
- warn 'third argument for add_contributor is deprecated. use role: instead'
166
- role = deprecated_role
167
- end
168
130
  meta = add_person('contributor', content, id: id,
169
131
  #{refiners_arguments_set_string},
170
132
  #{meta_attr_arguments_set_string})
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOJIMA Satoshi
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-15 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: nokogiri
@@ -34,22 +33,22 @@ dependencies:
34
33
  name: rubyzip
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
- - - ">"
36
+ - - ">="
38
37
  - !ruby/object:Gem::Version
39
- version: 1.1.1
38
+ version: '3.0'
40
39
  - - "<"
41
40
  - !ruby/object:Gem::Version
42
- version: '2.4'
41
+ version: '3.1'
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
46
45
  requirements:
47
- - - ">"
46
+ - - ">="
48
47
  - !ruby/object:Gem::Version
49
- version: 1.1.1
48
+ version: '3.0'
50
49
  - - "<"
51
50
  - !ruby/object:Gem::Version
52
- version: '2.4'
51
+ version: '3.1'
53
52
  - !ruby/object:Gem::Dependency
54
53
  name: epubcheck-ruby
55
54
  requirement: !ruby/object:Gem::Requirement
@@ -119,9 +118,11 @@ files:
119
118
  - ".gitattributes"
120
119
  - ".github/FUNDING.yml"
121
120
  - ".github/dependabot.yml"
121
+ - ".github/workflows/dependabot-auto-merge.yml"
122
122
  - ".github/workflows/gempush.yml"
123
123
  - ".github/workflows/test.yml"
124
124
  - ".gitignore"
125
+ - ".rspec"
125
126
  - ".rubocop.yml"
126
127
  - Gemfile
127
128
  - LICENSE.txt
@@ -163,7 +164,6 @@ homepage: http://github.com/skoji/gepub
163
164
  licenses:
164
165
  - BSD-3-Clause
165
166
  metadata: {}
166
- post_install_message:
167
167
  rdoc_options: []
168
168
  require_paths:
169
169
  - lib
@@ -171,15 +171,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - ">="
173
173
  - !ruby/object:Gem::Version
174
- version: '0'
174
+ version: '3.2'
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - ">="
178
178
  - !ruby/object:Gem::Version
179
179
  version: '0'
180
180
  requirements: []
181
- rubygems_version: 3.3.26
182
- signing_key:
181
+ rubygems_version: 3.6.9
183
182
  specification_version: 4
184
183
  summary: a generic EPUB library for Ruby.
185
184
  test_files: []