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 +4 -4
- data/.github/workflows/ruby-tests.yml +2 -2
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +6 -2
- data/epub-rb.gemspec +1 -1
- data/lib/epub/navigation.rb +8 -5
- data/lib/epub/v3.rb +1 -1
- data/lib/epub/version.rb +1 -1
- metadata +9 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc02ed1431c2944acb117ca018ab8d2bb1c071e09566588327d23179af660ba
|
4
|
+
data.tar.gz: 3ccd1b6e19ccdd0f5345d6391715a37fcba6cfad413c0180c4b91e91b6f4b9c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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@
|
29
|
+
- uses: actions/checkout@v5
|
30
30
|
|
31
31
|
- uses: actions/cache@v4
|
32
32
|
with:
|
data/.rubocop.yml
CHANGED
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"
|
data/lib/epub/navigation.rb
CHANGED
@@ -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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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,
|
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
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.
|
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:
|
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:
|
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:
|
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.
|
197
|
-
changelog_uri: https://github.com/fnando/epub/tree/v0.0.
|
198
|
-
documentation_uri: https://github.com/fnando/epub/tree/v0.0.
|
199
|
-
license_uri: https://github.com/fnando/epub/tree/v0.0.
|
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.
|
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: []
|