summaryrefslogtreecommitdiff
path: root/test/Tests
AgeCommit message (Collapse)Author
2024-03-20Typst writer: support Typst 0.11 table features. (#9593)John MacFarlane
* Typst writer: support Typst 0.11 table features. - colspans - rowspans - cell alignment overrides - relative column widths - header and footer - multiple table bodies with intermediate headers Row heads are not yet supported. The default typst template has been modified so that tables don't have lines by default. As is standard with pandoc, we only add a line under a header or over a footer. However, a different default stroke pattern can easily be added in a template. Closes #9588.
2024-03-19Change lhs tests so they don't use `--standalone`.John MacFarlane
This will avoid test failures due to minor changes in skylighting versions, e.g. #9589.
2024-02-13Add djot reader and writer.John MacFarlane
Djot is a light markup syntax (https://djot.net). This patch adds djot as input and output formats. API changes: Add Text.Pandoc.Readers.Djot Add Text.Pandoc.Writers.Djot
2024-02-13Markdown reader: fix wikilinks extension to allow newlines in titles.John MacFarlane
Closes #9454.
2024-01-27Regenerate epub tests with latest changes to EPUB reader.John MacFarlane
2024-01-16Add readMan to Text.Pandoc.Readers exportsGeorge Stagg
2023-12-18test(docx): also compare number of childrenEdwin Török
This detects if a tag gets added/removed, or moves within the hierarchy. Signed-off-by: Edwin Török <edwin@etorok.net>
2023-12-10LaTeX writer: fix bug with big footnotes inside emphasis (#9168)Hikaru Ibayashi
Closes #8982.
2023-11-29Docx reader: unwrap content of shaped textboxes...Stephan Meijer
* #9214 text in shape format test document * #9214 support Text in Shape Format * #9214 remove irrelevant code
2023-11-06ODT reader: Support attr `text:continue-numbering` (#8998)Stephan Meijer
Closes #8979.
2023-10-22DokuWiki reader: parse `<code>` and `<file>` as block-level code.John MacFarlane
Previously we treated them as inline code in some contexts, but that is not how DokuWiki works. Closes #9154.
2023-10-17JATS reader: fix handling of alt-text (#9134)Julia Diaz
Previously we were looking for an attribute that doesn't exist in JATS; alt-text is provided by a child element. Closes #9130.
2023-08-26Org reader: allow escaping commas in macro argumentsAmneesh Singh
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2023-08-19LaTeX writer: improve internal links and targets.John MacFarlane
We no longer wrap section headings in a `\hypertarget`. This is unnecessary (hyperref creates an anchor based on the label) and it interferes with tagging. In addition, we now use `\hyperref` rather than `\hyperlink` for internal links. Currently `\hypertarget` is still being used for link anchors not on headings. Closes #8744. Thanks to @u-fischer.
2023-08-10Fix display of block elements in JATS reader (PR #8971)Julia Diaz
A number of block elements, like disp-quote, list, and disp-formula, were always treated as inlines if appearing inside paragraphs, even if their usage granted a separate block. The function isElementBlock has been refined to prevent this, and a number of specific parse cases have been added to parseBlock. Also, some minimal cleanup of the test file, in order for it to pass XML validation against the JATS DTD 1.3 (it was not compliant with the current or any previous versions of JATS). Closes #8889.
2023-07-20Fix new variant of the vulnerability in CVE-2023-35936.John MacFarlane
Guilhem Moulin noticed that the fix to CVE-2023-35936 was incomplete. An attacker could get around it by double-encoding the malicious extension to create or override arbitrary files. $ echo '![](data://image/png;base64,cHJpbnQgImhlbGxvIgo=;.lua+%252f%252e%252e%252f%252e%252e%252fb%252elua)' >b.md $ .cabal/bin/pandoc b.md --extract-media=bar <p><img src="bar/2a0eaa89f43fada3e6c577beea4f2f8f53ab6a1d.lua+%2f%2e%2e%2f%2e%2e%2fb%2elua" /></p> $ cat b.lua print "hello" $ find bar bar/ bar/2a0eaa89f43fada3e6c577beea4f2f8f53ab6a1d.lua+ This commit adds a test case for this more complex attack and fixes the vulnerability. (The fix is quite simple: if the URL-unescaped filename or extension contains a '%', we just use the sha1 hash of the contents as the canonical name, just as we do if the filename contains '..'.)
2023-07-18JATS writer: don't use `<code>` for inline code.John MacFarlane
See #8889. The Taylor and Francis guide to JATS says that `<code>` is block level and not intended to be used inline within standard text.
2023-07-06Add typst reader tests.John MacFarlane
Closes #8942.
2023-07-05Fix asciidoc testsJohn MacFarlane
2023-07-05Make modern AsciiDoc the target for `asciidoc`.John MacFarlane
The AsciiDoc community now regards the dialect parsed by `asciidoctor` as the official AsciiDoc syntax, so it should be the target of our `asciidoc` format. Closes #8936. The `asciidoc` output format now behaves like `asciidoctor` used to. `asciidoctor` is a deprecated synonynm. For the old `asciidoc` behavior (targeting the Python script), use `asciidoc_legacy`. The templates have been consolidated. Instead of separate `default.asciidoctor` and `default.asciidoc` templates, there is just `default.asciidoc`. Text.Pandoc.Writers.AsciiDoc API changes: - `writeAsciiDoc` now behaves like `writeAsciiDoctor` used to. - `writeAsciiDoctor` is now a deprecated synonym for `writeAsciiDoc`. - New exported function `writeAsciiDocLegacy` behaves like `writeAsciDoc` used to.
2023-06-23Improve tests for fillMediaBag/extractMedia.John MacFarlane
Ensure that the current directory is not changed up if a test fails, and fix messages for the assertion failures.
2023-06-23Add tests for fillMediaBag/extractMedia.John MacFarlane
2023-06-22Retain image query parameters in dokuwiki reader (#8887)ech0
While converting dokuwiki syntax to gfm, the query parameters of images were stripped from the output. In general this makes sense, as the parameters' semantics are specific to dokuwiki. But it makes it impossible to access the query in a filter. This change retains the query parameters of image urls in the dokuwiki reader, by adding it as an extra query attribute.
2023-05-09Rename test/docx/block_quotes_parse_indent.native for consistencyStephan Meijer
2023-04-05Org reader: treat `#+NAME` as synonym for `#+LABEL`.Albert Krewinkel
Closes: #8578
2023-03-25Add typst writer.John MacFarlane
See #8713.
2023-03-22Org reader: Allow zero width space as an escape characterChristian Christiansen
Allow the character U+200B to be used as an escape character as described in the Org-mode documentation https://orgmode.org/manual/Escape-Character.html Closes issue #8716.
2023-03-14HTML writer footnotes changes:John MacFarlane
When `--reference-location=section` or `=block`, use an `aside` element for the notes rather than a `section`. When `--reference-location=section`, include the `aside` element inside the section element, rather than outside. (In slide shows, this option causes footnotes on a slide to be displayed at the bottom of the slide.) Closes #8695.
2023-02-18JATS writer: include alt-text in `<graphic>`, `<inline-graphic>` elementsAlbert Krewinkel
Closes: #8631
2023-01-29ODT reader: fix blockquote indent detectionDaniel Kessler
The ODT reader is supposed to detect blockquotes by checking a paragraph style's indentation level. But it's broken for two reasons: * The parser fails on non-integers. So "1in" will get read as 25mm, but "1.0in" fails. By default, the Quotations style is "0.3937in". * The reader doesn't check indentation levels of parent styles. In my test documents, LibreOffice often creates child styles for individual paragraphs, so it's important to check parents (ODT files created by the Pandoc ODT writer don't have this issue though). I added a new test "blockquote2" whose ODT file is generated directly from the corresponding Markdown file with pandoc. Fixes #3437.
2023-01-15Markdown, CommonMark: add support for wiki links. [API change]Albert Krewinkel
Adds the Markdown/CommonMark extensions `wikilinks_title_after_pipe` and `wikilinks_title_before_pipe`. The former enables links of style `[[Name of page|Title]]` and the latter `[[Title|Name of page]]`. Titles are optional in both variants, so this works for both: `[[https://example.org]]`, `[[Name of page]]`. The writer is modified to render links with title `wikilink` as a wikilink if a respective extension is enabled. Pandoc will use `wikilinks_title_after_pipe` if both extensions are enabled. Closes: #2923
2023-01-14Remove Null constructor from docsAlbert Krewinkel
2023-01-13Support complex figures. [API change]Albert Krewinkel
Thanks and credit go to Aner Lucero, who laid the groundwork for this feature in the 2021 GSoC project. He contributed many changes, including modifications to the readers for HTML, JATS, and LaTeX, and to the HTML and JATS writers. Shared (Albert Krewinkel): - The new function `figureDiv`, exported from `Text.Pandoc.Shared`, offers a standardized way to convert a figure into a Div element. Readers (Aner Lucero): - HTML reader: `<figure>` elements are parsed as figures, with the caption taken from the respective `<figcaption>` elements. - JATS reader: The `<fig>` and `<caption>` elements are parsed into figure elements, even if the contents is more complex. - LaTeX reader: support for figures with non-image contents and for subfigures. - Markdown reader: paragraphs containing just an image are treated as figures if the `implicit_figures` extension is enabled. The identifier is used as the figure's identifier and the image description is also used as figure caption; all other attributes are treated as belonging to the image. Writers (Aner Lucero, Albert Krewinkel): - DokuWiki, Haddock, Jira, Man, MediaWiki, Ms, Muse, PPTX, RTF, TEI, ZimWiki writers: Figures are rendered like Div elements. - Asciidoc writer: The figure contents is unwrapped; each image in the the figure becomes a separate figure. - Classic custom writers: Figures are passed to the global function `Figure(caption, contents, attr)`, where `caption` and `contents` are strings and `attr` is a table of key-value pairs. - ConTeXt writer: Figures are wrapped in a "placefigure" environment with `\startplacefigure`/`\endplacefigure`, adding the features caption and listing title as properties. Subfigures are place in a single row with the `\startfloatcombination` environment. - DocBook writer: Uses `mediaobject` elements, unless the figure contains subfigures or tables, in which case the figure content is unwrapped. - Docx writer: figures with multiple content blocks are rendered as tables with style `FigureTable`; like before, single-image figures are still output as paragraphs with style `Figure` or `Captioned Figure`, depending on whether a caption is attached. - DokuWiki writer: Caption and "alt-text" are no longer combined. The alt text of a figure will now be lost in the conversion. - FB2 writer: The figure caption is added as alt text to the images in the figure; pre-existing alt texts are kept. - ICML writer: Only single-image figures are supported. The contents of figures with additional elements gets unwrapped. - HTML writer: the alt text is no longer constructed from the caption, as was the case with implicit figures. This reduces duplication, but comes at the risk of images that are missing alt texts. Authors should take care to provide alt texts for all images. Some readers, most notably the Markdown reader with the `implicit_figures` extension, add a caption that's identical to the image description. The writer checks for this and adds an `aria-hidden` attribute to the `<figcaption>` element in that case. - JATS writer: The `<fig>` and `<caption>` elements are used write figures. - LaTeX writer: complex figures, e.g. with non-image contents and subfigures, are supported. The `subfigure` template variable is set if the document contains subfigures, triggering the conditional loading of the *subcaption* package. Contants of figures that contain tables are become unwrapped, as longtable environments are not allowed within figures. - Markdown writer: figures are output as implicit figures if possible, via HTML if the `raw_html` extension is enabled, and as Div elements otherwise. - OpenDocument writer: A separate paragraph is generated for each block element in a figure, each with style `FigureWithCaption`. Behavior for single-image figures therefore remains unchanged. - Org writer: Only the first element in a figure is given a caption; additional block elements in the figure are appended without any caption being added. - RST writer: Single-image figures are supported as before; the contents of more complex images become nested in a container of type `float`. - Texinfo writer: Figures are rendered as float with type `figure`. - Textile writer: Figures are rendered with the help of HTML elements. - XWiki: Figures are placed in a group. Co-authored-by: Aner Lucero <4rgento@gmail.com>
2023-01-12Store "unnumbered" class in DocBook role attribute (#8481)lifeunleaded
Markdown allows marking a heading as unnumbered, which is stored as a class token internally. This change will recognize this particular class token and append it to the role attribute, or create a role attribute with it if needed. This does not imply any processing in DocBook but is intended to let customized stylesheets identify these sections and act accordingly. Closes #1402
2023-01-10Update copyright years, it's 2023!Albert Krewinkel
2022-12-17ConTeXt writer: always use `\type` for inline codeAlbert Krewinkel
Inline codes that contained curly braces where previously rendered with `\mono`; this led to unexpected results when the presentation of `\type` was customized, as those changes would not have been applied to code rendered with `\mono`.
2022-11-19LaTeX writer: Use soul instead of ulem for strikeout, underline.John MacFarlane
This handles things like hyphenation, line breaks, and nonbreaking spaces better. Closes #8411.
2022-11-11Add tests for the new table featuresWout Gevaert
2022-10-24Rename T.P.Readers.Odt -> T.P.Readers.ODT.John MacFarlane
For consistency with Writers.ODT. Similarly, rename `readOdt` -> `readODT`. [API change]
2022-10-24Rename T.P.Writers.Docbook -> T.P.Writers.DocBook.John MacFarlane
Similarly, rename `writeDocbook` -> `writeDocBook`, for consistency with the DocBook reader's naming. [API change]
2022-10-10Org reader: make #+pandoc-emphasis-pre work as expected. (#8360)Amir Dekel
So far, `orgStateLastPreCharPos` wasn't updated appropriately after each parsing to native Str (by the parser `str`). In addition to solving this, the guard `notAfterString` in `emphasisStart` is removed to allow emphasis after Str at the first place.
2022-10-02Officially deprecate writeJATS...John MacFarlane
in favor of writeJatsArchiving.
2022-09-30[API Change] Extract Lua code into new package pandoc-lua-engineAlbert Krewinkel
The flag 'lua53` must now be used with that package if pandoc is to be compiled against Lua 5.3.
2022-09-30[API Change] Filter: Parameterize `applyFilters` over scripting engine.Albert Krewinkel
Pass the scripting engine as a parameter so it can be swapped out.
2022-09-30[API Change] Rename `pandocVersion` to `pandocVersionText`...Albert Krewinkel
and add a new `pandocVersion` value with type `Version`. This is consistent with the type used for `pandocTypesVersion` and allows to use the value where a Version type is required.
2022-09-28HTML Reader: Tests for 'tt' and 'code' elements (#8330).Justin Wood
tt is a deprecated element in HTML, but is still used in the wild in some places, support reading it as just another 'code' element. Commit 4abb9d0ad8dbb88fbc443a78d5a1b116cb7a5816 was originally part of this PR as well.
2022-09-27Tests.Command: remove unused `runTest`.John MacFarlane
2022-09-27Fix small whitespace things.John MacFarlane
2022-08-22Org writer: keep code block attributes as header args.Albert Krewinkel
This allows to keep more information in the resulting `src` blocks, making it easier to roundtrip from or through Org. Org babel ignores unknown header arguments.
2022-08-22Org writer: add code block identifier as `#+name` to src blocks.Albert Krewinkel