@@ -18,6 +18,7 @@ import Data.Maybe
18import System.FilePath
18import System.FilePath
19import System.IO
19import System.IO
21+import Text.Hakyll.Util
21import Text.Pandoc
22import Text.Pandoc
23-- | A Page is basically key-value mapping. Certain keys have special
24-- | A Page is basically key-value mapping. Certain keys have special
@@ -27,7 +28,6 @@ type Page = M.Map String PageValue
27-- | We use a ByteString for obvious reasons.
28-- | We use a ByteString for obvious reasons.
28type PageValue = B.ByteString
29type PageValue = B.ByteString
31-- | Add a key-value mapping to the Page.
31-- | Add a key-value mapping to the Page.
32addContext :: String -> String -> Page -> Page
32addContext :: String -> String -> Page -> Page
33addContext key value = M.insert key (B.pack value)
33addContext key value = M.insert key (B.pack value)
@@ -61,8 +61,8 @@ readMetaData handle = do
61 line <- hGetLine handle
61 line <- hGetLine handle
62 if isDelimiter line then return []
62 if isDelimiter line then return []
63 else do others <- readMetaData handle
63 else do others <- readMetaData handle
64− return $ (trim . break (== ':')) line : others
64+ return $ (trimPair . break (== ':')) line : others
65− where trim (key, value) = (key, dropWhile (`elem` ": ") value)
65+ where trimPair (key, value) = (trim key, trim $ tail value)
67isDelimiter :: String -> Bool
67isDelimiter :: String -> Bool
68isDelimiter = L.isPrefixOf "---"
68isDelimiter = L.isPrefixOf "---"