class SiSU_XHTML_EPUB2::Source

Public Class Methods

new(opt) click to toggle source
# File lib/sisu/xhtml_epub2.rb, line 76
def initialize(opt)
  @opt=opt
  @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end

Public Instance Methods

read() click to toggle source
# File lib/sisu/xhtml_epub2.rb, line 80
def read
  begin
    songsheet
  ensure
    Dir.chdir(@opt.f_pth[:pth])
  end
end
songsheet() click to toggle source
# File lib/sisu/xhtml_epub2.rb, line 87
def songsheet
  begin
    @md=@particulars.md
    @fnb=@md.fnb
    @env=@particulars.env
    unless @opt.act[:quiet][:set]==:on
      tool=(@opt.act[:verbose][:set]==:on \
      || @opt.act[:verbose_plus][:set]==:on \
      || @opt.act[:maintenance][:set]==:on) \
      ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}"
      : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
      (@opt.act[:verbose][:set]==:on \
      || @opt.act[:verbose_plus][:set]==:on \
      || @opt.act[:maintenance][:set]==:on) \
      ? SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          'EPUB',
          tool
        ).green_hi_blue
      : SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          'EPUB',
          tool
        ).green_title_hi
      if (@opt.act[:verbose_plus][:set]==:on \
      || @opt.act[:maintenance][:set]==:on)
        SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          @opt.fns,
          "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}"
        ).flow
      end
    end
    @env.processing_path.epub_bld #(@md)
    @env.processing_path.epub_cp_images(@md)
    data=nil
    SiSU_Env::FileOp.new(@md).mkdir.output.epub
    @tuned_file_array=SiSU_XHTML_EPUB2::Source::XHTML_Environment.new(@particulars).tuned_file_instructions
    data=@tuned_file_array
    per=SiSU_XHTML_EPUB2::Source::Toc.new(@md,data).songsheet
    data=@tuned_file_array
    SiSU_XHTML_EPUB2::Source::ScrollHeadAndSegToc.new(@md,per).in_common #watch
    SiSU_XHTML_EPUB2::Source::Seg.new(@md,data).songsheet
    SiSU_XHTML_EPUB2::Source::Output.new(@md).songsheet
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    unless (@opt.act[:verbose_plus][:set]==:on \
    || @opt.act[:maintenance][:set]==:on)
      texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"]
      texfiles.each do |f|
        if FileTest.file?(f)
          File.unlink(f)
        end
      end
    end
    SiSU_Env::Clear.new(@opt.selections.str,@opt.fns).param_instantiate
    @@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc={},{},{},{},{}
    @@tracker=0
    @@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@tablefoot=Array.new(5){[]}
    @@filename_seg,@@seg_url,@@to_lev4,@@get_hash_to,@@get_hash_fn='','','','',''
  end
end