Commit f095bb2
committed
NameProcessor: only inject nickname from primary NAME, anchor on last given name
Two correctness fixes for the nickname-injection feature:
getNickname() previously returned the first NICK across ALL NAME facts,
including `_MARNM` and other type-tagged variants. A nickname tied to
the married identity does not belong on the primary-identity name that
getFullName() returns. Skip non-primary NAME facts (TYPE != BIRTH/empty).
injectNickname() previously located the surname via strrpos and inserted
the quoted nickname before it. For trees that store surname particles
(`von`, `de la`, `van der`) outside the GEDCOM /SURN/ slashes, the
SURN attribute is just the family name (e.g. "Berg") and the particle
sits in the given-name area. The old algorithm produced
`Friedrich von "Fritz" Berg` — the nickname split the particle off
its surname. Anchor on the position after the last given name instead,
which keeps particles intact: `Friedrich von "Fritz" Berg` becomes
`Friedrich von "Fritz" Berg` if particles are inside the slashes
(SURN = "von Berg", firstNames = ["Friedrich"]) or
`Friedrich von "Fritz" Berg` if they sit outside (SURN = "Berg",
firstNames = ["Friedrich", "von"]). Tests cover both conventions
plus repeated given names, no given names, and idempotent re-injection.
Also fix .gitattributes: `/test/` was a typo for `/tests/`, so the
test suite was being shipped in composer --prefer-dist tarballs. Add
the rest of the dev-only paths (Make/, Makefile, AGENTS.md, compose.yaml,
.build/) for a leaner package.1 parent 3d744c4 commit f095bb2
3 files changed
Lines changed: 72 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
188 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| |||
223 | 233 | | |
224 | 234 | | |
225 | 235 | | |
226 | | - | |
| 236 | + | |
227 | 237 | | |
228 | 238 | | |
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
232 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
233 | 245 | | |
234 | 246 | | |
235 | 247 | | |
236 | | - | |
237 | | - | |
238 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
239 | 256 | | |
240 | 257 | | |
241 | 258 | | |
242 | | - | |
| 259 | + | |
243 | 260 | | |
244 | 261 | | |
245 | 262 | | |
246 | 263 | | |
247 | 264 | | |
248 | | - | |
| 265 | + | |
249 | 266 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 267 | + | |
| 268 | + | |
257 | 269 | | |
258 | 270 | | |
259 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
260 | 280 | | |
261 | 281 | | |
262 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | | - | |
399 | | - | |
| 398 | + | |
| 399 | + | |
400 | 400 | | |
401 | | - | |
402 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
403 | 406 | | |
404 | | - | |
405 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
406 | 412 | | |
407 | | - | |
408 | | - | |
| 413 | + | |
| 414 | + | |
409 | 415 | | |
410 | | - | |
411 | | - | |
| 416 | + | |
| 417 | + | |
412 | 418 | | |
413 | | - | |
414 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
415 | 424 | | |
416 | 425 | | |
417 | 426 | | |
418 | 427 | | |
419 | 428 | | |
| 429 | + | |
| 430 | + | |
420 | 431 | | |
421 | 432 | | |
422 | 433 | | |
423 | 434 | | |
424 | | - | |
| 435 | + | |
425 | 436 | | |
426 | 437 | | |
427 | 438 | | |
428 | | - | |
| 439 | + | |
429 | 440 | | |
430 | 441 | | |
431 | 442 | | |
| |||
0 commit comments