git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1856 from markwright/master
e2d86dfJohn MacFarlane
pandoc.cabal+1−1
@@ -250,7 +250,7 @@ Library
250 hslua >= 0.3 && < 0.4,
250 hslua >= 0.3 && < 0.4,
251 binary >= 0.5 && < 0.8,
251 binary >= 0.5 && < 0.8,
252 SHA >= 1.6 && < 1.7,
252 SHA >= 1.6 && < 1.7,
253− haddock-library >= 1.1 && < 1.2,
253+ haddock-library >= 1.1 && < 1.3,
254 old-time,
254 old-time,
255 deepseq-generics >= 0.1 && < 0.2,
255 deepseq-generics >= 0.1 && < 0.2,
256 JuicyPixels >= 3.1.6.1 && < 3.3
256 JuicyPixels >= 3.1.6.1 && < 3.3
src/Text/Pandoc/Readers/Haddock.hs+7−1
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{- |
2{- |
2 Module : Text.Pandoc.Readers.Haddock
3 Module : Text.Pandoc.Readers.Haddock
3 Copyright : Copyright (C) 2013 David Lazar
4 Copyright : Copyright (C) 2013 David Lazar
@@ -29,7 +30,12 @@ import Debug.Trace (trace)
29readHaddock :: ReaderOptions -- ^ Reader options
30readHaddock :: ReaderOptions -- ^ Reader options
30 -> String -- ^ String to parse
31 -> String -- ^ String to parse
31 -> Pandoc
32 -> Pandoc
33+readHaddock opts =
34+#if MIN_VERSION_haddock_library(1,2,0)
32−readHaddock opts = B.doc . docHToBlocks . trace' . parseParas
35+ B.doc . docHToBlocks . trace' . _doc . parseParas
36+#else
37+ B.doc . docHToBlocks . trace' . parseParas
38+#endif
33 where trace' x = if readerTrace opts
39 where trace' x = if readerTrace opts
34 then trace (show x) x
40 then trace (show x) x
35 else x
41 else x
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -592,7 +592,7 @@ inNote ils =
592
592
593unescapeURL :: String -> String
593unescapeURL :: String -> String
594unescapeURL ('\\':x:xs) | isEscapable x = x:unescapeURL xs
594unescapeURL ('\\':x:xs) | isEscapable x = x:unescapeURL xs
595− where isEscapable c = c `elem` "#$%&~_^\\{}"
595+ where isEscapable c = c `elem` ("#$%&~_^\\{}" :: String)
596unescapeURL (x:xs) = x:unescapeURL xs
596unescapeURL (x:xs) = x:unescapeURL xs
597unescapeURL [] = ""
597unescapeURL [] = ""
598
598
@@ -1225,7 +1225,7 @@ citationLabel = optional sp *>
1225 <* optional sp
1225 <* optional sp
1226 <* optional (char ',')
1226 <* optional (char ',')
1227 <* optional sp)
1227 <* optional sp)
1228− where isBibtexKeyChar c = isAlphaNum c || c `elem` ".:;?!`'()/*@_+=-[]*"
1228+ where isBibtexKeyChar c = isAlphaNum c || c `elem` (".:;?!`'()/*@_+=-[]*" :: String)
1229
1229
1230cites :: CitationMode -> Bool -> LP [Citation]
1230cites :: CitationMode -> Bool -> LP [Citation]
1231cites mode multi = try $ do
1231cites mode multi = try $ do
src/Text/Pandoc/Readers/Org.hs+4−3
@@ -1,5 +1,6 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3+{-# LANGUAGE FlexibleContexts #-}
3{-
4{-
4Copyright (C) 2014 Albert Krewinkel <tarleb@moltkeplatz.de>
5Copyright (C) 2014 Albert Krewinkel <tarleb@moltkeplatz.de>
5
6
@@ -1168,7 +1169,7 @@ isRelativeFilePath s = (("./" `isPrefixOf` s) || ("../" `isPrefixOf` s)) &&
1168
1169
1169isUri :: String -> Bool
1170isUri :: String -> Bool
1170isUri s = let (scheme, path) = break (== ':') s
1171isUri 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
1172 && not (null path)
1173 && not (null path)
1173
1174
1174isAbsoluteFilePath :: String -> Bool
1175isAbsoluteFilePath :: String -> Bool
@@ -1214,7 +1215,7 @@ solidify :: String -> String
1214solidify = map replaceSpecialChar
1215solidify = map replaceSpecialChar
1215 where replaceSpecialChar c
1216 where replaceSpecialChar c
1216 | isAlphaNum c = c
1217 | isAlphaNum c = c
1217− | c `elem` "_.-:" = c
1218+ | c `elem` ("_.-:" :: String) = c
1218 | otherwise = '-'
1219 | otherwise = '-'
1219
1220
1220-- | Parses an inline code block and marks it as an babel block.
1221-- | Parses an inline code block and marks it as an babel block.
@@ -1465,7 +1466,7 @@ inlineLaTeX = try $ do
1465 parseAsMathMLSym :: String -> Maybe Inlines
1466 parseAsMathMLSym :: String -> Maybe Inlines
1466 parseAsMathMLSym cs = B.str <$> MathMLEntityMap.getUnicode (clean cs)
1467 parseAsMathMLSym cs = B.str <$> MathMLEntityMap.getUnicode (clean cs)
1467 -- dropWhileEnd would be nice here, but it's not available before base 4.5
1468 -- 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
1469
1470
1470 state :: ParserState
1471 state :: ParserState
1471 state = def{ stateOptions = def{ readerParseRaw = True }}
1472 state = def{ stateOptions = def{ readerParseRaw = True }}
src/Text/Pandoc/Readers/RST.hs+2−1
@@ -1,4 +1,5 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE FlexibleContexts #-}
2{-
3{-
3Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
4Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
4
5
@@ -708,7 +709,7 @@ extractCaption = do
708toChunks :: String -> [String]
709toChunks :: String -> [String]
709toChunks = dropWhile null
710toChunks = dropWhile null
710 . map (trim . unlines)
711 . map (trim . unlines)
711− . splitBy (all (`elem` " \t")) . lines
712+ . splitBy (all (`elem` (" \t" :: String))) . lines
712
713
713codeblock :: Maybe String -> String -> String -> RSTParser Blocks
714codeblock :: Maybe String -> String -> String -> RSTParser Blocks
714codeblock numberLines lang body =
715codeblock 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 #-}
2-- RelaxedPolyRec needed for inlinesBetween on GHC < 7
2-- RelaxedPolyRec needed for inlinesBetween on GHC < 7
3{-
3{-
4 Copyright (C) 2014 Alexander Sulfrian <alexander.sulfrian@fu-berlin.de>
4 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
124 -> String -- ^ Name of writer
124 -> String -- ^ Name of writer
125 -> IO (Either E.IOException String)
125 -> IO (Either E.IOException String)
126getDefaultTemplate user writer = do
126getDefaultTemplate user writer = do
127− let format = takeWhile (`notElem` "+-") writer -- strip off extensions
127+ let format = takeWhile (`notElem` ("+-" :: String)) writer -- strip off extensions
128 case format of
128 case format of
129 "native" -> return $ Right ""
129 "native" -> return $ Right ""
130 "json" -> return $ Right ""
130 "json" -> return $ Right ""
@@ -288,7 +288,7 @@ reservedWords :: [Text]
288reservedWords = ["else","endif","for","endfor","sep"]
288reservedWords = ["else","endif","for","endfor","sep"]
289
289
290skipEndline :: Parser ()
290skipEndline :: 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 ()
292
292
293pConditional :: Parser Template
293pConditional :: Parser Template
294pConditional = do
294pConditional = do
src/Text/Pandoc/Writers/ConTeXt.hs+1−1
@@ -119,7 +119,7 @@ stringToConTeXt opts = concatMap (escapeCharForConTeXt opts)
119toLabel :: String -> String
119toLabel :: String -> String
120toLabel z = concatMap go z
120toLabel z = concatMap go z
121 where go x
121 where go x
122− | elem x "\\#[]\",{}%()|=" = "ux" ++ printf "%x" (ord x)
122+ | elem x ("\\#[]\",{}%()|=" :: String) = "ux" ++ printf "%x" (ord x)
123 | otherwise = [x]
123 | otherwise = [x]
124
124
125-- | Convert Elements to ConTeXt
125-- | 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 #-}
2{-
2{-
3Copyright (C) 2010-2014 John MacFarlane <jgm@berkeley.edu>
3Copyright (C) 2010-2014 John MacFarlane <jgm@berkeley.edu>
4
4
src/Text/Pandoc/Writers/ICML.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE OverloadedStrings, FlexibleContexts #-}
2
2
3{- |
3{- |
4 Module : Text.Pandoc.Writers.ICML
4 Module : Text.Pandoc.Writers.ICML
src/Text/Pandoc/Writers/LaTeX.hs+1−1
@@ -240,7 +240,7 @@ toLabel z = go `fmap` stringToLaTeX URLString z
240 where go [] = ""
240 where go [] = ""
241 go (x:xs)
241 go (x:xs)
242 | (isLetter x || isDigit x) && isAscii x = x:go xs
242 | (isLetter x || isDigit x) && isAscii x = x:go xs
243− | elem x "-+=:;." = x:go xs
243+ | elem x ("-+=:;." :: String) = x:go xs
244 | otherwise = "ux" ++ printf "%x" (ord x) ++ go xs
244 | otherwise = "ux" ++ printf "%x" (ord x) ++ go xs
245
245
246-- | Puts contents into LaTeX command.
246-- | Puts contents into LaTeX command.
src/Text/Pandoc/Writers/Markdown.hs+6−6
@@ -323,9 +323,9 @@ blockToMarkdown opts (Plain inlines) = do
323 then Just $ writerColumns opts
323 then Just $ writerColumns opts
324 else Nothing
324 else Nothing
325 let rendered = render colwidth contents
325 let rendered = render colwidth contents
326− let escapeDelimiter (x:xs) | x `elem` ".()" = '\\':x:xs
326+ let escapeDelimiter (x:xs) | x `elem` (".()" :: String) = '\\':x:xs
327− | otherwise = x : escapeDelimiter xs
327+ | otherwise = x : escapeDelimiter xs
328− escapeDelimiter [] = []
328+ escapeDelimiter [] = []
329 let contents' = if isEnabled Ext_all_symbols_escapable opts &&
329 let contents' = if isEnabled Ext_all_symbols_escapable opts &&
330 not (stPlain st) && beginsWithOrderedListMarker rendered
330 not (stPlain st) && beginsWithOrderedListMarker rendered
331 then text $ escapeDelimiter rendered
331 then text $ escapeDelimiter rendered
@@ -681,7 +681,7 @@ inlineListToMarkdown opts lst =
681 mapM (inlineToMarkdown opts) (avoidBadWraps lst) >>= return . cat
681 mapM (inlineToMarkdown opts) (avoidBadWraps lst) >>= return . cat
682 where avoidBadWraps [] = []
682 where avoidBadWraps [] = []
683 avoidBadWraps (Space:Str (c:cs):xs)
683 avoidBadWraps (Space:Str (c:cs):xs)
684− | c `elem` "-*+>" = Str (' ':c:cs) : avoidBadWraps xs
684+ | c `elem` ("-*+>" :: String) = Str (' ':c:cs) : avoidBadWraps xs
685 avoidBadWraps (x:xs) = x : avoidBadWraps xs
685 avoidBadWraps (x:xs) = x : avoidBadWraps xs
686
686
687escapeSpaces :: Inline -> Inline
687escapeSpaces :: Inline -> Inline
@@ -821,8 +821,8 @@ inlineToMarkdown opts (Cite (c:cs) lst)
821 sdoc <- inlineListToMarkdown opts sinlines
821 sdoc <- inlineListToMarkdown opts sinlines
822 let k' = text (modekey m ++ "@" ++ k)
822 let k' = text (modekey m ++ "@" ++ k)
823 r = case sinlines of
823 r = case sinlines of
824− Str (y:_):_ | y `elem` ",;]@" -> k' <> sdoc
824+ Str (y:_):_ | y `elem` (",;]@" :: String) -> k' <> sdoc
825− _ -> k' <+> sdoc
825+ _ -> k' <+> sdoc
826 return $ pdoc <+> r
826 return $ pdoc <+> r
827 modekey SuppressAuthor = "-"
827 modekey SuppressAuthor = "-"
828 modekey _ = ""
828 modekey _ = ""
src/Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE PatternGuards, OverloadedStrings #-}
1+{-# LANGUAGE PatternGuards, OverloadedStrings, FlexibleContexts #-}
2{-
2{-
3Copyright (C) 2008-2014 Andrea Rossato <andrea.rossato@ing.unitn.it>
3Copyright (C) 2008-2014 Andrea Rossato <andrea.rossato@ing.unitn.it>
4 and John MacFarlane.
4 and John MacFarlane.
src/Text/Pandoc/Writers/RST.hs+3−3
@@ -105,7 +105,7 @@ keyToRST :: ([Inline], (String, String))
105 -> State WriterState Doc
105 -> State WriterState Doc
106keyToRST (label, (src, _)) = do
106keyToRST (label, (src, _)) = do
107 label' <- inlineListToRST label
107 label' <- inlineListToRST label
108− let label'' = if ':' `elem` (render Nothing label')
108+ let label'' = if ':' `elem` ((render Nothing label') :: String)
109 then char '`' <> label' <> char '`'
109 then char '`' <> label' <> char '`'
110 else label'
110 else label'
111 return $ nowrap $ ".. _" <> label'' <> ": " <> text src
111 return $ nowrap $ ".. _" <> label'' <> ": " <> text src
@@ -333,12 +333,12 @@ inlineListToRST lst =
333 okAfterComplex :: Inline -> Bool
333 okAfterComplex :: Inline -> Bool
334 okAfterComplex Space = True
334 okAfterComplex Space = True
335 okAfterComplex LineBreak = True
335 okAfterComplex LineBreak = True
336− okAfterComplex (Str (c:_)) = isSpace c || c `elem` "-.,:;!?\\/'\")]}>–—"
336+ okAfterComplex (Str (c:_)) = isSpace c || c `elem` ("-.,:;!?\\/'\")]}>–—" :: String)
337 okAfterComplex _ = False
337 okAfterComplex _ = False
338 okBeforeComplex :: Inline -> Bool
338 okBeforeComplex :: Inline -> Bool
339 okBeforeComplex Space = True
339 okBeforeComplex Space = True
340 okBeforeComplex LineBreak = True
340 okBeforeComplex LineBreak = True
341− okBeforeComplex (Str (c:_)) = isSpace c || c `elem` "-:/'\"<([{–—"
341+ okBeforeComplex (Str (c:_)) = isSpace c || c `elem` ("-:/'\"<([{–—" :: String)
342 okBeforeComplex _ = False
342 okBeforeComplex _ = False
343 isComplex :: Inline -> Bool
343 isComplex :: Inline -> Bool
344 isComplex (Emph _) = True
344 isComplex (Emph _) = True
src/Text/Pandoc/Writers/Texinfo.hs+1−1
@@ -368,7 +368,7 @@ inlineListForNode = return . text . stringToTexinfo .
368
368
369-- periods, commas, colons, and parentheses are disallowed in node names
369-- periods, commas, colons, and parentheses are disallowed in node names
370disallowedInNode :: Char -> Bool
370disallowedInNode :: Char -> Bool
371−disallowedInNode c = c `elem` ".,:()"
371+disallowedInNode c = c `elem` (".,:()" :: String)
372
372
373-- | Convert inline element to Texinfo
373-- | Convert inline element to Texinfo
374inlineToTexinfo :: Inline -- ^ Inline to convert
374inlineToTexinfo :: Inline -- ^ Inline to convert