From 60f700997cb781e925bfec84f4c1ee8739382892 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 29 Aug 2007 19:57:01 +0000 Subject: + Fixed bug introduced into referenceTitle by previous changes. Now it works as before. + Improved Markdown.pl-compatibility in referenceLink: the two parts of a reference-style link may be separated by one space, but not more... [a] [link], [not] [a link]. git-svn-id: https://pandoc.googlecode.com/svn/trunk@955 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 13345c6a9..877c78ab0 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -168,8 +168,8 @@ referenceKey = try $ do optional (char '<') src <- many (noneOf "> \n\t") optional (char '>') - tit <- option "" referenceTitle - blanklines + tit <- option "" referenceTitle + blanklines return $ KeyBlock label (removeTrailingSpace src, tit) referenceTitle = try $ do @@ -178,7 +178,8 @@ referenceTitle = try $ do skipSpaces tit <- (charsInBalanced '(' ')' >>= return . unwords . words) <|> do delim <- char '\'' <|> char '"' - manyTill anyChar (try (char delim >> blankline)) + manyTill anyChar (try (char delim >> skipSpaces >> + notFollowedBy (noneOf ")\n"))) return $ decodeCharacterReferences tit noteMarker = string "[^" >> manyTill (noneOf " \t\n") (char ']') @@ -825,8 +826,8 @@ link = try $ do -- a link like [this][ref] or [this][] or [this] referenceLink label = do - ref <- option [] (try (skipSpaces >> optional newline >> - skipSpaces >> reference)) + ref <- option [] (try (optional (char ' ') >> + optional (newline >> skipSpaces) >> reference)) let ref' = if null ref then label else ref state <- getState case lookupKeySrc (stateKeys state) ref' of -- cgit v1.2.3