From d3ce014d2643fc62aa5af5b54b298fb083bf25b0 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 4 Dec 2009 15:15:32 +0100 Subject: Proper string trimming. --- src/Text/Hakyll/Page.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Text/Hakyll/Page.hs') diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs index 902d36b..3888b1d 100644 --- a/src/Text/Hakyll/Page.hs +++ b/src/Text/Hakyll/Page.hs @@ -18,6 +18,7 @@ import Data.Maybe import System.FilePath import System.IO +import Text.Hakyll.Util import Text.Pandoc -- | A Page is basically key-value mapping. Certain keys have special @@ -27,7 +28,6 @@ type Page = M.Map String PageValue -- | We use a ByteString for obvious reasons. type PageValue = B.ByteString - -- | Add a key-value mapping to the Page. addContext :: String -> String -> Page -> Page addContext key value = M.insert key (B.pack value) @@ -61,8 +61,8 @@ readMetaData handle = do line <- hGetLine handle if isDelimiter line then return [] else do others <- readMetaData handle - return $ (trim . break (== ':')) line : others - where trim (key, value) = (key, dropWhile (`elem` ": ") value) + return $ (trimPair . break (== ':')) line : others + where trimPair (key, value) = (trim key, trim $ tail value) isDelimiter :: String -> Bool isDelimiter = L.isPrefixOf "---" -- cgit v1.2.3