From 0fb6474a55427b52bf9aebd179f7b26f30c7dbaf Mon Sep 17 00:00:00 2001 From: Emily Bourke Date: Tue, 7 Sep 2021 13:38:47 +0100 Subject: pptx: Add support for incremental lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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). --- .../without-flag/deleted-layouts.pptx | Bin 0 -> 78405 bytes .../incremental-lists/without-flag/input.native | 137 +++++++++++++++++++++ .../without-flag/moved-layouts.pptx | Bin 0 -> 89148 bytes .../incremental-lists/without-flag/output.pptx | Bin 0 -> 75533 bytes .../incremental-lists/without-flag/templated.pptx | Bin 0 -> 88645 bytes 5 files changed, 137 insertions(+) create mode 100644 test/pptx/incremental-lists/without-flag/deleted-layouts.pptx create mode 100644 test/pptx/incremental-lists/without-flag/input.native create mode 100644 test/pptx/incremental-lists/without-flag/moved-layouts.pptx create mode 100644 test/pptx/incremental-lists/without-flag/output.pptx create mode 100644 test/pptx/incremental-lists/without-flag/templated.pptx (limited to 'test/pptx/incremental-lists/without-flag') diff --git a/test/pptx/incremental-lists/without-flag/deleted-layouts.pptx b/test/pptx/incremental-lists/without-flag/deleted-layouts.pptx new file mode 100644 index 000000000..16bd85ffd Binary files /dev/null and b/test/pptx/incremental-lists/without-flag/deleted-layouts.pptx differ diff --git a/test/pptx/incremental-lists/without-flag/input.native b/test/pptx/incremental-lists/without-flag/input.native new file mode 100644 index 000000000..87a4aea7e --- /dev/null +++ b/test/pptx/incremental-lists/without-flag/input.native @@ -0,0 +1,137 @@ +[Header 1 ("slide-1-content",[],[]) [Str "Slide",Space,Str "1",Space,Str "(Content)"] +,Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "These"]] + ,[Plain [Str "bullets"]] + ,[Plain [Str "should"]] + ,[Plain [Str "be"]] + ,[Plain [Str "incremental"]]]] +,Header 1 ("slide-2-content",[],[]) [Str "Slide",Space,Str "2",Space,Str "(Content)"] +,BulletList + [[Plain [Str "These"]] + ,[Plain [Str "are"]] + ,[Plain [Str "not"]]] +,Header 1 ("slide-3-content",[],[]) [Str "Slide",Space,Str "3",Space,Str "(Content)"] +,Para [Str "Even",Space,Str "with",Space,Str "some",Space,Str "text",Space,Str "first,",Space,Str "these",Space,Str "should:"] +,Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "also"]] + ,[Plain [Str "be"]] + ,[Plain [Str "incremental"]]]] +,Header 1 ("slide-4-content",[],[]) [Str "Slide",Space,Str "4",Space,Str "(Content)"] +,Div ("",["incremental"],[]) + [OrderedList (1,Decimal,Period) + [[Plain [Str "These"]] + ,[Plain [Str "are"]] + ,[Plain [Str "incremental"]]]] +,Para [Str "But",Space,Str "this",Space,Str "text",Space,Str "isn\8217t"] +,Header 1 ("slide-5-two-content",[],[]) [Str "Slide",Space,Str "5",Space,Str "(Two",Space,Str "Content)"] +,Div ("",["columns"],[]) + [Div ("",["column"],[]) + [Para [Str "Incremental",Space,Str "on",Space,Str "the",Space,Str "left:"] + ,Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "by"]] + ,[Plain [Str "one"]]]] + ,Para [Str "With",Space,Str "something",Space,Str "below"]] + ,Div ("",["column"],[]) + [Para [Str "Incremental",Space,Str "on",Space,Str "the",Space,Str "right:"] + ,Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "by"]] + ,[Plain [Str "one"]]]] + ,BulletList + [[Plain [Str "already"]] + ,[Plain [Str "here"]] + ,[Plain [Str "though"]]]]] +,Header 1 ("slide-6-two-content-right",[],[]) [Str "Slide",Space,Str "6",Space,Str "(Two",Space,Str "Content",Space,Str "Right)"] +,Div ("",["columns"],[]) + [Div ("",["column"],[]) + [Para [Image ("",[],[]) [Str "an",Space,Str "image"] ("lalune.jpg","fig:")]] + ,Div ("",["column"],[]) + [Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "An"]] + ,[Plain [Str "Incremental"]] + ,[Plain [Str "List"]]]]]] +,Header 1 ("slide-7-content-with-caption",[],[]) [Str "Slide",Space,Str "7",Space,Str "(Content",Space,Str "with",Space,Str "Caption)"] +,Para [Str "First,",Space,Str "we",Space,Str "have",Space,Str "some",Space,Str "incremental",Space,Str "bullets:"] +,Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]] +,Para [Str "Then,",Space,Str "a",Space,Str "picture:"] +,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")] +,Header 1 ("slide-8-comparison",[],[]) [Str "Slide",Space,Str "8",Space,Str "(Comparison)"] +,Div ("",["columns"],[]) + [Div ("",["column"],[]) + [Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]] + ,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")]] + ,Div ("",["column"],[]) + [Div ("",["incremental"],[]) + [OrderedList (1,Decimal,Period) + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]] + ,Table ("",[],[]) (Caption Nothing + []) + [(AlignDefault,ColWidth 5.555555555555555e-2)] + (TableHead ("",[],[]) + [Row ("",[],[]) + [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "1"]]]]) + [(TableBody ("",[],[]) (RowHeadColumns 0) + [] + [Row ("",[],[]) + [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "2"]]]])] + (TableFoot ("",[],[]) + [])]] +,Header 1 ("slide-10-content",[],[]) [Str "Slide",Space,Str "10",Space,Str "(Content)"] +,Div ("",["incremental","nonincremental"],[]) + [BulletList + [[Plain [Str "these"]] + ,[Plain [Str "are"]] + ,[Plain [Str "incremental"]] + ,[Plain [Str "(the",Space,Str "incremental",Space,Str "class",Space,Str "wins)"]]]] +,Header 1 ("slide-11-content",[],[]) [Str "Slide",Space,Str "11",Space,Str "(Content)"] +,Para [Str "These",Space,Str "bullets",Space,Str "are",Space,Str "incremental:"] +,BlockQuote + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]] +,Para [Str "These",Space,Str "are",Space,Str "not:"] +,Div ("",["incremental"],[]) + [BlockQuote + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]]] +,Para [Str "These",Space,Str "are:"] +,BlockQuote + [Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]]] +,Header 1 ("slide-12-content",[],[]) [Str "Slide",Space,Str "12",Space,Str "(Content)"] +,Div ("",["nonincremental"],[]) + [Div ("",["incremental"],[]) + [BulletList + [[Plain [Str "these"]] + ,[Plain [Str "are"]] + ,[Plain [Str "incremental"]]]]] +,Div ("",["incremental"],[]) + [Div ("",["nonincremental"],[]) + [BulletList + [[Plain [Str "these"]] + ,[Plain [Str "are"]] + ,[Plain [Str "not"]]]]]] diff --git a/test/pptx/incremental-lists/without-flag/moved-layouts.pptx b/test/pptx/incremental-lists/without-flag/moved-layouts.pptx new file mode 100644 index 000000000..054fe918e Binary files /dev/null and b/test/pptx/incremental-lists/without-flag/moved-layouts.pptx differ diff --git a/test/pptx/incremental-lists/without-flag/output.pptx b/test/pptx/incremental-lists/without-flag/output.pptx new file mode 100644 index 000000000..1b326461d Binary files /dev/null and b/test/pptx/incremental-lists/without-flag/output.pptx differ diff --git a/test/pptx/incremental-lists/without-flag/templated.pptx b/test/pptx/incremental-lists/without-flag/templated.pptx new file mode 100644 index 000000000..dee6e9b06 Binary files /dev/null and b/test/pptx/incremental-lists/without-flag/templated.pptx differ -- cgit v1.2.3