summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-tre.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-tre.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-tre.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-tre.lua b/Master/texmf-dist/tex/context/base/data-tre.lua
new file mode 100644
index 00000000000..9cac73b8ec7
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/data-tre.lua
@@ -0,0 +1,43 @@
+if not modules then modules = { } end modules ['data-tre'] = {
+ version = 1.001,
+ comment = "companion to luat-lib.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- \input tree://oeps1/**/oeps.tex
+
+local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders
+
+local done, found = { }, { }
+
+function finders.tree(specification,filetype)
+ local fnd = found[specification]
+ if not fnd then
+ local spec = resolvers.splitmethod(specification).path or ""
+ if spec ~= "" then
+ local path, name = file.dirname(spec), file.basename(spec)
+ if path == "" then path = "." end
+ local hash = done[path]
+ if not hash then
+ local pattern = path .. "/*" -- we will use the proper splitter
+ hash = dir.glob(pattern)
+ done[path] = hash
+ end
+ local pattern = "/" .. name:gsub("([%.%-%+])", "%%%1") .. "$"
+ for k, v in pairs(hash) do
+ if v:find(pattern) then
+ found[specification] = v
+ return v
+ end
+ end
+ end
+ fnd = unpack(finders.notfound)
+ found[specification] = fnd
+ end
+ return fnd
+end
+
+openers.tree = openers.generic
+loaders.tree = loaders.generic