diff options
24 files changed, 43 insertions, 14 deletions
diff --git a/pandoc.cabal b/pandoc.cabal index 615feaccb..ac6cb8121 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -429,6 +429,8 @@ extra-source-files: test/pptx/inline-formatting/*.pptx test/pptx/lists/input.native test/pptx/lists/*.pptx + test/pptx/list-level/input.native + test/pptx/list-level/*.pptx test/pptx/raw-ooxml/input.native test/pptx/raw-ooxml/*.pptx test/pptx/remove-empty-slides/input.native diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs index fe34d24dc..2f94dcc17 100644 --- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs @@ -500,27 +500,23 @@ blockToParagraphs (Header _ (ident, _, _) ils) = do blockToParagraphs (BulletList blksLst) = do pProps <- asks envParaProps incremental <- listShouldBeIncremental - let lvl = pPropLevel pProps local (\env -> env{ envInList = True - , envParaProps = pProps{ pPropLevel = lvl + 1 - , pPropBullet = Just Bullet + , envParaProps = pProps{ pPropBullet = Just Bullet , pPropMarginLeft = Nothing , pPropIndent = Nothing , pPropIncremental = incremental }}) $ - concatMapM multiParBullet blksLst + concatMapM multiParList blksLst blockToParagraphs (OrderedList listAttr blksLst) = do pProps <- asks envParaProps incremental <- listShouldBeIncremental - let lvl = pPropLevel pProps local (\env -> env{ envInList = True - , envParaProps = pProps{ pPropLevel = lvl + 1 - , pPropBullet = Just (AutoNumbering listAttr) + , envParaProps = pProps{ pPropBullet = Just (AutoNumbering listAttr) , pPropMarginLeft = Nothing , pPropIndent = Nothing , pPropIncremental = incremental }}) $ - concatMapM multiParBullet blksLst + concatMapM multiParList blksLst blockToParagraphs (DefinitionList entries) = do incremental <- listShouldBeIncremental let go :: ([Inline], [[Block]]) -> Pres [Paragraph] @@ -545,14 +541,21 @@ blockToParagraphs blk = do addLogMessage $ BlockNotRendered blk return [] --- Make sure the bullet env gets turned off after the first para. -multiParBullet :: [Block] -> Pres [Paragraph] -multiParBullet [] = return [] -multiParBullet (b:bs) = do +-- | Make sure the bullet env gets turned off after the first paragraph, and +-- indent any continuation paragraphs. +multiParList :: [Block] -> Pres [Paragraph] +multiParList [] = return [] +multiParList (b:bs) = do pProps <- asks envParaProps p <- blockToParagraphs b - ps <- local (\env -> env{envParaProps = pProps{pPropBullet = Nothing}}) $ - concatMapM blockToParagraphs bs + let level = pPropLevel pProps + ps <- local (\env -> env + { envParaProps = pProps + { pPropBullet = Nothing + , pPropLevel = level + 1 + } + }) + $ concatMapM blockToParagraphs bs return $ p ++ ps cellToParagraphs :: Alignment -> SimpleCell -> Pres [Paragraph] diff --git a/test/Tests/Writers/Powerpoint.hs b/test/Tests/Writers/Powerpoint.hs index 84bdd7476..f3663efbb 100644 --- a/test/Tests/Writers/Powerpoint.hs +++ b/test/Tests/Writers/Powerpoint.hs @@ -66,6 +66,10 @@ tests = let def "pptx/start-numbering-at/input.native" "pptx/start-numbering-at/output.pptx" + , pptxTests "List continuation paragraph indentation" + def + "pptx/list-level/input.native" + "pptx/list-level/output.pptx" , pptxTests "tables" def "pptx/tables/input.native" diff --git a/test/pptx/code-custom/output.pptx b/test/pptx/code-custom/output.pptx Binary files differindex ded8f1125..6c7a1a9ab 100644 --- a/test/pptx/code-custom/output.pptx +++ b/test/pptx/code-custom/output.pptx diff --git a/test/pptx/code-custom/templated.pptx b/test/pptx/code-custom/templated.pptx Binary files differindex 8bb0df1ff..116865c1f 100644 --- a/test/pptx/code-custom/templated.pptx +++ b/test/pptx/code-custom/templated.pptx diff --git a/test/pptx/code/output.pptx b/test/pptx/code/output.pptx Binary files differindex e700bc268..8fd00ff74 100644 --- a/test/pptx/code/output.pptx +++ b/test/pptx/code/output.pptx diff --git a/test/pptx/code/templated.pptx b/test/pptx/code/templated.pptx Binary files differindex 44f34cd64..0d7db048f 100644 --- a/test/pptx/code/templated.pptx +++ b/test/pptx/code/templated.pptx diff --git a/test/pptx/incremental-lists/with-flag/output.pptx b/test/pptx/incremental-lists/with-flag/output.pptx Binary files differindex 1ca1dbf17..82f5f926f 100644 --- a/test/pptx/incremental-lists/with-flag/output.pptx +++ b/test/pptx/incremental-lists/with-flag/output.pptx diff --git a/test/pptx/incremental-lists/with-flag/templated.pptx b/test/pptx/incremental-lists/with-flag/templated.pptx Binary files differindex 4ddf6bb75..e8482b25f 100644 --- a/test/pptx/incremental-lists/with-flag/templated.pptx +++ b/test/pptx/incremental-lists/with-flag/templated.pptx diff --git a/test/pptx/incremental-lists/without-flag/output.pptx b/test/pptx/incremental-lists/without-flag/output.pptx Binary files differindex 6f7261ba3..62e66e1fe 100644 --- a/test/pptx/incremental-lists/without-flag/output.pptx +++ b/test/pptx/incremental-lists/without-flag/output.pptx diff --git a/test/pptx/incremental-lists/without-flag/templated.pptx b/test/pptx/incremental-lists/without-flag/templated.pptx Binary files differindex ca5c9fdab..ac7be9564 100644 --- a/test/pptx/incremental-lists/without-flag/templated.pptx +++ b/test/pptx/incremental-lists/without-flag/templated.pptx diff --git a/test/pptx/list-level/input.native b/test/pptx/list-level/input.native new file mode 100644 index 000000000..e0b36b8e5 --- /dev/null +++ b/test/pptx/list-level/input.native @@ -0,0 +1,20 @@ +[Header 1 ("slide",[],[]) [Str "Slide"] +,BulletList + [[Para [Str "Top-level"] + ,Para [Str "With",Space,Str "continuation",Space,Str "paragraph"]] + ,[Para [Str "Then:"] + ,BulletList + [[Plain [Str "nested"]] + ,[Plain [Str "list"]] + ,[Plain [Str "items"]]]]] +,Header 1 ("slide-1",[],[]) [Str "Slide"] +,Para [Str "Paragraph."] +,OrderedList (1,Decimal,Period) + [[Para [Str "Top-level"] + ,Para [Str "Continuation"] + ,OrderedList (1,Decimal,Period) + [[Para [Str "Sub-list"] + ,Para [Str "With",Space,Str "Continuation"]] + ,[Para [Str "(still",Space,Str "sub-list)"]]]] + ,[Para [Str "(back",Space,Str "to",Space,Str "top-level)"]]] +,Para [Str "Paragraph."]] diff --git a/test/pptx/list-level/output.pptx b/test/pptx/list-level/output.pptx Binary files differnew file mode 100644 index 000000000..5e3506958 --- /dev/null +++ b/test/pptx/list-level/output.pptx diff --git a/test/pptx/list-level/templated.pptx b/test/pptx/list-level/templated.pptx Binary files differnew file mode 100644 index 000000000..8853a3082 --- /dev/null +++ b/test/pptx/list-level/templated.pptx diff --git a/test/pptx/lists/output.pptx b/test/pptx/lists/output.pptx Binary files differindex 94a424f42..e23f47218 100644 --- a/test/pptx/lists/output.pptx +++ b/test/pptx/lists/output.pptx diff --git a/test/pptx/lists/templated.pptx b/test/pptx/lists/templated.pptx Binary files differindex 52097489f..290b5b519 100644 --- a/test/pptx/lists/templated.pptx +++ b/test/pptx/lists/templated.pptx diff --git a/test/pptx/pauses/without-incremental/output.pptx b/test/pptx/pauses/without-incremental/output.pptx Binary files differnew file mode 100644 index 000000000..9085db330 --- /dev/null +++ b/test/pptx/pauses/without-incremental/output.pptx diff --git a/test/pptx/pauses/without-incremental/templated.pptx b/test/pptx/pauses/without-incremental/templated.pptx Binary files differnew file mode 100644 index 000000000..6662e2451 --- /dev/null +++ b/test/pptx/pauses/without-incremental/templated.pptx diff --git a/test/pptx/slide-breaks-toc/output.pptx b/test/pptx/slide-breaks-toc/output.pptx Binary files differindex 788cdf148..f2660ef93 100644 --- a/test/pptx/slide-breaks-toc/output.pptx +++ b/test/pptx/slide-breaks-toc/output.pptx diff --git a/test/pptx/slide-breaks-toc/templated.pptx b/test/pptx/slide-breaks-toc/templated.pptx Binary files differindex d11744079..0a2bdb857 100644 --- a/test/pptx/slide-breaks-toc/templated.pptx +++ b/test/pptx/slide-breaks-toc/templated.pptx diff --git a/test/pptx/speaker-notes-afterseps/output.pptx b/test/pptx/speaker-notes-afterseps/output.pptx Binary files differindex 99110d3ca..b54ba4465 100644 --- a/test/pptx/speaker-notes-afterseps/output.pptx +++ b/test/pptx/speaker-notes-afterseps/output.pptx diff --git a/test/pptx/speaker-notes-afterseps/templated.pptx b/test/pptx/speaker-notes-afterseps/templated.pptx Binary files differindex daf8e2175..3b272ab1b 100644 --- a/test/pptx/speaker-notes-afterseps/templated.pptx +++ b/test/pptx/speaker-notes-afterseps/templated.pptx diff --git a/test/pptx/start-numbering-at/output.pptx b/test/pptx/start-numbering-at/output.pptx Binary files differindex bc74ec599..ecfc6901a 100644 --- a/test/pptx/start-numbering-at/output.pptx +++ b/test/pptx/start-numbering-at/output.pptx diff --git a/test/pptx/start-numbering-at/templated.pptx b/test/pptx/start-numbering-at/templated.pptx Binary files differindex 4f191a06e..f3f46ef30 100644 --- a/test/pptx/start-numbering-at/templated.pptx +++ b/test/pptx/start-numbering-at/templated.pptx |