summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-otf.lua18
-rw-r--r--tex/context/base/l-dir.lua184
-rw-r--r--tex/context/base/l-table.lua18
-rw-r--r--tex/context/base/luat-inp.lua2
-rw-r--r--tex/context/base/luat-tmp.lua11
-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
14 files changed, 209 insertions, 42 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index eff20a6e8..be7393632 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{2008.01.28 21:28}
+\newcontextversion{2008.03.11 23:55}
%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 d90783726..6b126af9c 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -42,7 +42,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2008.03.10 23:20}
+\edef\contextversion{2008.03.11 23:55}
%D For those who want to use this:
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index 00eb8e4b8..f5e08ca6d 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -757,14 +757,6 @@ function fonts.otf.meanings.baseline(id)
return fonts.otf.meanings.resolve(fonts.otf.tables.baselines,id)
end
-function table.reverse_hash(h)
- local r = { }
- for k,v in pairs(h) do
- r[v] = (k:gsub(" ","")):lower()
- end
- return r
-end
-
fonts.otf.tables.to_scripts = table.reverse_hash(fonts.otf.tables.scripts )
fonts.otf.tables.to_languages = table.reverse_hash(fonts.otf.tables.languages)
fonts.otf.tables.to_features = table.reverse_hash(fonts.otf.tables.features )
@@ -908,16 +900,6 @@ end
-- memory saver ..
-function table.reverse(t)
- local tt = { }
- if #t > 0 then
- for i=#t,1,-1 do
- tt[#tt+1] = t[i]
- end
- end
- return tt
-end
-
function fonts.otf.enhance.pack(data)
if data then
local h, t = { }, { }
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 4ee2871ce..864e207b6 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -101,21 +101,183 @@ if lfs then do
--~ mkdirs(".","/a/b/c")
--~ mkdirs("a","b","c")
- function dir.mkdirs(...)
- local pth, err, lst = "", false, table.concat({...},"/")
- for _, s in ipairs(lst:split("/")) do
- if pth == "" then
- pth = (s == "" and "/") or s
+--~ function dir.mkdirs(...)
+--~ local pth, err, lst = "", false, table.concat({...},"/")
+--~ for _, s in ipairs(lst:split("/")) do
+--~ if pth == "" then
+--~ pth = (s == "" and "/") or s
+--~ else
+--~ pth = pth .. "/" .. s
+--~ end
+--~ if s == "" then
+--~ -- can be network path
+--~ elseif not lfs.isdir(pth) then
+--~ lfs.mkdir(pth)
+--~ end
+--~ end
+--~ return pth, not err
+--~ end
+
+ local make_indeed = true -- false
+
+ if string.find(os.getenv("PATH"),";") then
+
+ function dir.mkdirs(...)
+ local str, pth = "", ""
+ for _, s in ipairs({...}) do
+ if s ~= "" then
+ if str ~= "" then
+ str = str .. "/" .. s
+ else
+ str = s
+ end
+ end
+ end
+ local first, middle, last
+ local drive = false
+ first, middle, last = str:match("^(//)(//*)(.*)$")
+ if first then
+ -- empty network path == local path
+ else
+ first, last = str:match("^(//)/*(.-)$")
+ if first then
+ middle, last = str:match("([^/]+)/+(.-)$")
+ if middle then
+ pth = "//" .. middle
+ else
+ pth = "//" .. last
+ last = ""
+ end
+ else
+ first, middle, last = str:match("^([a-zA-Z]:)(/*)(.-)$")
+ if first then
+ pth, drive = first .. middle, true
+ else
+ middle, last = str:match("^(/*)(.-)$")
+ if not middle then
+ last = str
+ end
+ end
+ end
+ end
+ for s in last:gmatch("[^/]+") do
+ if pth == "" then
+ pth = s
+ elseif drive then
+ pth, drive = pth .. s, false
+ else
+ pth = pth .. "/" .. s
+ end
+ if make_indeed and not lfs.isdir(pth) then
+ lfs.mkdir(pth)
+ end
+ end
+ return pth, (lfs.isdir(pth) == true)
+ end
+
+--~ print(dir.mkdirs("","","a","c"))
+--~ print(dir.mkdirs("a"))
+--~ print(dir.mkdirs("a:"))
+--~ print(dir.mkdirs("a:/b/c"))
+--~ print(dir.mkdirs("a:b/c"))
+--~ print(dir.mkdirs("a:/bbb/c"))
+--~ print(dir.mkdirs("/a/b/c"))
+--~ print(dir.mkdirs("/aaa/b/c"))
+--~ print(dir.mkdirs("//a/b/c"))
+--~ print(dir.mkdirs("///a/b/c"))
+--~ print(dir.mkdirs("a/bbb//ccc/"))
+
+ function dir.expand_name(str)
+ local first, nothing, last = str:match("^(//)(//*)(.*)$")
+ if first then
+ first = lfs.currentdir() .. "/"
+ first = first:gsub("\\","/")
+ end
+ if not first then
+ first, last = str:match("^(//)/*(.*)$")
+ end
+ if not first then
+ first, last = str:match("^([a-zA-Z]:)(.*)$")
+ if first and not last:find("^/") then
+ local d = lfs.currentdir()
+ if lfs.chdir(first) then
+ first = lfs.currentdir()
+ first = first:gsub("\\","/")
+ end
+ lfs.chdir(d)
+ end
+ end
+ if not first then
+ first, last = lfs.currentdir(), str
+ first = first:gsub("\\","/")
+ end
+ last = last:gsub("//","/")
+ last = last:gsub("/%./","/")
+ last = last:gsub("^/*","")
+ first = first:gsub("/*$","")
+ if last == "" then
+ return first
+ else
+ return first .. "/" .. last
+ end
+ end
+
+ else
+
+ function dir.mkdirs(...)
+ local str, pth = "", ""
+ for _, s in ipairs({...}) do
+ if s ~= "" then
+ if str ~= "" then
+ str = str .. "/" .. s
+ else
+ str = s
+ end
+ end
+ end
+ str = str:gsub("/+","/")
+ if str:find("^/") then
+ pth = "/"
+ for s in str:gmatch("[^/]+") do
+ local first = (pth == "/")
+ if first then
+ pth = pth .. s
+ else
+ pth = pth .. "/" .. s
+ end
+ if make_indeed and not first and not lfs.isdir(pth) then
+ lfs.mkdir(pth)
+ end
+ end
else
- pth = pth .. "/" .. s
+ pth = "."
+ for s in str:gmatch("[^/]+") do
+ pth = pth .. "/" .. s
+ if make_indeed and not lfs.isdir(pth) then
+ lfs.mkdir(pth)
+ end
+ end
end
- if s == "" then
- -- can be network path
- elseif not lfs.isdir(pth) then
- lfs.mkdir(pth)
+ return pth, (lfs.isdir(pth) == true)
+ end
+
+--~ print(dir.mkdirs("","","a","c"))
+--~ print(dir.mkdirs("a"))
+--~ print(dir.mkdirs("/a/b/c"))
+--~ print(dir.mkdirs("/aaa/b/c"))
+--~ print(dir.mkdirs("//a/b/c"))
+--~ print(dir.mkdirs("///a/b/c"))
+--~ print(dir.mkdirs("a/bbb//ccc/"))
+
+ function dir.expand_name(str)
+ if not str:find("^/") then
+ str = lfs.currentdir() .. "/" .. str
end
+ str = str:gsub("//","/")
+ str = str:gsub("/%./","/")
+ return str
end
- return pth, not err
+
end
dir.makedirs = dir.mkdirs
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index 44cecff69..99c492f1f 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -664,3 +664,21 @@ function table.hexed(t,seperator)
for i=1,#t do tt[i] = string.format("0x%04X",t[i]) end
return table.concat(tt,seperator or " ")
end
+
+function table.reverse_hash(h)
+ local r = { }
+ for k,v in pairs(h) do
+ r[v] = (k:gsub(" ","")):lower()
+ end
+ return r
+end
+
+function table.reverse(t)
+ local tt = { }
+ if #t > 0 then
+ for i=#t,1,-1 do
+ tt[#tt+1] = t[i]
+ end
+ end
+ return tt
+end
diff --git a/tex/context/base/luat-inp.lua b/tex/context/base/luat-inp.lua
index 9f04ad82c..131b8b06b 100644
--- a/tex/context/base/luat-inp.lua
+++ b/tex/context/base/luat-inp.lua
@@ -1570,7 +1570,7 @@ function input.aux.find_file(instance,filename) -- todo : plugin (scanners, chec
end
-- this is actually 'other text files' or 'any' or 'whatever'
local filelist = input.aux.collect_files(instance,wantedfiles)
- local lf = filelist and filelist[1]
+ local fl = filelist and filelist[1]
if fl then
filename = fl[3]
result[#result+1] = filename
diff --git a/tex/context/base/luat-tmp.lua b/tex/context/base/luat-tmp.lua
index 916d82491..59ceb260f 100644
--- a/tex/context/base/luat-tmp.lua
+++ b/tex/context/base/luat-tmp.lua
@@ -56,12 +56,16 @@ function caches.configpath(instance)
--~ return input.expand_var(instance,"TEXMFCNF")
end
+function caches.hashed(tree)
+ return md5.hex((tree:lower()):gsub("[\\\/]+","/"))
+end
+
function caches.treehash(instance)
local tree = caches.configpath(instance)
if not tree or tree == "" then
return false
else
- return md5.hex(tree)
+ return caches.hashed(tree)
end
end
@@ -99,6 +103,7 @@ function caches.setpath(instance,...)
local pth = dir.mkdirs(caches.path,...)
return pth
end
+ caches.path = dir.expand_name(caches.path)
return caches.path
end
@@ -239,7 +244,7 @@ function input.aux.save_data(instance, dataname, check)
for cachename, files in pairs(instance[dataname]) do
local name
if input.usecache then
- name = file.join(caches.setpath(instance,"trees"),md5.hex(cachename))
+ name = file.join(caches.setpath(instance,"trees"),caches.hashed(cachename))
else
name = file.join(cachename,dataname)
end
@@ -331,7 +336,7 @@ end
function input.aux.load_data(instance,pathname,dataname,filename)
local luaname, lucname, pname, fname
if input.usecache then
- pname, fname = caches.setpath(instance,"trees"), md5.hex(pathname)
+ pname, fname = caches.setpath(instance,"trees"), caches.hashed(pathname)
filename = file.join(pname,fname)
else
if not filename or (filename == "") then
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index 43ff43c8e..66b5587be 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 01610a5bd..3e8c0991f 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index 9d8356d8a..341f36028 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index 12a7773ca..4dfc85ce3 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index 7366a4988..3231d2ee2 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index f46ea2c3a..816cf99c9 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index e887f86f3..e39c4f5cc 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="2008.03.10 23:20">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.03.11 23:55">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>