aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-01-25Add ParseError to PandocExecutionError.Jesse Rosenthal1-1/+3
This will be unified with Text.Pandoc.Error eventually. But I'm building it out here so as not to interfere with other modules that might be using the error module currently.
2017-01-25List derived instances vertically one-per-line for readability.Jesse Rosenthal1-2/+14
2017-01-25Change Test{State,Env} to Pure{State,Env}Jesse Rosenthal1-10/+10
This was left over from when the pure function was called runTest.
2017-01-25Class: Add MediaBag to MonadState.Jesse Rosenthal1-6/+18
2017-01-25Class: Add stateful IO warnings, and function to get warndings.Jesse Rosenthal1-3/+9
Right now, the io warnings both print to stderr and write to the state. That can be easily modified. We also add a getWarnings function which pulls warnings out of the state for instances of PandocMonad.
2017-01-25Changed readNative to use PandocMonad.John MacFarlane6-11/+22
2017-01-25Text.Pandoc: Change Reader to Reader m.John MacFarlane1-9/+11
For now I just replaced occurences of Reader with Reader IO, so nothing is really different. When we move readers into instances of PandocMonad, though, we can change things here so that the readers will work with any instance of PandocMonad.
2017-01-25Removed some commented-out source.John MacFarlane1-70/+0
2017-01-25Deleted whitespace at end of source lines.John MacFarlane9-11/+11
2017-01-25Fixed icml tables test (no newline at end).John MacFarlane1-1/+1
2017-01-25Fixed regression in OPML writer.John MacFarlane1-1/+1
OPML writer should note include `_notes` attribute when there's no content.
2017-01-25Fixed rtf tables testJohn MacFarlane1-0/+1
2017-01-25Texinfo writer: restore former behavior for headers level > 4.John MacFarlane1-19/+21
The recent changes made the writer fail with an error if it encountered a header with level 5. Better to do as we did before and just print a paragraph in that case. Eventually we should emit a warning here.
2017-01-25Update tests to work with runPure.John MacFarlane14-22/+28
2017-01-25Export Text.Pandoc.Class from Text.Pandoc.John MacFarlane1-0/+2
2017-01-25Fixes to compile after rebase.John MacFarlane2-3/+4
2017-01-25Clean up Text.PandocJesse Rosenthal2-78/+58
We had primed versions of all the Writer types and getWriter functions, as we transitioned. Now that we're using the new ones exclusively, we'll get rid of the old ones, and get rid of the primes in the names.
2017-01-25Implement Errors in PandocMonadJesse Rosenthal9-134/+179
Errors can be thrown purely with `throwError`. At the moment there are only three kinds of errors: 1. PandocFileReadError FilePath (for problems reading a file from the filesystem) 2. PandocShouldNeverHappenError String (for stuff that should never happen but we need to pattern-match anyway) 3. PandocSomeError String (a grab bag of everything else) Of course, we need to subdivide the third item in this list.
2017-01-25Convert all writers to use PandocMonad.Jesse Rosenthal25-276/+396
Since PandocMonad is an instance of MonadError, this will allow us, in a future commit, to change all invocations of `error` to `throwError`, which will be preferable for the pure versions. At the moment, we're disabling the lua custom writers (this is temporary). This requires changing the type of the Writer in Text.Pandoc. Right now, we run `runIOorExplode` in pandoc.hs, to make the conversion easier. We can switch it to the safer `runIO` in the future. Note that this required a change to Text.Pandoc.PDF as well. Since running an external program is necessarily IO, we can be clearer about using PandocIO.
2017-01-25Add runPure function.Jesse Rosenthal1-3/+29
This requires a default environment. The state variables are pretty straightforward. The env variables are a little trickier. I'm just making most of them empty for now. Note that some of them (like defaultReferenceDocx/ODT) will be coming out soon anyway.
2017-01-25Make PandocExecutionError an exceptionJesse Rosenthal1-6/+3
Until we fix fetchItem and fetchItem' to make use of MonadError, we have to thow an exception. We'll throw PandocFileReadError. Note that this is temporary.
2017-01-25Tests: have docx writer test use runIOorExplode.Jesse Rosenthal1-1/+2
Note that part of the reason for making a pure writer is to have better tests, so this is a temporary fix.
2017-01-25Pandoc.hs: Run `runIOorExplode` on IO functions.Jesse Rosenthal1-9/+17
This is a compatibility layer to reintroduce something like the old errors into the functions.
2017-01-25Make opaque typeclasses PandocPure and PandocIOJesse Rosenthal1-33/+75
2017-01-25Class: Specify Functor and ApplicativeJesse Rosenthal1-1/+1
We're still compiling for 7.8 which is pre-AMP, so let's just be explicit about it so we can use applicative notation.
2017-01-25Remove Text.Pandoc.FreeJesse Rosenthal2-270/+0
2017-01-25Convert writers to use PandocMonad typeclass.Jesse Rosenthal6-142/+122
Instead of Free Monad with runIO
2017-01-25Introduce PandocMonad typeclass.Jesse Rosenthal2-2/+205
This can be instantiated by both an IO monad or a pure State monad.
2017-01-25Remove GetPOSIXTime from Free monad.Jesse Rosenthal1-7/+2
We still export a P.getPOSIXTime function, but it's just internally defined in terms of P.getCurrentTime.
2017-01-25Free: Remove readFileUTF8.Jesse Rosenthal2-13/+1
This is just defined in term of a bytestring, so we convert when necessary.
2017-01-25Remove readFileStrict.Jesse Rosenthal2-13/+2
We only used it once, and then immediately converted to lazy.
2017-01-25Remove IO UUID functions.Jesse Rosenthal2-17/+2
2017-01-25Write Pure uuid function taking stdgen.Jesse Rosenthal1-11/+12
We're trying to cut down the necessarily IO functions. Since we alerady have a newStdGen function, we don't need this one.
2017-01-25ODT Writer: fix compiler complaint.Jesse Rosenthal1-1/+0
2017-01-25Free: Add Typeable instance to PandocActionErrorJesse Rosenthal1-2/+3
2017-01-25Finish pure writer of FB2.Jesse Rosenthal1-10/+17
2017-01-25FB2 writer: Rewrite image-fetching to use fetchItem.Jesse Rosenthal1-43/+11
This uses the function from shared, which will allow us to convert it over to the free monad.
2017-01-25Continue refactoring FB2 writer.Jesse Rosenthal1-8/+14
2017-01-25FB2 writer: bring functions to toplevel.Jesse Rosenthal1-47/+53
This is the first of a number of changes to bring the FB2 writer a bit closer to the idioms used elsewhere in pandoc, so it can be more easily converted to using the pure functions from Free.
2017-01-25Make pure rtf writer using free.Jesse Rosenthal1-4/+13
2017-01-25Fix up compiler warnings.Jesse Rosenthal1-1/+3
Export TestState and TestEnv, and remove redundant import.
2017-01-25Implement runTest functions.Jesse Rosenthal7-85/+177
These work with a State monad and a Reader monad to produce deterministic results. It can probably be simplified somewhat.
2017-01-25Remove IORef from EPUB writer.Jesse Rosenthal1-51/+62
2017-01-25Remove IORef from ODT writer.Jesse Rosenthal1-24/+38
We want pure writers, so IORef shouldn't be in there. We switch to using a normal State Monad. If this produces performance problems, we can look into trying STRefs, but that seems like unnecessary complication at the moment.
2017-01-25Introduce pure versions of IO Writers.Jesse Rosenthal4-90/+124
Using Text.Pandoc.Free, introduce pure versions of Docx, EPUB, ICML, and ODT writers. Each of the pure versions is exported along with the IO version (produced by running `runIO` on the pure reader). Ideally, this should make the writers easier to test.
2017-01-25New Free module, with pure versions of IO funcsJesse Rosenthal2-1/+211
Introduce a new module, Text.Pandoc.Free, with pure versions, based on the free monad, of numerous IO functions used in writers and readers. These functions are in a pure Monad (PandocAction). PandocAction takes as a parameter the type of IORefs in it. It can be aliased in individual writers and readers to avoid this parameter. Note that this means that at the moment a reader can only use one type of IORef. If possible, it would be nice to remove this limitation.
2017-01-25Adds support for pagebreaks (when it makes sense)Hubert Plociniczak22-11/+48
Update all writers to take into account page breaks. A straightforwad, far from complete, implementation of page breaks in selected writers. Readers will have to follow in the future as well.
2017-01-25Added page breaks into Pandoc.Hubert Plociniczak3-13/+61
This requires an updated version of pandoc-types that introduces PageBreak definition. Not that this initial commit only introduces ODT pagebreaks and distinguishes for it page breaks before, after, or both, the paragraph, as read from the style definition.
2017-01-25Copied a few changes from default.latex to default.beamer.John MacFarlane1-12/+7
(Wandmalfarbe)
2017-01-25Update list of listings languages in Highlighting.John MacFarlane1-54/+103
This allows more languages to be used when using the `--listings` option. Closes #3374.