@@ -1,3 +1,4 @@
1+{-# LANGUAGE TemplateHaskell, OverloadedStrings #-}
12{-
23Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
34
@@ -28,6 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2829Functions for producing an ODT file from OpenDocument XML.
2930-}
3031module Text.Pandoc.ODT ( saveOpenDocumentAsODT ) where
32+import Text.Pandoc.Shared ( contentsOf )
3133import Data.Maybe ( fromJust )
3234import Data.List ( partition, intersperse )
3335import Prelude hiding ( writeFile, readFile )
@@ -41,7 +43,7 @@ import Text.XML.Light
4143import Text.XML.Light.Cursor
4244import Text.Pandoc.Shared ( withTempDir )
4345import Network.URI ( isURI )
44−import Paths_pandoc
46+import qualified Data.ByteString.Char8 as B ( writeFile )
4547
4648-- | Produce an ODT file from OpenDocument XML.
4749saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
@@ -59,10 +61,10 @@ saveOpenDocumentAsODT destinationODTPath sourceDirRelative xml = do
5961 "It can be obtained from http://www.info-zip.org/Zip.html\n" ++
6062 "Debian (and Debian-based) linux: apt-get install zip\n" ++
6163 "Windows: See http://gnuwin32.sourceforge.net/packages/zip.htm"
62− referenceODTPath <- getDataFileName "reference.odt"
6364 withTempDir "pandoc-odt" $ \tempDir -> do
6465 let tempODT = tempDir </> "reference.odt"
65− copyFile referenceODTPath tempODT
66+ copyFile "odt-styles/reference.odt" tempODT
67+ B.writeFile tempODT $(contentsOf "odt-styles/reference.odt")
6668 createDirectory $ tempDir </> "Pictures"
6769 xml' <- handlePictures tempODT sourceDirRelative xml
6870 writeFile (tempDir </> "content.xml") xml'
@@ -138,3 +140,4 @@ handleContent tempODT sourceDirRelative content@(Elem el) = do
138140 else return content
139141
140142handleContent _ _ c = return c -- not Element
143+