git.iko.soy/typeable/pandoc
on master help sign in
data/pandoc.lua: regularize constructors.
0f658ebJohn MacFarlane
data/pandoc.lua+10−11
@@ -23,7 +23,7 @@ THIS SOFTWARE.
23-- @copyright © 2017 Albert Krewinkel
23-- @copyright © 2017 Albert Krewinkel
24-- @license MIT
24-- @license MIT
25local M = {
25local M = {
26− _VERSION = "0.2.0"
26+ _VERSION = "0.3.0"
27}
27}
28
28
29------------------------------------------------------------------------
29------------------------------------------------------------------------
@@ -137,7 +137,7 @@ end
137-- @function Doc
137-- @function Doc
138-- @tparam {Block,...} blocks document content
138-- @tparam {Block,...} blocks document content
139-- @tparam[opt] Meta meta document meta data
139-- @tparam[opt] Meta meta document meta data
140−function M.Doc(blocks, meta)
140+function M.Pandoc(blocks, meta)
141 meta = meta or {}
141 meta = meta or {}
142 return {
142 return {
143 ["blocks"] = blocks,
143 ["blocks"] = blocks,
@@ -146,6 +146,8 @@ function M.Doc(blocks, meta)
146 }
146 }
147end
147end
148
148
149+-- DEPRECATED synonym:
150+M.Doc = M.Pandoc
149
151
150------------------------------------------------------------------------
152------------------------------------------------------------------------
151-- MetaValue
153-- MetaValue
@@ -449,8 +451,7 @@ M.Link = M.Inline:create_constructor(
449 {"attributes", "content", {"target", "title"}}
451 {"attributes", "content", {"target", "title"}}
450)
452)
451
453
452−--- Creates a Math element, either inline or displayed. It is usually simpler to
454+--- Creates a Math element, either inline or displayed.
453−-- use one of the specialized functions @{InlineMath} or @{DisplayMath} instead.
454-- @function Math
455-- @function Math
455-- @tparam "InlineMath"|"DisplayMath" mathtype rendering specifier
456-- @tparam "InlineMath"|"DisplayMath" mathtype rendering specifier
456-- @tparam string text Math content
457-- @tparam string text Math content
@@ -462,7 +463,7 @@ M.Math = M.Inline:create_constructor(
462 end,
463 end,
463 {"mathtype", "text"}
464 {"mathtype", "text"}
464)
465)
465−--- Creates a DisplayMath element.
466+--- Creates a DisplayMath element (DEPRECATED).
466-- @function DisplayMath
467-- @function DisplayMath
467-- @tparam string text Math content
468-- @tparam string text Math content
468-- @treturn Inline Math element
469-- @treturn Inline Math element
@@ -471,7 +472,7 @@ M.DisplayMath = M.Inline:create_constructor(
471 function(text) return M.Math("DisplayMath", text) end,
472 function(text) return M.Math("DisplayMath", text) end,
472 {"mathtype", "text"}
473 {"mathtype", "text"}
473)
474)
474−--- Creates an InlineMath inline element.
475+--- Creates an InlineMath inline element (DEPRECATED).
475-- @function InlineMath
476-- @function InlineMath
476-- @tparam string text Math content
477-- @tparam string text Math content
477-- @treturn Inline Math element
478-- @treturn Inline Math element
@@ -490,9 +491,7 @@ M.Note = M.Inline:create_constructor(
490 "content"
491 "content"
491)
492)
492
493
493−--- Creates a Quoted inline element given the quote type and quoted content. It
494+--- Creates a Quoted inline element given the quote type and quoted content.
494−-- is usually simpler to use one of the specialized functions @{SingleQuoted} or
495−-- @{DoubleQuoted} instead.
496-- @function Quoted
495-- @function Quoted
497-- @tparam "DoubleQuote"|"SingleQuote" quotetype type of quotes to be used
496-- @tparam "DoubleQuote"|"SingleQuote" quotetype type of quotes to be used
498-- @tparam {Inline,..} content inline content
497-- @tparam {Inline,..} content inline content
@@ -502,7 +501,7 @@ M.Quoted = M.Inline:create_constructor(
502 function(quotetype, content) return {c = {quotetype, content}} end,
501 function(quotetype, content) return {c = {quotetype, content}} end,
503 {"quotetype", "content"}
502 {"quotetype", "content"}
504)
503)
505−--- Creates a single-quoted inline element.
504+--- Creates a single-quoted inline element (DEPRECATED).
506-- @function SingleQuoted
505-- @function SingleQuoted
507-- @tparam {Inline,..} content inline content
506-- @tparam {Inline,..} content inline content
508-- @treturn Inline quoted element
507-- @treturn Inline quoted element
@@ -512,7 +511,7 @@ M.SingleQuoted = M.Inline:create_constructor(
512 function(content) return M.Quoted(M.SingleQuote, content) end,
511 function(content) return M.Quoted(M.SingleQuote, content) end,
513 {"quotetype", "content"}
512 {"quotetype", "content"}
514)
513)
515−--- Creates a single-quoted inline element.
514+--- Creates a single-quoted inline element (DEPRECATED).
516-- @function DoubleQuoted
515-- @function DoubleQuoted
517-- @tparam {Inline,..} content inline content
516-- @tparam {Inline,..} content inline content
518-- @treturn Inline quoted element
517-- @treturn Inline quoted element
test/lua/hello-world-doc.lua+2−2
@@ -1,10 +1,10 @@
1return {
1return {
2 {
2 {
3− Doc = function(doc)
3+ Pandoc = function(doc)
4 local meta = {}
4 local meta = {}
5 local hello = { pandoc.Str "Hello,", pandoc.Space(), pandoc.Str "World!" }
5 local hello = { pandoc.Str "Hello,", pandoc.Space(), pandoc.Str "World!" }
6 local blocks = { pandoc.Para(hello) }
6 local blocks = { pandoc.Para(hello) }
7− return pandoc.Doc(blocks, meta)
7+ return pandoc.Pandoc(blocks, meta)
8 end
8 end
9 }
9 }
10}
10}
test/lua/implicit-doc-filter.lua+1−1
@@ -2,5 +2,5 @@ function Doc (doc)
2 local meta = {}
2 local meta = {}
3 local hello = { pandoc.Str "Hello,", pandoc.Space(), pandoc.Str "World!" }
3 local hello = { pandoc.Str "Hello,", pandoc.Space(), pandoc.Str "World!" }
4 local blocks = { pandoc.Para(hello) }
4 local blocks = { pandoc.Para(hello) }
5− return pandoc.Doc(blocks, meta)
5+ return pandoc.Pandoc(blocks, meta)
6end
6end