aboutsummaryrefslogtreecommitdiff
path: root/test/pptx
AgeCommit message (Collapse)AuthorFilesLines
2021-10-17pptx: Line up continuation paragraphsEmily Bourke46-0/+0
This commit changes the `marL` and `indent` values used for plain paragraphs and numbered lists, and changes the spacing defined in the reference doc master for bulleted lists. For paragraphs, there is now a left-indent taken from the `otherStyle` in the master. For numbered lists, the number is positioned where the text would be if this were a plain paragraph, and the text is indented to the next level. This means that continuation paragraphs line up nicely with numbered lists. It also /mostly/ matches the observed PowerPoint behaviour when inserting paragraphs and numbered lists: the only difference is that PowerPoint was using a different margin value for the first level numbered lists – I’ve changed this to match the other levels, as I don’t think it makes the spacing unappealing and it allows continuation paragraphs at any level to line up. With bulleted lists, I’m keeping the observed PowerPoint behaviour of specifying only a level, letting `marL` and `indent` be automatically taken from `bodyStyle`. To that end, this commit changes the `bodyStyle` spacing in the master of the default reference doc, to: - line up the text of the first paragraph in each bullet with any continuation paragraphs - line up nested bullet markers in any continuation paragraphs with the first paragraph, matching lists and plain paragraphs This does mean the continuation paragraphs still won’t line up for anyone using their own reference doc where they haven’t matched the `otherStyle` and `bodyStyle` indent levels, but I think people in that situation will be able to troubleshoot.
2021-10-17pptx: Fix list level numberingEmily Bourke21-0/+20
In PowerPoint, the content of a top-level list is at the same level as the content of a top-level paragraph – the only difference is that a list style has been applied. At the moment, the pptx writer increments the paragraph level on each list, turning what should be top-level lists into second-level lists. This commit changes that logic, only incrementing the paragraph level on continuation paragraphs of lists. - Fixes https://github.com/jgm/pandoc/issues/4828 - Fixes https://github.com/jgm/pandoc/issues/4663
2021-10-07pptx: Remove excessive layout testsEmily Bourke81-0/+23
When I added the tests for moved layouts and deleted layouts, I added them to all tests. However, this doesn’t really give a lot more info than having single tests, and the extra tests take up time and disk space. This commit removes the moved-layouts and deleted-layouts tests, in favour of a single test for each of those scenarios.
2021-10-04Powerpoint writer: consolidate text runs when possible.John MacFarlane136-0/+0
This slims down the output files by avoiding unnecessary text run elements. Updated golden tests.
2021-10-04Revert "Powerpoint writer: consolidate text run nodes."John MacFarlane136-0/+0
This reverts commit 62f83aa48633af477913bde6f615fe9f8793901a. This was already being done, it seems. I misidentified the problem; it is really with `Str ""` nodes.
2021-10-04Powerpoint writer: consolidate text run nodes.John MacFarlane136-0/+0
This should reduce the size of the generated files.
2021-09-18pptx: Support footers in the reference docEmily Bourke9-0/+66
In PowerPoint, it’s possible to specify footers across all slides, containing a date (optionally automatically updated to today’s date), the slide number (optionally starting from a higher number than 1), and static text. There’s also an option to hide the footer on the title slide. Before this commit, none of that footer content was pulled through from the reference doc: this commit supports all the functionality listed above. There is one behaviour which may not be immediately obvious: if the reference doc specifies a fixed date (i.e. not automatically updating), and there’s a date specified in the metadata for the document, the footer date is replaced by the metadata date. - Include date, slide number, and static footer content from reference doc - Respect “slide number starts from” option - Respect “Don’t show on title slide” option - Add tests
2021-09-16pptx: Support specifying slide background imagesEmily Bourke5-0/+17
In the reveal-js output, it’s possible to use reveal’s `data-background-image` class on a slide’s title to specify a background image for the slide. With this commit, it’s possible to use `background-image` in the same way for pptx output. Only the “stretch” mode is supported, and the background image is centred around the slide in the image’s larger axis, matching the observed default behaviour of PowerPoint. - Support `background-image` per slide. - Add tests. - Update manual.
2021-09-15pptx: Add support for incremental listsEmily Bourke10-0/+276
- Support -i option - Support incremental/noincremental divs - Support older block quote syntax - Add tests One thing not clear from the manual is what should happen when the input uses a combination of these things. For example, what should the following produce? ```md ::: {.incremental .nonincremental} - are - these - incremental? ::: ::: incremental ::::: nonincremental - or - these? ::::: ::: ::: nonincremental > - how > - about > - these? ::: ``` In this commit I’ve taken the following approach, matching the observed behaviour for beamer and reveal.js output: - if a div with both classes, incremental wins - the innermost incremental/nonincremental div is the one which takes effect - a block quote containing a list as its first element inverts whether the list is incremental, whether or not the quote is inside an incremental/non-incremental div I’ve added some tests to verify this behaviour. This commit closes issue #5689 (https://github.com/jgm/pandoc/issues/5689).
2021-09-13pptx: Fix logic for choosing Comparison layoutEmily Bourke10-0/+12
There was a mistake in the logic used to choose between the Comparison and Two Content layouts: if one column contained only non-text (an image or a table) and the other contained only text, the Comparison layout was chosen instead of the desired Two Content layout. This commit fixes that logic: > If either column contains text followed by non-text, use Comparison. Otherwise, use Two Content. It also adds a test asserting this behaviour.
2021-09-10pptx: Include all themes in output archiveEmily Bourke144-0/+0
- Accept test changes: they’re adding the second theme (for all tests not containing speaker notes), or changing its position in the XML (for the ones containing speaker notes).
2021-09-10pptx: Fix capitalisation of notesMasterIdEmily Bourke20-0/+0
I don’t think this has caused any problems, but before now it’s been "NotesMasterId", which is incorrect according to [ECMA-376]. [ECMA-376]: https://www.ecma-international.org/publications-and-standards/standards/ecma-376/
2021-09-01pptx: Add support for more layoutsEmily Bourke86-0/+137
Until now, the pptx writer only supported four slide layouts: “Title Slide” (used for the automatically generated metadata slide), “Section Header” (used for headings above the slide level), “Two Column” (used when there’s a columns div containing at least two column divs), and “Title and Content” (used for all other slides). This commit adds support for three more layouts: Comparison, Content with Caption, and Blank. - Support “Comparison” slide layout This layout is used when a slide contains at least two columns, at least one of which contains some text followed by some non-text (e.g. an image or table). The text in each column is inserted into the “body” placeholder for that column, and the non-text is inserted into the ObjType placeholder. Any extra content after the non-text is overlaid on top of the preceding content, rather than dropping it completely (as currently happens for the two-column layout). + Accept straightforward test changes Adding the new layout means the “-deleted-layouts” tests have an additional layout added to the master and master rels. + Add new tests for the comparison layout + Add new tests to pandoc.cabal - Support “Content with Caption” slide layout This layout is used when a slide’s body contains some text, followed by non-text (e.g. and image or a table). Before now, in this case the image or table would break onto a new slide: to get that output again, users can add a horizontal rule before the image or table. + Accept straightforward tests The “-deleted-layouts” tests all have an extra layout and relationship in the master for the Content with Caption layout. + Accept remove-empty-slides test Empty slides are still removed, but the Content with Caption layout is now used. + Change slide-level-0/h1-h2-with-text description This test now triggers the content with caption layout, giving a different (but still correct) result. + Add new tests for the new layout + Add new tests to the cabal file - Support “Blank” slide layout This layout is used when a slide contains only blank content (e.g. non-breaking spaces). No content is inserted into any placeholders in the layout. Fixes #5097. + Accept straightforward test changes Blank layout now copied over from reference doc as well, when layouts have been deleted. + Add some new tests A slide should use the blank layout if: - It contains only speaker notes - It contains only an empty heading with a body of nbsps - It contains only a heading containing only nbsps - Change ContentType -> Placeholder This type was starting to have a constructor for each placeholder on each slide (e.g. `ComparisonUpperLeftContent`). I’ve changed it instead to identify a placeholder by type and index, as I think that’s clearer and less redundant. - Describe layout-choosing logic in manual
2021-09-01pptx: Restructure testsEmily Bourke124-0/+0
- Use dashes consistently rather than underscores - Make a folder for each set of tests - List test files explicitly (Cabal doesn’t support ** until version 2.4)
2021-08-27pptx: Make first heading title if slide level is 0Emily Bourke20-0/+31
Before this commit, the pptx writer adds a slide break before any table, “columns” div, or paragraph starting with an image, unless the only thing before it on the same slide is a heading at the slide level. In that case, the item and heading are kept on the same slide, and the heading is used as the slide title (inserted into the layout’s “title” placeholder). However, if the slide level is set to 0 (as was recently enabled) this makes it impossible to have a slide with a title which contains any of those items in its body. This commit changes this behaviour: now if the slide level is 0, then items will be kept with a heading of any level, if the heading’s the only thing before the item on the same slide.
2021-08-18pptx: Include image title in descriptionEmily Bourke8-0/+0
The image title (i.e. `![alt text](link "title")`) was previously ignored when writing to pptx. This commit includes it in PowerPoint's description of the image, along with the link (which was already included). Fixes 7352.
2021-08-17pptx: Select layouts from reference doc by nameEmily Bourke44-0/+0
Until now, users had to make sure that their reference doc contains layouts in a specific order: the first four layouts in the file had to have a specific structure, or else pandoc would error (or sometimes successfully produce a pptx file, which PowerPoint would then fail to open). This commit changes the layout selection to use the layout names rather than order: users must make sure their reference doc contains four layouts with specific names, and if a layout with the right name isn’t found pandoc will output a warning and use the corresponding layout from the default reference doc as a fallback. I believe the use of names rather than order will be clearer to users, and the clearer errors will help them troubleshoot when things go wrong. - Add tests for moved layouts - Add tests for deleted layouts - Add newly included layouts to slideMaster1.xml to fix tests
2021-05-29Modify pptx tests to take a whole lot less space.John MacFarlane22-0/+0
- Replace a 300K image in the reference pptx with a 2K one. - Updated all the *_templated.pptx files based on the new reference pptx. - These changes should reduce the size of the tarball by roughly 7 MB! See haskell/hackage-server#935
2021-02-16Rename Text.Pandoc.XMLParser -> Text.Pandoc.XML.Light...John MacFarlane42-0/+0
..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-10Add new unexported module T.P.XMLParser.John MacFarlane42-0/+0
This exports functions that uses xml-conduit's parser to produce an xml-light Element or [Content]. This allows existing pandoc code to use a better parser without much modification. The new parser is used in all places where xml-light's parser was previously used. Benchmarks show a significant performance improvement in parsing XML-based formats (especially ODT and FB2). Note that the xml-light types use String, so the conversion from xml-conduit types involves a lot of extra allocation. It would be desirable to avoid that in the future by gradually switching to using xml-conduit directly. This can be done module by module. The new parser also reports errors, which we report when possible. A new constructor PandocXMLError has been added to PandocError in T.P.Error [API change]. Closes #7091, which was the main stimulus. These changes revealed the need for some changes in the tests. The docbook-reader.docbook test lacked definitions for the entities it used; these have been added. And the docx golden tests have been updated, because the new parser does not preserve the order of attributes. Add entity defs to docbook-reader.docbook. Update golden tests for docx.
2020-12-27Powerpoint writer: allow arbitrary OOXML in raw inline elementsAlbert Krewinkel1-1/+1
The raw text is now included verbatim in the output. Previously is was parsed into XML elements, which prevented the inclusion of partial XML snippets.
2020-06-22Handle native Underline in Powerpoint writer.John MacFarlane2-0/+0
(Instead of old Span with underline class. Spans with `underline` will no longer be rendered as underlined text.)
2020-04-15Adapt to the removal of the RowSpan, ColSpan, RowHeadColumns accessorsdespresc2-51/+51
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc2-103/+127
- 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-51/+117
2019-08-27PowerPoint writer: Start numbering at appopriate numbers.Jesse Rosenthal3-0/+9
Starting numbers for ordered lists were previously ignored. Now we specify the number if it is something other than 1. Closes: #5709
2019-06-14Powerpoint code formatting is now context dependent (#5573)Jeroen de Haas5-0/+21
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-04-05PowerPoint writer: expand builtin reference doc to model all layoutsJesse Rosenthal22-0/+0
The previous built-in reference doc had only title and content layouts. Add in a section-header slide and a two-content slide, so users can more easily modify it to build their own templates. Golden files needed to be regenerated. Checked on MS PowerPoint 2013.
2019-04-04PowerPoint tests: Regenerate golden filesJesse Rosenthal36-0/+0
Due to viewProps change in 61dc0f9f. Golden files checked on PowerPoint 2013 (Win 10 on virtualbox).
2019-03-31PowerPoint writer: add test for speaker notes after metadata.Jesse Rosenthal3-0/+5
2019-03-30Pptx writer: test for speaker notes after breaking header.Jesse Rosenthal3-0/+3
2019-02-27Powerpoint writer: add tests for underline.Jesse Rosenthal3-1/+1
2019-01-26Improve writing metadata for docx, pptx and odt (#5252)Agustín Martín Barbero34-0/+4
* 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
2018-10-20Powerpoint tests: test raw openxmlJesse Rosenthal3-0/+3
Output files confirmed not to be corrupt, and with content as expected, on PowerPoint 2013 on Windows 10 (virtualbox on linux).
2018-07-02More spellcheckAlexander Krotov3-1/+1
2018-03-24Update powerpoint golden tests:Jesse Rosenthal8-0/+0
Some internal changes in templating produced slightly different xml. All have been checked, are not corrupt, and have output as expected.
2018-03-21Powerpoint writer: add tests for improved speaker notes.Jesse Rosenthal3-0/+33
Tests speaker notes appearing after (and inside of) separating blocks. Output checked on Windows10 (archlinux virtualbox), PowerPoint 2013. Not corrupted, and output as expected.
2018-02-27Powerpoint writer: Use table stylesJesse Rosenthal2-0/+0
This will use the default table style in the reference-doc file. As a result they will be easier when using in a template, and match the color scheme.
2018-02-27Powerpoint writer: add test for table and list syntaxJesse Rosenthal6-0/+53
These were never added when the tests were first created. Output files checked in MS PowerPoint 2013 (Windows 10, VBox). No corruption, and output as expected.
2018-02-27Powerpoint writer: Remove empty slidesJesse Rosenthal3-0/+5
Make sure there are no empty slides in the pptx output. Because of the way that slides were split, these could be accidentally produced by comments after images. When animations are added, there will be a way to add an empty slide with either incremental lists or pauses. Test outputs checked with MS PowerPoint (Office 2013, Windows 10, VBox). Both files have expected output and are not corrupted.
2018-02-19Powerpoint writer tests: Test everything with template as wellJesse Rosenthal10-0/+0
Modify the PowerPoint tests to run all the tests with template (--reference-doc) as well. Because there are so many interlocking pieces, bugs can pop up in weird places when using templates, since it changes how the writer builds its output file. For example, I recently discovered a bug in which speaker notes worked fine and templating worked fine elsewhere, but templating with speaker notes produced a file that would crash MS PowerPoint. That particular bug was fixed, but this will forces us to check for that with each new change.
2018-02-19Powerpoint writer: Update.golden tests.Jesse Rosenthal9-0/+0
Checked with Office 2013. No corruption and output as expected.
2018-02-18Powerpoint writer: Add tests for speaker notes.Jesse Rosenthal2-0/+17
2018-02-18Powerpoint writer: update golden test filesJesse Rosenthal8-0/+0
Since the template changed, some small elements of these test files changed as well. All of these were checked with Powerpoint 2013 on Windows 10 (VirtualBox). All had expected outcomes and no corruption.
2018-01-22Powerpoint writer tests: add tests for two-column layout and imagesJesse Rosenthal4-0/+14
Powerpoint output checked in MS PowerPoint 2013 (Windows)
2018-01-22Powerpoint writer: Add further testsJesse Rosenthal4-0/+2
Tests added for: - table of contents - endnotes - endnotes with table of contents Powerpoint output checked in MS PowerPoint 2013 (Windows)
2018-01-21Powerpoint writer tests: New test framework for pptx.Jesse Rosenthal5-0/+12
Previously we had tested certain properties of the output PowerPoint slides. Corruption, though, comes as the result of a numebr of interrelated issues in the output pptx archive. This is a new approach, which compares the output of the Powerpoint writer with files that we know to (a) not be corrupt, and (b) to show the desired output behavior (details below). This commit introduces three tests using the new framework. More will follow. The test procedure: given a native file and a pptx file, we generate a pptx archive from the native file, and then test: 1. Whether the same files are in the two archives 2. Whether each of the contained xml files is the same. (We skip time entries in `docProps/core.xml`, since these are derived from IO. We just check to make sure that they're there in the same way in both files.) 3. Whether each of the media files is the same. Note that steps 2 and 3, though they compare multiple files, are one test each, since the number of files depends on the input file (if there is a failure, it will only report the first failed file comparison in the test failure).