From b9e30ca8b7b8c5189ec2f6ad63301027070f6387 Mon Sep 17 00:00:00 2001
From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
Date: Sun, 6 Jan 2008 19:46:55 +0000
Subject: [PATCH] RST reader: Fixed bug in parsing explicit links (resolves
 Issue #44). The problem was that we were looking for inlines until a '<'
 character signaled the start of the URL.  So if you hit a reference-style
 link, it would keep looking til the end of the document.  Fix:  change inline
 => (notFollowedBy (char '`') >> inline).  Note that this won't allow code
 inlines in links, but these aren't allowed in resT anyway.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1175 788f1e2b-df1e-0410-8736-df70ead52e1b
---
 Text/Pandoc/Readers/RST.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Text/Pandoc/Readers/RST.hs b/Text/Pandoc/Readers/RST.hs
index 67a4f6539..fb3129eac 100644
--- a/Text/Pandoc/Readers/RST.hs
+++ b/Text/Pandoc/Readers/RST.hs
@@ -570,8 +570,9 @@ link = choice [explicitLink, referenceLink, autoLink]  <?> "link"
 
 explicitLink = try $ do
   char '`'
-  notFollowedBy (char '`') -- `` is marks start of inline code
-  label <- manyTill inline (try (spaces >> char '<'))
+  notFollowedBy (char '`') -- `` marks start of inline code
+  label <- manyTill (notFollowedBy (char '`') >> inline) 
+                    (try (spaces >> char '<'))
   src <- manyTill (noneOf ">\n ") (char '>')
   skipSpaces
   string "`_"