summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-04-19 03:00:52 +0000
committerNorbert Preining <norbert@preining.info>2022-04-19 03:00:52 +0000
commitb0321ddd75259a36e909f25b3abc711dc1732c28 (patch)
tree9d7eac714004161e47b1bd11a37c3401c7a245ba /macros/luatex/latex/luamathalign/luamathalign-luaprop.lua
parenta7538780c749168835167a8d30aa65779c89407a (diff)
CTAN sync 202204190300
Diffstat (limited to 'macros/luatex/latex/luamathalign/luamathalign-luaprop.lua')
-rw-r--r--macros/luatex/latex/luamathalign/luamathalign-luaprop.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua b/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua
new file mode 100644
index 0000000000..3e10f0fc45
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua
@@ -0,0 +1,42 @@
+----Copyright (C) 2019--2022 by Marcel Krueger
+---
+--- This file may be distributed and/or modified under the
+--- conditions of the LaTeX Project Public License, either
+--- version 1.3c of this license or (at your option) any later
+--- version. The latest version of this license is in:
+---
+--- http://www.latex-project.org/lppl.txt
+---
+--- and version 1.3 or later is part of all distributions of
+--- LaTeX version 2005/12/01 or later.
+return function(namespace)
+ return {
+ query = function(n)
+ local p = node.getproperty(n)
+ return p and p[namespace]
+ end,
+ get = function(n, ...)
+ local p = node.getproperty(n)
+ if not p then
+ p = {}
+ node.setproperty(n, p)
+ end
+ local n = p[namespace]
+ if nil == p[namespace] then
+ local d = select('#', ...) ~= 0 and ... or {}
+ n, p[namespace] = d, d
+ end
+ return n
+ end,
+ set = function(n, v)
+ local p = node.getproperty(n)
+ if not p then
+ p = {}
+ node.setproperty(n, p)
+ end
+ local old = p[namespace]
+ p[namespace] = v
+ return old
+ end,
+ }
+end