git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1856 from markwright/master

Allow compilation with ghc 7.10.1 RC1 and haddock-library 1.2

commite2d86dfe286085cc33b513b17444e846fae0ce30 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 4 Jan 2015, 20:26 (12 years ago) parent4866c909c68017
15 files changed+34−26
pandoc.cabal+1−1 src/Text/Pandoc/Readers/Haddock.hs+7−1 src/Text/Pandoc/Readers/LaTeX.hs+2−2 src/Text/Pandoc/Readers/Org.hs+4−3 src/Text/Pandoc/Readers/RST.hs+2−1 src/Text/Pandoc/Readers/TWiki.hs+1−1 src/Text/Pandoc/Templates.hs+2−2 src/Text/Pandoc/Writers/ConTeXt.hs+1−1 src/Text/Pandoc/Writers/EPUB.hs+1−1 src/Text/Pandoc/Writers/ICML.hs+1−1 src/Text/Pandoc/Writers/LaTeX.hs+1−1 src/Text/Pandoc/Writers/Markdown.hs+6−6 src/Text/Pandoc/Writers/OpenDocument.hs+1−1 src/Text/Pandoc/Writers/RST.hs+3−3 src/Text/Pandoc/Writers/Texinfo.hs+1−1
pandoc.cabal+1−1
@@ -250,7 +250,7 @@ Library
250250 hslua >= 0.3 && < 0.4,
251251 binary >= 0.5 && < 0.8,
252252 SHA >= 1.6 && < 1.7,
253− haddock-library >= 1.1 && < 1.2,
253+ haddock-library >= 1.1 && < 1.3,
254254 old-time,
255255 deepseq-generics >= 0.1 && < 0.2,
256256 JuicyPixels >= 3.1.6.1 && < 3.3
src/Text/Pandoc/Readers/Haddock.hs+7−1
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{- |
23 Module : Text.Pandoc.Readers.Haddock
34 Copyright : Copyright (C) 2013 David Lazar
@@ -29,7 +30,12 @@ import Debug.Trace (trace)
2930readHaddock :: ReaderOptions -- ^ Reader options
3031 -> String -- ^ String to parse
3132 -> Pandoc
32−readHaddock opts = B.doc . docHToBlocks . trace' . parseParas
33+readHaddock opts =
34+#if MIN_VERSION_haddock_library(1,2,0)
35+ B.doc . docHToBlocks . trace' . _doc . parseParas
36+#else
37+ B.doc . docHToBlocks . trace' . parseParas
38+#endif
3339 where trace' x = if readerTrace opts
3440 then trace (show x) x
3541 else x
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -592,7 +592,7 @@ inNote ils =
592592
593593unescapeURL :: String -> String
594594unescapeURL ('\\':x:xs) | isEscapable x = x:unescapeURL xs
595− where isEscapable c = c `elem` "#$%&~_^\\{}"
595+ where isEscapable c = c `elem` ("#$%&~_^\\{}" :: String)
596596unescapeURL (x:xs) = x:unescapeURL xs
597597unescapeURL [] = ""
598598
@@ -1225,7 +1225,7 @@ citationLabel = optional sp *>
12251225 <* optional sp
12261226 <* optional (char ',')
12271227 <* optional sp)
1228− where isBibtexKeyChar c = isAlphaNum c || c `elem` ".:;?!`'()/*@_+=-[]*"
1228+ where isBibtexKeyChar c = isAlphaNum c || c `elem` (".:;?!`'()/*@_+=-[]*" :: String)
12291229
12301230cites :: CitationMode -> Bool -> LP [Citation]
12311231cites mode multi = try $ do
src/Text/Pandoc/Readers/Org.hs+4−3
@@ -1,5 +1,6 @@
11{-# LANGUAGE OverloadedStrings #-}
22{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3+{-# LANGUAGE FlexibleContexts #-}
34{-
45Copyright (C) 2014 Albert Krewinkel <tarleb@moltkeplatz.de>
56
@@ -1168,7 +1169,7 @@ isRelativeFilePath s = (("./" `isPrefixOf` s) || ("../" `isPrefixOf` s)) &&
11681169
11691170isUri :: String -> Bool
11701171isUri s = let (scheme, path) = break (== ':') s
1171− in all (\c -> isAlphaNum c || c `elem` ".-") scheme
1172+ in all (\c -> isAlphaNum c || c `elem` (".-" :: String)) scheme
11721173 && not (null path)
11731174
11741175isAbsoluteFilePath :: String -> Bool
@@ -1214,7 +1215,7 @@ solidify :: String -> String
12141215solidify = map replaceSpecialChar
12151216 where replaceSpecialChar c
12161217 | isAlphaNum c = c
1217− | c `elem` "_.-:" = c
1218+ | c `elem` ("_.-:" :: String) = c
12181219 | otherwise = '-'
12191220
12201221-- | Parses an inline code block and marks it as an babel block.
@@ -1465,7 +1466,7 @@ inlineLaTeX = try $ do
14651466 parseAsMathMLSym :: String -> Maybe Inlines
14661467 parseAsMathMLSym cs = B.str <$> MathMLEntityMap.getUnicode (clean cs)
14671468 -- dropWhileEnd would be nice here, but it's not available before base 4.5
1468− where clean = reverse . dropWhile (`elem` "{}") . reverse . drop 1
1469+ where clean = reverse . dropWhile (`elem` ("{}" :: String)) . reverse . drop 1
14691470
14701471 state :: ParserState
14711472 state = def{ stateOptions = def{ readerParseRaw = True }}
src/Text/Pandoc/Readers/RST.hs+2−1
@@ -1,4 +1,5 @@
11{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE FlexibleContexts #-}
23{-
34Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
45
@@ -708,7 +709,7 @@ extractCaption = do
708709toChunks :: String -> [String]
709710toChunks = dropWhile null
710711 . map (trim . unlines)
711− . splitBy (all (`elem` " \t")) . lines
712+ . splitBy (all (`elem` (" \t" :: String))) . lines
712713
713714codeblock :: Maybe String -> String -> String -> RSTParser Blocks
714715codeblock numberLines lang body =
src/Text/Pandoc/Readers/TWiki.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE RelaxedPolyRec, FlexibleInstances, TypeSynonymInstances #-}
1+{-# LANGUAGE RelaxedPolyRec, FlexibleInstances, TypeSynonymInstances, FlexibleContexts #-}
22-- RelaxedPolyRec needed for inlinesBetween on GHC < 7
33{-
44 Copyright (C) 2014 Alexander Sulfrian <alexander.sulfrian@fu-berlin.de>
src/Text/Pandoc/Templates.hs+2−2
@@ -124,7 +124,7 @@ getDefaultTemplate :: (Maybe FilePath) -- ^ User data directory to search first
124124 -> String -- ^ Name of writer
125125 -> IO (Either E.IOException String)
126126getDefaultTemplate user writer = do
127− let format = takeWhile (`notElem` "+-") writer -- strip off extensions
127+ let format = takeWhile (`notElem` ("+-" :: String)) writer -- strip off extensions
128128 case format of
129129 "native" -> return $ Right ""
130130 "json" -> return $ Right ""
@@ -288,7 +288,7 @@ reservedWords :: [Text]
288288reservedWords = ["else","endif","for","endfor","sep"]
289289
290290skipEndline :: Parser ()
291−skipEndline = P.try $ P.skipMany (P.satisfy (`elem` " \t")) >> P.char '\n' >> return ()
291+skipEndline = P.try $ P.skipMany (P.satisfy (`elem` (" \t" :: String))) >> P.char '\n' >> return ()
292292
293293pConditional :: Parser Template
294294pConditional = do
src/Text/Pandoc/Writers/ConTeXt.hs+1−1
@@ -119,7 +119,7 @@ stringToConTeXt opts = concatMap (escapeCharForConTeXt opts)
119119toLabel :: String -> String
120120toLabel z = concatMap go z
121121 where go x
122− | elem x "\\#[]\",{}%()|=" = "ux" ++ printf "%x" (ord x)
122+ | elem x ("\\#[]\",{}%()|=" :: String) = "ux" ++ printf "%x" (ord x)
123123 | otherwise = [x]
124124
125125-- | Convert Elements to ConTeXt
src/Text/Pandoc/Writers/EPUB.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE PatternGuards, CPP, ScopedTypeVariables, ViewPatterns #-}
1+{-# LANGUAGE PatternGuards, CPP, ScopedTypeVariables, ViewPatterns, FlexibleContexts #-}
22{-
33Copyright (C) 2010-2014 John MacFarlane <jgm@berkeley.edu>
44
src/Text/Pandoc/Writers/ICML.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE OverloadedStrings, FlexibleContexts #-}
22
33{- |
44 Module : Text.Pandoc.Writers.ICML
src/Text/Pandoc/Writers/LaTeX.hs+1−1
@@ -240,7 +240,7 @@ toLabel z = go `fmap` stringToLaTeX URLString z
240240 where go [] = ""
241241 go (x:xs)
242242 | (isLetter x || isDigit x) && isAscii x = x:go xs
243− | elem x "-+=:;." = x:go xs
243+ | elem x ("-+=:;." :: String) = x:go xs
244244 | otherwise = "ux" ++ printf "%x" (ord x) ++ go xs
245245
246246-- | Puts contents into LaTeX command.
src/Text/Pandoc/Writers/Markdown.hs+6−6
@@ -323,9 +323,9 @@ blockToMarkdown opts (Plain inlines) = do
323323 then Just $ writerColumns opts
324324 else Nothing
325325 let rendered = render colwidth contents
326− let escapeDelimiter (x:xs) | x `elem` ".()" = '\\':x:xs
327− | otherwise = x : escapeDelimiter xs
328− escapeDelimiter [] = []
326+ let escapeDelimiter (x:xs) | x `elem` (".()" :: String) = '\\':x:xs
327+ | otherwise = x : escapeDelimiter xs
328+ escapeDelimiter [] = []
329329 let contents' = if isEnabled Ext_all_symbols_escapable opts &&
330330 not (stPlain st) && beginsWithOrderedListMarker rendered
331331 then text $ escapeDelimiter rendered
@@ -681,7 +681,7 @@ inlineListToMarkdown opts lst =
681681 mapM (inlineToMarkdown opts) (avoidBadWraps lst) >>= return . cat
682682 where avoidBadWraps [] = []
683683 avoidBadWraps (Space:Str (c:cs):xs)
684− | c `elem` "-*+>" = Str (' ':c:cs) : avoidBadWraps xs
684+ | c `elem` ("-*+>" :: String) = Str (' ':c:cs) : avoidBadWraps xs
685685 avoidBadWraps (x:xs) = x : avoidBadWraps xs
686686
687687escapeSpaces :: Inline -> Inline
@@ -821,8 +821,8 @@ inlineToMarkdown opts (Cite (c:cs) lst)
821821 sdoc <- inlineListToMarkdown opts sinlines
822822 let k' = text (modekey m ++ "@" ++ k)
823823 r = case sinlines of
824− Str (y:_):_ | y `elem` ",;]@" -> k' <> sdoc
825− _ -> k' <+> sdoc
824+ Str (y:_):_ | y `elem` (",;]@" :: String) -> k' <> sdoc
825+ _ -> k' <+> sdoc
826826 return $ pdoc <+> r
827827 modekey SuppressAuthor = "-"
828828 modekey _ = ""
src/Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE PatternGuards, OverloadedStrings #-}
1+{-# LANGUAGE PatternGuards, OverloadedStrings, FlexibleContexts #-}
22{-
33Copyright (C) 2008-2014 Andrea Rossato <andrea.rossato@ing.unitn.it>
44 and John MacFarlane.
src/Text/Pandoc/Writers/RST.hs+3−3
@@ -105,7 +105,7 @@ keyToRST :: ([Inline], (String, String))
105105 -> State WriterState Doc
106106keyToRST (label, (src, _)) = do
107107 label' <- inlineListToRST label
108− let label'' = if ':' `elem` (render Nothing label')
108+ let label'' = if ':' `elem` ((render Nothing label') :: String)
109109 then char '`' <> label' <> char '`'
110110 else label'
111111 return $ nowrap $ ".. _" <> label'' <> ": " <> text src
@@ -333,12 +333,12 @@ inlineListToRST lst =
333333 okAfterComplex :: Inline -> Bool
334334 okAfterComplex Space = True
335335 okAfterComplex LineBreak = True
336− okAfterComplex (Str (c:_)) = isSpace c || c `elem` "-.,:;!?\\/'\")]}>–—"
336+ okAfterComplex (Str (c:_)) = isSpace c || c `elem` ("-.,:;!?\\/'\")]}>–—" :: String)
337337 okAfterComplex _ = False
338338 okBeforeComplex :: Inline -> Bool
339339 okBeforeComplex Space = True
340340 okBeforeComplex LineBreak = True
341− okBeforeComplex (Str (c:_)) = isSpace c || c `elem` "-:/'\"<([{–—"
341+ okBeforeComplex (Str (c:_)) = isSpace c || c `elem` ("-:/'\"<([{–—" :: String)
342342 okBeforeComplex _ = False
343343 isComplex :: Inline -> Bool
344344 isComplex (Emph _) = True
src/Text/Pandoc/Writers/Texinfo.hs+1−1
@@ -368,7 +368,7 @@ inlineListForNode = return . text . stringToTexinfo .
368368
369369-- periods, commas, colons, and parentheses are disallowed in node names
370370disallowedInNode :: Char -> Bool
371−disallowedInNode c = c `elem` ".,:()"
371+disallowedInNode c = c `elem` (".,:()" :: String)
372372
373373-- | Convert inline element to Texinfo
374374inlineToTexinfo :: Inline -- ^ Inline to convert