summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-07 14:48:47 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-07 14:48:47 +0100
commit7bf3450caf5900a5a3f11c0358dbffbf72f5ef1a (patch)
tree1a8e85b0fff647c50d65baa348871e98a09d59a6
parent1bf95c0028b041ae57a28cf1592db75010fe0f08 (diff)
downloadhakyll-7bf3450caf5900a5a3f11c0358dbffbf72f5ef1a.tar.gz
Run metacompilers instead of ignoring them
-rw-r--r--src/Hakyll/Core/Run.hs34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/Hakyll/Core/Run.hs b/src/Hakyll/Core/Run.hs
index 31280db..e850d99 100644
--- a/src/Hakyll/Core/Run.hs
+++ b/src/Hakyll/Core/Run.hs
@@ -141,17 +141,23 @@ runCompilers ((id', compiler) : compilers) = Hakyll $ do
result <- liftIO $ runCompiler compiler id' provider url store isModified
liftIO $ putStrLn $ "Generated target: " ++ show id'
- let CompileRule compiled = result
-
- case url of
- Nothing -> return ()
- Just r -> liftIO $ do
- putStrLn $ "Routing " ++ show id' ++ " to " ++ r
- let path = "_site" </> r
- makeDirectories path
- write path compiled
-
- liftIO $ putStrLn ""
-
- -- Continue for the remaining compilers
- unHakyll $ runCompilers compilers
+ case result of
+ -- Compile rule for one item, easy stuff
+ CompileRule compiled -> do
+ case url of
+ Nothing -> return ()
+ Just r -> liftIO $ do
+ putStrLn $ "Routing " ++ show id' ++ " to " ++ r
+ let path = "_site" </> r
+ makeDirectories path
+ write path compiled
+
+ liftIO $ putStrLn ""
+
+ -- Continue for the remaining compilers
+ unHakyll $ runCompilers compilers
+
+ -- Metacompiler, slightly more complicated
+ MetaCompileRule newCompilers -> do
+ -- Actually I was just kidding, it's not hard at all
+ unHakyll $ addNewCompilers compilers newCompilers