From d58dca502ed659c529802a1519be1a6d24129aef Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Mon, 9 Jul 2007 06:23:59 +0000 Subject: [PATCH] RST reader: Allow hyperlink target URIs to be split over multiple lines, and to start on the line after the reference. Resolves Issue 7. git-svn-id: https://pandoc.googlecode.com/svn/trunk@664 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/RST.hs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 24a460b71..36d0f8403 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -495,19 +495,27 @@ referenceKey = do option "" blanklines return result +targetURI = try $ do + skipSpaces + option ' ' newline + contents <- many1 (try (do many spaceChar + newline + many1 spaceChar + noneOf " \t\n") <|> noneOf "\n") + blanklines + return contents + imageKey = try $ do string ".. |" ref <- manyTill inline (char '|') skipSpaces string "image::" - src <- manyTill anyChar newline + src <- targetURI return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "") anonymousKey = try $ do oneOfStrings [".. __:", "__"] - skipSpaces - option ' ' newline - src <- manyTill anyChar newline + src <- targetURI state <- getState return $ KeyBlock [Str "_"] (removeLeadingTrailingSpace src, "") @@ -515,17 +523,13 @@ regularKeyQuoted = try $ do string ".. _`" ref <- manyTill inline (char '`') char ':' - skipSpaces - option ' ' newline - src <- manyTill anyChar newline + src <- targetURI return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "") regularKey = try $ do string ".. _" ref <- manyTill inline (char ':') - skipSpaces - option ' ' newline - src <- manyTill anyChar newline + src <- targetURI return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "") --