aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-02 20:20:16 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-02 20:20:16 -0700
commit326d7fa8f89f9a4b74042bf4cbb04931e26c8d8d (patch)
tree7eb190246a225ebeafce97ca9a163176bf426e92 /src/Text/Pandoc
parentbf915da6cd0dc97a231100b784450e334c715969 (diff)
downloadpandoc-326d7fa8f89f9a4b74042bf4cbb04931e26c8d8d.tar.gz
Docx writer: Improved entryFromArchive to avoid parse.
No need to parse the XML if we're just going to render it right away!
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 8aaf3c1b8..1e37b5515 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -310,8 +310,9 @@ writeDocx opts doc@(Pandoc meta _) = do
let relsEntry = toEntry relsPath epochtime $ renderXml rels
let entryFromArchive arch path =
- (toEntry path epochtime . renderXml) `fmap`
- parseXml arch distArchive path
+ maybe (fail $ path ++ " corrupt or missing in reference docx")
+ return
+ (findEntryByPath path arch `mplus` findEntryByPath path distArchive)
docPropsAppEntry <- entryFromArchive refArchive "docProps/app.xml"
themeEntry <- entryFromArchive refArchive "word/theme/theme1.xml"
fontTableEntry <- entryFromArchive refArchive "word/fontTable.xml"