summaryrefslogtreecommitdiff
path: root/tex/context/base/file-res.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/file-res.lua')
-rw-r--r--tex/context/base/file-res.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/tex/context/base/file-res.lua b/tex/context/base/file-res.lua
index 8e65ba4c7..8a50c0d58 100644
--- a/tex/context/base/file-res.lua
+++ b/tex/context/base/file-res.lua
@@ -6,13 +6,14 @@ if not modules then modules = { } end modules ['file-res'] = {
license = "see context related readme files"
}
-local format = string.format
+local format, find = string.format, string.find
local isfile = lfs.isfile
local is_qualified_path = file.is_qualified_path
-local hasscheme = url.hasscheme
+local hasscheme, urlescape = url.hasscheme, url.escape
-local trace_files = false trackers.register("resolvers.readfile", function(v) trace_files = v end)
-local report_files = logs.reporter("files","readfile")
+local trace_files = false trackers.register("resolvers.readfile", function(v) trace_files = v end)
+local trace_details = false trackers.register("resolvers.readfile.details", function(v) trace_details = v end)
+local report_files = logs.reporter("files","readfile")
resolvers.maxreadlevel = 2
@@ -23,6 +24,9 @@ local finders, loaders, openers = resolvers.finders, resolvers.loaders, resolver
local found = { } -- can best be done in the resolver itself
local function readfilename(specification,backtrack,treetoo)
+ if trace_details then
+ report_files(table.serialize(specification,"specification"))
+ end
local name = specification.filename
local fnd = name and found[name]
if not fnd then
@@ -132,9 +136,11 @@ function getreadfilename(scheme,path,name) -- better do a split and then pass ta
if hasscheme(name) or is_qualified_path(name) then
fullname = name
else
+ if not find(name,"%%") then
+ name = urlescape(name) -- if no % in names
+ end
fullname = ((path == "") and format("%s:///%s",scheme,name)) or format("%s:///%s/%s",scheme,path,name)
end
---~ print(">>>",fullname)
return resolvers.findtexfile(fullname) or "" -- can be more direct
end