epuber 0.9.3 → 0.9.4

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: b3174cb09810b6ddea59dce43ac29da5f7297149f660a00dfba002594042283b
4
- data.tar.gz: 2575207bf19ae9f6541e71e202588ccd22305e4398c37ef012970c504f0f2636
3
+ metadata.gz: cdced1dd2ebd0dc9d67e06757560ed5acd26d93303db343b53985b3c7aeebe20
4
+ data.tar.gz: e979d0957ff1a554bc4f29cb4e2bbe6cd0a113a83a42ed46a6e80c8f049e8008
5
5
  SHA512:
6
- metadata.gz: 16bc52d4b427d57d48b00062a5287c9ac67c1ecc02ecb95a62e641233ff65901aa5c40000829bfc2904692cc2e59d2b68cd3a2b0d20d9505c87ff79ad8a0501f
7
- data.tar.gz: 1073df008d945fe0877b2de2b007358048f18e519dfc33d8be302418c0f82e3554952c7a3d51d11a6efc05a6d292d0d1f843614f627e0481c5a1c759b9325a38
6
+ metadata.gz: b2ea5b2448b893e8c1c6cb47d4868cdfcd8e16aefeb54733c880c686107439ba51ec50aa89f0f571b6322998d5fe1d4862d4b8a4e78df003fbe4d1d849ebcbc9
7
+ data.tar.gz: 6492a8277ff6d0179a5fd91e3758cc0edc5ff73faf584237336395a52d151654a7c451085ddde6e40532010b3e6d5f9046a3f058237c7879b6da184141b63877
@@ -36,19 +36,19 @@ module Epuber
36
36
  attr_reader :destination_path
37
37
 
38
38
 
39
- # @return [Array<FileTypes::Abstract>] all files that will be in spine
39
+ # @return [Array<Epuber::Compiler::FileTypes::AbstractFile>] all files that will be in spine
40
40
  #
41
41
  attr_reader :spine_files
42
42
 
43
- # @return [Array<FileTypes::Abstract>] all files that has to be in manifest file (OPF)
43
+ # @return [Array<Epuber::Compiler::FileTypes::AbstractFile>] all files that has to be in manifest file (OPF)
44
44
  #
45
45
  attr_reader :manifest_files
46
46
 
47
- # @return [Array<FileTypes::Abstract>] all files that will be copied to EPUB package
47
+ # @return [Array<Epuber::Compiler::FileTypes::AbstractFile>] all files that will be copied to EPUB package
48
48
  #
49
49
  attr_reader :package_files
50
50
 
51
- # @return [Array<FileTypes::Abstract>] totally all files
51
+ # @return [Array<Epuber::Compiler::FileTypes::AbstractFile>] totally all files
52
52
  #
53
53
  attr_reader :files
54
54
 
@@ -27,9 +27,12 @@ module Epuber
27
27
  # @param [Compiler::CompilationContext] compilation_context
28
28
  #
29
29
  def process(compilation_context)
30
- return if destination_file_up_to_date?
31
-
32
- write_processed(process_css(File.read(abs_source_path), compilation_context))
30
+ if destination_file_up_to_date?
31
+ # HACK: for now, we need to process the file again, because we need to find linked files
32
+ process_css(File.read(final_destination_path), compilation_context)
33
+ else
34
+ write_processed(process_css(File.read(abs_source_path), compilation_context))
35
+ end
33
36
  end
34
37
 
35
38
  # Processes CSS file, resolves all linked files and adds them to file resolver
@@ -36,6 +36,12 @@ module Epuber
36
36
  # do nothing
37
37
  end
38
38
 
39
+ # @return [Set<Symbol>] list of properties
40
+ #
41
+ def properties
42
+ file_request&.properties || super
43
+ end
44
+
39
45
  # Source file does not change from last build
40
46
  # @warning Using only this method can cause not updating files that are different for targets
41
47
  #
@@ -11,7 +11,11 @@ module Epuber
11
11
  # @param [Compiler::CompilationContext] compilation_context
12
12
  #
13
13
  def process(compilation_context)
14
- return if destination_file_up_to_date?
14
+ if destination_file_up_to_date?
15
+ # HACK: for now, we need to process the file again, because we need to find linked files
16
+ process_css(File.read(final_destination_path), compilation_context)
17
+ return
18
+ end
15
19
 
16
20
  Stylus.define('__is_debug', !compilation_context.release_build)
17
21
  Stylus.define('__is_verbose_mode', compilation_context.verbose?)
@@ -126,7 +126,10 @@ module Epuber
126
126
  cover_image = @target.cover_image
127
127
  unless cover_image.nil?
128
128
  cover_image_result = @file_resolver.file_from_request(cover_image)
129
- @xml.meta(name: 'cover', content: create_id_from_path(pretty_path(cover_image_result)))
129
+ if cover_image_result
130
+ @xml.meta(name: 'cover',
131
+ content: create_id_from_path(pretty_path(cover_image_result)))
132
+ end
130
133
  end
131
134
 
132
135
  if epub_version >= 3
@@ -164,8 +167,11 @@ module Epuber
164
167
 
165
168
  properties = file.properties
166
169
  if properties.length.positive? && @target.epub_version >= 3
167
- pretty_properties = properties.to_a.map { |property| PROPERTIES_MAP[property] }.join(' ')
168
- attrs['properties'] = pretty_properties
170
+ formatted = properties.to_a
171
+ .map { |prop| PROPERTIES_MAP[prop] }
172
+ .compact
173
+ .join(' ')
174
+ attrs['properties'] = formatted unless formatted.empty?
169
175
  end
170
176
 
171
177
  @xml.item(attrs)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Epuber
4
- VERSION = '0.9.3'
4
+ VERSION = '0.9.4'
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.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Kříž
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-06 00:00:00.000000000 Z
11
+ date: 2024-05-13 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.5.9
597
+ rubygems_version: 3.5.10
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.