summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/penlightplus/penlightplus.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/penlightplus/penlightplus.lua')
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/macros/luatex/generic/penlightplus/penlightplus.lua b/macros/luatex/generic/penlightplus/penlightplus.lua
index 1f74d45777..84cd2094ff 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.lua
+++ b/macros/luatex/generic/penlightplus/penlightplus.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2023-09-04
+--% 2023-11-25
--% Copyright (C) 2021-2023 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -449,6 +449,10 @@ function str_mt.__index.trimfl(str)
return str:sub(2,-2)
end
+function str_mt.__index.subpar(s, r)
+ r = r or ' '
+ return (s:gsub('\\par', r))
+end
-- -- -- -- function stuff
@@ -802,6 +806,7 @@ function penlight.get_tbl_index(s)
return tbl, key
end
+
function penlight.get_tbl_item(s, p) -- get item with string, p means print value
p = p or false
local tbl, key = penlight.get_tbl_index(s)
@@ -840,6 +845,18 @@ function penlight.check_recent_tbl_undefault()
end
+penlight.tbl_xysep = '%s+' -- spaces separate x-y coords
+function penlight.def_tbl_coords(str, def)
+ -- todo could definitely make this flexible for a table...
+ local x, y = str:strip():splitv(penlight.tbl_xysep)
+ --if (~penlight.hasval(x)) or (~penlight.hasval(y)) then
+ -- penlight.tex.pkgerror('penlightplus', 'def_tbl_coords function could not parse coordiantes given as "'..str..'" ensure two numbers separated by space are given!', '', true)
+ --end
+ token.set_macro(def..'x', tostring(x))
+ token.set_macro(def..'y', tostring(y))
+end
+
+
if penlight.hasval(__PL_GLOBALS__) then
-- iterators
kpairs = penlight.utils.kpairs