aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App
AgeCommit message (Collapse)AuthorFilesLines
2019-10-09Change optVariables from [(String, String)] to Context Text.John MacFarlane3-26/+36
In Text.Pandoc.App.Opt [API change].
2019-10-09Options.WriterOptions: Change type of writerVariables to Context Text.John MacFarlane1-0/+5
This will allow structured values. [API change]
2019-10-08Use th to derive json instance for LineEnding.John MacFarlane1-16/+4
2019-10-07Text.Pandoc.Options: change To/FromJSON instances for...John MacFarlane1-1/+3
HTMLMathMethod, CiteMethod, ObfuscationMethod, TrackChanges, WrapOption, TopLevelDivision, ReferenceLocation, HTMLSlideVariant. In each case we use lowercase (or hyphenated lowercase) for constructors to line up more closely with command-line option values. This is a breaking change for those who manually decode or encode JSON for these data types (e.g. for ReaderOptions or WriterOptions). See #5790.
2019-10-07Remove derive_json_via_th flag; always use TH.John MacFarlane2-17/+0
This cuts down on code duplication and reduces the chance for errors. See #4083.
2019-10-07Remove redundant import.John MacFarlane1-1/+0
2019-10-07Use typeMismatch.John MacFarlane1-1/+2
2019-10-06T.P.App.Opt: custom FromJSON instance for LineEnding.John MacFarlane1-8/+17
So either CRLF or crlf will work.
2019-10-06Opt: Change optHighlightStyle to a Maybe String instead of Maybe Style.John MacFarlane3-24/+28
Do the parsing/loading of themes later, after option parsing.
2019-10-06Code cleanupJohn MacFarlane1-19/+23
2019-10-06Text.Pandoc.App.Opt: Remove optBaseHeaderLevel from Opt.John MacFarlane2-3/+1
We now just use optShiftHeadingLevelBy, to avoid redundancy.
2019-10-06Text.Pandoc.App.Opt: Change optShiftHeadingLevel to optShiftHeadingLevelBy...John MacFarlane2-3/+3
to match the option.
2019-10-06Text.Pandoc.App.Opt: more convenient To/FromJSON instances.John MacFarlane1-5/+9
Make the field names like `strip-empty-paragraphs` rather than `optStripEmptyParagraphs`.
2019-09-29Raise error on unsupported extensions. Closes #4338.John MacFarlane2-21/+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-27LogMessage: change UnknownExtension -> CouldNotDeduceFormatJohn MacFarlane1-1/+1
2019-09-10Add --shift-heading-level-by option.John MacFarlane2-2/+17
Deprecate --base-heading-level. The new option does everything the old one does, but also allows negative shifts. It also promotes the document metadata (if not null) to a level-1 heading with a +1 shift, and demotes an initial level-1 heading to document metadata with a -1 shift. This supports converting documents that use an initial level-1 heading for the document title. Closes #5615.
2019-09-08Add -L option as shortcut for --lua-filter.John MacFarlane1-1/+1
2019-08-24Change optMetadataFile type from Maybe to List (#5702)Owen McGrath2-3/+3
Changed optMetadataFile from `Maybe FilePath` to `[FilePath]`. This allows for multiple YAML metadata files to be added. The new default value has been changed from `Nothing` to `[]`. To account for this change in `Text.Pandoc.App`, `metaDataFromFile` now operates on two `mapM` calls (for `readFileLazy` and `yamlToMeta`) and a fold. Added a test (command/5700.md) which tests this functionality and updated MANUAL.txt, as per the contributing guidelines. With the current behavior, using `foldr1 (<>)`, values within files specified first will be used over those in later files. (If the reverse of this behavior would be preferred, it should be fixed by changing foldr1 to foldl1.)
2019-07-28Use doctemplates 0.3, change type of writerTemplate.John MacFarlane2-6/+17
* Require recent doctemplates. It is more flexible and supports partials. * Changed type of writerTemplate to Maybe Template instead of Maybe String. * Remove code from the LaTeX, Docbook, and JATS writers that looked in the template for strings to determine whether it is a book or an article, or whether csquotes is used. This was always kludgy and unreliable. To use csquotes for LaTeX, set `csquotes` in your variables or metadata. It is no longer sufficient to put `\usepackage{csquotes}` in your template or header includes. To specify a book style, use the `documentclass` variable or `--top-level-division`. * Change template code to use new API for doctemplates.
2019-07-14Logging: Added UnknownExtensions constructor to LogMessage.John MacFarlane1-3/+9
[API change] Issue this warning when we're falling back to markdown or html because we don't recognize the extension of the input or output files.
2019-07-14Change formatForFilePaths to return a Maybe.John MacFarlane2-7/+8
Internal change. This will make it easier to emit messages when we're guessing at a format.
2019-06-13Don't look for template files remotely for remote input.John MacFarlane1-1/+10
Previously pandoc would look for the template at a remote URL when a URL was used for the input file, instead of taking it from the data-dir. Closes #5579.
2019-05-04Add template variable `curdir` with working directoryJohn MacFarlane1-0/+5
from which pandoc is run. Closes #5464.
2019-03-08Allow -o/--output to be used with --print-*.John MacFarlane1-6/+15
`--print-default-data-file` `--print-highlighting-style` `--print-default-template` Note that `-o` must occur BEFORE the `--print*` command on the command line (this is documented). Closes #5357.
2019-03-07Add tectonic as an option for --pdf-engine. (#5346)Cormac Relf1-1/+1
Closes #5345 Runs tectonic on STDIN instead of a temporary .tex file, so that it looks in the working directory for `\include` and `\input` like the rest of the engines. Allows overriding the output directory without messing up the args with `--pdf-engine-opt=--outdir --pdf-engine-opt="$DIR"`.
2019-03-02Use XDG data directory for user data directory.John MacFarlane1-9/+5
Instead of `$HOME/.pandoc`, the default user data directory is now `$XDG_DATA_HOME/pandoc`, where `XDG_DATA_HOME` defaults to `$HOME/.local/share` but can be overridden by setting the environment variable. If this directory is missing, then `$HOME/.pandoc` is searched instead, for backwards compatibility. However, we recommend moving local pandoc data files from `$HOME/.pandoc` to `$HOME/.local/share/pandoc`. On Windows the default user data directory remains the same. Closes #3582.
2019-03-01Rearrange --help output in a more rational way.John MacFarlane1-279/+280
Closes #5336.
2019-03-01Remove license boilerplate.John MacFarlane4-72/+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-28Shared: add filterIpynbOutput. [API change]John MacFarlane2-1/+13
Add command line option `--ipynb-output=all|none|best`. Closes #5339.
2019-02-27Add latexmk as an option for --pdf-engine.John MacFarlane1-1/+1
Closes #3195. Note that you can use --pdf-engine-opt=-outdir=bar to specify a persistent temp dir.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel4-8/+8
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-30Update copyright year in version.John MacFarlane1-1/+1
2019-01-28Add cpp to avoid warning.John MacFarlane1-1/+6
2019-01-27Add isPrefixOf to imports.John MacFarlane1-1/+1
2019-01-26Normalize Windows paths to account for change in ghc 8.6.John MacFarlane1-9/+31
When pandoc is compiled with ghc 8.6, Windows paths are treated differently, and paths beginning `\\server` no longer work. This commit rewrites such patsh to `\\?\UNC\server` which works. The change operates at the level of argument parsing, so it only affects the command line program. See #5127 and the discussion there.
2019-01-24Allow some command line options to take URL in addition to FILE.John MacFarlane1-2/+2
`--include-in-header`, `--include-before-body`, `--include-after-body`
2019-01-22Support ipynb (Jupyter notebook) as input and output format.John MacFarlane1-0/+1
[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-12-31Allow '-' in filenames for custom lua writers.John MacFarlane1-2/+3
Closes #5187.
2018-12-31Removed obsolete and misleading comment.John MacFarlane1-1/+0
2018-11-07T.P.App: fix regression in output format heuristicsAlbert Krewinkel1-47/+5
This fix is necessary due to a rebasing error introduced in commit 418bd42df85b93016e50ba48042804e8f51341b5
2018-11-07T.P.App: extract submodule T.P.App.FormatHeuristicsAlbert Krewinkel1-0/+94
Format guessing is used for input and output options and should be shared.
2018-11-06T.P.App: extract Opt into separate moduleAlbert Krewinkel3-178/+225
The new Opt module has only a few dependencies. This is important for compile-times during development, as Template Haskell containing modules are be recompiled whenever a (transitive) dependency changes.
2018-11-04Add cabal flag `derive_json_via_th`Albert Krewinkel1-2/+20
Disabling the flag will cause derivation of ToJSON and FromJSON instances via GHC Generics instead of Template Haskell. The flag is enabled by default, as deriving via Generics can be slow (see #4083).
2018-11-03App: extract output settings into moduleAlbert Krewinkel2-3/+319
2018-11-03App: extract command line options to separate moduleAlbert Krewinkel1-0/+1091