aboutsummaryrefslogtreecommitdiff
path: root/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-08-06 03:34:06 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-08-06 03:34:06 +0000
commit05b366a0b217a6cae33bd1d36b66faa211860ba8 (patch)
treef016e59b9ced56fedef1874a528741bc8000ac2d /Text/Pandoc/Readers
parentabf2dc78ac2ba635547ec288f264491d7bc26978 (diff)
downloadpandoc-05b366a0b217a6cae33bd1d36b66faa211860ba8.tar.gz
Small improvements to citation parsing in markdown reader.
(Don't allow blank lines inside citations.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1382 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text/Pandoc/Readers')
-rw-r--r--Text/Pandoc/Readers/Markdown.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs
index 088adb38b..89dbfe9a9 100644
--- a/Text/Pandoc/Readers/Markdown.hs
+++ b/Text/Pandoc/Readers/Markdown.hs
@@ -1173,18 +1173,18 @@ chkCit t = do
case lookupKeySrc (stateKeys st) [Str $ fst t] of
Just _ -> fail "This is a link"
Nothing -> if elem (fst t) $ stateCitations st
- then return $ Just t
- else return $ Nothing
+ then return $ Just t
+ else return $ Nothing
citeMarker :: GenParser Char ParserState String
-citeMarker = string "[" >> manyTill anyChar (try $ string "]")
+citeMarker = char '[' >> manyTill ( noneOf "\n" <|> (newline >>~ notFollowedBy blankline) ) (char ']')
parseCitation :: GenParser Char ParserState [(String,String)]
parseCitation = try $ sepBy (parseLabel) (oneOf ";")
parseLabel :: GenParser Char ParserState (String,String)
parseLabel = try $ do
- res <- sepBy (skipMany (oneOf "\t\n ") >> many1 (noneOf "@;")) (oneOf "@")
+ res <- sepBy (skipSpaces >> optional newline >> skipSpaces >> many1 (noneOf "@;")) (oneOf "@")
case res of
[lab,loc] -> return (lab, loc)
[lab] -> return (lab, "" )