hakyll 3.1.1.0 → 3.1.1.1
raw patch · 6 files changed
+42/−15 lines, 6 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Hakyll.Core.DependencyAnalyzer: instance Show a => Show (Signal a)
+ Hakyll.Core.Rules: resources :: RulesM [Identifier]
+ Hakyll.Web.Page: pageCompilerWith :: ParserState -> WriterOptions -> Compiler Resource (Page String)
Files
- hakyll.cabal +1/−1
- src/Hakyll/Core/DependencyAnalyzer.hs +1/−0
- src/Hakyll/Core/Rules.hs +16/−10
- src/Hakyll/Core/Run.hs +11/−2
- src/Hakyll/Main.hs +2/−2
- src/Hakyll/Web/Page.hs +11/−0
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 3.1.1.0+Version: 3.1.1.1 Synopsis: A simple static site generator library. Description: A simple static site generator library, mainly aimed at
src/Hakyll/Core/DependencyAnalyzer.hs view
@@ -48,6 +48,7 @@ data Signal a = Build a | Cycle [a] | Done+ deriving (Show) instance (Ord a, Show a) => Monoid (DependencyAnalyzer a) where mempty = DependencyAnalyzer mempty mempty mempty mempty
src/Hakyll/Core/Rules.hs view
@@ -23,6 +23,7 @@ , compile , create , route+ , resources , metaCompile , metaCompileWith ) where@@ -72,8 +73,8 @@ -- tellResources :: [Resource] -> Rules-tellResources resources = RulesM $ tell $- RuleSet mempty mempty $ S.fromList resources+tellResources resources' = RulesM $ tell $+ RuleSet mempty mempty $ S.fromList resources' -- | Only compile/route items satisfying the given predicate --@@ -128,14 +129,11 @@ -- compile :: (Binary a, Typeable a, Writable a) => Compiler Resource a -> Rules-compile compiler = RulesM $ do- pattern <- rulesPattern <$> ask- provider <- rulesResourceProvider <$> ask- let ids = filterMatches pattern $ map toIdentifier $ resourceList provider- unRulesM $ do- tellCompilers $ flip map ids $ \identifier ->- (identifier, constA (fromIdentifier identifier) >>> compiler)- tellResources $ map fromIdentifier ids+compile compiler = do+ ids <- resources+ tellCompilers $ flip map ids $ \identifier ->+ (identifier, constA (fromIdentifier identifier) >>> compiler)+ tellResources $ map fromIdentifier ids -- | Add a compilation rule --@@ -159,6 +157,14 @@ pattern <- rulesPattern <$> ask group' <- rulesGroup <$> ask unRulesM $ tellRoute $ matchRoute (pattern `mappend` inGroup group') route'++-- | Get a list of resources matching the current pattern+--+resources :: RulesM [Identifier]+resources = RulesM $ do+ pattern <- rulesPattern <$> ask+ provider <- rulesResourceProvider <$> ask+ return $ filterMatches pattern $ map toIdentifier $ resourceList provider -- | Apart from regular compilers, one is also able to specify metacompilers. -- Metacompilers are a special class of compilers: they are compilers which
src/Hakyll/Core/Run.hs view
@@ -6,7 +6,7 @@ ) where import Prelude hiding (reverse)-import Control.Monad (filterM)+import Control.Monad (filterM, forM_) import Control.Monad.Trans (liftIO) import Control.Applicative (Applicative, (<$>)) import Control.Monad.Reader (ReaderT, runReaderT, ask)@@ -147,8 +147,17 @@ put $ state { hakyllAnalyzer = analyzer' } case signal of Done -> return ()- Cycle _ -> return ()+ Cycle c -> unRuntime $ dumpCycle c Build id' -> unRuntime $ build id'++-- | Dump cyclic error and quit+--+dumpCycle :: [Identifier] -> Runtime ()+dumpCycle cycle' = Runtime $ do+ logger <- hakyllLogger <$> ask+ section logger "Dependency cycle detected! Conflict:"+ forM_ (zip cycle' $ drop 1 cycle') $ \(x, y) ->+ report logger $ show x ++ " -> " ++ show y build :: Identifier -> Runtime () build id' = Runtime $ do
src/Hakyll/Main.hs view
@@ -87,11 +87,11 @@ ruleSet <- run configuration rules -- Get the resource list and a callback for the preview poll- let resources = rulesResources ruleSet+ let resources' = rulesResources ruleSet callback = build configuration rules -- Fork a thread polling for changes- _ <- forkIO $ previewPoll configuration resources callback+ _ <- forkIO $ previewPoll configuration resources' callback -- Run the server in the main thread server configuration port
src/Hakyll/Web/Page.hs view
@@ -53,6 +53,7 @@ , toMap , readPageCompiler , pageCompiler+ , pageCompilerWith , addDefaultFields , sortByBaseName ) where@@ -65,6 +66,8 @@ import Data.List (sortBy) import Data.Ord (comparing) +import Text.Pandoc (ParserState, WriterOptions)+ import Hakyll.Core.Identifier import Hakyll.Core.Compiler import Hakyll.Core.Resource@@ -90,6 +93,14 @@ pageCompiler :: Compiler Resource (Page String) pageCompiler = cached "Hakyll.Web.Page.pageCompiler" $ readPageCompiler >>> addDefaultFields >>> arr applySelf >>> pageRenderPandoc++-- | A version of 'pageCompiler' which allows you to specify your own pandoc+-- options+--+pageCompilerWith :: ParserState -> WriterOptions -> Compiler Resource (Page String)+pageCompilerWith state options = cached "pageCompilerWith" $+ readPageCompiler >>> addDefaultFields >>> arr applySelf+ >>> pageRenderPandocWith state options -- | Add a number of default metadata fields to a page. These fields include: --