Class: SiSU_HTML::Source::Output

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

Instance Method Summary collapse

Constructor Details

#initialize(data = '', md = '') ⇒ Output

Returns a new instance of Output.



712
713
714
715
716
# File 'lib/sisu/html.rb', line 712

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

Instance Method Details

#scrollObject



717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/sisu/html.rb', line 717

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

#segtocObject



741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# File 'lib/sisu/html.rb', line 741

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