hakyll 4.5.1.0 → 4.5.2.0
raw patch · 12 files changed
+36/−25 lines, 12 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Hakyll.Core.Item: instance Typeable1 Item
+ Hakyll.Core.Item: instance Typeable Item
- Hakyll.Core.Dependencies: PatternDependency :: Pattern -> [Identifier] -> Dependency
+ Hakyll.Core.Dependencies: PatternDependency :: Pattern -> (Set Identifier) -> Dependency
- Hakyll.Core.Rules: PatternDependency :: Pattern -> [Identifier] -> Dependency
+ Hakyll.Core.Rules: PatternDependency :: Pattern -> (Set Identifier) -> Dependency
Files
- data/example/index.html +1/−1
- hakyll.cabal +1/−1
- src/Hakyll/Core/Compiler/Internal.hs +2/−1
- src/Hakyll/Core/Dependencies.hs +3/−3
- src/Hakyll/Core/Metadata.hs +2/−1
- src/Hakyll/Core/Provider/Internal.hs +3/−4
- src/Hakyll/Core/UnixFilter.hs +11/−8
- src/Hakyll/Web/Html.hs +1/−0
- src/Hakyll/Web/Paginate.hs +3/−2
- src/Hakyll/Web/Tags.hs +5/−3
- tests/Hakyll/Core/Dependencies/Tests.hs +2/−1
- tests/Hakyll/Web/Html/Tests.hs +2/−0
data/example/index.html view
@@ -13,4 +13,4 @@ <h2>Posts</h2> $partial("templates/post-list.html")$ -<p>…or you can find more in the <a href="/archive.html">archives</a>.+<p>…or you can find more in the <a href="/archive.html">archives</a>.</p>
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 4.5.1.0+Version: 4.5.2.0 Synopsis: A static website compiler library Description:
src/Hakyll/Core/Compiler/Internal.hs view
@@ -248,5 +248,6 @@ compilerGetMatches pattern = do universe <- compilerUniverse <$> compilerAsk let matching = filterMatches pattern $ S.toList universe- compilerTellDependencies [PatternDependency pattern matching]+ set' = S.fromList matching+ compilerTellDependencies [PatternDependency pattern set'] return matching
src/Hakyll/Core/Dependencies.hs view
@@ -32,7 +32,7 @@ -------------------------------------------------------------------------------- data Dependency- = PatternDependency Pattern [Identifier]+ = PatternDependency Pattern (Set Identifier) | IdentifierDependency Identifier deriving (Show, Typeable) @@ -91,7 +91,7 @@ return $ concatMap dependenciesFor' $ fromMaybe [] $ M.lookup id' facts where dependenciesFor' (IdentifierDependency i) = [i]- dependenciesFor' (PatternDependency _ is) = is+ dependenciesFor' (PatternDependency _ is) = S.toList is --------------------------------------------------------------------------------@@ -116,7 +116,7 @@ go _ ds (IdentifierDependency i) = return $ IdentifierDependency i : ds go id' ds (PatternDependency p ls) = do universe <- ask- let ls' = filterMatches p universe+ let ls' = S.fromList $ filterMatches p universe if ls == ls' then return $ PatternDependency p ls : ds else do
src/Hakyll/Core/Metadata.hs view
@@ -12,6 +12,7 @@ import Control.Monad (forM) import Data.Map (Map) import qualified Data.Map as M+import qualified Data.Set as S --------------------------------------------------------------------------------@@ -60,4 +61,4 @@ makePatternDependency :: MonadMetadata m => Pattern -> m Dependency makePatternDependency pattern = do matches' <- getMatches pattern- return $ PatternDependency pattern matches'+ return $ PatternDependency pattern (S.fromList matches')
src/Hakyll/Core/Provider/Internal.hs view
@@ -31,8 +31,7 @@ import Data.Monoid (mempty) import Data.Set (Set) import qualified Data.Set as S-import Data.Time (Day (..), UTCTime (..),- secondsToDiffTime)+import Data.Time (Day (..), UTCTime (..)) import Data.Typeable (Typeable) import System.Directory (getModificationTime) import System.FilePath (addExtension, (</>))@@ -62,11 +61,11 @@ -------------------------------------------------------------------------------- instance Binary BinaryTime where put (BinaryTime (UTCTime (ModifiedJulianDay d) dt)) =- put d >> put (floor dt :: Integer)+ put d >> put (toRational dt) get = fmap BinaryTime $ UTCTime <$> (ModifiedJulianDay <$> get)- <*> (secondsToDiffTime <$> get)+ <*> (fromRational <$> get) --------------------------------------------------------------------------------
src/Hakyll/Core/UnixFilter.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -------------------------------------------------------------------------------- -- | A Compiler that supports unix filters. module Hakyll.Core.UnixFilter@@ -19,7 +21,6 @@ import System.IO (Handle, hClose, hFlush, hGetContents, hPutStr, hSetEncoding, localeEncoding) import System.Process-import qualified System.Info as System -------------------------------------------------------------------------------- import Hakyll.Core.Compiler@@ -105,17 +106,19 @@ -> i -> IO (o, String, ExitCode) unixFilterIO writer reader programName args input = do- -- The problem on Windows is that `proc` is that it is unable to execute+ -- The problem on Windows is that `proc` is unable to execute -- batch stubs (eg. anything created using 'gem install ...') even if its in -- `$PATH`. A solution to this issue is to execute the batch file explicitly -- using `cmd /c batchfile` but there is no rational way to know where said -- batchfile is on the system. Hence, we detect windows using the- -- `System.Info` module and then instead of using `proc` to create the- -- process, use `shell` instead which will be able to execute everything- -- `proc` can, and this can deal with batch files as well.- let pr = if System.os == "mingw32"- then shell $ unwords (programName : args)- else proc programName args+ -- CPP and instead of using `proc` to create the process, use `shell`+ -- which will be able to execute everything `proc` can+ -- as well as batch files.+#ifdef mingw32_HOST_OS+ let pr = shell $ unwords (programName : args)+#else+ let pr = proc programName args+#endif (Just inh, Just outh, Just errh, pid) <- createProcess pr
src/Hakyll/Web/Html.hs view
@@ -124,6 +124,7 @@ emptyException x = x relevant "." = False relevant "/" = False+ relevant "./" = False relevant _ = True
src/Hakyll/Web/Paginate.hs view
@@ -15,6 +15,7 @@ import Data.List (unfoldr) import qualified Data.Map as M import Data.Monoid (mconcat)+import qualified Data.Set as S import Text.Printf (printf) @@ -58,7 +59,7 @@ "invalid page number: " ++ show pn return $ Paginate pagPages pagPlaces makeId- (PatternDependency pattern idents)+ (PatternDependency pattern (S.fromList idents)) --------------------------------------------------------------------------------@@ -81,7 +82,7 @@ [(makeId i, i) | i <- [1 .. nPages]] return $ Paginate (M.fromList paginatePages') (M.fromList pagPlaces') makeId- (PatternDependency pattern idents)+ (PatternDependency pattern (S.fromList idents)) --------------------------------------------------------------------------------
src/Hakyll/Web/Tags.hs view
@@ -71,6 +71,7 @@ import Data.Maybe (catMaybes, fromMaybe) import Data.Monoid (mconcat) import Data.Ord (comparing)+import qualified Data.Set as S import System.FilePath (takeBaseName, takeDirectory) import Text.Blaze.Html (toHtml, toValue, (!)) import Text.Blaze.Html.Renderer.String (renderHtml)@@ -124,7 +125,8 @@ buildTagsWith f pattern makeId = do ids <- getMatches pattern tagMap <- foldM addTags M.empty ids- return $ Tags (M.toList tagMap) makeId (PatternDependency pattern ids)+ let set' = S.fromList ids+ return $ Tags (M.toList tagMap) makeId (PatternDependency pattern set') where -- Create a tag map for one page addTags tagMap id' = do@@ -148,8 +150,8 @@ tagsRules :: Tags -> (String -> Pattern -> Rules ()) -> Rules () tagsRules tags rules = forM_ (tagsMap tags) $ \(tag, identifiers) ->- create [tagsMakeId tags tag] $- rulesExtraDependencies [tagsDependency tags] $+ rulesExtraDependencies [tagsDependency tags] $+ create [tagsMakeId tags tag] $ rules tag $ fromList identifiers
tests/Hakyll/Core/Dependencies/Tests.hs view
@@ -38,7 +38,8 @@ , ("posts/02.md", []) , ("index.md",- [ PatternDependency "posts/*" ["posts/01.md", "posts/02.md"]+ [ PatternDependency "posts/*"+ (S.fromList ["posts/01.md", "posts/02.md"]) , IdentifierDependency "posts/01.md" , IdentifierDependency "posts/02.md" ])
tests/Hakyll/Web/Html/Tests.hs view
@@ -59,6 +59,8 @@ , "." @=? toSiteRoot "index.html" , "." @=? toSiteRoot "/index.html" , "../.." @=? toSiteRoot "foo/bar/qux"+ , ".." @=? toSiteRoot "./foo/bar.html"+ , ".." @=? toSiteRoot "/foo/./bar.html" ] , fromAssertions "isExternal"