diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-06 23:25:08 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-06 23:25:08 +0100 |
commit | f492f5a6dd991530241529d1110e73260d3a1d43 (patch) | |
tree | 3fad1e71d0802335f4727644a4ad40eef3b51a0b /data | |
parent | 3a22907306992f2dd1b6bcb548633734c0c9a1b1 (diff) | |
download | pandoc-f492f5a6dd991530241529d1110e73260d3a1d43.tar.gz |
data/pandoc.lua: fix Element inheritance
Extending all elements of a given type (e.g., all inline elements) was
difficult, as the table used to lookup unknown methods would be reset
every time a new element of that type was created, preventing recursive
property lookup. This is was changed in that all methods and attributes
of supertypes are now available to their subtypes.
Diffstat (limited to 'data')
-rw-r--r-- | data/pandoc.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua index 86bb5b8ea..d96d5e702 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -33,13 +33,15 @@ local List = require 'pandoc.List' -- @type Element -- @local local Element = {} +Element.__index = Element --- Create a new element subtype -- @local function Element:make_subtype(o) o = o or {} setmetatable(o, self) - self.__index = self + -- Make subtype usable as a metatable + o.__index = o return o end @@ -57,7 +59,6 @@ function Element:new(tag, ...) element.c = content end setmetatable(element, self) - self.__index = self return element end |