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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ccda14a70e4f430c42002fff5cb37ca178f5b3b13f75b358887a61e5d63abbd
4
- data.tar.gz: b4260a96dac06bf73f4ec4cebb83f15254b6f55a5d3ed2508018ab386c230565
3
+ metadata.gz: fa07b3555f6117e94c9c3db39aad006961306cfddb39c5a3322130c2cafc3c80
4
+ data.tar.gz: cef09e8cc130d46ea4f2cb5d416bf39cb4560d1d0e2d90b9fe13b07f291f216c
5
5
  SHA512:
6
- metadata.gz: ae836a7ec19859ad2fd7025c2e9c669db336779cb6133dab8ec6a63717d3a60525ca7bd729daeb5dec5887812e523d46d38e558f93a7889f807e239163ff2e6d
7
- data.tar.gz: 142b0f17db9e29429ffe8db8378a8acfb8556785a533b95fb6ecabfbd475489473161a8731c80f4aa3290b63444a8198e2349c4728dd2abc9ad2868b35638c9d
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
 
@@ -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/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.2"
5
5
  end
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.1
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.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
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: