lib/review/epubmaker.rb in review-5.9.0 vs lib/review/epubmaker.rb in review-5.10.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2010-2023 Kenshi Muto and Masayoshi Takahashi
+# Copyright (c) 2010-2024 Kenshi Muto and Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of the GNU LGPL, see the file "COPYING".
@@ -212,16 +212,21 @@
end
when 'text/css'
File.open(File.join(basetmpdir, content.file)) do |f|
f.each_line do |l|
l.scan(/url\((.+?)\)/) do |_m|
- @config['epubmaker']['force_include_images'].push($1.strip)
+ @config['epubmaker']['force_include_images'].push($1.strip.gsub(/\A(['"])(.*)\1\Z/, '\2'))
end
end
end
end
end
+
+ if @config['coverimage']
+ @config['epubmaker']['force_include_images'].push(File.join(@config['imagedir'], @config['coverimage']))
+ end
+
@config['epubmaker']['force_include_images'] = @config['epubmaker']['force_include_images'].compact.sort.uniq
end
def copy_images(resdir, destdir, allow_exts = nil)
return nil unless File.exist?(resdir)
@@ -521,10 +526,10 @@
@producer.contents.push(ReVIEW::EPUBMaker::Content.new(file: sfile))
end
end
def copy_static_file(configname, destdir, destfilename: nil)
- destfilename ||= @config[configname]
+ destfilename ||= File.basename(@config[configname])
unless File.exist?(@config[configname])
error! "#{configname}: #{@config[configname]} is not found."
end
FileUtils.cp(@config[configname],
File.join(destdir, destfilename), preserve: true)