summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2017-12-22 05:31:04 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2017-12-22 05:32:23 -0500
commit279c254007601de5cb6a44e0d51522748880d732 (patch)
tree04aa83deff695a5eacb5ca161dd7c99731a8ccc1 /src/Text
parenta848d3e031de78d848d4fda922bbc4c85114aa4f (diff)
PowerPoint writer: Treat lists inside BlockQuotes as lists
We don't yet produce incremental lists in PowerPoint, but we should at least treat lists inside BlockQuotes as lists, for compatibility with other slide formats.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Powerpoint.hs b/src/Text/Pandoc/Writers/Powerpoint.hs
index 7a453ef1f..d5627f51c 100644
--- a/src/Text/Pandoc/Writers/Powerpoint.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint.hs
@@ -369,6 +369,12 @@ inlineToParElems (Span _ ils) = concatMapM inlineToParElems ils
inlineToParElems (RawInline _ _) = return []
inlineToParElems _ = return []
+isListType :: Block -> Bool
+isListType (OrderedList _ _) = True
+isListType (BulletList _) = True
+isListType (DefinitionList _) = True
+isListType _ = False
+
blockToParagraphs :: PandocMonad m => Block -> P m [Paragraph]
blockToParagraphs (Plain ils) = do
parElems <- inlinesToParElems ils
@@ -386,7 +392,13 @@ blockToParagraphs (LineBlock ilsList) = do
blockToParagraphs (CodeBlock attr str) =
local (\r -> r{envParaProps = def{pPropMarginLeft = Just 100}}) $
blockToParagraphs $ Para [Code attr str]
--- TODO: work out the format
+-- We can't yet do incremental lists, but we should render a
+-- (BlockQuote List) as a list to maintain compatibility with other
+-- formats.
+blockToParagraphs (BlockQuote (blk : blks)) | isListType blk = do
+ ps <- blockToParagraphs blk
+ ps' <- blockToParagraphs $ BlockQuote blks
+ return $ ps ++ ps'
blockToParagraphs (BlockQuote blks) =
local (\r -> r{ envParaProps = (envParaProps r){pPropMarginLeft = Just 100}
, envRunProps = (envRunProps r){rPropForceSize = Just blockQuoteSize}})$