summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-01-18 08:35:10 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2021-01-18 08:36:40 +0000
commit3f88fc21052c6f33a2e93aed24c567aaa6a8af32 (patch)
tree56916d4c30aa3deae8baf7d8359f4ef3c2bf26ee /dev-haskell/hakyll
parentapp-text/pandoc: bump up to 2.11 (diff)
downloadgentoo-3f88fc21052c6f33a2e93aed24c567aaa6a8af32.tar.gz
gentoo-3f88fc21052c6f33a2e93aed24c567aaa6a8af32.tar.bz2
gentoo-3f88fc21052c6f33a2e93aed24c567aaa6a8af32.zip
dev-haskell/hakyll: bump up to 4.13.4.1
Package-Manager: Portage-3.0.13, Repoman-3.0.2 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'dev-haskell/hakyll')
-rw-r--r--dev-haskell/hakyll/Manifest1
-rw-r--r--dev-haskell/hakyll/files/hakyll-4.13.4.1-pandoc-2.11.patch209
-rw-r--r--dev-haskell/hakyll/hakyll-4.13.4.1.ebuild87
3 files changed, 297 insertions, 0 deletions
diff --git a/dev-haskell/hakyll/Manifest b/dev-haskell/hakyll/Manifest
index a6b73ffc3dc6..941255071a39 100644
--- a/dev-haskell/hakyll/Manifest
+++ b/dev-haskell/hakyll/Manifest
@@ -1 +1,2 @@
DIST hakyll-4.13.4.0.tar.gz 105151 BLAKE2B a17ddcc7846d4c50f3ade0d430a0208c6c85d9827e5daa69b1652050313cb62fc87fd8b1547cacacbca5562f4cf172eacd7e641d3921516c4578e0684ae55ee9 SHA512 4ade6776cfee7a8293ba4a659cf8633c0e6641ee2c33db9cdddeaca996ff092d027ce4165e174d7acdeb8485904394d9a899351d9e3c065e4ce7cb5af61ee08a
+DIST hakyll-4.13.4.1.tar.gz 105251 BLAKE2B 6a2c83f2784aad1c80ecce7d01ade1d1bde0546c3f828acc74c88df95b4217f191eb516bf57cc1993bdaebd76629d86d3963bf386f7df68ca5dc17288f3f2b3f SHA512 6045a1461855d46f57a20f7a84636f90e6d151bcbaf09511f10ab66fa0567062e355ff580d1f12a4432bbe517bc9e162d65927f3c343f8f077e81981e7c7973c
diff --git a/dev-haskell/hakyll/files/hakyll-4.13.4.1-pandoc-2.11.patch b/dev-haskell/hakyll/files/hakyll-4.13.4.1-pandoc-2.11.patch
new file mode 100644
index 000000000000..1598c89c8995
--- /dev/null
+++ b/dev-haskell/hakyll/files/hakyll-4.13.4.1-pandoc-2.11.patch
@@ -0,0 +1,209 @@
+From 77afcbc2937a4ee5db9666c1f3e0c090914d3980 Mon Sep 17 00:00:00 2001
+From: Jasper Van der Jeugt <m@jaspervdj.be>
+Date: Sun, 6 Dec 2020 19:24:06 +0100
+Subject: [PATCH] Pandoc 2.11 compatibility (#826)
+
+* Pandoc 2.11 compatibility
+
+* Bump stack.yaml
+
+* Bump stack dependencies
+---
+ lib/Hakyll/Web/Pandoc/Biblio.hs | 102 +++++++++++++++++---------------
+ lib/Hakyll/Web/Pandoc/Binary.hs | 12 ----
+ 5 files changed, 123 insertions(+), 86 deletions(-)
+diff --git a/lib/Hakyll/Web/Pandoc/Biblio.hs b/lib/Hakyll/Web/Pandoc/Biblio.hs
+index 5127d881..567f478b 100644
+--- a/lib/Hakyll/Web/Pandoc/Biblio.hs
++++ b/lib/Hakyll/Web/Pandoc/Biblio.hs
+@@ -12,6 +12,7 @@
+ {-# LANGUAGE Arrows #-}
+ {-# LANGUAGE DeriveDataTypeable #-}
+ {-# LANGUAGE GeneralizedNewtypeDeriving #-}
++{-# LANGUAGE OverloadedStrings #-}
+ module Hakyll.Web.Pandoc.Biblio
+ ( CSL
+ , cslCompiler
+@@ -23,33 +24,31 @@ module Hakyll.Web.Pandoc.Biblio
+
+
+ --------------------------------------------------------------------------------
+-import Control.Monad (liftM, replicateM)
+-import Data.Binary (Binary (..))
+-import Data.Typeable (Typeable)
++import Control.Monad (liftM)
++import Data.Binary (Binary (..))
++import qualified Data.ByteString as B
++import qualified Data.ByteString.Lazy as BL
++import qualified Data.Map as Map
++import qualified Data.Time as Time
++import Data.Typeable (Typeable)
+ import Hakyll.Core.Compiler
+ import Hakyll.Core.Compiler.Internal
+ import Hakyll.Core.Identifier
+ import Hakyll.Core.Item
+-import Hakyll.Core.Provider
+ import Hakyll.Core.Writable
+ import Hakyll.Web.Pandoc
+-import Hakyll.Web.Pandoc.Binary ()
+-import qualified Text.CSL as CSL
+-import Text.CSL.Pandoc (processCites)
+-import Text.Pandoc (Pandoc, ReaderOptions (..),
+- enableExtension, Extension (..))
++import Text.Pandoc (Extension (..), Pandoc,
++ ReaderOptions (..),
++ enableExtension)
++import qualified Text.Pandoc as Pandoc
++import qualified Text.Pandoc.Citeproc as Pandoc (processCitations)
+
+
+ --------------------------------------------------------------------------------
+-data CSL = CSL
+- deriving (Show, Typeable)
++newtype CSL = CSL {unCSL :: B.ByteString}
++ deriving (Binary, Show, Typeable)
+
+
+---------------------------------------------------------------------------------
+-instance Binary CSL where
+- put CSL = return ()
+- get = return CSL
+-
+
+ --------------------------------------------------------------------------------
+ instance Writable CSL where
+@@ -59,21 +58,12 @@ instance Writable CSL where
+
+ --------------------------------------------------------------------------------
+ cslCompiler :: Compiler (Item CSL)
+-cslCompiler = makeItem CSL
+-
+-
+---------------------------------------------------------------------------------
+-newtype Biblio = Biblio [CSL.Reference]
+- deriving (Show, Typeable)
++cslCompiler = fmap (CSL . BL.toStrict) <$> getResourceLBS
+
+
+ --------------------------------------------------------------------------------
+-instance Binary Biblio where
+- -- Ugly.
+- get = do
+- len <- get
+- Biblio <$> replicateM len get
+- put (Biblio rs) = put (length rs) >> mapM_ put rs
++newtype Biblio = Biblio {unBiblio :: B.ByteString}
++ deriving (Binary, Show, Typeable)
+
+
+ --------------------------------------------------------------------------------
+@@ -84,12 +74,7 @@ instance Writable Biblio where
+
+ --------------------------------------------------------------------------------
+ biblioCompiler :: Compiler (Item Biblio)
+-biblioCompiler = do
+- filePath <- getResourceFilePath
+- makeItem =<< unsafeCompiler (Biblio <$> CSL.readBiblioFile idpred filePath)
+- where
+- -- This is a filter on citations. We include all citations.
+- idpred = const True
++biblioCompiler = fmap (Biblio . BL.toStrict) <$> getResourceLBS
+
+
+ --------------------------------------------------------------------------------
+@@ -99,19 +84,42 @@ readPandocBiblio :: ReaderOptions
+ -> (Item String)
+ -> Compiler (Item Pandoc)
+ readPandocBiblio ropt csl biblio item = do
+- -- Parse CSL file, if given
+- provider <- compilerProvider <$> compilerAsk
+- style <- unsafeCompiler $
+- CSL.readCSLFile Nothing . (resourceFilePath provider) . itemIdentifier $ csl
+-
+- -- 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 Biblio refs = itemBody biblio
+- pandoc <- itemBody <$> readPandocWith ropt item
+- let pandoc' = processCites style refs pandoc
+-
+- return $ fmap (const pandoc') item
++ -- It's not straightforward to use the Pandoc API as of 2.11 to deal with
++ -- citations, since it doesn't export many things in 'Text.Pandoc.Citeproc'.
++ -- The 'citeproc' package is also hard to use.
++ --
++ -- So instead, we try treating Pandoc as a black box. Pandoc can read
++ -- specific csl and bilbio files based on metadata keys.
++ --
++ -- So we load the CSL and Biblio files and pass them to Pandoc using the
++ -- ersatz filesystem.
++ Pandoc.Pandoc (Pandoc.Meta meta) blocks <- itemBody <$>
++ readPandocWith ropt item
++
++ let cslFile = Pandoc.FileInfo zeroTime . unCSL $ itemBody csl
++ bibFile = Pandoc.FileInfo zeroTime . unBiblio $ itemBody biblio
++ addBiblioFiles = \st -> st
++ { Pandoc.stFiles =
++ Pandoc.insertInFileTree "_hakyll/style.csl" cslFile .
++ Pandoc.insertInFileTree "_hakyll/refs.bib" bibFile $
++ Pandoc.stFiles st
++ }
++ biblioMeta = Pandoc.Meta .
++ Map.insert "csl" (Pandoc.MetaString "_hakyll/style.csl") .
++ Map.insert "bibliography" (Pandoc.MetaString "_hakyll/refs.bib") $
++ meta
++ errOrPandoc = Pandoc.runPure $ do
++ Pandoc.modifyPureState addBiblioFiles
++ Pandoc.processCitations $ Pandoc.Pandoc biblioMeta blocks
++
++ pandoc <- case errOrPandoc of
++ Left e -> compilerThrow ["Error during processCitations: " ++ show e]
++ Right x -> return x
++
++ return $ fmap (const pandoc) item
++
++ where
++ zeroTime = Time.UTCTime (toEnum 0) 0
+
+ --------------------------------------------------------------------------------
+ pandocBiblioCompiler :: String -> String -> Compiler (Item String)
+diff --git a/lib/Hakyll/Web/Pandoc/Binary.hs b/lib/Hakyll/Web/Pandoc/Binary.hs
+index 5d3efead..3f7f4fb5 100644
+--- a/lib/Hakyll/Web/Pandoc/Binary.hs
++++ b/lib/Hakyll/Web/Pandoc/Binary.hs
+@@ -4,9 +4,6 @@ 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
+
+ --------------------------------------------------------------------------------
+@@ -18,7 +15,6 @@ instance Binary Caption
+ instance Binary Cell
+ instance Binary ColSpan
+ instance Binary ColWidth
+-instance Binary CSL.Reference
+ instance Binary Citation
+ instance Binary CitationMode
+ instance Binary Format
+@@ -27,17 +23,9 @@ instance Binary ListNumberDelim
+ instance Binary ListNumberStyle
+ instance Binary MathType
+ instance Binary QuoteType
+-instance Binary REF.CLabel
+-instance Binary REF.CNum
+-instance Binary REF.Literal
+-instance Binary REF.RefDate
+-instance Binary REF.RefType
+-instance Binary REF.Season
+ instance Binary Row
+ instance Binary RowHeadColumns
+ instance Binary RowSpan
+-instance Binary STY.Agent
+-instance Binary STY.Formatted
+ instance Binary TableBody
+ instance Binary TableFoot
+ instance Binary TableHead
diff --git a/dev-haskell/hakyll/hakyll-4.13.4.1.ebuild b/dev-haskell/hakyll/hakyll-4.13.4.1.ebuild
new file mode 100644
index 000000000000..87f239ca1460
--- /dev/null
+++ b/dev-haskell/hakyll/hakyll-4.13.4.1.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# ebuild generated by hackport 0.6.7.9999
+
+CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
+inherit haskell-cabal
+
+DESCRIPTION="A static website compiler library"
+HOMEPAGE="https://jaspervdj.be/hakyll"
+SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="buildwebsite +checkexternal +previewserver +usepandoc +watchserver"
+
+RDEPEND=">=dev-haskell/blaze-html-0.5:=[profile?] <dev-haskell/blaze-html-0.10:=[profile?]
+ >=dev-haskell/blaze-markup-0.5.1:=[profile?] <dev-haskell/blaze-markup-0.9:=[profile?]
+ >=dev-haskell/cryptonite-0.25:=[profile?] <dev-haskell/cryptonite-0.28:=[profile?]
+ >=dev-haskell/data-default-0.4:=[profile?] <dev-haskell/data-default-0.8:=[profile?]
+ >=dev-haskell/file-embed-0.0.10.1:=[profile?] <dev-haskell/file-embed-0.0.14:=[profile?]
+ >=dev-haskell/lrucache-1.1.1:=[profile?] <dev-haskell/lrucache-1.3:=[profile?]
+ >=dev-haskell/memory-0.14.18:=[profile?] <dev-haskell/memory-0.16:=[profile?]
+ >=dev-haskell/mtl-1:=[profile?] <dev-haskell/mtl-2.3:=[profile?]
+ >=dev-haskell/network-uri-2.6:=[profile?] <dev-haskell/network-uri-2.7:=[profile?]
+ >=dev-haskell/optparse-applicative-0.12:=[profile?] <dev-haskell/optparse-applicative-0.16:=[profile?]
+ >=dev-haskell/parsec-3.0:=[profile?] <dev-haskell/parsec-3.2:=[profile?]
+ >=dev-haskell/random-1.0:=[profile?] <dev-haskell/random-1.2:=[profile?]
+ >=dev-haskell/regex-tdfa-1.1:=[profile?] <dev-haskell/regex-tdfa-1.4:=[profile?]
+ >=dev-haskell/resourcet-1.1:=[profile?] <dev-haskell/resourcet-1.3:=[profile?]
+ >=dev-haskell/scientific-0.3.4:=[profile?] <dev-haskell/scientific-0.4:=[profile?]
+ >=dev-haskell/tagsoup-0.13.1:=[profile?] <dev-haskell/tagsoup-0.15:=[profile?]
+ >=dev-haskell/text-0.11:=[profile?] <dev-haskell/text-1.3:=[profile?]
+ >=dev-haskell/time-locale-compat-0.1:=[profile?] <dev-haskell/time-locale-compat-0.2:=[profile?]
+ >=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
+ >=dev-haskell/vector-0.11:=[profile?] <dev-haskell/vector-0.13:=[profile?]
+ >=dev-haskell/yaml-0.8.11:=[profile?] <dev-haskell/yaml-0.12:=[profile?]
+ >=dev-lang/ghc-8.6.3:=
+ buildwebsite? ( >=app-text/pandoc-2.11:=[profile?] <app-text/pandoc-2.12:=[profile?] )
+ checkexternal? ( >=dev-haskell/http-conduit-2.2:=[profile?] <dev-haskell/http-conduit-2.4:=[profile?] )
+ previewserver? ( >=dev-haskell/fsnotify-0.2:=[profile?] <dev-haskell/fsnotify-0.4:=[profile?]
+ >=dev-haskell/http-types-0.9:=[profile?] <dev-haskell/http-types-0.13:=[profile?]
+ >=dev-haskell/wai-3.2:=[profile?] <dev-haskell/wai-3.3:=[profile?]
+ >=dev-haskell/wai-app-static-3.1:=[profile?] <dev-haskell/wai-app-static-3.2:=[profile?]
+ >=dev-haskell/warp-3.2:=[profile?] <dev-haskell/warp-3.4:=[profile?] )
+ !previewserver? ( checkexternal? ( >=dev-haskell/http-types-0.7:=[profile?] <dev-haskell/http-types-0.13:=[profile?] )
+ watchserver? ( >=dev-haskell/fsnotify-0.2:=[profile?] <dev-haskell/fsnotify-0.4:=[profile?] ) )
+ usepandoc? ( >=app-text/pandoc-2.11:=[profile?] <app-text/pandoc-2.12:=[profile?] )
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-2.4.0.1
+ test? ( >=dev-haskell/quickcheck-2.8 <dev-haskell/quickcheck-2.15
+ >=dev-haskell/tasty-0.11 <dev-haskell/tasty-1.4
+ >=dev-haskell/tasty-hunit-0.9 <dev-haskell/tasty-hunit-0.11
+ >=dev-haskell/tasty-quickcheck-0.8 <dev-haskell/tasty-quickcheck-0.11 )
+"
+
+PATCHES=( "${FILESDIR}"/${P}-pandoc-2.11.patch )
+
+src_prepare() {
+ default
+
+ cabal_chdeps \
+ 'pandoc >= 2.10 && < 2.11,' 'pandoc >= 2.11' \
+ 'pandoc >= 2.10 && < 2.11' 'pandoc >= 2.11' \
+ 'pandoc-citeproc >= 0.14 && < 0.18' ' ' \
+ 'file-embed >= 0.0.10.1 && < 0.0.12' 'file-embed >= 0.0.10.1'
+}
+
+src_configure() {
+ haskell-cabal_src_configure \
+ $(cabal_flag buildwebsite buildwebsite) \
+ $(cabal_flag checkexternal checkexternal) \
+ $(cabal_flag previewserver previewserver) \
+ $(cabal_flag usepandoc usepandoc) \
+ $(cabal_flag watchserver watchserver)
+}
+
+src_test() {
+ # unixFilter test expects 'option' output in error message
+ # But it's a localized string that:
+ # https://github.com/jaspervdj/hakyll/issues/607
+ LANGUAGE=en haskell-cabal_src_test
+}