aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-05-30 13:13:57 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-05-30 13:13:57 -0700
commitaff401745cc67f3cba6f6e04a40b81e227ecdde8 (patch)
tree5fa69e6150a44dec263de27f2bcea8629e822a30
parent50c71b5bc5db797ac46550ed54e91196269716e3 (diff)
downloadpandoc-aff401745cc67f3cba6f6e04a40b81e227ecdde8.tar.gz
Revert "ALlow compilation with haddock-library 1.4 and above."
This reverts commit 50c71b5bc5db797ac46550ed54e91196269716e3. This was a bad idea, since tests depend on recent haddock-library. We'd be able to build but fail tests.
-rw-r--r--pandoc.cabal2
-rw-r--r--src/Text/Pandoc/Readers/Haddock.hs15
2 files changed, 2 insertions, 15 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index 16f486531..0fe8bdf0f 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -380,7 +380,7 @@ library
hslua-module-text >= 0.1.2 && < 0.2,
binary >= 0.5 && < 0.10,
SHA >= 1.6 && < 1.7,
- haddock-library >= 1.4 && < 1.7,
+ haddock-library >= 1.6 && < 1.7,
deepseq >= 1.3 && < 1.5,
JuicyPixels >= 3.1.6.1 && < 3.3,
Glob >= 0.7 && < 0.10,
diff --git a/src/Text/Pandoc/Readers/Haddock.hs b/src/Text/Pandoc/Readers/Haddock.hs
index 8e06d1e00..072bab350 100644
--- a/src/Text/Pandoc/Readers/Haddock.hs
+++ b/src/Text/Pandoc/Readers/Haddock.hs
@@ -44,13 +44,7 @@ readHaddockEither :: ReaderOptions -- ^ Reader options
-> String -- ^ String to parse
-> Either PandocError Pandoc
readHaddockEither _opts =
-#if MIN_VERSION_haddock_library(1,6,0)
Right . B.doc . docHToBlocks . _doc . parseParas Nothing
-#elif MIN_VERSION_haddock_library(1,2,0)
- Right . B.doc . docHToBlocks . _doc . parseParas
-#else
- Right . B.doc . docHToBlocks . parseParas
-#endif
docHToBlocks :: DocH String Identifier -> Blocks
docHToBlocks d' =
@@ -70,10 +64,8 @@ docHToBlocks d' =
DocEmphasis _ -> inlineFallback
DocMonospaced _ -> inlineFallback
DocBold _ -> inlineFallback
-#if MIN_VERSION_haddock_library(1,4,0)
DocMathInline _ -> inlineFallback
DocMathDisplay _ -> inlineFallback
-#endif
DocHeader h -> B.header (headerLevel h)
(docHToInlines False $ headerTitle h)
DocUnorderedList items -> B.bulletList (map docHToBlocks items)
@@ -89,7 +81,6 @@ docHToBlocks d' =
DocProperty s -> B.codeBlockWith ("",["property","haskell"],[]) (trim s)
DocExamples es -> mconcat $ map (\e ->
makeExample ">>>" (exampleExpression e) (exampleResult e)) es
-#if MIN_VERSION_haddock_library(1,5,0)
DocTable H.Table{ tableHeaderRows = headerRows
, tableBodyRows = bodyRows
}
@@ -102,7 +93,7 @@ docHToBlocks d' =
colspecs = replicate (maximum (map length body))
(AlignDefault, 0.0)
in B.table mempty colspecs header body
-#endif
+
where inlineFallback = B.plain $ docHToInlines False d'
consolidatePlains = B.fromList . consolidatePlains' . B.toList
consolidatePlains' zs@(Plain _ : _) =
@@ -134,10 +125,8 @@ docHToInlines isCode d' =
DocMonospaced (DocString s) -> B.code s
DocMonospaced d -> docHToInlines True d
DocBold d -> B.strong (docHToInlines isCode d)
-#if MIN_VERSION_haddock_library(1,4,0)
DocMathInline s -> B.math s
DocMathDisplay s -> B.displayMath s
-#endif
DocHeader _ -> mempty
DocUnorderedList _ -> mempty
DocOrderedList _ -> mempty
@@ -150,9 +139,7 @@ docHToInlines isCode d' =
DocAName s -> B.spanWith (s,["anchor"],[]) mempty
DocProperty _ -> mempty
DocExamples _ -> mempty
-#if MIN_VERSION_haddock_library(1,5,0)
DocTable _ -> mempty
-#endif
-- | Create an 'Example', stripping superfluous characters as appropriate
makeExample :: String -> String -> [String] -> Blocks