mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
MediaWiki writer: put nowiki around possible URLs.
Otherwise they get linkified automatically. Closes #11834.
This commit is contained in:
@@ -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>"
|
||||
|
||||
@@ -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>
|
||||
```
|
||||
Reference in New Issue
Block a user