aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/epub_format.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v4/epub_format.rb')
-rw-r--r--lib/sisu/v4/epub_format.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb
index 2889c7b1..98fc385d 100644
--- a/lib/sisu/v4/epub_format.rb
+++ b/lib/sisu/v4/epub_format.rb
@@ -1445,6 +1445,12 @@ WOK
WOK
end
def metadata #metadata dc
+ cover_image=if defined? @md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ %{\n <meta name="cover" content="cover_image" />}
+ else ''
+ end
author=if defined? @md.creator.author \
and @md.creator.author =~/\S+/
m=''
@@ -1567,7 +1573,7 @@ WOK
xmlns:opf="http://www.idpf.org/2007/opf"
unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0">
<dc:title>#{@md.title.full}</dc:title>
- #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights}
+ #{cover_image}#{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights}
<dc:identifier opf:scheme="URI">#{f.output_path.epub.url}/#{f.base_filename.epub}</dc:identifier>
<dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier>
<!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> -->
@@ -1589,6 +1595,16 @@ WOK
<item id="index" href="index.xhtml" media-type="application/xhtml+xml" />
WOK
end
+ def manifest_cover_image_information(md)
+ cover_image=if defined? md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and md.make.cover_image[:cover] =~/\S+/
+ <<WOK
+ <item id="cover_image_file" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
+WOK
+ else ''
+ end
+ end
def manifest_content(dob,name=nil)
name=name ? name : dob.name
<<WOK
@@ -1600,6 +1616,7 @@ WOK
images=[" <!-- Images -->\n"]
imgs.each do |i|
image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2]
+ type=type.sub(/jpg/,'jpeg')
images<<<<WOK
<item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" />
WOK
@@ -1618,6 +1635,11 @@ WOK
<spine toc="ncx">
WOK
end
+ def spine_cover_image
+ <<WOK
+ <itemref idref="cover_image_file" />
+WOK
+ end
def spine_sisu_toc
<<WOK
<itemref idref="index" linear="yes" />
@@ -1640,6 +1662,11 @@ WOK
<guide>
WOK
end
+ def guide_cover_image
+ <<WOK
+ <reference type="cover" title="Cover of [book title]" href="cover_image#{Sfx[:epub_xhtml]}" />
+WOK
+ end
def guide_sisu_toc
<<WOK
<reference type="index" href="index#{Sfx[:epub_xhtml]}" />