class SiSU_XHTML_EPUB2_Format::HeadInformation
Attributes
md[R]
rdf[R]
Public Class Methods
new(md)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1248 def initialize(md) @md=md # DublinCore 1 - title @css=SiSU_Env::CSS_Stylesheet.new(md) @per=SiSU_XHTML_EPUB2_Persist::Persist.new @per.seg_name_x=SiSU_XHTML_EPUB2::Seg.new.seg_name_x @per.seg_name_x_tracker=SiSU_XHTML_EPUB2::Seg.new.seg_name_x_tracker @tocband_scroll,@tocband_segtoc=nil,nil @index,@metalink='index','#metadata' end
Public Instance Methods
close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1359 def close <<-WOK </ncx> WOK end
doc_title()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1391 def doc_title txt=SanitizeXML.xml(@md.title.full) <<-WOK <docTitle> <text>#{txt}</text> </docTitle> WOK end
doc_type()
click to toggle source
~/epub
|-- META-INF | `-- container.xml # simple, make sure full-path of rootfile points to metadata.opf |-- content | |-- 1.xhtml | |-- 2.xhtml | |-- 3.xhtml | |-- ... .xhtml | |-- concordance.xhtml | |-- css | | `-- xhtml.css | |-- endnotes.xhtml | |-- image | | |-- arrow_next_red.png | | |-- arrow_prev_red.png | | |-- arrow_up_red.png | | `-- bullet_09.png | |-- index.xhtml | |-- meta.xhtml | |-- metadata.xhtml | `-- toc.xhtml |-- metadata.opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) |-- mimetype # application/epub+zip `-- toc.ncx #(i) head (ii) doc title (iii) navmap, list of navigation points (like chapters)
# File lib/sisu/xhtml_epub2_format.rb, line 1290 def doc_type doc_type_xhtml end
doc_type_xhtml()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1258 def doc_type_xhtml <<-WOK <?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml"> WOK end
guide(dob,fn_base,hashtag=nil)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1701 def guide(dob,fn_base,hashtag=nil) 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]) <<-WOK <reference type="text" href="#{guide_name}" /> WOK end
guide_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1710 def guide_close <<-WOK </guide> WOK end
guide_cover_image()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1691 def guide_cover_image <<-WOK <reference type="cover" title="Cover of #{SanitizeXML.xml(@md.title.full)}" href="cover_image#{Sfx[:epub_xhtml]}" /> WOK end
guide_open()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1685 def guide_open #guide: presentation order of XHTML files by reader). <<-WOK <guide> WOK end
guide_sisu_toc()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1696 def guide_sisu_toc <<-WOK <reference type="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" /> WOK end
head()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1369 def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] title=SanitizeXML.xml(@md.title.full) author=SanitizeXML.xml(@md.author) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> <title>#{title} by #{author}</title> <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" /> <meta name="dtb:uid" content="urn:uuid:#{dgst}" /> <!-- <meta name="epub-creator" content="#{@md.publisher}" /> --> <meta name="dtb:depth" content="#{depth}" /> <meta name="dtb:totalPageCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> WOK end
head_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1386 def head_close <<-WOK </head> WOK end
head_open()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1364 def head_open <<-WOK <head> WOK end
manifest_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1652 def manifest_close <<-WOK </manifest> WOK end
manifest_content(dob,fn_base,hashtag=nil)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1632 def manifest_content(dob,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn <<-WOK <item id="#{name}" href="#{name}" media-type="application/xhtml+xml" /> WOK end
manifest_content_sisu_toc()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1617 def manifest_content_sisu_toc <<-WOK <item id="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK end
manifest_cover_image_information(md)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1622 def manifest_cover_image_information(md) if defined? md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ <<-WOK <item id="cover_image#{Sfx[:epub_xhtml]}" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK else '' end end
manifest_images(imgs)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1639 def manifest_images(imgs) imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png'] images=[" <!-- Images -->\n"] imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] type=type.sub(/jpg/,'jpeg') images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> WOK end images=images.join('') images end
manifest_open()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1607 def manifest_open <<-WOK <manifest> <!-- NCX --> <item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" /> <!-- CSS Style Sheets --> <item id="main-css" href="css/xhtml.css" media-type="text/css" /> <!-- Content Documents --> WOK end
metadata()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1476 def metadata #metadata dc cover_image=if defined? @md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and @md.make.cover_image[:cover] =~/\S+/ %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />} else '' end author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ m='' @md.creator.author_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.author.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} else '' end editor=if defined? @md.creator.editor \ and @md.creator.editor =~/\S+/ m='' @md.creator.editor_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.editor.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} else '' end translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' @md.creator.translator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.translator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ m='' @md.creator.illustrator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.illustrator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>} else '' end date_published=if defined? @md.date.published \ and @md.date.published =~/\S+/ x=@md.date.published.dup x=SanitizeXML.xml(x) %{\n <dc:date opf:event="published">#{x}</dc:date>} else '' end subject=if defined? @md.classify.subject \ and @md.classify.subject =~/\S+/ x=@md.classify.subject.dup x=SanitizeXML.xml(x) %{\n <dc:subject>#{x}</dc:subject>} else '' end language=if defined? @md.opt.lng \ and @md.opt.lng =~/\S+/ language=@md.opt.lng.gsub(/<br>/,'<br />') %{\n <dc:language>#{language}</dc:language>} else '' end 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) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <#{$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:#{dgst}" 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.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier> <dc:identifier id="bookid">urn:uuid:#{dgst}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{dgst}</dc:identifier> --> </#{$ep[:o]}metadata> WOK end
metadata_opf()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1452 def metadata_opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) def structure package_open metadata_open metadata_close manifest_open manifest_close spine_open spine_close guide_open guide_close package_close end def package_open <<-WOK <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID"> WOK end def package_close <<-WOK </package> WOK end def metadata #metadata dc cover_image=if defined? @md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and @md.make.cover_image[:cover] =~/\S+/ %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />} else '' end author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ m='' @md.creator.author_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.author.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} else '' end editor=if defined? @md.creator.editor \ and @md.creator.editor =~/\S+/ m='' @md.creator.editor_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.editor.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} else '' end translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' @md.creator.translator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.translator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ m='' @md.creator.illustrator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.illustrator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>} else '' end date_published=if defined? @md.date.published \ and @md.date.published =~/\S+/ x=@md.date.published.dup x=SanitizeXML.xml(x) %{\n <dc:date opf:event="published">#{x}</dc:date>} else '' end subject=if defined? @md.classify.subject \ and @md.classify.subject =~/\S+/ x=@md.classify.subject.dup x=SanitizeXML.xml(x) %{\n <dc:subject>#{x}</dc:subject>} else '' end language=if defined? @md.opt.lng \ and @md.opt.lng =~/\S+/ language=@md.opt.lng.gsub(/<br>/,'<br />') %{\n <dc:language>#{language}</dc:language>} else '' end 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) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <#{$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:#{dgst}" 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.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier> <dc:identifier id="bookid">urn:uuid:#{dgst}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{dgst}</dc:identifier> --> </#{$ep[:o]}metadata> WOK end def manifest_open <<-WOK <manifest> <!-- NCX --> <item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" /> <!-- CSS Style Sheets --> <item id="main-css" href="css/xhtml.css" media-type="text/css" /> <!-- Content Documents --> WOK end def manifest_content_sisu_toc <<-WOK <item id="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK end def manifest_cover_image_information(md) if defined? md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ <<-WOK <item id="cover_image#{Sfx[:epub_xhtml]}" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK else '' end end def manifest_content(dob,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn <<-WOK <item id="#{name}" href="#{name}" media-type="application/xhtml+xml" /> WOK end def manifest_images(imgs) imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png'] images=[" <!-- Images -->\n"] imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] type=type.sub(/jpg/,'jpeg') images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> WOK end images=images.join('') images end def manifest_close <<-WOK </manifest> WOK end def spine_open #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). <<-WOK <spine toc="ncx"> WOK end def spine_cover_image <<-WOK <itemref idref="cover_image#{Sfx[:epub_xhtml]}" /> WOK end def spine_sisu_toc <<-WOK <itemref idref="index#{Sfx[:epub_xhtml]}" linear="yes" /> WOK end def spine(dob,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn <<-WOK <itemref idref="#{name}" linear="yes" /> WOK end def spine_close <<-WOK </spine> WOK end def guide_open #guide: presentation order of XHTML files by reader). <<-WOK <guide> WOK end def guide_cover_image <<-WOK <reference type="cover" title="Cover of #{SanitizeXML.xml(@md.title.full)}" href="cover_image#{Sfx[:epub_xhtml]}" /> WOK end def guide_sisu_toc <<-WOK <reference type="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" /> WOK end def guide(dob,fn_base,hashtag=nil) 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]) <<-WOK <reference type="text" href="#{guide_name}" /> WOK end def guide_close <<-WOK </guide> WOK end self end
metainf_container()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1298 def metainf_container #container.xml file in META-INF directory #simple, make sure full-path of rootfile points to metadata.opf #epub_metadata.opf content.opf <<-WOK <?xml version='1.0' encoding='utf-8'?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> <rootfile full-path="#{Ep[:d_oebps]}/#{Ep[:f_opf]}" media-type="application/oebps-package+xml" /> </rootfiles> </container> WOK end
mimetype()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1293 def mimetype <<-WOK application/epub+zip WOK end
open()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1353 def open <<-WOK <?xml version='1.0' encoding='utf-8'?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> WOK end
package_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1471 def package_close <<-WOK </package> WOK end
package_open()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1465 def package_open <<-WOK <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID"> WOK end
sections(dob,fn_base)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1312 def sections(dob,fn_base) name=fn_base + Sfx[:epub_xhtml] dir_epub_cont=@md.env.processing_path.epub + '/' + Ep[:d_oebps] segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') txt=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') output_epub_cont_seg << %{#{doc_type} <head> <title> #{dob.obj} - #{@md.html_title} </title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> <body lang="#{@md.opt.lng}"> <div class="content"> <div class="substance"> <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> <h1 class="norm" id="o#{dob.ocn}"> #{txt} </h1> </div> </div> </body> </html>} output_epub_cont_seg.close end
spine(dob,fn_base,hashtag=nil)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1673 def spine(dob,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn <<-WOK <itemref idref="#{name}" linear="yes" /> WOK end
spine_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1680 def spine_close <<-WOK </spine> WOK end
spine_cover_image()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1663 def spine_cover_image <<-WOK <itemref idref="cover_image#{Sfx[:epub_xhtml]}" /> WOK end
spine_open()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1657 def spine_open #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). <<-WOK <spine toc="ncx"> WOK end
spine_sisu_toc()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1668 def spine_sisu_toc <<-WOK <itemref idref="index#{Sfx[:epub_xhtml]}" linear="yes" /> WOK end
structure()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1341 def structure open head_open head head_close doc_title doc_author navmap_open #navmap ... navmap_close close end
table_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1717 def table_close %{ </font> #{the_table_close}} end
toc_ncx()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1340 def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map def structure open head_open head head_close doc_title doc_author navmap_open #navmap ... navmap_close close end def open <<-WOK <?xml version='1.0' encoding='utf-8'?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> WOK end def close <<-WOK </ncx> WOK end def head_open <<-WOK <head> WOK end def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] title=SanitizeXML.xml(@md.title.full) author=SanitizeXML.xml(@md.author) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> <title>#{title} by #{author}</title> <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" /> <meta name="dtb:uid" content="urn:uuid:#{dgst}" /> <!-- <meta name="epub-creator" content="#{@md.publisher}" /> --> <meta name="dtb:depth" content="#{depth}" /> <meta name="dtb:totalPageCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> WOK end def head_close <<-WOK </head> WOK end def doc_title txt=SanitizeXML.xml(@md.title.full) <<-WOK <docTitle> <text>#{txt}</text> </docTitle> WOK end def doc_author txt=SanitizeXML.xml(@md.author) <<-WOK <docAuthor> <text>#{txt}</text> </docAuthor> WOK end def navmap_open <<-WOK <navMap> WOK end def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>Table of Contents</text> </navLabel> <content src="index#{Sfx[:epub_xhtml]}" /> </navPoint> WOK end def navpoint(dob,no,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" txt=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') <<-WOK <navPoint class="chapter" id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>#{txt}</text> </navLabel> <content src="#{name}" /> WOK end def navpoint_close <<-WOK </navPoint> WOK end def navmap_close <<-WOK </navMap> WOK end self end
xhtml_close()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1721 def xhtml_close %{#{SiSU_Proj_XHTML::Bits.new.credits_sisu_epub} </body> </html>} end