epuber 0.9.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7acd7fcb74da144389521daa83a8fb681015b82d5cc8a1da35de6058d26fec3
4
- data.tar.gz: d61a1ac243fc871f6bf2a114d24936b123ed5a28666057b76fb3fc0da6109265
3
+ metadata.gz: b3174cb09810b6ddea59dce43ac29da5f7297149f660a00dfba002594042283b
4
+ data.tar.gz: 2575207bf19ae9f6541e71e202588ccd22305e4398c37ef012970c504f0f2636
5
5
  SHA512:
6
- metadata.gz: 85a24b75e370556e3a028e0c118b4f4bc36395c4140472ddfde4be4c46fd95549fecf3d18c28d72bf545b13f9850d82394ea509b8a97d9e3f1078f678d28647e
7
- data.tar.gz: 62483b8f634b572336cbede86754baa95d3627ac0c69d4f47e44ca701e57b201b53e0b9568a22fd7d4c3ebee6f345c1b132012be303f0ab73ed4db26d332deb3
6
+ metadata.gz: 16bc52d4b427d57d48b00062a5287c9ac67c1ecc02ecb95a62e641233ff65901aa5c40000829bfc2904692cc2e59d2b68cd3a2b0d20d9505c87ff79ad8a0501f
7
+ data.tar.gz: 1073df008d945fe0877b2de2b007358048f18e519dfc33d8be302418c0f82e3554952c7a3d51d11a6efc05a6d292d0d1f843614f627e0481c5a1c759b9325a38
@@ -49,8 +49,10 @@ module Epuber
49
49
  # resolve links to files, add other linked resources and compute correct path
50
50
  UI.print_step_processing_time('resolving url()') do
51
51
  parser.each_rule_set do |rule_set, _media_types|
52
+ # @type [CssParser::RuleSet::Declarations]
52
53
  declarations = rule_set.instance_eval { @declarations }
53
54
  declarations.each do |property, decl_value|
55
+ # @type [String]
54
56
  value = decl_value.to_s
55
57
  next unless value =~ URL_REGEXP
56
58
 
@@ -70,8 +72,10 @@ module Epuber
70
72
  new_url = SourceFile.resolve_relative_file(destination_path,
71
73
  path,
72
74
  compilation_context.file_resolver,
73
- group: resource_group)
74
- content = content.gsub(value, "url(#{quote}#{new_url}#{quote})")
75
+ group: resource_group,
76
+ location: self)
77
+
78
+ content = content.gsub(value, "url(#{quote}#{new_url}#{quote})") if new_url
75
79
  end
76
80
  end
77
81
  end
@@ -113,7 +113,7 @@ module Epuber
113
113
  end
114
114
  end
115
115
 
116
- def self.resolve_relative_file(destination_path, pattern, file_resolver, group: nil)
116
+ def self.resolve_relative_file(destination_path, pattern, file_resolver, group: nil, location: nil)
117
117
  dirname = File.dirname(destination_path)
118
118
 
119
119
  begin
@@ -127,7 +127,8 @@ module Epuber
127
127
  rescue XHTMLProcessor::UnparseableLinkError,
128
128
  FileFinders::FileNotFoundError,
129
129
  FileFinders::MultipleFilesFoundError => e
130
- UI.warning(e.to_s, location: img)
130
+ UI.warning(e.to_s, location: location)
131
+ return nil
131
132
  end
132
133
  end
133
134
 
@@ -218,6 +218,8 @@ module Epuber
218
218
  end
219
219
  end
220
220
 
221
+ return uri if path == '#'
222
+
221
223
  # skip uri with scheme (links to web pages)
222
224
  return uri unless uri.scheme.nil?
223
225
 
@@ -349,7 +351,8 @@ module Epuber
349
351
  new_path = Compiler::FileTypes::SourceFile.resolve_relative_file(file_path,
350
352
  path,
351
353
  file_resolver,
352
- group: resource_group)
354
+ group: resource_group,
355
+ location: img)
353
356
  img[attribute_name] = new_path if new_path
354
357
  end
355
358
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Epuber
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.3'
5
5
 
6
6
  HOME_URL = 'https://github.com/epuber-io/epuber'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epuber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Kříž
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-19 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -594,7 +594,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
594
594
  - !ruby/object:Gem::Version
595
595
  version: '0'
596
596
  requirements: []
597
- rubygems_version: 3.4.22
597
+ rubygems_version: 3.5.9
598
598
  signing_key:
599
599
  specification_version: 4
600
600
  summary: Epuber is simple tool to compile and pack source files into EPUB format.