summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/ctxtools.rb')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/ctxtools.rb252
1 files changed, 129 insertions, 123 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
index 00d2b494bb0..67baaab39c4 100644
--- a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
+++ b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
@@ -56,7 +56,8 @@ require 'base/file'
require 'rexml/document'
require 'net/http'
-require 'ftools'
+require 'fileutils'
+# require 'ftools'
require 'kconv'
exit if defined?(REQUIRE2LIB)
@@ -222,7 +223,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|
@@ -305,112 +306,112 @@ class Commands
end
-class Commands
-
- include CommandBase
-
- public
-
- def translateinterface
-
- # since we know what kind of file we're dealing with,
- # we do it quick and dirty instead of using rexml or
- # xslt
-
- interfaces = @commandline.arguments
-
- if interfaces.empty? then
- interfaces = ['cz','de','it','nl','ro','fr']
- else
- interfaces.delete('en')
- end
-
- interfaces.flatten.each do |interface|
-
- variables, constants, strings, list, data = Hash.new, Hash.new, Hash.new, '', ''
-
- keyfile, intfile, outfile = "keys-#{interface}.xml", "cont-en.xml", "cont-#{interface}.xml"
-
- report("generating #{keyfile}")
-
- begin
- one = "texexec --make --all #{interface}"
- two = "texexec --batch --silent --interface=#{interface} x-set-01"
- if @commandline.option("force") then
- system(one)
- system(two)
- elsif not system(two) then
- system(one)
- system(two)
- end
- rescue
- end
-
- unless File.file?(keyfile) then
- report("no #{keyfile} generated")
- next
- end
-
- report("loading #{keyfile}")
-
- begin
- list = IO.read(keyfile)
- rescue
- list = empty
- end
-
- if list.empty? then
- report("error in loading #{keyfile}")
- next
- end
-
- list.i_load('cd:variable', variables)
- list.i_load('cd:constant', constants)
- list.i_load('cd:command' , strings)
- # list.i_load('cd:element' , strings)
-
- report("loading #{intfile}")
-
- begin
- data = IO.read(intfile)
- rescue
- data = empty
- end
-
- if data.empty? then
- report("error in loading #{intfile}")
- next
- end
-
- report("translating interface en to #{interface}")
-
- data.i_translate('cd:string' , 'value', strings)
- data.i_translate('cd:variable' , 'value', variables)
- data.i_translate('cd:parameter', 'name' , constants)
- data.i_translate('cd:constant' , 'type' , variables)
- data.i_translate('cd:variable' , 'type' , variables)
- data.i_translate('cd:inherit' , 'name' , strings)
- # data.i_translate('cd:command' , 'name' , strings)
-
- data.gsub!(/(\<cd\:interface[^\>]*?language=")en(")/) do
- $1 + interface + $2
- end
-
- report("saving #{outfile}")
-
- begin
- if f = File.open(outfile, 'w') then
- f.write(data)
- f.close
- end
- rescue
- end
-
- end
-
- end
-
-end
+# class Commands
+#
+# include CommandBase
+#
+# public
+#
+# def translateinterface
+#
+# # since we know what kind of file we're dealing with,
+# # we do it quick and dirty instead of using rexml or
+# # xslt
+#
+# interfaces = @commandline.arguments
+#
+# if interfaces.empty? then
+# interfaces = ['cs','de','it','nl','ro','fr']
+# else
+# interfaces.delete('en')
+# end
+#
+# interfaces.flatten.each do |interface|
+#
+# variables, constants, strings, list, data = Hash.new, Hash.new, Hash.new, '', ''
+#
+# keyfile, intfile, outfile = "keys-#{interface}.xml", "cont-en.xml", "cont-#{interface}.xml"
+#
+# report("generating #{keyfile}")
+#
+# begin
+# one = "texexec --make --all #{interface}"
+# two = "texexec --batch --silent --interface=#{interface} x-set-01"
+# if @commandline.option("force") then
+# system(one)
+# system(two)
+# elsif not system(two) then
+# system(one)
+# system(two)
+# end
+# rescue
+# end
+#
+# unless File.file?(keyfile) then
+# report("no #{keyfile} generated")
+# next
+# end
+#
+# report("loading #{keyfile}")
+#
+# begin
+# list = IO.read(keyfile)
+# rescue
+# list = empty
+# end
+#
+# if list.empty? then
+# report("error in loading #{keyfile}")
+# next
+# end
+#
+# list.i_load('cd:variable', variables)
+# list.i_load('cd:constant', constants)
+# list.i_load('cd:command' , strings)
+# # list.i_load('cd:element' , strings)
+#
+# report("loading #{intfile}")
+#
+# begin
+# data = IO.read(intfile)
+# rescue
+# data = empty
+# end
+#
+# if data.empty? then
+# report("error in loading #{intfile}")
+# next
+# end
+#
+# report("translating interface en to #{interface}")
+#
+# data.i_translate('cd:string' , 'value', strings)
+# data.i_translate('cd:variable' , 'value', variables)
+# data.i_translate('cd:parameter', 'name' , constants)
+# data.i_translate('cd:constant' , 'type' , variables)
+# data.i_translate('cd:variable' , 'type' , variables)
+# data.i_translate('cd:inherit' , 'name' , strings)
+# # data.i_translate('cd:command' , 'name' , strings)
+#
+# data.gsub!(/(\<cd\:interface[^\>]*?language=")en(")/) do
+# $1 + interface + $2
+# end
+#
+# report("saving #{outfile}")
+#
+# begin
+# if f = File.open(outfile, 'w') then
+# f.write(data)
+# f.close
+# end
+# rescue
+# end
+#
+# end
+#
+# end
+#
+# end
class Commands
@@ -542,6 +543,7 @@ class Commands
"log", "tmp", "run", "bck", "rlg",
"mpt", "mpx", "mpd", "mpo", "mpb",
"ctl",
+ "pgf", "synctex.gz",
"tmp.md5", "tmp.out"
]
$texonlysuffixes = [
@@ -1219,14 +1221,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 +1314,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 +1327,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 +1564,8 @@ class Language
remap(/\xC0/, "[cyrillicyu]")
remap(/\xD1/, "[cyrillicya]")
remap(/\xA3/, "[cyrillicyo]")
+ when 'tr' then
+ remap(/\^\^11/, "[dotlessi]")
else
end
@@ -1632,7 +1637,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 +1649,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 +1669,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
@@ -2276,6 +2281,7 @@ class TexDeps
report("loading files")
report('')
n = 0
+# try tex and mkiv
@files.each do |filename|
if File.file?(filename) and f = File.open(filename) then
defs, uses, l = 0, 0, 0
@@ -2739,7 +2745,7 @@ commandline.registeraction('jeditinterface' , 'generate jedit syntax files [-
commandline.registeraction('bbeditinterface' , 'generate bbedit syntax files [--pipe]')
commandline.registeraction('sciteinterface' , 'generate scite syntax files [--pipe]')
commandline.registeraction('rawinterface' , 'generate raw syntax files [--pipe]')
-commandline.registeraction('translateinterface', 'generate interface files (xml) [nl de ..]')
+# commandline.registeraction('translateinterface', 'generate interface files (xml) [nl de ..]')
commandline.registeraction('purgefiles' , 'remove temporary files [--all --recurse] [basename]')
commandline.registeraction('documentation' , 'generate documentation [--type=] [filename]')
commandline.registeraction('filterpages' ) # no help, hidden temporary feature