@@ -94,20 +94,20 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | foreach ($node->children() as $child) { |
| 96 | 96 | switch ($child->getName()) { |
| 97 | - case "name-part": |
|
| 98 | - /** |
|
| 97 | + case "name-part": |
|
| 98 | + /** |
|
| 99 | 99 | * @var NamePart $namePart |
| 100 | 100 | */ |
| 101 | - $namePart = Factory::create($child, $this); |
|
| 102 | - $this->nameParts[$namePart->getName()] = $namePart; |
|
| 101 | + $namePart = Factory::create($child, $this); |
|
| 102 | + $this->nameParts[$namePart->getName()] = $namePart; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | foreach ($node->attributes() as $attribute) { |
| 107 | 107 | switch ($attribute->getName()) { |
| 108 | - case 'form': |
|
| 109 | - $this->form = (string)$attribute; |
|
| 110 | - break; |
|
| 108 | + case 'form': |
|
| 109 | + $this->form = (string)$attribute; |
|
| 110 | + break; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -268,19 +268,19 @@ discard block |
||
| 268 | 268 | delimiter-precedes-et-al attribute. */ |
| 269 | 269 | |
| 270 | 270 | switch ($this->delimiterPrecedesEtAl) { |
| 271 | - case 'never': |
|
| 272 | - $text = $text . " " . $this->etAl; |
|
| 273 | - break; |
|
| 274 | - case 'always': |
|
| 275 | - $text = $text . $this->delimiter . $this->etAl; |
|
| 276 | - break; |
|
| 277 | - case 'contextual': |
|
| 278 | - default: |
|
| 279 | - if (count($resultNames) === 1) { |
|
| 280 | - $text .= " " . $this->etAl; |
|
| 281 | - } else { |
|
| 282 | - $text .= $this->delimiter . $this->etAl; |
|
| 283 | - } |
|
| 271 | + case 'never': |
|
| 272 | + $text = $text . " " . $this->etAl; |
|
| 273 | + break; |
|
| 274 | + case 'always': |
|
| 275 | + $text = $text . $this->delimiter . $this->etAl; |
|
| 276 | + break; |
|
| 277 | + case 'contextual': |
|
| 278 | + default: |
|
| 279 | + if (count($resultNames) === 1) { |
|
| 280 | + $text .= " " . $this->etAl; |
|
| 281 | + } else { |
|
| 282 | + $text .= $this->delimiter . $this->etAl; |
|
| 283 | + } |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | return $text; |
@@ -352,40 +352,40 @@ discard block |
||
| 352 | 352 | /* “partial-each” - when one or more rendered names in the name variable match those in the preceding |
| 353 | 353 | bibliographic entry, the value of subsequent-author-substitute substitutes for each matching name. |
| 354 | 354 | Matching starts with the first name, and continues up to the first mismatch. */ |
| 355 | - case SubsequentAuthorSubstituteRule::PARTIAL_EACH: |
|
| 356 | - if (NameHelper::precedingHasAuthor($preceding, $name)) { |
|
| 357 | - $resultNames[] = $subsequentSubstitution; |
|
| 358 | - } else { |
|
| 359 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 360 | - } |
|
| 361 | - break; |
|
| 362 | - /* “partial-first” - as “partial-each”, but substitution is limited to the first name of the name |
|
| 355 | + case SubsequentAuthorSubstituteRule::PARTIAL_EACH: |
|
| 356 | + if (NameHelper::precedingHasAuthor($preceding, $name)) { |
|
| 357 | + $resultNames[] = $subsequentSubstitution; |
|
| 358 | + } else { |
|
| 359 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 360 | + } |
|
| 361 | + break; |
|
| 362 | + /* “partial-first” - as “partial-each”, but substitution is limited to the first name of the name |
|
| 363 | 363 | variable. */ |
| 364 | - case SubsequentAuthorSubstituteRule::PARTIAL_FIRST: |
|
| 365 | - if ($rank === 0) { |
|
| 366 | - if ($preceding->author[0]->family === $name->family) { |
|
| 367 | - $resultNames[] = $subsequentSubstitution; |
|
| 368 | - } else { |
|
| 369 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 370 | - } |
|
| 371 | - } else { |
|
| 372 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 373 | - } |
|
| 374 | - break; |
|
| 375 | - |
|
| 376 | - /* “complete-each” - requires a complete match like “complete-all”, but now the value of |
|
| 364 | + case SubsequentAuthorSubstituteRule::PARTIAL_FIRST: |
|
| 365 | + if ($rank === 0) { |
|
| 366 | + if ($preceding->author[0]->family === $name->family) { |
|
| 367 | + $resultNames[] = $subsequentSubstitution; |
|
| 368 | + } else { |
|
| 369 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 370 | + } |
|
| 371 | + } else { |
|
| 372 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 373 | + } |
|
| 374 | + break; |
|
| 375 | + |
|
| 376 | + /* “complete-each” - requires a complete match like “complete-all”, but now the value of |
|
| 377 | 377 | subsequent-author-substitute substitutes for each rendered name. */ |
| 378 | - case SubsequentAuthorSubstituteRule::COMPLETE_EACH: |
|
| 379 | - try { |
|
| 380 | - if (NameHelper::identicalAuthors($preceding, $data)) { |
|
| 381 | - $resultNames[] = $subsequentSubstitution; |
|
| 382 | - } else { |
|
| 383 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 384 | - } |
|
| 385 | - } catch (CiteProcException $e) { |
|
| 386 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 387 | - } |
|
| 388 | - break; |
|
| 378 | + case SubsequentAuthorSubstituteRule::COMPLETE_EACH: |
|
| 379 | + try { |
|
| 380 | + if (NameHelper::identicalAuthors($preceding, $data)) { |
|
| 381 | + $resultNames[] = $subsequentSubstitution; |
|
| 382 | + } else { |
|
| 383 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 384 | + } |
|
| 385 | + } catch (CiteProcException $e) { |
|
| 386 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 387 | + } |
|
| 388 | + break; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | return $resultNames; |
@@ -502,18 +502,18 @@ discard block |
||
| 502 | 502 | $text = ""; |
| 503 | 503 | if (!empty($this->and) && empty($this->etAl)) { |
| 504 | 504 | switch ($this->delimiterPrecedesLast) { |
| 505 | - case 'after-inverted-name': |
|
| 506 | - //TODO: implement |
|
| 507 | - break; |
|
| 508 | - case 'always': |
|
| 509 | - $text = implode($this->delimiter, $resultNames); |
|
| 510 | - break; |
|
| 511 | - case 'never': |
|
| 512 | - $text = $this->renderDelimiterPrecedesLastNever($resultNames); |
|
| 513 | - break; |
|
| 514 | - case 'contextual': |
|
| 515 | - default: |
|
| 516 | - $text = $this->renderDelimiterPrecedesLastContextual($resultNames); |
|
| 505 | + case 'after-inverted-name': |
|
| 506 | + //TODO: implement |
|
| 507 | + break; |
|
| 508 | + case 'always': |
|
| 509 | + $text = implode($this->delimiter, $resultNames); |
|
| 510 | + break; |
|
| 511 | + case 'never': |
|
| 512 | + $text = $this->renderDelimiterPrecedesLastNever($resultNames); |
|
| 513 | + break; |
|
| 514 | + case 'contextual': |
|
| 515 | + default: |
|
| 516 | + $text = $this->renderDelimiterPrecedesLastContextual($resultNames); |
|
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | return $text; |