@@ -233,11 +233,11 @@ M.BulletList = M.Block:create_constructor(
233233--- Creates a code block element
234234-- @function CodeBlock
235235-- @tparam string text code string
236−-- @tparam[opt] Attr attributes element attributes
236+-- @tparam[opt] Attr attr element attributes
237237-- @treturn Block code block element
238238M.CodeBlock = M.Block:create_constructor(
239239 "CodeBlock",
240− function(text, attributes) return {c = {attributes, text}} end,
240+ function(text, attr) return {c = {attr or M.Attr(), text}} end,
241241 {{"identifier", "classes", "attributes"}, "text"}
242242)
243243
@@ -254,11 +254,13 @@ M.DefinitionList = M.Block:create_constructor(
254254--- Creates a div element
255255-- @function Div
256256-- @tparam {Block,...} content block content
257−-- @tparam[opt] Attr attributes element attributes
257+-- @tparam[opt] Attr attr element attributes
258258-- @treturn Block code block element
259259M.Div = M.Block:create_constructor(
260260 "Div",
261− function(content, attributes) return {c = {attributes, content}} end,
261+ function(content, attr)
262+ return {c = {attr or M.Attr(), content}}
263+ end,
262264 {{"identifier", "classes", "attributes"}, "content"}
263265)
264266
@@ -266,12 +268,12 @@ M.Div = M.Block:create_constructor(
266268-- @function Header
267269-- @tparam int level header level
268270-- @tparam {Inline,...} content inline content
269−-- @tparam Attr attributes element attributes
271+-- @tparam[opt] Attr attr element attributes
270272-- @treturn Block header element
271273M.Header = M.Block:create_constructor(
272274 "Header",
273− function(level, content, attributes)
274− return {c = {level, attributes, content}}
275+ function(level, content, attr)
276+ return {c = {level, attr or M.Attr(), content}}
275277 end,
276278 {"level", {"identifier", "classes", "attributes"}, "content"}
277279)
@@ -386,11 +388,11 @@ M.Cite = M.Inline:create_constructor(
386388--- Creates a Code inline element
387389-- @function Code
388390-- @tparam string text brief image description
389−-- @tparam[opt] Attr attributes additional attributes
391+-- @tparam[opt] Attr attr additional attributes
390392-- @treturn Inline code element
391393M.Code = M.Inline:create_constructor(
392394 "Code",
393− function(text, attributes) return {c = {attributes, text}} end,
395+ function(text, attr) return {c = {attr or M.Attr(), text}} end,
394396 {{"identifier", "classes", "attributes"}, "text"}
395397)
396398
@@ -409,14 +411,14 @@ M.Emph = M.Inline:create_constructor(
409411-- @tparam {Inline,..} caption text used to describe the image
410412-- @tparam string src path to the image file
411413-- @tparam[opt] string title brief image description
412−-- @tparam[opt] Attr attributes additional attributes
414+-- @tparam[opt] Attr attr additional attributes
413415-- @treturn Inline image element
414416M.Image = M.Inline:create_constructor(
415417 "Image",
416− function(caption, src, title, attributes)
418+ function(caption, src, title, attr)
417419 title = title or ""
418− attributes = attributes or Attribute.empty
419− return {c = {attributes, caption, {src, title}}}
420+ attr = attr or M.Attr()
421+ return {c = {attr, caption, {src, title}}}
420422 end,
421423 {"attributes", "caption", {"src", "title"}}
422424)
@@ -434,14 +436,14 @@ M.LineBreak = M.Inline:create_constructor(
434436-- @tparam {Inline,..} content text for this link
435437-- @tparam string target the link target
436438-- @tparam[opt] string title brief link description
437−-- @tparam[opt] Attr attributes additional attributes
439+-- @tparam[opt] Attr attr additional attributes
438440-- @treturn Inline image element
439441M.Link = M.Inline:create_constructor(
440442 "Link",
441− function(content, target, title, attributes)
443+ function(content, target, title, attr)
442444 title = title or ""
443− attributes = attributes or Attribute.empty
444− return {c = {attributes, content, {target, title}}}
445+ attr = attr or M.Attr()
446+ return {c = {attr, content, {target, title}}}
445447 end,
446448 {"attributes", "content", {"target", "title"}}
447449)
@@ -560,11 +562,11 @@ M.Space = M.Inline:create_constructor(
560562--- Creates a Span inline element
561563-- @function Span
562564-- @tparam {Inline,..} content inline content
563−-- @tparam[opt] Attr attributes additional attributes
565+-- @tparam[opt] Attr attr additional attributes
564566-- @treturn Inline span element
565567M.Span = M.Inline:create_constructor(
566568 "Span",
567− function(content, attributes) return {c = {attributes, content}} end,
569+ function(content, attr) return {c = {attr or M.Attr(), content}} end,
568570 {{"identifier", "classes", "attributes"}, "content"}
569571)
570572