git.iko.soy/typeable/pandoc
on master help sign in
ALlow compilation with haddock-library 1.4 and above.

haddock-library-1.6 requires Cabal >= 2.0. This change allows systems with older Cabal versions to build pandoc.

commit50c71b5bc5db797ac46550ed54e91196269716e3 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 30 May 2018, 13:06 (8 years ago) parent7119715
2 files changed+15−2
pandoc.cabal+1−1 src/Text/Pandoc/Readers/Haddock.hs+14−1
pandoc.cabal+1−1
@@ -380,7 +380,7 @@ library
380380 hslua-module-text >= 0.1.2 && < 0.2,
381381 binary >= 0.5 && < 0.10,
382382 SHA >= 1.6 && < 1.7,
383− haddock-library >= 1.6 && < 1.7,
383+ haddock-library >= 1.4 && < 1.7,
384384 deepseq >= 1.3 && < 1.5,
385385 JuicyPixels >= 3.1.6.1 && < 3.3,
386386 Glob >= 0.7 && < 0.10,
src/Text/Pandoc/Readers/Haddock.hs+14−1
@@ -44,7 +44,13 @@ readHaddockEither :: ReaderOptions -- ^ Reader options
4444 -> String -- ^ String to parse
4545 -> Either PandocError Pandoc
4646readHaddockEither _opts =
47+#if MIN_VERSION_haddock_library(1,6,0)
4748 Right . B.doc . docHToBlocks . _doc . parseParas Nothing
49+#elif MIN_VERSION_haddock_library(1,2,0)
50+ Right . B.doc . docHToBlocks . _doc . parseParas
51+#else
52+ Right . B.doc . docHToBlocks . parseParas
53+#endif
4854
4955docHToBlocks :: DocH String Identifier -> Blocks
5056docHToBlocks d' =
@@ -64,8 +70,10 @@ docHToBlocks d' =
6470 DocEmphasis _ -> inlineFallback
6571 DocMonospaced _ -> inlineFallback
6672 DocBold _ -> inlineFallback
73+#if MIN_VERSION_haddock_library(1,4,0)
6774 DocMathInline _ -> inlineFallback
6875 DocMathDisplay _ -> inlineFallback
76+#endif
6977 DocHeader h -> B.header (headerLevel h)
7078 (docHToInlines False $ headerTitle h)
7179 DocUnorderedList items -> B.bulletList (map docHToBlocks items)
@@ -81,6 +89,7 @@ docHToBlocks d' =
8189 DocProperty s -> B.codeBlockWith ("",["property","haskell"],[]) (trim s)
8290 DocExamples es -> mconcat $ map (\e ->
8391 makeExample ">>>" (exampleExpression e) (exampleResult e)) es
92+#if MIN_VERSION_haddock_library(1,5,0)
8493 DocTable H.Table{ tableHeaderRows = headerRows
8594 , tableBodyRows = bodyRows
8695 }
@@ -93,7 +102,7 @@ docHToBlocks d' =
93102 colspecs = replicate (maximum (map length body))
94103 (AlignDefault, 0.0)
95104 in B.table mempty colspecs header body
96−
105+#endif
97106 where inlineFallback = B.plain $ docHToInlines False d'
98107 consolidatePlains = B.fromList . consolidatePlains' . B.toList
99108 consolidatePlains' zs@(Plain _ : _) =
@@ -125,8 +134,10 @@ docHToInlines isCode d' =
125134 DocMonospaced (DocString s) -> B.code s
126135 DocMonospaced d -> docHToInlines True d
127136 DocBold d -> B.strong (docHToInlines isCode d)
137+#if MIN_VERSION_haddock_library(1,4,0)
128138 DocMathInline s -> B.math s
129139 DocMathDisplay s -> B.displayMath s
140+#endif
130141 DocHeader _ -> mempty
131142 DocUnorderedList _ -> mempty
132143 DocOrderedList _ -> mempty
@@ -139,7 +150,9 @@ docHToInlines isCode d' =
139150 DocAName s -> B.spanWith (s,["anchor"],[]) mempty
140151 DocProperty _ -> mempty
141152 DocExamples _ -> mempty
153+#if MIN_VERSION_haddock_library(1,5,0)
142154 DocTable _ -> mempty
155+#endif
143156
144157-- | Create an 'Example', stripping superfluous characters as appropriate
145158makeExample :: String -> String -> [String] -> Blocks