This now aligns with Parsoid commit 00d6c00c5972705c0f88d398e4b78f757ef86f4b Change-Id: I051d1b29e480292078f681fc722a63d0d1588d15
174 lines
7 KiB
Text
174 lines
7 KiB
Text
# The parsoid-compatible option below is only relevant when we are running
|
||
# parser tests in integrated mode with Parsoid. This option is ignored
|
||
# when this test file is run with Parsoid in standalone mode.
|
||
!! options
|
||
parsoid-compatible=wt2html,wt2wt
|
||
version=2
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: internal link to RFC (T2479)
|
||
!! wikitext
|
||
[[RFC 123]]
|
||
!! html/php
|
||
<p><a href="/index.php?title=RFC_123&action=edit&redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123" class="new">RFC 123</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: RFC (T2479)
|
||
!! wikitext
|
||
RFC 822
|
||
!! html/php
|
||
<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: RFC (T67278)
|
||
!! wikitext
|
||
This is RFC 822 but thisRFC 822 is not RFC 822linked.
|
||
!! html/php
|
||
<p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
|
||
</p>
|
||
!! html/parsoid
|
||
<p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
|
||
!! wikitext
|
||
RFC      822
|
||
RFC
|
||
822
|
||
!! html/php
|
||
<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
|
||
RFC
|
||
822
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#Xa0;","srcContent":" "}'> </span> 822</a>
|
||
RFC
|
||
822</p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: ISBN (T3937)
|
||
!! wikitext
|
||
ISBN 0-306-40615-2
|
||
!! html/php
|
||
<p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: ISBN (T67278)
|
||
!! wikitext
|
||
This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
|
||
!! html/php
|
||
<p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
|
||
</p>
|
||
!! html/parsoid
|
||
<p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
|
||
!! wikitext
|
||
ISBN      978 0 316 09811 3
|
||
ISBN
|
||
9780316098113
|
||
ISBN 978
|
||
0316098113
|
||
!! html/php
|
||
<p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
|
||
ISBN
|
||
9780316098113
|
||
ISBN 978
|
||
0316098113
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span>3</a>
|
||
ISBN
|
||
9780316098113
|
||
ISBN 978
|
||
0316098113</p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: PMID incorrectly converts space to underscore
|
||
!! wikitext
|
||
PMID 1234
|
||
!! html/php
|
||
<p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: PMID (T67278)
|
||
!! wikitext
|
||
This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
|
||
!! html/php
|
||
<p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
|
||
</p>
|
||
!! html/parsoid
|
||
<p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
|
||
!! end
|
||
|
||
!! test
|
||
Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
|
||
!! wikitext
|
||
PMID      1234
|
||
PMID
|
||
1234
|
||
!! html/php
|
||
<p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
|
||
PMID
|
||
1234
|
||
</p>
|
||
!! html/parsoid
|
||
<p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#Xa0;","srcContent":" "}'> </span> 1234</a>
|
||
PMID
|
||
1234</p>
|
||
!! end
|
||
|
||
# <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
|
||
# since these are ExtLinkText, not MagicLinkText
|
||
!! test
|
||
Magic links: use appropriate serialization for "almost" magic links.
|
||
!! wikitext
|
||
X[[Special:BookSources/0978739256|foo]]
|
||
|
||
X[https://tools.ietf.org/html/rfc1234 foo]
|
||
!! html/php
|
||
<p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
|
||
</p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
|
||
<p>X<a rel="mw:ExtLink" href="https://tools.ietf.org/html/rfc1234" class="external text">foo</a></p>
|
||
!! end
|
||
|
||
# Parsoid fails this test
|
||
!! test
|
||
Magic links: All disabled (T47942)
|
||
!! options
|
||
wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
|
||
!! wikitext
|
||
ISBN 0-306-40615-2
|
||
PMID 1234
|
||
RFC 4321
|
||
!! html
|
||
<p>ISBN 0-306-40615-2
|
||
PMID 1234
|
||
RFC 4321
|
||
</p>
|
||
!! end
|