diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-09-06 23:03:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-09-06 23:03:00 +0200 |
commit | 3e104e2078f619b5f73eb5983f2308a672c18c5f (patch) | |
tree | c75d1a7a400d0e687d6a1ea95b89ee55cc25e11a /tex/context/base/core-sys.lua | |
parent | 425cbd3c69a5e8fc3ded0a48749205ba52641eb4 (diff) | |
download | context-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.lua | 42 |
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() |