hakyll 3.5.1.0 → 3.5.2.0
raw patch · 6 files changed
+30/−22 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hakyll.cabal +1/−1
- src/Hakyll/Core/Rules.hs +3/−3
- src/Hakyll/Web/Urls.hs +2/−1
- tests/Hakyll/Core/Rules/Tests.hs +21/−14
- tests/Hakyll/Web/Urls/Relativize/Tests.hs +1/−1
- tests/Hakyll/Web/Urls/Tests.hs +2/−2
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 3.5.1.0+Version: 3.5.2.0 Synopsis: A static website compiler library Description:
src/Hakyll/Core/Rules.hs view
@@ -172,9 +172,9 @@ pattern <- rulesPattern <$> ask provider <- rulesResourceProvider <$> ask group' <- rulesGroup <$> ask- return $ filterMatches pattern $ map (toId group') $ resourceList provider- where- toId g = setGroup g . toIdentifier+ -- Important: filter with pattern *before* setting the group+ return $ map (setGroup group') $ 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/Web/Urls.hs view
@@ -29,7 +29,8 @@ -- renderTags' :: [TS.Tag String] -> String renderTags' = TS.renderTagsOptions TS.renderOptions- { TS.optRawTag = (`elem` ["script", "style"]) . map toLower+ { TS.optRawTag = (`elem` ["script", "style"]) . map toLower+ , TS.optMinimize = (`elem` ["br", "img"]) } -- | Convert a filepath to an URL starting from the site root
tests/Hakyll/Core/Rules/Tests.hs view
@@ -8,46 +8,47 @@ import qualified Data.Set as S import Test.Framework-import Test.Framework.Providers.HUnit import Test.HUnit hiding (Test) import Hakyll.Core.Rules import Hakyll.Core.Rules.Internal import Hakyll.Core.Identifier+import Hakyll.Core.Identifier.Pattern import Hakyll.Core.Routes import Hakyll.Core.Compiler import Hakyll.Core.Resource.Provider import Hakyll.Core.Resource.Provider.Dummy+import Hakyll.Core.Writable.CopyFile import Hakyll.Web.Page+import TestSuite.Util tests :: [Test]-tests =- [ testCase "runRules" rulesTest+tests = fromAssertions "runRules" [case01]++-- | Dummy resource provider+--+provider :: IO ResourceProvider+provider = dummyResourceProvider $ M.fromList $ map (flip (,) "No content")+ [ "posts/a-post.markdown"+ , "posts/some-other-post.markdown" ] -- | Main test ---rulesTest :: Assertion-rulesTest = do+case01 :: Assertion+case01 = do p <- provider let ruleSet = runRules rules p- assert $ expected == S.fromList (map fst (rulesCompilers ruleSet))+ expected @=? S.fromList (map fst (rulesCompilers ruleSet)) where expected = S.fromList [ Identifier Nothing "posts/a-post.markdown" , Identifier Nothing "posts/some-other-post.markdown" , Identifier (Just "raw") "posts/a-post.markdown" , Identifier (Just "raw") "posts/some-other-post.markdown"+ , Identifier (Just "nav") "posts/a-post.markdown" ] --- | Dummy resource provider----provider :: IO ResourceProvider-provider = dummyResourceProvider $ M.fromList $ map (flip (,) "No content")- [ "posts/a-post.markdown"- , "posts/some-other-post.markdown"- ]- -- | Example rules -- rules :: Rules@@ -63,5 +64,11 @@ match "posts/*" $ do route $ setExtension "html" compile getResourceString++ -- Regression test+ group "nav" $ do+ match (list ["posts/a-post.markdown"]) $ do+ route idRoute+ compile copyFileCompiler return ()
tests/Hakyll/Web/Urls/Relativize/Tests.hs view
@@ -13,7 +13,7 @@ tests = fromAssertions "relativizeUrls" [ "<a href=\"../foo\">bar</a>" @=? relativizeUrls ".." "<a href=\"/foo\">bar</a>"- , "<img src=\"../../images/lolcat.png\"></img>" @=?+ , "<img src=\"../../images/lolcat.png\" />" @=? relativizeUrls "../.." "<img src=\"/images/lolcat.png\" />" , "<a href=\"http://haskell.org\">Haskell</a>" @=? relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
tests/Hakyll/Web/Urls/Tests.hs view
@@ -15,8 +15,8 @@ [ fromAssertions "withUrls" [ "<a href=\"FOO\">bar</a>" @=? withUrls (map toUpper) "<a href=\"foo\">bar</a>"- , "<img src=\"OH BAR\">" @=?- withUrls (map toUpper) "<img src=\"oh bar\">"+ , "<img src=\"OH BAR\" />" @=?+ withUrls (map toUpper) "<img src=\"oh bar\" />" -- Test escaping , "<script>\"sup\"</script>" @=?