From d283f9c864fc4a9ed8ffa4711dda9014b886149b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 25 Jun 2016 10:56:37 -0700 Subject: Fixed RST links with no explicit link text. The link ``_ should have `foo` as both its link text and its URL. See RST spec at "The reference text may also be omitted, in which case the URI will be duplicated for use as the reference text. This is useful for relative URIs where the address or file name is also the desired reference text: See ``_ or ``__ for details." Closes Debian #828167 -- reported by Christian Heller. --- src/Text/Pandoc/Readers/RST.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 296c55f32..60d69638b 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -1126,7 +1126,10 @@ explicitLink = try $ do skipSpaces string "`_" optional $ char '_' -- anonymous form - return $ B.link (escapeURI $ trim src) "" label' + let label'' = if label' == mempty + then B.str src + else label' + return $ B.link (escapeURI $ trim src) "" label'' referenceLink :: RSTParser Inlines referenceLink = try $ do -- cgit v1.2.3