diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-27 23:48:40 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-27 23:48:40 +0100 |
commit | b9e843e3672d540d5115176e1795ada18f92a320 (patch) | |
tree | bc1c344a648bc829545c34d9e981b3c9ece2306c /src/Text/Hakyll/Page.hs | |
parent | f9a4b4f6f4b4e5f9b8c0121a4a45529059dae48a (diff) | |
download | hakyll-b9e843e3672d540d5115176e1795ada18f92a320.tar.gz |
Started a cleanup of Text.Hakyll.Tags.
Diffstat (limited to 'src/Text/Hakyll/Page.hs')
-rw-r--r-- | src/Text/Hakyll/Page.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs index a0d9ed0..fb23d6f 100644 --- a/src/Text/Hakyll/Page.hs +++ b/src/Text/Hakyll/Page.hs @@ -13,14 +13,14 @@ import Data.Char (isSpace) import Data.Maybe (fromMaybe) import Control.Monad (liftM, replicateM) import Control.Monad.Reader (liftIO) -import System.FilePath (takeExtension, (</>)) +import System.FilePath import Test.QuickCheck import Text.Pandoc import Data.Binary import Text.Hakyll.Internal.Cache -import Text.Hakyll.Hakyll (Hakyll) +import Text.Hakyll.Hakyll import Text.Hakyll.File import Text.Hakyll.Util (trim) import Text.Hakyll.Context (Context) @@ -124,9 +124,11 @@ readPageFromFile path = do -- Read file. contents <- liftIO $ readFile path + enableCategories' <- askHakyll enableCategories let sections = splitAtDelimiters $ lines contents context = concat $ zipWith ($) sectionFunctions sections page = fromContext $ M.fromList $ + [ ("category", getCategory path) | enableCategories' ] ++ [ ("url", url) , ("path", path) ] ++ context @@ -134,6 +136,7 @@ readPageFromFile path = do return page where url = toURL path + getCategory = last . splitDirectories . takeDirectory -- | Read a page. Might fetch it from the cache if available. Otherwise, it will -- read it from the file given and store it in the cache. |