summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-vir.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-vir.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-vir.lua22
1 files changed, 12 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-vir.lua b/Master/texmf-dist/tex/context/base/data-vir.lua
index 89359c19a08..e5bf35fa77b 100644
--- a/Master/texmf-dist/tex/context/base/data-vir.lua
+++ b/Master/texmf-dist/tex/context/base/data-vir.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['data-vir'] = {
license = "see context related readme files"
}
-local format = string.format
+local format, validstrings = string.format, string.valid
local trace_virtual = false
local report_virtual = logs.reporter("resolvers","virtual")
@@ -18,14 +18,16 @@ local resolvers = resolvers
local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers
-local data, n, template = { }, 0, "virtual://%s.%s" -- hm, number can be query
+local data = { }
+local n = 0 -- hm, number can be query
+local template = "virtual://%s.%s"
function savers.virtual(specification,content)
n = n + 1 -- one number for all namespaces
local path = specification.path
local filename = format(template,path ~= "" and path or "virtualfile",n)
if trace_virtual then
- report_virtual("saver: file '%s' saved",filename)
+ report_virtual("saver: file %a saved",filename)
end
data[filename] = content
return filename
@@ -36,12 +38,12 @@ function finders.virtual(specification)
local d = data[original]
if d then
if trace_virtual then
- report_virtual("finder: file '%s' found",original)
+ report_virtual("finder: file %a found",original)
end
return original
else
if trace_virtual then
- report_virtual("finder: unknown file '%s'",original)
+ report_virtual("finder: unknown file %a",original)
end
return finders.notfound()
end
@@ -52,14 +54,14 @@ function openers.virtual(specification)
local d = data[original]
if d then
if trace_virtual then
- report_virtual("opener, file '%s' opened",original)
+ report_virtual("opener: file %a opened",original)
end
- data[original] = nil
+ data[original] = nil -- when we comment this we can have error messages
-- With utf-8 we signal that no regime is to be applied!
return openers.helpers.textopener("virtual",original,d,"utf-8")
else
if trace_virtual then
- report_virtual("opener, file '%s' not found",original)
+ report_virtual("opener: file %a not found",original)
end
return openers.notfound()
end
@@ -70,13 +72,13 @@ function loaders.virtual(specification)
local d = data[original]
if d then
if trace_virtual then
- report_virtual("loader, file '%s' loaded",original)
+ report_virtual("loader: file %a loaded",original)
end
data[original] = nil
return true, d, #d
end
if trace_virtual then
- report_virtual("loader, file '%s' not loaded",original)
+ report_virtual("loader: file %a not loaded",original)
end
return loaders.notfound()
end