summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/ruby/base/ctx.rb30
-rw-r--r--scripts/context/ruby/base/switch.rb36
-rw-r--r--scripts/context/ruby/ctxtools.rb11
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/x-sm2om.xsl79
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
13 files changed, 155 insertions, 19 deletions
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 <?xml ...?>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="xml"/>
+
+ <xsl:template match ="processing-instruction()"><xsl:copy/><xsl:text>
+ </xsl:text></xsl:template>
+
+ <xsl:template match = "node()|@*" >
+ <xsl:copy>
+ <xsl:apply-templates select = "node()|@*" />
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="comment"></xsl:template>
+
+ <xsl:variable name='openmath-to-content-mathml'><value-of select='$stylesheet-path'/>/x-openmath.xsl</xsl:variable>
+
+ <xsl:template match='i|n'>
+ <xsl:element name="OMOBJ">
+ <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute>
+ <xsl:attribute name="version">2.0</xsl:attribute>
+ <xsl:element name="OMI">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match='v'>
+ <xsl:element name="OMOBJ">
+ <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute>
+ <xsl:attribute name="version">2.0</xsl:attribute>
+ <xsl:element name="OMV">
+ <xsl:attribute name="name"><xsl:apply-templates/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- r a/b split in two parts -->
+
+ <xsl:template match='r'>
+ <xsl:element name="OMOBJ">
+ <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute>
+ <xsl:attribute name="version">2.0</xsl:attribute>
+ <xsl:element name="OMA">
+ <xsl:element name="OMS">
+ <xsl:attribute name="cd">interval1</xsl:attribute>
+ <xsl:attribute name="name">interval_oo</xsl:attribute>
+ </xsl:element>
+ <xsl:choose>
+ <xsl:when test="not(number(substring-before(translate(text(),',','.'),':')))">
+ <xsl:element name="OMV">
+ <xsl:attribute name="name"><xsl:value-of select="substring-before(text(),':')"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="OMI">
+ <xsl:value-of select="substring-before(text(),':')"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="not(number(substring-after(translate(text(),',','.'),':')))">
+ <xsl:element name="OMV">
+ <xsl:attribute name="name"><xsl:value-of select="substring-after(text(),':')"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="OMI">
+ <xsl:value-of select="substring-after(text(),':')"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+</xsl:stylesheet>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="jedna"/>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="eins"/>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="one"/>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="un"/>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="uno"/>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="een"/>
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 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.04.27 00:58">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.04.27 15:59">
<cd:variables>
<cd:variable name="one" value="unu"/>