hakyll 2.2 → 2.2.1
raw patch · 4 files changed
+20/−6 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.Hakyll.ContextManipulations: renderDateWithLocale :: TimeLocale -> String -> String -> String -> HakyllAction Context Context
Files
- data/templates/rss-item.xml +1/−1
- data/templates/rss.xml +1/−1
- hakyll.cabal +1/−1
- src/Text/Hakyll/ContextManipulations.hs +17/−3
data/templates/rss-item.xml view
@@ -1,7 +1,7 @@ <item> <title>$title</title> <link>$absolute/$url</link>- <description>$description</description>+ <description><![CDATA[$description]]></description> <pubDate>$timestamp</pubDate> <guid>$absolute/$url</guid> </item>
data/templates/rss.xml view
@@ -3,7 +3,7 @@ <channel> <title>$title</title> <link>$absolute</link>- <description>$description</description>+ <description><![CDATA[$description]]></description> <atom:link href="$absolute/$url" rel="self" type="application/rss+xml" /> <lastBuildDate>$timestamp</lastBuildDate>
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 2.2+Version: 2.2.1 Synopsis: A simple static site generator library. Description: A simple static site generator library, mainly aimed at
src/Text/Hakyll/ContextManipulations.hs view
@@ -6,13 +6,14 @@ , changeUrl , copyValue , renderDate+ , renderDateWithLocale , changeExtension , renderBody ) where import Control.Monad (liftM) import Control.Arrow (arr)-import System.Locale (defaultTimeLocale)+import System.Locale (TimeLocale, defaultTimeLocale) import System.FilePath (takeFileName, addExtension, dropExtension) import Data.Time.Format (parseTime, formatTime) import Data.Time.Clock (UTCTime)@@ -66,11 +67,24 @@ -- > renderDate "date" "%B %e, %Y" "Date unknown" -- -- Will render something like @January 32, 2010@.+-- renderDate :: String -- ^ Key in which the rendered date should be placed. -> String -- ^ Format to use on the date. -> String -- ^ Default key, in case the date cannot be parsed. -> HakyllAction Context Context-renderDate key format defaultValue = renderValue "path" key renderDate'+renderDate = renderDateWithLocale defaultTimeLocale++-- | This is an extended version of 'renderDate' that allows you to specify a+-- time locale that is used for outputting the date. For more details, see+-- 'renderDate'.+--+renderDateWithLocale :: TimeLocale -- ^ Output time locale.+ -> String -- ^ Destination key.+ -> String -- ^ Format to use on the date.+ -> String -- ^ Default key.+ -> HakyllAction Context Context+renderDateWithLocale locale key format defaultValue =+ renderValue "path" key renderDate' where renderDate' filePath = fromMaybe defaultValue $ do let dateString = substituteRegex "^([0-9]*-[0-9]*-[0-9]*).*" "\\1"@@ -78,7 +92,7 @@ time <- parseTime defaultTimeLocale "%Y-%m-%d" dateString :: Maybe UTCTime- return $ formatTime defaultTimeLocale format time+ return $ formatTime locale format time -- | Change the extension of a file. This is only needed when you want to -- render, for example, mardown to @.php@ files instead of @.html@ files.