aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2017-01-25Make Txt2Tags test pass.Jesse Rosenthal1-0/+1
We don't have a good way to set things that aren't in the common state. That will be the next order of business.
2017-01-25Have a common state for all PandocMonad instances.Jesse Rosenthal1-81/+63
2017-01-25Unify Errors.Jesse Rosenthal26-62/+81
2017-01-25Finish converting readers over.Jesse Rosenthal1-0/+12
2017-01-25Add Text2Tags to Text.PandocJesse Rosenthal1-3/+3
2017-01-25Add input and output filepaths to PandocMonad.Jesse Rosenthal1-12/+48
We'll want these in a number of places, but right now it will be necessary for the macros in T2T.
2017-01-25Add Zoned time to class.Jesse Rosenthal1-1/+15
2017-01-25Class: Add getModificationTimeJesse Rosenthal1-9/+37
This is to enable macros in T2T, but can be used for other stuff in the future, I imagine. This requires building up the info in our fake file trees. Note the version in IO is safe.
2017-01-25Working on readers.Jesse Rosenthal25-1111/+1279
2017-01-25Add IncoherentInstances pragma for HasQuotedContext.Jesse Rosenthal1-1/+3
We can remove this if we can figure out a better way to do this.
2017-01-25Class: add setMediaBag function.Jesse Rosenthal1-0/+6
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 MacFarlane1-3/+6
2017-01-25Deleted whitespace at end of source lines.John MacFarlane7-9/+9
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-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-25Fixes to compile after rebase.John MacFarlane2-3/+4
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 Rosenthal23-190/+227
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-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 Rosenthal1-269/+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 Rosenthal1-0/+202
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 Rosenthal6-84/+176
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 Rosenthal1-0/+209
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.