MediaWiki writer: put nowiki around possible URLs.

Otherwise they get linkified automatically.
Closes #11834.
This commit is contained in:
John MacFarlane
2026-08-27 19:55:16 -07:00
parent 6f2dcd886c
commit 9dfad4005d
2 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -458,7 +458,10 @@ inlineToMediaWiki (Str str) = do
if inDefLabel
then T.intercalate "<nowiki>:</nowiki>" $
map escapeText $ T.splitOn ":" str
else escapeText str
else
(if "://" `T.isInfixOf` str -- see #11834
then inNowiki
else id) $ escapeText str
inlineToMediaWiki (Math mt str) = return $ literal $
"<math display=\"" <>
@@ -1169,3 +1172,6 @@ startsWithListMarker t =
case T.uncons t of
Nothing -> False
Just (c,_) -> c == '#' || c == ':' || c == ';' || c == '*'
inNowiki :: Text -> Text
inNowiki t = "<nowiki>" <> t <> "</nowiki>"
+6
View File
@@ -0,0 +1,6 @@
```
% pandoc -t mediawiki
http://foo.bar (https://foo.bar.baz)
^D
<nowiki>http://foo.bar</nowiki> <nowiki>(https://foo.bar.baz)</nowiki>
```