Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Traversal methods are updated to use the new Walk module such that
sequences with nested Inline (or Block) elements are traversed in the
order in which they appear in the linearized document.
Fixes: #5667
|
|
Lua filters must be able to traverse sequences of AST elements and to
replace elements by splicing sequences back in their place. Special
`Walkable` instances can be used for this; those are provided in a new
module `Text.Pandoc.Lua.Walk`.
|
|
|
|
Fixed function names of pandoc.system.get_working_directory() and
pandoc.system.with_temporary_directory() which are written in the
manual of lua filter.
|
|
Closes: #5568
|
|
Function `pandoc.mediabag.delete` allows to remove a single item of the given
name from the media bag.
|
|
Function `pandoc.mediabag.empty` was added. It allows to clean-out the media
bag, removing all entries.
|
|
A new function `pandoc.mediabag.items` was added to Lua module
pandoc.mediabag. This allows users to lazily iterate over all media bag
items, loading items into Lua one-by-one. Example:
for filename, mime_type, content in pandoc.mediabag.items() do
-- use media bag item.
end
This is a convenient alternative to using `mediabag.list` in combination
with `mediabag.lookup`.
|
|
|
|
Version specifiers like `PANDOC_VERSION` and `PANDOC_API_VERSION` are
turned into `Version` objects. The objects simplify version-appropriate
comparisons while maintaining backward-compatibility.
A function `pandoc.types.Version` is added as part of the newly
introduced module `pandoc.types`, allowing users to create version
objects in scripts.
|
|
The `system` Lua module provides utility functions to interact with the
operating- and file system. E.g.
print(pandoc.system.get_current_directory())
or
pandoc.system.with_temporary_directory('tikz', function (dir)
-- write and compile a TikZ file with pdflatex
end)
|
|
The haddock module header contains essentially the
same information, so the boilerplate is redundant and
just one more thing to get out of sync.
|
|
|
|
This allows more control over the common state from within Lua scripts.
|
|
The file `init.lua` in pandoc's data directory is run as part of
pandoc's Lua initialization process. Previously, the `pandoc` module was
loaded in `init.lua`, and the structure for marshaling was set-up after.
This allowed simple patching of element marshaling, but made using
`init.lua` more difficult:
- it encouraged mixing essential initialization with user-defined
customization;
- upstream changes to init.lua had to be merged manually;
- accidentally breaking marshaling by removing required modules was
possible;
Instead, all required modules are now loaded before calling `init.lua`.
The file can be used entirely for user customization. Patching
marshaling functions, while discouraged, is still possible via the
`debug` module.
|
|
|
|
Quite a few modules were missing copyright notices.
This commit adds copyright notices everywhere via haddock module
headers. The old license boilerplate comment is redundant with this and has
been removed.
Update copyright years to 2019.
Closes #4592.
|
|
Equality of Lua objects representing pandoc AST elements is tested by
unmarshalling the objects and comparing the result in Haskell. A new
function `equals` which performs this test has been added to the
`pandoc.utils` module.
Closes: #5092
|
|
Meta value strings (MetaString) and booleans (MetaBool) are now
converted to the literal string and the lowercase boolean name,
respectively. Previously, all values of these types were converted to
the empty string.
|
|
Newly exported from Text.Pandoc.Lua:
- `runFilterFile` to run a Lua filter from file;
- data type `Global` and its constructors; and
- `setGlobals` to add globals to a Lua environment.
This module also contains `Pushable` and `Peekable` instances required
to get pandoc's data types to and from Lua. Low-level Lua operation
remain hidden in Text.Pandoc.Lua.
|
|
|
|
|
|
* Lua: allow access to pandoc state
Lua filters and custom writers now have read-only access to most fields
of pandoc's internal state via the global variable `PANDOC_STATE`.
* Lua: allow iterating through fields of PANDOC_STATE
* Lua filters doc: describe CommonState
* Lua filters doc: mention global variable PANDOC_STATE
* Lua: add access to logs
Log messages can currently only be printed, but not decomposed.
|
|
Snake case is used in most variable names, using camelCase for these
fields was an oversight. A metatable is added to ensure that the old
field names remain functional.
|
|
Hierarchical Elements were pushed to Lua as plain tables. This is
simple, but has the disadvantage that marshaling is eager: all child
elements will be marshaled as part of the object. Using a Lua userdata
object instead allows lazy access to fields, causing content marshaling
just (but also each time) when a field is accessed. Filters which do not
traverse the full element contents tree become faster as a result.
|
|
This ensures that ListAttributes, as present in OrderedList elements,
have additional accessors (viz. *start*, *style*, and *delimiter*).
|
|
|
|
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
|