Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/rtex/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def self.options
:preprocessor => 'latex',
:preprocess => false,
:processor => 'pdflatex',
:postprocessor => 'dvipdfmx',
:postprocess => false,
#
:shell_redirect => nil,
# Temporary Directory
Expand Down Expand Up @@ -83,6 +85,10 @@ def preprocessor #:nodoc:
@preprocessor ||= check_path_for @options[:preprocessor]
end

def postprocessor #:nodoc:
@postprocessor ||= check_path_for @options[:postprocessor]
end

def system_path #:nodoc:
ENV['PATH']
end
Expand All @@ -106,6 +112,7 @@ def process_pdf_from(input, &file_handler)
if generating?
preprocess! if preprocessing?
process!
postprocess! if postprocessing?
verify!
end
if file_handler
Expand All @@ -128,14 +135,28 @@ def preprocess!
end
end

def postprocess!
unless `#{postprocessor} #{dvi_file} #{@options[:shell_redirect]}`
raise GenerationError, "Could not postprocess using #{postprocessor}"
end
end

def preprocessing?
@options[:preprocess]
end

def postprocessing?
@options[:postprocess]
end

def source_file
@source_file ||= file(:tex)
end

def dvi_file
@dvi_file ||= file(:dvi)
end

def log_file
@log_file ||= file(:log)
end
Expand Down