Commit graph

7817 commits

Author SHA1 Message Date
John MacFarlane
92cc80b58b RST reader: implement start-after, end-before fields for include. 2017-01-25 17:07:40 +01:00
John MacFarlane
03ede3e312 RST reader: handle code, literal, number-lines, class, name for include. 2017-01-25 17:07:40 +01:00
John MacFarlane
d595702b17 RST reader include: handle negative values for start-, end-line. 2017-01-25 17:07:40 +01:00
John MacFarlane
223dff4d29 RST reader: support start-line and end-line in include.
Just skip other options for now.
2017-01-25 17:07:40 +01:00
John MacFarlane
ad3ff342dd RST reader: Simple .. include:: support.
TODO: handle the options (see comment in code).
See #223.
2017-01-25 17:07:40 +01:00
John MacFarlane
70aa7b0485 Added --fail-if-warnings option. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
57cff4b8ae Class: Functions for dealing with PureState
There are two states in PandocPure, but it is only easy to deal with
CommonState. In the past, to do state monad operations on
PureState (the state specific to PandocPure) you had to add (lift
. lift) to the monadic operation and then rewrap in the newtype. This
adds four functions ({get,gets,put,modify}PureState) corresponding to
normal state monad operations. This allows the user to modify
PureState in PandocPure without worrying about where it sits in the
monad stack or rewrapping the newtype.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
15708f0b0f Class: rename env* prefixed fields to st*.
This was left over from when they were part of an environment.
2017-01-25 17:07:40 +01:00
John MacFarlane
7bf0813814 Shared: changed err and warn output.
Don't print program name in either case.
Print [warning] for warnings.
2017-01-25 17:07:40 +01:00
John MacFarlane
c55a98ff0d LaTeX reader: Make sure we process includes in preamble. 2017-01-25 17:07:40 +01:00
John MacFarlane
7a68617556 LaTeX reader: further fixes to include. 2017-01-25 17:07:40 +01:00
John MacFarlane
62b30d8418 Give source position for include file loop. 2017-01-25 17:07:40 +01:00
John MacFarlane
d7583f3659 Error: change type of handleError.
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-25 17:07:40 +01:00
John MacFarlane
1a0d93a1d3 LaTeX reader: Proper include file processing.
* 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-25 17:07:40 +01:00
John MacFarlane
dc1bbaf58d Removed readRSTWithWarnings (now useless). 2017-01-25 17:07:40 +01:00
John MacFarlane
38064498d9 Parsing: Removed obsolete warnings stuff.
Removed stateWarnings, addWarning, and readWithWarnings.
2017-01-25 17:07:40 +01:00
John MacFarlane
1ed925ac20 TWiki reader: Remove old readTWikiWithWarnings'.
We get warnings for free now from PandocM.
(And anyway, this reader doesn't generate any!)
2017-01-25 17:07:40 +01:00
John MacFarlane
a4bd650277 Class: rename addWarning[WithPos] to warning[WithPos].
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-25 17:07:40 +01:00
John MacFarlane
63dc6bd025 Added a --quiet option to suppress warnings.
Use this also in Tests.Old.
2017-01-25 17:07:40 +01:00
John MacFarlane
2710fc4261 Class: Renamed 'warn' to 'addWarning' and consolidated RTF writer.
* 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-25 17:07:40 +01:00
John MacFarlane
5ab8909661 New withWarningsToStderr exported from Text.Pandoc.Class.
And use this in pandoc.hs so that messages actually get printed.
2017-01-25 17:07:40 +01:00
John MacFarlane
29b3975cbe Make sure texMathToInlines issues warning. 2017-01-25 17:07:40 +01:00
John MacFarlane
830be4d632 Refactored math conversion in writers.
* 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-25 17:07:40 +01:00
Jesse Rosenthal
221f878c0e Class: cleanup and clarification. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
912eee362b Remove OverlappingInstances pragma.
It doesn't help to solve the problem in 7.8.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
3cda737dbd Remove redundant import. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
e35c6c9e4d Try adding OverlappingInstances pragma to parsing.
It's having trouble figuring out HasQuoteContext.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
650fa20788 Readers: pass errors straight up to PandocMonad.
Since we've unified error types, we can just throw the same error at
the toplevel.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
9d69c51527 ODT test: remove unnecessary imports. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
c4c56b8c04 Fix rebasing errors. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
d5051ae101 Remove redundant imports from OPML reader. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
5a81c914e7 Remove reader from PandocPure.
Make it all state. This will make it easier to set things.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
06eb9cfb34 Make Txt2Tags test pass.
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-25 17:07:40 +01:00
Jesse Rosenthal
4fe499d3f2 Have a common state for all PandocMonad instances. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
5ede57122c Update all tests to use new readers and error structure. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
3574b98f81 Unify Errors. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
52859b9863 Finish converting readers over. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
5a02a81b43 Have to do some work to get the mediabag out. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
3f7b3f5fd0 Add Text2Tags to Text.Pandoc 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
6a9a38c92d Add input and output filepaths to PandocMonad.
We'll want these in a number of places, but right now it will be
necessary for the macros in T2T.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
9d9f615593 Add Zoned time to class. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
fe0b71a2f1 Class: Add getModificationTime
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-25 17:07:40 +01:00
Jesse Rosenthal
b53ebcdf8e Working on readers. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
840439ab2a Add IncoherentInstances pragma for HasQuotedContext.
We can remove this if we can figure out a better way to do this.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
d9f5f551dd Class: add setMediaBag function. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
d447552be1 Add ParseError to PandocExecutionError.
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-25 17:07:40 +01:00
Jesse Rosenthal
b34bb8be01 List derived instances vertically one-per-line for readability. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
97be338188 Change Test{State,Env} to Pure{State,Env}
This was left over from when the pure function was called runTest.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
2fc47ceebf Class: Add MediaBag to MonadState. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
cc7191b3b1 Class: Add stateful IO warnings, and function to get warndings.
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-25 17:07:40 +01:00