ders./dies. bei mehreren Personen

Simon E. hinzugefügt 3 Jahren her
beantwortet

Liebe Community, lieber Support,

Nachdem meine letzte Anfrage so genial beantwortet wurde nun eine andere und hoffentlich leichtere.


Wie hier, hier, und hier beschrieben war es bislang nicht möglich Mehrfachnennungen von Autor*innen durch ders./dies. abzukürzen, wenn die Nennung gemeinsam mit anderen Autor*innen erfolgte. Ist dies mittlerweise möglich?


Momentan gibt der verwendete Code des Stils: Juristisches zitieren (Riehm) folgendes aus:

Dreier, in: Dreier/Bauer (Hg.), GG, Art. 10 Rn. 12 ff.

gewünscht ist aber:


Dreier, in: ders./Bauer (Hg.), GG, Art. 10 Rn. 12 ff.


Oder im Worst case Szenario sogar:

Kunig, in: v. Münch/ders. (Hg.), GG, Art. 2 Rn. 16.


Hier demonstriert am häufigsten Anwendungsfall der Identität von Autor und Herausgeber, kann das Problem natürlich auch über mehrere Nachweise hinweg auftreten, dann sollte jedoch, wie auch sonst schon, die erste Nennung eines anderen Autors zur erneuten Nennung des Autorennamens führen.


Sollte es diese Funktion zwischenzeitlich in citavi 6 geschafft habe würde mich dies sehr freuen.


Hier der Code für den Fall mehrerer Herausgeber.


using System;
using System.Linq;
using System.Collections.Generic;
using SwissAcademic.Citavi;
using SwissAcademic.Citavi.Metadata;

