Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-haskell/hakyll/files/
Date: Thu, 22 Apr 2021 18:36:08
Message-Id: 1619116561.ae8ed2448bd62f5ab8f23bab1fdf0599c9d82dbb.slyfox@gentoo
1 commit: ae8ed2448bd62f5ab8f23bab1fdf0599c9d82dbb
2 Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
3 AuthorDate: Thu Apr 22 18:13:04 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 22 18:36:01 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae8ed244
7
8 dev-haskell/hakyll: remove unused patch(es)
9
10 Package-Manager: Portage-3.0.18, Repoman-3.0.3
11 Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
12 Closes: https://github.com/gentoo/gentoo/pull/20503
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 .../hakyll/files/hakyll-4.13.4.1-pandoc-2.11.patch | 209 ---------------------
16 1 file changed, 209 deletions(-)
17
18 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
19 deleted file mode 100644
20 index 1598c89c899..00000000000
21 --- a/dev-haskell/hakyll/files/hakyll-4.13.4.1-pandoc-2.11.patch
22 +++ /dev/null
23 @@ -1,209 +0,0 @@
24 -From 77afcbc2937a4ee5db9666c1f3e0c090914d3980 Mon Sep 17 00:00:00 2001
25 -From: Jasper Van der Jeugt <m@×××××××××.be>
26 -Date: Sun, 6 Dec 2020 19:24:06 +0100
27 -Subject: [PATCH] Pandoc 2.11 compatibility (#826)
28 -
29 -* Pandoc 2.11 compatibility
30 -
31 -* Bump stack.yaml
32 -
33 -* Bump stack dependencies
34 ----
35 - lib/Hakyll/Web/Pandoc/Biblio.hs | 102 +++++++++++++++++---------------
36 - lib/Hakyll/Web/Pandoc/Binary.hs | 12 ----
37 - 5 files changed, 123 insertions(+), 86 deletions(-)
38 -diff --git a/lib/Hakyll/Web/Pandoc/Biblio.hs b/lib/Hakyll/Web/Pandoc/Biblio.hs
39 -index 5127d881..567f478b 100644
40 ---- a/lib/Hakyll/Web/Pandoc/Biblio.hs
41 -+++ b/lib/Hakyll/Web/Pandoc/Biblio.hs
42 -@@ -12,6 +12,7 @@
43 - {-# LANGUAGE Arrows #-}
44 - {-# LANGUAGE DeriveDataTypeable #-}
45 - {-# LANGUAGE GeneralizedNewtypeDeriving #-}
46 -+{-# LANGUAGE OverloadedStrings #-}
47 - module Hakyll.Web.Pandoc.Biblio
48 - ( CSL
49 - , cslCompiler
50 -@@ -23,33 +24,31 @@ module Hakyll.Web.Pandoc.Biblio
51 -
52 -
53 - --------------------------------------------------------------------------------
54 --import Control.Monad (liftM, replicateM)
55 --import Data.Binary (Binary (..))
56 --import Data.Typeable (Typeable)
57 -+import Control.Monad (liftM)
58 -+import Data.Binary (Binary (..))
59 -+import qualified Data.ByteString as B
60 -+import qualified Data.ByteString.Lazy as BL
61 -+import qualified Data.Map as Map
62 -+import qualified Data.Time as Time
63 -+import Data.Typeable (Typeable)
64 - import Hakyll.Core.Compiler
65 - import Hakyll.Core.Compiler.Internal
66 - import Hakyll.Core.Identifier
67 - import Hakyll.Core.Item
68 --import Hakyll.Core.Provider
69 - import Hakyll.Core.Writable
70 - import Hakyll.Web.Pandoc
71 --import Hakyll.Web.Pandoc.Binary ()
72 --import qualified Text.CSL as CSL
73 --import Text.CSL.Pandoc (processCites)
74 --import Text.Pandoc (Pandoc, ReaderOptions (..),
75 -- enableExtension, Extension (..))
76 -+import Text.Pandoc (Extension (..), Pandoc,
77 -+ ReaderOptions (..),
78 -+ enableExtension)
79 -+import qualified Text.Pandoc as Pandoc
80 -+import qualified Text.Pandoc.Citeproc as Pandoc (processCitations)
81 -
82 -
83 - --------------------------------------------------------------------------------
84 --data CSL = CSL
85 -- deriving (Show, Typeable)
86 -+newtype CSL = CSL {unCSL :: B.ByteString}
87 -+ deriving (Binary, Show, Typeable)
88 -
89 -
90 ----------------------------------------------------------------------------------
91 --instance Binary CSL where
92 -- put CSL = return ()
93 -- get = return CSL
94 --
95 -
96 - --------------------------------------------------------------------------------
97 - instance Writable CSL where
98 -@@ -59,21 +58,12 @@ instance Writable CSL where
99 -
100 - --------------------------------------------------------------------------------
101 - cslCompiler :: Compiler (Item CSL)
102 --cslCompiler = makeItem CSL
103 --
104 --
105 ----------------------------------------------------------------------------------
106 --newtype Biblio = Biblio [CSL.Reference]
107 -- deriving (Show, Typeable)
108 -+cslCompiler = fmap (CSL . BL.toStrict) <$> getResourceLBS
109 -
110 -
111 - --------------------------------------------------------------------------------
112 --instance Binary Biblio where
113 -- -- Ugly.
114 -- get = do
115 -- len <- get
116 -- Biblio <$> replicateM len get
117 -- put (Biblio rs) = put (length rs) >> mapM_ put rs
118 -+newtype Biblio = Biblio {unBiblio :: B.ByteString}
119 -+ deriving (Binary, Show, Typeable)
120 -
121 -
122 - --------------------------------------------------------------------------------
123 -@@ -84,12 +74,7 @@ instance Writable Biblio where
124 -
125 - --------------------------------------------------------------------------------
126 - biblioCompiler :: Compiler (Item Biblio)
127 --biblioCompiler = do
128 -- filePath <- getResourceFilePath
129 -- makeItem =<< unsafeCompiler (Biblio <$> CSL.readBiblioFile idpred filePath)
130 -- where
131 -- -- This is a filter on citations. We include all citations.
132 -- idpred = const True
133 -+biblioCompiler = fmap (Biblio . BL.toStrict) <$> getResourceLBS
134 -
135 -
136 - --------------------------------------------------------------------------------
137 -@@ -99,19 +84,42 @@ readPandocBiblio :: ReaderOptions
138 - -> (Item String)
139 - -> Compiler (Item Pandoc)
140 - readPandocBiblio ropt csl biblio item = do
141 -- -- Parse CSL file, if given
142 -- provider <- compilerProvider <$> compilerAsk
143 -- style <- unsafeCompiler $
144 -- CSL.readCSLFile Nothing . (resourceFilePath provider) . itemIdentifier $ csl
145 --
146 -- -- We need to know the citation keys, add then *before* actually parsing the
147 -- -- actual page. If we don't do this, pandoc won't even consider them
148 -- -- citations!
149 -- let Biblio refs = itemBody biblio
150 -- pandoc <- itemBody <$> readPandocWith ropt item
151 -- let pandoc' = processCites style refs pandoc
152 --
153 -- return $ fmap (const pandoc') item
154 -+ -- It's not straightforward to use the Pandoc API as of 2.11 to deal with
155 -+ -- citations, since it doesn't export many things in 'Text.Pandoc.Citeproc'.
156 -+ -- The 'citeproc' package is also hard to use.
157 -+ --
158 -+ -- So instead, we try treating Pandoc as a black box. Pandoc can read
159 -+ -- specific csl and bilbio files based on metadata keys.
160 -+ --
161 -+ -- So we load the CSL and Biblio files and pass them to Pandoc using the
162 -+ -- ersatz filesystem.
163 -+ Pandoc.Pandoc (Pandoc.Meta meta) blocks <- itemBody <$>
164 -+ readPandocWith ropt item
165 -+
166 -+ let cslFile = Pandoc.FileInfo zeroTime . unCSL $ itemBody csl
167 -+ bibFile = Pandoc.FileInfo zeroTime . unBiblio $ itemBody biblio
168 -+ addBiblioFiles = \st -> st
169 -+ { Pandoc.stFiles =
170 -+ Pandoc.insertInFileTree "_hakyll/style.csl" cslFile .
171 -+ Pandoc.insertInFileTree "_hakyll/refs.bib" bibFile $
172 -+ Pandoc.stFiles st
173 -+ }
174 -+ biblioMeta = Pandoc.Meta .
175 -+ Map.insert "csl" (Pandoc.MetaString "_hakyll/style.csl") .
176 -+ Map.insert "bibliography" (Pandoc.MetaString "_hakyll/refs.bib") $
177 -+ meta
178 -+ errOrPandoc = Pandoc.runPure $ do
179 -+ Pandoc.modifyPureState addBiblioFiles
180 -+ Pandoc.processCitations $ Pandoc.Pandoc biblioMeta blocks
181 -+
182 -+ pandoc <- case errOrPandoc of
183 -+ Left e -> compilerThrow ["Error during processCitations: " ++ show e]
184 -+ Right x -> return x
185 -+
186 -+ return $ fmap (const pandoc) item
187 -+
188 -+ where
189 -+ zeroTime = Time.UTCTime (toEnum 0) 0
190 -
191 - --------------------------------------------------------------------------------
192 - pandocBiblioCompiler :: String -> String -> Compiler (Item String)
193 -diff --git a/lib/Hakyll/Web/Pandoc/Binary.hs b/lib/Hakyll/Web/Pandoc/Binary.hs
194 -index 5d3efead..3f7f4fb5 100644
195 ---- a/lib/Hakyll/Web/Pandoc/Binary.hs
196 -+++ b/lib/Hakyll/Web/Pandoc/Binary.hs
197 -@@ -4,9 +4,6 @@ module Hakyll.Web.Pandoc.Binary where
198 -
199 - import Data.Binary (Binary (..))
200 -
201 --import qualified Text.CSL as CSL
202 --import qualified Text.CSL.Reference as REF
203 --import qualified Text.CSL.Style as STY
204 - import Text.Pandoc
205 -
206 - --------------------------------------------------------------------------------
207 -@@ -18,7 +15,6 @@ instance Binary Caption
208 - instance Binary Cell
209 - instance Binary ColSpan
210 - instance Binary ColWidth
211 --instance Binary CSL.Reference
212 - instance Binary Citation
213 - instance Binary CitationMode
214 - instance Binary Format
215 -@@ -27,17 +23,9 @@ instance Binary ListNumberDelim
216 - instance Binary ListNumberStyle
217 - instance Binary MathType
218 - instance Binary QuoteType
219 --instance Binary REF.CLabel
220 --instance Binary REF.CNum
221 --instance Binary REF.Literal
222 --instance Binary REF.RefDate
223 --instance Binary REF.RefType
224 --instance Binary REF.Season
225 - instance Binary Row
226 - instance Binary RowHeadColumns
227 - instance Binary RowSpan
228 --instance Binary STY.Agent
229 --instance Binary STY.Formatted
230 - instance Binary TableBody
231 - instance Binary TableFoot
232 - instance Binary TableHead