aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-10-15App: added --request-header option.John MacFarlane1-8/+17
2017-10-15Handle unknown options in form `--latex-engine=foo`.John MacFarlane1-1/+2
Previously these were not triggering the helpful message about option name changes.
2017-10-06Removed redundant importJohn MacFarlane1-1/+0
2017-10-05KaTeX fixes:John MacFarlane1-22/+4
* In Options.HTMLMathMethod, the KaTeX contsructor now takes only one string (for the KaTeX base URL), rather than two [API change]. * The default URL has been updated to the latest version. * The autoload script is now loaded by default.
2017-09-30Removed Verbosity and MediaBag params from makePDF.John MacFarlane1-3/+2
They can be obtained from CommonState since we're in PandocIO.
2017-09-30Removed writerSourceURL, add source URL to common state.John MacFarlane1-17/+8
Removed `writerSourceURL` from `WriterOptions` (API change). Added `stSourceURL` to `CommonState`. It is set automatically by `setInputFiles`. Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`. The type of `getInputFiles` has changed; it now returns `[FilePath]` instead of `Maybe [FilePath]`. Functions in Class that formerly took the source URL as a parameter now have one fewer parameter (`fetchItem`, `downloadOrRead`, `setMediaResource`, `fillMediaBag`). Removed `WriterOptions` parameter from `makeSelfContained` in `SelfContained`.
2017-09-30Run Lua filters before extracting mediaAlbert Krewinkel1-2/+2
This enables users to change the media files being extracted via lua filters.
2017-09-30Text.Pandoc.Lua: add mediabag submoduleAlbert Krewinkel1-7/+6
2017-09-28Support R filters #3940 (#3941)Andrie de Vries1-0/+1
2017-09-26Lua filters: set global FORMAT instead of args.John MacFarlane1-4/+4
This changes the type of runLuaFilter.
2017-09-20Fixed bug in determining writer for xelatex engine.John MacFarlane1-1/+1
This revises the last commit, fixing #3931.
2017-09-19Fix and simply latex engine code in App.John MacFarlane1-47/+44
Fixes #3931.
2017-09-17Added `--strip-comments` option, `readerStripComments` in `ReaderOptions`.John MacFarlane1-0/+8
* Options: Added readerStripComments to ReaderOptions. * Added `--strip-comments` command-line option. * Made `htmlTag` from the HTML reader sensitive to this feature. This affects Markdown and Textile input. Closes #2552.
2017-09-15Set PANDOC_READER_OPTIONS in environment where filters are run.John MacFarlane1-7/+16
This contains a JSON representation of ReaderOptions.
2017-09-12Add default pdf engine for beamer.John MacFarlane1-0/+1
2017-09-12Use defaultLatexEngine instead of `head latexEngines`.John MacFarlane1-3/+9
Partial functions make me nervous.
2017-09-11Support for PDF generation via `weasyprint` and `prince` (#3909)Mauro Bieg1-41/+77
* 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-08-16Revision to binary format output to stdout:John MacFarlane1-3/+14
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.
2017-08-16Change behavior with binary format output to stdout.John MacFarlane1-19/+12
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.
2017-08-15Remove initial check for pdf creating program.John MacFarlane1-4/+0
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.
2017-08-12Set user data dir at beginning, so readDataFile has access to it.John MacFarlane1-1/+2
2017-08-11Added support for translations (localization) (see #3559).John MacFarlane1-166/+175
* 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`.
2017-08-10Remove writerUserDataDir from WriterOptions.John MacFarlane1-1/+0
It is now carried in CommonState in PandocMonad instances. (And thus it can be used by readers too.)
2017-08-10Removed datadir param from readDataFile and getDefaultTemplate.John MacFarlane1-4/+9
In Text.Pandoc.Class and Text.Pandoc.Template, resp. We now get the datadir from CommonState.
2017-08-10Expose getDefaultDataFile in both Shared and Class.John MacFarlane1-3/+3
2017-08-08Removed redundant import.John MacFarlane1-1/+0
2017-08-07Issue deprecation warning for `markdown_github`.John MacFarlane1-1/+5
Advise to use `gfm` instead.
2017-07-30Class: Removed unnecessary withMedia, improved haddocks.John MacFarlane1-2/+3
2017-07-19Templates: change signature of getDefaultTemplate.John MacFarlane1-3/+4
Now it runs in any instance of PandocMonad, and returns a String rather than an Either value.
2017-07-12Print informative message when failing with use of `--normalize`.John MacFarlane1-0/+2
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.
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-1/+0
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-30Make `east_asian_line_breaks` affect all readers/writers.John MacFarlane1-4/+13
Closes #3703.
2017-06-29Added parameter for user data directory to runLuaFilter.John MacFarlane1-1/+1
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.
2017-06-24Readers.getReader, Writers.getWriter API change.John MacFarlane1-5/+9
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.
2017-06-22Added `--epub-subdirectory` option.John MacFarlane1-0/+10
This specifies the subdirectory in the OCF container that holds the EPUB specific content. Closes #3720.
2017-06-20Move CR filtering from tabFilter to the readers.John MacFarlane1-2/+2
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.
2017-06-20App: issue proper errors instead of using 'error'.John MacFarlane1-2/+3
2017-06-20Text.Pandoc.Lua: throw LuaException instead of using 'error'.John MacFarlane1-3/+9
Text.Pandoc.App: trap LuaException and issue a PandocFilterError.
2017-06-19Separated tracing from logging.John MacFarlane1-2/+5
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`.
2017-06-19Text.Pandoc.Writers.Math: export defaultMathJaxURL, defaultKaTeXURL.John MacFarlane1-4/+6
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.
2017-06-11Properly decode source from stdin.John MacFarlane1-2/+1
This should fix the appveyor failures.
2017-06-11Switched Writer types to use Text.John MacFarlane1-11/+18
* 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.
2017-06-10Changed all readers to take Text instead of String.John MacFarlane1-3/+3
Readers: Renamed StringReader -> TextReader. Updated tests. API change.
2017-06-10App: change readSource(s) to use Text instead of String.John MacFarlane1-10/+14
2017-06-02hlint suggestions.John MacFarlane1-0/+1
2017-06-01Some hlint refactoring.John MacFarlane1-19/+18
2017-06-01Use isNothing.John MacFarlane1-2/+2
2017-06-01Trivial renaming.John MacFarlane1-8/+8
2017-05-23Shared: Provide custom isURI that rejects unknown schemes [isURI]Albert Krewinkel1-2/+2
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.
2017-05-22Let `--eol` take `native` as an argument.John MacFarlane1-12/+13
Add `Native` to the `LineEnding` type. Make `optEol` a `Native` rather than `Maybe Native`.