namespace SwissAcademic.Citavi.Citations
{
	public class ComponentPartFilter
		:
		IComponentPartFilter
	{
		//Version 2Xtra: Special Version of Author == Editor that does name disambiguation if needed
		//Version 1.7 Single N(neutral) oder unknown author yields "ders." instead of "dies."
		//Version 1.6 New variable "deactivateFilterWithOption1Switch"
		//Version 1.5 New variable "outputInItalics": output can quickly be changed between font style italics and neutral
		//Version 1.4 New variable "deactivateFilterInsideMultipleCitations": inside multiple citations, filter can be switched off to allow for cite collapsing (see below)
		//Version 1.3 Footnote index difference must not be > 0
		//Version 1.2 Takes all combinations of number/sex into account
		//Version 1.1 Takes organizations into account
		public IEnumerable<ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled)
		{
			//new in VErsion 1.6
			//if the following is set to true a placeholder citation's output will not show ders./dies. although this would normally be the case
			//as e.g. the second one of the following two: {Meier 2010 #2} and {Meier 2010 #2:17-19 /opt1} 
			var deactivateFilterWithOption1Switch = true;
			var outputInItalics = false;
			var outputInSmallCaps = false;
			var outputInBold = false;
			var outputUnderlined = false;

			bool allowRepetitionOutput = true;
			handled = false;
			var thisCitationIsPartOfMultipleCitation = false;

			if (citation == null) return null;
			if (citation.Reference == null) return null;
			if (citation.Reference.ParentReference == null) return null;
			if (citation.Reference.ParentReference.Editors == null) return null;
			
			SwissAcademic.Drawing.FontStyle fontStyle;
			
			// Autoren ggfs. Vornamen hinzufügen
			if (componentPart == null) return null;
			if (componentPart.Elements == null || componentPart.Elements.Count == 0) return null;

			PersonFieldElement thisPersonFieldElement = GetPersonFieldElement(componentPart);
			if (thisPersonFieldElement == null) return null;
			
			PersonFieldElement previousPersonFieldElement = GetPersonFieldElement(template);
			if (previousPersonFieldElement == null || previousPersonFieldElement.Id == thisPersonFieldElement.Id) return null;
		
			List<Person> thesePersons = GetPersonsDisplayed(componentPart, citation.Reference);
			if (thesePersons == null || !thesePersons.Any()) return null;

			//SPECIAL: if this citation has the /opt1 switch set, this filter should be deactivated
			var placeholderCitation = citation as PlaceholderCitation;
			if (deactivateFilterWithOption1Switch && placeholderCitation != null && placeholderCitation.FormatOption1)
			{
				allowRepetitionOutput = false;
			}

			//determine Persons to compare
			List<Person> previousPersons = GetPersonsDisplayed(previousPersonFieldElement, citation.Reference);
			var equality = PersonEquality.None;
			if (previousPersons == null || !previousPersons.Any()) 
			{
				allowRepetitionOutput = false;
			}
			else
			{
				equality = CheckPersonEquality(thesePersons, previousPersons);
				if (equality == PersonEquality.None) allowRepetitionOutput = false;
			}

			#region Equality detected and allowed - generate output

			//we DO have some equality, so let's check what we need to output instead of the person's name(s)
			var output = new TextUnitCollection();
			var text = string.Empty;
			var saveSuffix = string.Empty;
			var saveSuffixStyle = thisPersonFieldElement.GroupSuffixSingular.FontStyle;
			
			if (allowRepetitionOutput)
			{
				switch (equality)
				{
					case PersonEquality.M:
					case PersonEquality.N:
					{
						text = "ders.";
						saveSuffix = thisPersonFieldElement.GroupSuffixSingular.Text;
						saveSuffixStyle = thisPersonFieldElement.GroupSuffixSingular.FontStyle;
					}
					break;

					case PersonEquality.F:
					{
						text = "dies.";
						saveSuffix = thisPersonFieldElement.GroupSuffixSingular.Text;
						saveSuffixStyle = thisPersonFieldElement.GroupSuffixSingular.FontStyle;
					}
					break;
						
					default: //all others
					{
						text = "dies.";
						saveSuffix = thisPersonFieldElement.GroupSuffixPlural.Text;
						saveSuffixStyle = thisPersonFieldElement.GroupSuffixPlural.FontStyle;
					}
					break;
				}
				
				fontStyle = SwissAcademic.Drawing.FontStyle.Neutral;
				if (outputInItalics) fontStyle |= SwissAcademic.Drawing.FontStyle.Italic;
				if (outputInSmallCaps) fontStyle |= SwissAcademic.Drawing.FontStyle.SmallCaps;
				if (outputInBold) fontStyle |= SwissAcademic.Drawing.FontStyle.Bold;
				if (outputUnderlined) fontStyle |= SwissAcademic.Drawing.FontStyle.Underline;
				
				output.Add(new LiteralTextUnit(text, fontStyle));
				output.Add(new LiteralTextUnit(saveSuffix, saveSuffixStyle));
				
				handled = true;
				return output;
			}

			#endregion Equality detected - generate output
			
			#region No Equality or output not allowed
			
			else
			{
				if (thesePersons[0].Notes.Equals("Uneindeutig"))
				{
					thisPersonFieldElement.FirstGroupPersonNameOrder = PersonNameOrder.FirstNameLastName;
					thisPersonFieldElement.FirstGroupFirstNameFormat = NameFormat.Abbreviated;
					thisPersonFieldElement.FirstGroupMiddleNameUsage = MiddleNameUsage.FirstOnly;
					thisPersonFieldElement.FirstGroupMiddleNameFormat = NameFormat.Abbreviated;
				}
				
				if (thesePersons[0].Notes.Equals("Initial Uneindeutig"))
				{
					thisPersonFieldElement.FirstGroupPersonNameOrder = PersonNameOrder.FirstNameLastName;
					thisPersonFieldElement.FirstGroupFirstNameFormat = NameFormat.Full;
					thisPersonFieldElement.FirstGroupMiddleNameUsage = MiddleNameUsage.FirstOnly;
					thisPersonFieldElement.FirstGroupMiddleNameFormat = NameFormat.Abbreviated;
				}
				
				
				// more than two authors: use "FirstGroup", "SecondGroup" and "LastPerson"
				// note that the citation style truncates the list aftre the third author, so we can content ourselves with the first three
				// and use "LastPerson" for the third one
				
				if (thesePersons.Count == 2) // only two authors - no need for "LastPerson"
				{
					thisPersonFieldElement.UseDifferentFormatForLastPerson = false;
				}
				else // more than two authors
				{
					thisPersonFieldElement.UseDifferentFormatForLastPerson = true;
				}
				
				if (thesePersons.Count > 1 && thesePersons[1].Notes.Equals("Uneindeutig"))
				{
					thisPersonFieldElement.SecondGroupPersonNameOrder = PersonNameOrder.FirstNameLastName;
					thisPersonFieldElement.SecondGroupFirstNameFormat = NameFormat.Abbreviated;
					thisPersonFieldElement.SecondGroupMiddleNameUsage = MiddleNameUsage.FirstOnly;
					thisPersonFieldElement.SecondGroupMiddleNameFormat = NameFormat.Abbreviated;
				}
				
				if (thesePersons.Count > 1 && thesePersons[1].Notes.Equals("Initial Uneindeutig"))
				{
					thisPersonFieldElement.SecondGroupPersonNameOrder = PersonNameOrder.FirstNameLastName;
					thisPersonFieldElement.SecondGroupFirstNameFormat = NameFormat.Full;
					thisPersonFieldElement.SecondGroupMiddleNameUsage = MiddleNameUsage.FirstOnly;
					thisPersonFieldElement.SecondGroupMiddleNameFormat = NameFormat.Abbreviated;
				}
				
				if (thesePersons.Count > 2 && thesePersons[2].Notes.Equals("Uneindeutig")) // third Person last - we don't show more than three here
				{
					thisPersonFieldElement.LastPersonPersonNameOrder = PersonNameOrder.FirstNameLastName;
					thisPersonFieldElement.LastPersonFirstNameFormat = NameFormat.Abbreviated;
					thisPersonFieldElement.LastPersonMiddleNameUsage = MiddleNameUsage.FirstOnly;
					thisPersonFieldElement.LastPersonMiddleNameFormat = NameFormat.Abbreviated;
				}
				
				if (thesePersons.Count > 2 && thesePersons[2].Notes.Equals("Initial Uneindeutig")) // third Person last - we don't show more than three here
				{
					thisPersonFieldElement.LastPersonPersonNameOrder = PersonNameOrder.FirstNameLastName;
					thisPersonFieldElement.LastPersonFirstNameFormat = NameFormat.Full;
					thisPersonFieldElement.LastPersonMiddleNameUsage = MiddleNameUsage.FirstOnly;
					thisPersonFieldElement.LastPersonMiddleNameFormat = NameFormat.Abbreviated;
				}
				
				handled = false;
				return null;
			}
			
			#endregion
		}
		
		#region GetPreviousVisibleCitation

