From 7310101ce7739889fd4681864978f2c71722bbd6 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 27 Apr 2006 15:59:00 +0200 Subject: stable 2006.04.27 15:59 --- scripts/context/ruby/base/ctx.rb | 30 ++++++++++++-- scripts/context/ruby/base/switch.rb | 36 ++++++++++++++--- scripts/context/ruby/ctxtools.rb | 11 +++++- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/x-sm2om.xsl | 79 +++++++++++++++++++++++++++++++++++++ tex/context/interface/keys-cz.xml | 2 +- tex/context/interface/keys-de.xml | 2 +- tex/context/interface/keys-en.xml | 2 +- tex/context/interface/keys-fr.xml | 2 +- tex/context/interface/keys-it.xml | 2 +- tex/context/interface/keys-nl.xml | 2 +- tex/context/interface/keys-ro.xml | 2 +- 13 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 tex/context/base/x-sm2om.xsl diff --git a/scripts/context/ruby/base/ctx.rb b/scripts/context/ruby/base/ctx.rb index 6c8dd5a44..e39751fb6 100644 --- a/scripts/context/ruby/base/ctx.rb +++ b/scripts/context/ruby/base/ctx.rb @@ -23,6 +23,8 @@ class CtxRunner attr_reader :environments, :modules, :filters + @@suffix = 'prep' + def initialize(jobname=nil,logger=nil) if @logger = logger then def report(str='') @@ -129,13 +131,29 @@ class CtxRunner REXML::XPath.each(@xmldata.root,"/ctx:job/ctx:process/ctx:resources/ctx:filter") do |fil| @filters << justtext(fil) end + commands = Hash.new + REXML::XPath.each(@xmldata.root,"/ctx:job/ctx:preprocess/ctx:processors/ctx:processor") do |pre| + begin + commands[pre.attributes['name']] = pre + rescue + end + end + suffix = @@suffix + begin + suffix = REXML::XPath.match(@xmldata.root,"/ctx:job/ctx:preprocess/@suffix").to_s + rescue + puts $! + suffix = @@suffix + else + if suffix && suffix.empty? then suffix = @@suffix end + end REXML::XPath.each(@xmldata.root,"/ctx:job/ctx:preprocess/ctx:files") do |files| REXML::XPath.each(files,"ctx:file") do |pattern| preprocessor = pattern.attributes['processor'] if preprocessor and not preprocessor.empty? then pattern = justtext(pattern) Dir.glob(pattern).each do |oldfile| - newfile = "#{oldfile}.prep" + newfile = "#{oldfile}.#{suffix}" if File.needsupdate(oldfile,newfile) then begin File.delete(newfile) @@ -144,11 +162,17 @@ class CtxRunner end # there can be a sequence of processors preprocessor.split(',').each do |pp| - if command = REXML::XPath.first(@xmldata.root,"/ctx:job/ctx:preprocess/ctx:processors/ctx:processor[@name='#{pp}']") then + if command = commands[pp] then # a lie: no command = REXML::Document.new(command.to_s) # don't infect original command = command.elements["ctx:processor"] - report("preprocessing #{oldfile} using #{pp}") + begin + if suf = command.attributes['suffix'] then + newfile = "#{oldfile}.#{suf}" + end + rescue + end + report("preprocessing #{oldfile} into #{newfile} using #{pp}") REXML::XPath.each(command,"ctx:old") do |value| replace(value,oldfile) end REXML::XPath.each(command,"ctx:new") do |value| replace(value,newfile) end variables['old'] = oldfile diff --git a/scripts/context/ruby/base/switch.rb b/scripts/context/ruby/base/switch.rb index 97575cdaa..64b1abef0 100644 --- a/scripts/context/ruby/base/switch.rb +++ b/scripts/context/ruby/base/switch.rb @@ -47,23 +47,49 @@ class File @@update_eps = 1 + # def File.needsupdate(oldname,newname) + # begin + # oldtime = File.stat(oldname).mtime.to_i + # newtime = File.stat(newname).mtime.to_i + # if newtime >= oldtime + # return false + # elsif oldtime-newtime < @@update_eps then + # return false + # else + # return true + # end + # rescue + # return true + # end + # end + def File.needsupdate(oldname,newname) begin oldtime = File.stat(oldname).mtime.to_i newtime = File.stat(newname).mtime.to_i - delta = newtime - oldtime - delta < @@update_eps +# str = "o:#{oldtime} n:#{newtime} d:#{newtime-oldtime}" + if newtime >= oldtime +# puts "original is unchanged: #{str}" + return false + elsif oldtime-newtime < @@update_eps then +# puts "original is within range: #{str}" + return false + else +# puts "original is updated: #{str}" + return true + end rescue return true end end def File.syncmtimes(oldname,newname) + return begin if $mswindows then - # does not work (yet) - t = File.mtime(oldname) # i'm not sure if the time is frozen, so we do it here - File.utime(0,t,oldname,newname) + # does not work (yet) / gives future timestamp + # t = File.mtime(oldname) # i'm not sure if the time is frozen, so we do it here + # File.utime(0,t,oldname,newname) else t = File.mtime(oldname) # i'm not sure if the time is frozen, so we do it here File.utime(0,t,oldname,newname) diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 0ba1a7561..6d36051fa 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -421,6 +421,12 @@ class Commands recurse = @commandline.option("recurse") $dontaskprefixes.push(Dir.glob("mpx-*")) + + if purgeall then + $dontaskprefixes.push(Dir.glob("*.tex.prep")) + $dontaskprefixes.push(Dir.glob("*.xml.prep")) + end + $dontaskprefixes.flatten! $dontaskprefixes.sort! @@ -433,7 +439,7 @@ class Commands if ! pattern || pattern.empty? then globbed = if recurse then "**/*.*" else "*.*" end files = Dir.glob(globbed) - report("purging files : #{globbed}") + report("purging#{if all then ' all' end} temporary files : #{globbed}") else pattern.each do |pat| globbed = if recurse then "**/#{pat}-*.*" else "#{pat}-*.*" end @@ -441,7 +447,7 @@ class Commands globbed = if recurse then "**/#{pat}.*" else "#{pat}.*" end files.push(Dir.glob(globbed)) end - report("purging files : #{pattern.join(' ')}") + report("purging#{if all then ' all' end} temporary files : #{pattern.join(' ')}") end files.flatten! files.sort! @@ -2142,6 +2148,7 @@ commandline.registeraction('purgefiles' , 'remove temporary files [--all commandline.registeraction('documentation' , 'generate documentation [--type=] [filename]') commandline.registeraction('filterpages' ) # no help, hidden temporary feature commandline.registeraction('purgeallfiles' ) # no help, compatibility feature +commandline.registeraction('purgefiles' ) # no help, compatibility feature commandline.registeraction('patternfiles' , 'generate pattern files [--all --xml --utf8] [languagecode]') commandline.registeraction('dpxmapfiles' , 'convert pdftex mapfiles to dvipdfmx [--force] [texmfroot]') commandline.registeraction('listentities' , 'create doctype entity definition from enco-uc.tex') diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 02030165c..451aef0c7 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2006.04.27 00:58} +\newcontextversion{2006.04.27 15:59} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 1f2d5043c..035091084 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -31,7 +31,7 @@ %D 2004.8.30 the low level interface is english. Watch out and adapt %D your styles an modules. -\def\contextversion{2006.04.27 00:58} +\def\contextversion{2006.04.27 15:59} %D For those who want to use this: diff --git a/tex/context/base/x-sm2om.xsl b/tex/context/base/x-sm2om.xsl new file mode 100644 index 000000000..022d37355 --- /dev/null +++ b/tex/context/base/x-sm2om.xsl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + /x-openmath.xsl + + + + http://www.openmath.org/OpenMath + 2.0 + + + + + + + + + http://www.openmath.org/OpenMath + 2.0 + + + + + + + + + + + http://www.openmath.org/OpenMath + 2.0 + + + interval1 + interval_oo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index ce25d7971..e77af536e 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 6d71f6247..0e7154545 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 9e77a60e2..478b43a6f 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index b38033867..7d60c593f 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 4fff964bf..20b2b2525 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 4919806b5..2f808b4ea 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 346519a21..012f83036 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ - + -- cgit v1.2.3