on master help sign in
Run metacompilers instead of ignoring them
7bf3450Jasper Van der Jeugt
src/Hakyll/Core/Run.hs+20−14
@@ -141,17 +141,23 @@ runCompilers ((id', compiler) : compilers) = Hakyll $ do
141 result <- liftIO $ runCompiler compiler id' provider url store isModified
141 result <- liftIO $ runCompiler compiler id' provider url store isModified
142 liftIO $ putStrLn $ "Generated target: " ++ show id'
142 liftIO $ putStrLn $ "Generated target: " ++ show id'
143
143
144− let CompileRule compiled = result
144+ case result of
145−
145+ -- Compile rule for one item, easy stuff
146+ CompileRule compiled -> do
146− case url of
147+ case url of
147− Nothing -> return ()
148+ Nothing -> return ()
148− Just r -> liftIO $ do
149+ Just r -> liftIO $ do
149− putStrLn $ "Routing " ++ show id' ++ " to " ++ r
150+ putStrLn $ "Routing " ++ show id' ++ " to " ++ r
150− let path = "_site" </> r
151+ let path = "_site" </> r
151− makeDirectories path
152+ makeDirectories path
152− write path compiled
153+ write path compiled
153−
154+
154− liftIO $ putStrLn ""
155+ liftIO $ putStrLn ""
155−
156+
156− -- Continue for the remaining compilers
157+ -- Continue for the remaining compilers
157− unHakyll $ runCompilers compilers
158+ unHakyll $ runCompilers compilers
159+
160+ -- Metacompiler, slightly more complicated
161+ MetaCompileRule newCompilers -> do
162+ -- Actually I was just kidding, it's not hard at all
163+ unHakyll $ addNewCompilers compilers newCompilers