@@ -28,6 +28,7 @@ local M = {}
2828M.List = require 'pandoc.List'
2929M.mediabag = require 'pandoc.mediabag'
3030M.system = require 'pandoc.system'
31+M.types = require 'pandoc.types'
3132M.utils = require 'pandoc.utils'
3233M.text = require 'text'
3334
@@ -280,6 +281,7 @@ end
280281-- @tparam {Block,...} blocks document content
281282-- @tparam[opt] Meta meta document meta data
282283M.Pandoc = AstElement:make_subtype'Pandoc'
284+M.Pandoc.behavior.clone = M.types.clone.Pandoc
283285function M.Pandoc:new (blocks, meta)
284286 return {
285287 blocks = ensureList(blocks),
@@ -299,6 +301,7 @@ M.Doc = M.Pandoc
299301-- @function Meta
300302-- @tparam meta table table containing document meta information
301303M.Meta = AstElement:make_subtype'Meta'
304+M.Meta.behavior.clone = M.types.clone.Meta
302305function M.Meta:new (meta) return meta end
303306
304307
@@ -306,6 +309,7 @@ function M.Meta:new (meta) return meta end
306309-- MetaValue
307310-- @section MetaValue
308311M.MetaValue = AstElement:make_subtype('MetaValue')
312+M.MetaValue.behavior.clone = M.types.clone.MetaValue
309313
310314--- Meta blocks
311315-- @function MetaBlocks
@@ -369,6 +373,7 @@ end
369373
370374--- Block elements
371375M.Block = AstElement:make_subtype'Block'
376+M.Block.behavior.clone = M.types.clone.Block
372377
373378--- Creates a block quote element
374379-- @function BlockQuote
@@ -542,6 +547,7 @@ M.Table = M.Block:create_constructor(
542547
543548--- Inline element class
544549M.Inline = AstElement:make_subtype'Inline'
550+M.Inline.behavior.clone = M.types.clone.Inline
545551
546552--- Creates a Cite inline element
547553-- @function Cite
@@ -898,6 +904,7 @@ function M.Attr:new (identifier, classes, attributes)
898904 attributes = setmetatable(to_alist(attributes or {}), AttributeList)
899905 return {identifier, classes, attributes}
900906end
907+M.Attr.behavior.clone = M.types.clone.Attr
901908M.Attr.behavior._field_names = {identifier = 1, classes = 2, attributes = 3}
902909M.Attr.behavior.__eq = utils.equals
903910M.Attr.behavior.__index = function(t, k)
@@ -922,6 +929,7 @@ end
922929
923930-- Citation
924931M.Citation = AstElement:make_subtype'Citation'
932+M.Citation.behavior.clone = M.types.clone.Citation
925933
926934--- Creates a single citation.
927935-- @function Citation
@@ -944,6 +952,7 @@ end
944952
945953-- ListAttributes
946954M.ListAttributes = AstElement:make_subtype 'ListAttributes'
955+M.ListAttributes.behavior.clone = M.types.clone.ListAttributes
947956
948957--- Creates a set of list attributes.
949958-- @function ListAttributes