aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2014-08-12 09:00:53 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2014-08-12 09:00:53 -0400
commite4a8e4a636fb4b9bc860591f31bdb8e4dde62049 (patch)
treefa632ed7d08ed3a178adf17526153a3bdf23d331 /src/Text
parent4c88e64894af56a71a15289a70b2ae7950157f86 (diff)
downloadpandoc-e4a8e4a636fb4b9bc860591f31bdb8e4dde62049.tar.gz
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.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs4
1 files changed, 3 insertions, 1 deletions
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 []