From 6bbe5d435de76ea32cefa7b42e63bef26d1be9f3 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 13 Jul 2008 16:31:44 +0000 Subject: Fixed bugs in OpenDocument writer affecting nested block quotes. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1304 788f1e2b-df1e-0410-8736-df70ead52e1b --- Text/Pandoc/Writers/OpenDocument.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Text') diff --git a/Text/Pandoc/Writers/OpenDocument.hs b/Text/Pandoc/Writers/OpenDocument.hs index 7348f0a51..e361ba227 100644 --- a/Text/Pandoc/Writers/OpenDocument.hs +++ b/Text/Pandoc/Writers/OpenDocument.hs @@ -1,4 +1,3 @@ -{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE PatternGuards #-} {- Copyright (C) 2008 Andrea Rossato @@ -85,7 +84,7 @@ increaseIndent :: State WriterState () increaseIndent = modify $ \s -> s { stIndentPara = 1 + stIndentPara s } resetIndent :: State WriterState () -resetIndent = modify $ \s -> s { stIndentPara = 0 } +resetIndent = modify $ \s -> s { stIndentPara = (stIndentPara s) - 1 } setInDefinitionList :: Bool -> State WriterState () setInDefinitionList b = modify $ \s -> s { stInDefinition = b } @@ -224,11 +223,11 @@ inBlockQuote :: WriterOptions -> Int -> [Block] -> State WriterState Doc inBlockQuote o i (b:bs) | BlockQuote l <- b = do increaseIndent ni <- paraStyle "Quotations" [] - go ni =<< inBlockQuote o ni l - | Para l <- b = do go i =<< inParagraphTagsWithStyle ("P" ++ show i) <$> inlinesToOpenDocument o l - | otherwise = do go i =<< blockToOpenDocument o b - where go ni block = ($$) block <$> inBlockQuote o ni bs -inBlockQuote _ _ [] = resetIndent >> return empty + go =<< inBlockQuote o ni (map plainToPara l) + | Para l <- b = do go =<< inParagraphTagsWithStyle ("P" ++ show i) <$> inlinesToOpenDocument o l + | otherwise = do go =<< blockToOpenDocument o b + where go block = ($$) block <$> inBlockQuote o i bs +inBlockQuote _ _ [] = resetIndent >> return empty -- | Convert a list of Pandoc blocks to OpenDocument. blocksToOpenDocument :: WriterOptions -> [Block] -> State WriterState Doc -- cgit v1.2.3