aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-09 06:51:06 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-09 06:51:06 +0000
commit1780228b7c93757fbb826955a849dcd752235c80 (patch)
treede486c14d2c23af43b4e8c1085b291693cb3b2d5 /src
parentd58dca502ed659c529802a1519be1a6d24129aef (diff)
downloadpandoc-1780228b7c93757fbb826955a849dcd752235c80.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs12
1 files changed, 10 insertions, 2 deletions
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