aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2021-06-28Allow `$` characters in bibtex keys.John MacFarlane1-1/+1
Closes #7409.
2021-06-28Text.Pandoc.Error: fix line calculations in reporting parsec errors.John MacFarlane1-3/+3
Also remove a spurious initial newline in the error report.
2021-06-28Set proper initial source name in parsing BibTeX.John MacFarlane1-1/+3
(For better error messages.)
2021-06-28Markdown writer: put space between Plain and following fenced Div.John MacFarlane1-0/+3
Closes #4465.
2021-06-23ImageSize: Add Tiff constructor for ImageType.John MacFarlane3-1/+7
[Minor API change] This allows pandoc to get size information from tiff images. Closes #7405.
2021-06-23reveal.js writer: Go back to setting boolean values for variables.John MacFarlane1-30/+26
In a previous commit we used strings because boolean False wouldn't render as `false`. This is changed in the dev version ofdoctemplates, so we can go back to the more straightforward approach.
2021-06-22Fix regression with comment-only YAML metadata blocks.John MacFarlane1-0/+3
Closes #7400.
2021-06-22Fix unneeded importJohn MacFarlane1-1/+1
2021-06-21LaTeX writer: add strut at end of minipage if it contains...John MacFarlane1-2/+5
line breaks. Without them, the last line is shorter than it should be, at least in some cases.
2021-06-21Revert "LaTeX writer: put a strut after a line break (`\\`)."John MacFarlane1-1/+1
This reverts commit e2a7ecb5f73b12c8141ebf873a494652fc53babd.
2021-06-21LaTeX writer: put a strut after a line break (`\\`).John MacFarlane1-1/+1
This ensures that we have proper spacing before the next line (which might e.g. be a table bottom border). This gives better results in cases like test/command/7272.md.
2021-06-21Improve emailAddress in Text.Pandoc.Parsing.John MacFarlane2-5/+24
Previously the parser would accept characters in domains that are illegal in domains, and this sometimes caused it to gobble bits of the following text. Closes #7398. Note that this change, by itself, caused some txt2tag reader tests to fail. txt2tags allows bare email addresses with a following form query. So, in addition to the change to emailAddress, we modify the txt2tags parser so it can still handle these cases.
2021-06-21LaTeX writer: always use a minipage for cells with line breaks...John MacFarlane1-2/+7
if width information is available. Otherwise the way we treat them can lead to content that overflows a cell. Closes #7393.
2021-06-21LaTeX writer: Use `\strut` instead of `~` before `\\` in empty line.John MacFarlane1-1/+1
2021-06-21reveal.js writer: better handling of options.John MacFarlane1-0/+50
Previously it was impossible to specify false values for options that default to true; setting the option to false just caused the portion of the template setting the option to be omitted. Now we prepopulate all the variables with their default values, including them unconditionally and allowing them to be overridden.
2021-06-21Markdown writer: Fix regression in code blocks with attributes.John MacFarlane1-3/+3
Code blocks with a single class but nonempty attributes were having attributes drop as a result of #7242. Closes #7397.
2021-06-18insertMediaBag: ensure we get sane mediaPath for URLs.John MacFarlane1-5/+10
Long URLs cannot be treated as mediaPaths, but System.FilePath's `isRelative` often returns True for them. So we add a check for an absolute URL. We also ensure that extensions are derived only from the path portion of URLs (previously a following query was being included). Closes #7391.
2021-06-12Docx reader: handle absolute URIs in Relationship Target.John MacFarlane1-5/+11
Closes #7374.
2021-06-12Markdown writer: allow `pipe_tables` to be disabled for commonmark...John MacFarlane1-1/+0
(commonmark_x, gfm). Closes #7375.
2021-06-12Fix regression in citeproc processing.John MacFarlane1-1/+3
If inline references are used (in the metadata `references` field), we should still only include in the bibliography items that are actually cited -- unless `nocite` is used. Closes #7376.
2021-06-10Fix MediaBag regressions.John MacFarlane3-42/+41
With the 2.14 release `--extract-media` stopped working as before; there could be mismatches between the paths in the rendered document and the extracted media. This patch makes several changes (while keeping the same API). The `mediaPath` in 2.14 was always constructed from the SHA1 hash of the media contents. Now, we preserve the original path unless it's an absolute path or contains `..` segments (in that case we use a path based on the SHA1 hash of the contents). When constructing a path from the SHA1 hash, we always use the original extension, if there is one. Otherwise we look up an appropriate extension for the mime type. `mediaDirectory` and `mediaItems` now use the `mediaPath`, rather than the mediabag key, for the first component of the tuple. This makes more sense, I think, and fits with the documentation of these functions; eventually, though, we should rework the API so that `mediaItems` returns both the keys and the MediaItems. Rewriting of source paths in `extractMedia` has been fixed. `fillMediaBag` has been modified so that it doesn't modify image paths (that was part of the problem in #7345). We now do path normalization (e.g. `\` separators on Windows) only in writing the media; the paths are left unchanged in the image links (sensibly, since they might be URLs and not file paths). These changes should restore the original behavior from before 2.14. Closes #7345.
2021-06-10T.P.MIME, extensionFromMimeType: add a few special cases.John MacFarlane1-0/+10
When we do a reverse lookup in the MIME table, we just get the last match, so when the same mime type is associated with several different extensions, we sometimes got weird results, e.g. `.vs` for `text/plain`. These special cases help us get the most standard extensions for mime types like `text/plain`.
2021-06-10Docx writer: fix handling of empty table headersAlbert Krewinkel1-2/+2
A table header which does not contain any cells is now treated as an empty header. Fixes: #7369
2021-06-10Lua utils: fix handling of table headers in `from_simple_table`Albert Krewinkel1-1/+1
Passing an empty list of header cells now results in an empty table header. Fixes: #7369
2021-06-08Citeproc: avoid duplicate classes and attributes on refs div.John MacFarlane1-2/+2
2021-06-05LaTeX writer: Fix regression in table header position.John MacFarlane1-3/+10
In recent versions the table headers were no longer bottom-aligned (if more than one line). This patch fixes that by using minipages for table headers in non-simple tables. Closes #7347.
2021-06-05CommonMark writer: do not use simple class for fenced-divsJan Tojnar1-3/+6
In https://github.com/jgm/pandoc/pull/7242, we introduced a simple attribute style for for code blocks and fenced divs with a single class but turns out the CommonMark extension does not support it for fenced divs. https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/fenced_divs.md
2021-06-05CommonMark writer: do not throw away attributes when Ext_attributes is enabledJan Tojnar2-13/+17
Ext_attributes covers at least the following: - Ext_fenced_code_attributes - Ext_header_attributes - Ext_inline_code_attributes - Ext_link_attributes
2021-06-05Markdown writer: re-use functions from InlineJan Tojnar2-29/+4
Instead of duplicating linkAttributes and attrsToMarkdown, let’s just use those from the Inline module.
2021-06-05DocBook reader: Add support for danger elementJan Tojnar1-1/+2
Added in DocBook 5.2: - https://github.com/docbook/docbook/pull/64 - https://tdg.docbook.org/tdg/5.2/danger.html
2021-06-05DocBook writer: Remove non-existent admonitionsJan Tojnar1-2/+1
attention, error and hint are actually just reStructuredText specific. danger was too until introduced in DocBook 5.2: https://github.com/docbook/docbook/issues/55
2021-06-03T.P.Class.IO: normalise path in writeMedia.John MacFarlane1-3/+2
This ensures that we get `\` separators on Windows.
2021-06-02Text.Pandoc.PDF: only print relevant part of environment on `--verbose`.John MacFarlane1-2/+14
2021-06-02Fix regression in 2.14 for generation of PDFs with SVGs.John MacFarlane1-1/+2
Closes #7344.
2021-06-01HTML writer: Don't omit width attribute on div.John MacFarlane1-3/+4
Closes #7342.
2021-06-01Markdown reader: fix pipe table regression in 2.11.4.John MacFarlane1-1/+1
Previously pipe tables with empty headers (that is, a header line with all empty cells) would be rendered as headerless tables. This broke in 2.11.4. The fix here is to produce an AST with an empty table head when a pipe table has all empty header cells. Closes #7343.
2021-06-01LaTeX reader: don't allow optional * on symbol control sequences.John MacFarlane1-2/+4
Generally we allow optional starred variants of LaTeX commands (since many allow them, and if we don't accept these explicitly, ignoring the star usually gives acceptable results). But we don't want to do this for `\(*\)` and similar cases. Closes #7340.
2021-05-31Fix regression with commonmark/gfm yaml metdata block parsing.John MacFarlane1-5/+5
A regression in 2.14 led to the document body being omitted after YAML metadata in some cases. This is now fixed. Closes #7339.
2021-05-30HTML reader: fix column width regression.John MacFarlane1-1/+1
Column widths specified with a style attribute were off by a factor of 100 in 2.14. Closes #7334.
2021-05-30Have LoadedResource use relative paths.John MacFarlane1-2/+2
The immediate reason for this is to allow the test output of #3752 to work on both windows and linux.
2021-05-30Docx writer: fix regression on captions.John MacFarlane1-1/+3
The "Table Caption" style was no longer getting applied. (It was overwritten by "Compact.") Closes #7328.
2021-05-29Markdown reader: in rebasePaths, check for both Windows and PosixJohn MacFarlane1-4/+5
absolute paths. Previously Windows pandoc was treating `/foo/bar.jpg` as non-absolute.
2021-05-29In rebasePath, check for absolute paths two ways.John MacFarlane1-1/+4
isAbsolute from FilePath doesn't return True on Windows for paths beginning with `/`, so we check that separately.
2021-05-28Support `rebase_relative_paths` for commonmark based formats.John MacFarlane2-1/+4
(Including `gfm`.)
2021-05-28Docx reader: Support new table features.Emily Bourke3-49/+163
* Column spans * Row spans - The spec says that if the `val` attribute is ommitted, its value should be assumed to be `continue`, and that its values are restricted to {`restart`, `continue`}. If the value has any other value, I think it seems reasonable to default it to `continue`. It might cause problems if the spec is extended in the future by adding a third possible value, in which case this would probably give incorrect behaviour, and wouldn't error. * Allow multiple header rows * Include table description in simple caption - The table description element is like alt text for a table (along with the table caption element). It seems like we should include this somewhere, but I’m not 100% sure how – I’m pairing it with the simple caption for the moment. (Should it maybe go in the block caption instead?) * Detect table captions - Check for caption paragraph style /and/ either the simple or complex table field. This means the caption detection fails for captions which don’t contain a field, as in an example doc I added as a test. However, I think it’s better to be too conservative: a missed table caption will still show up as a paragraph next to the table, whereas if I incorrectly classify something else as a table caption it could cause havoc by pairing it up with a table it’s not at all related to, or dropping it entirely. * Update tests and add new ones Partially fixes: #6316
2021-05-28Docx reader: Read table column widths.Emily Bourke2-3/+4
2021-05-27Two citeproc locator/suffix improvements:John MacFarlane1-3/+11
- Recognize locators spelled with a capital letter. Closes #7323. - Add a comma and a space in front of the suffix if it doesn't start with space or punctuation. Closes #7324.
2021-05-27rebase_relative_paths: leave empty paths unchanged.John MacFarlane1-1/+1
2021-05-27rebase_relative_paths extension: don't change fragment paths.John MacFarlane1-1/+2
We don't want a pure fragment path to be rewritten, since these are used for cross-referencing.
2021-05-27Modify rebase_reference_links treatment of reference links/images.John MacFarlane1-5/+4
The directory is based on the file containing the link reference, not the file containing the link, if these differ.