diff options
| author | Ralph Amissah <ralph@amissah.com> | 2011-09-13 19:21:46 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2011-09-13 19:21:46 -0400 | 
| commit | e70f6340ee6c3e294468f15ed72ff69508b8f679 (patch) | |
| tree | 6b7b3885ebe60377b73251a7b3c54e3cbd0378da | |
| parent | v3: image (relative) paths for different sisu output structures (diff) | |
v3: epubsisu_3.0.18sisu-3.0.18
* fix for different output structures, language codes not used
  internally (within epub)
* adjustment to image paths for image copy
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 5 | ||||
| -rw-r--r-- | lib/sisu/v3/epub.rb | 15 | ||||
| -rw-r--r-- | lib/sisu/v3/epub_concordance.rb | 10 | ||||
| -rw-r--r-- | lib/sisu/v3/epub_format.rb | 22 | ||||
| -rw-r--r-- | lib/sisu/v3/epub_segments.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v3/epub_tune.rb | 6 | 
6 files changed, 35 insertions, 27 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 8994fc51..f366a0b5 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -30,6 +30,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.18.orig.tar.xz      * opt.act modifications      * sisupod processing (v2 processing also enabled) +  * epub +    * fix for different output structures, language codes not used +      internally (within epub) +    * adjustment to image paths for image copy +    * correct sisupod references and path to .txz (replace .zip)    * image (relative) paths for different sisu output structures diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 12ec1ce0..c1dcacec 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -338,7 +338,7 @@ module SiSU_EPUB          title=if dob.obj !~/Document Information/; linkname          else            link='metadata' -          %{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}">#{linkname}</a></b>} +          %{<b><a href="#{link}#{Sfx[:epub_xhtml]}">#{linkname}</a></b>}          end          toc={}          txt_obj={ txt: title } @@ -423,13 +423,13 @@ module SiSU_EPUB          linkname,ocn=dob.obj.strip,dob.ocn          p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn          if dob.ln==4 -          seg_link=%{  <a href="#{dob.name}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}"> +          seg_link=%{  <a href="#{dob.name}#{Sfx[:epub_xhtml]}">      #{dob.obj}    </a> }            @@seg_url=dob.name          elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/            seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, -            %{<a href="\\1#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}">} + +            %{<a href="\\1#{Sfx[:epub_xhtml]}">} +              %{\\1 \\2</a> })          end          p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn @@ -451,7 +451,7 @@ module SiSU_EPUB          if ocn \          and ocn !~/#/            p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) -          lnk_n_txt=%{  <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o#{ocn}"> +          lnk_n_txt=%{  <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">      #{linkname}    </a>}            txt_obj={ txt: lnk_n_txt } @@ -472,7 +472,7 @@ module SiSU_EPUB          if ocn \          and ocn !~/#/            p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) -          lnk_n_txt=%{  <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o#{ocn}"> +          lnk_n_txt=%{  <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">    #{linkname}  </a>}            txt_obj={ txt: lnk_n_txt } @@ -660,7 +660,10 @@ module SiSU_EPUB          img_pth=@md.env.path.image_source_include          @md.ec[:image].each do |x|            if FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ -          and FileTest.file?("#{img_pth}/#{x}") +          && FileTest.file?("#{@md.file.output_path.epub.rel_image}/#{x}") +            cp("#{@md.file.output_path.epub.rel_image}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") +          elsif FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ +          && FileTest.file?("#{img_pth}/#{x}")              cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image")            end          end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 687155d2..3a961285 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -185,18 +185,18 @@ WOK      protected        def location_scroll(wordlocation,show)          @wordlocation=wordlocation -        %{<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}\##{@wordlocation}">#{@wordlocation}</a>;  } +        %{<a href="doc#{Sfx[:epub_xhtml]}\##{@wordlocation}">#{@wordlocation}</a>;  }        end        def location_seg(wordlocation,show)          @wordlocation,@show=wordlocation,show -        @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil? +        @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil?          case @wordlocation          when @rxp_t1 -          %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show},  } +          %{[<a href="doc#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show},  }          when @rxp_t2 -          %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show},  } +          %{[<a href="doc#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show},  }          when @rxp_t3 -          %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show},  } +          %{[<a href="doc#{Sfx[:epub_xhtml]}##{@show}">H</a>]#{@show},  }          else %{<a href="#{@word_location_seg}">#{@show}</a>,  }          end        end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 345bee95..42570dd0 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1763,7 +1763,7 @@ WOK  }      end      def seg_head_navigation_band -      firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top"> +      firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top">        #{@vz.epub_png_nav_nxt}      </a>} if @md.firstseg =~/\S+/        DISABLE[:epub][:internal_navigation] \ @@ -1771,7 +1771,7 @@ WOK        : %{<p class="align_right">#{firstseg}</p>}      end      def seg_head_navigation_band_bottom -      firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top"> +      firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top">        #{@vz.epub_png_nav_nxt}      </a>} if @md.firstseg =~/\S+/        DISABLE[:epub][:internal_navigation] \ @@ -1906,17 +1906,17 @@ WOK      def dot_control_pre_next        %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">  <tr><td align="left"> -  <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> +  <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}>      #{@vz.png_nav_dot_pre}    </a>  </td>  <td align="center"> -  <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> +  <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}>      #{@vz.png_nav_dot_toc}    </a>  </td>  <td align="right"> -  <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> +  <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}>      #{@vz.png_nav_dot_nxt}    </a>  #{@vz.table_close}} @@ -1924,12 +1924,12 @@ WOK      def dot_control_pre        %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">  <tr><td align="left"> -  <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> +  <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}>      #{@vz.png_nav_dot_pre}    </a>  </td>  <td align="center"> -  <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> +  <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}>      #{@vz.png_nav_dot_toc}    </a>  </td> @@ -1941,15 +1941,15 @@ WOK      end      def toc_nav(f_pre=false,f_nxt=false,use=1)        pre=nxt='' -      toc=%{<a href="#{@index}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> +      toc=%{<a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}>    #{@vz.epub_png_nav_toc}  </a>  } -      pre=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> +      pre=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}>    #{@vz.epub_png_nav_pre}  </a>  } if f_pre==true -      nxt=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> +      nxt=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}>      #{@vz.epub_png_nav_nxt}    </a>  } if f_nxt==true @@ -2439,7 +2439,7 @@ WOK        fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info        %{    <p class="endnote"> -    #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#{@endnote_part_b} +    #{@endnote_part_a}#{fn}#{Sfx[:epub_xhtml]}#{@endnote_part_b}    </p>  }      end diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 7e4c412e..67d0884c 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -238,7 +238,7 @@ WOK              and dob.ln==4                if tracking != 0                  Seg.new(@md).tail -                segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" +                segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}"                  output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1]                  if dob.is=='heading' \                  or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ @@ -259,7 +259,7 @@ WOK                  heading_art(dob)                  head(dob)                  if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug -                  segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" +                  segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}"                    output_epub_cont_seg=File.new(segfilename,'w')                    Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output                    Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index d691361b..fedef1b3 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -274,11 +274,11 @@ module SiSU_EPUB_Tune              c=m[/"(.+?)"/m,1]              caption=%{<br /><p class="caption">#{c}</p>} if c              png=m.scan(/\S+/)[0] -            image_path='./image' +            image_path=@md.file.output_path.epub.rel_image #image_path=@env.url.images_epub              ins=if u \              and u.strip !~/^image$/ -              %{<a href="#{u}"><img src="#{@env.url.images_epub}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" /></a>#{caption}} -            else %{<img src="#{@env.url.images_epub}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" />#{caption}} +              %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" /></a>#{caption}} +            else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" />#{caption}}              end              word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)            else | 
