@@ -1,4 +1,4 @@
1−{-# LANGUAGE
1+{-# LANGUAGE
22 FlexibleContexts
33, GeneralizedNewtypeDeriving
44, TypeSynonymInstances
@@ -100,7 +100,7 @@ module Text.Pandoc.Parsing ( anyLine,
100100 macro,
101101 applyMacros',
102102 Parser,
103− ParserT,
103+ ParserT,
104104 F(..),
105105 runF,
106106 askF,
@@ -222,7 +222,7 @@ anyLine = do
222222 _ -> mzero
223223
224224-- | Like @manyTill@, but reads at least one item.
225−many1Till :: Stream s m t
225+many1Till :: Stream s m t
226226 => ParserT s st m a
227227 -> ParserT s st m end
228228 -> ParserT s st m [a]
@@ -501,7 +501,7 @@ mathInline =
501501-- displacement (the difference between the source column at the end
502502-- and the source column at the beginning). Vertical displacement
503503-- (source row) is ignored.
504−withHorizDisplacement :: Stream s m Char
504+withHorizDisplacement :: Stream s m Char
505505 => ParserT s st m a -- ^ Parser to apply
506506 -> ParserT s st m (a, Int) -- ^ (result, displacement)
507507withHorizDisplacement parser = do
@@ -528,7 +528,7 @@ withRaw parser = do
528528 return (result, raw)
529529
530530-- | Parses backslash, then applies character parser.
531−escaped :: Stream s m Char
531+escaped :: Stream s m Char
532532 => ParserT s st m Char -- ^ Parser for character to escape
533533 -> ParserT s st m Char
534534escaped parser = try $ char '\\' >> parser
@@ -564,7 +564,7 @@ decimal = do
564564-- returns (DefaultStyle, [next example number]). The next
565565-- example number is incremented in parser state, and the label
566566-- (if present) is added to the label table.
567−exampleNum :: Stream s m Char
567+exampleNum :: Stream s m Char
568568 => ParserT s ParserState m (ListNumberStyle, Int)
569569exampleNum = do
570570 char '@'
@@ -609,7 +609,7 @@ anyOrderedListMarker = choice $
609609 lowerAlpha, lowerRoman, upperAlpha, upperRoman]]
610610
611611-- | Parses a list number (num) followed by a period, returns list attributes.
612−inPeriod :: Stream s m Char
612+inPeriod :: Stream s m Char
613613 => ParserT s st m (ListNumberStyle, Int)
614614 -> ParserT s st m ListAttributes
615615inPeriod num = try $ do
@@ -621,7 +621,7 @@ inPeriod num = try $ do
621621 return (start, style, delim)
622622
623623-- | Parses a list number (num) followed by a paren, returns list attributes.
624−inOneParen :: Stream s m Char
624+inOneParen :: Stream s m Char
625625 => ParserT s st m (ListNumberStyle, Int)
626626 -> ParserT s st m ListAttributes
627627inOneParen num = try $ do
@@ -630,7 +630,7 @@ inOneParen num = try $ do
630630 return (start, style, OneParen)
631631
632632-- | Parses a list number (num) enclosed in parens, returns list attributes.
633−inTwoParens :: Stream s m Char
633+inTwoParens :: Stream s m Char
634634 => ParserT s st m (ListNumberStyle, Int)
635635 -> ParserT s st m ListAttributes
636636inTwoParens num = try $ do
@@ -641,7 +641,7 @@ inTwoParens num = try $ do
641641
642642-- | Parses an ordered list marker with a given style and delimiter,
643643-- returns number.
644−orderedListMarker :: Stream s m Char
644+orderedListMarker :: Stream s m Char
645645 => ListNumberStyle
646646 -> ListNumberDelim
647647 -> ParserT s ParserState m Int
@@ -688,7 +688,7 @@ lineBlockLines = try $ do
688688
689689-- | Parse a table using 'headerParser', 'rowParser',
690690-- 'lineParser', and 'footerParser'.
691−tableWith :: Stream s m Char
691+tableWith :: Stream s m Char
692692 => ParserT s ParserState m ([[Block]], [Alignment], [Int])
693693 -> ([Int] -> ParserT s ParserState m [[Block]])
694694 -> ParserT s ParserState m sep
@@ -735,7 +735,7 @@ widthsFromIndices numColumns' indices =
735735-- (which may be grid), then the rows,
736736-- which may be grid, separated by blank lines, and
737737-- ending with a footer (dashed line followed by blank line).
738−gridTableWith :: Stream [Char] m Char
738+gridTableWith :: Stream [Char] m Char
739739 => ParserT [Char] ParserState m [Block] -- ^ Block list parser
740740 -> Bool -- ^ Headerless table
741741 -> ParserT [Char] ParserState m Block
@@ -765,7 +765,7 @@ gridTableSep :: Stream s m Char => Char -> ParserT s ParserState m Char
765765gridTableSep ch = try $ gridDashedLines ch >> return '\n'
766766
767767-- | Parse header for a grid table.
768−gridTableHeader :: Stream [Char] m Char
768+gridTableHeader :: Stream [Char] m Char
769769 => Bool -- ^ Headerless table
770770 -> ParserT [Char] ParserState m [Block]
771771 -> ParserT [Char] ParserState m ([[Block]], [Alignment], [Int])
@@ -798,7 +798,7 @@ gridTableRawLine indices = do
798798 return (gridTableSplitLine indices line)
799799
800800-- | Parse row of grid table.
801−gridTableRow :: Stream [Char] m Char
801+gridTableRow :: Stream [Char] m Char
802802 => ParserT [Char] ParserState m [Block]
803803 -> [Int]
804804 -> ParserT [Char] ParserState m [[Block]]
@@ -826,7 +826,7 @@ gridTableFooter = blanklines
826826---
827827
828828-- | Parse a string with a given parser and state.
829−readWith :: (Show s, Stream s Identity Char)
829+readWith :: (Show s, Stream s Identity Char)
830830 => ParserT s st Identity a -- ^ parser
831831 -> st -- ^ initial state
832832 -> s -- ^ input
@@ -844,7 +844,7 @@ readWith parser state input =
844844 Right result -> result
845845
846846-- | Parse a string with @parser@ (for testing).
847−testStringWith :: (Show s, Show a, Stream s Identity Char)
847+testStringWith :: (Show s, Show a, Stream s Identity Char)
848848 => ParserT s ParserState Identity a
849849 -> s
850850 -> IO ()
@@ -1038,7 +1038,7 @@ registerHeader (ident,classes,kvs) header' = do
10381038failUnlessSmart :: (Stream s m a, HasReaderOptions st) => ParserT s st m ()
10391039failUnlessSmart = getOption readerSmart >>= guard
10401040
1041−smartPunctuation :: Stream s m Char
1041+smartPunctuation :: Stream s m Char
10421042 => ParserT s ParserState m Inlines
10431043 -> ParserT s ParserState m Inlines
10441044smartPunctuation inlineParser = do
@@ -1048,12 +1048,12 @@ smartPunctuation inlineParser = do
10481048apostrophe :: Stream s m Char => ParserT s st m Inlines
10491049apostrophe = (char '\'' <|> char '\8217') >> return (B.str "\x2019")
10501050
1051−quoted :: Stream s m Char
1051+quoted :: Stream s m Char
10521052 => ParserT s ParserState m Inlines
10531053 -> ParserT s ParserState m Inlines
10541054quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
10551055
1056−withQuoteContext :: Stream s m t
1056+withQuoteContext :: Stream s m t
10571057 => QuoteContext
10581058 -> ParserT s ParserState m a
10591059 -> ParserT s ParserState m a
@@ -1066,7 +1066,7 @@ withQuoteContext context parser = do
10661066 setState newState { stateQuoteContext = oldQuoteContext }
10671067 return result
10681068
1069−singleQuoted :: Stream s m Char
1069+singleQuoted :: Stream s m Char
10701070 => ParserT s ParserState m Inlines
10711071 -> ParserT s ParserState m Inlines
10721072singleQuoted inlineParser = try $ do
@@ -1074,7 +1074,7 @@ singleQuoted inlineParser = try $ do
10741074 withQuoteContext InSingleQuote $ many1Till inlineParser singleQuoteEnd >>=
10751075 return . B.singleQuoted . mconcat
10761076
1077−doubleQuoted :: Stream s m Char
1077+doubleQuoted :: Stream s m Char
10781078 => ParserT s ParserState m Inlines
10791079 -> ParserT s ParserState m Inlines
10801080doubleQuoted inlineParser = try $ do
@@ -1082,8 +1082,8 @@ doubleQuoted inlineParser = try $ do
10821082 withQuoteContext InDoubleQuote $ manyTill inlineParser doubleQuoteEnd >>=
10831083 return . B.doubleQuoted . mconcat
10841084
1085−failIfInQuoteContext :: Stream s m t
1086− => QuoteContext
1085+failIfInQuoteContext :: Stream s m t
1086+ => QuoteContext
10871087 -> ParserT s ParserState m ()
10881088failIfInQuoteContext context = do
10891089 st <- getState
@@ -1097,7 +1097,7 @@ charOrRef cs =
10971097 guard (c `elem` cs)
10981098 return c)
10991099
1100−singleQuoteStart :: Stream s m Char
1100+singleQuoteStart :: Stream s m Char
11011101 => ParserT s ParserState m ()
11021102singleQuoteStart = do
11031103 failIfInQuoteContext InSingleQuote
@@ -1105,24 +1105,24 @@ singleQuoteStart = do
11051105 guard =<< notAfterString
11061106 () <$ charOrRef "'\8216\145"
11071107
1108−singleQuoteEnd :: Stream s m Char
1108+singleQuoteEnd :: Stream s m Char
11091109 => ParserT s st m ()
11101110singleQuoteEnd = try $ do
11111111 charOrRef "'\8217\146"
11121112 notFollowedBy alphaNum
11131113
1114−doubleQuoteStart :: Stream s m Char
1114+doubleQuoteStart :: Stream s m Char
11151115 => ParserT s ParserState m ()
11161116doubleQuoteStart = do
11171117 failIfInQuoteContext InDoubleQuote
11181118 try $ do charOrRef "\"\8220\147"
11191119 notFollowedBy . satisfy $ flip elem [' ', '\t', '\n']
11201120
1121−doubleQuoteEnd :: Stream s m Char
1121+doubleQuoteEnd :: Stream s m Char
11221122 => ParserT s st m ()
11231123doubleQuoteEnd = void (charOrRef "\"\8221\148")
11241124
1125−ellipses :: Stream s m Char
1125+ellipses :: Stream s m Char
11261126 => ParserT s st m Inlines
11271127ellipses = do
11281128 try (charOrRef "\8230\133") <|> try (string "..." >> return '…')
@@ -1136,32 +1136,32 @@ dash = do
11361136 else B.str <$> (hyphenDash <|> emDash <|> enDash)
11371137
11381138-- Two hyphens = en-dash, three = em-dash
1139−hyphenDash :: Stream s m Char
1139+hyphenDash :: Stream s m Char
11401140 => ParserT s st m String
11411141hyphenDash = do
11421142 try $ string "--"
11431143 option "\8211" (char '-' >> return "\8212")
11441144
1145−emDash :: Stream s m Char
1145+emDash :: Stream s m Char
11461146 => ParserT s st m String
11471147emDash = do
11481148 try (charOrRef "\8212\151")
11491149 return "\8212"
11501150
1151−enDash :: Stream s m Char
1151+enDash :: Stream s m Char
11521152 => ParserT s st m String
11531153enDash = do
11541154 try (charOrRef "\8212\151")
11551155 return "\8211"
11561156
1157−enDashOld :: Stream s m Char
1157+enDashOld :: Stream s m Char
11581158 => ParserT s st m Inlines
11591159enDashOld = do
11601160 try (charOrRef "\8211\150") <|>
11611161 try (char '-' >> lookAhead (satisfy isDigit) >> return '–')
11621162 return (B.str "\8211")
11631163
1164−emDashOld :: Stream s m Char
1164+emDashOld :: Stream s m Char
11651165 => ParserT s st m Inlines
11661166emDashOld = do
11671167 try (charOrRef "\8212\151") <|> (try $ string "--" >> optional (char '-') >> return '-')
@@ -1169,7 +1169,7 @@ emDashOld = do
11691169
11701170-- This is used to prevent exponential blowups for things like:
11711171-- a**a*a**a*a**a*a**a*a**a*a**a*a**
1172−nested :: Stream s m a
1172+nested :: Stream s m a
11731173 => ParserT s ParserState m a
11741174 -> ParserT s ParserState m a
11751175nested p = do
@@ -1198,7 +1198,7 @@ citeKey = try $ do
11981198--
11991199
12001200-- | Parse a \newcommand or \renewcommand macro definition.
1201−macro :: (Stream [Char] m Char, HasMacros st, HasReaderOptions st)
1201+macro :: (Stream [Char] m Char, HasMacros st, HasReaderOptions st)
12021202 => ParserT [Char] st m Blocks
12031203macro = do
12041204 apply <- getOption readerApplyMacros
@@ -1214,8 +1214,8 @@ macro = do
12141214 else return $ rawBlock "latex" def'
12151215
12161216-- | Apply current macros to string.
1217−applyMacros' :: Stream [Char] m Char
1218− => String
1217+applyMacros' :: Stream [Char] m Char
1218+ => String
12191219 -> ParserT [Char] ParserState m String
12201220applyMacros' target = do
12211221 apply <- getOption readerApplyMacros