class Tex2Rtf

Implements programmatic control of the Tex2Rtf application.

Public Class Methods

new() click to toggle source

Constructor

Calls superclass method CLApp::new
# File lib/rakeutils/tex2rtf.rb, line 25
def initialize()
  super( find_app )
end

Public Instance Methods

find_app() click to toggle source
# File lib/rakeutils/tex2rtf.rb, line 29
def find_app
  if Ktutils::OS.windows?
    app_home = ENV["TEX2RTF_HOME"]
    unless app_home.nil? or app_home.empty?
      app_path = File.join(app_home, "tex2rtf.exe")
    end
  else
    raise "cannot use tex2rtf on linux based systems"
  end
end
generate_help_files(src_path, dest_path) click to toggle source

Generate help files.

src_path

Source file [.tex]. Path must use forward slashes.

dest_path

Destination file. Path must use forward slashes.

# File lib/rakeutils/tex2rtf.rb, line 43
def generate_help_files(src_path, dest_path)
  src_dir = File.dirname( File.expand_path( src_path ) )
  src_file = File.basename( src_path )
  dest_path = File.expand_path( dest_path )
  dest_dir = File.dirname( dest_path )

  puts "src_dir: #{src_dir}"
  puts "src_path: #{src_path}"
  puts "dest_dir: #{dest_dir}"
  puts "dest_path: #{dest_path}"

  # Create the destination dir if it doesn't exits.
  if( !File.exists?( dest_dir ) )
    File.makedirs( dest_dir, true )
  end

  cmd_line = "#{src_file} #{dest_path} -checkcurleybraces -checksyntax -html"

  cur_dir = pwd
  cd( src_dir )
    begin
      execute( cmd_line, false )
    rescue
      # do nothing
    end
  cd( cur_dir )
end