mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 22:45:20 +00:00
Merge "Rename appendText() to resolveFollow()"
This commit is contained in:
commit
ab20cb3cdf
|
@ -124,7 +124,7 @@ class ReferenceStack {
|
|||
$argv ];
|
||||
} elseif ( $text !== null ) {
|
||||
// We know the parent already, so just perform the follow="…" and bail out
|
||||
$this->appendText( $group, $follow, ' ' . $text );
|
||||
$this->resolveFollow( $group, $follow, $text );
|
||||
$this->refSequence--;
|
||||
}
|
||||
// A follow="…" never gets its own footnote marker
|
||||
|
@ -374,9 +374,9 @@ class ReferenceStack {
|
|||
return $this->refs[$group] ?? [];
|
||||
}
|
||||
|
||||
private function appendText( string $group, string $name, string $text ): void {
|
||||
$this->refs[$group][$name]['text'] ??= '';
|
||||
$this->refs[$group][$name]['text'] .= $text;
|
||||
private function resolveFollow( string $group, string $follow, string $text ): void {
|
||||
$this->refs[$group][$follow]['text'] ??= '';
|
||||
$this->refs[$group][$follow]['text'] .= " $text";
|
||||
}
|
||||
|
||||
public function setText( string $group, string $name, string $text ): void {
|
||||
|
|
|
@ -1023,14 +1023,14 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
|
|||
$this->assertSame( [], $stack->getGroupRefs( 'empty' ) );
|
||||
}
|
||||
|
||||
public function testAppendText() {
|
||||
public function testResolveFollow() {
|
||||
$stack = $this->newStack();
|
||||
|
||||
$stack->appendText( 'group', 'name', 'set' );
|
||||
$this->assertSame( [ 'text' => 'set' ], $stack->refs['group']['name'] );
|
||||
$stack->resolveFollow( 'group', 'name', 'set' );
|
||||
$this->assertSame( [ 'text' => ' set' ], $stack->refs['group']['name'] );
|
||||
|
||||
$stack->appendText( 'group', 'name', ' and append' );
|
||||
$this->assertSame( [ 'text' => 'set and append' ], $stack->refs['group']['name'] );
|
||||
$stack->resolveFollow( 'group', 'name', 'and append' );
|
||||
$this->assertSame( [ 'text' => ' set and append' ], $stack->refs['group']['name'] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue