epub-rb 0.0.1 → 0.0.2
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/CHANGELOG.md +6 -2
- data/lib/epub/navigation.rb +8 -5
- data/lib/epub/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa07b3555f6117e94c9c3db39aad006961306cfddb39c5a3322130c2cafc3c80
|
4
|
+
data.tar.gz: cef09e8cc130d46ea4f2cb5d416bf39cb4560d1d0e2d90b9fe13b07f291f216c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09ab78ec8f631c2ca43ad1a7decd2d365d28d90d0eb41cf8bb1dcfa4ce5889ceb6a79a50060165a752c026399c6c283e8edcfa49ed2cbffee817126aa74a957b'
|
7
|
+
data.tar.gz: edb2edba9b5df2351cbeddaab048ee06804991395260fd5ba4808ee84fad045b832e2756c0a05b3c4c74392e894404111d157318ffef6fa37117d407cb96f209
|
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/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/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
@@ -193,10 +193,10 @@ metadata:
|
|
193
193
|
rubygems_mfa_required: 'true'
|
194
194
|
homepage_uri: https://github.com/fnando/epub
|
195
195
|
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.
|
196
|
+
source_code_uri: https://github.com/fnando/epub/tree/v0.0.2
|
197
|
+
changelog_uri: https://github.com/fnando/epub/tree/v0.0.2/CHANGELOG.md
|
198
|
+
documentation_uri: https://github.com/fnando/epub/tree/v0.0.2/README.md
|
199
|
+
license_uri: https://github.com/fnando/epub/tree/v0.0.2/LICENSE.md
|
200
200
|
post_install_message:
|
201
201
|
rdoc_options: []
|
202
202
|
require_paths:
|