aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/epub.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v4/epub.rb')
-rw-r--r--lib/sisu/v4/epub.rb49
1 files changed, 47 insertions, 2 deletions
diff --git a/lib/sisu/v4/epub.rb b/lib/sisu/v4/epub.rb
index e8430aa5..9ac4b610 100644
--- a/lib/sisu/v4/epub.rb
+++ b/lib/sisu/v4/epub.rb
@@ -208,6 +208,13 @@ module SiSU_EPUB
@@toc[:opf] << @epub.metadata_opf.manifest_open
@@toc[:seg] << %{<div class="content">\n<div class="substance">}
@@toc[:scr] << %{<div class="content">\n<div class="substance">}
+ if defined? @md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ md_opf_a_content << @epub.metadata_opf.manifest_cover_image_information(@md)
+ md_opf_a_spine << @epub.metadata_opf.spine_cover_image
+ md_opf_a_guide << @epub.metadata_opf.guide_cover_image
+ end
md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
if @make.build.toc?
md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
@@ -546,7 +553,8 @@ module SiSU_EPUB
#Segtoc tail added here
segtoc << format_head_toc.xhtml_close
segtoc=segtoc.flatten.compact #watch
- SiSU_EPUB::Source::Output.new(@md,segtoc).segtoc
+ SiSU_EPUB::Source::Output.new(@md).make_cover_image
+ SiSU_EPUB::Source::Output.new(@md,segtoc).make_segtoc
segtoc=[]
@toc[:scr],@toc[:seg]=[],[]
toc_shared
@@ -654,7 +662,44 @@ module SiSU_EPUB
end
end
end
- def segtoc
+ def make_cover_image
+ begin
+ if @md.make.cover_image? \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ filename_xhtml=@make_file.epub.xhtml_cover_image
+ cover_image=<<WOK
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Cover</title>
+ <meta http-equiv="Content-Type" content='text/html; charset=utf-8' />
+ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />
+ <style type="text/css"> img { max-width: 100%; } </style>
+</head>
+<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+ <div class="svg_outer">
+ <div class="svg_inner">
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet">
+ <image width="#{@md.make.cover_image[:w]}" height="#{@md.make.cover_image[:h]}" xlink:href="image/#{@md.make.cover_image[:cover]}" />
+ </svg>
+ </div>
+ </div>
+</body>
+</html>
+WOK
+ filename_xhtml.puts cover_image,"\n"
+ filename_xhtml.close
+ end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ end
+ end
+ def make_segtoc
begin
if @make.build.toc?
filename_xhtml=@make_file.epub.xhtml_index