Class: SiSU_TeX::Source

Inherits:
Object
  • Object
show all
Includes:
SiSU_AO, SiSU_Env, SiSU_TeX
Defined in:
lib/sisu/texpdf.rb

Defined Under Namespace

Classes: LaTeXcreate, LaTeXtoPdf

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ Source

Returns a new instance of Source.



90
91
92
93
94
95
# File 'lib/sisu/texpdf.rb', line 90

def initialize(opt)
  @opt=opt
  @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
  @md=@particulars.md
  @env=SiSU_Env::InfoEnv.new(@md.fns) #@[email protected]
end

Instance Method Details

#directoriesObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/sisu/texpdf.rb', line 96

def directories
  begin
    case @opt.fns
    when /\.(?:-|ssm\.)?sst$/
      SiSU_Env::FileOp.new(@md).mkdir
      Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex)
    end
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end

#readObject



110
111
112
113
114
115
116
# File 'lib/sisu/texpdf.rb', line 110

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

#songObject



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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/sisu/texpdf.rb', line 117

def song
  begin
    @md=@particulars.md
    SiSU_Screen::Ansi.new(
      @opt.act[:color_state][:set],
      'LaTeX/PDF',
      "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
    ).green_title_hi unless @opt.act[:quiet][:set]==:on
    if (@opt.act[:verbose][:set]==:on \
    || @opt.act[:verbose_plus][:set]==:on \
    || @opt.act[:maintenance][:set]==:on)
      @env.url.output_tell
      if @md.opt.act[:pdf_l][:set]==:on
        SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          @opt.fns,
          "#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf"
        ).flow
      end
      if @md.opt.act[:pdf_p][:set]==:on
        SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          @opt.fns,
          "#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf"
        ).flow
      end
    end
    @md=@particulars.md
    $flag=@md.opt.selections.str                                                          #introduced to pass 0 for no object citation numbers... to texpdf_format
    directories
                                                                           #% needed needs to be reprogrammed !!!
    ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
    SiSU_TeX::Source::LaTeXcreate.new(@particulars).songsheet
    ao_array=''
    pwd=Dir.pwd
    SiSU_TeX::Source::LaTeXtoPdf.new(@md,@particulars.env).latexrun_selective
    Dir.chdir(pwd)
  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.tex}/#{@opt.fns}*"]
      texfiles.each do |f|
        if FileTest.file?(f)
          File.unlink(f)
        end
      end
    end
    @tex_file=@@tex_footnote_array=[]
    @@column_instruct=''
    @@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
    @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
    @@tex_col_w=[]
    @@n=@@tableheader=@@rights=nil
    @@date=SiSU_Env::InfoDate.new
    @@flag={}
    $flag=1 #remove at some stage
    SiSU_Env::Clear.new(@opt.selections.str,@opt.fns).param_instantiate
  end
end