packages feed

hakyll 2.4 → 2.4.1

raw patch · 4 files changed

+28/−16 lines, 4 filesdep ~mtlPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: mtl

API changes (from Hackage documentation)

Files

hakyll.cabal view
@@ -1,5 +1,5 @@ Name:               hakyll-Version:            2.4+Version:            2.4.1  Synopsis:           A simple static site generator library. Description:        A simple static site generator library, mainly aimed at@@ -35,7 +35,7 @@                     regex-base >= 0.93,                     regex-tdfa >= 1.1,                     network == 2.*,-                    mtl == 1.*,+                    mtl >= 1,                     old-locale == 1.*,                     old-time == 1.*,                     time >= 1.1,
src/Text/Hakyll/ContextManipulations.hs view
@@ -27,9 +27,10 @@  -- | Do something with a value in a @Context@, but keep the old value as well. --   If the key given is not present in the @Context@, nothing will happen.-renderValue :: String             -- ^ Key of which the value should be copied.-            -> String             -- ^ Key the value should be copied to.-            -> (String -> String) -- ^ Function to apply on the value.+--+renderValue :: String              -- ^ Key of which the value should be copied.+            -> String              -- ^ Key the value should be copied to.+            -> (String -> String)  -- ^ Function to apply on the value.             -> HakyllAction Context Context renderValue source destination f = arr $ \(Context context) -> Context $     case M.lookup source context of
src/Text/Hakyll/File.hs view
@@ -40,24 +40,32 @@     path' = if "$root" `isPrefixOf` path then drop 5 path                                          else path --- | Convert a relative filepath to a filepath in the destination+-- | Convert a relative URL to a filepath in the destination --   (default: @_site@). toDestination :: FilePath -> Hakyll FilePath toDestination url = do dir <- askHakyll siteDirectory-                       enableIndexUrl' <- askHakyll enableIndexUrl-                       let destination = if enableIndexUrl' && separatorEnd-                               then dir </> noSeparator </> "index.html"-                               else dir </> noSeparator-                       return destination-  where-    noSeparator = removeLeadingSeparator url-    separatorEnd = not (null url) && last url == '/'+                       toFilePath dir url --- | Convert a relative filepath to a filepath in the cache+-- | Convert a relative URL to a filepath in the cache --   (default: @_cache@). toCache :: FilePath -> Hakyll FilePath toCache path = do dir <- askHakyll cacheDirectory-                  return $ dir </> removeLeadingSeparator path+                  toFilePath dir path++-- | Implementation of toDestination/toCache+--+toFilePath :: String           -- ^ Directory (site or cache)+           -> String           -- ^ URL+           -> Hakyll FilePath  -- ^ Resulting file path+toFilePath dir url = do+   enableIndexUrl' <- askHakyll enableIndexUrl+   let destination = if enableIndexUrl' && separatorEnd+           then dir </> noSeparator </> "index.html"+           else dir </> noSeparator+   return destination+  where+    noSeparator = removeLeadingSeparator url+    separatorEnd = not (null url) && last url == '/'  -- | Get the url for a given page. For most extensions, this would be the path --   itself. It's only for rendered extensions (@.markdown@, @.rst@, @.lhs@ this
src/Text/Hakyll/Page.hs view
@@ -88,8 +88,11 @@     let sections = evalState (splitAtDelimiters $ lines contents) Nothing         sectionsData = concat $ zipWith ($) sectionFunctions sections +    -- Note that url, path etc. are listed first, which means can be overwritten+    -- by section data     return $ PageSection ("url", url, False)            : PageSection ("path", path, False)+           : PageSection ("title", takeBaseName path, False)            : (category ++ sectionsData)   where     category = let dirs = splitDirectories $ takeDirectory path