Skip to content

Commit 5f06c8d

Browse files
authored
Keep name particles in author names and display names (#15359)
Particles such as "de" and "van" were dropped from author names, so the title block showed "Frank S. Boer" for a name whose non-dropping-particle is "de". The normalizer discarded particles from name tables and string authors, and the display name was built from given and family only. Particles are now kept, and the display name follows CSL order (given, dropping particle, non-dropping particle, family). A particle parsed from a literal is added only when the parse also supplies the family, so a written family is not doubled. - Keep both particle fields in name tables and parse particles from string authors - Build the display name in CSL order, skipping absent parts - Fill only the fields the author did not write Fixes #12649
1 parent 1e2ba61 commit 5f06c8d

3 files changed

Lines changed: 78 additions & 17 deletions

File tree

‎news/changelog-1.12.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ All changes included in 1.12:
2929

3030
### All Formats
3131

32+
- ([#12649](https://github.com/quarto-dev/quarto-cli/issues/12649)): Fix name particles such as `de` or `van` missing from author names in title blocks and JATS output.
3233
- ([#15344](https://github.com/quarto-dev/quarto-cli/pull/15344)): A Div with an id that starts with a heading now renders as that heading's section, which takes the Div's classes, so CSS such as `div.myclass > section` no longer matches. Quarto keeps the heading id on the section, so crossrefs and table of contents links still target the heading; in beamer, DocBook, ConTeXt, AsciiDoc and revealjs the Div's id is no longer written.
3334

3435
### `html`

‎src/resources/filters/modules/authors.lua‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ local kFamilyName = 'family'
118118
local kLiteralName = 'literal'
119119
local kDroppingParticle = 'dropping-particle'
120120
local kNonDroppingParticle = 'non-dropping-particle'
121-
local kNameFields = { kGivenName, kFamilyName, kLiteralName}
121+
local kNameFields = { kGivenName, kFamilyName, kLiteralName, kDroppingParticle, kNonDroppingParticle }
122122

123123
-- Academic titles or professional certifications displayed following a personal name (for example, “MD”, “PhD”).
124124
local kDegrees = 'degrees'
@@ -421,15 +421,15 @@ local function bibtexParseName(nameRaw)
421421
end
422422

423423
local function createNameLiteral(name)
424+
-- CSL display order, skipping absent parts
424425
local literalName = {}
425-
if name[kFamilyName] and name[kGivenName] then
426-
tappend(literalName, name[kGivenName])
427-
tappend(literalName, {pandoc.Space()})
428-
tappend(literalName, name[kFamilyName])
429-
elseif name[kFamilyName] then
430-
tappend(literalName, name[kFamilyName])
431-
elseif name[kGivenName] then
432-
tappend(literalName, name[kGivenName])
426+
for _, field in ipairs({ kGivenName, kDroppingParticle, kNonDroppingParticle, kFamilyName }) do
427+
if name[field] ~= nil then
428+
if #literalName > 0 then
429+
tappend(literalName, {pandoc.Space()})
430+
end
431+
tappend(literalName, name[field])
432+
end
433433
end
434434
return literalName
435435
end
@@ -445,19 +445,24 @@ local function normalizeName(name)
445445
-- no family or given name, parse the literal and create one
446446
if name[kFamilyName] == nil or name[kGivenName] == nil then
447447
if name[kLiteralName] then
448-
local parsedName = bibtexParseName(name)
448+
local parsedName = bibtexParseName(name[kLiteralName])
449449
if type(parsedName) == 'table' then
450-
if parsedName.given ~= nil then
450+
-- fields the author wrote win over what the parse infers
451+
if name[kGivenName] == nil and parsedName.given ~= nil then
451452
name[kGivenName] = {pandoc.Str(parsedName.given)}
452453
end
453-
if parsedName.family ~= nil then
454+
-- a parsed particle belongs to the parsed family: a written
455+
-- family already holds whatever particle the author meant
456+
local familyFromParse = name[kFamilyName] == nil and parsedName.family ~= nil
457+
if familyFromParse then
454458
name[kFamilyName] = {pandoc.Str(parsedName.family)}
455459
end
456-
if name[kDroppingParticle] ~= nil then
457-
name[kDroppingParticle] = parsedName[kDroppingParticle]
458-
end
459-
if name[kNonDroppingParticle] ~= nil then
460-
name[kNonDroppingParticle] = parsedName[kNonDroppingParticle]
460+
if familyFromParse and name[kDroppingParticle] == nil and name[kNonDroppingParticle] == nil then
461+
for _, particle in ipairs({ kDroppingParticle, kNonDroppingParticle }) do
462+
if parsedName[particle] ~= nil then
463+
name[particle] = {pandoc.Str(parsedName[particle])}
464+
end
465+
end
461466
end
462467
else
463468
if #name[kLiteralName] > 1 then
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Author name particles
3+
author:
4+
- Charles de Gaulle
5+
- name:
6+
given: Frank S.
7+
family: Boer
8+
non-dropping-particle: de
9+
- given: Ludwig
10+
family: Beethoven
11+
non-dropping-particle: van
12+
- Johannes van der Waals
13+
- Plato
14+
- name:
15+
literal: Johann Wolfgang von Goethe
16+
given: J. W.
17+
- name:
18+
literal: Jean de La Fontaine
19+
dropping-particle: de
20+
- name:
21+
given: Alexander
22+
family: Humboldt
23+
dropping-particle: von
24+
- name:
25+
literal: Vincent van Gogh
26+
family: van Gogh
27+
- name:
28+
family: van den Bosch
29+
format:
30+
html: default
31+
jats: default
32+
_quarto:
33+
tests:
34+
html:
35+
ensureFileRegexMatches:
36+
- ['<p>Charles de Gaulle\s*</p>', '<p>Frank S\. de Boer\s*</p>', '<p>Ludwig van Beethoven\s*</p>', '<p>Alexander von Humboldt\s*</p>', '<p>Johannes van der Waals\s*</p>', '<p>Plato\s*</p>']
37+
- ['<p>Frank S\. Boer\s*</p>', '<p>Ludwig Beethoven\s*</p>', '<p>Alexander Humboldt\s*</p>']
38+
jats:
39+
ensureFileRegexMatches:
40+
- ['<given-names>Alexander von</given-names>', '<surname>de Gaulle</surname>', '<surname>de Boer</surname>', '<surname>van Beethoven</surname>', '<surname>van der Waals</surname>', '<surname>Plato</surname>', '<surname>von Goethe</surname>', '<given-names>J\. W\.</given-names>', '<surname>La Fontaine</surname>', '<given-names>Jean de</given-names>', '<surname>van Gogh</surname>', '<surname>van den Bosch</surname>']
41+
- ['<surname>Gaulle</surname>', '<surname>Boer</surname>', '<surname>Beethoven</surname>', '<surname>Waals</surname>', 'J\. W\.Johann', '<given-names>Johann Wolfgang</given-names>', '<surname>de La Fontaine</surname>', 'van van Gogh', 'van den van den Bosch']
42+
---
43+
44+
Particles in author names must survive author normalization.
45+
46+
- `Charles de Gaulle` is a plain string: Pandoc's BibTeX parse finds the particle `de`.
47+
- `Frank S. de Boer` is a `name:` table with an explicit `non-dropping-particle`.
48+
- `Ludwig van Beethoven` uses flat `given`, `family` and `non-dropping-particle` fields.
49+
- `Johannes van der Waals` is a string with a multi-word particle.
50+
- `Plato` is a single-word string: no particle, no stray spaces.
51+
- `Johann Wolfgang von Goethe` has a literal plus a written `given`, which must survive the parse.
52+
- `Jean de La Fontaine` has a literal plus an explicit particle, which wins over the parse.
53+
- `Alexander von Humboldt` has an explicit `dropping-particle`: the title block shows it, and JATS keeps it with the given names.
54+
- `Vincent van Gogh` has a literal plus a written `family` that already holds the particle, which must not be added twice.
55+
- `van den Bosch` is a written `family` alone, holding its particle: nothing is added to it.

0 commit comments

Comments
 (0)