diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-06 20:47:00 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-06 20:47:00 +0000 |
commit | 233148f9638f637871391cbed239068aeddb6cca (patch) | |
tree | bda8ced5e165d64c9c69e361718c13282514bf94 /src/Text | |
parent | 58dcef062556067b753892c8020d7f8c4e0bed0c (diff) | |
download | pandoc-233148f9638f637871391cbed239068aeddb6cca.tar.gz |
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
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 22 |
1 files changed, 14 insertions, 8 deletions
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 |