diff options
| author | Albert Krewinkel <[email protected]> | 2023-03-17 15:39:51 +0100 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-03-18 15:00:45 -0700 |
| commit | 203a652e4318a6bce2685ea02b16c669b36fc16a (patch) | |
| tree | 706008d1c6101b0f3e58a3f8e8a26c39a1c4123e /doc | |
| parent | f9b6777a92ab304149b93f34a40a36e5e9c95bf5 (diff) | |
Lua: add pandoc.cli.repl function
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lua-filters.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 53edfd9b1..37bc89d81 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -3747,6 +3747,40 @@ Returns: - parsed options, using their JSON-like representation. (table) +### repl {#pandoc.cli.repl} + +`repl ([env])` + +Starts a read-eval-print loop (REPL). The function returns all +values of the last evaluated input. Exit the REPL by pressing +`ctrl-d` or `ctrl-c`; press `F1` to get a list of all key +bindings. + +The REPL is started in the global namespace, unless the `env` +parameter is specified. In that case, the global namespace is +merged into the given table and the result is used as `_ENV` value +for the repl. + +Specifically, local variables *cannot* be accessed, unless they +are explicitly passed via the `env` parameter; e.g. + + function Pandoc (doc) + -- start repl, allow to access the `doc` parameter + -- in the repl + return pandoc.cli.repl{ doc = doc } + end + +Parameters: + +`env` +: Extra environment; the global environment is merged into this + table. (table) + +Returns: + +The result(s) of the last evaluated input, or nothing if the last +input resulted in an error. + # Module pandoc.utils |
