summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl')
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/grph-inc.lmt5
-rw-r--r--tex/context/base/mkxl/mlib-lmt.lmt6
-rw-r--r--tex/context/base/mkxl/mlib-scn.lmt34
-rw-r--r--tex/context/base/mkxl/mlib-svg.lmt15
6 files changed, 54 insertions, 10 deletions
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 3fedf6b5b..c4718ba92 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.07.22 19:11}
+\newcontextversion{2021.07.23 18:50}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index b517cf7b9..c8c14a6b1 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2021.07.22 19:11}
+\immutable\edef\contextversion{2021.07.23 18:50}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt
index 4ac980682..d6cfb0d6c 100644
--- a/tex/context/base/mkxl/grph-inc.lmt
+++ b/tex/context/base/mkxl/grph-inc.lmt
@@ -555,6 +555,11 @@ function figures.setpaths(locationset,pathlist)
end
end
end
+ -- new
+ if environment.arguments.path then
+ table.insert(t,1,environment.arguments.path)
+ end
+ --
figure_paths = t
last_pathlist = pathlist
figures.paths = figure_paths
diff --git a/tex/context/base/mkxl/mlib-lmt.lmt b/tex/context/base/mkxl/mlib-lmt.lmt
index 55485e5f8..61d390dc0 100644
--- a/tex/context/base/mkxl/mlib-lmt.lmt
+++ b/tex/context/base/mkxl/mlib-lmt.lmt
@@ -79,6 +79,9 @@ end
function mp.lmt_svg_include()
local labelfile = metapost.getparameter { "labelfile" }
if labelfile and labelfile ~= "" then
+ labelfile = resolvers.findbinfile(labelfile)
+ end
+ if labelfile and labelfile ~= "" then
local labels = table.load(labelfile) -- todo: same path as svg file
if type(labels) == "table" then
for i=1,#labels do
@@ -103,8 +106,9 @@ function mp.lmt_svg_include()
end
local filename = metapost.getparameter { "filename" }
if filename and filename ~= "" then
+ local ok, data = resolvers.loadbinfile(filename)
mpdirect ( metapost.svgtomp {
- data = io.loaddata(filename),
+ data = data,
remap = true,
colormap = colormap,
id = filename,
diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt
index 6032fd861..56fdce0fb 100644
--- a/tex/context/base/mkxl/mlib-scn.lmt
+++ b/tex/context/base/mkxl/mlib-scn.lmt
@@ -550,7 +550,6 @@ local function getparameterdefault()
-- return injectnumeric(0)
return 0
else
- print("LAST",last)
-- return get(last)
return last
end
@@ -765,6 +764,30 @@ function metapost.setparameterset(namespace,t)
namespaces[namespace] = t
end
+function metapost.getparameterpreset(namespace,t)
+ return namespace and presets[namespace] or presets
+end
+
+local function setluaparameter()
+ local namespace = scanstring()
+ local name = scanstring()
+ local value = scanstring()
+ local code = load("return " .. value)
+ if type(code) == "function" then
+ local result = code()
+ if result then
+ local data = namespace and namespaces[namespace] or namespaces
+ data[name] = result
+ else
+ report("no result from lua code: %s",value)
+ end
+ else
+ report("invalid lua code: %s",value)
+ end
+end
+
+registerdirect("setluaparameter", setluaparameter)
+
-- This is an experiment for Alan and me.
do
@@ -890,6 +913,15 @@ do
end
end
+ function metapost.setrecord(name,data)
+ if type(data) == "table" then
+ local index = names[name]
+ if index then
+ records[index] = data
+ end
+ end
+ end
+
function metapost.runinternal(action,index,kind,name)
if action == 0 then
-- allocate
diff --git a/tex/context/base/mkxl/mlib-svg.lmt b/tex/context/base/mkxl/mlib-svg.lmt
index 3e6d68099..862bd1cad 100644
--- a/tex/context/base/mkxl/mlib-svg.lmt
+++ b/tex/context/base/mkxl/mlib-svg.lmt
@@ -1595,9 +1595,10 @@ do
local filename = ref.filename
local fragment = ref.fragment
if filename and filename ~= "" then
- if lfs.isfile(filename) then
- report("loading use file: %s",filename)
- local root = xml.load(filename)
+ local fullname = resolvers.findbinfile(filename)
+ if lfs.isfile(fullname) then
+ report("loading use file: %s",fullname)
+ local root = xml.load(fullname)
res = xmlfirst(root,"**[@id='"..fragment.."']")
if res then
xmlinheritattributes(res,c) -- tricky
@@ -3525,7 +3526,8 @@ do
local bpfactor = number.dimenfactors.bp
function metapost.includesvgfile(filename,offset) -- offset in sp
- if lfs.isfile(filename) then
+ local fullname = resolvers.findbinfile(filename)
+ if lfs.isfile(fullname) then
context.startMPcode("doublefun")
context('draw lmt_svg [ filename = "%s", offset = %N ] ;',filename,(offset or 0)*bpfactor)
context.stopMPcode()
@@ -3553,8 +3555,9 @@ do
function metapost.showsvgpage(data)
local dd = data.data
if not dd then
- local fn = data.filename
- dd = fn and table.load(fn)
+ local filename = data.filename
+ local fullname = filename and resolvers.findbinfile(filename)
+ dd = fullname and table.load(fullname)
end
if type(dd) == "table" then
local comment = data.comment