epub-rb 0.0.1 → 0.0.3

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: 8ccda14a70e4f430c42002fff5cb37ca178f5b3b13f75b358887a61e5d63abbd
4
- data.tar.gz: b4260a96dac06bf73f4ec4cebb83f15254b6f55a5d3ed2508018ab386c230565
3
+ metadata.gz: 5cc02ed1431c2944acb117ca018ab8d2bb1c071e09566588327d23179af660ba
4
+ data.tar.gz: 3ccd1b6e19ccdd0f5345d6391715a37fcba6cfad413c0180c4b91e91b6f4b9c8
5
5
  SHA512:
6
- metadata.gz: ae836a7ec19859ad2fd7025c2e9c669db336779cb6133dab8ec6a63717d3a60525ca7bd729daeb5dec5887812e523d46d38e558f93a7889f807e239163ff2e6d
7
- data.tar.gz: 142b0f17db9e29429ffe8db8378a8acfb8556785a533b95fb6ecabfbd475489473161a8731c80f4aa3290b63444a8198e2349c4728dd2abc9ad2868b35638c9d
6
+ metadata.gz: 8acdb568bea82dcab90109e6c62dc683249d6dd0e8cb5c852c04be337799fba00e4dc43c89a380e7323d19e767d44029ab6ec5273ef354738312e36c59523f30
7
+ data.tar.gz: 5e33aaf52cca42bda7ef9bad2f4cb8d644169650fc0a67d5ead06e251a307deb9c5de41e59da6b5afbd9179c1cc7340469732e742cae99e80ccf8c0c9ba09265
@@ -19,14 +19,14 @@ jobs:
19
19
  strategy:
20
20
  fail-fast: false
21
21
  matrix:
22
- ruby: ["3.2", "3.3"]
22
+ ruby: ["3.2", "3.3", "3.4"]
23
23
  gemfile:
24
24
  - Gemfile
25
25
 
26
26
  steps:
27
27
  - uses: fnando/epubcheck-action@main
28
28
 
29
- - uses: actions/checkout@v4
29
+ - uses: actions/checkout@v5
30
30
 
31
31
  - uses: actions/cache@v4
32
32
  with:
data/.rubocop.yml CHANGED
@@ -8,6 +8,10 @@ AllCops:
8
8
  Exclude:
9
9
  - vendor/**/*
10
10
  - gemfiles/**/*
11
+
11
12
  Naming/FileName:
12
13
  Exclude:
13
14
  - lib/epub-rb.rb
15
+
16
+ Gemspec/AttributeAssignment:
17
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -11,10 +11,14 @@ Prefix your message with one of the following:
11
11
  - [Security] in case of vulnerabilities.
12
12
  -->
13
13
 
14
+ ## v0.0.2 - Jan 25, 2024
15
+
16
+ - [Changed] Link to single files with just the anchor.
17
+
14
18
  ## v0.0.1 - Jan 25, 2024
15
19
 
16
- - Remove unused dependencies.
17
- - Fix bug with SecureRandom.
20
+ - [Fixed] Remove unused dependencies.
21
+ - [Fixed] Fix bug with SecureRandom.
18
22
 
19
23
  ## v0.0.0 - Jan 25, 2024
20
24
 
data/epub-rb.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_dependency "builder"
39
39
  spec.add_dependency "nokogiri"
40
- spec.add_dependency "rubyzip"
40
+ spec.add_dependency "rubyzip", ">= 3.0.0"
41
41
  spec.add_development_dependency "minitest"
42
42
  spec.add_development_dependency "minitest-utils"
43
43
  spec.add_development_dependency "pry-meta"
@@ -49,6 +49,7 @@ module Epub
49
49
  def self.extract(files, root_dir:)
50
50
  root = Node.new(level: 0, entry: Entry.new(navigation: []))
51
51
  current = root
52
+ single_file = files.size == 1
52
53
 
53
54
  sections = files.map do |file|
54
55
  {
@@ -62,11 +63,13 @@ module Epub
62
63
  title = node.text.strip
63
64
  level = node.name[1].to_i
64
65
 
65
- entry = Entry.new(
66
- title:,
67
- link: "#{section[:path]}##{node.attributes['id']}",
68
- navigation: []
69
- )
66
+ link = if single_file
67
+ "##{node.attributes['id']}"
68
+ else
69
+ "#{section[:path]}##{node.attributes['id']}"
70
+ end
71
+
72
+ entry = Entry.new(title:, link:, navigation: [])
70
73
 
71
74
  if level > current.level
72
75
  current = Node.new(level:, entry:, parent: current)
data/lib/epub/v3.rb CHANGED
@@ -33,7 +33,7 @@ module Epub
33
33
  private def create_epub_file
34
34
  FileUtils.rm_rf(output_path)
35
35
 
36
- Zip::File.open(output_path, Zip::File::CREATE) do |zip|
36
+ Zip::File.open(output_path, create: true) do |zip|
37
37
  # The `mimetype` file must be stored first and it should be
38
38
  # uncompressed.
39
39
  zip.add_stored("mimetype", config.tmpdir.join("mimetype"))
data/lib/epub/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Epub
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epub-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-01-26 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: builder
@@ -44,14 +43,14 @@ dependencies:
44
43
  requirements:
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
47
- version: '0'
46
+ version: 3.0.0
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - ">="
53
52
  - !ruby/object:Gem::Version
54
- version: '0'
53
+ version: 3.0.0
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: minitest
57
56
  requirement: !ruby/object:Gem::Requirement
@@ -193,11 +192,10 @@ metadata:
193
192
  rubygems_mfa_required: 'true'
194
193
  homepage_uri: https://github.com/fnando/epub
195
194
  bug_tracker_uri: https://github.com/fnando/epub/issues
196
- source_code_uri: https://github.com/fnando/epub/tree/v0.0.1
197
- changelog_uri: https://github.com/fnando/epub/tree/v0.0.1/CHANGELOG.md
198
- documentation_uri: https://github.com/fnando/epub/tree/v0.0.1/README.md
199
- license_uri: https://github.com/fnando/epub/tree/v0.0.1/LICENSE.md
200
- post_install_message:
195
+ source_code_uri: https://github.com/fnando/epub/tree/v0.0.3
196
+ changelog_uri: https://github.com/fnando/epub/tree/v0.0.3/CHANGELOG.md
197
+ documentation_uri: https://github.com/fnando/epub/tree/v0.0.3/README.md
198
+ license_uri: https://github.com/fnando/epub/tree/v0.0.3/LICENSE.md
201
199
  rdoc_options: []
202
200
  require_paths:
203
201
  - lib
@@ -212,8 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
210
  - !ruby/object:Gem::Version
213
211
  version: '0'
214
212
  requirements: []
215
- rubygems_version: 3.5.5
216
- signing_key:
213
+ rubygems_version: 3.6.9
217
214
  specification_version: 4
218
215
  summary: Create epub files using Ruby.
219
216
  test_files: []