mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-12 01:01:29 +00:00
Collapse duplicate code in Cite::referencesFormatEntry()
Bug: T237241 Change-Id: Id4d9b453244f9c1d1577497439e39d3d7b58b5ff
This commit is contained in:
parent
97ba23aae9
commit
c4c6eaa8df
|
@ -806,38 +806,26 @@ class Cite {
|
|||
)->inContentLanguage()->plain();
|
||||
}
|
||||
|
||||
// Anonymous, auto-numbered references can't be reused and get marked with a -1.
|
||||
if ( $val['count'] < 0 ) {
|
||||
// This counts the number of reuses. 0 means the reference appears only 1 time.
|
||||
if ( $val['count'] < 1 ) {
|
||||
// Anonymous, auto-numbered references can't be reused and get marked with a -1.
|
||||
if ( $val['count'] < 0 ) {
|
||||
$id = $val['key'];
|
||||
$backlinkId = $this->refKey( $val['key'] );
|
||||
} else {
|
||||
$id = $key . '-' . $val['key'];
|
||||
$backlinkId = $this->refKey( $key, $val['key'] . '-' . $val['count'] );
|
||||
}
|
||||
return wfMessage(
|
||||
'cite_references_link_one',
|
||||
$this->normalizeKey(
|
||||
self::getReferencesKey( $val['key'] )
|
||||
),
|
||||
$this->normalizeKey(
|
||||
$this->refKey( $val['key'] )
|
||||
),
|
||||
$this->normalizeKey( self::getReferencesKey( $id ) ),
|
||||
$this->normalizeKey( $backlinkId ),
|
||||
$text,
|
||||
$val['dir']
|
||||
)->inContentLanguage()->plain();
|
||||
// Standalone named reference, I want to format this like an
|
||||
// anonymous reference because displaying "1. 1.1 Ref text" is
|
||||
// overkill and users frequently use named references when they
|
||||
// don't need them for convenience
|
||||
}
|
||||
if ( $val['count'] === 0 ) {
|
||||
return wfMessage(
|
||||
'cite_references_link_one',
|
||||
$this->normalizeKey(
|
||||
self::getReferencesKey( $key . "-" . $val['key'] )
|
||||
),
|
||||
$this->normalizeKey(
|
||||
$this->refKey( $key, $val['key'] . "-" . $val['count'] )
|
||||
),
|
||||
$text,
|
||||
$val['dir']
|
||||
)->inContentLanguage()->plain();
|
||||
|
||||
// Named references with >1 occurrences
|
||||
}
|
||||
$backlinks = [];
|
||||
// for group handling, we have an extra key here.
|
||||
for ( $i = 0; $i <= $val['count']; ++$i ) {
|
||||
|
|
Loading…
Reference in a new issue