git.iko.soy/typeable/pandoc
on master help sign in
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

commitd58dca502ed659c529802a1519be1a6d24129aef authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateMon 9 Jul 2007, 06:23 (19 years ago) parent655363d
1 file changed+14−10
src/Text/Pandoc/Readers/RST.hs+14−10
src/Text/Pandoc/Readers/RST.hs+14−10
@@ -495,19 +495,27 @@ referenceKey = do
495495 option "" blanklines
496496 return result
497497
498+targetURI = try $ do
499+ skipSpaces
500+ option ' ' newline
501+ contents <- many1 (try (do many spaceChar
502+ newline
503+ many1 spaceChar
504+ noneOf " \t\n") <|> noneOf "\n")
505+ blanklines
506+ return contents
507+
498508imageKey = try $ do
499509 string ".. |"
500510 ref <- manyTill inline (char '|')
501511 skipSpaces
502512 string "image::"
503− src <- manyTill anyChar newline
513+ src <- targetURI
504514 return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "")
505515
506516anonymousKey = try $ do
507517 oneOfStrings [".. __:", "__"]
508− skipSpaces
509− option ' ' newline
510− src <- manyTill anyChar newline
518+ src <- targetURI
511519 state <- getState
512520 return $ KeyBlock [Str "_"] (removeLeadingTrailingSpace src, "")
513521
@@ -515,17 +523,13 @@ regularKeyQuoted = try $ do
515523 string ".. _`"
516524 ref <- manyTill inline (char '`')
517525 char ':'
518− skipSpaces
519− option ' ' newline
520− src <- manyTill anyChar newline
526+ src <- targetURI
521527 return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "")
522528
523529regularKey = try $ do
524530 string ".. _"
525531 ref <- manyTill inline (char ':')
526− skipSpaces
527− option ' ' newline
528− src <- manyTill anyChar newline
532+ src <- targetURI
529533 return $ KeyBlock (normalizeSpaces ref) (removeLeadingTrailingSpace src, "")
530534
531535 --