aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2017-01-25Error: change type of handleError.John MacFarlane2-12/+12
It now lives in IO and gives a proper message + exit instead of calling 'error'. We shouldn't be making it easier for people to raise error on pure code. And this is better for the main application in IO.
2017-01-25LaTeX reader: Proper include file processing.John MacFarlane2-111/+35
* Removed handleIncludes from LaTeX reader [API change]. * Now the ordinary LaTeX reader handles includes in a way that is appropriate to the monad it is run in.
2017-01-25Removed readRSTWithWarnings (now useless).John MacFarlane1-10/+1
2017-01-25Parsing: Removed obsolete warnings stuff.John MacFarlane1-21/+3
Removed stateWarnings, addWarning, and readWithWarnings.
2017-01-25TWiki reader: Remove old readTWikiWithWarnings'.John MacFarlane1-18/+5
We get warnings for free now from PandocM. (And anyway, this reader doesn't generate any!)
2017-01-25Class: rename addWarning[WithPos] to warning[WithPos].John MacFarlane11-42/+40
There's already a function addWarning in Parsing! Maybe we can dispense with that now, but I still like 'warning' better as a name.
2017-01-25Class: Renamed 'warn' to 'addWarning' and consolidated RTF writer.John MacFarlane10-39/+41
* Renaming Text.Pandoc.Class.warn to addWarning avoids conflict with Text.Pandoc.Shared.warn. * Removed writeRTFWithEmbeddedImages from Text.Pandoc.Writers.RTF. This is no longer needed; we automatically handle embedded images using the PandocM functions. [API change]
2017-01-25New withWarningsToStderr exported from Text.Pandoc.Class.John MacFarlane1-1/+11
And use this in pandoc.hs so that messages actually get printed.
2017-01-25Make sure texMathToInlines issues warning.John MacFarlane1-1/+3
2017-01-25Refactored math conversion in writers.John MacFarlane11-416/+488
* Remove exported module `Text.Pandoc.Readers.TeXMath` * Add exported module `Text.Pandoc.Writers.Math` * The function `texMathToInlines` now lives in `Text.Pandoc.Writers.Math` * Export helper function `convertMath` from `Text.Pandoc.Writers.Math` * Use these functions in all writers that do math conversion. This ensures that warnings will always be issued for failed math conversions.
2017-01-25Class: cleanup and clarification.Jesse Rosenthal1-22/+6
2017-01-25Remove OverlappingInstances pragma.Jesse Rosenthal1-1/+0
It doesn't help to solve the problem in 7.8.
2017-01-25Try adding OverlappingInstances pragma to parsing.Jesse Rosenthal1-0/+1
It's having trouble figuring out HasQuoteContext.
2017-01-25Readers: pass errors straight up to PandocMonad.Jesse Rosenthal8-13/+8
Since we've unified error types, we can just throw the same error at the toplevel.
2017-01-25Fix rebasing errors.Jesse Rosenthal2-2/+2
2017-01-25Remove redundant imports from OPML reader.Jesse Rosenthal1-2/+0
2017-01-25Remove reader from PandocPure.Jesse Rosenthal1-50/+43
Make it all state. This will make it easier to set things.
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.