Lua: simplify and deprecate function pandoc.utils.equals
The function is no longer required for element comparisons; it is now an alias for the `==` operator.
This commit is contained in:
parent
1c389bf6b6
commit
17a32a99a5
4 changed files with 26 additions and 20 deletions
|
@ -6,7 +6,7 @@ constraints: aeson >= 2.0.1.0
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/pandoc/pandoc-lua-marshal
|
location: https://github.com/pandoc/pandoc-lua-marshal
|
||||||
tag: 45e53d9dce37d20f8e30e0d297a43c5b4c4a6831
|
tag: f81ec19006cc4d0476f199d1fb913bac4af0a0d8
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
|
|
|
@ -831,8 +831,8 @@ Usage:
|
||||||
Pandoc document
|
Pandoc document
|
||||||
|
|
||||||
Values of this type can be created with the
|
Values of this type can be created with the
|
||||||
[`pandoc.Pandoc`](#pandoc.pandoc) constructor. Object equality is
|
[`pandoc.Pandoc`](#pandoc.pandoc) constructor. Pandoc values are
|
||||||
determined via [`pandoc.utils.equals`].
|
equal in Lua if and only if they are equal in Haskell.
|
||||||
|
|
||||||
`blocks`
|
`blocks`
|
||||||
: document content ([List] of [Blocks])
|
: document content ([List] of [Blocks])
|
||||||
|
@ -876,8 +876,8 @@ Meta information on a document; string-indexed collection of
|
||||||
[MetaValues].
|
[MetaValues].
|
||||||
|
|
||||||
Values of this type can be created with the
|
Values of this type can be created with the
|
||||||
[`pandoc.Meta`](#pandoc.meta) constructor. Object equality is
|
[`pandoc.Meta`](#pandoc.meta) constructor. Meta values are equal
|
||||||
determined via [`pandoc.utils.equals`].
|
in Lua if and only if they are equal in Haskell.
|
||||||
|
|
||||||
## MetaValue {#type-metavalue}
|
## MetaValue {#type-metavalue}
|
||||||
|
|
||||||
|
@ -909,7 +909,8 @@ or `pandoc.Blocks`.
|
||||||
|
|
||||||
## Block {#type-block}
|
## Block {#type-block}
|
||||||
|
|
||||||
Object equality is determined via [`pandoc.utils.equals`].
|
Block values are equal in Lua if and only if they are equal in
|
||||||
|
Haskell.
|
||||||
|
|
||||||
### Common methods
|
### Common methods
|
||||||
|
|
||||||
|
@ -1292,8 +1293,8 @@ Usage:
|
||||||
|
|
||||||
## Inline {#type-inline}
|
## Inline {#type-inline}
|
||||||
|
|
||||||
Object equality is determined by checking the Haskell
|
Inline values are equal in Lua if and only if they are equal in
|
||||||
representation for equality.
|
Haskell.
|
||||||
|
|
||||||
### Common methods
|
### Common methods
|
||||||
|
|
||||||
|
@ -1741,7 +1742,7 @@ Result:
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
-- returns `pandoc.Inlines{pandoc.SmallCaps('SPQR)}`
|
-- returns `pandoc.Inlines{pandoc.SmallCaps('SPQR')}`
|
||||||
return pandoc.Inlines{pandoc.Emph('spqr')}:walk {
|
return pandoc.Inlines{pandoc.Emph('spqr')}:walk {
|
||||||
Str = function (s) return string.upper(s.text) end,
|
Str = function (s) return string.upper(s.text) end,
|
||||||
Emph = function (e) return pandoc.SmallCaps(e.content) end,
|
Emph = function (e) return pandoc.SmallCaps(e.content) end,
|
||||||
|
@ -1766,7 +1767,8 @@ This also works when using the `attr` setter:
|
||||||
local span = pandoc.Span 'text'
|
local span = pandoc.Span 'text'
|
||||||
span.attr = {id = 'text', class = 'a b', other_attribute = '1'}
|
span.attr = {id = 'text', class = 'a b', other_attribute = '1'}
|
||||||
|
|
||||||
Object equality is determined via [`pandoc.utils.equals`].
|
Attr values are equal in Lua if and only if they are equal in
|
||||||
|
Haskell.
|
||||||
|
|
||||||
Fields:
|
Fields:
|
||||||
|
|
||||||
|
@ -1784,6 +1786,9 @@ Fields:
|
||||||
List of key/value pairs. Values can be accessed by using keys as
|
List of key/value pairs. Values can be accessed by using keys as
|
||||||
indices to the list table.
|
indices to the list table.
|
||||||
|
|
||||||
|
Attributes values are equal in Lua if and only if they are equal
|
||||||
|
in Haskell.
|
||||||
|
|
||||||
### Caption {#type-caption}
|
### Caption {#type-caption}
|
||||||
|
|
||||||
The caption of a table, with an optional short caption.
|
The caption of a table, with an optional short caption.
|
||||||
|
@ -1835,7 +1840,8 @@ Single citation entry
|
||||||
Values of this type can be created with the
|
Values of this type can be created with the
|
||||||
[`pandoc.Citation`](#pandoc.citation) constructor.
|
[`pandoc.Citation`](#pandoc.citation) constructor.
|
||||||
|
|
||||||
Object equality is determined via [`pandoc.utils.equals`].
|
Citation values are equal in Lua if and only if they are equal in
|
||||||
|
Haskell.
|
||||||
|
|
||||||
Fields:
|
Fields:
|
||||||
|
|
||||||
|
@ -2115,7 +2121,7 @@ Values of this type can be created with the
|
||||||
`must_be_at_least(actual, expected [, error_message])`
|
`must_be_at_least(actual, expected [, error_message])`
|
||||||
|
|
||||||
Raise an error message if the actual version is older than the
|
Raise an error message if the actual version is older than the
|
||||||
expected version; does nothing if actual is equal to or newer
|
expected version; does nothing if `actual` is equal to or newer
|
||||||
than the expected version.
|
than the expected version.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -2173,7 +2179,6 @@ Usage:
|
||||||
[TableFoot]: #type-tablefoot
|
[TableFoot]: #type-tablefoot
|
||||||
[TableHead]: #type-tablehead
|
[TableHead]: #type-tablehead
|
||||||
[Version]: #type-version
|
[Version]: #type-version
|
||||||
[`pandoc.utils.equals`]: #pandoc.utils.equals
|
|
||||||
|
|
||||||
# Module text
|
# Module text
|
||||||
|
|
||||||
|
@ -3308,12 +3313,13 @@ Test equality of AST elements. Elements in Lua are considered
|
||||||
equal if and only if the objects obtained by unmarshaling are
|
equal if and only if the objects obtained by unmarshaling are
|
||||||
equal.
|
equal.
|
||||||
|
|
||||||
|
**This function is deprecated.** Use the normal Lua `==` equality
|
||||||
|
operator instead.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
||||||
`element1`, `element2`:
|
`element1`, `element2`:
|
||||||
: Objects to be compared. Acceptable input types are [Pandoc],
|
: Objects to be compared (any type)
|
||||||
[Meta], [MetaValue], [Block], [Inline], [Attr],
|
|
||||||
[ListAttributes], and [Citation].
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,9 @@ documentedModule = Module
|
||||||
=#> functionResult pushInlines "list of inlines" ""
|
=#> functionResult pushInlines "list of inlines" ""
|
||||||
|
|
||||||
, defun "equals"
|
, defun "equals"
|
||||||
### liftPure2 (==)
|
### equal
|
||||||
<#> parameter peekAstElement "AST element" "elem1" ""
|
<#> parameter pure "AST element" "elem1" ""
|
||||||
<#> parameter peekAstElement "AST element" "elem2" ""
|
<#> parameter pure "AST element" "elem2" ""
|
||||||
=#> functionResult pushBool "boolean" "true iff elem1 == elem2"
|
=#> functionResult pushBool "boolean" "true iff elem1 == elem2"
|
||||||
|
|
||||||
, defun "make_sections"
|
, defun "make_sections"
|
||||||
|
|
|
@ -38,7 +38,7 @@ extra-deps:
|
||||||
- git: https://github.com/jgm/ipynb.git
|
- git: https://github.com/jgm/ipynb.git
|
||||||
commit: 00246af10885c2ad4413ace4f69a7e6c88297a08
|
commit: 00246af10885c2ad4413ace4f69a7e6c88297a08
|
||||||
- git: https://github.com/pandoc/pandoc-lua-marshal
|
- git: https://github.com/pandoc/pandoc-lua-marshal
|
||||||
commit: 45e53d9dce37d20f8e30e0d297a43c5b4c4a6831
|
commit: f81ec19006cc4d0476f199d1fb913bac4af0a0d8
|
||||||
- git: https://github.com/jgm/commonmark-hs
|
- git: https://github.com/jgm/commonmark-hs
|
||||||
commit: 4d460b206e0b1872376db86cadf7a4567eeddaed
|
commit: 4d460b206e0b1872376db86cadf7a4567eeddaed
|
||||||
subdir: commonmark-pandoc
|
subdir: commonmark-pandoc
|
||||||
|
|
Loading…
Reference in a new issue