diff options
-rw-r--r-- | hakyll.cabal | 5 | ||||
-rw-r--r-- | src/Hakyll/Web/Pandoc/Biblio.hs | 8 | ||||
-rw-r--r-- | src/Hakyll/Web/Pandoc/Binary.hs | 31 |
3 files changed, 40 insertions, 4 deletions
diff --git a/hakyll.cabal b/hakyll.cabal index 44c01d1..955bbab 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -137,11 +137,12 @@ Library Hakyll.Core.Util.File Hakyll.Core.Util.Parser Hakyll.Web.Template.Internal + Hakyll.Web.Pandoc.Binary Paths_hakyll Build-Depends: base >= 4 && < 5, - binary >= 0.5 && < 0.8, + binary >= 0.7 && < 0.8, blaze-html >= 0.5 && < 0.8, blaze-markup >= 0.5.1 && < 0.7, bytestring >= 0.9 && < 0.11, @@ -228,7 +229,7 @@ Test-suite hakyll-tests test-framework-quickcheck2 >= 0.3 && < 0.4, -- Copy pasted from hakyll dependencies: base >= 4 && < 5, - binary >= 0.5 && < 0.8, + binary >= 0.7 && < 0.8, blaze-html >= 0.5 && < 0.8, blaze-markup >= 0.5.1 && < 0.7, bytestring >= 0.9 && < 0.11, diff --git a/src/Hakyll/Web/Pandoc/Biblio.hs b/src/Hakyll/Web/Pandoc/Biblio.hs index 6c92f28..c8f075d 100644 --- a/src/Hakyll/Web/Pandoc/Biblio.hs +++ b/src/Hakyll/Web/Pandoc/Biblio.hs @@ -21,6 +21,7 @@ module Hakyll.Web.Pandoc.Biblio -------------------------------------------------------------------------------- import Control.Applicative ((<$>)) +import Control.Monad (replicateM) import Data.Binary (Binary (..)) import Data.Typeable (Typeable) import qualified Text.CSL as CSL @@ -33,6 +34,7 @@ import Hakyll.Core.Identifier import Hakyll.Core.Item import Hakyll.Core.Writable import Hakyll.Web.Pandoc +import Hakyll.Web.Pandoc.Binary () -------------------------------------------------------------------------------- @@ -65,8 +67,10 @@ newtype Biblio = Biblio [CSL.Reference] -------------------------------------------------------------------------------- instance Binary Biblio where -- Ugly. - get = Biblio . read <$> get - put (Biblio rs) = put $ show rs + get = do + len <- get + Biblio <$> replicateM len get + put (Biblio rs) = put (length rs) >> mapM_ put rs -------------------------------------------------------------------------------- diff --git a/src/Hakyll/Web/Pandoc/Binary.hs b/src/Hakyll/Web/Pandoc/Binary.hs new file mode 100644 index 0000000..ec75f77 --- /dev/null +++ b/src/Hakyll/Web/Pandoc/Binary.hs @@ -0,0 +1,31 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# LANGUAGE DeriveGeneric #-} +module Hakyll.Web.Pandoc.Binary where + +import Data.Binary (Binary (..)) + +import qualified Text.CSL as CSL +import qualified Text.CSL.Reference as REF +import qualified Text.CSL.Style as STY +import Text.Pandoc + +-------------------------------------------------------------------------------- +-- orphans + +instance Binary REF.CNum +instance Binary REF.Literal +instance Binary REF.RefDate +instance Binary REF.RefType +instance Binary STY.Agent +instance Binary STY.Formatted +instance Binary Inline +instance Binary Block +instance Binary Citation +instance Binary MathType +instance Binary Alignment +instance Binary CitationMode +instance Binary QuoteType +instance Binary Format +instance Binary ListNumberDelim +instance Binary ListNumberStyle +instance Binary CSL.Reference |