Class: SiSU_XHTML_EPUB2::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/xhtml_epub2.rb

Defined Under Namespace

Classes: Endnotes, Output, ScrollHeadAndSegToc, Seg, Table, Toc, XHTML_Environment

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ Source

Returns a new instance of Source.



78
79
80
81
# File 'lib/sisu/xhtml_epub2.rb', line 78

def initialize(opt)
  @opt=opt
  @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end

Instance Method Details

#readObject



82
83
84
85
86
87
88
# File 'lib/sisu/xhtml_epub2.rb', line 82

def read
  begin
    songsheet
  ensure
    Dir.chdir(@opt.f_pth[:pth])
  end
end

#songsheetObject



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
150
151
152
153
# File 'lib/sisu/xhtml_epub2.rb', line 89

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