aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2024-05-05 00:25:29 +0200
committerAlbert Krewinkel <[email protected]>2024-05-05 00:25:29 +0200
commit32f0ed9ea3600629de4d74f1841c73502da5baa8 (patch)
tree7e0ed9f7233318acc9b61b4c531a741368de01fd /pandoc-lua-engine/src
parent1a15c9f6a938e62bd6778a0b0c86f5f851b5772b (diff)
Lua: improve `pandoc.json.decode` docs.
Diffstat (limited to 'pandoc-lua-engine/src')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Module/JSON.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/JSON.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/JSON.hs
index 8d88b07cb..4e158dfec 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/JSON.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/JSON.hs
@@ -93,11 +93,14 @@ decode = defun "decode"
"whether to use pandoc types when possible.")
=#> functionResult pure "any" "decoded object"
#? T.unlines
- [ "Creates a Lua object from a JSON string. The function returns an"
- , "[[Inline]], [[Block]], [[Pandoc]], [[Inlines]], or [[Blocks]] element"
- , "if the input can be decoded into represent any of those types."
- , "Otherwise the default decoding is applied, using tables, booleans,"
- , "numbers, and [null](#pandoc.json.null) to represent the JSON value."
+ [ "Creates a Lua object from a JSON string. If the input can be decoded"
+ , "as representing an [[Inline]], [[Block]], [[Pandoc]], [[Inlines]],"
+ , "or [[Blocks]] element the function will return an object of the"
+ , "appropriate type. Otherwise, if the input does not represent any"
+ , "of the AST types, the default decoding is applied: Objects and"
+ , "arrays are represented as tables, the JSON `null` value becomes"
+ , "[null](#pandoc.json.null), and JSON booleans, strings, and numbers"
+ , "are converted using the Lua types of the same name."
, ""
, "The special handling of AST elements can be disabled by setting"
, "`pandoc_types` to `false`."
@@ -116,5 +119,5 @@ encode = defun "encode"
, "If the object has a metamethod with name `__tojson`, then the"
, "result is that of a call to that method with `object` passed as"
, "the sole argument. The result of that call is expected to be a"
- , "valid JSON string, but this not checked."
+ , "valid JSON string, but this is not checked."
]