summaryrefslogtreecommitdiff
path: root/tex/context/base/core-sys.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-09-06 23:03:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-09-06 23:03:00 +0200
commit3e104e2078f619b5f73eb5983f2308a672c18c5f (patch)
treec75d1a7a400d0e687d6a1ea95b89ee55cc25e11a /tex/context/base/core-sys.lua
parent425cbd3c69a5e8fc3ded0a48749205ba52641eb4 (diff)
downloadcontext-3e104e2078f619b5f73eb5983f2308a672c18c5f.tar.gz
beta 2012.09.06 23:03
Diffstat (limited to 'tex/context/base/core-sys.lua')
-rw-r--r--tex/context/base/core-sys.lua42
1 files changed, 22 insertions, 20 deletions
diff --git a/tex/context/base/core-sys.lua b/tex/context/base/core-sys.lua
index 8e4286cae..cf027e1c6 100644
--- a/tex/context/base/core-sys.lua
+++ b/tex/context/base/core-sys.lua
@@ -6,33 +6,35 @@ if not modules then modules = { } end modules ['core-sys'] = {
license = "see context related readme files"
}
-local lower, format = string.lower, string.format
+local lower, format, gsub = string.lower, string.format, string.gsub
local suffix, basename, removesuffix = file.suffix, file.basename, file.removesuffix
local environment = environment
--- function commands.updatefilenames(inputfilename,outputfilename)
--- --
--- environment.jobfilename = inputfilename or tex.jobname or ""
--- environment.jobfilesuffix = lower(suffix(environment.jobfilename))
--- --
--- environment.inputfilename = inputfilename or ""
--- environment.inputfilebarename = removesuffix(basename(inputfilename))
--- environment.inputfilesuffix = lower(suffix(inputfilename))
--- --
--- environment.outputfilename = outputfilename or ""
--- end
-
-function commands.updatefilenames(jobname,inputfilename,outputfilename)
+function commands.updatefilenames(jobname,fulljobname,inputfilename,outputfilename)
+ --
+ environment.jobname = jobname
+ --
+ local jobfilename = gsub(fulljobname or jobname or inputfilename or tex.jobname or "","%./","")
+ --
+ environment.jobfilename = jobfilename
+ environment.jobfilesuffix = lower(suffix(environment.jobfilename))
+ --
+ local inputfilename = gsub(inputfilename or "","%./","")
+ environment.inputfilename = inputfilename
+ environment.inputfilebarename = removesuffix(basename(inputfilename))
+ --
+ local inputfilerealsuffix = suffix(inputfilename)
+ environment.inputfilerealsuffix = inputfilerealsuffix
--
- environment.jobfilename = jobname or inputfilename or tex.jobname or ""
- environment.jobfilesuffix = lower(suffix(environment.jobfilename))
+ local inputfilesuffix = inputfilerealsuffix == "" and "tex" or lower(inputfilerealsuffix)
+ environment.inputfilesuffix = inputfilesuffix
--
- environment.inputfilename = inputfilename or ""
- environment.inputfilebarename = removesuffix(basename(inputfilename))
- environment.inputfilesuffix = lower(suffix(inputfilename))
+ local outputfilename = outputfilename or environment.inputfilebarename or ""
+ environment.outputfilename = outputfilename
--
- environment.outputfilename = outputfilename or environment.inputfilebarename or ""
+ commands.writestatus("files",format("jobname: %q, input: %q, result: %q, suffix: %s",
+ jobfilename,inputfilename,outputfilename,inputfilesuffix))
end
statistics.register("result saved in file", function()