summaryrefslogtreecommitdiff
path: root/test/Tests/Lua.hs
Commit message (Collapse)AuthorAge
* Text.Pandoc.Lua: support Inline and Block catch-allsAlbert Krewinkel2017-08-22
| | | | | | | Try function `Inline`/`Block` if no other filter function of the respective type matches an element. Closes: #3859
* Text.Pandoc.Lua: respect metatable when getting filtersAlbert Krewinkel2017-08-22
| | | | | | | | | | | | | | | | 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.
* Test fixes so we can find data files.John MacFarlane2017-08-14
| | | | | | | In old tests & command tests, we now set the environment variable pandoc_datadir. In lua tests, we set the datadir explicitly.
* Use hslua >= 0.7, update Lua codeAlbert Krewinkel2017-08-13
|
* Added parameter for user data directory to runLuaFilter.John MacFarlane2017-06-29
| | | | | | | | | | 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.
* Use fewer quickcheck tests for lua tests, to speed things up.John MacFarlane2017-05-07
|
* Lua filter: fall-back to global filters when none is returnedAlbert Krewinkel2017-04-30
| | | | | | | | | 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
* Lua filter: allow shorthand functions for math and quotedAlbert Krewinkel2017-04-14
| | | | | Allow to use functions named `SingleQuoted`, `DoubleQuoted`, `DisplayMath`, and `InlineMath` in filters.
* Use lua constructors to push meta valuesAlbert Krewinkel2017-04-13
|
* Lua filter: improve doc filter performanceAlbert Krewinkel2017-04-07
| | | | | Pandoc elements are pushed and pulled from the lua stack via custom instances.
* Ensure correctness of StackValue instancesAlbert Krewinkel2017-04-06
|
* Lua module: add readers submoduleAlbert Krewinkel2017-04-02
| | | | | | | | | | | | | | | 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.
* Lua filters (#3514)Albert Krewinkel2017-03-20
* 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.