summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-pre.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-pre.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-pre.lua25
1 files changed, 22 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-pre.lua b/Master/texmf-dist/tex/context/base/data-pre.lua
index deee9ebf46f..9348f6cd39c 100644
--- a/Master/texmf-dist/tex/context/base/data-pre.lua
+++ b/Master/texmf-dist/tex/context/base/data-pre.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['data-res'] = {
version = 1.001,
- comment = "companion to luat-lib.tex",
+ comment = "companion to luat-lib.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -35,6 +35,14 @@ prefixes.relative = function(str,n)
return resolvers.clean_path(str)
end
+prefixes.auto = function(str)
+ local fullname = prefixes.relative(str)
+ if not lfs.isfile(fullname) then
+ fullname = prefixes.locate(str)
+ end
+ return fullname
+end
+
prefixes.locate = function(str)
local fullname = resolvers.find_given_file(str) or ""
return resolvers.clean_path((fullname ~= "" and fullname) or str)
@@ -58,6 +66,16 @@ prefixes.full = prefixes.locate
prefixes.file = prefixes.filename
prefixes.path = prefixes.pathname
+function resolvers.allprefixes(separator)
+ local all = table.sortedkeys(prefixes)
+ if separator then
+ for i=1,#all do
+ all[i] = all[i] .. ":"
+ end
+ end
+ return all
+end
+
local function _resolve_(method,target)
if prefixes[method] then
return prefixes[method](target)
@@ -68,7 +86,8 @@ end
local function resolve(str)
if type(str) == "table" then
- for k, v in pairs(str) do -- ipairs
+ for k=1,#str do
+ local v = str[k]
str[k] = resolve(v) or v
end
elseif str and str ~= "" then
@@ -81,7 +100,7 @@ resolvers.resolve = resolve
if os.uname then
- for k, v in pairs(os.uname()) do
+ for k, v in next, os.uname() do
if not prefixes[k] then
prefixes[k] = function() return v end
end