aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2021-08-01RTF writer: omit `\bin` in `\pict`.John MacFarlane1-1/+1
According to the spec, this is not needed or wanted when the data is in hexadecimal format, as it is here.
2021-07-29parseFromString: preserve at least the source directory.John MacFarlane1-1/+1
Previously we just set the source name to "chunk" when parsing from strings, to avoid misleading source positions. This had the side effect that `rebase_relative_paths` would break inside sections that were parsed as strings. So, now we use "ORIGINAL_SOURCE_PATH_chunk" instead of just "chunk". Closes #7464.
2021-07-22LaTeX writer: Use ulem for underline.John MacFarlane1-1/+3
ulem is conditionally included already when the `strikeout` variable is set, so we set this when there is underlined text, and use `\uline` instead of `\underline`. This fixes wrapping for underlined text. Closes #7351.
2021-07-22MIME: use image/x-xcf instead of application/x-xcf.John MacFarlane1-1/+1
Closes #7454.
2021-07-17LaTeX reader: avoid trailing hyphen in translating languages.John MacFarlane1-2/+2
Previously `\foreignlanguage{english}` turned into `<span lang="en-">`. The same issue affected Arabic. Closes #7447.
2021-07-16DocBook reader: handle images with imageobjectco elements.John MacFarlane1-3/+3
Closes #7440.
2021-07-16LaTeX reader: Support `\cline` in LaTeX tables.John MacFarlane1-0/+1
Closes #7442.
2021-07-16PDF: Fix svgIn path error.John MacFarlane1-1/+1
We were duplicating the temp directory; this didn't show up on macOS or linux because there we use absolute paths for the temp directory. Closes #7431.
2021-07-11DocBook reader: add support for citerefentry (#7437)Jan Tojnar1-1/+5
Originally intended for referring to UNIX manual pages, either part of the same DocBook document as refentry element, or external – hence the manvolnum element. These days, refentry is more general, for example the element documentation pages linked below are each a refentry. As per the *Processing expectations* section of citerefentry, the element is supposed to be a hyperlink to a refentry (when in the same document) but pandoc does not support refentry tag at the moment so that is moot. https://tdg.docbook.org/tdg/5.1/citerefentry.html https://tdg.docbook.org/tdg/5.1/manvolnum.html https://tdg.docbook.org/tdg/5.1/refentry.html This roughly corresponds to a `manpage` role in rST syntax, which produces a `Code` AST node with attributes `.interpreted-text role=manpage` but that does not fit DocBook parser. https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-manpage
2021-07-11Improved parsing of raw LaTeX from Text streams (rawLaTeXParser).John MacFarlane2-11/+37
We now use source positions from the token stream to tell us how much of the text stream to consume. Getting this to work required a few other changes to make token source positions accurate. Closes #7434.
2021-07-09Always use / when adding directory to image path with extractMedia.John MacFarlane1-1/+1
Even on Windows. May help with #7431.
2021-07-09RST reader: fix regression with code includes.John MacFarlane1-1/+5
With the recent changes to include infrastructure, included code blocks were getting an extra newline. Closes #7436. Added regression test.
2021-07-07Don't incorporate externally linked images in EPUB documents (#7430)Michael Hoffmann1-1/+2
Just like it is possible to avoid incorporating an image in EPUB by passing `data-external="1"` to a raw HTML snippet, this makes the same possible for native Images, by looking for an associated `external` attribute.
2021-07-06Recognize data-external when reading HTML img tags (#7429)Michael Hoffmann1-8/+3
Preserve all attributes in img tags. If attributes have a `data-` prefix, it will be stripped. In particular, this preserves a `data-external` attribute as an `external` attribute in the pandoc AST.
2021-07-06T.P.PDF, convertImage: normalize paths.John MacFarlane1-3/+3
This will avoid paths on Windows with mixed path separators, which may cause problems with SVG conversion. See #7431.
2021-07-06Markdown reader: don't try to read contents in self-closing HTML tag.John MacFarlane1-1/+4
Previously we had problems parsing raw HTML with self-closing tags like `<col/>`. The problem was that pandoc would look for a closing tag to close the markdown contents, but the closing tag had, in effect, already been parsed by `htmlTag`. This fixes the issue described in <https://groups.google.com/d/msgid/pandoc-discuss/297bc662-7841-4423-bcbb-534e99bbba09n%40googlegroups.com>.
2021-07-06HTML reader: add col, colgroup to 'closes' definitionsJohn MacFarlane1-1/+3
2021-07-05Add command test for #7394.John MacFarlane1-0/+1
And fix a small bug in handling of citations in notes, which led to commas at the end of sentences in some cases.
2021-07-05Citeproc: cleanup and efficiency improvement in deNote.John MacFarlane1-15/+21
2021-07-05Revamp note citation handling.John MacFarlane1-14/+30
Use latest citeproc, which uses a Span with a class rather than a Note for notes. This helps us distinguish between user notes and citation notes. Don't put citations at the beginning of a note in parentheses. (Closes #7394.)
2021-07-02HTML5 writer, remove aria-hidden when explicit atl text is provided.Aner Lucero1-4/+7
2021-06-29Docx writer: Add table numbering for captioned tables.John MacFarlane2-3/+30
The numbers are added using fields, so that Word can create a list of tables that will update automatically.
2021-06-29Docx writer: Fixed a couple bugs in Figure numbering.John MacFarlane1-4/+3
2021-06-29Docx writer: support figure numbers.John MacFarlane2-3/+21
These are set up in such a way that they will work with Word's automatic table of figures. Closes #7392.
2021-06-29Remove duplicated alt text in HTML output.Aner Lucero1-2/+3
2021-06-28Improve punctuation moving with `--citeproc`.John MacFarlane1-14/+15
Previously, using `--citeproc` could cause punctuation to move in quotes even when there aer no citations. This has been changed; now, punctuation moving is limited to citations. In addition, we only move footnotes around punctuation if the style is a note style, even if `notes-after-punctuation` is `true`.
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