aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/OpenDocument.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-10 23:39:49 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-11 00:46:31 +0200
commitfa719d026464619dd51714620470998ab5d18e17 (patch)
tree9eb4eeaff01a2c6f3ccb283ff57d07ef5f622beb /src/Text/Pandoc/Writers/OpenDocument.hs
parent0c2a509dfb3bd9f7ba8a0fdec02a165ed7cf49da (diff)
downloadpandoc-fa719d026464619dd51714620470998ab5d18e17.tar.gz
Switched Writer types to use Text.
* XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
Diffstat (limited to 'src/Text/Pandoc/Writers/OpenDocument.hs')
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index 53c1d0c59..58295684e 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -36,6 +36,7 @@ import Control.Arrow ((***), (>>>))
import Control.Monad.State hiding (when)
import Data.Char (chr)
import Data.List (sortBy)
+import Data.Text (Text)
import qualified Data.Map as Map
import Data.Ord (comparing)
import qualified Data.Set as Set
@@ -195,17 +196,18 @@ handleSpaces s
rm [] = empty
-- | Convert Pandoc document to string in OpenDocument format.
-writeOpenDocument :: PandocMonad m => WriterOptions -> Pandoc -> m String
+writeOpenDocument :: PandocMonad m => WriterOptions -> Pandoc -> m Text
writeOpenDocument opts (Pandoc meta blocks) = do
let colwidth = if writerWrapText opts == WrapAuto
then Just $ writerColumns opts
else Nothing
- let render' = render colwidth
+ let render' :: Doc -> Text
+ render' = render colwidth
((body, metadata),s) <- flip runStateT
defaultWriterState $ do
m <- metaToJSON opts
- (fmap (render colwidth) . blocksToOpenDocument opts)
- (fmap (render colwidth) . inlinesToOpenDocument opts)
+ (fmap render' . blocksToOpenDocument opts)
+ (fmap render' . inlinesToOpenDocument opts)
meta
b <- render' `fmap` blocksToOpenDocument opts blocks
return (b, m)