class SiSU_Assemble::CompositeFileList

Public Class Methods

new(opt) click to toggle source
# File lib/sisu/ao_composite.rb, line 232
def initialize(opt)
  @opt=opt
  @env=SiSU_Env::InfoEnv.new
end

Public Instance Methods

insertions?(fns_array) click to toggle source
# File lib/sisu/ao_composite.rb, line 248
def insertions?(fns_array)
  tuned_file=[]
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'Composite Document',
    @opt.fno
  ).grey_title_hi unless @opt.act[:quiet][:set]==:on
  @ssm=[@opt.fns]
  fns_array.each do |para|
    if para =~/^<<\s+(\S+?\.ss[it])$/
      loadfilename=$1.strip
      if (@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],
          'loading:',
          loadfilename,
        ).txt_grey
      end
      tuned_file << if loadfilename =~ /(?:https?|file):\/\/\S+?\.ss[it]$/
        @ssm << loadfilename
      elsif loadfilename =~ /\.ss[it]$/ \
      and FileTest.file?(loadfilename)
        @ssm << loadfilename
      else
        STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfilename}"}
        $process_document = :skip; break #remove this line to continue processing documents that have missing include files
        para
      end
    end
  end
  @ssm
end
read() click to toggle source
# File lib/sisu/ao_composite.rb, line 236
def read
  begin
    @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub
    fns_array=IO.readlines(@opt.fns,'')
    insertions?(fns_array)
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end