11 [
'hello this is ~~~',
12 "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
14 [
'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
15 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
26 $title = Title::newFromText( str_replace(
'::',
'__', __METHOD__ ) );
28 $user->setName(
"127.0.0.1" );
29 $popts = ParserOptions::newFromUser( $user );
30 $text =
$wgParser->preSaveTransform( $text, $title, $user, $popts );
32 $this->assertEquals( $expected, $text );
45 "<p class='foo'>Text.</p>",
46 "<p class='foo'>Text.</p>",
53 "<p>Text.</p><p>More text.</p>",
54 "<p>Text.</p><p>More text.</p>",
67 $this->assertEquals( $expected, Parser::stripOuterParagraph( $text ) );
77 $title = Title::newFromText(
'foo' );
79 $wgParser->setHook(
'recursivecallparser', [ $this,
'helperParserFunc' ] );
80 $wgParser->parse(
'<recursivecallparser>baz</recursivecallparser>', $title, $po );
84 $title = Title::newFromText(
'foo' );
94 $title = Title::newFromText( str_replace(
'::',
'__', __METHOD__ ) );
96 $frame =
$wgParser->getPreprocessor()->newFrame();
98 [
'pre',
'foo',
'style' =>
'margin-left: 1.6em' ]
103 'text' =>
'<pre style="margin-left: 1.6em">foo</pre>',
104 ],
$ret,
'callParserFunction works for {{#tag:pre|foo|style=margin-left: 1.6em}}' );
114 $title = Title::newFromText( str_replace(
'::',
'__', __METHOD__ ) );
123 'fromtitle' => $title->getPrefixedDBkey(),
133 'fromtitle' =>
false,
134 'byteoffset' =>
null,
143 'fromtitle' => $title->getPrefixedDBkey(),
147 ],
$out->getSections(),
'getSections() with proper value when <h2> is used' );
154 $this->assertEquals( $expected, Parser::normalizeLinkUrl( $url ), $explanation );
160 'Escaping of unsafe characters',
161 'http://example.org/foo bar?param[]="value"¶m[]=valüe',
162 'http://example.org/foo%20bar?param%5B%5D=%22value%22¶m%5B%5D=val%C3%BCe',
165 'Case normalization of percent-encoded characters',
166 'http://example.org/%ab%cD%Ef%FF',
167 'http://example.org/%AB%CD%EF%FF',
170 'Unescaping of safe characters',
171 'http://example.org/%3C%66%6f%6F%3E?%3C%66%6f%6F%3E#%3C%66%6f%6F%3E',
172 'http://example.org/%3Cfoo%3E?%3Cfoo%3E#%3Cfoo%3E',
175 'Context-sensitive replacement of sometimes-safe characters',
176 'http://example.org/%23%2F%3F%26%3D%2B%3B?%23%2F%3F%26%3D%2B%3B#%23%2F%3F%26%3D%2B%3B',
177 'http://example.org/%23%2F%3F&=+;?%23/?%26%3D%2B%3B#%23/?&=+;',
static provideStripOuterParagraph()
testNormalizeLinkUrl( $explanation, $url, $expected)
provideNormalizeLinkUrl
testGetSections()
Parser ParserOutput::getSections.
testStripOuterParagraph( $text, $expected)
provideStripOuterParagraph
testPreSaveTransform( $text, $expected)
providePreSaveTransform
static providePreSaveTransform()
helperParserFunc( $input, $args, $parser)
static provideNormalizeLinkUrl()
testRecursiveParse()
MWException Parser state cleared while parsing.
Set options of the Parser.
Variant of the Message class.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
do that in ParserLimitReportFormat instead $parser
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
if(is_array($mode)) switch( $mode) $input