diff options
Diffstat (limited to 'scripts/context/ruby')
-rw-r--r-- | scripts/context/ruby/base/tex.rb | 67 | ||||
-rw-r--r-- | scripts/context/ruby/ctxtools.rb | 35 | ||||
-rw-r--r-- | scripts/context/ruby/texmfstart.rb | 8 |
3 files changed, 75 insertions, 35 deletions
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 582ff640c..55d62c8ac 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -112,8 +112,8 @@ class TEX ['tex','standard'] .each do |b| @@mappaths[b] = 'dvips' end ['pdftex','pdfetex'] .each do |b| @@mappaths[b] = 'pdftex' end - ['aleph','omega','xetex','petex'] .each do |b| @@mappaths[b] = 'dvipdfm' end - ['dvipdfm', 'dvipdfmx', 'xdvipdfmx'] .each do |b| @@mappaths[b] = 'dvipdfm' end + ['aleph','omega','xetex','petex'] .each do |b| @@mappaths[b] = 'dvipdfmx' end + ['dvipdfm', 'dvipdfmx', 'xdvipdfmx'] .each do |b| @@mappaths[b] = 'dvipdfmx' end ['xdv','xdv2pdf'] .each do |b| @@mappaths[b] = 'dvips' end # todo norwegian (no) @@ -124,9 +124,9 @@ class TEX ['cont-de','de','german'] .each do |f| @@texformats[f] = 'cont-de' end ['cont-it','it','italian'] .each do |f| @@texformats[f] = 'cont-it' end ['cont-fr','fr','french'] .each do |f| @@texformats[f] = 'cont-fr' end - ['cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cz' end + ['cont-cs','cs','cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cs' end ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro' end - ['cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-uk' end + ['cont-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb' end ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end ['latex'] .each do |f| @@texformats[f] = 'latex.ltx' end @@ -141,7 +141,7 @@ class TEX ['plain','default','standard','mptopdf'] .each do |f| @@texmethods[f] = 'plain' end ['cont-en','cont-nl','cont-de','cont-it', - 'cont-fr','cont-cz','cont-ro','cont-uk'] .each do |f| @@texmethods[f] = 'context' end + 'cont-fr','cont-cs','cont-ro','cont-gb'] .each do |f| @@texmethods[f] = 'context' end ['latex','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end ['plain','default','standard'] .each do |f| @@mpsmethods[f] = 'plain' end @@ -151,7 +151,7 @@ class TEX @@mpsmakestr['plain'] = @@platformslash + "dump" ['cont-en','cont-nl','cont-de','cont-it', - 'cont-fr','cont-cz','cont-ro','cont-uk'] .each do |f| @@texprocstr[f] = @@platformslash + "emergencyend" end + 'cont-fr','cont-cs','cont-ro','cont-gb'] .each do |f| @@texprocstr[f] = @@platformslash + "emergencyend" end @@runoptions['aleph'] = ['--8bit'] @@runoptions['luatex'] = ['--file-line-error'] @@ -640,10 +640,14 @@ class TEX report("using tex format path #{texformatpath}") Dir.chdir(texformatpath) rescue false if FileTest.writable?(texformatpath) then - if texformats.length > 0 then - makeuserfile - makeresponsefile - end + # from now on we no longer support this; we load + # all patterns and if someone wants another + # interface language ... cook up a fmt or usr file + # + # if texformats.length > 0 then + # makeuserfile + # makeresponsefile + # end if texengine == 'luatex' then cleanupluafiles texformats.each do |texformat| @@ -2174,30 +2178,57 @@ end end def checkmpgraphics(mpname) + # in practice the checksums will differ because of multiple instances + # ok, we could save the mpy/mpo files by number, but not now mpoptions = '' if getvariable('makempy') then mpoptions += " --makempy " end + mponame = File.suffixed(mpname,'mpo') + mpyname = File.suffixed(mpname,'mpy') + pdfname = File.suffixed(mpname,'pdf') + tmpname = File.suffixed(mpname,'tmp') if getvariable('mpyforce') || getvariable('forcempy') then mpoptions += " --force " else - mponame = File.suffixed(mpname,'mpo') - mpyname = File.suffixed(mpname,'mpy') return false unless File.atleast?(mponame,32) mpochecksum = FileState.new.checksum(mponame) return false if mpochecksum.empty? # where does the checksum get into the file? # maybe let texexec do it? # solution: add one if not present or update when different - if f = File.silentopen(mpyname) then - str = f.gets.chomp - f.close - if str =~ /^\%\s*mpochecksum\s*\:\s*(\d+)/o then - return false if mpochecksum == $1 + begin + mpydata = IO.read(mpyname) + if mpydata then + if mpydata =~ /^\%\s*mpochecksum\s*\:\s*([A-Z0-9]+)$/mo then + checksum = $1 + if mpochecksum == checksum then + return false + end + end + end + rescue + # no file + end + end + # return Kpse.runscript('makempy',mpname) + # only pdftex + flags = ['--noctx','--process','--batch','--once'] + result = runtexexec([mponame], flags, 1) + runcommand(["pstoedit","-ssp -dt -f mpost", pdfname,tmpname]) + tmpdata = IO.read(tmpname) + if tmpdata then + if mpy = openedfile(mpyname) then + mpy << "% mpochecksum: #{mpochecksum}\n" + tmpdata.scan(/beginfig(.*?)endfig/mo) do |s| + mpy << "begingraphictextfig#{s}endgraphictextfig\n" end + mpy.close() end end - return Kpse.runscript('makempy',mpname) + File.silentdelete(tmpname) + File.silentdelete(pdfname) + return true end def checkmplabels(mpname) diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 00d2b494b..70c9ce243 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -222,7 +222,7 @@ class Commands interfaces = @commandline.arguments if interfaces.empty? then - interfaces = ['en','cz','de','it','nl','ro','fr'] + interfaces = ['en','cs','de','it','nl','ro','fr'] end interfaces.each do |interface| @@ -320,7 +320,7 @@ class Commands interfaces = @commandline.arguments if interfaces.empty? then - interfaces = ['cz','de','it','nl','ro','fr'] + interfaces = ['cs','de','it','nl','ro','fr'] else interfaces.delete('en') end @@ -1219,14 +1219,15 @@ class Language def located(filename) begin - fname = Kpse.found(filename, 'context') - if FileTest.file?(fname) then - report("using file #{fname}") - return fname - else - report("file #{filename} is not present") - return nil + ["context","plain","latex"].each do |name| # fallbacks needed for czech patterns + fname = Kpse.found(filename, name) + if FileTest.file?(fname) then + report("using file #{fname}") + return fname + end end + report("file #{filename} is not present") + return nil rescue report("file #{filename} cannot be located using kpsewhich") return nil @@ -1311,9 +1312,9 @@ class Language remap(/\"o/, "[odiaeresis]") remap(/\"u/, "[udiaeresis]") when 'fr' then - demap(/\\n\{/, "\\keep{") - remap(/\\ae/, "[adiaeresis]") - remap(/\\oe/, "[odiaeresis]") + demap(/\\n\{/, "\\delete{") + remap(/\\ae/, "[aeligature]") + remap(/\\oe/, "[oeligature]") when 'la' then # \lccode`'=`' somewhere else, todo demap(/\\c\{/, "\\delete{") @@ -1324,7 +1325,7 @@ class Language remap("a2|", "[greekalphaiotasub]") remap("h2|", "[greeketaiotasub]") remap("w2|", "[greekomegaiotasub]") - remap(">2r1<2r", "[2ῤ1ῥ]") + remap(">2r1<2r", "[2ῤ1ῥ]") remap(">a2n1wdu'", "[ἀ2ν1ωδύ]") remap(">e3s2ou'", "[ἐ3σ2ού]") # main conversion @@ -1561,6 +1562,8 @@ class Language remap(/\xC0/, "[cyrillicyu]") remap(/\xD1/, "[cyrillicya]") remap(/\xA3/, "[cyrillicyo]") + when 'tr' then + remap(/\^\^11/, "[dotlessi]") else end @@ -1632,7 +1635,7 @@ class Commands @@languagedata['ba' ] = [ 'ec' , ['bahyph.tex'] ] @@languagedata['ca' ] = [ 'ec' , ['cahyph.tex'] ] @@languagedata['cy' ] = [ 'ec' , ['cyhyph.tex'] ] - @@languagedata['cz' ] = [ 'ec' , ['czhyphen.tex','czhyphen.ex'] ] + @@languagedata['cs' ] = [ 'ec' , ['czhyphen.tex','czhyphen.ex'] ] @@languagedata['de' ] = [ 'ec' , ['dehyphn.tex'] ] @@languagedata['deo'] = [ 'ec' , ['dehypht.tex'] ] @@languagedata['da' ] = [ 'ec' , ['dkspecial.tex','dkcommon.tex'] ] @@ -1644,7 +1647,7 @@ 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['us' ] = [ 'default' , [['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex']] ] # inhyph.tex @@languagedata['is' ] = [ 'ec' , ['ishyph.tex'] ] @@ -1664,7 +1667,7 @@ class Commands # srhyphc.tex / cyrillic @@languagedata['sv' ] = [ 'ec' , ['svhyph.tex'] ] @@languagedata['tr' ] = [ 'ec' , ['tkhyph.tex'] ] - @@languagedata['uk' ] = [ 'default' , [['ukhyphen.tex'],['ukhyph.tex']] ] + @@languagedata['gb' ] = [ '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/texmfstart.rb b/scripts/context/ruby/texmfstart.rb index e43929213..42a26a09c 100644 --- a/scripts/context/ruby/texmfstart.rb +++ b/scripts/context/ruby/texmfstart.rb @@ -2115,6 +2115,12 @@ end def make(filename,windows=false,linux=false,remove=false) basename = File.basename(filename).gsub(/\.[^.]+?$/, '') +if @kpse.find_file(@tree,filename+".lua") or @kpse.find_file(@tree,filename+".rb") or @kpse.find_file(@tree,filename+".pl") then + # make stub indeed +else + report("no stub needed for '#{basename}'") + return +end if $stubpath == 'auto' then basename = File.dirname($0) + '/' + basename else @@ -2129,7 +2135,7 @@ def make(filename,windows=false,linux=false,remove=false) return elsif not remove then if windows then - ['bat','exe'].each do |suffix| + ['bat','cmd','exe'].each do |suffix| if FileTest.file?("#{basename}.#{suffix}") then report("windows stub '#{basename}.#{suffix}' skipped (already present)") return |