aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Error.hs
AgeCommit message (Collapse)AuthorFilesLines
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-55/+61
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-09-29Raise error on unsupported extensions. Closes #4338.John MacFarlane1-0/+23
+ An error is now raised if you try to specify (enable or disable) an extension that does not affect the given format, e.g. `docx+pipe_tables`. + The `--list-extensions[=FORMAT]` option now lists only extensions that affect the given FORMAT. + Text.Pandoc.Error: Add constructors `PandocUnknownReaderError`, `PandocUnknownWriterError`, `PandocUnsupportedExtensionError`. [API change] + Text.Pandoc.Extensions now exports `getAllExtensions`, which returns the extensions that affect a given format (whether enabled by default or not). [API change] + Text.Pandoc.Extensions: change type of `parseFormatSpec` from `Either ParseError (String, Extensions -> Extensions)` to `Either ParseError (String, [Extension], [Extension])` [API change]. + Text.Pandoc.Readers: change type of `getReader` so it returns a value in the PandocMonad instance rather than an Either [API change]. Exceptions for unknown formats and unsupported extensions are now raised by this function and need not be handled by the calling function. + Text.Pandoc.Writers: change type of `getWriter` so it returns a value in the PandocMonad instance rather than an Either [API change]. Exceptions for unknown formats and unsupported extensions are now raised by this function and need not be handled by the calling function.
2019-09-12Better message for PandocShouldNeverHappenError.John MacFarlane1-1/+3
2019-09-12Change exit codes.John MacFarlane1-3/+3
It's good practice not to use codes 1-2 for user errors. Also, we used 65 for two different errors. - PandocAppError was 1, is now 4 - PandocOptionError was 2, is now 6 - PandocMakePDFError was 65, is now 66
2019-08-25Better message for PandocTemplateError.John MacFarlane1-1/+1
2019-03-01Remove license boilerplate.John MacFarlane1-17/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-22Support ipynb (Jupyter notebook) as input and output format.John MacFarlane1-0/+3
[API change] * Depend on ipynb library. * Add `ipynb` as input and output format. * Added Text.Pandoc.Readers.Ipynb (supports both nbformat v3 and v4). * Added Text.Pandoc.Writers.Ipynb (supports nbformat v4). * Added ipynb readers and writers to T.P.Readers, T.P.Writers, and T.P.Extensions. Register the file extension .ipynb for this format. * Add `PandocIpynbDecodingError` constructor to Text.Pandoc.Error.Error. * Note: there is no template for ipynb.
2018-11-29Add PandocUTF8DecodingError constructor for PandocError.John MacFarlane1-0/+7
[API change]
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-10-27Don't rely on syb when we don't need to.John MacFarlane1-1/+1
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-4/+4
2017-10-21In rendering PandocParsecError, only print input at error location...John MacFarlane1-1/+6
if the source name is `source` (i.e., the top level). Otherwise results will be misleading, since what readM does is to look up the source position of the error in the *original* input, which may not match the input used by parseFromString or in parsing from an included file. Closes #3865. Not a great fix, maybe there's something better that could be done, but this should at least avoid misleading messages.
2017-09-11Support for PDF generation via `weasyprint` and `prince` (#3909)Mauro Bieg1-1/+1
* Rename --latex-engine to --pdf-engine * In `Text.Pandoc.Options.WriterOptions`, rename `writerLaTeXEngine` to `writerPdfEngine` and `writerLaTeXArgs` to `writerPdfArgs`. * Add support for `weasyprint` and `prince`, in addition to `wkhtmltopdf`, for PDF generation via HTML (closes #3906). * `Text.Pandoc.PDF.html2pdf`: use stdin instead of intermediate HTML file
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-0/+3
This rewrite is primarily motivated by the need to get macros working properly. A side benefit is that the reader is significantly faster (27s -> 19s in one benchmark, and there is a lot of room for further optimization). We now tokenize the input text, then parse the token stream. Macros modify the token stream, so they should now be effective in any context, including math. Thus, we no longer need the clunky macro processing capacities of texmath. A custom state LaTeXState is used instead of ParserState. This, plus the tokenization, will require some rewriting of the exported functions rawLaTeXInline, inlineCommand, rawLaTeXBlock. * Added Text.Pandoc.Readers.LaTeX.Types (new exported module). Exports Macro, Tok, TokType, Line, Column. [API change] * Text.Pandoc.Parsing: adjusted type of `insertIncludedFile` so it can be used with token parser. * Removed old texmath macro stuff from Parsing. Use Macro from Text.Pandoc.Readers.LaTeX.Types instead. * Removed texmath macro material from Markdown reader. * Changed types for Text.Pandoc.Readers.LaTeX's rawLaTeXInline and rawLaTeXBlock. (Both now return a String, and they are polymorphic in state.) * Added orgMacros field to OrgState. [API change] * Removed readerApplyMacros from ReaderOptions. Now we just check the `latex_macros` reader extension. * Allow `\newcommand\foo{blah}` without braces. Fixes #1390. Fixes #2118. Fixes #3236. Fixes #3779. Fixes #934. Fixes #982.
2017-06-22Added `writerEpubSubdirectory` to `WriterOptions`.John MacFarlane1-0/+3
[API change] The EPUB writer now takes its EPUB subdirectory from this option. Also added `PandocEpubSubdirectoryError` to `PandocError`. This is raised if the EPUB subdirectory is not all ASCII alphanumerics. See #3720.
2017-06-20Text.Pandoc.Error: added PandocTemplateError.John MacFarlane1-0/+2
2017-06-02hlint suggestions.John MacFarlane1-1/+1
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-07Added PandocHttpException, trap exceptions in fetching from URLs.John MacFarlane1-0/+4
Closes #3646.
2017-05-02Added PandocResourceNotFound error.John MacFarlane1-0/+3
Use this instead of PandocIOError when a resource is not found in path. This improves the error message in this case, see #3629.
2017-04-15Error: Added PandocCouldNotFindDataFileError.John MacFarlane1-0/+3
Use this instead of PandocAppError when appropriate. Removed exit code from PandocAppError, use 1 for all.
2017-04-15Fixed shadowing warningsJohn MacFarlane1-5/+5
2017-04-15Error: Added PandocFilterError.John MacFarlane1-0/+3
2017-04-15Error: Added PandocPDFErrorJohn MacFarlane1-0/+2
2017-04-15Text.Pandoc.Error: added new constructors.John MacFarlane1-0/+7
- PandocSyntaxMapError String - PandocFailOnWarningError - PandocPDFProgramNotFoundError String
2017-04-04Error: Added PandocOptionError.John MacFarlane1-0/+2
2017-04-02Text.Pandoc.App: Throw errors rather than exiting.John MacFarlane1-1/+10
These are caught (and lead to exit) in pandoc.hs, but other uses of Text.Pandoc.App may want to recover in another way. Added PandocAppError to PandocError (API change). This is a stopgap: later we should have a separate constructor for each type of error. Also fixed uses of 'exit' in Shared.readDataFile, and removed 'err' from Shared (API change). Finally, removed the dependency on extensible-exceptions. See #3548.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-4/+5
2017-02-23Removed unnecessary import.John MacFarlane1-5/+1
2017-02-23Fix compiler warning for older GHC versions.John MacFarlane1-2/+5
2017-02-23Error: Changed PandocFileReadError to PandocIOErrorJohn MacFarlane1-2/+3
2017-02-19Error: added PandocMakePDFErrorJohn MacFarlane1-0/+2
2017-02-10Added Text.Pandoc.Logging (exported module).John MacFarlane1-8/+3
This now contains the Verbosity definition previously in Options, as well as a new LogMessage datatype that will eventually be used instead of raw strings for warnings. This will enable us, among other things, to provide machine-readable warnings if desired. See #3392.
2017-01-25Generic instance for PandocError.John MacFarlane1-1/+2
2017-01-25Error: change type of handleError.John MacFarlane1-11/+11
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-25Unify Errors.Jesse Rosenthal1-8/+18
2016-09-02Remove Text.Pandoc.Compat.ExceptJesse Rosenthal1-5/+0
2016-08-06Fix out of index error in handleErrorMatthew Pickering1-4/+8
In the latex parser when includes are processed, the text of the included file is directly included into the parse stream. This caused problems when there was an error in the included file (and the included file was longer than the original file) as the error would be reported at this position. The error handling tries to display the line and position where the error occured. It works by including a copy of the input and finding the place in the input when given the position of the error. In the previously described scenario, the input file would be the original source file but the error position would be the position of the error in the included file. The fix is to not try to show the exact line when it would cause an out-of-bounds error.
2016-03-22Updated copyright dates to include 2016.John MacFarlane1-2/+2
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-11Removed unnecessary import.John MacFarlane1-1/+1
2015-10-11Define Typeable and Exception instances for PandocError.John MacFarlane1-1/+6
Closes #2386.
2015-02-18Move utility error functions to Text.Pandoc.SharedMatthew Pickering1-8/+1
2015-02-18Update haddocks and copyright noticesMatthew Pickering1-2/+34
2015-02-18Add Text.Pandoc.Error module with PandocError typeMatthew Pickering1-0/+39