aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index f81fda5d4..f1e985bb7 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -377,17 +377,15 @@ inlineToMediaWiki _ (LineBreak) = return "<br />\n"
inlineToMediaWiki _ Space = return " "
inlineToMediaWiki opts (Link txt (src, _)) = do
- link <- inlineListToMediaWiki opts txt
- let useAuto = txt == [Code src]
- let src' = if isURI src
- then src
- else if take 1 src == "/"
- then "http://{{SERVERNAME}}" ++ src
- else "http://{{SERVERNAME}}/" ++ src
- return $ if useAuto
- then src'
- else "[" ++ src' ++ " " ++ link ++ "]"
-
+ label <- inlineListToMediaWiki opts txt
+ if txt == [Code src] -- autolink
+ then return src
+ else if isURI src
+ then return $ "[" ++ src ++ " " ++ label ++ "]"
+ else return $ "[[" ++ src' ++ "|" ++ label ++ "]]"
+ where src' = case src of
+ '/':xs -> xs -- with leading / it's a
+ _ -> src -- link to a help page
inlineToMediaWiki opts (Image alt (source, tit)) = do
alt' <- inlineListToMediaWiki opts alt
let txt = if (null tit)