Class: SiSU_XHTML_EPUB2_Seg::Output
- Inherits:
-
Object
- Object
- SiSU_XHTML_EPUB2_Seg::Output
- Defined in:
- lib/sisu/xhtml_epub2_segments.rb
Instance Method Summary collapse
-
#initialize(md, outputfile, per, type = '') ⇒ Output
constructor
A new instance of Output.
- #output ⇒ Object
Constructor Details
#initialize(md, outputfile, per, type = '') ⇒ Output
Returns a new instance of Output.
61 62 63 64 |
# 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 |
Instance Method Details
#output ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# 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' =SiSU_Metadata::Summary.new(@md).xhtml_display. @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} \ << \ << '</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 |