aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-09 06:23:59 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-09 06:23:59 +0000
commitd58dca502ed659c529802a1519be1a6d24129aef (patch)
treefef56643a4972d33c4ff3ad2e18cad83e02c934f /src/Text/Pandoc/Readers
parent655363da5147b3b1483dc9ccd7c8b50f865815e2 (diff)
downloadpandoc-d58dca502ed659c529802a1519be1a6d24129aef.tar.gz
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
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs24
1 files 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, "")
--