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). --- .../with-flag/deleted-layouts.pptx | Bin 0 -> 80172 bytes test/pptx/incremental-lists/with-flag/input.native | 139 +++++++++++++++++++++ .../incremental-lists/with-flag/moved-layouts.pptx | Bin 0 -> 90917 bytes test/pptx/incremental-lists/with-flag/output.pptx | Bin 0 -> 77298 bytes .../incremental-lists/with-flag/templated.pptx | Bin 0 -> 90414 bytes .../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 10 files changed, 276 insertions(+) create mode 100644 test/pptx/incremental-lists/with-flag/deleted-layouts.pptx create mode 100644 test/pptx/incremental-lists/with-flag/input.native create mode 100644 test/pptx/incremental-lists/with-flag/moved-layouts.pptx create mode 100644 test/pptx/incremental-lists/with-flag/output.pptx create mode 100644 test/pptx/incremental-lists/with-flag/templated.pptx 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') diff --git a/test/pptx/incremental-lists/with-flag/deleted-layouts.pptx b/test/pptx/incremental-lists/with-flag/deleted-layouts.pptx new file mode 100644 index 000000000..5a74826a4 Binary files /dev/null and b/test/pptx/incremental-lists/with-flag/deleted-layouts.pptx differ diff --git a/test/pptx/incremental-lists/with-flag/input.native b/test/pptx/incremental-lists/with-flag/input.native new file mode 100644 index 000000000..b690794dc --- /dev/null +++ b/test/pptx/incremental-lists/with-flag/input.native @@ -0,0 +1,139 @@ +[Header 1 ("slide-1-content",[],[]) [Str "Slide",Space,Str "1",Space,Str "(Content)"] +,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 + [[Para [Str "as"]] + ,[Para [Str "should"]] + ,[Para [Str "these"]]] +,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:"] +,BulletList + [[Plain [Str "also"]] + ,[Plain [Str "be"]] + ,[Plain [Str "incremental"]]] +,Header 1 ("slide-4-content",[],[]) [Str "Slide",Space,Str "4",Space,Str "(Content)"] +,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"] +,BulletList + [[Plain [Str "But"]] + ,[Plain [Str "these"]] + ,[Plain [Str "are"]]] +,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:"] + ,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:"] + ,BulletList + [[Plain [Str "one"]] + ,[Plain [Str "by"]] + ,[Plain [Str "one"]]] + ,Para [Str "With",Space,Str "something",Space,Str "else",Space,Str "below"]]] +,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"],[]) + [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:"] +,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"],[]) + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]] + ,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")]] + ,Div ("",["column"],[]) + [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-9-content",[],[]) [Str "Slide",Space,Str "9",Space,Str "(Content)"] +,Div ("",["nonincremental"],[]) + [BulletList + [[Plain [Str "these"]] + ,[Plain [Str "are"]] + ,[Plain [Str "not"]] + ,[Plain [Str "incremental"]]]] +,BulletList + [[Plain [Str "these"]] + ,[Plain [Str "are"]]] +,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 "not",Space,Str "incremental:"] +,BlockQuote + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]] +,Para [Str "These",Space,Str "are:"] +,Div ("",["nonincremental"],[]) + [BlockQuote + [BulletList + [[Plain [Str "one"]] + ,[Plain [Str "two"]] + ,[Plain [Str "three"]]]]] +,Para [Str "These",Space,Str "are",Space,Str "not:"] +,BlockQuote + [Div ("",["nonincremental"],[]) + [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/with-flag/moved-layouts.pptx b/test/pptx/incremental-lists/with-flag/moved-layouts.pptx new file mode 100644 index 000000000..f20dd2906 Binary files /dev/null and b/test/pptx/incremental-lists/with-flag/moved-layouts.pptx differ diff --git a/test/pptx/incremental-lists/with-flag/output.pptx b/test/pptx/incremental-lists/with-flag/output.pptx new file mode 100644 index 000000000..d4f76f1e7 Binary files /dev/null and b/test/pptx/incremental-lists/with-flag/output.pptx differ diff --git a/test/pptx/incremental-lists/with-flag/templated.pptx b/test/pptx/incremental-lists/with-flag/templated.pptx new file mode 100644 index 000000000..f5ee2ff5f Binary files /dev/null and b/test/pptx/incremental-lists/with-flag/templated.pptx differ 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