Class: Tex2Rtf

Inherits:
CLApp show all
Includes:
FileUtils
Defined in:
lib/rakeutils/tex2rtf.rb

Overview

Implements programmatic control of the Tex2Rtf application.

Constant Summary collapse

APP_PATH =
"M:/Tex2RTF/tex2rtf.exe"

Instance Method Summary collapse

Methods inherited from CLApp

#execute, #normalize_dir_path, #quote_all_values, #quote_value, #rubyize_path, #windowize_path

Constructor Details

#initializeTex2Rtf

Constructor



26
27
28
# File 'lib/rakeutils/tex2rtf.rb', line 26

def initialize()
    super( APP_PATH )   # Call parent constructor.
end

Instance Method Details

#generateHelpFiles(srcPath, destPath) ⇒ Object

Generate help files.

srcPath

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

destPath

Destination file. Path must use forward slashes.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rakeutils/tex2rtf.rb', line 34

def generateHelpFiles(srcPath, destPath)
    srcDir = File.dirname( File.expand_path( srcPath ) )
    srcFile = File.basename( srcPath )
    destPath = File.expand_path( destPath )
    destDir = File.dirname( destPath )
    
    puts "srcDir: #{srcDir}"
    puts "srcPath: #{srcPath}"
    puts "destDir: #{destDir}"
    puts "destPath: #{destPath}"
    
    if( !File.exists?( destDir ) )          # Create the destination dir if it doesn't exits.
        File.makedirs( destDir, true )
    end
    
    cmdLine = "#{srcFile} #{destPath} -checkcurleybraces -checksyntax -html"

    curDir = pwd
    cd( srcDir )
        begin
            execute( cmdLine, false )
        rescue
            # do nothing
        end
    cd( curDir )
end