From 233148f9638f637871391cbed239068aeddb6cca Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 6 Jan 2007 20:47:00 +0000 Subject: Fixed bug in Markdown reader's handling of underscores and other inline formatting markers inside reference labels: for example, in '[A_B]: /url/a_b', the material between underscores was being parsed as emphasized inlines. git-svn-id: https://pandoc.googlecode.com/svn/trunk@442 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 35ceb7807..ba4274c1c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -696,17 +696,23 @@ endline = try (do -- links -- --- a reference label for a link -reference = do +rawLabel = try $ do char labelStart - notFollowedBy (char noteStart) -- allow for embedded brackets: - label <- manyTill ((do{res <- reference; - return $ [Str "["] ++ res ++ [Str "]"]}) <|> - count 1 inline) - (char labelEnd) - return (normalizeSpaces (concat label)) + raw <- manyTill (do{res <- rawLabel; return ("[" ++ res ++ "]")} <|> + count 1 anyChar) (char labelEnd) + return $ concat raw +-- a reference label for a link +reference = try $ do + notFollowedBy (try (do{char labelStart; char noteStart})) + raw <- rawLabel + oldInput <- getInput + setInput raw + label <- many inline + setInput oldInput + return (normalizeSpaces label) + -- source for a link, with optional title source = try (do char srcStart -- cgit v1.2.3