aboutsummaryrefslogtreecommitdiff
path: root/test/lua
AgeCommit message (Collapse)AuthorFilesLines
2017-08-22Text.Pandoc.Lua: support Inline and Block catch-allsAlbert Krewinkel1-0/+11
Try function `Inline`/`Block` if no other filter function of the respective type matches an element. Closes: #3859
2017-08-22Text.Pandoc.Lua: respect metatable when getting filtersAlbert Krewinkel1-0/+20
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.
2017-06-29data/pandoc.lua: regularize constructors.John MacFarlane2-3/+3
We now use Pandoc instead of Doc (though Doc remains a deprecated Synonym), and we deprecate DoubleQuoted, SingleQuoted, InlineMath, and DisplayMath.
2017-06-29Lua filters: Remove special treatment of Quoted, Math.John MacFarlane1-2/+4
No more SingleQuoted, DoubleQuoted, InlineMath, DisplayMath. This makes everything uniform and predictable, though it does open up a difference btw lua filters and custom writers.
2017-04-30Lua filter: fall-back to global filters when none is returnedAlbert Krewinkel1-0/+6
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
2017-04-26Lua module: provide simple `read` format parserAlbert Krewinkel1-1/+2
A single `read` function parsing pandoc-supported formats is added to the module. This is simpler and more convenient than the previous method of exposing all reader functions individually.
2017-04-26Lua filter: allow filtering of meta data onlyAlbert Krewinkel1-0/+12
2017-04-15Lua filter: revert to non-destructuring filtersAlbert Krewinkel4-11/+12
We want to provide an interface familiar to users of other filtering libraries.
2017-04-14Lua filter: allow shorthand functions for math and quotedAlbert Krewinkel1-0/+7
Allow to use functions named `SingleQuoted`, `DoubleQuoted`, `DisplayMath`, and `InlineMath` in filters.
2017-04-14Lua filter: use destructured functions for block filtersAlbert Krewinkel2-4/+3
Filtering functions take element components as arguments instead of the whole block elements. This resembles the way elements are handled in custom writers.
2017-04-12Lua filter: use destructured functions for inline filtersAlbert Krewinkel1-4/+5
Instead of taking the whole inline element, forcing users to destructure it themselves, the components of the elements are passed to the filtering functions.
2017-04-02Lua module: add readers submoduleAlbert Krewinkel1-0/+12
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.
2017-03-20Lua filters (#3514)Albert Krewinkel3-0/+26
* 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.