aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2014-06-20 10:27:18 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2014-06-20 10:27:18 -0400
commit2aa5f58c5b82dd5750e1bf5f30e1936d132104ac (patch)
tree81dce0a9467b77900f68682e88e6bfdd268330f3
parent03af19a7e12ff3a7f0a396ebed73c6c17f12ad07 (diff)
downloadpandoc-2aa5f58c5b82dd5750e1bf5f30e1936d132104ac.tar.gz
Docx reader: Add a comment explaining strNormalize
`normalize` from Text.Pandoc.Shared is more general. In tests, though, it more than doubles the run time. `strNormalize` does less, but it does what we need. This comment is added for future maintainability.
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index e62cf6f0e..8a8bc46a6 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -144,6 +144,10 @@ runElemToString (Tab) = ['\t']
runElemsToString :: [RunElem] -> String
runElemsToString = concatMap runElemToString
+--- We use this instead of the more general
+--- Text.Pandoc.Shared.normalize for reasons of efficiency. For
+--- whatever reason, `normalize` makes a run take almost twice as
+--- long. (It does more, but this does what we need)
strNormalize :: [Inline] -> [Inline]
strNormalize [] = []
strNormalize (Str "" : ils) = strNormalize ils