diff options
author | Ralph Amissah <ralph@amissah.com> | 2013-02-20 22:30:24 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2013-02-20 22:30:24 -0500 |
commit | 1c33d8106063e96da4750098efce9b8d9f87cc02 (patch) | |
tree | 76f2006cb0385bef8a796e64b25cfaac3e2d6425 /lib/sisu/v4/epub_format.rb | |
parent | debian/changelog (4.0.7-1) (diff) | |
parent | v4 (v3): version & changelog, dates touched (diff) |
Merge tag 'sisu_4.0.8' into debian/sid
SiSU 4.0.8
Diffstat (limited to 'lib/sisu/v4/epub_format.rb')
-rw-r--r-- | lib/sisu/v4/epub_format.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 48408162..98f4d7e4 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -65,30 +65,27 @@ module SiSU_EPUB_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Viz::Defaults.new end def ocn_display make=SiSU_Env::ProcessingSettings.new(@md) if make.build.ocn? ocn_class='ocn' if @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}">#{$ep[:hsp]}</label>}) + @ocn.gsub(/^(\d+|)$/,'') else @ocn.gsub(/^(\d+|)$/, %{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>}) end else ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}">#{$ep[:hsp]}</label>}) + @ocn.gsub(/^(\d+|)$/,'') end end def name %{<a name="#{@ocn}"></a>} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying - %{id="o#{@ocn}"} + (@ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto %{<a href="##{@ocn}">} @@ -1226,7 +1223,8 @@ module SiSU_EPUB_Format if x.is_a?(String) x=x.gsub(/ /,' ') if Ep[:alt]==:on x.gsub(/&/,'&'). - gsub(/</,'<').gsub(/>/,'>'). + gsub(/</,"<").gsub(/>/,">"). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). #gsub(/</,'<').gsub(/>/,'>'). gsub(/\\\\/,'<br />'). gsub(/<br(?: \/)?>/,'<br />') @@ -1244,9 +1242,8 @@ module SiSU_EPUB_Format @css=SiSU_Env::CSS_Stylesheet.new(md) @seg_name_xhtml=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml || []) @seg_name_xhtml_tracker=(SiSU_EPUB::Source::Seg.new.seg_name_xhtml_tracker || []) - @index='index' - @metalink='#metadata' @tocband_scroll,@tocband_segtoc=nil,nil + @index,@metalink='index','#metadata' end def doc_type_xhtml <<-WOK @@ -1573,17 +1570,21 @@ output_epub_cont_seg.close rights=if defined? @md.rights.all \ and @md.rights.all =~/\S+/ rights=SanitizeXML.xml(@md.rights.all) + rights=rights.gsub(/<br\s*\/?>/,' ') %{\n <dc:rights>#{rights}</dc:rights>} else '' end f=SiSU_Env::FileOp.new(@md) <<-WOK - <#{$ep[:o]}metadata xmlns:dc="http://purl.org/dc/elements/1.1/" + <#{$ep[:o]}metadata + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:dc="http://purl.org/dc/elements/1.1/" unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0"> <dc:title>#{@md.title.full}</dc:title> #{cover_image}#{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} - <dc:identifier opf:scheme="URI">#{f.output_path.epub.url}/#{f.base_filename.epub}</dc:identifier> + <dc:identifier opf:scheme="URI">#{f.output_path.epub.url.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier> <dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> --> </#{$ep[:o]}metadata> @@ -1687,7 +1688,7 @@ output_epub_cont_seg.close 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]) + guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) <<-WOK <reference type="text" href="#{guide_name}" /> WOK |