aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Writers
AgeCommit message (Collapse)AuthorFilesLines
2021-02-16Rename Text.Pandoc.XMLParser -> Text.Pandoc.XML.Light...John MacFarlane1-1/+2
..and add new definitions isomorphic to xml-light's, but with Text instead of String. This allows us to keep most of the code in existing readers that use xml-light, but avoid lots of unnecessary allocation. We also add versions of the functions from xml-light's Text.XML.Light.Output and Text.XML.Light.Proc that operate on our modified XML types, and functions that convert xml-light types to our types (since some of our dependencies, like texmath, use xml-light). Update golden tests for docx and pptx. OOXML test: Use `showContent` instead of `ppContent` in `displayDiff`. Docx: Do a manual traversal to unwrap sdt and smartTag. This is faster, and needed to pass the tests. Benchmarks: A = prior to 8ca191604dcd13af27c11d2da225da646ebce6fc (Feb 8) B = as of 8ca191604dcd13af27c11d2da225da646ebce6fc (Feb 8) C = this commit | Reader | A | B | C | | ------- | ----- | ------ | ----- | | docbook | 18 ms | 12 ms | 10 ms | | opml | 65 ms | 62 ms | 35 ms | | jats | 15 ms | 11 ms | 9 ms | | docx | 72 ms | 69 ms | 44 ms | | odt | 78 ms | 41 ms | 28 ms | | epub | 64 ms | 61 ms | 56 ms | | fb2 | 14 ms | 5 ms | 4 ms |
2021-02-13Org: support task_lists extensionAlbert Krewinkel1-11/+46
The tasks lists extension is now supported by the org reader and writer; the extension is turned on by default. Closes: #6336
2021-02-07Avoid unnecessary use of NoImplicitPrelude pragma (#7089)Albert Krewinkel19-36/+0
2020-12-13Docx writer: keep raw openxml strings verbatim.Albert Krewinkel1-0/+10
Closes: #6933
2020-12-07Docbook writer: Handle admonition titles from Markdown readerJan Tojnar1-0/+14
Docbook reader produces a `Div` with `title` class for `<title>` element within an “admonition” element. Markdown writer then turns this into a fenced div with `title` class attribute. Since fenced divs are block elements, their content is recognized as a paragraph by the Markdown reader. This is an issue for Docbook writer because it would produce an invalid DocBook document from such AST – the `<title>` element can only contain “inline” elements. Let’s handle this invalid special case separately by unwrapping the paragraph before creating the `<title>` element.
2020-12-07Docbook writer: handle admonitionsJan Tojnar1-0/+52
Similarly to https://github.com/jgm/pandoc/commit/d6fdfe6f2bba2a8ed25d6c9f11861774001f7a91, we should handle admonitions.
2020-11-14Markdown writer: default to using ATX headings.Aner Lucero1-1/+3
Previously we used Setext (underlined) headings by default. The default is now ATX (`##` style). * Add the `--markdown-headings=atx|setext` option. * Deprecate `--atx-headers`. * Add constructor 'ATXHeadingInLHS` constructor to `LogMessage` [API change]. * Support `markdown-headings` in defaults files. * Document new options in MANUAL. Closes #6662.
2020-10-06DOCX reader: Allow empty dates in comments and tracked changes (#6726)Diego Balseiro1-0/+5
For security reasons, some legal firms delete the date from comments and tracked changes. * Make date optional (Maybe) in tracked changes and comments datatypes * Add tests
2020-10-02Docx writer: better handle list items whose contents are lists (#6522)Michael Hoffmann1-0/+5
If the first element of a bulleted or ordered list is another list, then that first item will disappear if the target format is docx. This changes the docx writer so that it prepends an empty string for those cases. With this, no items will disappear. Closes #5948.
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-1/+1
* Fix hlint suggestions, update hlint.yaml Most suggestions were redundant brackets. Some required LambdaCase. The .hlint.yaml file had a small typo, and didn't ignore camelCase suggestions in certain modules.
2020-09-12[API change] Rename Writers.Tables and its contents (#6679)Christian Despres1-64/+66
Writers.Tables is now Writers.AnnotatedTable. All of the types and functions in it have had the "Ann" removed from them. Now it is expected that the module be imported qualified.
2020-09-05Add Writers.Tables helper functions and types, add tests for those (#6655)Christian Despres1-0/+252
Add Writers.Tables helper functions and types, add tests for those The Writers.Tables module contains an AnnTable type that is a pandoc Table with added inferred information that should be enough for writers (in particular the HTML writer) to operate on without having to lay out the table themselves. The toAnnTable and fromAnnTable functions in that module convert between AnnTable and Table. In addition to producing an AnnTable with coherent and well-formed annotations, the toAnnTable function also normalizes its input Table like the table builder does. Various tests ensure that toAnnTable normalizes tables exactly like the table builder, and that its annotations are coherent.
2020-07-08Escape starting periods in ms writer code blocksMichael Hoffmann1-0/+37
If a line of ms code block output starts with a period (.), it should be prepended by '\&' so that it is not interpreted as a roff command. Fixes #6505
2020-06-22Use native Underline instead of Span in JiraJohn MacFarlane1-2/+1
2020-04-15Use the new builders, modify readers to preserve empty headersdespresc2-9/+22
The Builder.simpleTable now only adds a row to the TableHead when the given header row is not null. This uncovered an inconsistency in the readers: some would unconditionally emit a header filled with empty cells, even if the header was not present. Now every reader has the conditional behaviour. Only the XWiki writer depended on the header row being always present; it now pads its head as necessary.
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc2-3/+3
- Writers.Native is now adapted to the new Table type. - Inline captions should now be conditionally wrapped in a Plain, not a Para block. - The toLegacyTable function now lives in Writers.Shared.
2020-04-15Implement the new Table typedespresc2-6/+6
2020-04-04Jira: support citations, attachment links, and user linksAlbert Krewinkel1-0/+34
Closes: #6231 Closes: #6238 Closes: #6239
2020-04-03Jira reader: resolve parsing issues of blockquote, colorAlbert Krewinkel1-0/+5
Parsing problems occurring with block quotes and colored text have been resolved. Fixes: #6233 Fixes: #6235
2020-03-31Jira writer: convert spans with class `underline` to inserted textAlbert Krewinkel1-0/+27
Spans with class `underline` as converted into Jira text marked as `+inserted+`, i.e. surrounded by plus-signs.
2020-02-12Introduce new format variants for JATS (#6067)Albert Krewinkel1-1/+15
New formats: - `jats_archiving` for the "Archiving and Interchange Tag Set", - `jats_publishing` for the "Journal Publishing Tag Set", and - `jats_articleauthoring` for the "Article Authoring Tag Set." The "jats" output format is now an alias for "jats_archiving". Closes: #6014
2020-02-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane3-26/+26
2020-01-01LaTeX writer: properly handle unnumbered headings level 4+.John MacFarlane1-1/+1
Closes #6018. Previously the `\paragraph` command was used instead of `\paragraph*` for unnumbered level 4 headings.
2019-11-14RST writer: fix backslash escaping after stringsAlbert Krewinkel1-0/+3
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-12Switch to new pandoc-types and use Text instead of String [API change].despresc2-11/+18
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-04HTML Reader/Writer - Add support for <var> and <samp> (#5861)Amogh Rathore1-0/+22
Closes #5799
2019-10-29Changes to build with new doctemplates/doclayout.John MacFarlane1-1/+1
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-24HTML reader/writer: Better handling of <q> with cite attribute (#5837)Ole Martin Ruud1-0/+17
* HTML reader: Handle cite attribute for quotes. If a `<q>` tag has a `cite` attribute, we interpret it as a Quoted element with an inner Span. Closes #5798 * Refactor url canonicalization into a helper function * Modify HTML writer to handle quote with cite. [0]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
2019-10-09Options.WriterOptions: Change type of writerVariables to Context Text.John MacFarlane1-1/+5
This will allow structured values. [API change]
2019-10-03Minor ghc 8.8 fixups.John MacFarlane1-1/+0
2019-09-23ConTeXt unit tests - tweak code property.John MacFarlane1-1/+1
Inline code will never have two consecutive newlines. We get a counterexample in this case https://pipelines.actions.githubusercontent.com/bMXCpShstkkHbFPgw9hBRMWw2w9plyzdVM8r7CRPFBHFvidaAG/5cf52d2d-3804-412d-ae65-4f8c059b0fb7/_apis/pipelines/1/runs/116/signedlogcontent/39?urlExpires=2019-09-23T17%3A38%3A05.8358735Z&urlSigningMethod=HMACV1&urlSignature=Qtd6vnzqgSwXpAkIyp9DJY4Kn7GJzYMR8UDkLR%2FsMQY%3D so for simplicity we just weed out code with newlines.
2019-09-22Make `plain` output plainer.John MacFarlane1-1/+3
Previously we used the following Project Gutenberg conventions for plain output: - extra space before and after level 1 and 2 headings - all-caps for strong emphasis `LIKE THIS` - underscores surrounding regular emphasis `_like this_` This commit makes `plain` output plainer. Strong and Emph inlines are rendered without special formatting. Headings are also rendered without special formatting, and with only one blank line following. To restore the former behavior, use `-t plain+gutenberg`. API change: Add `Ext_gutenberg` constructor to `Extension`. See #5741.
2019-09-20Preserve built-in styles in DOCX with custom style (#5670)Ben Steinberg1-0/+4
This commit prevents custom styles on divs and spans from overriding styles on certain elements inside them, like headings, blockquotes, and links. On those elements, the "native" style is required for the element to display correctly. This change also allows nesting of custom styles; in order to do so, it removes the default "Compact" style applied to Plain blocks, except when inside a table.
2019-08-27PowerPoint writer: Start numbering at appopriate numbers.Jesse Rosenthal1-0/+4
Starting numbers for ordered lists were previously ignored. Now we specify the number if it is something other than 1. Closes: #5709
2019-07-28Use doctemplates 0.3, change type of writerTemplate.John MacFarlane2-5/+16
* 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-18Markdown writer: prefer using raw_attribute when enabled.John MacFarlane1-1/+1
The `raw_attribute` will be used to mark raw bits, even HTML and LaTeX, and even when `raw_html` and `raw_tex` are enabled, as they are by default. To get the old behavior, disable `raw_attribute` in the writer. Closes #4311.
2019-07-14Muse: add RTL supportAlexander Krotov1-0/+7
Closes #5551
2019-06-14Powerpoint code formatting is now context dependent (#5573)Jeroen de Haas1-0/+8
This commit alters the way in which the Powerpoint writer treats inline code and code blocks. - Inline code is now formatted at the same size as the surrounding text. - Code blocks are now given a margin and font size according to their level. - Furthermore this commit allows changing the font with which code is formatted via the `monofont` option. Tested in - PowerPoint 365 for Windows - 1808 (Build 10730.20344 Click-to-Run) - PowerPoint 365 for Mac - 16.26 (19060901)
2019-06-10LaTeX writer: Use mbox to get proper behavior inside `\sout`.John MacFarlane1-1/+1
Closes #5529.
2019-05-25Muse writer: do not escape empty line after <br>Alexander Krotov1-0/+1
2019-05-16JATS writer: properly handle footnotes.John MacFarlane1-3/+1
"Best Practice: When footnotes are grouped at the end of an article, wrap them in a `<fn-group>` and use an `<xref>` element in the text, as usual, to tie each footnote in the list to a particular location in the text." Closes #5511.
2019-04-28Muse writer tests: compare Text without converting to [Char]Alexander Krotov1-6/+6
2019-03-31PowerPoint writer: add test for speaker notes after metadata.Jesse Rosenthal1-0/+4
2019-03-30Pptx writer: test for speaker notes after breaking header.Jesse Rosenthal1-0/+4
2019-02-18Muse writer: escape secondary notesAlexander Krotov1-0/+1
2019-02-10Use latest skylighting.John MacFarlane1-1/+1
2019-01-26Improve writing metadata for docx, pptx and odt (#5252)Agustín Martín Barbero2-0/+18
* docx writer: support custom properties. Solves the writer part of #3024. Also supports additional core properties: `subject`, `lang`, `category`, `description`. * odt writer: improve standard properties, including the following core properties: `generator` (Pandoc/VERSION), `description`, `subject`, `keywords`, `initial-creator` (from authors), `creation-date` (actual creation date). Also fix date. * pptx writer: support custom properties. Also supports additional core properties: `subject`, `category`, `description`. * Includes golden tests. * MANUAL: document metadata support for docx, odt, pptx writers
2019-01-07Asciidoc writer: shorter delimiters for tables, blockquotes.John MacFarlane1-4/+4
This matches asciidoctor reference docs. Closes #4364.
2018-11-14Muse writer: indent simple tables only on the top levelAlexander Krotov1-0/+6
2018-11-13Muse writer: output tables with one column as grid tablesAlexander Krotov1-0/+12