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