12345678910111213141516171819202122232425 |
- module Write where
-
- import qualified Data.Text as T
- import System.Directory ( createDirectoryIfMissing
- , makeAbsolute
- )
- import System.FilePath ( joinPath )
-
- import Post ( RawPost )
- import Utils ( basename )
-
- writePost :: FilePath -> RawPost -> IO ()
- writePost buildPath (path, contents) = do
- outputDir <- makeAbsolute $ joinPath [buildPath, "posts", basename path]
- let outputFile = joinPath [outputDir, "index.html"]
- createDirectoryIfMissing False outputDir
- writeFile outputFile $ T.unpack contents
-
- writeIndexPage :: FilePath -> T.Text -> IO ()
- writeIndexPage buildPath page =
- writeFile (joinPath [buildPath, "index.html"]) (T.unpack page)
-
- writeRSSFeed :: FilePath -> T.Text -> IO ()
- writeRSSFeed buildPath feed =
- writeFile (joinPath [buildPath, "rss.xml"]) (T.unpack feed)
|