From f223196c35bf9d714e0d2f44bd6cae8f413e70b2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 23 Sep 2019 17:46:39 -0700 Subject: Man writer: suppress non-absolute link URLs. Motivation: in a man page there's not much use for relative URLs, which you can't follow. Absolute URLs are still useful. We previously suppressed relative URLs starting with '#' (purely internal links), but it makes sense to go a bit farther. Closes #5770. --- src/Text/Pandoc/Writers/Man.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 6bcc2b86f..f8c895e3c 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -310,9 +310,9 @@ inlineToMan _ LineBreak = return $ cr <> text ".PD 0" $$ text ".P" $$ text ".PD" <> cr inlineToMan _ SoftBreak = return space inlineToMan _ Space = return space -inlineToMan opts (Link _ txt ('#':_, _)) = - inlineListToMan opts txt -- skip internal links -inlineToMan opts (Link _ txt (src, _)) = do +inlineToMan opts (Link _ txt (src, _)) + | not (isURI src) = inlineListToMan opts txt -- skip relative links + | otherwise = do linktext <- inlineListToMan opts txt let srcSuffix = fromMaybe src (stripPrefix "mailto:" src) return $ case txt of -- cgit v1.2.3