Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
We can remove this if we can figure out a better way to do this.
|
|
|
|
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.
|
|
|
|
This was left over from when the pure function was called runTest.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
|
|
OPML writer should note include `_notes` attribute when there's
no content.
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Note that part of the reason for making a pure writer is to have better
tests, so this is a temporary fix.
|
|
This is a compatibility layer to reintroduce something like the old
errors into the functions.
|
|
|
|
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.
|
|
|
|
Instead of Free Monad with runIO
|
|
This can be instantiated by both an IO monad or a pure State monad.
|
|
We still export a P.getPOSIXTime function, but it's just internally
defined in terms of P.getCurrentTime.
|
|
This is just defined in term of a bytestring, so we convert when necessary.
|
|
We only used it once, and then immediately converted to lazy.
|
|
|
|
We're trying to cut down the necessarily IO functions. Since we alerady
have a newStdGen function, we don't need this one.
|
|
|
|
|
|
|
|
This uses the function from shared, which will allow us to convert it
over to the free monad.
|
|
|
|
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.
|
|
|
|
Export TestState and TestEnv, and remove redundant import.
|
|
These work with a State monad and a Reader monad to produce
deterministic results. It can probably be simplified somewhat.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|