mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 00:05:00 +00:00
Replace use of Parser::$mStripState, deprecated in 1.35
The replacement, Parser::getStripState(), was added to MediaWiki in 1.34. The extension.json for this extension already requires MW >= 1.35. Bug: T275160 Change-Id: I062ac8b69756a7ad35d8cc744b4735fd2e70f13e
This commit is contained in:
parent
eba0e49c71
commit
96da9fe0e9
|
@ -52,7 +52,7 @@ class Scribunto_LuaTextLibrary extends Scribunto_LuaLibraryBase {
|
|||
*/
|
||||
public function textUnstrip( $s ) {
|
||||
$this->checkType( 'unstrip', 1, $s, 'string' );
|
||||
$stripState = $this->getParser()->mStripState;
|
||||
$stripState = $this->getParser()->getStripState();
|
||||
return [ $stripState->killMarkers( $stripState->unstripNoWiki( $s ) ) ];
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Scribunto_LuaTextLibrary extends Scribunto_LuaLibraryBase {
|
|||
*/
|
||||
public function textUnstripNoWiki( $s ) {
|
||||
$this->checkType( 'unstripNoWiki', 1, $s, 'string' );
|
||||
return [ $this->getParser()->mStripState->unstripNoWiki( $s ) ];
|
||||
return [ $this->getParser()->getStripState()->unstripNoWiki( $s ) ];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ class Scribunto_LuaTextLibrary extends Scribunto_LuaLibraryBase {
|
|||
*/
|
||||
public function killMarkers( $s ) {
|
||||
$this->checkType( 'killMarkers', 1, $s, 'string' );
|
||||
return [ $this->getParser()->mStripState->killMarkers( $s ) ];
|
||||
return [ $this->getParser()->getStripState()->killMarkers( $s ) ];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -440,7 +440,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
] + $args );
|
||||
$this->assertSame(
|
||||
'<pre style="margin-left: 1.6em">foo</pre>',
|
||||
$parser->mStripState->unstripBoth( $ret['return'] ),
|
||||
$parser->getStripState()->unstripBoth( $ret['return'] ),
|
||||
'callParserFunction works for {{#tag:pre|foo|style=margin-left: 1.6em}}'
|
||||
);
|
||||
|
||||
|
@ -452,7 +452,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
] + $args );
|
||||
$this->assertSame(
|
||||
'<pre style="margin-left: 1.6em">foo</pre>',
|
||||
$parser->mStripState->unstripBoth( $ret['return'] ),
|
||||
$parser->getStripState()->unstripBoth( $ret['return'] ),
|
||||
'extensionTag works for {{#tag:pre|foo|style=margin-left: 1.6em}}'
|
||||
);
|
||||
|
||||
|
@ -463,7 +463,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
] + $args );
|
||||
$this->assertSame(
|
||||
'<pre style="margin-left: 1.6em">foo</pre>',
|
||||
$parser->mStripState->unstripBoth( $ret['return'] ),
|
||||
$parser->getStripState()->unstripBoth( $ret['return'] ),
|
||||
'extensionTag works for {{#tag:pre|foo|style=margin-left: 1.6em}}'
|
||||
);
|
||||
|
||||
|
@ -650,7 +650,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
$count = 0;
|
||||
$wikitext = "{{#invoke:TestVolatileCaching|$func}}";
|
||||
$text = $frame->expand( $pp->preprocessToObj( "$wikitext $wikitext" ) );
|
||||
$text = $parser->mStripState->unstripBoth( $text );
|
||||
$text = $parser->getStripState()->unstripBoth( $text );
|
||||
$this->assertTrue( $frame->isVolatile(), "Frame is marked volatile" );
|
||||
$this->assertEquals( '1 2', $text, "Volatile wikitext was not cached" );
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
|
||||
$frame = $pp->newFrame();
|
||||
$text = $frame->expand( $pp->preprocessToObj( "{{#invoke:Bug65687|test|foo}}" ) );
|
||||
$text = $parser->mStripState->unstripBoth( $text );
|
||||
$text = $parser->getStripState()->unstripBoth( $text );
|
||||
$this->assertEquals( 'ok', $text, 'mw.loadData allowed access to frame args' );
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
$text = $frame->expand( $pp->preprocessToObj(
|
||||
"{{#invoke:Bug67498-$how|test|foo}} -- {{#invoke:Bug67498-$how|test|bar}}"
|
||||
) );
|
||||
$text = $parser->mStripState->unstripBoth( $text );
|
||||
$text = $parser->getStripState()->unstripBoth( $text );
|
||||
$text = explode( ' -- ', $text );
|
||||
$this->assertEquals( 'foo foo', $text[0],
|
||||
"mw.getCurrentFrame() failed from a module loaded $how"
|
||||
|
@ -765,7 +765,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
$text = $frame->expand( $pp->preprocessToObj(
|
||||
"{{#invoke:Outer|echo|oarg|{{#invoke:Inner|test|iarg}}}}"
|
||||
) );
|
||||
$text = $parser->mStripState->unstripBoth( $text );
|
||||
$text = $parser->getStripState()->unstripBoth( $text );
|
||||
$this->assertSame(
|
||||
'(Outer: 1=oarg, 2=(Inner: mod_name=Module:Inner, mod_1=iarg, name=Module:Inner, 1=iarg))',
|
||||
$text
|
||||
|
@ -827,7 +827,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
|
||||
$frame = $pp->newFrame();
|
||||
$text = $frame->expand( $pp->preprocessToObj( ">{{#invoke:T236092|foo}}<" ) );
|
||||
$text = $parser->mStripState->unstripBoth( $text );
|
||||
$text = $parser->getStripState()->unstripBoth( $text );
|
||||
$this->assertSame( '>false<', $text );
|
||||
}
|
||||
|
||||
|
@ -849,7 +849,7 @@ class Scribunto_LuaCommonTest extends Scribunto_LuaEngineTestBase {
|
|||
|
||||
$frame = $pp->newFrame();
|
||||
$text = $frame->expand( $pp->preprocessToObj( ">{{#invoke:TestAddWarning|foo}}<" ) );
|
||||
$text = $parser->mStripState->unstripBoth( $text );
|
||||
$text = $parser->getStripState()->unstripBoth( $text );
|
||||
$this->assertSame( '>ok<', $text );
|
||||
$this->assertSame( [ 'Don\'t panic!' ], $parser->getOutput()->getWarnings() );
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ class Scribunto_LuaTextLibraryTest extends Scribunto_LuaEngineUnitTestBase {
|
|||
'nowiki' => Parser::MARKER_PREFIX . '-test-nowiki-' . Parser::MARKER_SUFFIX,
|
||||
'general' => Parser::MARKER_PREFIX . '-test-general-' . Parser::MARKER_SUFFIX,
|
||||
];
|
||||
$parser->mStripState->addNoWiki( $markers['nowiki'], 'NoWiki' );
|
||||
$parser->mStripState->addGeneral( $markers['general'], 'General' );
|
||||
$parser->getStripState()->addNoWiki( $markers['nowiki'], 'NoWiki' );
|
||||
$parser->getStripState()->addGeneral( $markers['general'], 'General' );
|
||||
$interpreter = $this->getEngine()->getInterpreter();
|
||||
$interpreter->callFunction(
|
||||
$interpreter->loadString( 'mw.text.stripTest = ...', 'fortest' ),
|
||||
|
|
Loading…
Reference in a new issue