ditaa.rb
# override variable (to keep previous version)
override variable (to keep previous version)
override variable ( to keep previous version )
def write
      super_ditaa_write                     
      output_dir = Tags::DitaaBlock::output_dir
      dest_folder = File.join(dest, output_dir)
      FileUtils.mkdir_p(dest_folder) unless File.exists?(dest_folder)
      src_files = []
      Tags::DitaaBlock::generated_files.each do |f|
        src_files << f.path
      end
      pre_files = Dir.glob(File.join(source, output_dir, 'ditaa-*.png'))
      to_remove = pre_files - src_files
      to_remove.each do |f|
        File.unlink f if File.exists?(f)
        d, fn = File.split(f)
        df = File.join(dest, output_dir, fn)
        File.unlink df if File.exists?(df)
      end
    end
def write super_ditaa_write output_dir = Tags :: DitaaBlock :: output_dir dest_folder = File . join ( dest , output_dir ) FileUtils . mkdir_p ( dest_folder ) unless File . exists? ( dest_folder ) src_files = [ ] Tags :: DitaaBlock :: generated_files . each do | f | src_files << f . path end pre_files = Dir . glob ( File . join ( source , output_dir , 'ditaa-*.png' ) ) to_remove = pre_files - src_files to_remove . each do | f | File . unlink f if File . exists? ( f ) d , fn = File . split ( f ) df = File . join ( dest , output_dir , fn ) File . unlink df if File . exists? ( df ) end end
override variable (to keep previous version)
override variable ( to keep previous version )
# calling super # create the destination folder for the rendered images (dest) # get a list of all the generated files # get a list of all the already present files # clean all previously rendered files not rendered in the actual build