hakyll 4.9.3.0 → 4.9.4.0
raw patch · 3 files changed
+541/−81 lines, 3 filesdep ~directorydep ~pandoc-citeprocdep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: directory, pandoc-citeproc, time, vector
API changes (from Hackage documentation)
Files
- CHANGELOG.md +428/−0
- hakyll.cabal +9/−8
- src/Hakyll/Check.hs +104/−73
+ CHANGELOG.md view
@@ -0,0 +1,428 @@+---+title: Releases+---++# Releases++## Hakyll 4.9.4.0++- Make `./site check` concurrent+- Bump directory dependency to 1.3+- Bump time dependency to 1.7+- Bump vector dependency to 0.12++## Hakyll 4.9.3.0++- Add a `Hakyll.Web.Redirect` module (contribution by gwern)+- Expose `Hakyll.Commands`+- Fix the exit code behaviour of `./site check`++## Hakyll 4.9.2.0++- Fix integer fields in YAML metadata (Fix by Nikolaos S. Papaspyrou)+- Bump pandoc dependency to 1.19++## Hakyll 4.9.1.0++- Allow optparse-applicative 0.13, QuickCheck 2.9, and pandoc 1.18+ (contributions by Chris Wong and Felix Yan)+- Fix extra test files for packaging source files (contribution by Julien+ Langlois)++## Hakyll 4.9.0.0++This release switches over some dependencies to alternatives, in order to clean+up some stuff and build on a wider variety of setups (stack/cabal).++- Move from `test-framework` to `tasty`+- Fix feed generator when item contains CDATA (contribution by Yann Esposito)+- Fix CompressCSS to not modify string constants (contribution by Nicole Rauch)+- Fix YAML dependency issue (contribution by Jens Peterson)+- Move from `cmdargs` to `optparse-applicative` (contribution by sk3r)+- Allow for trimming whitespace in templates (contribution by Sam Davis)+- Improve error messages for template parsing (contribution by Lorenzo+ Tabacchini)+- Improvements to the installation instructions (contribution by Thomas Koch)+- Move from `snap` to `warp` for preview servier (contribution by Arguggi)+- Fix error in CompressCSS (contribution by Luca Molteni)+- Move example from XHTML to HTML5 (contribution by Peter Doherty)+- Make errors in check less verbose (contribution by Jan Tojnar)+- Work on building with GHC 8.0.1 (contribution by Rohan Jain)++## Hakyll 4.8.3.2++This release is compatible with GHC 8.0.1, although `previewServer` might not+work yet on some setups.++- Allow data-default 0.7, pandoc-citeproc 0.10, and tagsoup 0.14 (contributions+ by Paul van der Walt and Felix Yan)+- Allow binary 0.8, process 1.4, time 1.6 (contribution by Sergei Trofimovich)+- Fix issue with `.metadata` file reading++## Hakyll 4.8.3.1++- Bump scientific dependency to 0.3.4++## Hakyll 4.8.3.0++- Fix another compilation issue wrt. orphan `Show` instance from regex-tdfa+ (contribution by Sergei Trofimovich)++## Hakyll 4.8.2.0++- Fix compilation issue wrt. orphan `Show` instance from regex-tdfa++## Hakyll 4.8.1.0++- Fix compilation on windows++## Hakyll 4.8.0.1++- Fix issue with test suite++## Hakyll 4.8.0.0++- Support full YAML in page metadata+- Bump data-default dependency to 0.6+- Add snippet field for literal includes in templates (contribution by Nicolas+ Mattia)++## Hakyll 4.7.5.2++- Bump pandoc dependency to 1.17 (contribution by Felix Yan)+- Fix `unixFilter` documentation (contribution by Richard Cook)+- Bump example posts (contribution by Andrew Barchuk)+- Add a template compiler that only uses the template body (contribution by+ Bergi)++## Hakyll 4.7.5.1++- Bump pandoc and pandoc-citeproc dependencies to 1.16 and 0.9 respectively++## Hakyll 4.7.5.0++- Expose templating engine+- Fix bug in feed context precedence (contribution by Yuriy Syrovetskiy)+- Bump http-types dependency to 0.9++## Hakyll 4.7.4.0++- Expose `getItemModificationTime`++## Hakyll 4.7.3.1++- Bump pandoc-citeproc dependency to 0.8++## Hakyll 4.7.3.0++- Bump HUnit dependency to 1.3+- Add `poster` as an URL attribute (contribution by vtduncan)+- Prevent `hakyll-init` from generating directories with leading hyphen+ (contribution by Javran Cheng)++## Hakyll 4.7.2.3++- Fix time dependency in tests++## Hakyll 4.7.2.2++- Relax time dependency++## Hakyll 4.7.2.1++- Bump fsnotify dependency to 0.2++## Hakyll 4.7.2.0++- Improve documentation of `getResourceXXX` functions (contribution by Matthias+ C. M. Troffaes)+- Allow for empty templates+- Bump pandoc dependency to 1.15++## Hakyll 4.7.1.0++- Drop old-time, old-locale, time-locale-compat dependencies+- Add convenicence `pandocBiblioCompiler` (contribution by+ Matthias C. M. Troffaes)+- Add support for mediawiki (contribution by Chen Lei)++## Hakyll 4.7.0.0++- Bump pandoc to 1.14. This will break a lot of sites: since the pandoc parser+ might now return an error message, it is ran inside the `Compiler` monad where+ we can nicely handle the error.++## Hakyll 4.6.9.0++- Let caller decide exit (fix by Erik Dominikus)+- Bump pandoc-citeproc dependency++## Hakyll 4.6.8.1++- Fix test suite dependencies++## Hakyll 4.6.8.0++- Fix building on GHC 7.10 (fix by Charles Strahan)+- Add support for a custom teaser separator (contribution by Tom Sydney+ Kerckhove)+- Let Pandoc handle DocBook files (contribution by Joshua SImmons)++## Hakyll 4.6.7.1++- Bump dependencies++## Hakyll 4.6.7.0++- Bump dependencies+- Fix bug where hakyll-init would create a file called `name.cabal.cabal` (fix+ by Hans-Peter Deifel)++## Hakyll 4.6.6.0++- Fix compilation error when preview server is disabled (fix by Magnus Therning)+- Add author name by default to RSS feeds (contribution by Calen Pennington)++## Hakyll 4.6.5.0++- Bump dependencies+- Fix garbled "Listening on 0.0.0.0:8000" message+- Add `boolField` (contribution by Ferenc Wágner)++## Hakyll 4.6.4.0++- Fix another dependency handling bug when using snapshots+- Add `matchMetadata` for examining metadata when defining rules++## Hakyll 4.6.3.0++- Fix dependency handling bug++## Hakyll 4.6.2.0++- Loosen `binary` dependency+- Make dependency handling more granular so you can depend on specific snapshots+ of an item++## Hakyll 4.6.1.0++- Bump `fsnotify` and `pandoc-citeproc` dependencies+- Rewrite polling code a bit++## Hakyll 4.6.0.0++- Added `listFieldWith` function+- Improved `rulesExtraDependencies` behaviour+- Changed function syntax in templates from `$foo arg1 arg2$` to+ `$foo("arg1", "arg2")$`+- Support parsing date from directory names in addition to file names++## Hakyll 4.5.5.0++- Fix Binary instances for `pandoc` and `pandoc-citeproc`+- Fix `network-uri` dependency issue++## Hakyll 4.5.4.0++- Fix issue with HTML entities when running `withUrls` and `demoteHeaders`.+- Generate a cabal file for the initialised site.+- Add pagination support.++## Hakyll 4.5.3.0++- Bump Pandoc to 1.12.4 to include the org-mode reader.++## Hakyll 4.5.2.0++- Fix rebuilding everything issue with latest directory (contribution by Jorge+ Israel Peña)+- Fix issue with `toSiteRoot` (contribution by Izzy Cecil)+- Fix issue with tag dependencies, slightly improve caching++## Hakyll 4.5.0.0++- Fix issue with syntax highlighting and line numbers (contribution by Adelbert+ Chang)+- Improve documentation for `Context` (contribution by Daniil Frumin)+- Added `IsString` instance for `Template`+- Added the `pandocCompilerWithTransformM` function (contribution by Daniil+ Frumin)+- Make `./site check` return the right exit code (contribution by Andres Loeh)+- Use OS threads to make `./site watch` work nicely on Windows (contribution by+ Simonas Kazlauskas)+- Make the `unixFilter` function work better on windows by calling `shell`+ (contribution by Collin J. Doering)+- Add a command-line flag to bind on a user-specified host (contribution by+ chrisdotcode)++## Hakyll 4.4.3.0++- Fix issue when using `metadataRoute` after other custom routes++## Hakyll 4.4.2.0++- Fix issue where Hakyll would not detect a change if a `.metadata` file was+ deleted++## Hakyll 4.4.1.0++- Use Pandoc 1.12 highlighting by default++## Hakyll 4.4.0.0++- Update to work with Pandoc 1.12. This changes the type of `readPandocBibilio`:+ the `CSL` argument is no longer optional (contribution by Jorge Israel Peña)++- Fix incorrect output of `toSiteRoot` on windows (contribution by Saeid+ Al-Wazzan)++- Add a preview port option to `Configuration` (contribution by Jorge Israel+ Peña)++- Add `watch` command that polls for changes but does not necessarily launch a+ server (contribution by Eric Stolten)++- Generalise type of `metadataField`++- Fix issue where metadata was not correctly loaded when using versions++## Hakyll 4.3.3.0++- Re-add the `functionField` function++## Hakyll 4.3.2.0++- Re-add the `mapContext` function++- Unescape internal URLs when using `./site check` (contribution by Marc-Antoine+ Perennou)++## Hakyll 4.3.1.0++- Make teasers undefined if no `<!--more-->` comment is found++- Sanitize tag URLs (contribution by Simonas Kazlauskas)++## Hakyll 4.3.0.0++- Add conditionals, partials and for loops to the template system (includes a+ contribution by Ivan N. Veselov)++- Improvements to the preview functionality on windows (contribution by Jorge+ Israel Peña)++- Add pagination support (contribution by Anton Dubovik)++- Slight speedup for the Hakyll cache (contribution by justnoxx)++- Add teaser functionality (contribution by Ivan N. Veselov)++- Make `./site check` work with scheme-relative URLs (contribution by Simonas+ Kazlauskas)++- The `./site deploy` command can now be customized with Haskell code+ (contribution by Samuel Tardieu)++- Use `hsnotify` for proper polling instead of sleep loop on all platforms+ (contribution by Simonas Kazlauskas)++- More useful debug info available++## Hakyll 4.2.2.0++- Fix issue with `Alternative` instance of `Compiler`++## Hakyll 4.2.1.1++*March 9, 2013*++- Make `http-conduit` dependency optional by adding a `checkExternal` cabal flag++## Hakyll 4.2.1.0++*March 7, 2013*++- Fix issue where `copyFileCompiler` ignored `providerDirectory`++## Hakyll 4.2.0.0++*March 7, 2013*++- Read second extension for `.lhs`, e.g. `.md.lhs` or `.tex.lhs` (contribution+ by Alexander Vershilov)++- Speedup initialization by using modification times instead of hashing files++- Speedup initialization with a rewritten resource provider++- Fix `./site check` not working with sites that require a user agent (e.g.+ <http://www.wikipedia.org/>)++- Change `chronological` and `recentFirst` to actually look at the dates of+ items. This changes their types from:++ chronological, recentFirst :: [Item a] -> [Item a]++ to:++ chronological, recentFirst+ :: MonadMetadata m => [Item a] -> m [Item a]++ (contribution by Simonas Kazlauskas)++- Add `metadataRoute`, so it is now possible to use metadata when determining+ routes++- Improve metadata parser for multiline metadata fields (contribution by Peter+ Jones)++- Add the `getMetadataField` utility++## Hakyll 4.1.4.0++*January 26, 2013*++- Export the flexible `renderTags` function++## Hakyll 4.1.3.0++*January 26, 2013*++- Export the constructor of the `Tags` datatype++## Hakyll 4.1.2.0++*January 20, 2013*++- Fix an issue where a dependency cycle would lead to infinite recursion/stack+ overflow++## Hakyll 4.1.1.0++*January 20, 2013*++- Fix an issue regarding `relativizeUrls` expanding `<meta />` to+ `<meta></meta>`++## Hakyll 4.1.0.0++*January 20, 2013*++Update to use Pandoc 1.10, this requires changes to your `site.hs` if you're+using custom Pandoc options or the `Hakyll.Web.Pandoc.Biblio` module.++- `defaultHakyllParserState` renamed to `defaultHakyllReaderOptions`++- The type of `readPandocBiblio` changed++Because of the many changes, this release is no longer compatible with Pandoc+1.9.++## Hakyll 4.0.0.0++*January 16, 2013*++The Initial release of Hakyll 4, see+[this blogpost](http://jaspervdj.be/posts/2013-01-16-hakyll-4.0.html) and+[the migration guide](/tutorials/hakyll-3-to-hakyll4-migration-guide.html) for+an overview of changes.
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 4.9.3.0+Version: 4.9.4.0 Synopsis: A static website compiler library Description:@@ -62,6 +62,7 @@ templates/rss.xml Extra-source-files:+ CHANGELOG.md tests/data/example.md tests/data/example.md.metadata tests/data/images/favicon.ico@@ -161,7 +162,7 @@ cryptohash >= 0.7 && < 0.12, data-default >= 0.4 && < 0.8, deepseq >= 1.3 && < 1.5,- directory >= 1.0 && < 1.3,+ directory >= 1.0 && < 1.4, filepath >= 1.0 && < 1.5, lrucache >= 1.1.1 && < 1.3, mtl >= 1 && < 2.3,@@ -178,10 +179,10 @@ scientific >= 0.3.4 && < 0.4, tagsoup >= 0.13.1 && < 0.15, text >= 0.11 && < 1.3,- time >= 1.4 && < 1.7,+ time >= 1.4 && < 1.8, time-locale-compat >= 0.1 && < 0.2, unordered-containers >= 0.2 && < 0.3,- vector >= 0.11 && < 0.12,+ vector >= 0.11 && < 0.13, yaml >= 0.8.11 && < 0.9, optparse-applicative >= 0.12 && < 0.14 @@ -254,7 +255,7 @@ cryptohash >= 0.7 && < 0.12, data-default >= 0.4 && < 0.8, deepseq >= 1.3 && < 1.5,- directory >= 1.0 && < 1.3,+ directory >= 1.0 && < 1.4, filepath >= 1.0 && < 1.5, lrucache >= 1.1.1 && < 1.3, mtl >= 1 && < 2.3,@@ -271,10 +272,10 @@ scientific >= 0.3.4 && < 0.4, tagsoup >= 0.13.1 && < 0.15, text >= 0.11 && < 1.3,- time >= 1.4 && < 1.7,+ time >= 1.4 && < 1.8, time-locale-compat >= 0.1 && < 0.2, unordered-containers >= 0.2 && < 0.3,- vector >= 0.11 && < 0.12,+ vector >= 0.11 && < 0.13, yaml >= 0.8.11 && < 0.9, optparse-applicative >= 0.12 && < 0.14 @@ -315,7 +316,7 @@ Build-depends: base >= 4 && < 5,- directory >= 1.0 && < 1.3,+ directory >= 1.0 && < 1.4, filepath >= 1.0 && < 1.5 Other-modules:
src/Hakyll/Check.hs view
@@ -8,22 +8,21 @@ ---------------------------------------------------------------------------------import Control.Monad (forM_)-import Control.Monad.Reader (ask)-import Control.Monad.RWS (RWST, runRWST)+import Control.Monad (forM_, foldM)+import Control.Monad.Reader (ask, ReaderT, runReaderT) import Control.Monad.Trans (liftIO) import Control.Monad.Trans.Resource (runResourceT)-import Control.Monad.Writer (tell) import Data.ByteString.Char8 (unpack) import Data.List (isPrefixOf)-import Data.Set (Set)-import qualified Data.Set as S+import qualified Data.Map.Lazy as Map import Network.URI (unEscapeString) import System.Directory (doesDirectoryExist, doesFileExist) import System.Exit (ExitCode (..)) import System.FilePath (takeDirectory, takeExtension, (</>))+import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar,+ readMVar) import qualified Text.HTML.TagSoup as TS @@ -31,7 +30,7 @@ #ifdef CHECK_EXTERNAL import Control.Exception (SomeAsyncException (..), SomeException (..), try, throw)-import Control.Monad.State (get, modify)+import Control.Monad.State (get, modify, StateT, runStateT) import Data.List (intercalate) import Data.Typeable (cast) import Data.Version (versionBranch)@@ -58,11 +57,20 @@ -------------------------------------------------------------------------------- check :: Configuration -> Logger -> Check -> IO ExitCode check config logger check' = do- ((), write) <- runChecker checkDestination config logger check'- return $ if checkerFaulty write > 0 then ExitFailure 1 else ExitSuccess+ ((), state) <- runChecker checkDestination config logger check'+ failed <- countFailedLinks state+ return $ if failed > 0 then ExitFailure 1 else ExitSuccess --------------------------------------------------------------------------------+countFailedLinks :: CheckerState -> IO Int+countFailedLinks state = foldM addIfFailure 0 (Map.elems state)+ where addIfFailure failures mvar = do+ checkerWrite <- readMVar mvar+ return $ failures + checkerFaulty checkerWrite+++-------------------------------------------------------------------------------- data CheckerRead = CheckerRead { checkerConfig :: Configuration , checkerLogger :: Logger@@ -85,26 +93,28 @@ ---------------------------------------------------------------------------------type CheckerState = Set String+type CheckerState = Map.Map URL (MVar CheckerWrite) ---------------------------------------------------------------------------------type Checker a = RWST CheckerRead CheckerWrite CheckerState IO a+type Checker a = ReaderT CheckerRead (StateT CheckerState IO) a --------------------------------------------------------------------------------+type URL = String+++-------------------------------------------------------------------------------- runChecker :: Checker a -> Configuration -> Logger -> Check- -> IO (a, CheckerWrite)+ -> IO (a, CheckerState) runChecker checker config logger check' = do let read' = CheckerRead { checkerConfig = config , checkerLogger = logger , checkerCheck = check' }-- (x, _, write) <- runRWST checker read' S.empty Logger.flush logger- return (x, write)+ runStateT (runReaderT checker read') Map.empty --------------------------------------------------------------------------------@@ -133,14 +143,31 @@ let urls = getUrls $ TS.parseTags contents forM_ urls $ \url -> do Logger.debug logger $ "Checking link " ++ url- checkUrl filePath url+ m <- liftIO newEmptyMVar+ checkUrlIfNeeded filePath (canonicalizeUrl url) m+ where+ -- Check scheme-relative links+ canonicalizeUrl url = if schemeRelative url then "http:" ++ url else url+ schemeRelative = isPrefixOf "//" ---------------------------------------------------------------------------------checkUrl :: FilePath -> String -> Checker ()+checkUrlIfNeeded :: FilePath -> URL -> MVar CheckerWrite -> Checker ()+checkUrlIfNeeded filepath url m = do+ logger <- checkerLogger <$> ask+ needsCheck <- (== All) . checkerCheck <$> ask+ checked <- (url `Map.member`) <$> get+ if not needsCheck || checked+ then Logger.debug logger "Already checked, skipping"+ else do modify $ Map.insert url m+ checkUrl filepath url+++--------------------------------------------------------------------------------+checkUrl :: FilePath -> URL -> Checker () checkUrl filePath url | isExternal url = checkExternalUrl url- | hasProtocol url = skip "Unknown protocol, skipping"+ | hasProtocol url = skip url $ Just "Unknown protocol, skipping" | otherwise = checkInternalUrl filePath url where validProtoChars = ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "+-."@@ -150,30 +177,45 @@ ---------------------------------------------------------------------------------ok :: String -> Checker ()-ok _ = tell $ mempty {checkerOk = 1}+ok :: URL -> Checker ()+ok url = putCheckResult url mempty {checkerOk = 1} ---------------------------------------------------------------------------------skip :: String -> Checker ()-skip reason = do+skip :: URL -> Maybe String -> Checker ()+skip url maybeReason = do logger <- checkerLogger <$> ask- Logger.debug logger $ reason- tell $ mempty {checkerOk = 1}+ case maybeReason of+ Nothing -> return ()+ Just reason -> Logger.debug logger reason+ putCheckResult url mempty {checkerOk = 1} + ---------------------------------------------------------------------------------faulty :: String -> Maybe String -> Checker ()+faulty :: URL -> Maybe String -> Checker () faulty url reason = do logger <- checkerLogger <$> ask Logger.error logger $ "Broken link to " ++ show url ++ explanation- tell $ mempty {checkerFaulty = 1}+ putCheckResult url mempty {checkerFaulty = 1} where formatExplanation = (" (" ++) . (++ ")") explanation = maybe "" formatExplanation reason ---------------------------------------------------------------------------------checkInternalUrl :: FilePath -> String -> Checker ()+putCheckResult :: URL -> CheckerWrite -> Checker ()+putCheckResult url result = do+ state <- get+ let maybeMVar = Map.lookup url state+ case maybeMVar of+ Just m -> liftIO $ putMVar m result+ Nothing -> do+ logger <- checkerLogger <$> ask+ Logger.debug logger "Failed to find existing entry for checked URL"+++--------------------------------------------------------------------------------+checkInternalUrl :: FilePath -> URL -> Checker () checkInternalUrl base url = case url' of "" -> ok url _ -> do@@ -191,57 +233,46 @@ ---------------------------------------------------------------------------------checkExternalUrl :: String -> Checker ()+checkExternalUrl :: URL -> Checker () #ifdef CHECK_EXTERNAL checkExternalUrl url = do- logger <- checkerLogger <$> ask- needsCheck <- (== All) . checkerCheck <$> ask- checked <- (url `S.member`) <$> get-- if not needsCheck || checked- then Logger.debug logger "Already checked, skipping"- else do- result <- liftIO $ try $ do- mgr <- Http.newManager Http.tlsManagerSettings- runResourceT $ do- request <- Http.parseRequest urlToCheck- response <- Http.http (settings request) mgr- let code = Http.statusCode (Http.responseStatus response)- return $ code >= 200 && code < 300-- modify $ if schemeRelative url- then S.insert urlToCheck . S.insert url- else S.insert url- case result of- Left (SomeException e) ->- case (cast e :: Maybe SomeAsyncException) of- Just ae -> throw ae- _ -> faulty url (Just $ showException e)- Right _ -> ok url- where- -- Add additional request info- settings r = r- { Http.method = "HEAD"- , Http.redirectCount = 10- , Http.requestHeaders = ("User-Agent", ua) : Http.requestHeaders r- }-- -- Nice user agent info- ua = fromString $ "hakyll-check/" ++- (intercalate "." $ map show $ versionBranch $ Paths_hakyll.version)-- -- Check scheme-relative links- schemeRelative = isPrefixOf "//"- urlToCheck = if schemeRelative url then "http:" ++ url else url-- -- Convert exception to a concise form- showException e = case cast e of- Just (Http.HttpExceptionRequest _ e') -> show e'- _ -> head $ words $ show e+ result <- requestExternalUrl url+ case result of+ Left (SomeException e) ->+ case (cast e :: Maybe SomeAsyncException) of+ Just ae -> throw ae+ _ -> faulty url (Just $ showException e)+ Right _ -> ok url+ where+ -- Convert exception to a concise form+ showException e = case cast e of+ Just (Http.HttpExceptionRequest _ e') -> show e'+ _ -> head $ words $ show e #else-checkExternalUrl _ = return ()+checkExternalUrl url = skip url Nothing #endif ++--------------------------------------------------------------------------------+requestExternalUrl :: URL -> Checker (Either SomeException Bool)+requestExternalUrl url = liftIO $ try $ do+ mgr <- Http.newManager Http.tlsManagerSettings+ runResourceT $ do+ request <- Http.parseRequest url+ response <- Http.http (settings request) mgr+ let code = Http.statusCode (Http.responseStatus response)+ return $ code >= 200 && code < 300+ where+ -- Add additional request info+ settings r = r+ { Http.method = "HEAD"+ , Http.redirectCount = 10+ , Http.requestHeaders = ("User-Agent", ua) : Http.requestHeaders r+ }++ -- Nice user agent info+ ua = fromString $ "hakyll-check/" +++ (intercalate "." $ map show $ versionBranch Paths_hakyll.version) --------------------------------------------------------------------------------