aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-09-23 17:46:39 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-09-23 17:46:39 -0700
commitf223196c35bf9d714e0d2f44bd6cae8f413e70b2 (patch)
tree8e26972eea5f780be5d51a8735a0c63f3f1a4228 /src
parente99050283edfd976ffba51256140a252d1e26508 (diff)
downloadpandoc-f223196c35bf9d714e0d2f44bd6cae8f413e70b2.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs6
1 files changed, 3 insertions, 3 deletions
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