@@ -35,7 +35,7 @@ import Text.Pandoc.Writers.Shared
3535import Text.Pandoc.Options
3636import Text.Pandoc.Walk (query)
3737import Text.Printf ( printf )
38−import Data.List ( intercalate, isPrefixOf )
38+import Data.List ( intercalate )
3939import Control.Monad.State
4040import Text.Pandoc.Pretty
4141import Text.Pandoc.Templates ( renderTemplate' )
@@ -283,14 +283,6 @@ inlineToConTeXt (RawInline "tex" str) = return $ text str
283283inlineToConTeXt (RawInline _ _) = return empty
284284inlineToConTeXt (LineBreak) = return $ text "\\crlf" <> cr
285285inlineToConTeXt Space = return space
286−-- autolink
287−inlineToConTeXt (Link [Str str] (src, tit))
288− | if "mailto:" `isPrefixOf` src
289− then src == escapeURI ("mailto:" ++ str)
290− else src == escapeURI str =
291− inlineToConTeXt (Link
292− [RawInline "context" "\\hyphenatedurl{", Str str, RawInline "context" "}"]
293− (src, tit))
294286-- Handle HTML-like internal document references to sections
295287inlineToConTeXt (Link txt (('#' : ref), _)) = do
296288 opts <- gets stOptions
@@ -305,6 +297,7 @@ inlineToConTeXt (Link txt (('#' : ref), _)) = do
305297 <> brackets (text ref)
306298
307299inlineToConTeXt (Link txt (src, _)) = do
300+ let isAutolink = txt == [Str src]
308301 st <- get
309302 let next = stNextRef st
310303 put $ st {stNextRef = next + 1}
@@ -313,8 +306,9 @@ inlineToConTeXt (Link txt (src, _)) = do
313306 return $ "\\useURL"
314307 <> brackets (text ref)
315308 <> brackets (text $ escapeStringUsing [('#',"\\#"),('%',"\\%")] src)
316− <> brackets empty
317− <> brackets label
309+ <> (if isAutolink
310+ then empty
311+ else brackets empty <> brackets label)
318312 <> "\\from"
319313 <> brackets (text ref)
320314inlineToConTeXt (Image _ (src, _)) = do