@@ -1,4 +1,3 @@
1−{-# LANGUAGE TemplateHaskell #-}
21{-
32Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
43
@@ -29,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2928Functions for producing an ODT file from OpenDocument XML.
3029-}
3130module Text.Pandoc.ODT ( saveOpenDocumentAsODT ) where
32−import Text.Pandoc.TH ( makeZip )
3331import Data.List ( find )
3432import System.FilePath ( (</>), takeFileName )
3533import qualified Data.ByteString.Lazy as B
@@ -39,6 +37,8 @@ import Codec.Archive.Zip
3937import Control.Applicative ( (<$>) )
4038import Text.ParserCombinators.Parsec
4139import System.Time
40+import Text.Pandoc.Shared ( inDirectory )
41+import Paths_pandoc ( getDataFileName )
4242
4343-- | Produce an ODT file from OpenDocument XML.
4444saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
@@ -46,7 +46,9 @@ saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
4646 -> String -- ^ OpenDocument XML contents.
4747 -> IO ()
4848saveOpenDocumentAsODT destinationODTPath sourceDirRelative xml = do
49− let refArchive = read $(makeZip $ "data" </> "odt-styles")
49+ refArchivePath <- getDataFileName $ "data" </> "odt-styles"
50+ refArchive <- inDirectory refArchivePath $
51+ addFilesToArchive [OptRecursive] emptyArchive ["."]
5052 -- handle pictures
5153 let (newContents, pics) =
5254 case runParser pPictures [] "OpenDocument XML contents" xml of