@@ -12,8 +12,7 @@ import Data.Maybe (fromMaybe)
12import Control.Parallel.Strategies (rdeepseq, ($|))
12import Control.Parallel.Strategies (rdeepseq, ($|))
13import Control.Monad.Reader (liftIO)
13import Control.Monad.Reader (liftIO)
14import System.FilePath (takeExtension)
14import System.FilePath (takeExtension)
15−import System.IO (IOMode(..), openFile, hClose)
15+import System.IO
16−import qualified System.IO.UTF8 as U
18import Text.Pandoc
17import Text.Pandoc
@@ -93,18 +92,18 @@ cachePage page@(Page mapping) = do
94 writePageToCache = do
93 writePageToCache = do
95 handle <- openFile destination WriteMode
94 handle <- openFile destination WriteMode
96− U.hPutStrLn handle "---"
95+ hPutStrLn handle "---"
97 mapM_ (writePair handle) $ M.toList simpleMetaData
96 mapM_ (writePair handle) $ M.toList simpleMetaData
98 mapM_ (writeSection handle) $ M.toList sectionMetaData
97 mapM_ (writeSection handle) $ M.toList sectionMetaData
99− U.hPutStrLn handle "---"
98+ hPutStrLn handle "---"
100− U.hPutStrLn handle $ getBody page
99+ hPutStrLn handle $ getBody page
101 hClose handle
100 hClose handle
103− writePair h (k, v) = do U.hPutStr h $ k ++ ": " ++ v
102+ writePair h (k, v) = do hPutStr h $ k ++ ": " ++ v
104− U.hPutStrLn h ""
103+ hPutStrLn h ""
106− writeSection h (k, v) = do U.hPutStrLn h $ "--- " ++ k
105+ writeSection h (k, v) = do hPutStrLn h $ "--- " ++ k
107− U.hPutStrLn h v
106+ hPutStrLn h v
109 destination = toCache $ getURL page
108 destination = toCache $ getURL page
@@ -147,7 +146,7 @@ readPage pagePath = do
147 -- Read file.
146 -- Read file.
148 handle <- liftIO $ openFile path ReadMode
147 handle <- liftIO $ openFile path ReadMode
149 sections <- fmap (splitAtDelimiters . lines )
148 sections <- fmap (splitAtDelimiters . lines )
150− (liftIO $ U.hGetContents handle)
149+ (liftIO $ hGetContents handle)
152 let context = concat $ zipWith ($) sectionFunctions sections
151 let context = concat $ zipWith ($) sectionFunctions sections
153 page = fromContext $ M.fromList $
152 page = fromContext $ M.fromList $