class SiSU_HTML::Source::Output

Public Class Methods

new(data='',md='') click to toggle source
# File lib/sisu/html.rb, line 710
def initialize(data='',md='')
  @data,@md=data,md
  @file=SiSU_Env::FileOp.new(md)
  @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
end

Public Instance Methods

scroll() click to toggle source
# File lib/sisu/html.rb, line 715
def scroll
  if @md.opt.act[:html_scroll][:set]==:on
    begin
      @filename_html_scroll=@file.write_file.html_scroll
      @data.each do |para|
        para=para.strip.
          gsub(/<:.+?>/,'').
          gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2).
          gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1).
         #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll).
          gsub(/#{Rx[:mx_fa_clean]}/,'')
        unless para =~/\A\s*\Z/
          @filename_html_scroll.puts para,"\n"
        end
      end
    rescue
      SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
        __LINE__.to_s + ':' + __FILE__
      end
    ensure
      @filename_html_scroll.close
    end
  end
end
segtoc() click to toggle source
# File lib/sisu/html.rb, line 739
def segtoc
  if @md.opt.act[:html_seg][:set]==:on
    begin
      @filename_html_segtoc=@file.write_file.html_segtoc
      @data.each do |para|
        para=para.strip.
          gsub(/<!.+?!>/,'').
          gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2).
          gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1)
        unless para =~/\A\s*\Z/
          @filename_html_segtoc.puts para,"\n"
        end
      end
    rescue
      SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
        __LINE__.to_s + ':' + __FILE__
      end
    ensure
      @filename_html_segtoc.close
      pwd_set=Dir.pwd
      idx_lnk=(@o_str.dump_or_redirect?) \
      ? @file.base_filename.manifest
      : @file.base_filename.html_segtoc
      mlnk=@file.base_filename.html_seg_index
      Dir.chdir(@file.output_path.html_seg.dir)
      FileUtils::rm_f(mlnk)
      FileUtils::ln_s(idx_lnk,mlnk)
      Dir.chdir(pwd_set)
    end
  end
end