aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/epub_format.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-02-20 19:18:56 -0500
committerRalph Amissah <ralph@amissah.com>2013-02-20 22:19:09 -0500
commit9b67ec9247d8322ede2bb47405862fd0ce6de375 (patch)
tree15b1c37ace164124f8b829d8e3c33abb8595c69a /lib/sisu/v4/epub_format.rb
parentb_epub.png, epub icon (for manifest) updated to use official image (diff)
v4 (v3): epub, tinkering with headers & cleaning of angle brackets '<' & '>'
Diffstat (limited to 'lib/sisu/v4/epub_format.rb')
-rw-r--r--lib/sisu/v4/epub_format.rb22
1 files changed, 12 insertions, 10 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(/&nbsp;/,' ') if Ep[:alt]==:on
x.gsub(/&/,'&amp;').
- gsub(/</,'&lt;').gsub(/>/,'&gt;').
+ gsub(/</,"&lt;").gsub(/>/,"&gt;").
+ gsub(/#{Dx[:url_o]}/,Dx[:url_o_xml]).gsub(/#{Dx[:url_c]}/,Dx[:url_o_xml]).
#gsub(/</,'&#60;').gsub(/>/,'&#62;').
gsub(/\\\\/,'<br />').
gsub(/&lt;br(?: \/)?&gt;/,'<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>