diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-06-25 10:56:37 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-06-25 10:56:37 -0700 |
commit | d283f9c864fc4a9ed8ffa4711dda9014b886149b (patch) | |
tree | 6567dacac13651f63bdf6bee564a9ee1ac4e3c04 /src/Text | |
parent | a4294800bfe91976697239ff15c1f87f518df6e8 (diff) | |
download | pandoc-d283f9c864fc4a9ed8ffa4711dda9014b886149b.tar.gz |
Fixed RST links with no explicit link text.
The link
`<foo>`_
should have `foo` as both its link text and its URL.
See RST spec at
<http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases>
"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 `<a_named_relative_link>`_ or `<an_anonymous_relative_link>`__
for details."
Closes Debian #828167 -- reported by Christian Heller.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 5 |
1 files changed, 4 insertions, 1 deletions
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 |