@@ -173,18 +173,23 @@ end
173173--- Meta blocks
174174-- @function MetaBlocks
175175-- @tparam {Block,...} blocks blocks
176+
176177--- Meta inlines
177178-- @function MetaInlines
178179-- @tparam {Inline,...} inlines inlines
180+
179181--- Meta list
180182-- @function MetaList
181183-- @tparam {MetaValue,...} meta_values list of meta values
184+
182185--- Meta boolean
183186-- @function MetaBool
184187-- @tparam boolean bool boolean value
188+
185189--- Meta map
186190-- @function MetaMap
187191-- @tparam table a string-index map of meta values
192+
188193--- Meta string
189194-- @function MetaString
190195-- @tparam string str string value
@@ -205,17 +210,166 @@ for i = 1, #M.meta_value_types do
205210 )
206211end
207212
208−--- Inline element class
209−-- @type Inline
210−M.Inline = Element:make_subtype{}
211−M.Inline.__call = function (t, ...)
213+------------------------------------------------------------------------
214+-- Block
215+-- @section Block
216+
217+M.Block = Element:make_subtype{}
218+M.Block.__call = function (t, ...)
212219 return t:new(...)
213220end
214221
222+--- Creates a block quote element
223+-- @function BlockQuote
224+-- @tparam {Block,...} content block content
225+-- @treturn Block block quote element
226+M.BlockQuote = M.Block:create_constructor(
227+ "BlockQuote",
228+ function(content) return {c = content} end
229+)
230+
231+--- Creates a bullet (i.e. unordered) list.
232+-- @function BulletList
233+-- @tparam {{Block,...},...} content list of items
234+-- @treturn Block block quote element
235+M.BulletList = M.Block:create_constructor(
236+ "BulletList",
237+ function(content) return {c = content} end
238+)
239+
240+--- Creates a code block element
241+-- @function CodeBlock
242+-- @tparam string code code string
243+-- @tparam[opt] Attributes attributes element attributes
244+-- @treturn Block code block element
245+M.CodeBlock = M.Block:create_constructor(
246+ "CodeBlock",
247+ function(code, attributes) return {c = {attributes, code}} end
248+)
249+
250+--- Creates a definition list, containing terms and their explanation.
251+-- @function DefinitionList
252+-- @tparam {{{Inline,...},{Block,...}},...} content list of items
253+-- @treturn Block block quote element
254+M.DefinitionList = M.Block:create_constructor(
255+ "DefinitionList",
256+ function(content) return {c = content} end
257+)
258+
259+--- Creates a div element
260+-- @function Div
261+-- @tparam {Block,...} content block content
262+-- @tparam[opt] Attributes attributes element attributes
263+-- @treturn Block code block element
264+M.Div = M.Block:create_constructor(
265+ "Div",
266+ function(content, attributes) return {c = {attributes, content}} end
267+)
268+
269+--- Creates a block quote element.
270+-- @function Header
271+-- @tparam int level header level
272+-- @tparam Attributes attributes element attributes
273+-- @tparam {Inline,...} content inline content
274+-- @treturn Block header element
275+M.Header = M.Block:create_constructor(
276+ "Header",
277+ function(level, attributes, content)
278+ return {c = {level, attributes, content}}
279+ end
280+)
281+
282+--- Creates a horizontal rule.
283+-- @function HorizontalRule
284+-- @treturn Block horizontal rule
285+M.HorizontalRule = M.Block:create_constructor(
286+ "HorizontalRule",
287+ function() return {} end
288+)
289+
290+--- Creates a line block element.
291+-- @function LineBlock
292+-- @tparam {{Inline,...},...} content inline content
293+-- @treturn Block block quote element
294+M.LineBlock = M.Block:create_constructor(
295+ "LineBlock",
296+ function(content) return {c = content} end
297+)
298+
299+--- Creates a null element.
300+-- @function Null
301+-- @treturn Block null element
302+M.Null = M.Block:create_constructor(
303+ "Null",
304+ function() return {} end
305+)
306+
307+--- Creates an ordered list.
308+-- @function OrderedList
309+-- @tparam {{Block,...},...} items list items
310+-- @param[opt] listAttributes list parameters
311+-- @treturn Block
312+M.OrderedList = M.Block:create_constructor(
313+ "OrderedList",
314+ function(items, listAttributes)
315+ return {c = {listAttributes,items}}
316+ end
317+)
318+
319+--- Creates a para element.
320+-- @function Para
321+-- @tparam {Inline,...} content inline content
322+-- @treturn Block block quote element
323+M.Para = M.Block:create_constructor(
324+ "Para",
325+ function(content) return {c = content} end
326+)
327+
328+--- Creates a plain element.
329+-- @function Plain
330+-- @tparam {Inline,...} content inline content
331+-- @treturn Block block quote element
332+M.Plain = M.Block:create_constructor(
333+ "Plain",
334+ function(content) return {c = content} end
335+)
336+
337+--- Creates a raw content block of the specified format.
338+-- @function RawBlock
339+-- @tparam string format format of content
340+-- @tparam string content string content
341+-- @treturn Block block quote element
342+M.RawBlock = M.Block:create_constructor(
343+ "RawBlock",
344+ function(format, content) return {c = {format, content}} end
345+)
346+
347+--- Creates a table element.
348+-- @function Table
349+-- @tparam {Inline,...} caption table caption
350+-- @tparam {AlignDefault|AlignLeft|AlignRight|AlignCenter,...} aligns alignments
351+-- @tparam {int,...} widths column widths
352+-- @tparam {Block,...} headers header row
353+-- @tparam {{Block,...}} rows table rows
354+-- @treturn Block block quote element
355+M.Table = M.Block:create_constructor(
356+ "Table",
357+ function(caption, aligns, widths, headers, rows)
358+ return {c = {caption, aligns, widths, headers, rows}}
359+ end
360+)
361+
362+
215363------------------------------------------------------------------------
216364-- Inline
217365-- @section Inline
218366
367+--- Inline element class
368+M.Inline = Element:make_subtype{}
369+M.Inline.__call = function (t, ...)
370+ return t:new(...)
371+end
372+
219373--- Creates a Cite inline element
220374-- @function Cite
221375-- @tparam {Inline,...} content List of inlines
@@ -405,42 +559,6 @@ M.Superscript = M.Inline:create_constructor(
405559)
406560
407561
408−------------------------------------------------------------------------
409−-- Block elements
410−-- @type Block
411−M.Block = Element:make_subtype{}
412−
413−--- Block constructors
414−M.Block.constructors = {
415− BlockQuote = true,
416− BulletList = true,
417− CodeBlock = true,
418− DefinitionList = true,
419− Div = true,
420− Header = true,
421− HorizontalRule = true,
422− HorizontalRule = true,
423− LineBlock = true,
424− Null = true,
425− OrderedList = true,
426− Para = true,
427− Plain = true,
428− RawBlock = true,
429− Table = true,
430−}
431−
432−local set_of_inline_types = {}
433−for k, _ in pairs(M.Inline.constructor) do
434− set_of_inline_types[k] = true
435−end
436−
437−for block_type, _ in pairs(M.Block.constructors) do
438− M[block_type] = function(...)
439− return M.Block:new(block_type, ...)
440− end
441−end
442−
443−
444562------------------------------------------------------------------------
445563-- Constants
446564-- @section constants
@@ -482,6 +600,81 @@ M.SuppressAuthor.t = "SuppressAuthor"
482600M.NormalCitation = {}
483601M.NormalCitation.t = "NormalCitation"
484602
603+--- Table cells aligned left.
604+-- @see Table
605+M.AlignLeft = {}
606+M.AlignLeft.t = "AlignLeft"
607+
608+--- Table cells right-aligned.
609+-- @see Table
610+M.AlignRight = {}
611+M.AlignRight.t = "AlignRight"
612+
613+--- Table cell content is centered.
614+-- @see Table
615+M.AlignCenter = {}
616+M.AlignCenter.t = "AlignCenter"
617+
618+--- Table cells are alignment is unaltered.
619+-- @see Table
620+M.AlignDefault = {}
621+M.AlignDefault.t = "AlignDefault"
622+
623+--- Default list number delimiters are used.
624+-- @see OrderedList
625+M.DefaultDelim = {}
626+M.DefaultDelim.t = "DefaultDelim"
627+
628+--- List numbers are delimited by a period.
629+-- @see OrderedList
630+M.Period = {}
631+M.Period.t = "Period"
632+
633+--- List numbers are delimited by a single parenthesis.
634+-- @see OrderedList
635+M.OneParen = {}
636+M.OneParen.t = "OneParen"
637+
638+--- List numbers are delimited by a double parentheses.
639+-- @see OrderedList
640+M.TwoParens = {}
641+M.TwoParens.t = "TwoParens"
642+
643+--- List are numbered in the default style
644+-- @see OrderedList
645+M.DefaultStyle = {}
646+M.DefaultStyle.t = "DefaultStyle"
647+
648+--- List items are numbered as examples.
649+-- @see OrderedList
650+M.Example = {}
651+M.Example.t = "Example"
652+
653+--- List are numbered using decimal integers.
654+-- @see OrderedList
655+M.Decimal = {}
656+M.Decimal.t = "Decimal"
657+
658+--- List are numbered using lower-case roman numerals.
659+-- @see OrderedList
660+M.LowerRoman = {}
661+M.LowerRoman.t = "LowerRoman"
662+
663+--- List are numbered using upper-case roman numerals
664+-- @see OrderedList
665+M.UpperRoman = {}
666+M.UpperRoman.t = "UpperRoman"
667+
668+--- List are numbered using lower-case alphabetic characters.
669+-- @see OrderedList
670+M.LowerAlpha = {}
671+M.LowerAlpha.t = "LowerAlpha"
672+
673+--- List are numbered using upper-case alphabetic characters.
674+-- @see OrderedList
675+M.UpperAlpha = {}
676+M.UpperAlpha.t = "UpperAlpha"
677+
485678
486679------------------------------------------------------------------------
487680-- Helper Functions
@@ -503,7 +696,7 @@ M.NormalCitation.t = "NormalCitation"
503696function M.global_filter()
504697 local res = {}
505698 for k, v in pairs(_G) do
506− if M.Inline.constructor[k] or M.Block.constructors[k] or k == "Doc" then
699+ if M.Inline.constructor[k] or M.Block.constructor[k] or M.Block.constructors[k] or k == "Doc" then
507700 res[k] = v
508701 end
509702 end