# 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

RFC 123

!! html/parsoid

RFC 123

!! end !! test Magic links: RFC (T2479) !! options cat !! wikitext RFC 822 !! metadata cat=Pages_using_RFC_magic_links sort= !! html/php

RFC 822

!! html/parsoid

RFC 822

!! end !! test Magic links: RFC (T67278) !! wikitext This is RFC 822 but thisRFC 822 is not RFC 822linked. !! html/php

This is RFC 822 but thisRFC 822 is not RFC 822linked.

!! html/parsoid

This is RFC 822 but thisRFC 822 is not RFC 822linked.

!! end !! test Magic links: RFC (w/ non-newline whitespace, T30950/T31025) !! wikitext RFC 822 RFC 822 !! html/php

RFC 822 RFC 822

!! html/parsoid

RFC 822 RFC 822

!! end !! test Magic links: ISBN (T3937) !! options cat !! wikitext ISBN 0-306-40615-2 !! metadata cat=Pages_using_ISBN_magic_links sort= !! html/php

ISBN 0-306-40615-2

!! html/parsoid

ISBN 0-306-40615-2

!! 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

This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.

!! html/parsoid

This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.

!! 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

ISBN 978 0 316 09811 3 ISBN 9780316098113 ISBN 978 0316098113

!! html/parsoid

ISBN 978 0 316 09811 3 ISBN 9780316098113 ISBN 978 0316098113

!! end !! test Magic links: PMID incorrectly converts space to underscore !! wikitext PMID 1234 !! html/php

PMID 1234

!! html/parsoid

PMID 1234

!! end !! test Magic links: PMID (T67278) !! options cat !! wikitext This is PMID 1234 but thisPMID 1234 is not PMID 1234linked. !! metadata cat=Pages_using_PMID_magic_links sort= !! html/php

This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.

!! html/parsoid

This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.

!! end !! test Magic links: PMID (w/ non-newline whitespace, T30950/T31025) !! wikitext PMID 1234 PMID 1234 !! html/php

PMID 1234 PMID 1234

!! html/parsoid

PMID 1234 PMID 1234

!! end # 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://datatracker.ietf.org/doc/html/rfc1234 foo] !! html/php

Xfoo

Xfoo

!! html/parsoid

Xfoo

Xfoo

!! end !! test Magic links: All disabled (T47942) !! config wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false} !! options cat !! wikitext ISBN 0-306-40615-2 PMID 1234 RFC 4321 !! metadata !! html

ISBN 0-306-40615-2 PMID 1234 RFC 4321

!! end !! test Magic links: html2wt of old wikitext when disabled (T47942) !! config wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false} !! options parsoid=html2wt !! html/parsoid

ISBN 0-306-40615-2 PMID 1234 RFC 4321

