class SiSU_XHTML_EPUB2_Seg::Output
Public Class Methods
new(md,outputfile,per,type='')
click to toggle source
# File lib/sisu/xhtml_epub2_segments.rb, line 61 def initialize(md,outputfile,per,type='') @md, @output_epub_cont_seg,@per,@type= md,outputfile, per, type end
Public Instance Methods
output()
click to toggle source
# File lib/sisu/xhtml_epub2_segments.rb, line 65 def output if @per.title =~/\S/ filename_seg=[] filename_seg \ << @per.title \ << @per.nav if @type=='endnotes' @per.headings=[] #watch txt_obj={ txt: 'Endnotes', ocn_display: ''} format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @per.headings \ << format_seg.title_heading1 filename_seg \ << @per.heading_endnotes \ << @per.headings \ << %{\n<div class="content">\n} \ << @per.endnote_all \ << '</div>' elsif @type=='idx' @per.headings=[] txt_obj={ txt: 'Index', ocn_display: ''} format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @per.headings << format_seg.title_heading1 filename_seg \ << @per.heading_idx \ << @per.headings \ << %{\n<div class="content">\n} \ << @per.idx \ << '</div>' elsif @type=='metadata' metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata @per.headings=[] txt_obj={ txt: 'Metadata', ocn_display: ''} format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @per.headings \ << format_seg.title_heading1 filename_seg \ << @per.heading_idx \ << @per.headings \ << %{\n<div class="content">\n} \ << metadata \ << '</div>' elsif @type=='sisu_manifest' env=SiSU_Env::InfoEnv.new(@md.fns) path_and_name,url_and_name= \ "#{env.path.output}/#{@md.fnb}/sisu_manifest.html", "#{env.url.root}/#{@md.fnb}/sisu_manifest.html" manifest=if FileTest.file?("#{path_and_name}")==true <<WOK <p>A list of available output types may be available at the following url:</p> <p><a href="#{url_and_name}">#{url_and_name}</a></p> WOK else '' end @per.headings=[] txt_obj={ txt: 'Manifest', ocn_display: ''} format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @per.headings \ << format_seg.title_heading1 filename_seg \ << @per.heading_idx \ << @per.headings \ << %{\n<div class="content">\n} \ << manifest \ << '</div>' else filename_seg \ << @per.headings \ << @per.main \ << "\n</div>\n" end filename_seg \ << @per.tail \ << @per.nav \ << @per.closed filename_seg=filename_seg.flatten.compact #watch filename_seg.each do |str| unless str =~/\A\s*\Z/ @output_epub_cont_seg \ << str.strip end end @output_epub_cont_seg.close end end