@@ -997,17 +997,17 @@ registerHeader (ident,classes,kvs) header' = do
997failUnlessSmart :: HasReaderOptions st => Parser s st ()
997failUnlessSmart :: HasReaderOptions st => Parser s st ()
998failUnlessSmart = getOption readerSmart >>= guard
998failUnlessSmart = getOption readerSmart >>= guard
1000−smartPunctuation :: Parser [Char] ParserState Inline
1000+smartPunctuation :: Parser [Char] ParserState Inlines
1001− -> Parser [Char] ParserState Inline
1001+ -> Parser [Char] ParserState Inlines
1002smartPunctuation inlineParser = do
1002smartPunctuation inlineParser = do
1003 failUnlessSmart
1003 failUnlessSmart
1004 choice [ quoted inlineParser, apostrophe, dash, ellipses ]
1004 choice [ quoted inlineParser, apostrophe, dash, ellipses ]
1006−apostrophe :: Parser [Char] ParserState Inline
1006+apostrophe :: Parser [Char] ParserState Inlines
1007−apostrophe = (char '\'' <|> char '\8217') >> return (Str "\x2019")
1007+apostrophe = (char '\'' <|> char '\8217') >> return (B.str "\x2019")
1009−quoted :: Parser [Char] ParserState Inline
1009+quoted :: Parser [Char] ParserState Inlines
1010− -> Parser [Char] ParserState Inline
1010+ -> Parser [Char] ParserState Inlines
1011quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
1011quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
1013withQuoteContext :: QuoteContext
1013withQuoteContext :: QuoteContext
@@ -1022,20 +1022,19 @@ withQuoteContext context parser = do
1022 setState newState { stateQuoteContext = oldQuoteContext }
1022 setState newState { stateQuoteContext = oldQuoteContext }
1023 return result
1023 return result
1025−singleQuoted :: Parser [Char] ParserState Inline
1025+singleQuoted :: Parser [Char] ParserState Inlines
1026− -> Parser [Char] ParserState Inline
1026+ -> Parser [Char] ParserState Inlines
1027singleQuoted inlineParser = try $ do
1027singleQuoted inlineParser = try $ do
1028 singleQuoteStart
1028 singleQuoteStart
1029 withQuoteContext InSingleQuote $ many1Till inlineParser singleQuoteEnd >>=
1029 withQuoteContext InSingleQuote $ many1Till inlineParser singleQuoteEnd >>=
1030− return . Quoted SingleQuote . normalizeSpaces
1030+ return . B.singleQuoted . mconcat
1032−doubleQuoted :: Parser [Char] ParserState Inline
1032+doubleQuoted :: Parser [Char] ParserState Inlines
1033− -> Parser [Char] ParserState Inline
1033+ -> Parser [Char] ParserState Inlines
1034doubleQuoted inlineParser = try $ do
1034doubleQuoted inlineParser = try $ do
1035 doubleQuoteStart
1035 doubleQuoteStart
1036− withQuoteContext InDoubleQuote $ do
1037− contents <- manyTill inlineParser doubleQuoteEnd
1036+ withQuoteContext InDoubleQuote $ manyTill inlineParser doubleQuoteEnd >>=
1038− return . Quoted DoubleQuote . normalizeSpaces $ contents
1037+ return . B.doubleQuoted . mconcat
1040failIfInQuoteContext :: QuoteContext -> Parser [tok] ParserState ()
1039failIfInQuoteContext :: QuoteContext -> Parser [tok] ParserState ()
1041failIfInQuoteContext context = do
1040failIfInQuoteContext context = do
@@ -1079,17 +1078,17 @@ doubleQuoteEnd = do
1079 charOrRef "\"\8221\148"
1078 charOrRef "\"\8221\148"
1080 return ()
1079 return ()
1082−ellipses :: Parser [Char] st Inline
1081+ellipses :: Parser [Char] st Inlines
1083ellipses = do
1082ellipses = do
1084 try (charOrRef "\8230\133") <|> try (string "..." >> return '…')
1083 try (charOrRef "\8230\133") <|> try (string "..." >> return '…')
1085− return (Str "\8230")
1084+ return (B.str "\8230")
1087−dash :: Parser [Char] ParserState Inline
1086+dash :: Parser [Char] ParserState Inlines
1088dash = do
1087dash = do
1089 oldDashes <- getOption readerOldDashes
1088 oldDashes <- getOption readerOldDashes
1090 if oldDashes
1089 if oldDashes
1091 then emDashOld <|> enDashOld
1090 then emDashOld <|> enDashOld
1092− else Str `fmap` (hyphenDash <|> emDash <|> enDash)
1091+ else B.str `fmap` (hyphenDash <|> emDash <|> enDash)
1094-- Two hyphens = en-dash, three = em-dash
1093-- Two hyphens = en-dash, three = em-dash
1095hyphenDash :: Parser [Char] st String
1094hyphenDash :: Parser [Char] st String
@@ -1107,16 +1106,16 @@ enDash = do
1107 try (charOrRef "\8212\151")
1106 try (charOrRef "\8212\151")
1108 return "\8211"
1107 return "\8211"
1110−enDashOld :: Parser [Char] st Inline
1109+enDashOld :: Parser [Char] st Inlines
1111enDashOld = do
1110enDashOld = do
1112 try (charOrRef "\8211\150") <|>
1111 try (charOrRef "\8211\150") <|>
1113 try (char '-' >> lookAhead (satisfy isDigit) >> return '–')
1112 try (char '-' >> lookAhead (satisfy isDigit) >> return '–')
1114− return (Str "\8211")
1113+ return (B.str "\8211")
1116−emDashOld :: Parser [Char] st Inline
1115+emDashOld :: Parser [Char] st Inlines
1117emDashOld = do
1116emDashOld = do
1118 try (charOrRef "\8212\151") <|> (try $ string "--" >> optional (char '-') >> return '-')
1117 try (charOrRef "\8212\151") <|> (try $ string "--" >> optional (char '-') >> return '-')
1119− return (Str "\8212")
1118+ return (B.str "\8212")
1121-- This is used to prevent exponential blowups for things like:
1120-- This is used to prevent exponential blowups for things like:
1122-- a**a*a**a*a**a*a**a*a**a*a**a*a**
1121-- a**a*a**a*a**a*a**a*a**a*a**a*a**