summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2022-07-15 21:22:33 +0200
committerGitHub <noreply@github.com>2022-07-15 21:22:33 +0200
commitdaef24f02269f1e0041fb222d9bb87cda4537088 (patch)
treed5f1670ae751b43e1429973c000a58870ba30494 /doc
parent7119fee96350afd5c81a1cbc0187282ebf81eadd (diff)
Lua: extend pandoc.system module. (#8184)
The module now has the additional functions `list_directory`, `make_directory`, and `remove_directory`. This makes it easier to write cross-platform scripts that need to inspect or modify the file system.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 5f533ecfe..b4ac31479 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -4423,6 +4423,60 @@ Returns:
- The current working directory (string).
+### list\_directory {#pandoc.system.list_directory}
+
+`list_directory ([directory])`
+
+List the contents of a directory.
+
+Parameters:
+
+`directory`
+: Path of the directory whose contents should be listed
+ (string). Defaults to `.`.
+
+Returns:
+
+- A table of all entries in `directory` without the special
+ entries `.` and `..`. (list of strings)
+
+### make\_directory {#pandoc.system.make_directory}
+
+`make_directory (dirname [, create_parent])`
+
+Create a new directory which is initially empty, or as near to
+empty as the operating system allows. The function throws an
+error if the directory cannot be created, e.g., if the parent
+directory does not exist or if a directory of the same name is
+already present.
+
+If the optional second parameter is provided and truthy, then all
+directories, including parent directories, are created as
+necessary.
+
+Parameters:
+
+`dirname`
+: name of the new directory (string)
+
+`create_parent`
+: create parent directories if necessary (boolean)
+
+### remove\_directory {#pandoc.system.remove_directory}
+
+`remove_directory (dirname [, recursive])`
+
+Remove an existing, empty directory. If `recursive` is given,
+then delete the directory and its contents recursively.
+
+Parameters:
+
+`dirname`
+: name of the directory to delete (string)
+
+`recursive`
+: delete content recursively (boolean)
+
### with\_environment {#pandoc.system.with_environment}
`with_environment (environment, callback)`