		private static Citation GetPreviousVisibleCitation(Citation citation)
		{
			if (citation == null) return null;

			#region Bibliography

			if (citation.CitationType == CitationType.Bibliography)
			{
				BibliographyCitation previousBibliographyCitation = citation as BibliographyCitation;
				if (previousBibliographyCitation == null) return null;

				//consider nobib
				do
				{
					previousBibliographyCitation = previousBibliographyCitation.PreviousBibliographyCitation;
					if (previousBibliographyCitation == null) return null;

				} while (previousBibliographyCitation.NoBib == true);

				//still here? found one!
				return previousBibliographyCitation;
			}

			#endregion Bibliography

			#region InText

			if (citation.CitationType == CitationType.InText)
			{
				InTextCitation previousInTextCitation = citation as InTextCitation;
				if (previousInTextCitation == null) return null;

				//consider bibonly
				do
				{
					previousInTextCitation = previousInTextCitation.PreviousInTextCitation;
					if (previousInTextCitation == null) return null;

				} while (previousInTextCitation.BibOnly == true);

				//still here? found one!
				return previousInTextCitation;
			}

			#endregion InText

			#region Footnote

			if (citation.CitationType == CitationType.Footnote)
			{
				FootnoteCitation previousFootnoteCitation = citation as FootnoteCitation;
				if (previousFootnoteCitation == null) return null;

				//consider bibonly
				do
				{
					previousFootnoteCitation = previousFootnoteCitation.PreviousFootnoteCitation;
					if (previousFootnoteCitation == null) return null;

				} while (previousFootnoteCitation.BibOnly == true);

				//still here? found one!
				return previousFootnoteCitation;
			}

			#endregion Footnote

			//still here? no visible previous citation found!
			return null;
		}

		#endregion GetPreviousCitation
		
		#region GetPersonFieldElement
		
		private static PersonFieldElement GetPersonFieldElement(ComponentPart componentPart)
		{
			if (componentPart == null) return null;
			if (componentPart.Elements == null || !componentPart.Elements.Any()) return null;
			
			//check for 1st PersonFieldElement in ComponentPart
			return componentPart.Elements.OfType<PersonFieldElement>().FirstOrDefault() as PersonFieldElement;	
		}
		
		private static PersonFieldElement GetPersonFieldElement(Template template)
		{
			if (template == null) return null;
			if (template.ComponentParts == null || !template.ComponentParts.Any()) return null;
			
			return template.ComponentParts.SelectMany(part => part.Elements).OfType<PersonFieldElement>().FirstOrDefault();
		}
		
		#endregion

		#region GetPersonsDisplayed

		private static List<Person> GetPersonsDisplayed(PersonFieldElement element, Reference reference)
		{
			if (element == null) return null;
			if (element.ComponentPart == null) return null;
			List<Person> persons = null;
			
			ComponentPartScope scope = element.ComponentPart.Scope;
			Reference referenceInScope = null;
			if (scope == ComponentPartScope.Reference) referenceInScope = reference;
			else referenceInScope = reference.ParentReference;
			if (referenceInScope == null) return null;

			switch (element.PropertyId)
			{
				#region Authors

				case ReferencePropertyId.Authors:
					{
						if (referenceInScope.Authors != null) persons = new List<Person>(referenceInScope.Authors);
					}
					break;

				#endregion Authors

				#region Editors

				case ReferencePropertyId.Editors:
					{
						if (referenceInScope.Editors != null) persons = new List<Person>(referenceInScope.Editors);
					}
					break;

				#endregion Editors

				#region AuthorsEditorsOrganizations

				case ReferencePropertyId.AuthorsOrEditorsOrOrganizations:
					{
						if (referenceInScope.AuthorsOrEditorsOrOrganizations != null) persons = new List<Person>(referenceInScope.AuthorsOrEditorsOrOrganizations);
					}
					break;

				#endregion AuthorsEditorsOrganizations

				#region Collaborators

				case ReferencePropertyId.Collaborators:
					{
						if (referenceInScope.Collaborators != null) persons = new List<Person>(referenceInScope.Collaborators);
					}
					break;

				#endregion Collaborators

				#region Organizations

				case ReferencePropertyId.Organizations:
					{
						if (referenceInScope.Organizations != null) persons = new List<Person>(referenceInScope.Organizations);
					}
					break;

				#endregion Organizations

				#region OthersInvolved

				case ReferencePropertyId.OthersInvolved:
					{
						if (referenceInScope.OthersInvolved != null) persons = new List<Person>(referenceInScope.OthersInvolved);
					}
					break;

				#endregion OthersInvolved
			}

			return persons;
		}

		private static List<Person> GetPersonsDisplayed(ComponentPart componentPart, Reference reference)
		{
			List<Person> persons = null;
			if (reference == null) return null;
			
			PersonFieldElement firstPersonFieldElement = GetPersonFieldElement(componentPart);			
			return GetPersonsDisplayed(firstPersonFieldElement, reference);
		}

		private static List<Person> GetPersonsDisplayed(Template template, Reference reference)
		{
			if (reference == null) return null;
			if (template == null) return null;
			if (template.ComponentParts == null || template.ComponentParts.Count == 0) return null;

			List<Person> persons = null;

			//check for 1st PersonFieldElement in citation's template
			IEnumerable<IElement> elements = template.ComponentParts.SelectMany(part => part.Elements);
			PersonFieldElement firstPersonFieldElement = elements.FirstOrDefault(item => item is PersonFieldElement) as PersonFieldElement;
			if (firstPersonFieldElement == null) return null;

			return GetPersonsDisplayed(firstPersonFieldElement, reference);
		}

		private static List<Person> GetPersonsDisplayed(Citation citation)
		{
			if (citation == null) return null;
			if (citation.Reference == null) return null;

			Template template = citation.GetTemplate();
			if (template == null) return null;

			List<Person> persons = null;

			persons = GetPersonsDisplayed(template, citation.Reference);
			if (persons != null) return persons;

			template = template.TemplateUseCase.FallbackTemplate;
			if (template == null) return null;
			persons = GetPersonsDisplayed(template, citation.Reference);
			if (persons != null) return persons;

			return null;
		}

		#endregion GetPersonsDisplayed

