summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App.hs
Commit message (Collapse)AuthorAge
...
* Support for PDF generation via `weasyprint` and `prince` (#3909)Mauro Bieg2017-09-11
| | | | | | | * 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
* Revision to binary format output to stdout:John MacFarlane2017-08-16
| | | | | | | | We now allow default output to stdout when it can be determined that the output is being piped. (On Windows, as mentioned before, this can't be determined.) Using '-o -' forces output to stdout regardless.
* Change behavior with binary format output to stdout.John MacFarlane2017-08-16
| | | | | | | | | | | | | Previously, for binary formats, output to stdout was disabled unless we could detect that the output was being piped (and not sent to the terminal). Unfortunately, such detection is not possible on Windows, leaving windows users no way to pipe binary output. So we have changed the behavior in the following way: * If the -o option is not used, binary output is never sent to stdout by default; instead, an error is raised. * IF '-o -' is used, binary output is sent to stdout, regardless of whether it is being piped. This works on Windows too.
* Remove initial check for pdf creating program.John MacFarlane2017-08-15
| | | | | | | | | | | | | | Instead, just try running it and raise the exception if it isn't found at that point. This improves things for users of Cygwin on Windows, where the executable won't be found by `findExecutable` unless `.exe` is added. The same exception is raised as before, but at a later point. Closes #3819.
* Set user data dir at beginning, so readDataFile has access to it.John MacFarlane2017-08-12
|
* Added support for translations (localization) (see #3559).John MacFarlane2017-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | * readDataFile, readDefaultDataFile, getReferenceDocx, getReferenceODT have been removed from Shared and moved into Class. They are now defined in terms of PandocMonad primitives, rather than being primitve methods of the class. * toLang has been moved from BCP47 to Class. * NoTranslation and CouldNotLoudTranslations have been added to LogMessage. * New module, Text.Pandoc.Translations, exporting Term, Translations, readTranslations. * New functions in Class: translateTerm, setTranslations. Note that nothing is loaded from data files until translateTerm is used; setTranslation just sets the language to be used. * Added two translation data files in data/translations. * LaTeX reader: Support `\setmainlanguage` or `\setdefaultlanguage` (polyglossia) and `\figurename`.
* Remove writerUserDataDir from WriterOptions.John MacFarlane2017-08-10
| | | | | It is now carried in CommonState in PandocMonad instances. (And thus it can be used by readers too.)
* Removed datadir param from readDataFile and getDefaultTemplate.John MacFarlane2017-08-10
| | | | | In Text.Pandoc.Class and Text.Pandoc.Template, resp. We now get the datadir from CommonState.
* Expose getDefaultDataFile in both Shared and Class.John MacFarlane2017-08-10
|
* Removed redundant import.John MacFarlane2017-08-08
|
* Issue deprecation warning for `markdown_github`.John MacFarlane2017-08-07
| | | | Advise to use `gfm` instead.
* Class: Removed unnecessary withMedia, improved haddocks.John MacFarlane2017-07-30
|
* Templates: change signature of getDefaultTemplate.John MacFarlane2017-07-19
| | | | | Now it runs in any instance of PandocMonad, and returns a String rather than an Either value.
* Print informative message when failing with use of `--normalize`.John MacFarlane2017-07-12
| | | | | | | | We may want to think of some kind of graceful fallback, but the present behavior has the advantage of forcing people to update scripts when updating to pandoc 2.0. See #3786.
* Rewrote LaTeX reader with proper tokenization.John MacFarlane2017-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make `east_asian_line_breaks` affect all readers/writers.John MacFarlane2017-06-30
| | | | Closes #3703.
* Added parameter for user data directory to runLuaFilter.John MacFarlane2017-06-29
| | | | | | | | | | in Text.Pandoc.Lua. Also to pushPandocModule. This change allows users to override pandoc.lua with a file in their local data directory, adding custom functions, etc. @tarleb, if you think this is a bad idea, you can revert this. But in general our data files are all overridable.
* Readers.getReader, Writers.getWriter API change.John MacFarlane2017-06-24
| | | | | | | | | | | | | Now these functions return a pair of a reader/writer and an Extensions, instead of building the extensions into the reader/writer. The calling code must explicitly set readerExtensions or writerExtensions using the Extensions returned. The point of the change is to make it possible for the calling code to determine what extensions are being used. See #3659.
* Added `--epub-subdirectory` option.John MacFarlane2017-06-22
| | | | | | | This specifies the subdirectory in the OCF container that holds the EPUB specific content. Closes #3720.
* Move CR filtering from tabFilter to the readers.John MacFarlane2017-06-20
| | | | | | | | | | The readers previously assumed that CRs had been filtered from the input. Now we strip the CRs in the readers themselves, before parsing. (The point of this is just to simplify the parsers.) Shared now exports a new function `crFilter`. [API change] And `tabFilter` no longer filters CRs.
* App: issue proper errors instead of using 'error'.John MacFarlane2017-06-20
|
* Text.Pandoc.Lua: throw LuaException instead of using 'error'.John MacFarlane2017-06-20
| | | | Text.Pandoc.App: trap LuaException and issue a PandocFilterError.
* Separated tracing from logging.John MacFarlane2017-06-19
| | | | | | | | | | | Formerly tracing was just log messages with a DEBUG log level. We now make these things independent. Tracing can be turned on or off in PandocMonad using `setTrace`; it is independent of logging. * Removed `DEBUG` from `Verbosity`. * Removed `ParserTrace` from `LogMessage`. * Added `trace`, `setTrace` to `PandocMonad`.
* Text.Pandoc.Writers.Math: export defaultMathJaxURL, defaultKaTeXURL.John MacFarlane2017-06-19
| | | | | | | | This will ensure that we only need to update these in one place. (Currently, for example, the mathjax URL is used in both App and trypandoc.) Closes #3685.
* Properly decode source from stdin.John MacFarlane2017-06-11
| | | | This should fix the appveyor failures.
* Switched Writer types to use Text.John MacFarlane2017-06-11
| | | | | | | | | | | * XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
* Changed all readers to take Text instead of String.John MacFarlane2017-06-10
| | | | | | | | Readers: Renamed StringReader -> TextReader. Updated tests. API change.
* App: change readSource(s) to use Text instead of String.John MacFarlane2017-06-10
|
* hlint suggestions.John MacFarlane2017-06-02
|
* Some hlint refactoring.John MacFarlane2017-06-01
|
* Use isNothing.John MacFarlane2017-06-01
|
* Trivial renaming.John MacFarlane2017-06-01
|
* Shared: Provide custom isURI that rejects unknown schemes [isURI]Albert Krewinkel2017-05-23
| | | | | | | | | | | | | | | | | | | We also export the set of known `schemes`. The new function replaces the function of the same name from `Network.URI`, as the latter did not check whether a scheme is well-known. E.g. MediaWiki wikis frequently feature pages with names like `User:John`. These links were interpreted as URIs, thus turning internal links into global links. This is prevented by also checking whether the scheme of a URI is frequently used (i.e. is IANA registered or an otherwise well-known scheme). Fixes: #2713 Update set of well-known URIs from IANA list All official IANA schemes (as of 2017-05-22) are included in the set of known schemes. The four non-official schemes doi, isbn, javascript, and pmid are kept.
* Let `--eol` take `native` as an argument.John MacFarlane2017-05-22
| | | | | Add `Native` to the `LineEnding` type. Make `optEol` a `Native` rather than `Maybe Native`.
* Text.Pandoc.App: ToJSON and FromJSON instances for Opts.John MacFarlane2017-05-21
| | | | | This can be used e.g. to pass options via web interface, such as trypandoc.
* Finished implemtation of `--resource-path`.John MacFarlane2017-05-21
| | | | | | * Default is just working directory. * Working directory must be explicitly specifide if `--resource-path` option is used.
* Added `--resource-path=SEARCHPATH` command line option.John MacFarlane2017-05-20
| | | | | | | | | | | | | | | | SEARCHPATH is separated by the usual character, depending on OS (: on unix, ; on windows). Note: This does not yet work for PDF output, because the routine that creates PDFs runs outside PandocMonad. (This has to do with its use of inTemporaryDirectory and its interaction with our exceptions.) The best solution would be to figure out how to move the PDF creation routines into PandocMonad. Second-best, just pass an extra parameter in? See #852.
* Add `--eol` flag and writer option to control line endings.Stefan Dresselhaus2017-05-18
| | | | | | | | | | | | * Add `--eol=crlf|lf` CLI option. * Add `optEol` to `WriterOptions` [API change] * In `Text.Pandoc.UTF8`, add new functions parameterized on `Newline`: `writeFileWith`, `putStrWith`, `putStrLnWith`, `hPutStrWith`, `hPutStrLnWith`. [API change] * Document option in MANUAL.txt. Closes #3663. Closes #2097.
* Update dates in copyright noticesAlbert Krewinkel2017-05-13
| | | | | This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
* Rename fillMedia -> fillMediaBag.John MacFarlane2017-05-07
|
* Moved fillMedia, extractMedia from App to Class.John MacFarlane2017-05-07
| | | | Also generalized type of fillMedia to any instance of PandocMonad.
* Added PandocHttpException, trap exceptions in fetching from URLs.John MacFarlane2017-05-07
| | | | Closes #3646.
* fillMediaBag: don't cause fatal error if resource not found.John MacFarlane2017-05-07
| | | | Report warning instead and change image to its alt text.
* Allow `--extract-media` to work with non-binary input formats.John MacFarlane2017-05-07
| | | | | | | | | | | | | | | | | | | | | If `--extract-media` is supplied with a non-binary input format, pandoc will attempt to extract the contents of all linked images, whether in local files, data: uris, or external uris. They will be named based on the sha1 hash of the contents. Closes #1583, #2289. Notes: - One thing that is slightly subideal with this commit is that identical resources will be downloaded multiple times. To improve this we could have mediabag store an original filename/url + a new name. - We might think about reusing some of this code, since more or less the same thing is done in the Docx, EPUB, PDF writers (with slight variations).
* Simplify plumbing for document transformation.John MacFarlane2017-05-07
|
* Small fix to error reporting in App.John MacFarlane2017-04-15
| | | | Closes #3548.
* Error: Added PandocCouldNotFindDataFileError.John MacFarlane2017-04-15
| | | | | Use this instead of PandocAppError when appropriate. Removed exit code from PandocAppError, use 1 for all.
* App: use PandocOptionError instead of PandocAppError where appropriate.John MacFarlane2017-04-15
|
* Error: Added PandocFilterError.John MacFarlane2017-04-15
|
* Error: Added PandocPDFErrorJohn MacFarlane2017-04-15
|