diff options
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r-- | lib/sisu/v4/epub_format.rb | 22 | ||||
-rw-r--r-- | lib/sisu/v4/epub_tune.rb | 9 |
2 files changed, 18 insertions, 13 deletions
diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index a56ea394..98f4d7e4 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -71,23 +71,21 @@ module SiSU_EPUB_Format 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}">} @@ -1225,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 />') @@ -1243,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 @@ -1572,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> diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb index bce4aed7..fbb42bc4 100644 --- a/lib/sisu/v4/epub_tune.rb +++ b/lib/sisu/v4/epub_tune.rb @@ -123,7 +123,7 @@ module SiSU_EPUB_Tune begin @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/ - data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_html + data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_angle_brackets data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup data=SiSU_EPUB_Tune::Tune.new(data,@md).markup @@ -156,6 +156,7 @@ module SiSU_EPUB_Tune gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,"●#{$ep[:hsp]*2}"). + gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]). gsub(/#{Mx[:nbsp]}/,$ep[:hsp]). gsub(/<(p|br)>/,'<\1 />') dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean @@ -274,10 +275,12 @@ module SiSU_EPUB_Tune @tuned_file << dob end end - def amp_html + def amp_angle_brackets data,data_new=@data,[] data.each do |dob| - dob.obj=dob.obj.gsub(/&/u,'&') + dob.obj=dob.obj. + gsub(/&/u,'&'). + gsub(/</u,'<').gsub(/>/u,'>') data_new << dob end data_new |