aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Util.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-04-17API change: use new type PandocLua for all pandoc Lua operationsAlbert Krewinkel1-14/+3
The new type `PandocLua` is an instance of the `PandocMonad` typeclass and can thus be used in a way similar to `PandocIO`.
2020-04-17API change: use PandocError for exceptions in Lua subsystemAlbert Krewinkel1-3/+4
The PandocError type is used throughout the Lua subsystem, all Lua functions throw an exception of this type if an error occurs. The `LuaException` type is removed and no longer exported from `Text.Pandoc.Lua`. In its place, a new constructor `PandocLuaError` is added to PandocError.
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-1/+2
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-2/+2
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-01-04Add type annotations to assist ghci.John MacFarlane1-2/+3
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-4/+4
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.
2018-10-01Lua filters: report traceback when an error occursAlbert Krewinkel1-2/+36
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.
2018-10-01Lua Util: add missing docstring to defineHowToAlbert Krewinkel1-1/+1
2018-09-24Use hslua v1.0.0Albert Krewinkel1-55/+33
2018-08-12Lua: cleanup Lua utils, remove unused functions.Albert Krewinkel1-56/+28
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-03-17hlint fixes.John MacFarlane1-1/+1
2018-01-23Lua filters: store constructors in registryAlbert Krewinkel1-2/+3
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.
2018-01-23Lua: move getTag from StackInstances to UtilAlbert Krewinkel1-3/+16
Change: minor
2018-01-12Lua filters: improve error messagesAlbert Krewinkel1-0/+9
Provide more context about the task which caused an error.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-4/+4
2018-01-04Use hslua utils where possibleAlbert Krewinkel1-16/+0
Some helper functions and types have been moved to hslua. Change: minor
2017-12-29data/pandoc.lua: drop function pandoc.global_filterAlbert Krewinkel1-0/+1
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.
2017-12-23Lua modules: add function pandoc.utils.normalize_dateAlbert Krewinkel1-0/+4
The function parses a date and converts it (if possible) to "YYYY-MM-DD" format.
2017-12-22Lua.Util: avoid altering the stack if peeking failsAlbert Krewinkel1-4/+12
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
2017-12-21Lua modules: move to dedicated submoduleAlbert Krewinkel1-2/+20
The Haskell module defining the Lua `pandoc` module is moved to Text.Pandoc.Lua.Module.Pandoc. Change: minor
2017-12-20Lua modules: turn pipe, read into full Haskell functionsAlbert Krewinkel1-3/+12
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.
2017-12-02Lua filters: refactor lua module handlingAlbert Krewinkel1-1/+32
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`.
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-2/+2
2017-10-26update years in copyrightKolen Cheung1-1/+1
2017-08-13Text.Pandoc.Lua: Optimize performance by using raw table accessAlbert Krewinkel1-11/+6
Raw table accessing functions never call back into haskell, which allows the compiler to use more aggressive optimizations. This improves lua filter performance considerably (⪆5% speedup).
2017-08-13Use hslua >= 0.7, update Lua codeAlbert Krewinkel1-63/+39
2017-06-03Improve code style in lua and org modulesAlbert Krewinkel1-4/+2
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-1/+1
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-04-14Avoid repeating StackValue instances definitionsAlbert Krewinkel1-1/+55
The lua filters and custom lua writer system defined very similar StackValue instances for strings and tuples. These instance definitions are extracted to a separate module to enable sharing.
2017-04-14Extract lua helper functions into Lua.Util moduleAlbert Krewinkel1-0/+86