diff options
author | Marius <mariausol@gmail.com> | 2011-01-31 00:29:42 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-01-31 00:29:42 +0200 |
commit | d0fbd0050d9085f815b642d138c3ef571b64b76a (patch) | |
tree | a9db5fa1c10795ffa6280fc1781fae8d10144ac6 /scripts | |
parent | a894f2e8c02c29b8ddeec3094acc1859ab34f864 (diff) | |
download | context-d0fbd0050d9085f815b642d138c3ef571b64b76a.tar.gz |
beta 2011.01.24 23:51
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-context.lua | 45 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 8 | ||||
-rw-r--r-- | scripts/context/ruby/base/tex.rb | 54 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 8 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 8 |
5 files changed, 70 insertions, 53 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 12ab2ecd8..4cb00301d 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -1080,7 +1080,7 @@ function scripts.context.metapost() end function scripts.context.version() - local name = resolvers.findfile("context.tex") + local name = resolvers.findfile("context.mkiv") if name ~= "" then logs.simple("main context file: %s",name) local data = io.loaddata(name) @@ -1095,7 +1095,7 @@ function scripts.context.version() logs.simple("context version: unknown, load error") end else - logs.simple("main context file: unknown, 'context.tex' not found") + logs.simple("main context file: unknown, 'context.mkiv' not found") end end @@ -1215,29 +1215,30 @@ local function touch(name,pattern) end end -local touchables = { "cont-new.mkii", "cont-new.mkiv" } +local function touchfiles(suffix) + local done, oldversion, newversion, foundname = touch(file.addsuffix("context",suffix),"(\\edef\\contextversion{)(.-)(})") + if done then + logs.simple("old version : %s", oldversion) + logs.simple("new version : %s", newversion) + logs.simple("touched file: %s", foundname) + local ok, _, _, foundname = touch(file.addsuffix("cont-new",suffix), "(\\newcontextversion{)(.-)(})") + if ok then + logs.simple("touched file: %s", foundname) + end + end +end function scripts.context.touch() if environment.argument("expert") then - local done, oldversion, newversion, foundname = touch("context.tex", "(\\edef\\contextversion{)(.-)(})") - if done then - logs.simple("old version : %s", oldversion) - logs.simple("new version : %s", newversion) - logs.simple("touched file: %s", foundname) - for i=1,#touchables do - local ok, _, _, foundname = touch(touchables[i], "(\\newcontextversion{)(.-)(})") - if ok then - logs.simple("touched file: %s", foundname) - end - end - end + touchfiles("mkii") + touchfiles("mkiv") end end -- extras function scripts.context.extras(pattern) - local found = resolvers.findfile("context.tex") + local found = resolvers.findfile("context.mkiv") if found == "" then logs.simple("unknown extra: %s", extra) else @@ -1332,12 +1333,12 @@ function scripts.context.update() local force = environment.argument("force") local socket = require("socket") local http = require("socket.http") - local basepath = resolvers.findfile("context.tex") or "" + local basepath = resolvers.findfile("context.mkiv") or "" if basepath == "" then - logs.simple("quiting, no 'context.tex' found") + logs.simple("quiting, no 'context.mkiv' found") return end - local basetree = basepath.match(basepath,"^(.-)tex/context/base/context.tex$") or "" + local basetree = basepath.match(basepath,"^(.-)tex/context/base/context.mkiv$") or "" if basetree == "" then logs.simple("quiting, no proper tds structure (%s)",basepath) return @@ -1379,12 +1380,12 @@ function scripts.context.update() logs.simple("quiting, unable to open '%s'",zipname) return end - local newfile = zip.loaddata(zipfile,"tex/context/base/context.tex") + local newfile = zip.loaddata(zipfile,"tex/context/base/context.mkiv") if not newfile then - logs.simple("quiting, unable to open '%s'","context.tex") + logs.simple("quiting, unable to open '%s'","context.mkiv") return end - local oldfile = io.loaddata(resolvers.findfile("context.tex")) or "" + local oldfile = io.loaddata(resolvers.findfile("context.mkiv")) or "" local function versiontonumber(what,str) local version = str:match("\\edef\\contextversion{(.-)}") or "" local year, month, day, hour, minute = str:match("\\edef\\contextversion{(%d+)%.(%d+)%.(%d+) *(%d+)%:(%d+)}") diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 4fc678333..f414d1707 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -13418,10 +13418,14 @@ function environment.make_format(name) end logs.simple("format path: %s",lfs.currentdir()) -- check source file - local texsourcename = file.addsuffix(name,"tex") + local texsourcename = file.addsuffix(name,"mkiv") local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" if fulltexsourcename == "" then - logs.simple("no tex source file with name: %s",texsourcename) + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + logs.simple("no tex source file with name: %s (mkiv or tex)",name) lfs.chdir(olddir) return else diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 5c9fa2c98..72cf7dad0 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -118,18 +118,16 @@ class TEX # todo norwegian (no) - ['plain'] .each do |f| @@texformats[f] = 'plain' end - ['cont-en','en','english','context','standard'].each do |f| @@texformats[f] = 'cont-en' end - ['cont-nl','nl','dutch'] .each do |f| @@texformats[f] = 'cont-nl' end - ['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-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-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb' end - ['cont-pe','pe','persian'] .each do |f| @@texformats[f] = 'cont-pe' end - ['cont-xp','xp','experimental'] .each do |f| @@texformats[f] = 'cont-xp' end - ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end + ['plain'] .each do |f| @@texformats[f] = 'plain' end + ['cont-en','en','english','context','standard'].each do |f| @@texformats[f] = 'cont-en.mkii' end + ['cont-nl','nl','dutch'] .each do |f| @@texformats[f] = 'cont-nl.mkii' end + ['cont-de','de','german'] .each do |f| @@texformats[f] = 'cont-de.mkii' end + ['cont-it','it','italian'] .each do |f| @@texformats[f] = 'cont-it.mkii' end + ['cont-fr','fr','french'] .each do |f| @@texformats[f] = 'cont-fr.mkii' end + ['cont-cs','cs','cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cs.mkii' end + ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro.mkii' end + ['cont-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb.mkii' end + ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end ['latex'] .each do |f| @@texformats[f] = 'latex.ltx' end @@ -142,10 +140,15 @@ class TEX ['latex','pdflatex'] .each do |p| @@prognames[p] = 'latex' end ['plain','default','standard','mptopdf'] .each do |f| @@texmethods[f] = 'plain' end - ['cont-en','cont-nl','cont-de','cont-it', - 'cont-fr','cont-cs','cont-ro','cont-gb', - 'cont-pe','cont-xp'] .each do |f| @@texmethods[f] = 'context' end - ['latex','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end + ['cont-en','cont-en.mkii', + 'cont-nl','cont-nl.mkii', + 'cont-de','cont-de.mkii', + 'cont-it','cont-it.mkii', + 'cont-fr','cont-fr.mkii', + 'cont-cs','cont-cs.mkii', + 'cont-ro','cont-ro.mkii', + 'cont-gb','cont-gb.mkii'] .each do |f| @@texmethods[f] = 'context' end + ['latex','latex.ltx','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end # untested ['plain','default','standard'] .each do |f| @@mpsmethods[f] = 'plain' end ['metafun'] .each do |f| @@mpsmethods[f] = 'metafun' end @@ -442,14 +445,6 @@ class TEX if str.class == String then str.split(',') else str.flatten end end - def validtexformat(str) validsomething(str,@@texformats,'tex') end - def validmpsformat(str) validsomething(str,@@mpsformats,'mp' ) end - def validtexengine(str) validsomething(str,@@texengines,'pdftex') end - def validmpsengine(str) validsomething(str,@@mpsengines,'mpost' ) end - - def validtexmethod(str) [validsomething(str,@@texmethods)].flatten.first end - def validmpsmethod(str) [validsomething(str,@@mpsmethods)].flatten.first end - def validsomething(str,something,type=nil) if str then list = [str].flatten.collect do |s| @@ -471,6 +466,15 @@ class TEX end end + def validtexformat(str) validsomething(str,@@texformats,'tex') || + validsomething(str,@@texformats,'mkii') end + def validmpsformat(str) validsomething(str,@@mpsformats,'mp' ) end + def validtexengine(str) validsomething(str,@@texengines,'pdftex') end + def validmpsengine(str) validsomething(str,@@mpsengines,'mpost' ) end + + def validtexmethod(str) [validsomething(str,@@texmethods)].flatten.first end + def validmpsmethod(str) [validsomething(str,@@mpsmethods)].flatten.first end + def validbackend(str) if str && @@backends.key?(str) then @@backends[str] @@ -562,7 +566,7 @@ class TEX # will go to context/process context/listing etc def contextversion # ook elders gebruiken - filename = Kpse.found('context.tex') + filename = Kpse.found('context.mkii') version = 'unknown' begin if FileTest.file?(filename) && IO.read(filename).match(/\\contextversion\{(\d+\.\d+\.\d+.*?)\}/) then diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 4fc678333..f414d1707 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -13418,10 +13418,14 @@ function environment.make_format(name) end logs.simple("format path: %s",lfs.currentdir()) -- check source file - local texsourcename = file.addsuffix(name,"tex") + local texsourcename = file.addsuffix(name,"mkiv") local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" if fulltexsourcename == "" then - logs.simple("no tex source file with name: %s",texsourcename) + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + logs.simple("no tex source file with name: %s (mkiv or tex)",name) lfs.chdir(olddir) return else diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 4fc678333..f414d1707 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -13418,10 +13418,14 @@ function environment.make_format(name) end logs.simple("format path: %s",lfs.currentdir()) -- check source file - local texsourcename = file.addsuffix(name,"tex") + local texsourcename = file.addsuffix(name,"mkiv") local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" if fulltexsourcename == "" then - logs.simple("no tex source file with name: %s",texsourcename) + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + logs.simple("no tex source file with name: %s (mkiv or tex)",name) lfs.chdir(olddir) return else |