git.iko.soy/typeable/pandoc
on master help sign in
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.

commit279c254007601de5cb6a44e0d51522748880d732 authorJesse Rosenthal <jrosenthal@jhu.edu> dateFri 22 Dec 2017, 05:31 (9 years ago) parenta848d3e
1 file changed+13−1
src/Text/Pandoc/Writers/Powerpoint.hs+13−1
src/Text/Pandoc/Writers/Powerpoint.hs+13−1
@@ -369,6 +369,12 @@ inlineToParElems (Span _ ils) = concatMapM inlineToParElems ils
369369inlineToParElems (RawInline _ _) = return []
370370inlineToParElems _ = return []
371371
372+isListType :: Block -> Bool
373+isListType (OrderedList _ _) = True
374+isListType (BulletList _) = True
375+isListType (DefinitionList _) = True
376+isListType _ = False
377+
372378blockToParagraphs :: PandocMonad m => Block -> P m [Paragraph]
373379blockToParagraphs (Plain ils) = do
374380 parElems <- inlinesToParElems ils
@@ -386,7 +392,13 @@ blockToParagraphs (LineBlock ilsList) = do
386392blockToParagraphs (CodeBlock attr str) =
387393 local (\r -> r{envParaProps = def{pPropMarginLeft = Just 100}}) $
388394 blockToParagraphs $ Para [Code attr str]
389−-- TODO: work out the format
395+-- We can't yet do incremental lists, but we should render a
396+-- (BlockQuote List) as a list to maintain compatibility with other
397+-- formats.
398+blockToParagraphs (BlockQuote (blk : blks)) | isListType blk = do
399+ ps <- blockToParagraphs blk
400+ ps' <- blockToParagraphs $ BlockQuote blks
401+ return $ ps ++ ps'
390402blockToParagraphs (BlockQuote blks) =
391403 local (\r -> r{ envParaProps = (envParaProps r){pPropMarginLeft = Just 100}
392404 , envRunProps = (envRunProps r){rPropForceSize = Just blockQuoteSize}})$