!! wikitext [[Special:BookSources/0306406152|ISBN 0-306-40615-2]] [//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract PMID 1234] [https://datatracker.ietf.org/doc/html/rfc4321 RFC 4321] !! end # PMID has an interwiki setup (if the pmid-interwiki option is set), but RFC # doesn't. Check that we round-trip correctly from the interwiki format, # whether magic links are enabled or not (and whether the interwiki is # present or not). !! test Prefer PMID magic link, no interwiki and magic links enabled (T145590#8608455) !! wikitext PMID 234 !! html/php

PMID 234

!! html/parsoid

PMID 234

!! end !! test Prefer PMID magic link, interwiki and magic links enabled (T145590#8608455) !! options pmid-interwiki !! wikitext PMID 234 !! html/php

PMID 234

!! html/parsoid

PMID 234

!! end !! test Round-trip PMID interwiki, magic links enabled (T145590#8608455) !! options pmid-interwiki !! wikitext [[pmid:234|PMID 234]] !! html/php

PMID 234

!! html/parsoid

PMID 234

    !! end

    !! test
    Prefer PMID interwiki, magic links disabled (T145590#8608455)
    !! options
    pmid-interwiki
    !! config
    wgEnableMagicLinks={"PMID":false,"RFC":false}
    !! wikitext
    [[pmid:234|PMID 234]]

    [https://datatracker.ietf.org/doc/html/rfc4321 RFC 4321]
    !! html/php

PMID 234

RFC 4321

!! html/parsoid

PMID 234

RFC 4321

    !! end

    !! test
    Preder PMID extlink if no interwiki, magic links disabled (T145590#8608455)
    !! options
    parsoid=html2wt
    !! config
    wgEnableMagicLinks={"PMID":false,"RFC":false}
    !! wikitext
    [//www.ncbi.nlm.nih.gov/pubmed/234?dopt=Abstract PMID 234]
    !! html/parsoid

PMID 234

!! end !! article Foo !! text FOO !! endarticle !! test Magic links inside links (not autolinked) !! wikitext [[Foo|http://example.com]] [[Foo|RFC 1234]] [[Foo|PMID 1234]] [[Foo|ISBN 123456789x]] [http://foo.com http://example.com] [http://foo.com RFC 1234] [http://foo.com PMID 1234] [http://foo.com ISBN 123456789x] !! html/php

http://example.com RFC 1234 PMID 1234 ISBN 123456789x

http://example.com RFC 1234 PMID 1234 ISBN 123456789x

!! html/parsoid

http://example.com RFC 1234 PMID 1234 ISBN 123456789x

http://example.com RFC 1234 PMID 1234 ISBN 123456789x

!! end !! test WTS of magic word text (T109371) !! options parsoid=html2wt !! html/parsoid

RFC 1234

RFC 1234

RFC 1234

!! wikitext RFC 1234 [http://foo.com RFC 1234] [[Foo|RFC 1234]] !! end !! test T4304: HTML attribute safety (ISBN) !! wikitext
!! html
!! end !! test T4304: HTML attribute safety (RFC) !! wikitext
!! html
!! end !! test T4304: HTML attribute safety (PMID) !! wikitext
!! html
!! end !! test ISBN code coverage !! wikitext ISBN 978-0-1234-56 789 !! html/php

ISBN 978-0-1234-56 789

!! html/parsoid

ISBN 978-0-1234-56 789

!! end !! test ISBN followed by 5 spaces !! wikitext ISBN !! html

ISBN

!! end !! test Double ISBN !! wikitext ISBN ISBN 1234567890 !! html/php

ISBN ISBN 1234567890

!! html/parsoid

ISBN ISBN 1234567890

!! end # Uppercase X and lowercase x as well !! test ISBN with an X !! wikitext ISBN 3-462-04561-X ISBN 3-462-04561-x ISBN 080442957X ISBN 080442957x ISBN 978080442957X ISBN 978080442957x !! html/php

ISBN 3-462-04561-X ISBN 3-462-04561-x ISBN 080442957X ISBN 080442957x ISBN 978080442957X ISBN 978080442957x

!! html/parsoid

ISBN 3-462-04561-X ISBN 3-462-04561-x ISBN 080442957X ISBN 080442957x ISBN 978080442957X ISBN 978080442957x

!! end !! test ISBN with empty prefix (parsoid test) !! wikitext ISBN 1234567890 !! html/php

ISBN 1234567890

!! html/parsoid

ISBN 1234567890

!! end !! test T24905: followed by ISBN followed by !! wikitext (fr) ISBN 2753300917 [http://www.example.com example.com] !! html/php

(fr) ISBN 2753300917 example.com

!! html/parsoid

(fr) ISBN 2753300917 example.com

!! end !! test Double RFC !! wikitext RFC RFC 1234 !! html/php

RFC RFC 1234

!! html/parsoid

RFC RFC 1234

!! end !! test Double RFC with a wiki link !! wikitext RFC [[RFC 1234]] !! html/php

RFC RFC 1234

!! html/parsoid

RFC RFC 1234

!! end !! test RFC code coverage !! wikitext RFC 983 987 !! html/php

RFC 983 987

!! html/parsoid

RFC 983 987

!! end !! test ISBN with a dummy number !! wikitext ISBN --- !! html

ISBN ---

!! end !! test ISBN with space-delimited number !! wikitext ISBN 92 9017 032 8 !! html/php

ISBN 92 9017 032 8

!! html/parsoid

ISBN 92 9017 032 8

!! end !! test ISBN with multiple spaces, no number !! wikitext ISBN foo !! html

ISBN foo

!! end !! test ISBN length !! wikitext ISBN 123456789 ISBN 1234567890 ISBN 12345678901 !! html/php

ISBN 123456789

ISBN 1234567890

ISBN 12345678901

!! html/parsoid

ISBN 123456789

ISBN 1234567890

ISBN 12345678901

!! end !! test ISBN with trailing year (T9110) !! wikitext ISBN 1-234-56789-0 - 2006 ISBN 1 234 56789 0 - 2006 !! html/php

ISBN 1-234-56789-0 - 2006

ISBN 1 234 56789 0 - 2006

!! html/parsoid

ISBN 1-234-56789-0 - 2006

ISBN 1 234 56789 0 - 2006

!! end !! test Edited ISBN links not serializable as ISBN links should serialize as wikilinks (magic links enabled) !! options parsoid=html2wt !! html/parsoid ISBN 1234567895 !! wikitext [[Special:BookSources/1234567890|ISBN 1234567895]] !! end !! test Edited ISBN links not serializable as ISBN links should serialize as wikilinks (magic links disabled) !! config wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false} !! options parsoid=html2wt !! html/parsoid ISBN 1234567895 !! wikitext [[Special:BookSources/1234567890|ISBN 1234567895]] !! end !! test Edited RFC links not serializable as RFC links should serialize as extlinks !! options parsoid=html2wt !! html/parsoid New RFC !! wikitext [https://datatracker.ietf.org/doc/html/rfc123 New RFC] !! end !! test Edited PMID links not serializable as PMID links should serialize as extlinks !! options parsoid=html2wt !! html/parsoid New PMID !! wikitext [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID] !! end !! test Edited PMID links not serializable as PMID links should serialize as wikilinks if possible !! options parsoid=html2wt pmid-interwiki !! html/parsoid New PMID !! wikitext [[pmid:123|New PMID]] !! end