38 public static $attributes = [
40 'delimiter-precedes-et-al',
41 'delimiter-precedes-last',
45 'et-al-subsequent-min',
46 'et-al-subsequent-use-first',
90 private $delimiterPrecedesEtAl;
113 private $delimiterPrecedesLast;
131 private $etAlUseFirst;
142 private $etAlUseLast =
false;
150 private $etAlSubsequentMin;
158 private $etAlSubsequentUseFirst;
167 private $initialize =
true;
176 private $initializeWith =
false;
190 private $nameAsSortOrder =
"";
199 private $sortSeparator =
", ";
211 private $nameForm =
"long";
213 private $nameDelimiter =
", ";
217 $parent = $this->parent;
219 while ($parent !=
null && $parent instanceof
HasParent) {
220 if ($parent instanceof
Macro) {
223 $parent = $parent->getParent();
234 $parentStyleElement =
null;
235 if ($this instanceof
Name || $this instanceof
Names) {
236 if ($context->getMode() ===
"bibliography") {
238 $parentStyleElement = $context->getRoot();
240 $parentStyleElement = $context->getBibliography();
243 $parentStyleElement = $context->getCitation();
246 $parentStyleElement = $context->getRoot();
249 foreach (self::$attributes as $nameAttribute) {
250 $attribute = $node[$nameAttribute];
251 switch ($nameAttribute) {
253 if (!empty($attribute)) {
254 $this->and = (string) $attribute;
255 } elseif (!empty($parentStyleElement)) {
256 $this->and = $parentStyleElement->getAnd();
259 case 'delimiter-precedes-et-al':
260 if (!empty($attribute)) {
261 $this->delimiterPrecedesEtAl = (string) $attribute;
262 } elseif (!empty($parentStyleElement)) {
263 $this->delimiterPrecedesEtAl = $parentStyleElement->getDelimiterPrecedesEtAl();
266 case 'delimiter-precedes-last':
267 if (!empty($attribute)) {
268 $this->delimiterPrecedesLast = (string) $attribute;
269 } elseif (!empty($parentStyleElement)) {
270 $this->delimiterPrecedesLast = $parentStyleElement->getDelimiterPrecedesLast();
274 if (!empty($attribute)) {
275 $this->etAlMin = intval((
string) $attribute);
276 } elseif (!empty($parentStyleElement)) {
277 $this->etAlMin = $parentStyleElement->getEtAlMin();
280 case 'et-al-use-first':
281 if (!empty($attribute)) {
282 $this->etAlUseFirst = intval((
string) $attribute);
283 } elseif (!empty($parentStyleElement)) {
284 $this->etAlUseFirst = $parentStyleElement->getEtAlUseFirst();
287 case 'et-al-subsequent-min':
288 if (!empty($attribute)) {
289 $this->etAlSubsequentMin = intval((
string) $attribute);
290 } elseif (!empty($parentStyleElement)) {
291 $this->etAlSubsequentMin = $parentStyleElement->getEtAlSubsequentMin();
294 case 'et-al-subsequent-use-first':
295 if (!empty($attribute)) {
296 $this->etAlSubsequentUseFirst = intval((
string) $attribute);
297 } elseif (!empty($parentStyleElement)) {
298 $this->etAlSubsequentUseFirst = $parentStyleElement->getEtAlSubsequentUseFirst();
301 case 'et-al-use-last':
302 if (!empty($attribute)) {
303 $this->etAlUseLast = boolval((
string) $attribute);
304 } elseif (!empty($parentStyleElement)) {
305 $this->etAlUseLast = $parentStyleElement->getEtAlUseLast();
309 if (!empty($attribute)) {
310 $this->
initialize = boolval((
string) $attribute);
311 } elseif (!empty($parentStyleElement)) {
312 $this->
initialize = $parentStyleElement->getInitialize();
315 case 'initialize-with':
316 if (!empty($attribute)) {
317 $this->initializeWith = (string) $attribute;
318 } elseif (!empty($parentStyleElement)) {
319 $this->initializeWith = $parentStyleElement->getInitializeWith();
322 case 'name-as-sort-order':
323 if (!empty($attribute)) {
324 $this->nameAsSortOrder = (string) $attribute;
325 } elseif (!empty($parentStyleElement)) {
326 $this->nameAsSortOrder = $parentStyleElement->getNameAsSortOrder();
329 case 'sort-separator':
330 if (!empty($attribute)) {
331 $this->sortSeparator = (string) $attribute;
332 } elseif (!empty($parentStyleElement)) {
333 $this->sortSeparator = $parentStyleElement->getSortSeparator();
337 if ($this instanceof Root || $this instanceof StyleElement) {
338 if (!empty($attribute)) {
340 } elseif (!empty($parentStyleElement)) {
341 $this->
setNameForm($parentStyleElement->getNameForm());
346 if ($this instanceof Name) {
347 if (!empty($attribute)) {
348 $this->
setForm((
string) $attribute);
349 } elseif (!empty($parentStyleElement)) {
350 $this->
setForm($parentStyleElement->getNameForm());
354 case 'name-delimiter':
355 if ($this instanceof Root || $this instanceof StyleElement) {
356 if (!empty($attribute)) {
358 } elseif (!empty($parentStyleElement)) {
364 if (!empty($attribute)) {
365 $this->nameDelimiter = $this->delimiter = (string) $attribute;
366 } elseif (!empty($parentStyleElement)) {
367 $this->nameDelimiter = $this->delimiter = $parentStyleElement->getNameDelimiter();
372 if ($this instanceof Name) {
373 if (!empty($attribute)) {
374 $this->setDelimiter((
string) $attribute);
375 } elseif (!empty($parentStyleElement)) {
376 $this->setDelimiter($parentStyleElement->getNameDelimiter());
381 $this->attributesInitialized =
true;
395 public function setAnd($and)
405 return $this->delimiterPrecedesEtAl;
413 $this->delimiterPrecedesEtAl = $delimiterPrecedesEtAl;
421 return $this->delimiterPrecedesLast;
429 $this->delimiterPrecedesLast = $delimiterPrecedesLast;
437 return $this->etAlMin;
445 $this->etAlMin = $etAlMin;
453 return $this->etAlUseFirst;
461 $this->etAlUseFirst = $etAlUseFirst;
469 return $this->etAlUseLast;
477 $this->etAlUseLast = $etAlUseLast;
485 return $this->etAlSubsequentMin;
493 $this->etAlSubsequentMin = $etAlSubsequentMin;
501 return $this->etAlSubsequentUseFirst;
509 $this->etAlSubsequentUseFirst = $etAlSubsequentUseFirst;
517 return $this->initialize;
525 $this->initialize = $initialize;
533 return $this->initializeWith;
541 $this->initializeWith = $initializeWith;
549 return $this->nameAsSortOrder;
557 $this->nameAsSortOrder = $nameAsSortOrder;
565 return $this->sortSeparator;
573 $this->sortSeparator = $sortSeparator;
597 return $this->nameForm;
605 $this->nameForm = $nameForm;
613 return $this->nameDelimiter;
621 $this->nameDelimiter = $nameDelimiter;