summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2007-01-09 20:04:00 +0100
committerHans Hagen <pragma@wxs.nl>2007-01-09 20:04:00 +0100
commit18fb36ed7ca387bd1947a4e811e0f7c3cc0cfde7 (patch)
tree71a122e17a66c53196b9b141289bb0e2e72f158d /scripts
parentdf357eceacf49ab989db1882e5b788a51c6039e1 (diff)
downloadcontext-18fb36ed7ca387bd1947a4e811e0f7c3cc0cfde7.tar.gz
stable 2007.01.09 20:04
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/ruby/base/tex.rb72
-rw-r--r--scripts/context/ruby/ctxtools.rb23
-rw-r--r--scripts/context/ruby/pdftools.rb35
-rw-r--r--scripts/context/ruby/rlxtools.rb5
-rw-r--r--scripts/context/ruby/texexec.rb52
-rw-r--r--scripts/context/ruby/texmfstart.rb2
6 files changed, 124 insertions, 65 deletions
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb
index eee599801..69d5fd750 100644
--- a/scripts/context/ruby/base/tex.rb
+++ b/scripts/context/ruby/base/tex.rb
@@ -67,26 +67,27 @@ class TEX
include Variables
- @@texengines = Hash.new
- @@mpsengines = Hash.new
- @@backends = Hash.new
- @@mappaths = Hash.new
- @@runoptions = Hash.new
- @@texformats = Hash.new
- @@mpsformats = Hash.new
- @@prognames = Hash.new
- @@texmakestr = Hash.new
- @@texprocstr = Hash.new
- @@mpsmakestr = Hash.new
- @@mpsprocstr = Hash.new
-
- @@texmethods = Hash.new
- @@mpsmethods = Hash.new
-
- @@pdftex = 'pdftex' # new default, pdfetex is gone
-
- @@luafiles = "luafiles.tmp"
- @@luatarget = "lua/context"
+ @@texengines = Hash.new
+ @@mpsengines = Hash.new
+ @@backends = Hash.new
+ @@mappaths = Hash.new
+ @@runoptions = Hash.new
+ @@draftoptions = Hash.new
+ @@texformats = Hash.new
+ @@mpsformats = Hash.new
+ @@prognames = Hash.new
+ @@texmakestr = Hash.new
+ @@texprocstr = Hash.new
+ @@mpsmakestr = Hash.new
+ @@mpsprocstr = Hash.new
+
+ @@texmethods = Hash.new
+ @@mpsmethods = Hash.new
+
+ @@pdftex = 'pdftex' # new default, pdfetex is gone
+
+ @@luafiles = "luafiles.tmp"
+ @@luatarget = "lua/context"
ENV['PATH'].split(File::PATH_SEPARATOR).each do |p|
if System.unix? then
@@ -166,16 +167,18 @@ class TEX
'cont-fr','cont-cz','cont-ro','cont-uk'] .each do |f| @@texprocstr[f] = "\\emergencyend" end
# @@runoptions['xetex'] = ['--output-driver \\\"-d 4 -V 5\\\"'] # we need the pos pass
- @@runoptions['xetex'] = ['--8bit -no-pdf'] # from now on we assume (x)dvipdfmx to be used
- @@runoptions['pdfetex'] = ['--8bit ']
- @@runoptions['pdftex'] = ['--8bit '] # pdftex is now pdfetex
- @@runoptions['luatex'] = ['']
- @@runoptions['aleph'] = ['--8bit ']
- @@runoptions['mpost'] = ['--8bit ']
+ @@runoptions['xetex'] = ['--8bit,-no-pdf'] # from now on we assume (x)dvipdfmx to be used
+ @@runoptions['pdfetex'] = ['--8bit']
+ @@runoptions['pdftex'] = ['--8bit'] # pdftex is now pdfetex
+ @@runoptions['luatex'] = ['--file-line-error']
+ @@runoptions['aleph'] = ['--8bit']
+ @@runoptions['mpost'] = ['--8bit']
+
+ @@draftoptions['pdftex'] = ['--draftmode']
@@booleanvars = [
'batchmode', 'nonstopmode', 'fast', 'fastdisabled', 'silentmode', 'final',
- 'paranoid', 'notparanoid', 'nobanner', 'once', 'allpatterns',
+ 'paranoid', 'notparanoid', 'nobanner', 'once', 'allpatterns', 'draft',
'nompmode', 'nomprun', 'automprun', 'combine',
'nomapfiles', 'local',
'arrange', 'noarrange',
@@ -192,7 +195,7 @@ class TEX
'filters', 'usemodules', 'environments', 'separation', 'setuppath',
'arguments', 'input', 'output', 'randomseed', 'modes', 'mode', 'filename',
'ctxfile', 'printformat', 'paperformat', 'paperoffset',
- 'timeout'
+ 'timeout', 'passon'
]
@@standardvars = [
'mainlanguage', 'bodyfont', 'language'
@@ -377,7 +380,18 @@ class TEX
def mpsmethod(format) @@mpsmethods[str] || @@mpsmethods['standard'] end
def runoptions(engine)
- if @@runoptions.key?(engine) then @@runoptions[engine].join(' ') else '' end
+ options = if getvariable('draft') then @@draftoptions[engine] else [] end
+ begin
+ if str = getvariable('passon') then
+ options = [options,str.split(' ')].flatten
+ end
+ rescue
+ end
+ if @@runoptions.key?(engine) then
+ [options,@@runoptions[engine]].flatten.join(' ')
+ else
+ options.join(' ')
+ end
end
# private
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index 275739a72..b306ee5dc 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -897,6 +897,7 @@ class Language
end
def load(filenames=@filenames)
+ found = false
begin
if filenames then
@filenames.each do |fileset|
@@ -907,8 +908,9 @@ class Language
@data += data.gsub(/\%.*$/, '').gsub(/\\message\{.*?\}/, '')
data.gsub!(/(\\patterns|\\hyphenation)\s*\{.*/mo) do '' end
@read += "\n% preamble of file #{fname}\n\n#{data}\n"
- report("file #{fname} is loaded")
@data.gsub!(/^[\s\n]+$/mois, '')
+ report("file #{fname} is loaded")
+ found = true
break # next fileset
end
rescue
@@ -919,6 +921,7 @@ class Language
end
rescue
end
+ return found
end
def valid?
@@ -1184,10 +1187,11 @@ class Language
commandline.report("processing language #{language}")
commandline.report("")
language = Language.new(commandline,language,filenames,encoding)
- language.load
- language.convert
- language.save
- commandline.report("")
+ if language.load then
+ language.convert
+ language.save
+ commandline.report("")
+ end
end
end
@@ -1604,15 +1608,16 @@ class Commands
# ghyphen.readme ghyph31.readme grphyph
@@languagedata['hr' ] = [ 'ec' , ['hrhyph.tex'] ]
@@languagedata['hu' ] = [ 'ec' , ['huhyphn.tex'] ]
- @@languagedata['en' ] = [ 'default' , [['ushyphmax.tex','ushyph.tex','hyphen.tex']] ]
- @@languagedata['us' ] = [ 'default' , [['ushyphmax.tex','ushyph.tex','hyphen.tex']] ]
+ @@languagedata['en' ] = [ 'default' , ['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex'] ]
+ @@languagedata['us' ] = [ 'default' , ['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex'] ]
# inhyph.tex
@@languagedata['is' ] = [ 'ec' , ['ishyph.tex'] ]
@@languagedata['it' ] = [ 'ec' , ['ithyph.tex'] ]
@@languagedata['la' ] = [ 'ec' , ['lahyph.tex'] ]
# mnhyph
@@languagedata['nl' ] = [ 'ec' , ['nehyph96.tex'] ]
- @@languagedata['no' ] = [ 'ec' , ['nohyphbx.tex','nohyph2.tex','nohyph1.tex','nohyph.tex'] ]
+ # @@languagedata['no' ] = [ 'ec' , ['nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex'] ]
+ @@languagedata['no' ] = [ 'ec' , ['asxsx.tex','nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex'] ]
@@languagedata['agr'] = [ 'agr' , [['grahyph4.tex','oldgrhyph.tex']] ] # new, todo
@@languagedata['pl' ] = [ 'ec' , ['plhyph.tex'] ]
@@languagedata['pt' ] = [ 'ec' , ['pthyph.tex'] ]
@@ -1623,7 +1628,7 @@ class Commands
# srhyphc.tex / cyrillic
@@languagedata['sv' ] = [ 'ec' , ['svhyph.tex'] ]
@@languagedata['tr' ] = [ 'ec' , ['tkhyph.tex'] ]
- @@languagedata['uk' ] = [ 'default' , [['ukhyphen.tex','ukhyph.tex']] ]
+ @@languagedata['uk' ] = [ 'default' , [['ukhyphen.tex'],['ukhyph.tex']] ]
# @@languagedata['ru' ] = [ 't2a' , ['ruhyphal.tex'] ] # t2a does not work
@@languagedata['ru' ] = [ 'cyr' , ['ruhyphal.tex'] ]
end
diff --git a/scripts/context/ruby/pdftools.rb b/scripts/context/ruby/pdftools.rb
index 6dfa47374..25e7250b6 100644
--- a/scripts/context/ruby/pdftools.rb
+++ b/scripts/context/ruby/pdftools.rb
@@ -738,6 +738,40 @@ class Commands
end
+ # name type emb sub uni object ID
+ # ------------------------------------ ------------ --- --- --- ---------
+ # EOPLBP+TimesNewRomanPSMT TrueType yes yes no 167 0
+ # Times-Roman TrueType no no no 95 0
+ # EPBAAB+Helvetica Type 1C yes yes yes 108 0
+ # EPBMLE+Helvetica-Oblique Type 1C yes yes yes 111 0
+ # Helvetica TrueType no no no 112 0
+
+ def checkembedded
+ $stderr = $stdout
+ $stdout.flush
+ if @commandline.option('pattern') then
+ # **/*.pdf
+ filenames, n = globfiles(@commandline.option('pattern'),'pdf'), 0
+ else
+ filenames, n = findfiles('pdf'), 0
+ end
+ filenames.sort.each do |file|
+ report("= checking #{File.expand_path(file)}")
+ result = `pdffonts #{file}`.chomp
+ lines = result.split(/\n/)
+ if result =~ /emb\s+sub\s+uni/io then
+ lines.each do |line|
+ report("! #{line}") if line =~ /no\s+(no|yes)\s+(no|yes)/io
+ end
+ else
+ lines.each do |line|
+ report("? #{line}")
+ end
+ end
+ report("")
+ end
+ end
+
def countpages
if @commandline.option('pattern') then
filenames, n = globfiles(@commandline.option('pattern'),'pdf'), 0
@@ -802,6 +836,7 @@ commandline.registeraction('convertimage', 'filename [--retain --subpath]')
commandline.registeraction('downsampleimage', 'filename [--retain --subpath --lowres --normal]')
commandline.registeraction('info', 'filename')
commandline.registeraction('countpages', '[--pattern --threshold]')
+commandline.registeraction('checkembedded', '[--pattern]')
commandline.registeraction('analyzefile' , 'filename')
diff --git a/scripts/context/ruby/rlxtools.rb b/scripts/context/ruby/rlxtools.rb
index 40a45bd51..ea065612f 100644
--- a/scripts/context/ruby/rlxtools.rb
+++ b/scripts/context/ruby/rlxtools.rb
@@ -94,7 +94,8 @@ class Commands
report("processing record #{nofrecords} (#{variables['file'] || 'noname'}: #{variables.size} entries)")
if conversion = variables['conversion'] then
report("testing for conversion #{conversion}")
- if suffix = variables['suffix'].downcase then
+ if suffix = variables['suffix'] then
+ suffix.downcase!
if ! suffix.empty? && variables['file'] && variables['file'] !~ /\.([a-z]+)$/i then
variables['file'] += ".#{suffix}"
end
@@ -103,7 +104,7 @@ class Commands
else
report("conversion #{conversion} for suffix #{suffix}")
end
- pattern = "@name='#{conversion}' and @suffix='#{suffix.downcase}'"
+ pattern = "@name='#{conversion}' and @suffix='#{suffix}'"
if steps = REXML::XPath.first(proc.root,"/rl:manipulators/rl:manipulator[#{pattern}]") then
localsteps = steps.deep_clone
['rl:old','rl:new'].each do |tag|
diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb
index 389a7a6ed..3d504ac9e 100644
--- a/scripts/context/ruby/texexec.rb
+++ b/scripts/context/ruby/texexec.rb
@@ -437,30 +437,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"
diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb
index de4a18d2e..6dd79dc1e 100644
--- a/scripts/context/ruby/texmfstart.rb
+++ b/scripts/context/ruby/texmfstart.rb
@@ -1520,7 +1520,7 @@ def set_applications(page=1)
$applications['perl'] = $applications['pl'] = 'perl'
$applications['ruby'] = $applications['rb'] = 'ruby'
$applications['python'] = $applications['py'] = 'python'
- $applications['lua'] = $applications['lua'] = 'lua'
+ $applications['lua'] = $applications['lua'] = 'luatex --luaonly'
$applications['java'] = $applications['jar'] = 'java'
if $mswindows then