From 62701442505f35ad9b773c6c52514ba9f1102c56 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Jan 2013 23:39:12 -0500 Subject: v4 v3: epub_format, cosmetic arrangement of code <<-WOK --- lib/sisu/v4/epub_format.rb | 148 ++++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'lib/sisu/v4/epub_format.rb') 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 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 - < @@ -1285,7 +1285,7 @@ WOK media-type="application/oebps-package+xml" /> -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 end def close - < -WOK + WOK end def head_open - < -WOK + WOK end def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] - < #{@md.title.full} by #{@md.author} @@ -1356,67 +1356,67 @@ WOK -WOK + WOK end def head_close - < -WOK + WOK end def doc_title - < #{@md.title.full} -WOK + WOK end def doc_author - < #{@md.author} -WOK + WOK end def navmap_open - < -WOK + WOK end def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" - < Table of Contents -WOK + WOK end def navpoint(dob,no,name=nil) name=name ? name : dob.name id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" - < #{dob.obj} - -WOK + + WOK end def navpoint_close - < -WOK + WOK end def navmap_close - < -WOK + WOK end self end @@ -1434,15 +1434,15 @@ WOK package_close end def package_open - < -WOK + WOK end def package_close - < -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) - < @@ -1578,38 +1578,38 @@ WOK urn:uuid:#{@md.dgst[1]} -WOK + WOK end def manifest_open - < -WOK + WOK end def manifest_content_sisu_toc - < -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 else '' end end def manifest_content(dob,name=nil) name=name ? name : dob.name - < -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 + WOK end images=images.join('') images end def manifest_close - < -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 end def spine_cover_image - < -WOK + WOK end def spine_sisu_toc - < -WOK + WOK end def spine(dob,name=nil) name=name ? name : dob.name - < -WOK + WOK end def spine_close - < -WOK + WOK end def guide_open #guide: presentation order of XHTML files by reader). - < -WOK + WOK end def guide_cover_image - < -WOK + WOK end def guide_sisu_toc - < -WOK + WOK end def guide(dob,name=nil) name=name ? name : dob.name - < -WOK + WOK end def guide_close - < -WOK + WOK end self end -- cgit v1.2.3 From 7cc6d871a955444cb5c265f48d6310319ba08731 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Jan 2013 23:44:10 -0500 Subject: v4 v3: xhtml structure error, fix missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [bug reported by Mikael Böök] * fix of additional detail --- lib/sisu/v4/epub_format.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/sisu/v4/epub_format.rb') diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 14304139..60c40dea 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -1303,11 +1303,12 @@ application/epub+zip #{@vz.color_body}
-
- -

- #{dob.obj} -

+
+ +

+ #{dob.obj} +

+
} -- cgit v1.2.3 From ff824c5c3d36f278e3050b171293e04c22b7356e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Jan 2013 23:48:09 -0500 Subject: v4 v3: epub, epub_format, provide full depth epub table of contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [request Mikael Böök] --- lib/sisu/v4/epub_format.rb | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'lib/sisu/v4/epub_format.rb') diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 60c40dea..84d32000 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -1287,10 +1287,10 @@ application/epub+zip WOK end - def sections(dob,name) - filename="#{name}#{Sfx[:epub_xhtml]}" - dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}" - segfilename="#{dir_epub_cont}/#{filename}" + def sections(dob,fn_base) + name=fn_base + Sfx[:epub_xhtml] + dir_epub_cont=@md.env.processing_path.epub + '/' + Ep[:d_oebps] + segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') output_epub_cont_seg << %{#{doc_type} @@ -1396,8 +1396,9 @@ output_epub_cont_seg.close WOK end - def navpoint(dob,no,name=nil) - name=name ? name : dob.name + def navpoint(dob,no,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" @@ -1593,7 +1594,7 @@ output_epub_cont_seg.close end def manifest_content_sisu_toc <<-WOK - + WOK end def manifest_cover_image_information(md) @@ -1606,10 +1607,11 @@ output_epub_cont_seg.close else '' end end - def manifest_content(dob,name=nil) - name=name ? name : dob.name + def manifest_content(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn <<-WOK - + WOK end def manifest_images(imgs) @@ -1643,11 +1645,12 @@ output_epub_cont_seg.close end def spine_sisu_toc <<-WOK - + WOK end - def spine(dob,name=nil) - name=name ? name : dob.name + def spine(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn <<-WOK WOK @@ -1670,13 +1673,16 @@ output_epub_cont_seg.close end def guide_sisu_toc <<-WOK - + WOK end - def guide(dob,name=nil) + def guide(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn name=name ? name : dob.name + guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) <<-WOK - + WOK end def guide_close -- cgit v1.2.3