aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App
AgeCommit message (Collapse)AuthorFilesLines
2019-11-13Use `atx-headers` rather than `setext-headers` in defaults file...John MacFarlane1-2/+2
for consistency with CLI options. See #5894.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc4-107/+111
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-11-07Fix list fields in Opt so they aren't reversed.John MacFarlane2-28/+24
Previously optIncludeInHeader, etc. were in reverse order. This has been changed to promote #5881. Note also that the `sourcefile` variable used to be sometimes a string, sometimes a list (when there was more than one). Now it is always a list.
2019-11-07Change merge behavior for metadata.John MacFarlane1-1/+1
Previously, if a document contained two YAML metadata blocks that set the same field, the conflict would be resolved in favor of the first. Now it is resolved in favor of the second (due to a change in pandoc-types). This makes the behavior more uniform with other things in pandoc (such as reference links and `--metadata-file`).
2019-11-06Add and apply filters in order (not reversed).John MacFarlane1-4/+2
This changes `applyFilters` from Text.Pandoc.Filter so that it does a left fold rather than a right fold, applying the filters in the order listed. [behavior change] The command-line arguments are accumulated in order instead of reverse order. A first step twoards #5881.
2019-11-06Allow singular input-file in defaults file.John MacFarlane1-0/+4
Closes #5877.
2019-11-03Allow pdf output to stdout.John MacFarlane1-12/+15
PDF output will not be output to the terminal, but can be sent to stdout using either `-o -` or a pipe. The intermediate format will be determined based on the setting of `--pdf-engine`. Closes #5751.
2019-11-02Move extension-adding to applyDefaultsJohn MacFarlane1-6/+5
2019-11-01Revert "ALlow multiple comma-separated files for `--defaults`."John MacFarlane1-7/+6
This reverts commit e96f3fd813b3f8b73c3457ff6e9177e2a4a74164.
2019-11-01ALlow multiple comma-separated files for `--defaults`.John MacFarlane1-6/+7
2019-11-01Factor out applyDefaults in T.P.A.CommandLineOptions.John MacFarlane1-20/+24
2019-11-01`--defaults` improvements.John MacFarlane2-89/+114
- ToYAML instance is now for `Opt -> Opt`, rather than `Opt`. - This allows us to handle `--defaults` without clobbering all the options that occur prior to `--defaults` on the command line. (Note, however, that options in `--defaults` can replace these options if the `--defaults` option is used after them, which may be a bit confusing given the name.) - `--defaults` may now be used multiple times on the command line, allowing users to break defaults into different chunks.
2019-10-29Changes to build with new doctemplates/doclayout.John MacFarlane1-1/+2
The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata.
2019-10-11Allow output-file to be null in --defaults.John MacFarlane1-1/+1
2019-10-11Remove redundant import.John MacFarlane1-1/+0
2019-10-10Improve parsing of --defaults.John MacFarlane3-31/+254
- Add FromYAML instances to Opt and to all subsidiary types. - Remove the use of HsYAML-aeson, which doesn't give good position information on errors. - Rename some fields in Opt to better match cli options or reflect what the ycontain [API change]: + optMetadataFile -> optMetadataFiles + optPDFEngineArgs -> optPDFEngineOpts + optWrapText -> optWrap - Add IpynbOutput enumerated type to Text.Pandoc.App.Opts. Use this instead fo a string for optIpynbOutput. - Add FromYAML instance for Filter in Text.Pandoc.Filters. With these changes parsing of defaults files should be complete and should give decent error messages. Now (unlike before) we get an error if an unknown field is used.
2019-10-10Add -d as synonym for --defaults.John MacFarlane1-1/+1
2019-10-10Reorder options in `--help`.John MacFarlane1-58/+58
2019-10-10`--metadata-file`: when multiple files specified, second takes precedence...John MacFarlane1-1/+1
on conflicting fields. This changes earlier behavior (but not in a release), where first took precedence. Note that this may seem inconsistent with the behavior of multiple YAML blocks within a document, where the first takes precedence. Still, it is convenient to be able to override defaults with options later on the command line.
2019-10-10Remove unnecessary import.John MacFarlane1-1/+0
2019-10-09--defaults: add .yaml extension if absent, look in user data dir...John MacFarlane1-13/+30
under "defaults" subdirectory.
2019-10-09T.P.App.Opt: rename optReader, optWriter as optFrom, optTo.John MacFarlane3-8/+8
This will allow to: and from: in defaults.
2019-10-09Make sure that input-files works in --default files.John MacFarlane1-1/+1
2019-10-09Basic changes for MathJax 3.zorkow1-1/+1
2019-10-09Initial implementation of --defaults option.John MacFarlane2-3/+24
Need documentation.
2019-10-09T.P.App.Opt: Changed optMetadata to Meta, to allow structured values.John MacFarlane3-14/+32
[API change] The current behavior of the `--metadata` option stays the same.
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.