diff options
Diffstat (limited to 'scripts/context/ruby/base')
-rw-r--r-- | scripts/context/ruby/base/pdf.rb | 34 | ||||
-rw-r--r-- | scripts/context/ruby/base/tex.rb | 4 |
2 files changed, 32 insertions, 6 deletions
diff --git a/scripts/context/ruby/base/pdf.rb b/scripts/context/ruby/base/pdf.rb index d8cbf9e05..9f4e9a6c3 100644 --- a/scripts/context/ruby/base/pdf.rb +++ b/scripts/context/ruby/base/pdf.rb @@ -1,14 +1,34 @@ module PDFview - @files = Hash.new + @files = Hash.new + @opencalls = Hash.new + @closecalls = Hash.new + @allcalls = Hash.new + + @method = 'default' # 'xpdf' + + @opencalls['default'] = "pdfopen --file" + @opencalls['xpdf'] = "xpdfopen" + + @closecalls['default'] = "pdfclose --file" + @closecalls['xpdf'] = nil + + @allcalls['default'] = "pdfclose --all" + @allcalls['xpdf'] = nil + + def PDFview.setmethod(method) + @method = method + end def PDFview.open(*list) begin [*list].flatten.each do |file| filename = fullname(file) if FileTest.file?(filename) then - result = `pdfopen --file #{filename} 2>&1` - @files[filename] = true + if @opencalls[@method] then + result = `#{@opencalls[@method]} #{filename} 2>&1` + @files[filename] = true + end end end rescue @@ -20,7 +40,9 @@ module PDFview filename = fullname(file) begin if @files.key?(filename) then - result = `pdfclose --file #{filename} 2>&1` + if @closecalls[@method] then + result = `#{@closecalls[@method]} #{filename} 2>&1` + end else closeall return @@ -33,7 +55,9 @@ module PDFview def PDFview.closeall begin - result = `pdfclose --all 2>&1` + if @allcalls[@method] then + result = `#{@allcalls[@method]} 2>&1` + end rescue end @files.clear diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 25b10efa1..eb7ba657a 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -128,7 +128,7 @@ class TEX 'mpyforce', 'forcempy', 'forcetexutil', 'texutil', 'globalfile', 'autopath', - 'purge', 'purgeall', 'autopdf', 'simplerun', 'verbose', + 'purge', 'purgeall', 'autopdf', 'xpdf', 'simplerun', 'verbose', 'nooptionfile' ] @@stringvars = [ @@ -1195,6 +1195,8 @@ class TEX setvariable('nomprun',true) if orisuffix == 'mpx' # else cylic run + PDFview.setmethod('xpdf') if getvariable('xpdf') + PDFview.closeall if getvariable('autopdf') forcexml = jobsuffix.match(/^(xml|fo|fox|rlg|exa)$/io) # nil or match |