Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
A proper Lua traceback is added if either loading of a file or execution
of a filter function fails. This should be of help to authors of Lua
filters who need to debug their code.
|
|
|
|
|
|
|
|
|
|
Exposes a function converting which flattenes a list of blocks into a
list of inlines. An example use case would be the conversion of Note
elements into other inlines.
|
|
|
|
This seems to be necessary if we are to use our custom Prelude
with ghci.
Closes #4464.
|
|
|
|
The name of the Lua script which is executed is made available in the
global Lua variable `PANDOC_SCRIPT_FILE`, both for Lua filters and
custom writers.
Closes: #4393
|
|
Lua functions used to construct AST element values are stored in the Lua
registry for quicker access. Getting a value from the registry is much
faster than getting a global value (partly to idiosyncrasies of hslua);
this change results in a considerable performance boost.
|
|
Change: minor
|
|
|
|
|
|
Run JSON filters from Lua filters
|
|
Runs a JSON filter on a Pandoc document.
|
|
Provide more context about the task which caused an error.
|
|
The options which were used to read the document are made available to
Lua filters via the `PANDOC_READER_OPTIONS` global.
|
|
The current pandoc-types version is made available to Lua programs in
the global PANDOC_API_VERSION. It contains the version as a list of
numbers.
|
|
The current pandoc version is made available to Lua programs in the
global PANDOC_VERSION. It contains the version as a list of numbers.
|
|
|
|
The fields were named like the Haskell fields, not like the documented,
shorter version. The names are changed to match the documentation and
Citations are given a shared metatable to enable simple extensibility.
Fixes: #4222
|
|
Some helper functions and types have been moved to hslua.
Change: minor
|
|
I'm sure this was intended in the first place, but currently
only Meta is supported.
|
|
The function `global_filter` was used internally to get the implicitly
defined global filter. It was of little value to end-users, but caused
unnecessary code duplication in pandoc. The function has hence been
dropped. Internally, the global filter is now received by interpreting
the global table as lua filter.
This is a Lua API change.
|
|
Convert list of Pandoc blocks into (hierarchical) list of Elements.
|
|
The function parses a date and converts it (if possible) to "YYYY-MM-DD"
format.
|
|
The function allows conversion of numbers below 4000 into roman
numerals.
|
|
The new function `pandoc.utils.stringify` converts any AST element to a
string with formatting removed.
|
|
The stack now remains unaltered if `getRawInt` or `getTable` fail. This
is important when those functions are used in an operation that is part
of an Alternative.
Change: minor
|
|
A new module `pandoc.utils` has been created. It holds utility functions
like `sha1`, which was moved from the main `pandoc` module.
|
|
Definitions for the `pandoc.mediabag` modules are moved to a separate
Haskell module.
Change: minor
|
|
The Haskell module defining the Lua `pandoc` module is moved to
Text.Pandoc.Lua.Module.Pandoc.
Change: minor
|
|
The `pipe` and `read` utility functions are converted from hybrid
lua/haskell functions into full Haskell functions. This avoids the need
for intermediate `_pipe`/`_read` helper functions, which have dropped.
|
|
Change: minor
|
|
The same init file (`data/init`) that is used to setup the Lua
interpreter for Lua filters is also used to setup the interpreter of
custom writers.lua.
|
|
The list of package searchers is named `package.loaders` in Lua 5.1 and
LuaJIT, and `package.searchers` in Lua 5.2 and later.
|
|
The file `init.lua` is used to initialize the Lua interpreter which is
used in Lua filters. This gives users the option to require libraries
which they want to use in all of their filters, and to extend default
modules.
|
|
The integration with Lua's package/module system is improved: A
pandoc-specific package searcher is prepended to the searchers in
`package.searchers`. The modules `pandoc` and `pandoc.mediabag` can now
be loaded via `require`.
|
|
Pandoc and Meta elements are now pushed by calling the respective
constructor functions of the pandoc Lua module. This makes serialization
consistent with the way blocks and inlines are pushed to lua and allows
to use List methods with the `blocks` value.
|
|
The changes were missing due to an error while using git.
|
|
The List module is automatically loaded, but not assigned to a global
variable. It can be included in filters by calling `List = require
'List'`.
Lists of blocks, lists of inlines, and lists of classes are now given
`List` as a metatable, making working with them more convenient. E.g.,
it is now possible to concatenate lists of inlines using Lua's
concatenation operator `..` (requires at least one of the operants to
have `List` as a metatable):
function Emph (emph)
local s = {pandoc.Space(), pandoc.Str 'emphasized'}
return pandoc.Span(emph.content .. s)
end
Closes: #4081
|
|
|
|
Refactored some code from Text.Pandoc.Lua.PandocModule
into new internal module Text.Pandoc.Lua.Filter.
Add `walk_inline` and `walk_block` in pandoc lua module.
|
|
|
|
|
|
|
|
|
|
The pipe command is wrapped in a lua function, throwing a lua error if
the command returns with an error. A wrapper is needed as Haskell
functions exposed to lua may not throw lua errors due to limitations of
hslua.
The error handling is written such that a table can be returned as an
error object in the future. This is potentially useful when finer
control is required while catching the error in lua code. Current
limitations of hslua require error objects to be strings.
|