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
This commit is contained in:
fiddlosopher 2007-07-09 06:23:59 +00:00
parent 655363da51
commit d58dca502e

View file

@ -495,19 +495,27 @@ referenceKey = do
option "" blanklines option "" blanklines
return result 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 imageKey = try $ do
string ".. |" string ".. |"
ref <- manyTill inline (char '|') ref <- manyTill inline (char '|')
skipSpaces skipSpaces
string "image::" string "image::"
src <- manyTill anyChar newline src <- targetURI
return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "") return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "")
anonymousKey = try $ do anonymousKey = try $ do
oneOfStrings [".. __:", "__"] oneOfStrings [".. __:", "__"]
skipSpaces src <- targetURI
option ' ' newline
src <- manyTill anyChar newline
state <- getState state <- getState
return $ KeyBlock [Str "_"] (removeLeadingTrailingSpace src, "") return $ KeyBlock [Str "_"] (removeLeadingTrailingSpace src, "")
@ -515,17 +523,13 @@ regularKeyQuoted = try $ do
string ".. _`" string ".. _`"
ref <- manyTill inline (char '`') ref <- manyTill inline (char '`')
char ':' char ':'
skipSpaces src <- targetURI
option ' ' newline
src <- manyTill anyChar newline
return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "") return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "")
regularKey = try $ do regularKey = try $ do
string ".. _" string ".. _"
ref <- manyTill inline (char ':') ref <- manyTill inline (char ':')
skipSpaces src <- targetURI
option ' ' newline
src <- manyTill anyChar newline
return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "") return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "")
-- --