aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmily Bourke <undergroundquizscene@protonmail.com>2021-09-17 16:05:06 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2021-10-17 17:24:30 -0700
commit8af15ab345bb0790cc3442722673d9da9f23a79c (patch)
tree573a438aa9d684178aabc3666e755862cd031beb /src
parent3f489bcb5897898d453bef549d6eba5f5d2120bf (diff)
downloadpandoc-8af15ab345bb0790cc3442722673d9da9f23a79c.tar.gz
pptx: Fix list level numbering
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
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint/Presentation.hs31
1 files changed, 17 insertions, 14 deletions
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]