Make clear that walk performs a deep copy (#8124)

Relevant discussion here: https://groups.google.com/g/pandoc-discuss/c/-NoL3Ft9AC8

I felt that it could be useful to inform that walk is the only way to get a deep copy of a List. I wrote this where I think that users will likely loop up for this feature, but it may be out of place.
This commit is contained in:
Bastien Dumont 2022-06-15 00:14:19 +02:00 committed by GitHub
parent b263f38304
commit 7244821705
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -859,7 +859,9 @@ equal in Lua if and only if they are equal in Haskell.
Applies a Lua filter to the Pandoc element. Just as for Applies a Lua filter to the Pandoc element. Just as for
full-document filters, the order in which elements are traversed full-document filters, the order in which elements are traversed
can be controlled by setting the `traverse` field of the filter; can be controlled by setting the `traverse` field of the filter;
see the section on [traversal order][Traversal order]. see the section on [traversal order][Traversal order]. Returns a
(deep) copy on which the filter has been applied: the original
element is left untouched.
Parameters: Parameters:
@ -935,7 +937,9 @@ Haskell.
Applies a Lua filter to the block element. Just as for Applies a Lua filter to the block element. Just as for
full-document filters, the order in which elements are traversed full-document filters, the order in which elements are traversed
can be controlled by setting the `traverse` field of the filter; can be controlled by setting the `traverse` field of the filter;
see the section on [traversal order][Traversal order]. see the section on [traversal order][Traversal order]. Returns a
(deep) copy on which the filter has been applied: the original
element is left untouched.
Note that the filter is applied to the subtree, but not to the Note that the filter is applied to the subtree, but not to the
`self` block element. The rationale is that otherwise the element `self` block element. The rationale is that otherwise the element
@ -1284,7 +1288,9 @@ values:
Applies a Lua filter to the Blocks list. Just as for Applies a Lua filter to the Blocks list. Just as for
full-document filters, the order in which elements are traversed full-document filters, the order in which elements are traversed
can be controlled by setting the `traverse` field of the filter; can be controlled by setting the `traverse` field of the filter;
see the section on [traversal order][Traversal order]. see the section on [traversal order][Traversal order]. Returns a
(deep) copy on which the filter has been applied: the original
list is left untouched.
Parameters: Parameters:
@ -1319,7 +1325,9 @@ Haskell.
Applies a Lua filter to the Inline element. Just as for Applies a Lua filter to the Inline element. Just as for
full-document filters, the order in which elements are traversed full-document filters, the order in which elements are traversed
can be controlled by setting the `traverse` field of the filter; can be controlled by setting the `traverse` field of the filter;
see the section on [traversal order][Traversal order]. see the section on [traversal order][Traversal order]. Returns a
(deep) copy on which the filter has been applied: the original
element is left untouched.
Note that the filter is applied to the subtree, but not to the Note that the filter is applied to the subtree, but not to the
`self` inline element. The rationale is that otherwise the `self` inline element. The rationale is that otherwise the
@ -1740,7 +1748,9 @@ values:
Applies a Lua filter to the Inlines list. Just as for Applies a Lua filter to the Inlines list. Just as for
full-document filters, the order in which elements are handled full-document filters, the order in which elements are handled
are are Inline → Inlines → Block → Blocks. The filter is applied are are Inline → Inlines → Block → Blocks. The filter is applied
to all list items *and* to the list itself. to all list items *and* to the list itself. Returns a (deep)
copy on which the filter has been applied: the original list is
left untouched.
Parameters: Parameters:
@ -3372,6 +3382,8 @@ Usage:
### `walk_block (element, filter)` {#pandoc.walk_block} ### `walk_block (element, filter)` {#pandoc.walk_block}
Apply a filter inside a block element, walking its contents. Apply a filter inside a block element, walking its contents.
Returns a (deep) copy on which the filter has been applied:
the original element is left untouched.
Parameters: Parameters:
@ -3387,6 +3399,8 @@ Returns: the transformed block element
### `walk_inline (element, filter)` {#pandoc.walk_inline} ### `walk_inline (element, filter)` {#pandoc.walk_inline}
Apply a filter inside an inline element, walking its contents. Apply a filter inside an inline element, walking its contents.
Returns a (deep) copy on which the filter has been applied:
the original element is left untouched.
Parameters: Parameters:
@ -3981,7 +3995,8 @@ Returns:
### `pandoc.List:clone ()` {#pandoc.list:clone} ### `pandoc.List:clone ()` {#pandoc.list:clone}
Returns a (shallow) copy of the list. Returns a (shallow) copy of the list. (To get a deep copy
of the list, use `walk` with an empty filter.)
### `pandoc.List:extend (list)` {#pandoc.list:extend} ### `pandoc.List:extend (list)` {#pandoc.list:extend}