git.iko.soy/typeable/pandoc
on master help sign in
PowerPoint writer: Treat lists inside BlockQuotes as lists
279c254Jesse Rosenthal
src/Text/Pandoc/Writers/Powerpoint.hs+13−1
@@ -369,6 +369,12 @@ inlineToParElems (Span _ ils) = concatMapM inlineToParElems ils
369inlineToParElems (RawInline _ _) = return []
369inlineToParElems (RawInline _ _) = return []
370inlineToParElems _ = return []
370inlineToParElems _ = return []
371
371
372+isListType :: Block -> Bool
373+isListType (OrderedList _ _) = True
374+isListType (BulletList _) = True
375+isListType (DefinitionList _) = True
376+isListType _ = False
377+
372blockToParagraphs :: PandocMonad m => Block -> P m [Paragraph]
378blockToParagraphs :: PandocMonad m => Block -> P m [Paragraph]
373blockToParagraphs (Plain ils) = do
379blockToParagraphs (Plain ils) = do
374 parElems <- inlinesToParElems ils
380 parElems <- inlinesToParElems ils
@@ -386,7 +392,13 @@ blockToParagraphs (LineBlock ilsList) = do
386blockToParagraphs (CodeBlock attr str) =
392blockToParagraphs (CodeBlock attr str) =
387 local (\r -> r{envParaProps = def{pPropMarginLeft = Just 100}}) $
393 local (\r -> r{envParaProps = def{pPropMarginLeft = Just 100}}) $
388 blockToParagraphs $ Para [Code attr str]
394 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'
390blockToParagraphs (BlockQuote blks) =
402blockToParagraphs (BlockQuote blks) =
391 local (\r -> r{ envParaProps = (envParaProps r){pPropMarginLeft = Just 100}
403 local (\r -> r{ envParaProps = (envParaProps r){pPropMarginLeft = Just 100}
392 , envRunProps = (envRunProps r){rPropForceSize = Just blockQuoteSize}})$
404 , envRunProps = (envRunProps r){rPropForceSize = Just blockQuoteSize}})$