aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2024-05-04 22:06:26 +0200
committerAlbert Krewinkel <[email protected]>2024-05-04 22:17:01 +0200
commitc45f163b4d6ee64faf2c10a1bc58f89f0ff2f174 (patch)
tree227090ce9c1a51df3a24e129b7b459c2c3774098
parent6000a1739469b644e5ba8905c631063bed99c5f7 (diff)
Lua: fix generated docs.
Update and fix docs for `pandoc.types.Version` and `pandoc.utils.type`.
-rw-r--r--doc/lua-filters.md41
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Types.hs12
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs2
-rw-r--r--tools/update-lua-module-docs.lua16
4 files changed, 33 insertions, 38 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 3872e1cba..af67d1fd5 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -3703,8 +3703,8 @@ are explicitly passed via the `env` parameter; e.g.
return pandoc.cli.repl{ doc = doc }
end
-**Note**: it seems that the function exits immediately on
-Windows, without prompting for user input.
+**Note**: it seems that the function exits immediately on Windows,
+without prompting for user input.
Parameters:
@@ -4053,14 +4053,14 @@ argument has a string-valued metafield `__name`, then it returns
that string. Otherwise it behaves just like the normal `type`
function.
-Usage:
+Usage:
-- Prints one of 'string', 'boolean', 'Inlines', 'Blocks',
-- 'table', and 'nil', corresponding to the Haskell constructors
- -- MetaString, MetaBool, MetaInlines, MetaBlocks, MetaMap,
- -- and an unset value, respectively.
-
- function Meta (meta)
+ -- MetaString, MetaBool, MetaInlines, MetaBlocks, MetaMap,
+ -- and an unset value, respectively.
+
+ function Meta (meta)
print('type of metavalue `author`:', pandoc.utils.type(meta.author))
end
@@ -4089,7 +4089,7 @@ Parameters:
Returns:
-- new Version object ([Version]{unknown-type="Version"})
+- new Version object ([Version])
<!-- END: AUTOGENERATED CONTENT -->
@@ -6132,26 +6132,32 @@ Returns:
- template context (table)
+<!-- BEGIN: AUTOGENERATED CONTENT for module pandoc.types -->
+
# Module pandoc.types
-Constructors for types which are not part of the pandoc AST.
+Constructors for types that are not part of the pandoc AST.
-### Version {#pandoc.types.version}
+## Functions {#pandoc.types-functions}
-`Version (version_specifier)`
+### Version {#pandoc.types.Version}
-Creates a Version object.
+`Version (version_specifier)`
Parameters:
`version_specifier`
-: Version specifier: this can be a version string like
- `'2.7.3'`, a list of integers like `{2, 7, 3}`, a single
- integer, or a [Version].
+: A version string like `'2.7.3'`, a Lua number like `2.0`, a
+ list of integers like `{2,7,3}`, or a Version object.
+ (string\|number\|{[integer]{unknown-type="integer"},\...}\|[Version])
Returns:
-- A new [Version] object.
+- New Version object. ([Version])
+
+*Since: 2.7.3*
+
+<!-- END: AUTOGENERATED CONTENT -->
<!-- BEGIN: AUTOGENERATED CONTENT for module pandoc.zip -->
@@ -6352,10 +6358,11 @@ Returns:
[Pandoc]: #type-pandoc
[Table]: #type-table
[SimpleTable]: #type-simpletable
+ [Version]: #type-version
[`list`]: #pandoc.mediabag.list
+ [WriterOptions]: #type-writeroptions
[null]: #pandoc.json.null
[this blog post]: http://neilmitchell.blogspot.co.uk/2015/10/filepaths-are-subtle-symlinks-are-hard.html
- [WriterOptions]: #type-writeroptions
[ChunkedDoc]: #type-chunkeddoc
[zip.Entry]: #type-pandoc.zip.Entry
[zip.Archive]: #type-pandoc.zip.Archive
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Types.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Types.hs
index 1b0e69580..014add31b 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Types.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Types.hs
@@ -30,14 +30,14 @@ documentedModule = Module
, moduleFunctions =
[ defun "Version"
### return
- <#> parameter peekVersionFuzzy "string|integer|{integer,...}|Version"
+ <#> parameter peekVersionFuzzy "string|number|{integer,...}|Version"
"version_specifier"
- (mconcat [ "either a version string like `'2.7.3'`, "
- , "a single integer like `2`, "
- , "list of integers like `{2,7,3}`, "
- , "or a Version object"
+ (mconcat [ "A version string like `'2.7.3'`, "
+ , "a Lua number like `2.0`, "
+ , "a list of integers like `{2,7,3}`, "
+ , "or a Version object."
])
- =#> functionResult pushVersion "Version" "A new Version object."
+ =#> functionResult pushVersion "Version" "New Version object."
`since` makeVersion [2,7,3]
]
, moduleOperations = []
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs
index 7ebd125d4..5fddf6e8b 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs
@@ -369,10 +369,12 @@ type' = defun "type"
, "function."
, ""
, "Usage:"
+ , ""
, " -- Prints one of 'string', 'boolean', 'Inlines', 'Blocks',"
, " -- 'table', and 'nil', corresponding to the Haskell constructors"
, " -- MetaString, MetaBool, MetaInlines, MetaBlocks, MetaMap,"
, " -- and an unset value, respectively."
+ , ""
, " function Meta (meta)"
, " print('type of metavalue `author`:', pandoc.utils.type(meta.author))"
, " end"
diff --git a/tools/update-lua-module-docs.lua b/tools/update-lua-module-docs.lua
index c951d8668..614a3326c 100644
--- a/tools/update-lua-module-docs.lua
+++ b/tools/update-lua-module-docs.lua
@@ -54,6 +54,7 @@ local known_types = {
SimpleTable = 'type-simpletable',
Table = 'type-table',
WriterOptions = 'type-writeroptions',
+ Version = 'type-version',
}
local function render_typespec (typespec)
@@ -256,21 +257,6 @@ local handled_modules = {
layout = true
}
-local modules = {
- -- 'cli',
- -- 'utils',
- -- 'mediabag',
- -- 'format',
- -- 'path',
- -- 'structure',
- -- 'system',
- -- 'layout',
- -- 'scaffolding',
- -- 'template',
- -- 'types',
- 'zip',
-}
-
-- Generate docs for the given module
if arg and arg[1] then
local module_name = arg[1]