From 532c0301d456758990609bdf65b718ce2f1f32ca Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Aug 2011 00:06:18 -0400 Subject: v3: epub, constants, experiment with presentation * disable some internal "features" * make file and directory naming more flexible, now using 'OEBPS', 'toc.ncx', 'content.opf', * adjustment of some headers and general tuning * add opf guide * clean processing directory between each build * constants, added constants Ep (for epub) * constants, added DISABLE (used here with epub) --- lib/sisu/v3/epub_format.rb | 117 +++++++++++++++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 31 deletions(-) (limited to 'lib/sisu/v3/epub_format.rb') diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 2a9af20e..6afae58b 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1310,12 +1310,14 @@ 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 epb.opf + #epub_metadata.opf content.opf < - + - + WOK @@ -1335,6 +1337,9 @@ WOK end def open < + WOK end @@ -1353,11 +1358,13 @@ WOK < - - - - - + #{@md.title.full} by #{@md.author} + + + + + + WOK end def head_close @@ -1385,31 +1392,40 @@ WOK WOK end def navmap_sisu_toc(no) + id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ + ? '' \ + : "-#{no}" < + Table of Contents - + WOK end def navpoint(dob,no) + id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ + ? '' \ + : "-#{no}" < + #{dob.obj} - + WOK end def navpoint_top3(dob,no,name) + id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ + ? '' \ + : "-#{no}" < + #{dob.obj} - + WOK end def navpoint_close @@ -1433,6 +1449,8 @@ WOK manifest_close spine_open spine_close + guide_open + guide_close package_close end def package_open @@ -1563,12 +1581,16 @@ WOK %{\n #{rights}} else '' end + f=SiSU_Env::SiSU_file.new(@md) < + #{@md.title.full} #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} - ... - urn:uuid:#{@md.dgst[1]} + #{f.output_path.epub.url}/#{f.base_filename.epub} + urn:uuid:#{@md.dgst[1]} + WOK end @@ -1576,20 +1598,20 @@ WOK < - + - + WOK end def manifest_content_sisu_toc < + WOK end def manifest_content(dob) < + WOK end def manifest_images(imgs) @@ -1598,7 +1620,7 @@ WOK imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] images<<< + WOK end images=images.join('') @@ -1610,24 +1632,45 @@ WOK WOK end def spine_open - #spine: reading order of HTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). + #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). < WOK end def spine_sisu_toc < + WOK end def spine(dob) < + WOK end def spine_close < +WOK + end + def guide_open + #guide: presentation order of XHTML files by reader). + < +WOK + end + def guide_sisu_toc + < +WOK + end + def guide(dob) + < +WOK + end + def guide_close + < WOK end self @@ -1705,13 +1748,17 @@ WOK firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ - %{

#{firstseg}

} + DISABLE[:epub][:internal_navigation] \ + ? '' \ + : %{

#{firstseg}

} end def seg_head_navigation_band_bottom firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ - %{

#{firstseg}

} + DISABLE[:epub][:internal_navigation] \ + ? '' \ + : %{

#{firstseg}

} end def manifest_link(text) #watch fix removed font size 2 %{ #{text}} @@ -1888,7 +1935,9 @@ WOK #{@vz.epub_png_nav_nxt} } if f_nxt==true - %{

+ DISABLE[:epub][:internal_navigation] \ + ? '' \ + : %{

#{pre} #{toc} #{nxt} @@ -2215,13 +2264,19 @@ WOK } end def title_heading1 - title_heading('h1','tiny') + id_u=DISABLE[:epub][:per_section_title] \ + ? '' \ + : title_heading('h1','tiny') end def title_heading2 - title_heading('h2','tiny') + id_u=DISABLE[:epub][:per_section_title] \ + ? '' \ + : title_heading('h2','tiny') end def title_heading3 - title_heading('h3','tiny') + id_u=DISABLE[:epub][:per_section_title] \ + ? '' \ + : title_heading('h3','tiny') end def title_heading4 '' -- cgit v1.2.3