From 8fe365726f3bb7866a7a9285cb5045c50c39fd67 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 31 Jan 2013 18:36:08 -0500 Subject: v4: epub, constants, debug alternative for various readers ... work on --- lib/sisu/v4/epub_format.rb | 137 ++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 70 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 dd3273d0..d8baae63 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -69,7 +69,7 @@ module SiSU_EPUB_Format ocn_class='ocn' if @ocn.to_i==0 @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) else @ocn.gsub(/^(\d+|)$/, %{}) @@ -77,7 +77,7 @@ module SiSU_EPUB_Format else ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end end def name @@ -1220,6 +1220,7 @@ module SiSU_EPUB_Format module SanitizeXML def self.xml(x) if x.is_a?(String) + x=x.gsub(/ /,' ') if Ep[:alt]==:on x.gsub(/&/,'&'). gsub(//,'>'). #gsub(//,'>'). @@ -1246,8 +1247,6 @@ module SiSU_EPUB_Format def doc_type_xhtml <<-WOK - WOK end @@ -1305,25 +1304,25 @@ application/epub+zip segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') output_epub_cont_seg << %{#{doc_type} - - - #{dob.obj} - - #{@md.html_title} - - -#{@css.xhtml_epub} - -#{@vz.color_body} -
-
- -

- #{dob.obj} -

-
-
- -} + + + #{dob.obj} - + #{@md.html_title} + + + #{@css.xhtml_epub} + + #{@vz.color_body} +
+
+ +

+ #{dob.obj} +

+
+
+ + } output_epub_cont_seg.close end def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map @@ -1341,9 +1340,7 @@ output_epub_cont_seg.close end def open <<-WOK - - + WOK end @@ -1404,12 +1401,12 @@ output_epub_cont_seg.close ? '' : "-#{no}" <<-WOK - - - Table of Contents - - - + + + Table of Contents + + + WOK end def navpoint(dob,no,fn_base,hashtag=nil) @@ -1419,16 +1416,16 @@ output_epub_cont_seg.close ? '' : "-#{no}" <<-WOK - - - #{dob.obj} - - + + + #{dob.obj} + + WOK end def navpoint_close <<-WOK - + WOK end def navmap_close @@ -1454,7 +1451,7 @@ output_epub_cont_seg.close def package_open <<-WOK - + WOK end def package_close @@ -1466,7 +1463,7 @@ output_epub_cont_seg.close cover_image=if defined? @md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and @md.make.cover_image[:cover] =~/\S+/ - %{\n } + %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />} else '' end author=if defined? @md.creator.author \ @@ -1577,7 +1574,7 @@ output_epub_cont_seg.close end f=SiSU_Env::FileOp.new(@md) <<-WOK - #{@md.title.full} @@ -1585,7 +1582,7 @@ output_epub_cont_seg.close #{f.output_path.epub.url}/#{f.base_filename.epub} urn:uuid:#{@md.dgst[1]} - + WOK end def manifest_open @@ -1608,7 +1605,7 @@ output_epub_cont_seg.close and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ <<-WOK - + WOK else '' end @@ -1646,7 +1643,7 @@ output_epub_cont_seg.close end def spine_cover_image <<-WOK - + WOK end def spine_sisu_toc @@ -1674,7 +1671,7 @@ output_epub_cont_seg.close end def guide_cover_image <<-WOK - + WOK end def guide_sisu_toc @@ -1727,20 +1724,20 @@ output_epub_cont_seg.close end def head %{#{doc_type} - - -#{@css.xhtml_epub} - -#{@vz.color_body}} + + + #{@css.xhtml_epub} + + #{@vz.color_body}} end def concordance if @md.concord_make %{#{@vz.margin_css} -

- - Concordance - -

+

+ + Concordance + +

#{@vz.table_close}} else %{#{@vz.margin_css} @@ -1807,15 +1804,15 @@ output_epub_cont_seg.close end def head %{#{doc_type} - - - #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - - #{@md.html_title} - - -#{@css.xhtml_epub} - -#{@vz.color_body}} + + + #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - + #{@md.html_title} + + + #{@css.xhtml_epub} + + #{@vz.color_body}} end def endnote_mark %{ @@ -1833,7 +1830,7 @@ output_epub_cont_seg.close Owner Details -     + #{$ep[:hsp]*3} @@ -1914,7 +1911,7 @@ output_epub_cont_seg.close def no_paranum %{
- +

#{@txt}

@@ -2059,7 +2056,7 @@ output_epub_cont_seg.close #{@txt}

#{@vz.margin_num_css} -     + #{$ep[:hsp]*3} #{@vz.table_close}} end def bold_heading #unused @@ -2069,7 +2066,7 @@ output_epub_cont_seg.close #{@txt}

#{@vz.margin_num_css} -     + #{$ep[:hsp]*3} #{@vz.table_close}} end def toc_head_copy_at @@ -2123,8 +2120,8 @@ output_epub_cont_seg.close note=$1 note=note.gsub(/[\n\s]+/m,' ') txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). - gsub(/ \d+<\/sup> /m,''). - gsub(/#{Mx[:nbsp]}\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove + gsub(/#{$ep[:hsp]}\d+<\/sup>#{$ep[:hsp]}/m,''). + gsub(/#{$ep[:hsp]}\d+<\/sup>#{$ep[:hsp]}/m,'') #remove end %{<#{tag} class="#{attrib}"> #{txt} #{note} -- cgit v1.2.3