Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
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
|
|
Elements with attributes got an additional `attr` accessor. Attributes
were accessible only via the `identifier`, `classes`, and `attributes`,
which was in conflict with the documentation, which indirectly states
that such elements have the an `attr` property.
|
|
Every constructor which accepts a list of blocks now also accepts a
single block element for convenience. Furthermore, strings are accepted as
shorthand for `{pandoc.Str "text"}` in constructors.
|
|
Every constructor which accepts a list of inlines now also accepts a
single inline element for convenience.
|
|
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.
|
|
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 functions `sha1`, `read`, and `pipe` are now tested.
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 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`.
|
|
Attribute lists are represented as associative lists in Lua. Pure
associative lists are awkward to work with. A metatable is attached to
attribute lists, allowing to access and use the associative list as if
the attributes were stored in as normal key-value pair in table.
Note that this changes the way `pairs` works on attribute lists. Instead
of producing integer keys and two-element tables, the resulting iterator
function now returns the key and value of those pairs. Use `ipairs` to
get the old behavior.
Warning: the new iteration mechanism only works if pandoc has been
compiled with Lua 5.2 or later (current default: 5.3).
The `pandoc.Attr` function is altered to allow passing attributes as
key-values in a normal table. This is more convenient than having to
construct the associative list which is used internally.
Closes #4071
|
|
The `text` module is preloaded in lua. The module contains some UTF-8
aware string functions, implemented in Haskell. The module is loaded on
request only, e.g.:
text = require 'text'
function Str (s)
s.text = text.upper(s.text)
return s
end
|
|
|
|
|
|
Try function `Inline`/`Block` if no other filter function of the
respective type matches an element.
Closes: #3859
|
|
This change makes it possible to define a catch-all function using lua's
metatable lookup functionality.
function catch_all(el)
…
end
return {
setmetatable({}, {__index = function(_) return catch_all end})
}
A further effect of this change is that the map with filter functions
now only contains functions corresponding to AST element constructors.
|
|
In old tests & command tests, we now set the environment variable
pandoc_datadir.
In lua tests, we set the datadir explicitly.
|
|
|
|
in Text.Pandoc.Lua. Also to pushPandocModule.
This change allows users to override pandoc.lua with a file
in their local data directory, adding custom functions, etc.
@tarleb, if you think this is a bad idea, you can revert this.
But in general our data files are all overridable.
|
|
|
|
The implicitly defined global filter (i.e. all element filtering
functions defined in the global lua environment) is used if no filter is
returned from a lua script. This allows to just write top-level
functions in order to define a lua filter. E.g
function Emph(elem) return pandoc.Strong(elem.content) end
|
|
Allow to use functions named `SingleQuoted`, `DoubleQuoted`,
`DisplayMath`, and `InlineMath` in filters.
|
|
|
|
Pandoc elements are pushed and pulled from the lua stack via custom
instances.
|
|
|
|
Plain text readers are exposed to lua scripts via the `pandoc.reader`
submodule, which is further subdivided by format. Converting e.g. a
markdown string into a pandoc document is possible from within lua:
doc = pandoc.reader.markdown.read_doc("Hello, World!")
A `read_block` convenience function is provided for all formats,
although it will still parse the whole string but return only the first
block as the result.
Custom reader options are not supported yet, default options are used
for all parsing operations.
|
|
* Add `--lua-filter` option. This works like `--filter` but takes pathnames of special lua filters and uses the lua interpreter baked into pandoc, so that no external interpreter is needed. Note that lua filters are all applied after regular filters, regardless of their position on the command line.
* Add Text.Pandoc.Lua, exporting `runLuaFilter`. Add `pandoc.lua` to data files.
* Add private module Text.Pandoc.Lua.PandocModule to supply the default lua module.
* Add Tests.Lua to tests.
* Add data/pandoc.lua, the lua module pandoc imports when processing its lua filters.
* Document in MANUAL.txt.
|