summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-fonts.lua7
-rw-r--r--scripts/context/lua/mtx-kpse.lua50
-rw-r--r--scripts/context/lua/mtxrun.lua33
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua33
-rw-r--r--scripts/context/stubs/unix/mtxrun33
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua33
6 files changed, 144 insertions, 45 deletions
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index fcba696c4..513a0a0a7 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -486,11 +486,16 @@ function scripts.fonts.convert() -- new save
if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' then
local data = fonts.handlers.otf.readers.loadfont(filename,sub)
if data then
+ local nofsubfonts = data and data.properties and data.properties.nofsubfonts or 0
fonts.handlers.otf.readers.compact(data)
fonts.handlers.otf.readers.rehash(data,getargument("names") and "names" or "unicodes")
local savename = replacesuffix(lower(data.metadata.fullname or filename),"lua")
table.save(savename,data)
- report("font: %a saved as %a",filename,savename)
+ if nofsubfonts == 0 then
+ report("font: %a saved as %a",filename,savename)
+ else
+ report("font: %a saved as %a, %i subfonts found, provide number if wanted",filename,savename,nofsubfonts)
+ end
else
report("font: %a not loaded",filename)
end
diff --git a/scripts/context/lua/mtx-kpse.lua b/scripts/context/lua/mtx-kpse.lua
index 025dd5ff5..7542751ac 100644
--- a/scripts/context/lua/mtx-kpse.lua
+++ b/scripts/context/lua/mtx-kpse.lua
@@ -8,13 +8,12 @@ if not modules then modules = { } end modules ['mtx-kpse'] = {
-- I decided to make this module after a report on the mailing list about
-- a clash with texmf-var on a system that had texlive installed. One way
--- to figure that out is to use kpse. We had the code anyway.
---
--- mtxrun --script kpse --progname=pdftex --findfile context.mkii
+-- to figure that out is to use kpse. We had the code anyway so next time
+-- there is some issue ...
trackers.enable("resolvers.lib.silent")
-local kpse = LUATEXENGINE == "luametatex" and require("libs-imp-kpse")
+local kpse = LUATEXENGINE == "luametatex" and require("libs-imp-kpse.lmt")
if type(kpse) ~= "table" then
return
@@ -33,6 +32,7 @@ local helpinfo = [[
<subcategory>
<flag name="progname"><short>mandate, set the program name (e.g. pdftex)</short></flag>
<flag name="findfile"><short>report the fully qualified path of the given file</short></flag>
+ <flag name="findfiles"><short>report a list of all full names of the given file</short></flag>
<flag name="expandpath"><short>expand the given path variable</short></flag>
<flag name="expandvar"><short>expand a variable</short></flag>
<flag name="expandbraces"><short>expand a complex variable specification</short></flag>
@@ -40,11 +40,29 @@ local helpinfo = [[
<flag name="readablefile"><short>report if a file is readable</short></flag>
<flag name="filetypes"><short>list all supported formats</short></flag>
</subcategory>
+ </category>
+ <category name="additional">
<subcategory>
- <flag name="fonts"><short>only wipe fonts</short></flag>
+ <flag name="format"><short>format type</short></flag>
+ <flag name="path"><short>path variable</short></flag>
+ <flag name="split"><short>split result in lines</short></flag>
</subcategory>
</category>
</flags>
+ <examples>
+ <category>
+ <title>Examples</title>
+ <subcategory>
+ <example><command>mtxrun --script kpse --progname=pdftex --findfile context.mkii</command></example>
+ <example><command>mtxrun --script kpse --progname=pdftex --findfile context.mkii --format=tex</command></example>
+ <example><command>mtxrun --script kpse --progname=pdftex --findfiles context.mkii --path=$TEXINPUTS</command></example>
+ </subcategory>
+ <subcategory>
+ <example><command>mtxrun --script kpse --progname=pdftex --expandpath $TEXMFVAR</command></example>
+ <example><command>mtxrun --script kpse --progname=pdftex --expandpath $TEXINPUTS -- split</command></example>
+ </subcategory>
+ </category>
+ </examples>
</application>
]]
@@ -56,7 +74,8 @@ local application = logs.application {
local report = application.report
local argument = environment.argument
-local target = environment.files[1]
+local files = environment.files
+local target = files[1]
if argument("progname") or argument("programname") then
kpse.set_program_name(argument("progname"))
@@ -65,15 +84,30 @@ else
return
end
+local function printtable(result)
+ if type(result) == "table" then
+ for i=1,#result do
+ print(result[i])
+ end
+ end
+end
+
if argument("exporthelp") then
application.export(environment.argument("exporthelp"),target)
elseif argument("filetypes") or argument("formats") then
print(table.concat(kpse.get_file_types()," "))
elseif type(target) == "string" and target ~= "" then
- if argument("findfile") or argument("find-file") then
+ if argument("findfiles") or argument("find-files") then
+ printtable(kpse.find_files(argument("path"),target))
+ elseif argument("findfile") or argument("find-file") then
print(kpse.find_file(target,argument("format")))
elseif argument("expandpath") or argument("expand-path") then
- print(kpse.expand_path(target))
+ local result = kpse.expand_path(target)
+ if result and argument("split") then
+ printtable(string.split(result,";"))
+ else
+ print(result)
+ end
elseif argument("expandvar") or argument("expand-var") then
print(kpse.expand_var(target))
elseif argument("expandbraces") or argument("expand-braces") then
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index b683bc729..4f5a11f7e 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -25630,7 +25630,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5950, stripped down to: 3737
+-- original size: 6287, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25640,7 +25640,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25774,6 +25774,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
end
end
+local dofile=dofile
+local savedrequire=require
+function require(name,version)
+ if find(name,"%.lua$") or find(name,"%.lmt$") then
+ local m=dofile(findfile(name))
+ if m then
+ package.loaded[name]=m
+ return m
+ end
+ else
+ return savedrequire(name)
+ end
+end
end -- of closure
@@ -26215,8 +26228,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1041889
--- stripped bytes : 411275
+-- original bytes : 1042226
+-- stripped bytes : 411343
-- end library merge
@@ -26871,12 +26884,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index b683bc729..4f5a11f7e 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -25630,7 +25630,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5950, stripped down to: 3737
+-- original size: 6287, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25640,7 +25640,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25774,6 +25774,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
end
end
+local dofile=dofile
+local savedrequire=require
+function require(name,version)
+ if find(name,"%.lua$") or find(name,"%.lmt$") then
+ local m=dofile(findfile(name))
+ if m then
+ package.loaded[name]=m
+ return m
+ end
+ else
+ return savedrequire(name)
+ end
+end
end -- of closure
@@ -26215,8 +26228,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1041889
--- stripped bytes : 411275
+-- original bytes : 1042226
+-- stripped bytes : 411343
-- end library merge
@@ -26871,12 +26884,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index b683bc729..4f5a11f7e 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -25630,7 +25630,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5950, stripped down to: 3737
+-- original size: 6287, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25640,7 +25640,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25774,6 +25774,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
end
end
+local dofile=dofile
+local savedrequire=require
+function require(name,version)
+ if find(name,"%.lua$") or find(name,"%.lmt$") then
+ local m=dofile(findfile(name))
+ if m then
+ package.loaded[name]=m
+ return m
+ end
+ else
+ return savedrequire(name)
+ end
+end
end -- of closure
@@ -26215,8 +26228,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1041889
--- stripped bytes : 411275
+-- original bytes : 1042226
+-- stripped bytes : 411343
-- end library merge
@@ -26871,12 +26884,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index b683bc729..4f5a11f7e 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -25630,7 +25630,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5950, stripped down to: 3737
+-- original size: 6287, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25640,7 +25640,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25774,6 +25774,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
end
end
+local dofile=dofile
+local savedrequire=require
+function require(name,version)
+ if find(name,"%.lua$") or find(name,"%.lmt$") then
+ local m=dofile(findfile(name))
+ if m then
+ package.loaded[name]=m
+ return m
+ end
+ else
+ return savedrequire(name)
+ end
+end
end -- of closure
@@ -26215,8 +26228,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1041889
--- stripped bytes : 411275
+-- original bytes : 1042226
+-- stripped bytes : 411343
-- end library merge
@@ -26871,12 +26884,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)