aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App.hs
AgeCommit message (Collapse)AuthorFilesLines
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`.
2017-05-21Text.Pandoc.App: ToJSON and FromJSON instances for Opts.John MacFarlane1-5/+22
This can be used e.g. to pass options via web interface, such as trypandoc.
2017-05-21Finished implemtation of `--resource-path`.John MacFarlane1-2/+2
* Default is just working directory. * Working directory must be explicitly specifide if `--resource-path` option is used.
2017-05-20Added `--resource-path=SEARCHPATH` command line option.John MacFarlane1-1/+12
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.
2017-05-18Add `--eol` flag and writer option to control line endings.Stefan Dresselhaus1-5/+21
* 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.
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-07Rename fillMedia -> fillMediaBag.John MacFarlane1-2/+2
2017-05-07Moved fillMedia, extractMedia from App to Class.John MacFarlane1-49/+3
Also generalized type of fillMedia to any instance of PandocMonad.
2017-05-07Added PandocHttpException, trap exceptions in fetching from URLs.John MacFarlane1-4/+13
Closes #3646.
2017-05-07fillMediaBag: don't cause fatal error if resource not found.John MacFarlane1-10/+19
Report warning instead and change image to its alt text.
2017-05-07Allow `--extract-media` to work with non-binary input formats.John MacFarlane1-4/+26
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).
2017-05-07Simplify plumbing for document transformation.John MacFarlane1-25/+21
2017-04-15Small fix to error reporting in App.John MacFarlane1-4/+2
Closes #3548.
2017-04-15Error: Added PandocCouldNotFindDataFileError.John MacFarlane1-4/+4
Use this instead of PandocAppError when appropriate. Removed exit code from PandocAppError, use 1 for all.
2017-04-15App: use PandocOptionError instead of PandocAppError where appropriate.John MacFarlane1-16/+16
2017-04-15Error: Added PandocFilterError.John MacFarlane1-8/+4
2017-04-15Error: Added PandocPDFErrorJohn MacFarlane1-1/+1
2017-04-15Text.Pandoc.Error: added new constructors.John MacFarlane1-9/+6
- PandocSyntaxMapError String - PandocFailOnWarningError - PandocPDFProgramNotFoundError String
2017-04-15Revised error message for pandoc -t pdf.John MacFarlane1-4/+4
2017-04-04Error: Added PandocOptionError.John MacFarlane1-1/+1
2017-04-03Removed unused import.John MacFarlane1-1/+0
2017-04-02Text.Pandoc.App: Throw errors rather than exiting.John MacFarlane1-41/+53
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-04-01Allow a theme file as argument to `--highlight-style`.John MacFarlane1-2/+8
Also include a sample, `default.theme`, in `data/`.
2017-04-01Change MathJax CDN default since old one is shutting down.John MacFarlane1-1/+1
New URL: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js Announcement: https://www.mathjax.org/cdn-shutting-down/ NOTE: The new URL requires a version number, which we'll have to update manually in subsequent pandoc releases in order to take advantage of mathjax improvements. Closes #3544.
2017-03-31JATS writer: don't include jats.csl in metadata if csl already specified.John MacFarlane1-1/+3
2017-03-30Allow dynamic loading of syntax definitions.John MacFarlane1-1/+28
See #3334. * Add writerSyntaxMap to WriterOptions. * Highlighting: added parameter for SyntaxMap to highlight. * Implemented --syntax-definition option. TODO: [ ] Figure out whether we want to have the xml parsing depend on the dtd (it currently does, and fails unless the language.dtd is found in the same directory). [ ] Add an option to read a KDE syntax highlighting theme as a custom style. [ ] Add tests.
2017-03-30Don't read jats.csl unless we actually need it.John MacFarlane1-5/+6
2017-03-30Automatically include URI-encoded jats.csl for jats output.John MacFarlane1-2/+8
This way people can do pandoc -s -t jats --filter pandoc-citeproc and it will just work. If they want to specify a stylesheet, they still can.
2017-03-24Recognize .roff extension as ms format.John MacFarlane1-0/+1
2017-03-23Allow creation of pdf via groff ms and pdfroff.John MacFarlane1-4/+8
pandoc -t ms -o output.pdf input.txt
2017-03-23Initial addition of groff ms writer.John MacFarlane1-0/+1
* New module: Text.Pandoc.Writers.Ms. * New template: default.ms. * The writer uses texmath's new eqn writer to convert math to eqn format, so a ms file produced with this writer should be processed with `groff -ms -e` if it contains math.
2017-03-20Lua filters (#3514)Albert Krewinkel1-0/+16
* Add `--lua-filter` option. This works like `--filter` but takes pathnames of special lua filters and uses the lua interpreter baked into pandoc, so that no external interpreter is needed. Note that lua filters are all applied after regular filters, regardless of their position on the command line. * Add Text.Pandoc.Lua, exporting `runLuaFilter`. Add `pandoc.lua` to data files. * Add private module Text.Pandoc.Lua.PandocModule to supply the default lua module. * Add Tests.Lua to tests. * Add data/pandoc.lua, the lua module pandoc imports when processing its lua filters. * Document in MANUAL.txt.
2017-03-16Add default abbreviations file (data/abbreviations).John MacFarlane1-4/+4
This contains a list of strings that will be recognized by pandoc's Markdown parser as abbreviations. (A nonbreaking space will be inserted after the period, preventing a sentence space in formats like LaTeX.) Users can override the default by putting a file abbreviations in their user data directory (`~/.pandoc` on *nix).
2017-03-16Added --abbreviations=FILE option for custom abbreviations file.John MacFarlane1-8/+23
2017-03-07Re-enable support for custom lua writers.John MacFarlane1-1/+3
Closes #3495.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-109/+110
2017-03-04hlint refactoring.John MacFarlane1-12/+9
2017-02-27Removed `--epub-stylesheet`; use `--css` instead.John MacFarlane1-13/+2
* Removed writerEpubStylesheet in WriterOptions. * Removed `--epub-stylesheet` option. * Allow `--css` to be used with epub. * Allow multiple stylesheets to be used. * Stylesheets will be taken both from `--css` and from the `stylesheet` metadata field (which can contain either a file path or a list of them). Closes #3472, #847.
2017-02-25App: reverse optInputFiles so they come out in right order in templates.John MacFarlane1-1/+5
2017-02-25Add `sourcefile` and `outputfile` template variables (#3439)Roland Hieber1-0/+5
Closes #3431.
2017-02-25Make `--ascii` work with DocBook output too.John MacFarlane1-1/+4