Implement the GEDCOM tag "_RUFNAME"

RUFNAME is the German word for "call name", i.e. the part of the given
name commonly used to address somebody. Some official documents mark it
as such.

The GEDCOM standards 5.5.1 and 5.5.5 mention this tag.
This commit is contained in:
Matthias Urlichs 2023-01-19 17:24:52 +01:00 committed by Nick Hall
parent b7d28a28f1
commit 5e1d36b0ad
5 changed files with 24 additions and 1 deletions

View File

@ -774,6 +774,7 @@
<name type="Birth Name"> <name type="Birth Name">
<first>Amber Marie</first> <first>Amber Marie</first>
<surname>Smith</surname> <surname>Smith</surname>
<call>Marie</call>
</name> </name>
<eventref hlink="_0000003100000031" role="Primary"/> <eventref hlink="_0000003100000031" role="Primary"/>
<eventref hlink="_0000003300000033" role="Primary"/> <eventref hlink="_0000003300000033" role="Primary"/>

View File

@ -122,7 +122,7 @@ BEGIN:VCARD
VERSION:3.0 VERSION:3.0
PRODID:-//Gramps//NONSGML Gramps 5.0.0-alpha1//EN PRODID:-//Gramps//NONSGML Gramps 5.0.0-alpha1//EN
FN:Amber Marie Smith FN:Amber Marie Smith
N:Smith;Amber;Marie;; N:Smith;Marie;Amber;;
SORT-STRING:Smith Amber Marie SORT-STRING:Smith Amber Marie
X-GENDER:Female X-GENDER:Female
BDAY:1998-04-12 BDAY:1998-04-12

View File

@ -65,6 +65,7 @@
2 TYPE birth 2 TYPE birth
2 GIVN Amber Marie 2 GIVN Amber Marie
2 SURN Smith 2 SURN Smith
2 _RUFNAME Marie
1 SEX F 1 SEX F
1 BIRT 1 BIRT
2 TYPE Birth of Amber Marie Smith 2 TYPE Birth of Amber Marie Smith
@ -984,6 +985,7 @@
2 GIVN Fake 2 GIVN Fake
2 SPFX von 2 SPFX von
2 SURN Person 2 SURN Person
2 _RUFNAME Person
2 NSFX I 2 NSFX I
2 NPFX Fake person 2 NPFX Fake person
2 NICK Fake 2 NICK Fake

View File

@ -1304,6 +1304,7 @@ class GedcomWriter(UpdateCallback):
suffix = name.get_suffix() suffix = name.get_suffix()
title = name.get_title() title = name.get_title()
nick = name.get_nick_name() nick = name.get_nick_name()
call = name.get_call_name()
if nick.strip() == '': if nick.strip() == '':
nick = attr_nick nick = attr_nick
@ -1323,6 +1324,8 @@ class GedcomWriter(UpdateCallback):
self._writeln(2, 'SPFX', surprefix) self._writeln(2, 'SPFX', surprefix)
if surname: if surname:
self._writeln(2, 'SURN', surname) self._writeln(2, 'SURN', surname)
if call:
self._writeln(2, '_RUFNAME', call)
if name.get_suffix(): if name.get_suffix():
self._writeln(2, 'NSFX', suffix) self._writeln(2, 'NSFX', suffix)
if name.get_title(): if name.get_title():

View File

@ -276,6 +276,7 @@ TOKEN__JUST = 135
TOKEN__TEXT = 136 TOKEN__TEXT = 136
TOKEN__DATE = 137 TOKEN__DATE = 137
TOKEN__APID = 138 TOKEN__APID = 138
TOKEN__CALLNAME = 139
TOKENS = { TOKENS = {
"_ADPN" : TOKEN__ADPN, "_ADPN" : TOKEN__ADPN,
@ -316,6 +317,7 @@ TOKENS = {
"_PRIMARY" : TOKEN__PRIMARY, "_PRIMARY" : TOKEN__PRIMARY,
"_PRIV" : TOKEN__PRIV, "_PRIV" : TOKEN__PRIV,
"_PUBLISHER" : TOKEN_IGNORE, "_PUBLISHER" : TOKEN_IGNORE,
"_RUFNAME" : TOKEN__CALLNAME,
"_SCBK" : TOKEN_IGNORE, "_SCBK" : TOKEN_IGNORE,
"_SCHEMA" : TOKEN__SCHEMA, "_SCHEMA" : TOKEN__SCHEMA,
"_SSHOW" : TOKEN_IGNORE, "_SSHOW" : TOKEN_IGNORE,
@ -2091,6 +2093,8 @@ class GedcomParser(UpdateCallback):
TOKEN_GIVN : self.__name_givn, TOKEN_GIVN : self.__name_givn,
# NICK <NAME_PIECE_NICKNAME> {0:1} # NICK <NAME_PIECE_NICKNAME> {0:1}
TOKEN_NICK : self.__name_nick, TOKEN_NICK : self.__name_nick,
# _RUFNAME <NAME_PIECE_CALLNAME> {0:1}
TOKEN__CALLNAME: self.__name_call,
# +1 SPFX <NAME_PIECE_SURNAME_PREFIX {0:1} # +1 SPFX <NAME_PIECE_SURNAME_PREFIX {0:1}
TOKEN_SPFX : self.__name_spfx, TOKEN_SPFX : self.__name_spfx,
# +1 SURN <NAME_PIECE_SURNAME> {0:1} # +1 SURN <NAME_PIECE_SURNAME> {0:1}
@ -4424,6 +4428,19 @@ class GedcomParser(UpdateCallback):
state.name.set_nick_name(line.data.strip()) state.name.set_nick_name(line.data.strip())
self.__skip_subordinate_levels(state.level + 1, state) self.__skip_subordinate_levels(state.level + 1, state)
def __name_call(self, line, state):
"""
This parses the inofficial _RUFNAME tag that indicates which part
of a person's given name is commonly used to address them.
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
"""
state.name.set_call_name(line.data.strip())
self.__skip_subordinate_levels(state.level + 1, state)
def __name_aka(self, line, state): def __name_aka(self, line, state):
""" """
This parses the non-standard GEDCOM tags _AKA or _AKAN as a subsidiary This parses the non-standard GEDCOM tags _AKA or _AKAN as a subsidiary