diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-10-28 20:03:50 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-10-28 20:03:50 +0100 |
commit | f58a2cb5d22c5931581274db1f0ec85ac903b747 (patch) | |
tree | ba324713b8c0f2ee9465238d3cf867de3fb41dc5 /tex/context/base/mkiv/data-vir.lua | |
parent | 24f6f7de245bdff10f21984a9a3c6af3d31fa1f1 (diff) | |
download | context-f58a2cb5d22c5931581274db1f0ec85ac903b747.tar.gz |
2019-10-28 18:22:00
Diffstat (limited to 'tex/context/base/mkiv/data-vir.lua')
-rw-r--r-- | tex/context/base/mkiv/data-vir.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/data-vir.lua b/tex/context/base/mkiv/data-vir.lua index 7e25c822d..c5e63039c 100644 --- a/tex/context/base/mkiv/data-vir.lua +++ b/tex/context/base/mkiv/data-vir.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['data-vir'] = { license = "see context related readme files" } +local type = type local formatters, validstrings = string.formatters, string.valid local trace_virtual = false @@ -18,14 +19,18 @@ local resolvers = resolvers local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers -local data = { } -local n = 0 -- hm, number can be query -local f_virtual = formatters["virtual://%s.%s"] +local data = { } +local n = 0 -- hm, number can be query +local f_virtual_n = formatters["virtual://%s.%s"] +local f_virtual_y = formatters["virtual://%s-%s.%s"] -function savers.virtual(specification,content) +function savers.virtual(specification,content,suffix) n = n + 1 -- one number for all namespaces - local path = specification.path - local filename = f_virtual(path ~= "" and path or "virtualfile",n) + local path = type(specification) == "table" and specification.path or specification + if type(path) ~= "string" or path == "" then + path = "virtualfile" + end + local filename = suffix and f_virtual_y(path,n,suffix) or f_virtual_n(path,suffix) if trace_virtual then report_virtual("saver: file %a saved",filename) end |