packages feed

hakyll 3.3.0.0 → 3.3.0.1

raw patch · 5 files changed

+25/−2 lines, 5 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Hakyll.Core.Routes: constRoute :: FilePath -> Routes

Files

hakyll.cabal view
@@ -1,5 +1,5 @@ Name:    hakyll-Version: 3.3.0.0+Version: 3.3.0.1  Synopsis: A static website compiler library Description:
src/Hakyll/Core/Routes.hs view
@@ -33,6 +33,7 @@     , setExtension     , matchRoute     , customRoute+    , constRoute     , gsubRoute     , composeRoutes     ) where@@ -98,6 +99,11 @@ -- customRoute :: (Identifier a -> FilePath) -> Routes customRoute f = Routes $ Just . f . castIdentifier++-- | A route that always gives the same result. Obviously, you should only use+-- this for a single compilation rule.+constRoute :: FilePath -> Routes+constRoute = customRoute . const  -- | Create a gsub route --
src/Hakyll/Web/Urls.hs view
@@ -8,6 +8,7 @@     ) where  import Data.List (isPrefixOf)+import Data.Char (toLower) import System.FilePath (splitPath, takeDirectory, joinPath) import qualified Data.Set as S @@ -16,12 +17,20 @@ -- | Apply a function to each URL on a webpage -- withUrls :: (String -> String) -> String -> String-withUrls f = TS.renderTags . map tag . TS.parseTags+withUrls f = renderTags' . map tag . TS.parseTags   where     tag (TS.TagOpen s a) = TS.TagOpen s $ map attr a     tag x                = x     attr (k, v)          = (k, if k `S.member` refs then f v else v)     refs                 = S.fromList ["src", "href"]++-- | Customized TagSoup renderer. (The default TagSoup renderer escape CSS+-- within style tags.)+--+renderTags' :: [TS.Tag String] -> String+renderTags' = TS.renderTagsOptions TS.renderOptions+    { TS.optRawTag = (`elem` ["script", "style"]) . map toLower+    }  -- | Convert a filepath to an URL starting from the site root --
tests/Hakyll/Core/Routes/Tests.hs view
@@ -6,6 +6,7 @@ import Test.Framework import Test.HUnit hiding (Test) +import Hakyll.Core.Identifier import Hakyll.Core.Routes import TestSuite.Util @@ -15,6 +16,11 @@     , Just "foo.html" @=? runRoutes (setExtension ".html") "foo"     , Just "foo.html" @=? runRoutes (setExtension "html") "foo.markdown"     , Just "foo.html" @=? runRoutes (setExtension ".html") "foo.markdown"++    , Just "neve ro ddo reven" @=?+        runRoutes (customRoute (reverse . toFilePath  )) "never odd or even"++    , Just "foo" @=? runRoutes (constRoute "foo") "bar"      , Just "tags/bar.xml" @=?         runRoutes (gsubRoute "rss/" (const "")) "tags/rss/bar.xml"
tests/Hakyll/Web/Urls/Tests.hs view
@@ -23,6 +23,8 @@             withUrls id "<script>\"sup\"</script>"         , "<code>&lt;stdio&gt;</code>" @=?             withUrls id "<code>&lt;stdio&gt;</code>"+        , "<style>body > p { line-height: 1.3 }</style>" @=?+            withUrls id "<style>body > p { line-height: 1.3 }</style>"         ]     , fromAssertions "toUrl"         [ "/foo/bar.html"    @=? toUrl "foo/bar.html"