fix(parser): preserve annotation parens for single-person inputs

Move paren extraction in parseReceivers() after the multi-separator
check so single-person entries like "Clara de Gruyter(*1871)" keep
their parens intact for split()'s annotation extraction. Multi-person
entries like "Hedi und Tutu (Gruber)" still use parens as shared
last-name override.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-08 13:00:34 +02:00
parent e696e5056d
commit e49ae5de29
2 changed files with 20 additions and 6 deletions

View File

@@ -24,6 +24,18 @@ class PersonNameParserTest {
.containsExactly("Eugenie de Gruyter");
}
@Test
void singlePerson_annotationParenPreserved() {
assertThat(PersonNameParser.parseReceivers("Clara de Gruyter(*1871)"))
.containsExactly("Clara de Gruyter(*1871)");
}
@Test
void singlePerson_nicknameParenPreserved() {
assertThat(PersonNameParser.parseReceivers("Gertrud D.(Tuttu)"))
.containsExactly("Gertrud D.(Tuttu)");
}
@Test
void gebAnnotation_noDot_multiWord_stripped() {
assertThat(PersonNameParser.parseReceivers("Ella Dieckmann, geb de Gruyter"))