Markdown writer: Use autolink when link text matches url.

Previously we also checked for a null title, but this
test fails for links produced by citeproc-hs in bibliographies.

So, if the link has a title, it will be lost on conversion
to an autolink, but that seems okay.
This commit is contained in:
John MacFarlane 2013-01-26 14:01:50 -08:00
parent 412863df7f
commit 2f50406c7f

View file

@ -644,9 +644,9 @@ inlineToMarkdown opts (Link txt (src, tit)) = do
then empty
else text $ " \"" ++ tit ++ "\""
let srcSuffix = if isPrefixOf "mailto:" src then drop 7 src else src
let useAuto = case (tit,txt) of
("", [Str s]) | escapeURI s == srcSuffix -> True
_ -> False
let useAuto = case txt of
[Str s] | escapeURI s == srcSuffix -> True
_ -> False
let useRefLinks = writerReferenceLinks opts && not useAuto
ref <- if useRefLinks then getReference txt (src, tit) else return []
reftext <- inlineListToMarkdown opts ref