summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/ruby/texexec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/texexec.rb')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/texexec.rb88
1 files changed, 47 insertions, 41 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/texexec.rb b/Master/texmf-dist/scripts/context/ruby/texexec.rb
index 389a7a6ed09..f37cfd8c2b0 100644
--- a/Master/texmf-dist/scripts/context/ruby/texexec.rb
+++ b/Master/texmf-dist/scripts/context/ruby/texexec.rb
@@ -36,6 +36,7 @@ class Commands
end
job.makeformats
job.inspect && Kpse.inspect if @commandline.option('verbose')
+ seterror if job.error?
end
end
@@ -60,7 +61,7 @@ class Commands
prepare(job)
job.processtex
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -70,7 +71,7 @@ class Commands
prepare(job)
job.processmptex
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -80,7 +81,7 @@ class Commands
prepare(job)
job.processmpxtex
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -90,7 +91,7 @@ class Commands
prepare(job)
job.processmpgraphic
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -100,7 +101,7 @@ class Commands
prepare(job)
job.processmpstatic
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -216,11 +217,11 @@ class Commands
fnames.each do |ffname|
if msuffixes.include?(File.splitname(ffname)[1]) && FileTest.file?(ffname) then
if mod = File.open(job.tempfilename('tex'),'w') then
-if File.suffix(ffname) =~ /^(mkii|mkiv)$/o then
- markfile = $1
-else
- markfile = nil
-end
+ if File.suffix(ffname) =~ /^(mkii|mkiv)$/o then
+ markfile = $1
+ else
+ markfile = nil
+ end
Kpse.runscript('ctxtools',ffname,'--document')
if ted = File.silentopen(File.suffixed(ffname,'ted')) then
firstline = ted.gets
@@ -244,11 +245,11 @@ end
job.setvariable('simplerun',true)
# job.setvariable('nooptionfile',true)
job.setvariable('files',[job.tempfilename])
-result = File.unsuffixed(File.basename(ffname))
-if markfile then
- result = result+'-'+markfile
-end
-job.setvariable('result',result)
+ result = File.unsuffixed(File.basename(ffname))
+ if markfile then
+ result = result+'-'+markfile
+ end
+ job.setvariable('result',result)
job.processtex
# ["dvi", "pdf","ps"].each do |s|
# File.silentrename(job.tempfilename(s),File.suffixed(ffname,s));
@@ -437,30 +438,34 @@ job.setvariable('result',result)
f << "\\starttext\n"
files.each do |filename|
result = @commandline.checkedoption('result','texexec')
- if (filename !~ /^texexec/io) && (filename !~ /^#{result}/) then
- report("copying file: #{filename}")
- f << "\\getfiguredimensions\n"
- f << " [#{filename}]\n"
- f << " [scale=#{scale},\n"
- f << " page=1,\n"
- f << " size=trimbox\n" if trim
- f << "]\n"
- f << "\\definepapersize\n"
- f << " [copy]\n"
- f << " [width=\\figurewidth,\n"
- f << " height=\\figureheight]\n"
- f << "\\setuppapersize\n"
- f << " [copy][copy]\n"
- f << "\\setuplayout\n"
- f << " [page]\n"
- f << "\\setupexternalfigures\n"
- f << " [directory=]\n"
- f << "\\copypages\n"
- f << " [#{filename}]\n"
- f << " [scale=#{scale},\n"
- f << " marking=on,\n" if @commandline.option('markings')
- f << " size=trimbox,\n" if trim
- f << " offset=#{paperoffset}]\n"
+ begin
+ if (filename !~ /^texexec/io) && (filename !~ /^#{result}/) then
+ report("copying file: #{filename}")
+ f << "\\getfiguredimensions\n"
+ f << " [#{filename}]\n"
+ f << " [scale=#{scale},\n"
+ f << " page=1,\n"
+ f << " size=trimbox\n" if trim
+ f << "]\n"
+ f << "\\definepapersize\n"
+ f << " [copy]\n"
+ f << " [width=\\figurewidth,\n"
+ f << " height=\\figureheight]\n"
+ f << "\\setuppapersize\n"
+ f << " [copy][copy]\n"
+ f << "\\setuplayout\n"
+ f << " [page]\n"
+ f << "\\setupexternalfigures\n"
+ f << " [directory=]\n"
+ f << "\\copypages\n"
+ f << " [#{filename}]\n"
+ f << " [scale=#{scale},\n"
+ f << " marking=on,\n" if @commandline.option('markings')
+ f << " size=trimbox,\n" if trim
+ f << " offset=#{paperoffset}]\n"
+ end
+ rescue
+ report("wrong specification")
end
end
f << "\\stoptext\n"
@@ -568,7 +573,7 @@ job.setvariable('result',result)
if (str = @commandline.option('engine')) && ! str.standard? && ! str.empty? then
job.setvariable('texengine',str)
elsif @commandline.oneof('pdfetex','pdftex','pdf') then
- job.setvariable('texengine','pdfetex')
+ job.setvariable('texengine','pdftex')
elsif @commandline.oneof('xetex','xtx') then
job.setvariable('texengine','xetex')
elsif @commandline.oneof('aleph') then
@@ -596,6 +601,7 @@ job.setvariable('result',result)
else
case job.getvariable('texengine')
when 'pdfetex' then job.setvariable('backend','pdftex')
+ when 'pdftex' then job.setvariable('backend','pdftex')
when 'luatex' then job.setvariable('backend','pdftex')
when 'xetex' then job.setvariable('backend','xetex')
when 'aleph' then job.setvariable('backend','dvipdfmx')
@@ -763,4 +769,4 @@ commandline.registerflag('verbose')
commandline.expand
-Commands.new(commandline,logger,banner).send(commandline.action || 'main')
+Commands.new(commandline,logger,banner).execute(commandline.action || 'main') # or just execute()