git.iko.soy/typeable/pandoc
on master help sign in
Modified str parser to capture apostrophes in smart mode.
dd96267John MacFarlane
src/Text/Pandoc/Readers/Markdown.hs+9−2
@@ -44,7 +44,7 @@ import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockT
44 isTextTag, isCommentTag )
44 isTextTag, isCommentTag )
45import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
45import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
46import Text.ParserCombinators.Parsec
46import Text.ParserCombinators.Parsec
47−import Control.Monad (when, liftM, guard)
47+import Control.Monad (when, liftM, guard, mzero)
48import Text.HTML.TagSoup
48import Text.HTML.TagSoup
49import Text.HTML.TagSoup.Match (tagOpen)
49import Text.HTML.TagSoup.Match (tagOpen)
50
50
@@ -1087,8 +1087,15 @@ nonEndline = satisfy (/='\n')
1087
1087
1088str :: GenParser Char ParserState Inline
1088str :: GenParser Char ParserState Inline
1089str = do
1089str = do
1090+ st <- getState
1090 a <- alphaNum
1091 a <- alphaNum
1092+ as <- many $ alphaNum
1091− as <- many $ alphaNum <|> (try $ char '_' >>~ lookAhead alphaNum)
1093+ <|> (try $ char '_' >>~ lookAhead alphaNum)
1094+ <|> if stateStrict st
1095+ then mzero
1096+ else (try $ char '\'' >> lookAhead alphaNum >> return '\x2019')
1097+ -- for things like l'aide - would be better to return
1098+ -- an Apostrophe, but we can't in this context
1092 let result = a:as
1099 let result = a:as
1093 state <- getState
1100 state <- getState
1094 let spacesToNbr = map (\c -> if c == ' ' then '\160' else c)
1101 let spacesToNbr = map (\c -> if c == ' ' then '\160' else c)