From b82a01b6883c1f6a9ce5d3edd80d5a2453ecef9e Mon Sep 17 00:00:00 2001 From: Emily Bourke Date: Thu, 19 Aug 2021 15:53:21 +0100 Subject: pptx: Add support for more layouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- MANUAL.txt | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) (limited to 'MANUAL.txt') diff --git a/MANUAL.txt b/MANUAL.txt index f81f4c70b..afdd66ddd 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1182,11 +1182,15 @@ header when requesting a document from a URL: - Title and Content - Section Header - Two Content + - Comparison + - Content with Caption + - Blank For each name, the first layout found with that name will be used. If no layout is found with one of the names, pandoc will output a warning and use the layout with that name from the default reference - doc instead. + doc instead. (How these layouts are used is described in [PowerPoint + layout choice](#powerpoint-layout-choice).) All templates included with a recent version of MS PowerPoint will fit these criteria. (You can click on `Layout` under the @@ -1195,8 +1199,8 @@ header when requesting a document from a URL: You can also modify the default `reference.pptx`: first run `pandoc -o custom-reference.pptx --print-default-data-file reference.pptx`, and then modify `custom-reference.pptx` - in MS PowerPoint (pandoc will use the first four layout - slides, as mentioned above). + in MS PowerPoint (pandoc will use the layouts with the names + listed above). `--epub-cover-image=`*FILE* @@ -5833,6 +5837,48 @@ you use deeper nesting of section levels with reveal.js unless you set `--slide-level=0` (which lets reveal.js produce a one-dimensional layout and only interprets horizontal rules as slide boundaries). +### PowerPoint layout choice + +When creating slides, the pptx writer chooses from a number of pre-defined +layouts, based on the content of the slide: + +Title Slide +: This layout is used for the initial slide, which is generated and + filled from the metadata fields `date`, `author`, and `title`, if + they are present. + +Section Header +: This layout is used for what pandoc calls “title slides”, i.e. + slides which start with a header which is above the slide level in + the hierarchy. + +Two Content +: This layout is used for two-column slides, i.e. slides containing a + div with class `columns` which contains at least two divs with class + `column`. + +Comparison +: This layout is used instead of “Two Content” for any two-column + slides in which at least one column contains text followed by + non-text (e.g. an image or a table). + +Content with Caption +: This layout is used for any non-two-column slides which contain text + followed by non-text (e.g. an image or a table). + +Blank +: This layout is used for any slides which only contain blank content, + e.g. a slide containing only speaker notes, or a slide containing + only a non-breaking space. + +Title and Content +: This layout is used for all slides which do not match the criteria + for another layout. + +These layouts are chosen from the default pptx reference doc included with +pandoc, unless an alternative reference doc is specified using +`--reference-doc`. + ## Incremental lists By default, these writers produce lists that display "all at once." -- cgit v1.2.3