diff -Nru haskell-hakyll-3.2.0.9/data/templates/atom-item.xml haskell-hakyll-3.2.6.1/data/templates/atom-item.xml
--- haskell-hakyll-3.2.0.9/data/templates/atom-item.xml 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/data/templates/atom-item.xml 2012-02-13 10:54:43.000000000 +0000
@@ -2,6 +2,7 @@
$title$
$root$$url$
- $timestamp$
+ $published$
+ $updated$
diff -Nru haskell-hakyll-3.2.0.9/data/templates/atom.xml haskell-hakyll-3.2.6.1/data/templates/atom.xml
--- haskell-hakyll-3.2.0.9/data/templates/atom.xml 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/data/templates/atom.xml 2012-02-13 10:54:43.000000000 +0000
@@ -7,6 +7,6 @@
$authorName$
- $timestamp$
+ $updated$
$body$
diff -Nru haskell-hakyll-3.2.0.9/data/templates/rss-item.xml haskell-hakyll-3.2.6.1/data/templates/rss-item.xml
--- haskell-hakyll-3.2.0.9/data/templates/rss-item.xml 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/data/templates/rss-item.xml 2012-02-13 10:54:43.000000000 +0000
@@ -2,6 +2,6 @@
$title$
$root$$url$
- $timestamp$
+ $published$
$root$$url$
diff -Nru haskell-hakyll-3.2.0.9/data/templates/rss.xml haskell-hakyll-3.2.6.1/data/templates/rss.xml
--- haskell-hakyll-3.2.0.9/data/templates/rss.xml 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/data/templates/rss.xml 2012-02-13 10:54:43.000000000 +0000
@@ -6,7 +6,7 @@
- $timestamp$
+ $updated$
$body$
diff -Nru haskell-hakyll-3.2.0.9/debian/changelog haskell-hakyll-3.2.6.1/debian/changelog
--- haskell-hakyll-3.2.0.9/debian/changelog 2011-10-08 14:17:37.000000000 +0000
+++ haskell-hakyll-3.2.6.1/debian/changelog 2012-03-06 19:04:29.000000000 +0000
@@ -1,3 +1,30 @@
+haskell-hakyll (3.2.6.1-1) unstable; urgency=low
+
+ * New upstream version.
+ * Bump to Standards-Version 3.9.3.
+
+ -- Clint Adams Tue, 06 Mar 2012 14:04:21 -0500
+
+haskell-hakyll (3.2.4.0-1) unstable; urgency=low
+
+ * New upstream version.
+ * Install /usr/share/hakyll-3.2.4.0/templates/*.xml
+ Need them to build git://github.com/marcmo/blog.coldflake.git
+
+ -- Kiwamu Okabe Sun, 08 Jan 2012 00:06:55 +0900
+
+haskell-hakyll (3.2.3.2-2) unstable; urgency=low
+
+ * Support snap server.
+
+ -- Kiwamu Okabe Tue, 03 Jan 2012 01:33:41 +0900
+
+haskell-hakyll (3.2.3.2-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Clint Adams Mon, 26 Dec 2011 09:49:39 -0500
+
haskell-hakyll (3.2.0.9-1) unstable; urgency=low
* New upstream version.
diff -Nru haskell-hakyll-3.2.0.9/debian/control haskell-hakyll-3.2.6.1/debian/control
--- haskell-hakyll-3.2.0.9/debian/control 2011-10-08 14:16:29.000000000 +0000
+++ haskell-hakyll-3.2.6.1/debian/control 2012-03-06 19:06:26.000000000 +0000
@@ -2,15 +2,18 @@
Section: haskell
Priority: extra
Maintainer: Debian Haskell Group
-Uploaders: Clint Adams
+Uploaders: Clint Adams , Kiwamu Okabe
Build-Depends: debhelper (>= 7)
, cdbs
, haskell-devscripts (>= 0.8)
, ghc
, ghc-prof
- , libghc-binary-dev (>> 0.5)
- , libghc-binary-dev (<< 1.0)
- , libghc-binary-prof
+ , libghc-blaze-html-dev (>> 0.4)
+ , libghc-blaze-html-dev (<< 0.6)
+ , libghc-blaze-html-prof
+ , libghc-citeproc-hs-dev (>> 0.3.2)
+ , libghc-citeproc-hs-dev (<< 0.4)
+ , libghc-citeproc-hs-prof
, libghc-cryptohash-dev (>> 0.7)
, libghc-cryptohash-dev (<< 0.8)
, libghc-cryptohash-prof
@@ -18,37 +21,47 @@
, libghc-hamlet-dev (<< 0.11)
, libghc-hamlet-prof
, libghc-mtl-dev (>> 1)
- , libghc-mtl-dev (<< 3)
+ , libghc-mtl-dev (<< 2.1)
, libghc-mtl-prof
- , libghc-pandoc-dev (>> 1.6)
- , libghc-pandoc-dev (<< 2.0)
+ , libghc-pandoc-dev (>> 1.9)
+ , libghc-pandoc-dev (<< 1.10)
, libghc-pandoc-prof
- , libghc-parsec3-dev (>> 2.1)
+ , libghc-parsec3-dev (>> 3.0)
, libghc-parsec3-dev (<< 3.2)
, libghc-parsec3-prof
, libghc-regex-base-dev (>> 0.93)
- , libghc-regex-base-dev (<< 1.0)
+ , libghc-regex-base-dev (<< 0.94)
, libghc-regex-base-prof
- , libghc-regex-pcre-dev (>> 0.93)
- , libghc-regex-pcre-dev (<< 1.0)
- , libghc-regex-pcre-prof
- , libghc-tagsoup-dev (>> 0.12)
+ , libghc-regex-tdfa-dev (>> 1.1)
+ , libghc-regex-tdfa-dev (<< 1.2)
+ , libghc-regex-tdfa-prof
+ , libghc-tagsoup-dev (>> 0.12.6)
, libghc-tagsoup-dev (<< 0.13)
, libghc-tagsoup-prof
+ , libghc-snap-core-dev (>= 0.6)
+ , libghc-snap-core-dev (<< 0.8)
+ , libghc-snap-core-prof
+ , libghc-snap-server-dev (>= 0.6)
+ , libghc-snap-server-dev (<< 0.8)
+ , libghc-snap-server-prof
Build-Depends-Indep: ghc-doc
- , libghc-binary-doc
+ , libghc-blaze-html-doc
+ , libghc-citeproc-hs-doc
, libghc-cryptohash-doc
, libghc-hamlet-doc
, libghc-mtl-doc
, libghc-pandoc-doc
, libghc-parsec3-doc
, libghc-regex-base-doc
- , libghc-regex-pcre-doc
+ , libghc-regex-tdfa-doc
, libghc-tagsoup-doc
-Standards-Version: 3.9.2
+ , libghc-snap-core-doc
+ , libghc-snap-server-doc
+Standards-Version: 3.9.3
Homepage: http://hackage.haskell.org/package/hakyll
Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-hakyll
Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-hakyll
+DM-Upload-Allowed: yes
Package: libghc-hakyll-dev
Architecture: any
diff -Nru haskell-hakyll-3.2.0.9/debian/rules haskell-hakyll-3.2.6.1/debian/rules
--- haskell-hakyll-3.2.0.9/debian/rules 2011-10-08 14:11:00.000000000 +0000
+++ haskell-hakyll-3.2.6.1/debian/rules 2012-03-06 19:03:54.000000000 +0000
@@ -2,3 +2,7 @@
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/hlibrary.mk
+
+install/libghc-hakyll-dev :: debian/tmp-inst-ghc
+ mkdir -p debian/libghc-hakyll-dev/usr/share
+ cp -r debian/tmp-inst-ghc/usr/share/hakyll-* debian/libghc-hakyll-dev/usr/share/
diff -Nru haskell-hakyll-3.2.0.9/debian/yesod.dirs haskell-hakyll-3.2.6.1/debian/yesod.dirs
--- haskell-hakyll-3.2.0.9/debian/yesod.dirs 2011-10-08 14:11:00.000000000 +0000
+++ haskell-hakyll-3.2.6.1/debian/yesod.dirs 1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-usr/bin
-usr/share
diff -Nru haskell-hakyll-3.2.0.9/hakyll.cabal haskell-hakyll-3.2.6.1/hakyll.cabal
--- haskell-hakyll-3.2.0.9/hakyll.cabal 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/hakyll.cabal 2012-02-13 10:54:43.000000000 +0000
@@ -1,5 +1,5 @@
Name: hakyll
-Version: 3.2.0.9
+Version: 3.2.6.1
Synopsis: A static website compiler library
Description:
@@ -60,24 +60,25 @@
Build-Depends:
base >= 4 && < 5,
- binary >= 0.5 && < 1.0,
+ binary >= 0.5 && < 0.6,
blaze-html >= 0.4 && < 0.6,
- bytestring >= 0.9 && < 1.0,
- containers >= 0.3 && < 1.0,
+ bytestring >= 0.9 && < 0.10,
+ citeproc-hs >= 0.3.2 && < 0.4,
+ containers >= 0.3 && < 0.5,
cryptohash >= 0.7 && < 0.8,
- directory >= 1.0 && < 1.3,
- filepath >= 1.0 && < 2.0,
+ directory >= 1.0 && < 1.2,
+ filepath >= 1.0 && < 1.4,
hamlet >= 0.10.3 && < 0.11,
- mtl >= 1 && < 3.0,
- old-locale >= 1.0 && < 2.0,
- old-time >= 1.0 && < 1.3,
- pandoc >= 1.6 && < 2.0,
- parsec >= 2.1 && < 3.2,
- process >= 1.0 && < 1.4,
- regex-base >= 0.93 && < 1.0,
- regex-pcre >= 0.93 && < 1.0,
- tagsoup >= 0.12 && < 0.13,
- time >= 1.1 && < 1.3,
+ mtl >= 1 && < 2.1,
+ old-locale >= 1.0 && < 1.1,
+ old-time >= 1.0 && < 1.2,
+ pandoc >= 1.9 && < 1.10,
+ parsec >= 3.0 && < 3.2,
+ process >= 1.0 && < 1.2,
+ regex-base >= 0.93 && < 0.94,
+ regex-tdfa >= 1.1 && < 1.2,
+ tagsoup >= 0.12.6 && < 0.13,
+ time >= 1.1 && < 1.5,
unix >= 2.4 && < 2.6
Exposed-Modules:
@@ -114,6 +115,7 @@
Hakyll.Web.Page.Metadata
Hakyll.Web.Page.Read
Hakyll.Web.Pandoc
+ Hakyll.Web.Pandoc.Biblio
Hakyll.Web.Pandoc.FileType
Hakyll.Web.Tags
Hakyll.Web.Template
@@ -134,8 +136,8 @@
If flag(previewServer)
Build-depends:
- snap-core >= 0.5.1 && < 0.6,
- snap-server >= 0.5.1 && < 0.6
+ snap-core >= 0.6 && < 0.8,
+ snap-server >= 0.6 && < 0.8
Cpp-Options:
-DPREVIEW_SERVER
Other-Modules:
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Core/Identifier/Pattern.hs haskell-hakyll-3.2.6.1/src/Hakyll/Core/Identifier/Pattern.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Core/Identifier/Pattern.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Core/Identifier/Pattern.hs 2012-02-13 10:54:43.000000000 +0000
@@ -57,7 +57,7 @@
import Data.Monoid (Monoid, mempty, mappend)
import GHC.Exts (IsString, fromString)
-import Text.Regex.PCRE ((=~~))
+import Text.Regex.TDFA ((=~~))
import Hakyll.Core.Identifier
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Core/Rules/Internal.hs haskell-hakyll-3.2.6.1/src/Hakyll/Core/Rules/Internal.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Core/Rules/Internal.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Core/Rules/Internal.hs 2012-02-13 10:54:43.000000000 +0000
@@ -56,7 +56,7 @@
-- | Rule state
--
data RuleState = RuleState
- { rulesMetaCompilerIndex :: Int
+ { rulesNextIdentifier :: Int
} deriving (Show)
-- | Rule environment
@@ -84,7 +84,7 @@
runRules rules provider = nubCompilers $
evalState (execWriterT $ runReaderT (unRulesM rules) env) state
where
- state = RuleState {rulesMetaCompilerIndex = 0}
+ state = RuleState {rulesNextIdentifier = 0}
env = RuleEnvironment { rulesResourceProvider = provider
, rulesPattern = mempty
, rulesGroup = Nothing
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Core/Rules.hs haskell-hakyll-3.2.6.1/src/Hakyll/Core/Rules.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Core/Rules.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Core/Rules.hs 2012-02-13 10:54:43.000000000 +0000
@@ -26,6 +26,7 @@
, resources
, metaCompile
, metaCompileWith
+ , freshIdentifier
) where
import Control.Applicative ((<$>))
@@ -208,17 +209,9 @@
-- ^ Compiler generating the other compilers
-> Rules
-- ^ Resulting rules
-metaCompile compiler = RulesM $ do
- -- Create an identifier from the state
- state <- get
- let index = rulesMetaCompilerIndex state
- id' = fromCapture "Hakyll.Core.Rules.metaCompile/*" (show index)
-
- -- Update the state with a new identifier
- put $ state {rulesMetaCompilerIndex = index + 1}
-
- -- Fallback to 'metaCompileWith' with now known identifier
- unRulesM $ metaCompileWith id' compiler
+metaCompile compiler = do
+ id' <- freshIdentifier "Hakyll.Core.Rules.metaCompile"
+ metaCompileWith id' compiler
-- | Version of 'metaCompile' that allows you to specify a custom identifier for
-- the metacompiler.
@@ -243,3 +236,13 @@
compilers = [(id', compiler >>> arr makeRule )]
tell $ RuleSet mempty compilers mempty
+
+-- | Generate a fresh Identifier with a given prefix
+freshIdentifier :: String -- ^ Prefix
+ -> RulesM (Identifier a) -- ^ Fresh identifier
+freshIdentifier prefix = RulesM $ do
+ state <- get
+ let index = rulesNextIdentifier state
+ id' = parseIdentifier $ prefix ++ "/" ++ show index
+ put $ state {rulesNextIdentifier = index + 1}
+ return id'
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Core/Util/Arrow.hs haskell-hakyll-3.2.6.1/src/Hakyll/Core/Util/Arrow.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Core/Util/Arrow.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Core/Util/Arrow.hs 2012-02-13 10:54:43.000000000 +0000
@@ -16,9 +16,9 @@
sequenceA :: Arrow a
=> [a b c]
-> a b [c]
-sequenceA = foldl reduce $ constA []
+sequenceA = foldr reduce $ constA []
where
- reduce la xa = xa &&& la >>^ arr (uncurry (:))
+ reduce xa la = xa &&& la >>^ arr (uncurry (:))
unitA :: Arrow a
=> a b ()
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Core/Util/String.hs haskell-hakyll-3.2.6.1/src/Hakyll/Core/Util/String.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Core/Util/String.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Core/Util/String.hs 2012-02-13 10:54:43.000000000 +0000
@@ -9,7 +9,7 @@
import Data.Char (isSpace)
import Data.Maybe (listToMaybe)
-import Text.Regex.PCRE ((=~~))
+import Text.Regex.TDFA ((=~~))
-- | Trim a string (drop spaces, tabs and newlines at both sides).
--
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Blaze.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Blaze.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Blaze.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Blaze.hs 2012-02-13 10:54:43.000000000 +0000
@@ -12,8 +12,8 @@
import Hakyll.Web.Page
import Hakyll.Web.Page.Metadata
--- | Get a field from a page and convert it to HTML. This version does escape
--- the given HTML
+-- | Get a field from a page and convert it to HTML. This version does not
+-- escape the given HTML
--
getFieldHtml :: String -> Page a -> Html
getFieldHtml key = preEscapedString . getField key
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Feed.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Feed.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Feed.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Feed.hs 2012-02-13 10:54:43.000000000 +0000
@@ -7,11 +7,11 @@
-- Also note that the pages should have (at least) the following fields to
-- produce a correct feed:
--
--- - @$title@: Title of the item
+-- - @$title$@: Title of the item
--
--- - @$description@: Description to appear in the feed
+-- - @$description$@: Description to appear in the feed
--
--- - @$url@: URL to the item - this is usually set automatically.
+-- - @$url$@: URL to the item - this is usually set automatically.
--
-- In addition, the posts should be named according to the rules for
-- 'Hakyll.Page.Metadata.renderDateField'.
@@ -50,7 +50,8 @@
} deriving (Show, Eq)
-- | This is an auxiliary function to create a listing that is, in fact, a feed.
--- The items should be sorted on date. The @$timestamp@ field should be set.
+-- The items should be sorted on date. The @$updated@ field should be set for
+-- each item.
--
createFeed :: Template -- ^ Feed template
-> Template -- ^ Item template
@@ -60,7 +61,7 @@
-> String -- ^ Resulting feed
createFeed feedTemplate itemTemplate url configuration items =
pageBody $ applyTemplate feedTemplate
- $ trySetField "timestamp" timestamp
+ $ trySetField "updated" updated
$ trySetField "title" (feedTitle configuration)
$ trySetField "description" (feedDescription configuration)
$ trySetField "authorName" (feedDescription configuration)
@@ -75,10 +76,10 @@
-- Body: concatenated items
body = concat $ map pageBody items'
- -- Take the first timestamp, which should be the most recent
- timestamp = fromMaybe "Unknown" $ do
+ -- Take the first updated, which should be the most recent
+ updated = fromMaybe "Unknown" $ do
p <- listToMaybe items
- return $ getField "timestamp" p
+ return $ getField "updated" p
-- | Abstract function to render any feed.
@@ -107,18 +108,23 @@
--
renderRss :: FeedConfiguration -- ^ Feed configuration
-> Compiler [Page String] String -- ^ Feed compiler
-renderRss configuration = arr (map renderDate)
+renderRss configuration = arr (map (addUpdated . renderDate))
>>> renderFeed "templates/rss.xml" "templates/rss-item.xml" configuration
where
- renderDate = renderDateField "timestamp" "%a, %d %b %Y %H:%M:%S UT"
+ renderDate = renderDateField "published" "%a, %d %b %Y %H:%M:%S UT"
"No date found."
-- | Render an Atom feed with a number of items.
--
renderAtom :: FeedConfiguration -- ^ Feed configuration
-> Compiler [Page String] String -- ^ Feed compiler
-renderAtom configuration = arr (map renderDate)
+renderAtom configuration = arr (map (addUpdated . renderDate))
>>> renderFeed "templates/atom.xml" "templates/atom-item.xml" configuration
where
- renderDate = renderDateField "timestamp" "%Y-%m-%dT%H:%M:%SZ"
+ renderDate = renderDateField "published" "%Y-%m-%dT%H:%M:%SZ"
"No date found."
+
+-- | Copies @$updated$@ from @$published$@ if it is not already set.
+--
+addUpdated :: Page a -> Page a
+addUpdated page = trySetField "updated" (getField "published" page) page
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Page/Metadata.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Page/Metadata.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Page/Metadata.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Page/Metadata.hs 2012-02-13 10:54:43.000000000 +0000
@@ -16,18 +16,23 @@
, renderModificationTimeWith
, copyBodyToField
, copyBodyFromField
+ , comparePagesByDate
) where
-import Prelude hiding (id)
-import Control.Category (id)
import Control.Arrow (Arrow, arr, (>>>), (***), (&&&))
+import Control.Category (id)
+import Control.Monad (msum)
import Data.List (intercalate)
import Data.Maybe (fromMaybe)
-import Data.Time.Clock (UTCTime)
-import Data.Time.Format (parseTime, formatTime)
-import qualified Data.Map as M
+import Data.Ord (comparing)
+import Prelude hiding (id)
import System.FilePath (takeFileName)
import System.Locale (TimeLocale, defaultTimeLocale)
+import qualified Data.Map as M
+
+import Data.Time.Calendar (Day (..))
+import Data.Time.Clock (UTCTime (..))
+import Data.Time.Format (parseTime, formatTime)
import Hakyll.Web.Page.Internal
import Hakyll.Core.Util.String
@@ -118,11 +123,23 @@
-> Page a -- ^ Resulting page
copyField src dst = renderField src dst id
--- | When the metadata has a field called @path@ in a
--- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages),
--- this function can render the date.
+-- | When the metadata has a field called @published@ in one of the
+-- following formats then this function can render the date.
+--
+-- * @Sun, 01 Feb 2000 13:00:00 UT@ (RSS date format)
--
--- > renderDate "date" "%B %e, %Y" "Date unknown"
+-- * @2000-02-01T13:00:00Z@ (Atom date format)
+--
+-- * @February 1, 2000 1:00 PM@ (PM is usually uppercase)
+--
+-- * @February 1, 2000@ (assumes 12:00 AM for the time)
+--
+-- Alternatively, when the metadata has a field called @path@ in a
+-- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages)
+-- and no @published@ metadata field set, this function can render
+-- the date.
+--
+-- > renderDateField "date" "%B %e, %Y" "Date unknown"
--
-- Will render something like @January 32, 2010@.
--
@@ -143,19 +160,31 @@
-> String -- ^ Default value
-> Page a -- ^ Target page
-> Page a -- ^ Resulting page
-renderDateFieldWith locale key format defaultValue =
- renderField "path" key renderDate'
+renderDateFieldWith locale key format defaultValue page =
+ setField key renderTimeString page
where
- renderDate' filePath = fromMaybe defaultValue $ do
- let dateString = intercalate "-" $ take 3
- $ splitAll "-" $ takeFileName filePath
- time <- parseTime defaultTimeLocale
- "%Y-%m-%d"
- dateString :: Maybe UTCTime
+ renderTimeString = fromMaybe defaultValue $ do
+ time <- getUTCMaybe locale page
return $ formatTime locale format time
+-- | Parser to try to extract and parse the time from the @published@
+-- field or from the filename. See 'renderDateField' for more information.
+getUTCMaybe :: TimeLocale -- ^ Output time locale
+ -> Page a -- ^ Input page
+ -> Maybe UTCTime -- ^ Parsed UTCTime
+getUTCMaybe locale page = msum
+ [ fromPublished "%a, %d %b %Y %H:%M:%S UT"
+ , fromPublished "%Y-%m-%dT%H:%M:%SZ"
+ , fromPublished "%B %e, %Y %l:%M %p"
+ , fromPublished "%B %e, %Y"
+ , getFieldMaybe "path" page >>= parseTime' "%Y-%m-%d" .
+ intercalate "-" . take 3 . splitAll "-" . takeFileName
+ ]
+ where
+ fromPublished f = getFieldMaybe "published" page >>= parseTime' f
+ parseTime' f str = parseTime locale f str
+
-- | Set the modification time as a field in the page
---
renderModificationTime :: String
-- ^ Destination key
-> String
@@ -189,3 +218,11 @@
-> Page String -- ^ Target page
-> Page String -- ^ Resulting page
copyBodyFromField key page = fmap (const $ getField key page) page
+
+-- | Compare pages by the date and time parsed as in 'renderDateField',
+-- where 'LT' implies earlier, and 'GT' implies later. For more details,
+-- see 'renderDateField'.
+comparePagesByDate :: Page a -> Page a -> Ordering
+comparePagesByDate = comparing $ fromMaybe zero . getUTCMaybe defaultTimeLocale
+ where
+ zero = UTCTime (ModifiedJulianDay 0) 0
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Pandoc/Biblio.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Pandoc/Biblio.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Pandoc/Biblio.hs 1970-01-01 00:00:00.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Pandoc/Biblio.hs 2012-02-13 10:54:43.000000000 +0000
@@ -0,0 +1,73 @@
+-- | Wraps pandocs bibiliography handling
+--
+-- In order to add a bibliography, you will need a bibliography file (e.g.
+-- @.bib@) and a CSL file (@.csl@). Both need to be compiled with their
+-- respective compilers ('biblioCompiler' and 'cslCompiler'). Then, you can
+-- refer to these files when you use 'pageReadPandocBiblio'. This function also
+-- takes a parser state for completeness -- you can use
+-- 'defaultHakyllParserState' if you're unsure.
+--
+{-# LANGUAGE Arrows, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
+module Hakyll.Web.Pandoc.Biblio
+ ( CSL
+ , cslCompiler
+ , Biblio (..)
+ , biblioCompiler
+ , pageReadPandocBiblio
+ ) where
+
+import Control.Applicative ((<$>))
+import Control.Arrow (arr, returnA)
+import Data.Typeable (Typeable)
+
+import Data.Binary (Binary (..))
+import Text.Pandoc (Pandoc, ParserState (..))
+import Text.Pandoc.Biblio (processBiblio)
+import qualified Text.CSL as CSL
+
+import Hakyll.Core.Compiler
+import Hakyll.Core.Identifier
+import Hakyll.Core.Resource
+import Hakyll.Core.Writable
+import Hakyll.Web.Page
+import Hakyll.Web.Pandoc
+
+newtype CSL = CSL FilePath
+ deriving (Binary, Show, Typeable, Writable)
+
+cslCompiler :: Compiler Resource CSL
+cslCompiler = arr (CSL . unResource)
+
+newtype Biblio = Biblio [CSL.Reference]
+ deriving (Show, Typeable)
+
+instance Binary Biblio where
+ -- Ugly.
+ get = Biblio . read <$> get
+ put (Biblio rs) = put $ show rs
+
+instance Writable Biblio where
+ write _ _ = return ()
+
+biblioCompiler :: Compiler Resource Biblio
+biblioCompiler = unsafeCompiler $
+ fmap Biblio . CSL.readBiblioFile . unResource
+
+pageReadPandocBiblio :: ParserState
+ -> Identifier CSL
+ -> Identifier Biblio
+ -> Compiler (Page String) (Page Pandoc)
+pageReadPandocBiblio state csl refs = proc page -> do
+ CSL csl' <- require_ csl -< ()
+ Biblio refs' <- require_ refs -< ()
+ -- We need to know the citation keys, add then *before* actually parsing the
+ -- actual page. If we don't do this, pandoc won't even consider them
+ -- citations!
+ let cits = map CSL.refId refs'
+ state' = state {stateCitations = stateCitations state ++ cits}
+ pandocPage <- pageReadPandocWithA -< (state', page)
+ let pandoc = pageBody pandocPage
+ pandoc' <- unsafeCompiler processBiblio' -< (csl', refs', pandoc)
+ returnA -< pandocPage {pageBody = pandoc'}
+ where
+ processBiblio' (c, r, p) = processBiblio c Nothing r p
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Pandoc/FileType.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Pandoc/FileType.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Pandoc/FileType.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Pandoc/FileType.hs 2012-02-13 10:54:43.000000000 +0000
@@ -16,14 +16,15 @@
-- default
--
data FileType
- = Html
+ = Binary
+ | Css
+ | Html
| LaTeX
| LiterateHaskell FileType
| Markdown
- | Rst
+ | OrgMode
| PlainText
- | Css
- | Binary
+ | Rst
deriving (Eq, Ord, Show, Read)
-- | Get the file type for a certain file. The type is determined by extension.
@@ -31,6 +32,7 @@
fileType :: FilePath -> FileType
fileType = fileType' . takeExtension
where
+ fileType' ".css" = Css
fileType' ".htm" = Html
fileType' ".html" = Html
fileType' ".lhs" = LiterateHaskell Markdown
@@ -41,12 +43,12 @@
fileType' ".mdwn" = Markdown
fileType' ".mkd" = Markdown
fileType' ".mkdwn" = Markdown
+ fileType' ".org" = OrgMode
fileType' ".page" = Markdown
fileType' ".rst" = Rst
fileType' ".tex" = LaTeX
fileType' ".text" = PlainText
fileType' ".txt" = PlainText
- fileType' ".css" = Css
fileType' _ = Binary -- Treat unknown files as binary
-- | Get the file type for the current file
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Pandoc.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Pandoc.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Pandoc.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Pandoc.hs 2012-02-13 10:54:43.000000000 +0000
@@ -10,6 +10,7 @@
-- * Functions working on pages/compilers
, pageReadPandoc
, pageReadPandocWith
+ , pageReadPandocWithA
, pageRenderPandoc
, pageRenderPandocWith
@@ -20,7 +21,7 @@
import Prelude hiding (id)
import Control.Applicative ((<$>))
-import Control.Arrow ((>>^), (&&&))
+import Control.Arrow ((>>>), (>>^), (&&&), (***))
import Control.Category (id)
import Data.Maybe (fromMaybe)
@@ -28,6 +29,7 @@
import Hakyll.Core.Compiler
import Hakyll.Core.Identifier
+import Hakyll.Core.Util.Arrow
import Hakyll.Web.Pandoc.FileType
import Hakyll.Web.Page.Internal
@@ -78,10 +80,16 @@
-- | Read the resource using pandoc
--
pageReadPandocWith :: ParserState -> Compiler (Page String) (Page Pandoc)
-pageReadPandocWith state =
- id &&& getIdentifier &&& getFileType >>^ pageReadPandocWith'
+pageReadPandocWith state = constA state &&& id >>> pageReadPandocWithA
+
+-- | Read the resource using pandoc. This is a (rarely needed) variant, which
+-- comes in very useful when the parser state is the result of some arrow.
+--
+pageReadPandocWithA :: Compiler (ParserState, Page String) (Page Pandoc)
+pageReadPandocWithA =
+ id *** id &&& getIdentifier &&& getFileType >>^ pageReadPandocWithA'
where
- pageReadPandocWith' (p, (i, t)) = readPandocWith state t (Just i) <$> p
+ pageReadPandocWithA' (s, (p, (i, t))) = readPandocWith s t (Just i) <$> p
-- | Render the resource using pandoc
--
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Preview/Server.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Preview/Server.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Preview/Server.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Preview/Server.hs 2012-02-13 10:54:43.000000000 +0000
@@ -7,25 +7,21 @@
import Control.Monad.Trans (liftIO)
-import Snap.Types (Snap)
-import Snap.Util.FileServe ( DirectoryConfig (..), fancyDirectoryConfig
- , serveDirectoryWith
- )
-import Snap.Http.Server ( httpServe, setAccessLog, setErrorLog
- , setPort, emptyConfig
- )
+import qualified Snap.Core as Snap
+import qualified Snap.Http.Server as Snap
+import qualified Snap.Util.FileServe as Snap
-- | Serve a given directory
--
static :: FilePath -- ^ Directory to serve
-> (FilePath -> IO ()) -- ^ Pre-serve hook
- -> Snap ()
+ -> Snap.Snap ()
static directory preServe =
- serveDirectoryWith directoryConfig directory
+ Snap.serveDirectoryWith directoryConfig directory
where
- directoryConfig :: DirectoryConfig Snap
- directoryConfig = fancyDirectoryConfig
- { preServeHook = liftIO . preServe
+ directoryConfig :: Snap.DirectoryConfig Snap.Snap
+ directoryConfig = Snap.fancyDirectoryConfig
+ { Snap.preServeHook = liftIO . preServe
}
-- | Main method, runs a static server in the given directory
@@ -35,10 +31,10 @@
-> Int -- ^ Port to listen on
-> IO () -- ^ Blocks forever
staticServer directory preServe port =
- httpServe config $ static directory preServe
+ Snap.httpServe config $ static directory preServe
where
-- Snap server config
- config = setPort port
- $ setAccessLog Nothing
- $ setErrorLog Nothing
- $ emptyConfig
+ config = Snap.setPort port
+ $ Snap.setAccessLog Snap.ConfigNoLog
+ $ Snap.setErrorLog Snap.ConfigNoLog
+ $ Snap.emptyConfig
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Tags.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Tags.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Tags.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Tags.hs 2012-02-13 10:54:43.000000000 +0000
@@ -35,13 +35,17 @@
, renderTagList
, renderTagsField
, renderCategoryField
+ , sortTagsBy
+ , caseInsensitiveTags
) where
import Prelude hiding (id)
import Control.Category (id)
import Control.Applicative ((<$>))
+import Data.Char (toLower)
+import Data.Ord (comparing)
import qualified Data.Map as M
-import Data.List (intersperse, intercalate)
+import Data.List (intersperse, intercalate, sortBy)
import Control.Arrow (arr, (&&&), (>>>), (***), (<<^), returnA)
import Data.Maybe (catMaybes, fromMaybe)
import Data.Monoid (mconcat)
@@ -170,7 +174,7 @@
renderTagList makeUrl = renderTags makeUrl makeLink (intercalate ", ")
where
makeLink tag url count _ _ = renderHtml $
- H.a ! A.href (toValue url) $ toHtml (tag ++ "(" ++ show count ++ ")")
+ H.a ! A.href (toValue url) $ toHtml (tag ++ " (" ++ show count ++ ")")
-- | Render tags with links
--
@@ -206,3 +210,15 @@
-> (String -> Identifier a) -- ^ Create a category link
-> Compiler (Page a) (Page a) -- ^ Resulting compiler
renderCategoryField = renderTagsFieldWith getCategory
+
+-- | Sort tags using supplied function. First element of the tuple passed to
+-- the comparing function is the actual tag name.
+--
+sortTagsBy :: ((String, [Page a]) -> (String, [Page a]) -> Ordering)
+ -> Compiler (Tags a) (Tags a)
+sortTagsBy f = arr $ Tags . sortBy f . tagsMap
+
+-- | Sample sorting function that compares tags case insensitively.
+--
+caseInsensitiveTags :: (String, [Page a]) -> (String, [Page a]) -> Ordering
+caseInsensitiveTags = comparing $ map toLower . fst
diff -Nru haskell-hakyll-3.2.0.9/src/Hakyll/Web/Template.hs haskell-hakyll-3.2.6.1/src/Hakyll/Web/Template.hs
--- haskell-hakyll-3.2.0.9/src/Hakyll/Web/Template.hs 2011-10-05 10:00:04.000000000 +0000
+++ haskell-hakyll-3.2.6.1/src/Hakyll/Web/Template.hs 2012-02-13 10:54:43.000000000 +0000
@@ -39,15 +39,35 @@
--
-- In addition to the native format, Hakyll also supports hamlet templates. For
-- more information on hamlet templates, please refer to:
--- .
+-- . Internally, hamlet templates are
+-- converted to hakyll templates -- which means that you can only use variable
+-- insertion (and not all hamlet's features).
+--
+-- This is an example of a valid hamlet template. You should place them in
+-- files with a @.hamlet@ extension:
+--
+-- > !!!
+-- >
+-- >
+-- >
+-- > MyAweSomeCompany - #{title}
+-- >
+-- >