From 95324bdc01bb604582f0bd29bc446329b3ad0f18 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 23 May 2006 16:32:00 +0200 Subject: stable 2006.05.23 16:32 --- scripts/context/ruby/base/tex.rb | 32 ++++++++++++++++++++++++-------- scripts/context/ruby/ctxtools.rb | 2 +- scripts/context/ruby/texexec.rb | 5 ++++- 3 files changed, 29 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 61701e501..dc1362e90 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -8,8 +8,11 @@ # info : j.hagen@xs4all.nl # www : www.pragma-ade.com -# todo: write systemcall for mpost to file so that it can be run -# faster +# todo: +# +# - write systemcall for mpost to file so that it can be run faster +# - use -8bit and -progname +# # report ? @@ -83,6 +86,7 @@ class TEX ['tex','pdftex','pdfetex','standard'] .each do |e| @@texengines[e] = 'pdfetex' end ['aleph','omega'] .each do |e| @@texengines[e] = 'aleph' end ['xetex'] .each do |e| @@texengines[e] = 'xetex' end + ['luatex'] .each do |e| @@texengines[e] = 'luatex' end ['metapost','mpost', 'standard'] .each do |e| @@mpsengines[e] = 'mpost' end @@ -118,7 +122,7 @@ class TEX ['plain','mpost'] .each do |f| @@mpsformats[f] = 'plain' end ['metafun','context','standard'] .each do |f| @@mpsformats[f] = 'metafun' end - ['pdfetex','aleph','omega'] .each do |p| @@prognames[p] = 'context' end + ['pdfetex','aleph','omega','xetex','luatex'] .each do |p| @@prognames[p] = 'context' end ['mpost'] .each do |p| @@prognames[p] = 'metafun' end ['plain','default','standard','mptopdf'] .each do |f| @@texmethods[f] = 'plain' end @@ -138,6 +142,8 @@ class TEX # @@runoptions['xetex'] = ['--output-driver \\\"-d 4 -V 5\\\"'] # we need the pos pass @@runoptions['xetex'] = ['--no-pdf'] # from now on we assume (x)dvipdfmx to be used + @@runoptions['luatex'] = ['--progname=pdftex'] + @@booleanvars = [ 'batchmode', 'nonstopmode', 'fast', 'fastdisabled', 'silentmode', 'final', 'paranoid', 'notparanoid', 'nobanner', 'once', 'allpatterns', @@ -338,7 +344,7 @@ class TEX def prefixed(format,engine) case engine - when /etex|eetex|pdfetex|pdfeetex|pdfxtex|xpdfetex|eomega|aleph|xetex/io then + when /etex|eetex|pdfetex|pdfeetex|pdfxtex|xpdfetex|eomega|aleph|xetex|luatex/io then "*#{format}" else format @@ -730,13 +736,23 @@ class TEX bomdone = true end if str =~ /^\%\s*(.*)/o then - vars = Hash.new + # we only accept lines with key=value pairs + vars, ok = Hash.new, true $1.split(/\s+/o).each do |s| k, v = s.split('=') - vars[k] = v + if k && v then + vars[k] = v + else + ok = false + break + end end - @@preamblekeys.each do |v| - setvariable(v[1],vars[v[0]]) if vars.key?(v[0]) + if ok then + # we have a valid line + @@preamblekeys.each do |v| + setvariable(v[1],vars[v[0]]) if vars.key?(v[0]) && vars[v[0]] + end + break end else break diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index ee967ec31..69c6885b4 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -2373,7 +2373,7 @@ commandline.registeraction('brandfiles' , 'add context copyright notice [ commandline.registeraction('platformize' , 'replace line-endings [--recurse --force] [pattern]') commandline.registeraction('dependencies' , 'analyze depedencies witin context [--compact] [rootfile]') commandline.registeraction('updatecontext' , 'download latest version and remake formats') -commandline.registeraction('disarmutfbom' , 'remove utf bom [==force]') +commandline.registeraction('disarmutfbom' , 'remove utf bom [--force]') commandline.registervalue('type','') diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb index 06e74812d..4194874e9 100644 --- a/scripts/context/ruby/texexec.rb +++ b/scripts/context/ruby/texexec.rb @@ -490,13 +490,15 @@ class Commands job.setvariable('texengine','xetex') elsif @commandline.oneof('aleph') then job.setvariable('texengine','aleph') + elsif @commandline.oneof('luatex') then + job.setvariable('texengine','luatex') else job.setvariable('texengine','standard') end if (str = @commandline.option('backend')) && ! str.standard? && ! str.empty? then job.setvariable('backend',str) - elsif @commandline.oneof('pdfetex','pdftex','pdf') then + elsif @commandline.oneof('pdfetex','pdftex','pdf','luatex') then job.setvariable('backend','pdftex') elsif @commandline.oneof('dvipdfmx','dvipdfm','dpx','dpm') then job.setvariable('backend','dvipdfmx') @@ -511,6 +513,7 @@ class Commands else case job.getvariable('texengine') when 'pdfetex' 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') else -- cgit v1.2.3