summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-01-09 19:44:42 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2018-01-09 19:44:42 +0100
commitf5e021998efcebb32d03bd03ace57c825f55a20d (patch)
treef92fdade2ada8bf257a97593882b017ece76e961 /data
parentbf944e0aeb60ed831549b7dce485e703dc8363c9 (diff)
data/pandoc.lua: fix access to Attr components
Accessing an Attr value (e.g., ` Attr().classes`) was broken; the more common case of accessing it via an Inline or Block element was unaffected by this.
Diffstat (limited to 'data')
-rw-r--r--data/pandoc.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index 44b8b0f1b..b3cee4670 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -62,7 +62,6 @@ local function create_accessor_functions (fn_template, accessors)
if type(acc) == "string" then
res[acc] = make_indexing_function(fn_template, {...})
else
- local unpack = table.unpack or unpack
for i = 1, #(acc or {}) do
add_accessors(acc[i], i, ...)
end
@@ -802,13 +801,12 @@ function M.Attr:new (identifier, classes, attributes)
end
M.Attr.behavior._field_names = {identifier = 1, classes = 2, attributes = 3}
M.Attr.behavior.__index = function(t, k)
- return rawget(t, k) or
- rawget(t, M.Attr._field_names[k]) or
- rawget(getmetatable(t), k)
+ return rawget(t, getmetatable(t)._field_names[k]) or
+ getmetatable(t)[k]
end
M.Attr.behavior.__newindex = function(t, k, v)
- if M.Attr._field_names[k] then
- rawset(t, M.Attr._field_names[k], v)
+ if getmetatable(t)._field_names[k] then
+ rawset(t, getmetatable(t)._field_names[k], v)
else
rawset(t, k, v)
end