mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Merge "Rename internal BOOK_REF_ATTRIBUTE constant"
This commit is contained in:
commit
ebf38366e7
12
src/Cite.php
12
src/Cite.php
|
@ -38,10 +38,8 @@ class Cite {
|
||||||
|
|
||||||
public const DEFAULT_GROUP = '';
|
public const DEFAULT_GROUP = '';
|
||||||
|
|
||||||
/**
|
/** Attribute name for the sub-referencing feature in <ref …> */
|
||||||
* Wikitext attribute name for Book Referencing.
|
public const SUBREF_ATTRIBUTE = 'extends';
|
||||||
*/
|
|
||||||
public const BOOK_REF_ATTRIBUTE = 'extends';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message key for the (localized) tracking category for pages using the `extends` attribute.
|
* Message key for the (localized) tracking category for pages using the `extends` attribute.
|
||||||
|
@ -125,15 +123,15 @@ class Cite {
|
||||||
?string $text,
|
?string $text,
|
||||||
array $argv
|
array $argv
|
||||||
): string {
|
): string {
|
||||||
// Tag every page where Book Referencing has been used, whether or not the ref tag is valid.
|
// Tag every page where sub-referencing has been used, whether or not the ref tag is valid.
|
||||||
// TODO: Remove this generic usage tracking once the feature is stable. See T237531.
|
// TODO: Remove this generic usage tracking once the feature is stable. See T237531.
|
||||||
if ( array_key_exists( self::BOOK_REF_ATTRIBUTE, $argv ) ) {
|
if ( array_key_exists( self::SUBREF_ATTRIBUTE, $argv ) ) {
|
||||||
$parser->addTrackingCategory( self::EXTENDS_TRACKING_CATEGORY );
|
$parser->addTrackingCategory( self::EXTENDS_TRACKING_CATEGORY );
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = $this->parseArguments(
|
$status = $this->parseArguments(
|
||||||
$argv,
|
$argv,
|
||||||
[ 'group', 'name', self::BOOK_REF_ATTRIBUTE, 'follow', 'dir' ]
|
[ 'group', 'name', self::SUBREF_ATTRIBUTE, 'follow', 'dir' ]
|
||||||
);
|
);
|
||||||
$arguments = $status->getValue();
|
$arguments = $status->getValue();
|
||||||
// Use the default group, or the references group when inside one.
|
// Use the default group, or the references group when inside one.
|
||||||
|
|
|
@ -418,7 +418,7 @@ class CiteTest extends \MediaWikiIntegrationTestCase {
|
||||||
$spy = TestingAccessWrapper::newFromObject( $cite );
|
$spy = TestingAccessWrapper::newFromObject( $cite );
|
||||||
$spy->errorReporter = $this->createMock( ErrorReporter::class );
|
$spy->errorReporter = $this->createMock( ErrorReporter::class );
|
||||||
|
|
||||||
$spy->guardedRef( $mockParser, 'text', [ Cite::BOOK_REF_ATTRIBUTE => 'a' ] );
|
$spy->guardedRef( $mockParser, 'text', [ Cite::SUBREF_ATTRIBUTE => 'a' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue