git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: litChar now includes entities.
5491adbJohn MacFarlane
src/Text/Pandoc/Readers/Markdown.hs+4−4
@@ -45,7 +45,6 @@ import Text.Pandoc.Parsing hiding (tableWith)
45import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
45import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
46import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
46import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
47 isTextTag, isCommentTag )
47 isTextTag, isCommentTag )
48−import Text.Pandoc.XML ( fromEntities )
49import Text.Pandoc.Biblio (processBiblio)
48import Text.Pandoc.Biblio (processBiblio)
50import qualified Text.CSL as CSL
49import qualified Text.CSL as CSL
51import Data.Monoid (mconcat, mempty)
50import Data.Monoid (mconcat, mempty)
@@ -144,6 +143,7 @@ atMostSpaces n = (char ' ' >> atMostSpaces (n-1)) <|> return ()
144
143
145litChar :: MarkdownParser Char
144litChar :: MarkdownParser Char
146litChar = escapedChar'
145litChar = escapedChar'
146+ <|> characterReference
147 <|> noneOf "\n"
147 <|> noneOf "\n"
148 <|> try (newline >> notFollowedBy blankline >> return ' ')
148 <|> try (newline >> notFollowedBy blankline >> return ' ')
149
149
@@ -287,7 +287,7 @@ referenceTitle :: MarkdownParser String
287referenceTitle = try $ do
287referenceTitle = try $ do
288 skipSpaces >> optional newline >> skipSpaces
288 skipSpaces >> optional newline >> skipSpaces
289 let parenTit = charsInBalanced '(' ')' litChar
289 let parenTit = charsInBalanced '(' ')' litChar
290− fromEntities <$> (quotedTitle '"' <|> quotedTitle '\'' <|> parenTit)
290+ quotedTitle '"' <|> quotedTitle '\'' <|> parenTit
291
291
292-- A link title in quotes
292-- A link title in quotes
293quotedTitle :: Char -> MarkdownParser String
293quotedTitle :: Char -> MarkdownParser String
@@ -295,7 +295,7 @@ quotedTitle c = try $ do
295 char c
295 char c
296 notFollowedBy spaces
296 notFollowedBy spaces
297 let pEnder = try $ char c >> notFollowedBy (satisfy isAlphaNum)
297 let pEnder = try $ char c >> notFollowedBy (satisfy isAlphaNum)
298− let regChunk = many1 (noneOf ['\\','\n',c]) <|> count 1 litChar
298+ let regChunk = many1 (noneOf ['\\','\n','&',c]) <|> count 1 litChar
299 let nestedChunk = (\x -> [c] ++ x ++ [c]) <$> quotedTitle c
299 let nestedChunk = (\x -> [c] ++ x ++ [c]) <$> quotedTitle c
300 unwords . words . concat <$> manyTill (nestedChunk <|> regChunk) pEnder
300 unwords . words . concat <$> manyTill (nestedChunk <|> regChunk) pEnder
301
301
@@ -1500,7 +1500,7 @@ source = do
1500 return (escapeURI $ trimr src, tit)
1500 return (escapeURI $ trimr src, tit)
1501
1501
1502linkTitle :: MarkdownParser String
1502linkTitle :: MarkdownParser String
1503−linkTitle = fromEntities <$> (quotedTitle '"' <|> quotedTitle '\'')
1503+linkTitle = quotedTitle '"' <|> quotedTitle '\''
1504
1504
1505link :: MarkdownParser (F Inlines)
1505link :: MarkdownParser (F Inlines)
1506link = try $ do
1506link = try $ do