diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-05 00:48:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-05 00:48:46 +0000 |
commit | f210bce174e1f2f05305ab03e88e120a1cbfc4da (patch) | |
tree | 5c4e2ad096b5c745e859516ac3196fa0864292d5 /Master/texmf-dist/tex/context/base/mkiv/data-met.lua | |
parent | 35fd641a3546acc0c62e0aa7f134888e36da30d4 (diff) |
context (from cont-tmf.zip of Feb 17 16:00, size 116339406)
git-svn-id: svn://tug.org/texlive/trunk@54086 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/data-met.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/data-met.lua | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-met.lua b/Master/texmf-dist/tex/context/base/mkiv/data-met.lua index bb892957733..8004ad2cdac 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-met.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-met.lua @@ -6,9 +6,12 @@ if not modules then modules = { } end modules ['data-met'] = { license = "see context related readme files" } -local find, format = string.find, string.format -local sequenced = table.sequenced +local type = type +local find = string.find local addurlscheme, urlhashed = url.addscheme, url.hashed +local collapsepath, joinfile = file.collapsepath, file.join + +local report_methods = logs.reporter("resolvers","methods") local trace_locating = false local trace_methods = false @@ -16,31 +19,38 @@ local trace_methods = false trackers.register("resolvers.locating", function(v) trace_methods = v end) trackers.register("resolvers.methods", function(v) trace_methods = v end) ---~ trace_methods = true - -local report_methods = logs.reporter("resolvers","methods") - -local allocate = utilities.storage.allocate - -local resolvers = resolvers +local allocate = utilities.storage.allocate +local resolvers = resolvers local registered = { } local function splitmethod(filename) -- todo: filetype in specification if not filename then - return { scheme = "unknown", original = filename } + return { + scheme = "unknown", + original = filename, + } end if type(filename) == "table" then return filename -- already split end - filename = file.collapsepath(filename,".") -- hm, we should keep ./ in some cases - + filename = collapsepath(filename,".") -- hm, we should keep ./ in some cases if not find(filename,"://",1,true) then - return { scheme = "file", path = filename, original = filename, filename = filename } + return { + scheme = "file", + path = filename, + original = filename, + filename = filename, + } end - local specification = url.hashed(filename) + local specification = urlhashed(filename) if not specification.scheme or specification.scheme == "" then - return { scheme = "file", path = filename, original = filename, filename = filename } + return { + scheme = "file", + path = filename, + original = filename, + filename = filename, + } else return specification end @@ -53,7 +63,7 @@ end -- if type(filename) == "table" then -- return filename -- already split -- end --- return url.hashed(filename) +-- return urlhashed(filename) -- end resolvers.splitmethod = splitmethod -- bad name but ok @@ -64,11 +74,12 @@ resolvers.splitmethod = splitmethod -- bad name but ok local function methodhandler(what,first,...) -- filename can be nil or false local method = registered[what] if method then - local how, namespace = method.how, method.namespace + local how = method.how + local namespace = method.namespace if how == "uri" or how == "url" then local specification = splitmethod(first) - local scheme = specification.scheme - local resolver = namespace and namespace[scheme] + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] if resolver then if trace_methods then report_methods("resolving, method %a, how %a, handler %a, argument %a",what,how,scheme,first) @@ -112,7 +123,10 @@ end resolvers.methodhandler = methodhandler function resolvers.registermethod(name,namespace,how) - registered[name] = { how = how or "tag", namespace = namespace } + registered[name] = { + how = how or "tag", + namespace = namespace + } namespace["byscheme"] = function(scheme,filename,...) if scheme == "file" then return methodhandler(name,filename,...) @@ -122,7 +136,7 @@ function resolvers.registermethod(name,namespace,how) end end -local concatinators = allocate { notfound = file.join } -- concatinate paths +local concatinators = allocate { notfound = joinfile } -- concatinate paths local locators = allocate { notfound = function() end } -- locate databases local hashers = allocate { notfound = function() end } -- load databases local generators = allocate { notfound = function() end } -- generate databases |