From 44b136740b7ab988b96ee67fb67d7395ef3823ce Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 28 Jul 2007 19:14:50 +0000 Subject: Changes to Markdown reader: + added try to def of indentSpaces + in def of 'reference', check to make sure it's not a note reference first. git-svn-id: https://pandoc.googlecode.com/svn/trunk@827 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc/Readers/Markdown.hs') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 3f4c76be4..0ecb09178 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -73,7 +73,7 @@ specialChars = "\\[]*_~`<>$!^-.&'\"" -- | Skip a single endline if there is one. skipEndline = option Space endline -indentSpaces = do +indentSpaces = try $ do state <- getState let tabStop = stateTabStop state try (count tabStop (char ' ')) <|> @@ -194,7 +194,7 @@ rawLine = try $ do contents <- many1 nonEndline end <- option "" (do newline - option "" (try indentSpaces) + option "" indentSpaces return "\n") return (contents ++ end) @@ -206,8 +206,8 @@ noteBlock = try $ do failIfStrict ref <- noteMarker char ':' - option ' ' (try blankline) - option "" (try indentSpaces) + option ' ' blankline + option "" indentSpaces raw <- sepBy rawLines (try (do {blankline; indentSpaces})) option "" blanklines -- parse the extracted text, which may contain various block elements: @@ -408,7 +408,7 @@ listContinuation start = try (do listContinuationLine start = try (do notFollowedBy' blankline notFollowedBy' start - option "" (try indentSpaces) + option "" indentSpaces result <- manyTill anyChar newline return (result ++ "\n")) @@ -915,7 +915,8 @@ endline = try (do -- -- a reference label for a link -reference = inlinesInBalanced "[" "]" >>= (return . normalizeSpaces) +reference = notFollowedBy' (string "[^") >> -- footnote reference + inlinesInBalanced "[" "]" >>= (return . normalizeSpaces) -- source for a link, with optional title source = try $ do -- cgit v1.2.3