From e4a8e4a636fb4b9bc860591f31bdb8e4dde62049 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Tue, 12 Aug 2014 09:00:53 -0400 Subject: Docx reader: Make dropcap combining more efficient. Before, we had to run reduceList on the whole combined paragraph, which was redundant, and could take some time for long paragraphs. We only need to combine the drop cap with the first inline of the next paragraph. --- src/Text/Pandoc/Readers/Docx.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index c856ca30a..10dc45581 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -462,7 +462,9 @@ bodyPartToBlocks (Paragraph pPr parparts) bodyPartToBlocks (Paragraph pPr parparts) = do ils <- parPartsToInlines parparts >>= (return . normalizeSpaces) dropIls <- gets docxDropCap - let ils' = reduceList $ dropIls ++ ils + let ils' = case ils of + (x:xs) -> reduceList (dropIls ++ [x]) ++ xs + [] -> dropIls if dropCap pPr then do modify $ \s -> s { docxDropCap = ils' } return [] -- cgit v1.2.3