		#region CheckPersonEquality

		private static PersonEquality CheckPersonEquality(List<Person> personsA, List<Person> personsB)
		{
			if (personsA == null || personsA.Count == 0) return PersonEquality.None;
			if (personsB == null || personsB.Count == 0) return PersonEquality.None;
			if (personsA.Count != personsB.Count) return PersonEquality.None;

			//we DO have two lists of persons of same length
			//FIRST sort by id for comparison
			var personIdComparer = new PersonIdComparer();
			personsA.Sort(personIdComparer);
			personsB.Sort(personIdComparer);

			var allCounter = personsA.Count;
			var maleCounter = 0;
			var femaleCounter = 0;
			var neutralCounter = 0;

			//loop, compare GUID/id and determine/count sex 
			for (int i = 0; i < personsA.Count; i++)
			{
				var idA = personsA.GetValue(PersonPropertyId.Id).ToString();
				var idB = personsB.GetValue(PersonPropertyId.Id).ToString();

				if (!idA.Equals(idB, StringComparison.Ordinal)) return PersonEquality.None;

				//identical!
				//determine sex (just need to look at one of them, because they are identical)
				if (personsA.Sex == Sex.Male) maleCounter++;
				if (personsA.Sex == Sex.Female) femaleCounter++;
				if (personsA.Sex == Sex.Neutral || personsA.Sex == Sex.Unknown) neutralCounter++;
			}

			//still here, so ALL persons are equal, now return equality based on sex
			if (allCounter == 1 && maleCounter == 1) return PersonEquality.M;
			else if (allCounter == 1 && femaleCounter == 1) return PersonEquality.F;
			else if (allCounter == 1 && neutralCounter == 1) return PersonEquality.N;

			else if (allCounter > 1 && maleCounter == allCounter) return PersonEquality.MM;
			else if (allCounter > 1 && femaleCounter == allCounter) return PersonEquality.FF;
			else if (allCounter > 1 && neutralCounter == allCounter) return PersonEquality.NN;

			else if (allCounter > 1 && maleCounter + femaleCounter == allCounter) return PersonEquality.FM;
			else if (allCounter > 1 && femaleCounter + neutralCounter == allCounter) return PersonEquality.FN;
			else if (allCounter > 1 && maleCounter + neutralCounter == allCounter) return PersonEquality.MN;

			else if (allCounter >= 3
				&& maleCounter >= 1 && femaleCounter >= 1 && neutralCounter >= 1
				&& maleCounter + femaleCounter + neutralCounter == allCounter) return PersonEquality.FMN;
			else return PersonEquality.None;

		}

		#endregion CheckPersonEquality

		#region Enum PersonEquality

		public enum PersonEquality
		{
			/// <summary>
			/// None: Different persons and/or different numbers of persons.
			/// </summary>
			/// <returns></returns>
			None,

			/// <summary>
			/// Identical person, a single female (Latin: eadem)
			/// </summary>
			F,
			/// <summary>
			/// Identical person, a single male (Latin: idem)
			/// </summary>
			M,
			/// <summary>
			/// Identical persons, a single (neutral) organization (Latin: idem)
			/// </summary>
			N,

			/// <summary>
			/// Identical persons, only females, 2 or more (Latin: eaedem)
			/// </summary>
			FF,
			/// <summary>
			/// Identical persons, only males, 2 or more (Latin: eidem)
			/// </summary>
			MM,
			/// <summary>
			/// Identical persons, only (neutral) organizations, 2 or more (Latin: eadem)
			/// </summary>
			NN,

			/// <summary>
			/// Identical persons, mixed group of females and males only
			/// </summary>
			FM,
			/// <summary>
			/// Identical persons, mixed group of females and neutrals only
			/// </summary>
			FN,
			/// <summary>
			/// Identical persons, mixed group of males and neutrals only
			/// </summary>
			MN,

			/// <summary>
			/// Identical persons, mixed group of females, males and neutrals
			/// </summary>
			FMN
		}

		#endregion PersonEquality

		#region PersonIdComparer

		//The following is a sort comparer that will bring all person collections into a well defined order
		//namely in the order of their internal GUID values.
		public class PersonIdComparer : IComparer<Person>
		{
			public int Compare(Person person1, Person person2)
			{
				int returnValue = 1;
				if (person1 != null && person2 != null)
				{
					returnValue = person1.GetValue(PersonPropertyId.Id).ToString().CompareTo(person2.GetValue(PersonPropertyId.Id).ToString());
				}
				return returnValue;
			}
		}

		#endregion PersonIdComparer
	}
}

Beste Antwort
Foto

Das geht mt den von mir liebevoll Micky-Maus-Komponenten getauften Komponenten: eine Komponente, bei der vollkommen egal ist aus was für Elementen sie besteht (es kann also etwa ein Textelement sein, in dem "Micky Maus" steht), deren Inhalt vollkommen durch folgenden Code erzeugt wird:

using System.Linq;
using System.Collections.Generic;
using SwissAcademic.Citavi;
using SwissAcademic.Citavi.Metadata;
using SwissAcademic.Collections;
using SwissAcademic.Drawing;
using System.Text.RegularExpressions;

