aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v3/epub_format.rb134
-rw-r--r--lib/sisu/v4/epub_format.rb148
2 files changed, 141 insertions, 141 deletions
diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb
index 3b0412ba..709351d8 100644
--- a/lib/sisu/v3/epub_format.rb
+++ b/lib/sisu/v3/epub_format.rb
@@ -92,7 +92,7 @@ module SiSU_EPUB_Format
end
class CSS
def css_epub_xhtml
-<<WOK
+ <<-WOK
/* SiSU epub css default stylesheet */
body {
color: black;
@@ -1214,7 +1214,7 @@ module SiSU_EPUB_Format
margin-bottom: 20px;
margin-right: 15mm;
}
-WOK
+ WOK
end
end
class HeadInformation
@@ -1232,17 +1232,17 @@ WOK
@tocband_scroll,@tocband_segtoc=nil,nil
end
def doc_type_xhtml
-<<WOK
+ <<-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">
-WOK
+ WOK
end
=begin
~/epub
|-- META-INF
- | `-- container.xml #✓ simple, make sure full-path of rootfile points to metadata.opf
+ | `-- container.xml # simple, make sure full-path of rootfile points to metadata.opf
|-- content
| |-- 1.xhtml
| |-- 2.xhtml
@@ -1262,21 +1262,21 @@ WOK
| |-- metadata.xhtml
| `-- toc.xhtml
|-- metadata.opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes)
- |-- mimetype #✓ application/epub+zip
- `-- toc.ncx #✓ (i) head (ii) doc title (iii) navmap, list of navigation points (like chapters)
+ |-- mimetype # application/epub+zip
+ `-- toc.ncx #(i) head (ii) doc title (iii) navmap, list of navigation points (like chapters)
=end
def doc_type
doc_type_xhtml
end
def mimetype
- <<WOK
+ <<-WOK
application/epub+zip
-WOK
+ WOK
end
def metainf_container #container.xml file in META-INF directory
#simple, make sure full-path of rootfile points to metadata.opf
#epub_metadata.opf content.opf
- <<WOK
+ <<-WOK
<?xml version='1.0' encoding='utf-8'?>
<container version="1.0"
xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
@@ -1285,7 +1285,7 @@ WOK
media-type="application/oebps-package+xml" />
</rootfiles>
</container>
-WOK
+ WOK
end
def sections(dob,name)
filename="#{name}#{Sfx[:epub_xhtml]}"
@@ -1327,26 +1327,26 @@ output_epub_cont_seg.close
close
end
def open
- <<WOK
+ <<-WOK
<?xml version="1.0"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
-WOK
+ WOK
end
def close
- <<WOK
+ <<-WOK
</ncx>
-WOK
+ WOK
end
def head_open
- <<WOK
+ <<-WOK
<head>
-WOK
+ WOK
end
def head
depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4]
- <<WOK
+ <<-WOK
<!-- four required metadata items (for all NCX documents,
(including the relaxed constraints of OPS 2.0) -->
<title>#{@md.title.full} by #{@md.author}</title>
@@ -1356,67 +1356,67 @@ WOK
<meta name="dtb:depth" content="#{depth}" />
<meta name="dtb:totalPageCount" content="0" />
<meta name="dtb:maxPageNumber" content="0" />
-WOK
+ WOK
end
def head_close
- <<WOK
+ <<-WOK
</head>
-WOK
+ WOK
end
def doc_title
- <<WOK
+ <<-WOK
<docTitle>
<text>#{@md.title.full}</text>
</docTitle>
-WOK
+ WOK
end
def doc_author
- <<WOK
+ <<-WOK
<docAuthor>
<text>#{@md.author}</text>
</docAuthor>
-WOK
+ WOK
end
def navmap_open
- <<WOK
+ <<-WOK
<navMap>
-WOK
+ WOK
end
def navmap_sisu_toc(no)
id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \
? ''
: "-#{no}"
- <<WOK
+ <<-WOK
<navPoint id="navpoint#{id_u}" playOrder="#{no}">
<navLabel>
<text>Table of Contents</text>
</navLabel>
<content src="index#{Sfx[:epub_xhtml]}" />
</navPoint>
-WOK
+ WOK
end
def navpoint(dob,no,name=nil)
name=name ? name : dob.name
id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \
? ''
: "-#{no}"
- <<WOK
+ <<-WOK
<navPoint id="navpoint#{id_u}" playOrder="#{no}">
<navLabel>
<text>#{dob.obj}</text>
</navLabel>
<content src="#{name}#{Sfx[:epub_xhtml]}" />
-WOK
+ WOK
end
def navpoint_close
- <<WOK
+ <<-WOK
</navPoint>
-WOK
+ WOK
end
def navmap_close
- <<WOK
+ <<-WOK
</navMap>
-WOK
+ WOK
end
self
end
@@ -1434,15 +1434,15 @@ WOK
package_close
end
def package_open
- <<WOK
+ <<-WOK
<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0">
-WOK
+ WOK
end
def package_close
- <<WOK
+ <<-WOK
</package>
-WOK
+ WOK
end
def metadata #metadata dc
author=if defined? @md.creator.author \
@@ -1562,7 +1562,7 @@ WOK
else ''
end
f=SiSU_Env::FileOp.new(@md)
- <<WOK
+ <<-WOK
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:opf="http://www.idpf.org/2007/opf"
unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0">
@@ -1572,89 +1572,89 @@ WOK
<dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier>
<!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> -->
</metadata>
-WOK
+ WOK
end
def manifest_open
- <<WOK
+ <<-WOK
<manifest>
<!-- NCX -->
<item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" />
<!-- CSS Style Sheets -->
<item id="main-css" href="css/xhtml.css" media-type="text/css" />
<!-- Content Documents -->
-WOK
+ WOK
end
def manifest_content_sisu_toc
- <<WOK
+ <<-WOK
<item id="index" href="index.xhtml" media-type="application/xhtml+xml" />
-WOK
+ WOK
end
def manifest_content(dob,name=nil)
name=name ? name : dob.name
- <<WOK
+ <<-WOK
<item id="#{name}" href="#{name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
-WOK
+ WOK
end
def manifest_images(imgs)
imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png']
images=[" <!-- Images -->\n"]
imgs.each do |i|
image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2]
- images<<<<WOK
+ images<<<<-WOK
<item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" />
-WOK
+ WOK
end
images=images.join('')
images
end
def manifest_close
- <<WOK
+ <<-WOK
</manifest>
-WOK
+ WOK
end
def spine_open
#spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.).
- <<WOK
+ <<-WOK
<spine toc="ncx">
-WOK
+ WOK
end
def spine_sisu_toc
- <<WOK
+ <<-WOK
<itemref idref="index" linear="yes" />
-WOK
+ WOK
end
def spine(dob,name=nil)
name=name ? name : dob.name
- <<WOK
+ <<-WOK
<itemref idref="#{name}" linear="yes" />
-WOK
+ WOK
end
def spine_close
- <<WOK
+ <<-WOK
</spine>
-WOK
+ WOK
end
def guide_open
#guide: presentation order of XHTML files by reader).
- <<WOK
+ <<-WOK
<guide>
-WOK
+ WOK
end
def guide_sisu_toc
- <<WOK
+ <<-WOK
<reference type="index" href="index#{Sfx[:epub_xhtml]}" />
-WOK
+ WOK
end
def guide(dob,name=nil)
name=name ? name : dob.name
- <<WOK
+ <<-WOK
<reference type="text" href="#{name}#{Sfx[:epub_xhtml]}" />
-WOK
+ WOK
end
def guide_close
- <<WOK
+ <<-WOK
</guide>
-WOK
+ WOK
end
self
end
diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb
index 5a63a6ec..14304139 100644
--- a/lib/sisu/v4/epub_format.rb
+++ b/lib/sisu/v4/epub_format.rb
@@ -92,7 +92,7 @@ module SiSU_EPUB_Format
end
class CSS
def css_epub_xhtml
-<<WOK
+ <<-WOK
/* SiSU epub css default stylesheet */
body {
color: black;
@@ -1214,7 +1214,7 @@ module SiSU_EPUB_Format
margin-bottom: 20px;
margin-right: 15mm;
}
-WOK
+ WOK
end
end
class HeadInformation
@@ -1232,17 +1232,17 @@ WOK
@tocband_scroll,@tocband_segtoc=nil,nil
end
def doc_type_xhtml
-<<WOK
+ <<-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">
-WOK
+ WOK
end
=begin
~/epub
|-- META-INF
- | `-- container.xml #✓ simple, make sure full-path of rootfile points to metadata.opf
+ | `-- container.xml # simple, make sure full-path of rootfile points to metadata.opf
|-- content
| |-- 1.xhtml
| |-- 2.xhtml
@@ -1262,21 +1262,21 @@ WOK
| |-- metadata.xhtml
| `-- toc.xhtml
|-- metadata.opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes)
- |-- mimetype #✓ application/epub+zip
- `-- toc.ncx #✓ (i) head (ii) doc title (iii) navmap, list of navigation points (like chapters)
+ |-- mimetype # application/epub+zip
+ `-- toc.ncx #(i) head (ii) doc title (iii) navmap, list of navigation points (like chapters)
=end
def doc_type
doc_type_xhtml
end
def mimetype
- <<WOK
+ <<-WOK
application/epub+zip
-WOK
+ WOK
end
def metainf_container #container.xml file in META-INF directory
#simple, make sure full-path of rootfile points to metadata.opf
#epub_metadata.opf content.opf
- <<WOK
+ <<-WOK
<?xml version='1.0' encoding='utf-8'?>
<container version="1.0"
xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
@@ -1285,7 +1285,7 @@ WOK
media-type="application/oebps-package+xml" />
</rootfiles>
</container>
-WOK
+ WOK
end
def sections(dob,name)
filename="#{name}#{Sfx[:epub_xhtml]}"
@@ -1327,26 +1327,26 @@ output_epub_cont_seg.close
close
end
def open
- <<WOK
+ <<-WOK
<?xml version="1.0"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
-WOK
+ WOK
end
def close
- <<WOK
+ <<-WOK
</ncx>
-WOK
+ WOK
end
def head_open
- <<WOK
+ <<-WOK
<head>
-WOK
+ WOK
end
def head
depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4]
- <<WOK
+ <<-WOK
<!-- four required metadata items (for all NCX documents,
(including the relaxed constraints of OPS 2.0) -->
<title>#{@md.title.full} by #{@md.author}</title>
@@ -1356,67 +1356,67 @@ WOK
<meta name="dtb:depth" content="#{depth}" />
<meta name="dtb:totalPageCount" content="0" />
<meta name="dtb:maxPageNumber" content="0" />
-WOK
+ WOK
end
def head_close
- <<WOK
+ <<-WOK
</head>
-WOK
+ WOK
end
def doc_title
- <<WOK
+ <<-WOK
<docTitle>
<text>#{@md.title.full}</text>
</docTitle>
-WOK
+ WOK
end
def doc_author
- <<WOK
+ <<-WOK
<docAuthor>
<text>#{@md.author}</text>
</docAuthor>
-WOK
+ WOK
end
def navmap_open
- <<WOK
+ <<-WOK
<navMap>
-WOK
+ WOK
end
def navmap_sisu_toc(no)
id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \
? ''
: "-#{no}"
- <<WOK
+ <<-WOK
<navPoint id="navpoint#{id_u}" playOrder="#{no}">
<navLabel>
<text>Table of Contents</text>
</navLabel>
<content src="index#{Sfx[:epub_xhtml]}" />
</navPoint>
-WOK
+ WOK
end
def navpoint(dob,no,name=nil)
name=name ? name : dob.name
id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \
? ''
: "-#{no}"
- <<WOK
+ <<-WOK
<navPoint id="navpoint#{id_u}" playOrder="#{no}">
<navLabel>
<text>#{dob.obj}</text>
</navLabel>
- <content src="#{name}#{Sfx[:epub_xhtml]}" />
-WOK
+ <content src="#{name}" />
+ WOK
end
def navpoint_close
- <<WOK
+ <<-WOK
</navPoint>
-WOK
+ WOK
end
def navmap_close
- <<WOK
+ <<-WOK
</navMap>
-WOK
+ WOK
end
self
end
@@ -1434,15 +1434,15 @@ WOK
package_close
end
def package_open
- <<WOK
+ <<-WOK
<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0">
-WOK
+ WOK
end
def package_close
- <<WOK
+ <<-WOK
</package>
-WOK
+ WOK
end
def metadata #metadata dc
cover_image=if defined? @md.make.cover_image \
@@ -1568,7 +1568,7 @@ WOK
else ''
end
f=SiSU_Env::FileOp.new(@md)
- <<WOK
+ <<-WOK
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:opf="http://www.idpf.org/2007/opf"
unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0">
@@ -1578,38 +1578,38 @@ WOK
<dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier>
<!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> -->
</metadata>
-WOK
+ WOK
end
def manifest_open
- <<WOK
+ <<-WOK
<manifest>
<!-- NCX -->
<item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" />
<!-- CSS Style Sheets -->
<item id="main-css" href="css/xhtml.css" media-type="text/css" />
<!-- Content Documents -->
-WOK
+ WOK
end
def manifest_content_sisu_toc
- <<WOK
+ <<-WOK
<item id="index" href="index.xhtml" media-type="application/xhtml+xml" />
-WOK
+ 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
+ <<-WOK
<item id="cover_image_file" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
-WOK
+ WOK
else ''
end
end
def manifest_content(dob,name=nil)
name=name ? name : dob.name
- <<WOK
+ <<-WOK
<item id="#{name}" href="#{name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" />
-WOK
+ WOK
end
def manifest_images(imgs)
imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png']
@@ -1617,71 +1617,71 @@ WOK
imgs.each do |i|
image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2]
type=type.sub(/jpg/,'jpeg')
- images<<<<WOK
+ images<<<<-WOK
<item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" />
-WOK
+ WOK
end
images=images.join('')
images
end
def manifest_close
- <<WOK
+ <<-WOK
</manifest>
-WOK
+ WOK
end
def spine_open
#spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.).
- <<WOK
+ <<-WOK
<spine toc="ncx">
-WOK
+ WOK
end
def spine_cover_image
- <<WOK
+ <<-WOK
<itemref idref="cover_image_file" />
-WOK
+ WOK
end
def spine_sisu_toc
- <<WOK
+ <<-WOK
<itemref idref="index" linear="yes" />
-WOK
+ WOK
end
def spine(dob,name=nil)
name=name ? name : dob.name
- <<WOK
+ <<-WOK
<itemref idref="#{name}" linear="yes" />
-WOK
+ WOK
end
def spine_close
- <<WOK
+ <<-WOK
</spine>
-WOK
+ WOK
end
def guide_open
#guide: presentation order of XHTML files by reader).
- <<WOK
+ <<-WOK
<guide>
-WOK
+ WOK
end
def guide_cover_image
- <<WOK
+ <<-WOK
<reference type="cover" title="Cover of [book title]" href="cover_image#{Sfx[:epub_xhtml]}" />
-WOK
+ WOK
end
def guide_sisu_toc
- <<WOK
+ <<-WOK
<reference type="index" href="index#{Sfx[:epub_xhtml]}" />
-WOK
+ WOK
end
def guide(dob,name=nil)
name=name ? name : dob.name
- <<WOK
+ <<-WOK
<reference type="text" href="#{name}#{Sfx[:epub_xhtml]}" />
-WOK
+ WOK
end
def guide_close
- <<WOK
+ <<-WOK
</guide>
-WOK
+ WOK
end
self
end