From 1780228b7c93757fbb826955a849dcd752235c80 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Mon, 9 Jul 2007 06:51:06 +0000 Subject: Markdown reader: Parse bracketed text in inline footnotes. Previously, "test^[my [note] contains brackets]" would yield a note with contents "my [note". Now it yields a note with contents "my [note] contains brackets". New function: inlinesInBrackets. Resolves Issue 14. git-svn-id: https://pandoc.googlecode.com/svn/trunk@665 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 36bb3f760..eb771efe6 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1011,11 +1011,19 @@ note = try $ do Nothing -> fail "note not found" Just contents -> return (Note contents) +inlinesInBrackets = try $ do + char '[' + results <- many $ count 1 (choice [link, referenceLink, image]) <|> + try (do{res <- inlinesInBrackets; return + ([Str "["] ++ res ++ [Str "]"])}) <|> + (do{notFollowedBy (char ']'); count 1 inline}) + char ']' + return $ concat results + inlineNote = try $ do failIfStrict char noteStart - char labelStart - contents <- manyTill inline (char labelEnd) + contents <- inlinesInBrackets return (Note [Para contents]) rawLaTeXInline' = do -- cgit v1.2.3