You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the JSON generator, it assumes the Western convention of forename surname. This is a format not specified by GEDCOM, which instead says (in GEDCOM 5.5.5) that:
The surname of an individual, if known, is enclosed between two slash (/) characters. The order of the name parts should be the order that the person would, by custom of their culture,have used when giving it to a recorder.
Examples
William Lee /Parry/ - given name William Lee, surname Parry
William Lee - given name only or surname not known
/Parry/ - surname only
William Lee /Mac Parry/ - both Mac and Parry are part of the surname Mac Parry
William /Parry/ Boatsman - surname Parry embedded in the name string
William Lee /Pa.../ - surname partly unknown (unreadable)
In the current behaviour, any text after the surname is discarded. This is a bug.
functionextractName(name: string): {firstName?: string;lastName?: string}{constmatches=name.match(/\/([^\/]+)\//);if(matches){constlastName=matches[1].trim();// Replace the last name part (including slashes) and trim the resultletfirstName=name.replace(matches[0],'').trim();// Replace any occurrence of double spaces with a single spacefirstName=firstName.replace(/\s\s+/g,' ');return{firstName: firstName||undefined,lastName: lastName};}else{// If no last name is found, just return the trimmed and cleaned firstNamereturn{firstName: name.trim().replace(/\s\s+/g,' ')};}}
Which results in:
extractName("William Lee /Mac Pa.../ Boatsman")// {"firstName": "William Lee Boatsman", "lastName": "Mac Pa..."}
This way at least, no information is lost (even if it may not be presented in the desired order on topola).
The text was updated successfully, but these errors were encountered:
apple-phi
changed the title
Handle non-Western naming conventions
Fix surname extraction
Aug 12, 2024
In the JSON generator, it assumes the Western convention of
forename surname
. This is a format not specified by GEDCOM, which instead says (in GEDCOM 5.5.5) that:In the current behaviour, any text after the surname is discarded. This is a bug.
The current implementation is the following:
topola/src/gedcom.ts
Lines 34 to 40 in f493984
I propose changing it to something like this:
Which results in:
This way at least, no information is lost (even if it may not be presented in the desired order on
topola
).The text was updated successfully, but these errors were encountered: