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.
commite4a8e4a636fb4b9bc860591f31bdb8e4dde62049
authorJesse Rosenthal <jrosenthal@jhu.edu>
dateTue 12 Aug 2014, 09:00 (12 years ago)
parent4c88e64
src/Text/Pandoc/Readers/Docx.hs+3−1
@@ -462,7 +462,9 @@ bodyPartToBlocks (Paragraph pPr parparts)
462462bodyPartToBlocks (Paragraph pPr parparts) = do
463463 ils <- parPartsToInlines parparts >>= (return . normalizeSpaces)
464464 dropIls <- gets docxDropCap
465− let ils' = reduceList $ dropIls ++ ils
465+ let ils' = case ils of
466+ (x:xs) -> reduceList (dropIls ++ [x]) ++ xs
467+ [] -> dropIls
466468 if dropCap pPr
467469 then do modify $ \s -> s { docxDropCap = ils' }
468470 return []