summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-sys.lua
blob: 0be9fd588c72bd7c2517f4976dcd8ed591ca6e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
if not modules then modules = { } end modules ['core-sys'] = {
    version   = 1.001,
    comment   = "companion to core-sys.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

local lower, format = string.lower, string.format
local extname, basename, removesuffix = file.extname, file.basename, file.removesuffix

local environment = environment

function commands.updatefilenames(inputfilename,outputfilename)
    environment.inputfilename     = inputfilename or ""
    environment.outputfilename    = outputfilename or ""
    environment.jobfilename       = inputfilename or tex.jobname or ""
    environment.jobfilesuffix     = lower(extname(environment.jobfilename))
    environment.inputfilebarename = removesuffix(basename(inputfilename))
    environment.inputfilesuffix   = lower(extname(inputfilename))
end

statistics.register("result saved in file", function()
    -- suffix will be fetched from backend
    return format( "%s.%s", environment.outputfilename, (tex.pdfoutput>0 and "pdf") or "dvi")
end)