Class: SiSU_SStm_AO_SStm::Source::Output

Inherits:
SiSU_SStm_AO_SStm::Source show all
Includes:
SiSU_Env, SiSU_Param
Defined in:
lib/sisu/src_po4a_sst_ao_sst.rb

Instance Method Summary collapse

Methods inherited from SiSU_SStm_AO_SStm::Source

#process_file, #read_process_src_files, #read_setup, #wrap_width_set

Methods included from SiSU_Response

#answer?, #available_selections_, #query, #response?, #response_short, #response_strict, #selection_options, #selections_available_

Methods included from SiSU_Languages_Selected

#language, #sisu_languages_available, #source_language_selected_str, #translation_languages_available, #translation_languages_selected, #translation_languages_selected_str, #translation_languages_selected_that_are_available, #translation_languages_selected_that_are_available_str

Methods included from SiSU_Object_Munge

#block_, #clean_text, #code_, #extract_endnotes, #footnotes_inline, #footnotes_ref_and_note, #i_ao_o_src_markup_restore, #i_ao_o_strip_markup, #i_src_o_strip_markup, #object_marks, #objects, #src_markup, #textface_marks, #textface_marks_po4a

Constructor Details

#initialize(fn, content, md, process = :complete) ⇒ Output

Returns a new instance of Output.



817
818
819
820
# File 'lib/sisu/src_po4a_sst_ao_sst.rb', line 817

def initialize(fn,content,md,process=:complete)
  @fn,@content,@md,@process=fn,content,md,process
  @file=SiSU_Env::FileOp.new(md,fn)
end

Instance Method Details

#po4aObject

%pot output



821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
# File 'lib/sisu/src_po4a_sst_ao_sst.rb', line 821

def po4a                                                                 #%pot output
  file_pot=@file.write_file.po4a_sst
  #file_pot=(@md.opt.f_pth[:lng] == @md.opt.lng_base) \
  #? @file.write_file.pot
  #: @file.write_file.po
  @sisu=[]
  emptyline=0
  @content.each do |para|                                                # this is a hack
    if para.is_a?(Array) \
    and para.length > 0
      para.each do |line|
        if line
          line=line.gsub(/\s+$/m,'').
            gsub(/^\A[ ]*\Z/m,'')
          if line=~/^\A[ ]*\Z/m
            emptyline+=1
          else emptyline=0
          end
          file_pot.puts line if emptyline < 2                     #remove extra line spaces (fix upstream)
        end
      end
    else file_pot.puts para          #unix plaintext # /^([*=-]|\.){5}/
    end
  end
  file_pot.close
  SiSU_Po4aUtils::PotNumber.new.reset
  #po4a_git
end

#po4a_gitObject

po4a_git



849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
# File 'lib/sisu/src_po4a_sst_ao_sst.rb', line 849

def po4a_git
  unless @md.opt.act[:maintenance][:set]==:on
    require_relative 'git'                           # git.rb
    git=SiSU_Git::Source.new(@md.opt,@process)
    unless FileTest.directory?(@file.output_path.pot_git.dir)
      git.create_file_structure_git
    end
    if @md.opt.f_pth[:lng] == @md.opt.lng_base
      FileUtils::cp(
        @file.place_file.pot.dir,
        @file.output_path.pot_git.dir
      )
    else # naive, work on -->
      FileUtils::cp(
        @file.place_file.po.dir,
        @file.output_path.po_git.dir
      ) #unless FileTest.file?(@file.place_file.po_git.dir)
    end
    git.read
  end
end