mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-14 18:45:12 +00:00
Merge "Include more information in missing parent placeholder"
This commit is contained in:
commit
9b770fba99
|
@ -69,7 +69,7 @@ class ReferenceStack {
|
|||
private const ACTION_INCREMENT = 'increment';
|
||||
private const ACTION_NEW_FROM_PLACEHOLDER = 'new-from-placeholder';
|
||||
private const ACTION_NEW = 'new';
|
||||
private const PARENT_REF_PLACEHOLDER = '__placeholder__';
|
||||
public const PARENT_REF_PLACEHOLDER = '__placeholder__';
|
||||
|
||||
/**
|
||||
* Leave a mark in the stack which matches an invalid ref tag.
|
||||
|
@ -194,6 +194,7 @@ class ReferenceStack {
|
|||
} else {
|
||||
// Transfer my number to parent ref.
|
||||
$this->refs[$group][$extends] = [
|
||||
'name' => $extends,
|
||||
'number' => $ref['number'],
|
||||
self::PARENT_REF_PLACEHOLDER => true,
|
||||
];
|
||||
|
@ -380,6 +381,9 @@ class ReferenceStack {
|
|||
}
|
||||
|
||||
public function listDefinedRef( string $group, string $name, string $text ): void {
|
||||
if ( isset( $this->refs[$group][$name][self::PARENT_REF_PLACEHOLDER] ) ) {
|
||||
unset( $this->refs[$group][$name][self::PARENT_REF_PLACEHOLDER] );
|
||||
}
|
||||
if ( !isset( $this->refs[$group][$name]['text'] ) ) {
|
||||
$this->refs[$group][$name]['text'] = $text;
|
||||
} elseif ( $this->refs[$group][$name]['text'] !== $text ) {
|
||||
|
|
|
@ -373,7 +373,7 @@ wgCiteBookReferencing=true
|
|||
!! end
|
||||
|
||||
!! test
|
||||
T236256 - Base and book reference in different groups
|
||||
T236256 - Base and book reference in different groups don't collide
|
||||
!! config
|
||||
wgCiteBookReferencing=true
|
||||
!! wikitext
|
||||
|
@ -397,7 +397,7 @@ wgCiteBookReferencing=true
|
|||
!! end
|
||||
|
||||
!! test
|
||||
T236256 - Extending in the unnamed default group
|
||||
T236256 - Extending in the unnamed default group doesn't collide with refs from other groups
|
||||
!! config
|
||||
wgCiteBookReferencing=true
|
||||
!! wikitext
|
||||
|
@ -420,7 +420,7 @@ wgCiteBookReferencing=true
|
|||
!! end
|
||||
|
||||
!! test
|
||||
T236256 - Base in the unnamed default group
|
||||
T236256 - Extends in named group doesn't conflict with default group
|
||||
!! config
|
||||
wgCiteBookReferencing=true
|
||||
!! wikitext
|
||||
|
|
|
@ -436,6 +436,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
|
|||
'extendsIndex' => 1,
|
||||
],
|
||||
'b' => [
|
||||
'name' => 'b',
|
||||
'number' => 1,
|
||||
'__placeholder__' => true,
|
||||
]
|
||||
|
@ -578,6 +579,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
|
|||
'extendsIndex' => 1,
|
||||
],
|
||||
'b' => [
|
||||
'name' => 'b',
|
||||
'number' => 1,
|
||||
'__placeholder__' => true,
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue