aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2019-11-14Default files: Allow leaving input-files blank again.John MacFarlane1-3/+4
Leaving it blank yields a Nothing value (interpreted as stdin). Providing an empty list is intepreted as no input. This resolves one part of #5888.
2019-11-14Change optInputFiles to a `Maybe [FilePath]`.John MacFarlane4-15/+21
`Nothing` means: nothing specified. `Just []` means: an empty list specified (e.g. in defaults). Potentially these could lead to different behavior: see #5888.
2019-11-14Writers.Shared: Clean up code for adding metadata to variables.John MacFarlane1-10/+9
2019-11-14Markdown reader: use take1WhileP for table row.John MacFarlane1-1/+1
2019-11-14Markdown reader: Use take1WhileP for str.John MacFarlane1-1/+3
This yields a small but measurable performance improvement.
2019-11-14Parsing: Rename takeWhileP -> take1WhileP and clean it up.John MacFarlane1-9/+11
(It doesn't match the empty sequence.)
2019-11-14Allow combining `-Vheader-includes` and `--include-in-header`.John MacFarlane1-15/+21
Closes #5904.
2019-11-14Fix regression preventing header-includes from being set using -V.John MacFarlane1-1/+2
See #5904.
2019-11-14RST writer: fix backslash escaping after stringsAlbert Krewinkel1-2/+2
The check whether a complex inline element following a string must be escaped, now depends on the last character of the string instead of the first. Fixes: #5906
2019-11-13Fix regression introduced by last commit.John MacFarlane1-1/+2
2019-11-13Markdown reader: don't parse footnote body unless extension enabled.John MacFarlane1-18/+20
2019-11-13Default files: combine with prior values when appropriate.John MacFarlane1-21/+45
Certain command-line arguments can be repeated: `--metadata-file`, `--css`, `--include-in-header`, `--include-before-body`, `--include-after-body`, `--variable`, `--metadata`, `--syntax-definition`. In these cases, values specified in default files should be added to the list rather than replacing values specified earlier on the command line (perhaps in other default files). So, for example, if one does pandoc --variable foo=3 --defaults d1 --defaults d2 and `d1` sets the variable `bar` and `d2` sets `baz`, all three variables will be set. Closes #5894.
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-13Ensure there's a blank line before RST tables.John MacFarlane1-4/+5
Closes #5898.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc124-5922/+6294
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-11Fix typos (#5896)Brian Wignall2-2/+2
2019-11-11Markdown reader: fix small super/subscript issue.John MacFarlane1-2/+6
Superscripts and subscripts cannot contain spaces, but newlines were previously allowed (unintentionally). This led to bad interactions in some cases with footnotes. E.g. ``` foo^[note] bar^[note] ``` With this change newlines are also not allowed inside super/subscripts. Closes #5878.
2019-11-11Change the implementation of `htmlSpanLikeElements` and implement `<dfn>` ↵Florian Beeres3-7/+16
(#5882) * Add HTML Reader support for `<dfn>`, parsing this as a Span with class `dfn`. * Change `htmlSpanLikeElements` implementation to retain classes, attributes and inline content.
2019-11-07DocBook reader: Fix bug with entities in mathphrase element.John MacFarlane1-4/+2
Closes #5885.
2019-11-07Fix list fields in Opt so they aren't reversed.John MacFarlane3-30/+30
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 MacFarlane3-10/+8
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 MacFarlane3-10/+7
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-04Removed an unnecessary unpack.John MacFarlane1-1/+1
2019-11-04HTML Reader/Writer - Add support for <var> and <samp> (#5861)Amogh Rathore2-11/+22
Closes #5799
2019-11-03PDF: don't assume tex log file is UTF8-encoded.John MacFarlane1-2/+11
Fall back to latin1 if it can't be read as UTF-8. Closes #5872.
2019-11-03Docx reader: Only use LTR when it is overriding BiDi settingJesse Rosenthal3-2/+14
The left-to-right direction setting in docx is used in the spec only for overriding an explicit right-to-left setting. We only process it when it happens in a paragraph set with BiDi. This is especially important for docs exported from Google Docs, which explicitly (and unnecessarily) set "rtl=0" for every paragraph. Closes: #5723
2019-11-03EPUB writer: ensure that `lang` variable is set on all chapters.John MacFarlane1-3/+5
2019-11-03Docx reader: fix list number resumption for sublists. Closes #4324.John MacFarlane1-1/+8
The first list item of a sublist should not resume numbering from the number of the last sublist item of the same level, if that sublist was a sublist of a different list item. That is, we should not get: ``` 1. one 1. sub one 2. sub two 2. two 3. sub one ```
2019-11-03Allow pdf output to stdout.John MacFarlane2-13/+17
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-03Place caption before table in OpenDocument format. (#5869)Dmitry Pogodin1-3/+5
Closes #5681.
2019-11-02RST reader: avoid spurious warning...John MacFarlane1-1/+1
when resolving links to internal anchors ending with `_`. Closes #5763.
2019-11-02LaTeX reader: Fixed dollar-math parsing...John MacFarlane1-9/+9
...to ensure that space is left between a control seq and a following word that would otherwise change its meaning. Closes #5836.
2019-11-02LaTeX untokenize: Ensure space between control sequence and following letter.John MacFarlane2-2/+15
Closes #5836.
2019-11-02LaTeX reader: Don't omit macro definitions defined in the preamble.John MacFarlane1-6/+7
These were formerly omitted (though they still affected macro resolution if `latex_macros` was set). Now they are included in the document.
2019-11-02LaTeX reader: parse macro defs as raw latex...John MacFarlane1-8/+13
when `latex_macros` is disabled. (When `latex_macros` is enabled, we omit them, since pandoc is applying the macros itself.) Previously, it was documented that the macro definitions got passed through as raw latex regardless of whether `latex_macros` was set -- but in fact they never got passed through.
2019-11-02LaTeX reader: fixed a hang/memory leak in certain circumstances.John MacFarlane1-3/+3
We were using `grouped blocks` instead of `grouped block`. This caused the reader to hang in an infinite loop (with a memory leak) on e.g. `\parbox{1em}{#1}`. Closes #5845.
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-31Jira writer: remove extraneous newline after single-line block quotesAlbert Krewinkel1-1/+1
See #5858
2019-10-30docbook reader: fix nesting of chapters and sections (#5864)Florian Klink1-1/+1
* Set dbBook to true when traversing a chapter too. Currently, a `<title/>` in a chapter and in a `<section/>` below that chapter have the same level if they're not inside a `<book/>`. This can happen in a multi-file book project. Also see the example at https://tdg.docbook.org/tdg/4.5/chapter.html Co-authored-by: Félix Baylac-Jacqué <felix@alternativebit.fr> * Add docbook-chapter test This tests nested `<section/>` and makes sure `<title/>` in the first `<section/>` below `<chapter/>` is one level deeper than the `<chapter/>`'s `<title/>`, also when not inside a `<book/>`. Co-authored-by: Félix Baylac-Jacqué <felix@alternativebit.fr>
2019-10-29T.P.W.Shared: Changed gridTables so it does better at...John MacFarlane1-16/+20
...keeping the widths of columns. See #4320. Adjust test case for #4320.
2019-10-29Changes to build with new doctemplates/doclayout.John MacFarlane21-84/+114
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-29Shared.makeSections: better behavior in some corner cases.John MacFarlane1-3/+7
When a div surrounds multiple sections at the same level, or a section of highre level followed by one of lower level, then we just leave it as a div and create a new div for the section. Closes #5846, closes #5761.
2019-10-28Shared: improve isTight.John MacFarlane1-1/+1
If a list has an empty item, this should not count against its being a tight list. Closes #5857.
2019-10-27Org reader: fix parsing of empty comment linesAlbert Krewinkel1-1/+3
Comment lines in Org-mode can be completely empty; both of these line should produce no output: # a comment # The reader used to produce a wrong result for the latter, but ignores that line as well now. Fixes: #5856
2019-10-25Beamer writer: fix regression with hrules separating slides.John MacFarlane1-3/+3