namespace SwissAcademic.Citavi.Citations
{
	public class ComponentPartFilter
		:
		IComponentPartFilter
	{
		public IEnumerable<ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled)
		{
			
			handled = true;
			
			// User Options
			
			bool NoPeriods = true;
			bool UseIdem = true;
			bool ReplaceFirstOfSeveralPersonsWithIdem = true;
			bool ReplaceSecondOrLaterOfSeveralPersonsWithIdem = true;
			bool ReplaceInText = false;
			bool DeactivateFilterAcrossFootnotesIfSeparatedByMoreThanOneIndexNo = true;						
		
			LiteralTextUnit idemSingularMaleLiteral = new LiteralTextUnit("ders.", FontStyle.Neutral);
			LiteralTextUnit idemSingularFemaleLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			LiteralTextUnit idemSingularNeutralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			LiteralTextUnit idemPluralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			
			LiteralTextUnit spaceLiteral = new LiteralTextUnit(" ", FontStyle.Neutral);			
			LiteralTextUnit andOthersLiteral = new LiteralTextUnit(" u.A.", FontStyle.Italic);			
			LiteralTextUnit betweenFirstAndSecondWithTwoLiteral = new LiteralTextUnit(" & ", FontStyle.Neutral);			
			LiteralTextUnit betweenFirstAndSecondWithThreeLiteral =  new LiteralTextUnit(", ", FontStyle.Neutral);			
			LiteralTextUnit betweenSecondAndThirdLiteral = new LiteralTextUnit(" & ", FontStyle.Neutral);
			
			LiteralTextUnit editorsPrefixLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsSingularLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsPluralLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsSuffixLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			
			// Fixed Variables
			
			if (citation == null) return null;
			
			Reference thisReference = citation.Reference;
			if (thisReference == null) return null;
			
			Reference parentReference = thisReference.ParentReference;
			if (parentReference == null) return null;
			
			Citation previousCitation = null;		
			if (citation.PreviousCitation!= null) previousCitation = citation.PreviousCitation;
			
			FootnoteCitation footnoteCitation = citation as FootnoteCitation;
			InTextCitation inTextCitation = citation as InTextCitation;
			
			PlaceholderCitation thisPlaceholderCitation  = citation as PlaceholderCitation;
			
			// Dynamic Variables
			
			bool IsIdem = false;
			bool SeparatedByMoreThanOneIndexNo = false;
			bool IsEditors = true;
			
			int personCount = 0;	
			
			TextUnitCollection output = new TextUnitCollection();
			
			//The Magic	
			
			// Getting the main persons for this reference

			IList<Person> parentReferencePersonList = parentReference.Editors as IList<Person>;						
			if (parentReferencePersonList == null || !parentReferencePersonList.Any()) return null;
			personCount = parentReferencePersonList.Count;
			
			IList<Person> thisReferencePersonList = thisReference.Authors as IList<Person>;					
			
			// Check if idem
			
			if (UseIdem &&
				thisReferencePersonList.Count == parentReferencePersonList.Count &&
				!thisReferencePersonList.Except(parentReferencePersonList).Any())
			{
				IsIdem = true;	
			}			
			
			// Print the author or idem
			
			if (IsIdem)
			{				
				if (parentReferencePersonList.Count == 1)
				{
					if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Male)
					{
						output.Add(idemSingularMaleLiteral);
					}
					else if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Female)
					{
						output.Add(idemSingularFemaleLiteral);
					}
					else if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Neutral || parentReferencePersonList.FirstOrDefault().Sex == Sex.Unknown)
					{
						output.Add(idemSingularNeutralLiteral);
					}
				}
				else if (parentReferencePersonList.Count > 1)
				{
					output.Add(idemPluralLiteral);
				}
			}
			else
			{
				int i = 1;
				foreach (Person person in parentReferencePersonList)
				{
					if (person == null) 
					{
					}
					else if (
						i == 1 &&
						UseIdem &&
						ReplaceFirstOfSeveralPersonsWithIdem &&
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
					{
						if (person.Sex == Sex.Male)
						{
							output.Add(idemSingularMaleLiteral);
						}
						else if (person.Sex == Sex.Female)
						{
							output.Add(idemSingularFemaleLiteral);
						}
						else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
						{
							output.Add(idemSingularNeutralLiteral);
						}
					}
					else if (i == 1)
					{   
						output.Add(new LiteralTextUnit(person.FirstName));
						if (person.MiddleName != "")
						{
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
						}
						output.Add(spaceLiteral);
						output.Add(new LiteralTextUnit(person.LastName));
					}
					else if (i == 2 && personCount == 2)
					{
						output.Add(betweenFirstAndSecondWithTwoLiteral);
						
						if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{						
							output.Add(new LiteralTextUnit(person.FirstName));
							if (person.MiddleName != "")
							{
								output.Add(spaceLiteral);
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}
					else if (i == 2 && personCount == 3)
					{
						output.Add(betweenFirstAndSecondWithThreeLiteral);
												if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{
							output.Add(new LiteralTextUnit(person.FirstName));	
							if (person.MiddleName != "")
							{
								output.Add(spaceLiteral);
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}
					else if (i == 2 && personCount > 3)
					{
						output.Add(andOthersLiteral);
						break;
					}
					else if (i == 3)
					{
						output.Add(betweenSecondAndThirdLiteral);
												if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{
							output.Add(new LiteralTextUnit(person.FirstName));			
							if (person.MiddleName != "")
							{
								output.Add(spaceLiteral);
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}					
					i = i +1;
				}
			}
			
			output.Add(editorsPrefixLiteral);
			if (personCount == 1) 
			{
				output.Add(editorsSingularLiteral);
			}
			else
			{
				output.Add(editorsPluralLiteral);
			}
				
			output.Add(editorsSuffixLiteral);

			// Finalizing the output
				
			if (NoPeriods)
			{
				foreach (ITextUnit textUnit in output)
				{
					var pattern1 = @"(?<=\p{Lu})\. ?(?=\p{Lu}\.)";
					textUnit.Text = Regex.Replace(textUnit.Text, pattern1, "");

					var pattern2 = @"\.";
					textUnit.Text = Regex.Replace(textUnit.Text, pattern2, "");
				}
			}
			
			return output;
			
		}
	}
}

Antworten (4)

Foto
1

Lieber Simon

Das geht auch mit Citavi 6 nicht, sorry.

Freundliche Grüsse

Peter

Foto
2

Das geht mt den von mir liebevoll Micky-Maus-Komponenten getauften Komponenten: eine Komponente, bei der vollkommen egal ist aus was für Elementen sie besteht (es kann also etwa ein Textelement sein, in dem "Micky Maus" steht), deren Inhalt vollkommen durch folgenden Code erzeugt wird:

using System.Linq;
using System.Collections.Generic;
using SwissAcademic.Citavi;
using SwissAcademic.Citavi.Metadata;
using SwissAcademic.Collections;
using SwissAcademic.Drawing;
using System.Text.RegularExpressions;

namespace SwissAcademic.Citavi.Citations
{
	public class ComponentPartFilter
		:
		IComponentPartFilter
	{
		public IEnumerable<ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled)
		{
			
			handled = true;
			
			// User Options
			
			bool NoPeriods = true;
			bool UseIdem = true;
			bool ReplaceFirstOfSeveralPersonsWithIdem = true;
			bool ReplaceSecondOrLaterOfSeveralPersonsWithIdem = true;
			bool ReplaceInText = false;
			bool DeactivateFilterAcrossFootnotesIfSeparatedByMoreThanOneIndexNo = true;						
		
			LiteralTextUnit idemSingularMaleLiteral = new LiteralTextUnit("ders.", FontStyle.Neutral);
			LiteralTextUnit idemSingularFemaleLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			LiteralTextUnit idemSingularNeutralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			LiteralTextUnit idemPluralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			
			LiteralTextUnit spaceLiteral = new LiteralTextUnit(" ", FontStyle.Neutral);			
			LiteralTextUnit andOthersLiteral = new LiteralTextUnit(" u.A.", FontStyle.Italic);			
			LiteralTextUnit betweenFirstAndSecondWithTwoLiteral = new LiteralTextUnit(" & ", FontStyle.Neutral);			
			LiteralTextUnit betweenFirstAndSecondWithThreeLiteral =  new LiteralTextUnit(", ", FontStyle.Neutral);			
			LiteralTextUnit betweenSecondAndThirdLiteral = new LiteralTextUnit(" & ", FontStyle.Neutral);
			
			LiteralTextUnit editorsPrefixLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsSingularLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsPluralLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsSuffixLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			
			// Fixed Variables
			
			if (citation == null) return null;
			
			Reference thisReference = citation.Reference;
			if (thisReference == null) return null;
			
			Reference parentReference = thisReference.ParentReference;
			if (parentReference == null) return null;
			
			Citation previousCitation = null;		
			if (citation.PreviousCitation!= null) previousCitation = citation.PreviousCitation;
			
			FootnoteCitation footnoteCitation = citation as FootnoteCitation;
			InTextCitation inTextCitation = citation as InTextCitation;
			
			PlaceholderCitation thisPlaceholderCitation  = citation as PlaceholderCitation;
			
			// Dynamic Variables
			
			bool IsIdem = false;
			bool SeparatedByMoreThanOneIndexNo = false;
			bool IsEditors = true;
			
			int personCount = 0;	
			
			TextUnitCollection output = new TextUnitCollection();
			
			//The Magic	
			
			// Getting the main persons for this reference

			IList<Person> parentReferencePersonList = parentReference.Editors as IList<Person>;						
			if (parentReferencePersonList == null || !parentReferencePersonList.Any()) return null;
			personCount = parentReferencePersonList.Count;
			
			IList<Person> thisReferencePersonList = thisReference.Authors as IList<Person>;					
			
			// Check if idem
			
			if (UseIdem &&
				thisReferencePersonList.Count == parentReferencePersonList.Count &&
				!thisReferencePersonList.Except(parentReferencePersonList).Any())
			{
				IsIdem = true;	
			}			
			
			// Print the author or idem
			
			if (IsIdem)
			{				
				if (parentReferencePersonList.Count == 1)
				{
					if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Male)
					{
						output.Add(idemSingularMaleLiteral);
					}
					else if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Female)
					{
						output.Add(idemSingularFemaleLiteral);
					}
					else if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Neutral || parentReferencePersonList.FirstOrDefault().Sex == Sex.Unknown)
					{
						output.Add(idemSingularNeutralLiteral);
					}
				}
				else if (parentReferencePersonList.Count > 1)
				{
					output.Add(idemPluralLiteral);
				}
			}
			else
			{
				int i = 1;
				foreach (Person person in parentReferencePersonList)
				{
					if (person == null) 
					{
					}
					else if (
						i == 1 &&
						UseIdem &&
						ReplaceFirstOfSeveralPersonsWithIdem &&
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
					{
						if (person.Sex == Sex.Male)
						{
							output.Add(idemSingularMaleLiteral);
						}
						else if (person.Sex == Sex.Female)
						{
							output.Add(idemSingularFemaleLiteral);
						}
						else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
						{
							output.Add(idemSingularNeutralLiteral);
						}
					}
					else if (i == 1)
					{   
						output.Add(new LiteralTextUnit(person.FirstName));
						if (person.MiddleName != "")
						{
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
						}
						output.Add(spaceLiteral);
						output.Add(new LiteralTextUnit(person.LastName));
					}
					else if (i == 2 && personCount == 2)
					{
						output.Add(betweenFirstAndSecondWithTwoLiteral);
						
						if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{						
							output.Add(new LiteralTextUnit(person.FirstName));
							if (person.MiddleName != "")
							{
								output.Add(spaceLiteral);
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}
					else if (i == 2 && personCount == 3)
					{
						output.Add(betweenFirstAndSecondWithThreeLiteral);
												if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{
							output.Add(new LiteralTextUnit(person.FirstName));	
							if (person.MiddleName != "")
							{
								output.Add(spaceLiteral);
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}
					else if (i == 2 && personCount > 3)
					{
						output.Add(andOthersLiteral);
						break;
					}
					else if (i == 3)
					{
						output.Add(betweenSecondAndThirdLiteral);
												if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{
							output.Add(new LiteralTextUnit(person.FirstName));			
							if (person.MiddleName != "")
							{
								output.Add(spaceLiteral);
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							output.Add(spaceLiteral);
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}					
					i = i +1;
				}
			}
			
			output.Add(editorsPrefixLiteral);
			if (personCount == 1) 
			{
				output.Add(editorsSingularLiteral);
			}
			else
			{
				output.Add(editorsPluralLiteral);
			}
				
			output.Add(editorsSuffixLiteral);

			// Finalizing the output
				
			if (NoPeriods)
			{
				foreach (ITextUnit textUnit in output)
				{
					var pattern1 = @"(?<=\p{Lu})\. ?(?=\p{Lu}\.)";
					textUnit.Text = Regex.Replace(textUnit.Text, pattern1, "");

					var pattern2 = @"\.";
					textUnit.Text = Regex.Replace(textUnit.Text, pattern2, "");
				}
			}
			
			return output;
			
		}
	}
}

Foto
1

Nochmals Danke für diesen genialen Code Jay.

Ich habe ihn für meine Zwecke ein wenig abgewandelt, sodass die Ausgabe dem Gewünschten Ergebnis entspricht. Lediglich die Mehrdeutigkeitsauflösung via "Uneindeutig" in "Notiz" (in der Personenkarte) wie sie der von von mir als erstes gepostete Code durchführt konnte ich nicht implementieren. Aber das ist ein sehr kleines feature auf das ich im Zweifel auch verzichten kann.


Für die Nachwelt hier der Code der das fettgedruckte Ergebnis produziert.:


[1] Henne, "Von 0 auf Lüth in 6 1/2 Jahren", in: ders./Riedlinger, Das Lüth-Urteil aus (rechts-) historischer Sicht, S. 198 (199)


[2] Barton, in: Esser u.A., FS f. Kühne, S. 139 (150)


using System.Linq;
using System.Collections.Generic;
using SwissAcademic.Citavi;
using SwissAcademic.Citavi.Metadata;
using SwissAcademic.Collections;
using SwissAcademic.Drawing;
using System.Text.RegularExpressions;

namespace SwissAcademic.Citavi.Citations
{
	public class ComponentPartFilter
		:
		IComponentPartFilter
	{
		public IEnumerable<ITextUnit> GetTextUnits(ComponentPart componentPart, Template template, Citation citation, out bool handled)
		{
			
			handled = true;
			
			// User Options
			
			bool NoPeriods = false;
			bool UseIdem = true;
			bool ReplaceFirstOfSeveralPersonsWithIdem = true;
			bool ReplaceSecondOrLaterOfSeveralPersonsWithIdem = true;
			bool ReplaceInText = false;
			bool DeactivateFilterAcrossFootnotesIfSeparatedByMoreThanOneIndexNo = true;						
		
			LiteralTextUnit idemSingularMaleLiteral = new LiteralTextUnit("ders.", FontStyle.Neutral);
			LiteralTextUnit idemSingularFemaleLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			LiteralTextUnit idemSingularNeutralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			LiteralTextUnit idemPluralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
			
			LiteralTextUnit spaceLiteral = new LiteralTextUnit(" ", FontStyle.Neutral);			
			LiteralTextUnit andOthersLiteral = new LiteralTextUnit(" u.A.", FontStyle.Neutral);			
			LiteralTextUnit betweenFirstAndSecondWithTwoLiteral = new LiteralTextUnit("/", FontStyle.Neutral);			
			LiteralTextUnit betweenFirstAndSecondWithThreeLiteral =  new LiteralTextUnit("/", FontStyle.Neutral);			
			LiteralTextUnit betweenSecondAndThirdLiteral = new LiteralTextUnit("/", FontStyle.Neutral);
			
			LiteralTextUnit editorsPrefixLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsSingularLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsPluralLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			LiteralTextUnit editorsSuffixLiteral = new LiteralTextUnit("", FontStyle.Neutral);
			
			// Fixed Variables
			
			if (citation == null) return null;
			
			Reference thisReference = citation.Reference;
			if (thisReference == null) return null;
			
			Reference parentReference = thisReference.ParentReference;
			if (parentReference == null) return null;
			
			Citation previousCitation = null;		
			if (citation.PreviousCitation!= null) previousCitation = citation.PreviousCitation;
			
			FootnoteCitation footnoteCitation = citation as FootnoteCitation;
			InTextCitation inTextCitation = citation as InTextCitation;
			
			PlaceholderCitation thisPlaceholderCitation  = citation as PlaceholderCitation;
			
			// Dynamic Variables
			
			bool IsIdem = false;
			bool SeparatedByMoreThanOneIndexNo = false;
			bool IsEditors = true;
			
			int personCount = 0;	
			
			TextUnitCollection output = new TextUnitCollection();
			
			//The Magic	
			
			// Getting the main persons for this reference

			IList<Person> parentReferencePersonList = parentReference.Editors as IList<Person>;						
			if (parentReferencePersonList == null || !parentReferencePersonList.Any()) return null;
			personCount = parentReferencePersonList.Count;
			
			IList<Person> thisReferencePersonList = thisReference.Authors as IList<Person>;					
			
			// Check if idem
			
			if (UseIdem &&
				thisReferencePersonList.Count == parentReferencePersonList.Count &&
				!thisReferencePersonList.Except(parentReferencePersonList).Any())
			{
				IsIdem = true;	
			}			
			
			// Print the author or idem
			
			if (IsIdem)
			{				
				if (parentReferencePersonList.Count == 1)
				{
					if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Male)
					{
						output.Add(idemSingularMaleLiteral);
					}
					else if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Female)
					{
						output.Add(idemSingularFemaleLiteral);
					}
					else if (parentReferencePersonList.FirstOrDefault().Sex == Sex.Neutral || parentReferencePersonList.FirstOrDefault().Sex == Sex.Unknown)
					{
						output.Add(idemSingularNeutralLiteral);
					}
				}
				else if (parentReferencePersonList.Count > 1)
				{
					output.Add(idemPluralLiteral);
				}
			}
			else
			{
				int i = 1;
				foreach (Person person in parentReferencePersonList)
				{
					if (person == null) 
					{
					}
					else if (
						i == 1 &&
						UseIdem &&
						ReplaceFirstOfSeveralPersonsWithIdem &&
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
					{
						if (person.Sex == Sex.Male)
						{
							output.Add(idemSingularMaleLiteral);
						}
						else if (person.Sex == Sex.Female)
						{
							output.Add(idemSingularFemaleLiteral);
						}
						else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
						{
							output.Add(idemSingularNeutralLiteral);
						}
					}
					else if (i == 1)
					{   
					
						if (person.MiddleName != "")
						{
							
							output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
						}
						
						output.Add(new LiteralTextUnit(person.LastName));
					}
					else if (i == 2 && personCount == 2)
					{
						output.Add(betweenFirstAndSecondWithTwoLiteral);
						
						if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{						
							
							if (person.MiddleName != "")
							{
								
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}
					else if (i == 2 && personCount == 3)
					{
						output.Add(betweenFirstAndSecondWithThreeLiteral);
												if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{
							
							if (person.MiddleName != "")
							{
								
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}
					else if (i == 2 && personCount > 3)
					{
						output.Add(andOthersLiteral);
						break;
					}
					else if (i == 3)
					{
						output.Add(betweenSecondAndThirdLiteral);
												if (UseIdem &&
						ReplaceSecondOrLaterOfSeveralPersonsWithIdem && 
						thisReferencePersonList.Count == 1 &&
						person == thisReferencePersonList.FirstOrDefault())
						{
							if (person.Sex == Sex.Male)
							{
								output.Add(idemSingularMaleLiteral);
							}
							else if (person.Sex == Sex.Female)
							{
								output.Add(idemSingularFemaleLiteral);
							}
							else if (person.Sex == Sex.Neutral || person.Sex == Sex.Unknown)
							{
								output.Add(idemSingularNeutralLiteral);
							}
						}
						else
						{
										
							if (person.MiddleName != "")
							{
								
								output.Add(new LiteralTextUnit(person.MiddleName[0].ToString()));
							}
							
							output.Add(new LiteralTextUnit(person.LastName));
						}
					}					
					i = i +1;
				}
			}
			
			output.Add(editorsPrefixLiteral);
			if (personCount == 1) 
			{
				output.Add(editorsSingularLiteral);
			}
			else
			{
				output.Add(editorsPluralLiteral);
			}
				
			output.Add(editorsSuffixLiteral);

			// Finalizing the output
				
			if (NoPeriods)
			{
				foreach (ITextUnit textUnit in output)
				{
					var pattern1 = @"(?<=\p{Lu})\. ?(?=\p{Lu}\.)";
					textUnit.Text = Regex.Replace(textUnit.Text, pattern1, "");

					var pattern2 = @"\.";
					textUnit.Text = Regex.Replace(textUnit.Text, pattern2, "");
				}
			}
			
			return output;
			
		}
	}
}

Foto
1

Vielen Dank! Das

LiteralTextUnit idemSingularNeutralLiteral = new LiteralTextUnit("dies.", FontStyle.Neutral);
ist aber ein Tippfehler, oder? M.E. müsste da "dass." stehen.

Foto
Foto
1

Hallo,

vielen Dank für das tolle Skript. Ich habe es erfolgreich ausprobiert...

Ich würde es gerne noch minimal anpassen, leider bekomme ich es mit meinen rudimentären Programmierkenntnissen nicht hin. Vielleicht kann mir jemand helfen, für den diese Änderungen kein Problem sind?

Die Vorgaben für mein Dokument sind, dass

  • die Ausgabe mit Abgekürzten Vor- und Mittelnamen erfolgt,
  • sowohl alle Namen als auch "ders."/"dies."/"dass." kursiv sind (konnte ich bis auf den ersten Namen selber anpassen)
  • die Namen mit " / " getrennt sind (konnte ich selber anpassen)
  • die ersten vier Herausgebernamen angezeigt werden und erst dann "u.a." verwendet wird.

Ein Beispiel für das Ziel:

D. Dubiel, „Ganzeindeutig auf die Gemeinde kommt es an“, in: dies. / H. Keul / B. Scholz / R. Sternal (Hg.), Tradition im Auf-Bruch:1948-1998. Festschrift des Seminars für Gemeindepastoral Magdeburg, Paderborn1998, 71–81.


Vermutlich ist es nicht ganz einfach machbar... vielleicht liest es jedoch jemand und kann mir helfen.

Frohe Grüße

Samuel

Antwort schreiben
 
Dateianlage anfügen (KEINE vertraulichen Dokumente!)