More refactoring. Way nicer prompts
[xyz.git] / src / Lib.hs
index 9cad63d..b48ddf8 100644 (file)
@@ -2,10 +2,9 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE DuplicateRecordFields #-}
 
-module Lib
-    ( someFunc, EntryList, allFilesIn, ProjectConfig, context
-    ) where
+module Lib where
 
+import Util
 import Data.Function (on)
 import Data.List (sort, sortBy, groupBy)
 import Data.Ord (comparing)
@@ -100,9 +99,6 @@ entryListToIndex el = unorderedList Nothing $ map (\(year, monthList) -> unorder
 i2t :: Integer -> Text
 i2t = (fromString . show)
 
-slugify = toLower. replace " " "-"
-urlify = slugify . replace "?" ""
-
 timeStampToDateString = fromString . formatTime defaultTimeLocale "%d %B %Y" . utcToLocalTime (hoursToTimeZone 8)
 
 entryToMarkup entry template = toStrict $ render template tmplContext
@@ -130,9 +126,7 @@ rawTextToEntry rawEntry = BlogEntry (posixSecondsToUTCTime (fromInteger (read (u
     meta = splitOn "::" (fileLines !! 0)
     fileLines = lines rawEntry
 
-allFilesIn dir = filter (/= "..")<$>(filter(/= "."))<$>(getDirectoryContents dir)
-
-someFunc projectConfig files = do
+writeOutProject projectConfig files = do
   files <- fmap (reverse . sort) $ allFilesIn "entries"
   rawEntries <- mapM (\x -> (readFile ("entries/" ++ x)) >>= (\y -> (return . fromString) y)) files
   entryList <- mapM (\raw -> return $ rawTextToEntry raw) rawEntries