@@ -26,60 +26,6 @@ local M = {
26 _VERSION = "0.2.0"
26 _VERSION = "0.2.0"
32−setmetatable(M.Attributes, M.Attributes)
34−M.Attributes.__index = function(t, k)
37− elseif k == "class" then
38− return table.concat(t[2], ' ')
44−--- Create a new set of attributes (Attr).
45−-- @function Attributes
46−M.Attributes.__call = function(t, key_values, id, classes)
48− for i = 1, #key_values do
49− kv[key_values[i][1]] = key_values[i][2]
52− classes = classes or {}
53− local attr = {id, classes, key_values, kv = kv}
54− setmetatable(attr, t)
57−M.Attributes.empty = M.Attributes('', {}, {})
60−--- Creates a single citation.
62−-- @tparam string id citation identifier (like a bibtex key)
63−-- @tparam AuthorInText|SuppressAuthor|NormalCitation mode citation mode
64−-- @tparam[opt] {Inline,...} prefix citation prefix
65−-- @tparam[opt] {Inline,...} suffix citation suffix
66−-- @tparam[opt] int note_num note number
67−-- @tparam[opt] int note_num hash number
68−M.Citation = function(id, mode, prefix, suffix, note_num, hash)
69− prefix = prefix or {}
70− suffix = suffix or {}
71− note_num = note_num or 0
75− citationPrefix = prefix,
76− citationSuffix = suffix,
78− citationNoteNum = note_num,
83------------------------------------------------------------------------
29------------------------------------------------------------------------
84-- The base class for pandoc's AST elements.
30-- The base class for pandoc's AST elements.
85-- @type Element
31-- @type Element
@@ -211,9 +157,10 @@ for i = 1, #M.meta_value_types do
213------------------------------------------------------------------------
159------------------------------------------------------------------------
214−-- Block
160+-- Blocks
215-- @section Block
161-- @section Block
217M.Block = Element:make_subtype{}
164M.Block = Element:make_subtype{}
218M.Block.__call = function (t, ...)
165M.Block.__call = function (t, ...)
219 return t:new(...)
166 return t:new(...)
@@ -598,23 +545,67 @@ M.Superscript = M.Inline:create_constructor(
600------------------------------------------------------------------------
547------------------------------------------------------------------------
601−-- Constants
548+-- Helpers
602−-- @section constants
549+-- @section helpers
604−--- Math content is to be displayed on a separate line.
551+-- Attributes
605−-- @see Math
552+M.Attributes = {}
606−M.DisplayMath = "DisplayMath"
553+setmetatable(M.Attributes, M.Attributes)
607−--- Math content is to be displayed inline within the paragraph
554+M.Attributes.__index = function(t, k)
608−-- @see Math
555+ if k == "id" then
609−M.InlineMath = "InlineMath"
556+ return t[1]
557+ elseif k == "class" then
558+ return table.concat(t[2], ' ')
563+--- Create a new set of attributes (Attr).
564+-- @function Attributes
565+-- @tparam table key_values table containing string keys and values
566+-- @tparam[opt] string id element identifier
567+-- @tparam[opt] {string,...} classes element classes
568+-- @return element attributes
569+M.Attributes.__call = function(t, key_values, id, classes)
571+ for i = 1, #key_values do
572+ kv[key_values[i][1]] = key_values[i][2]
575+ classes = classes or {}
576+ local attr = {id, classes, key_values, kv = kv}
577+ setmetatable(attr, t)
580+M.Attributes.empty = M.Attributes('', {}, {})
611−--- Double quoted content.
582+--- Creates a single citation.
612−-- @see Quoted
583+-- @function Citation
613−M.DoubleQuote = "DoubleQuote"
584+-- @tparam string id citation identifier (like a bibtex key)
585+-- @tparam AuthorInText|SuppressAuthor|NormalCitation mode citation mode
586+-- @tparam[opt] {Inline,...} prefix citation prefix
587+-- @tparam[opt] {Inline,...} suffix citation suffix
588+-- @tparam[opt] int note_num note number
589+-- @tparam[opt] int note_num hash number
590+M.Citation = function(id, mode, prefix, suffix, note_num, hash)
591+ prefix = prefix or {}
592+ suffix = suffix or {}
593+ note_num = note_num or 0
597+ citationPrefix = prefix,
598+ citationSuffix = suffix,
599+ citationMode = mode,
600+ citationNoteNum = note_num,
601+ citationHash = hash,
615−--- Single quoted content.
605+
616−-- @see Quoted
606+------------------------------------------------------------------------
617−M.SingleQuote = "SingleQuote"
607+-- Constants
608+-- @section constants
619--- Author name is mentioned in the text.
610--- Author name is mentioned in the text.
620-- @see Citation
611-- @see Citation