MediaWiki writer: Remove redundant display text for wiki links
Prior to this commit the MediaWiki writer always added the display text for a wiki link: * [[Help|Help]] * [[Bubbles|Everyone loves bubbles]] However the display text in the first example is redundant since MediaWiki uses the target as the default display text. The result being: * [[Help]] * [[Bubbles|Everyone loves bubbles]]
This commit is contained in:
parent
6fffa1ac78
commit
4dcb2b6fb6
2 changed files with 15 additions and 4 deletions
|
@ -450,6 +450,9 @@ inlineToMediaWiki (Link _ txt (src, _)) = do
|
|||
[Str s] | isURI src && escapeURI s == src -> return src
|
||||
_ -> return $ if isURI src
|
||||
then "[" <> src <> " " <> label <> "]"
|
||||
else
|
||||
if src == label
|
||||
then "[[" <> src' <> "]]"
|
||||
else "[[" <> src' <> "|" <> label <> "]]"
|
||||
-- with leading / it's a link to a help page
|
||||
where src' = fromMaybe src $ T.stripPrefix "/" src
|
||||
|
|
8
test/command/7808.md
Normal file
8
test/command/7808.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
Wiki links should have no display text, if their display text matches
|
||||
their target.
|
||||
```
|
||||
% pandoc -f mediawiki -t mediawiki
|
||||
[[Help]] [[Butter|Butter]] [[Bubbles|Everyone loves bubbles]]
|
||||
^D
|
||||
[[Help]] [[Butter]] [[Bubbles|Everyone loves bubbles]]
|
||||
```
|
Loading…
Reference in a new issue