From 12edaa6671b197dc355bb301f711493bb5ad0dff Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 12 Jan 2006 10:38:00 +0100 Subject: stable 2006.01.12 10:38 --- scripts/context/perl/texexec.pl | 2 +- scripts/context/ruby/base/tex.rb | 2 +- scripts/context/ruby/ctxtools.rb | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl index aab5888f9..e939df78e 100644 --- a/scripts/context/perl/texexec.pl +++ b/scripts/context/perl/texexec.pl @@ -3018,7 +3018,7 @@ sub show_version_info { $contextversion = ; close IN; } - $contextversion =~ s/.*contextversion\{([0-9.]+)\}.*/$1/s; + $contextversion =~ s/.*contextversion\{([0-9\.\:\s]+)\}.*/$1/s; } $EnterBatchMode = 1; $Format = 'cont-en'; diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 968d66ed7..25b10efa1 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -437,7 +437,7 @@ class TEX filename = Kpse.found('context.tex') version = 'unknown' begin - if FileTest.file?(filename) && IO.read(filename).match(/\\contextversion\{(\d+\.\d+\.\d+)\}/) then + if FileTest.file?(filename) && IO.read(filename).match(/\\contextversion\{(\d+\.\d+\.\d+.*?)\}/) then version = $1 end rescue diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 948c19d58..024bc4e18 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -84,24 +84,32 @@ class Commands end end unless maincontextfile.empty? then + nextcontextfile = maincontextfile.sub(/context\.tex$/,"cont-new.tex") case action - when 1 then touchfile(maincontextfile) - when 2 then reportversion(maincontextfile) + when 1 then + touchfile(maincontextfile) + touchfile(nextcontextfile,@@newcontextversion) + when 2 then + reportversion(maincontextfile) + reportversion(nextcontextfile,@@newcontextversion) end end end - def touchfile(filename) + @@contextversion = "\\\\contextversion" + @@newcontextversion = "\\\\newcontextversion" + + def touchfile(filename,command=@@contextversion) if FileTest.file?(filename) then if data = IO.read(filename) then - timestamp = Time.now.strftime('%Y.%m.%d') + timestamp = Time.now.strftime('%Y.%m.%d %H:%M') prevstamp = '' begin - data.gsub!(/\\contextversion\{(\d+\.\d+\.\d+)\}/) do + data.gsub!(/#{command}\{(\d+\.\d+\.\d+.*?)\}/) do prevstamp = $1 - "\\contextversion{#{timestamp}}" + "#{command.sub(/(\\)+/,"\\")}{#{timestamp}}" end rescue else @@ -133,11 +141,11 @@ class Commands end - def reportversion(filename) + def reportversion(filename,command=@@contextversion) version = 'unknown' begin - if FileTest.file?(filename) && IO.read(filename).match(/\\contextversion\{(\d+\.\d+\.\d+)\}/) then + if FileTest.file?(filename) && IO.read(filename).match(/#{command}\{(\d+\.\d+\.\d+.*?)\}/) then version = $1 end rescue -- cgit v1.2.3