Skip to content

Commit 4ff0d23

Browse files
authored
Fix name particles missing from listing author names (#15366)
Listing items built each structured author's name from given and family only, so a name with a particle showed as "Frank S. Boer" where the post's title block shows "Frank S. de Boer". A name without a given name showed as "undefined Aristotle". The same value feeds the listing author field, table sort and filter, and the RSS feed's dc:creator. Use cslNameToString, which builds the name in CSL order (given, dropping particle, non-dropping particle, family) and skips absent parts, matching how the title block builds it.
1 parent bb14001 commit 4ff0d23

7 files changed

Lines changed: 58 additions & 6 deletions

File tree

‎news/changelog-1.12.md‎

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

6969
- ([#15269](https://github.com/quarto-dev/quarto-cli/pull/15269)): Fix listing `image-alt` values containing quotes or `&` rendering broken or double-escaped alt text. (author: @mcanouil)
7070
- ([#15269](https://github.com/quarto-dev/quarto-cli/pull/15269)): Add `target` and `rel` options to listings and listing items, with the listing value as the default for its items. (author: @mcanouil)
71+
- ([#15366](https://github.com/quarto-dev/quarto-cli/pull/15366)): Fix name particles such as `de` or `van` missing from author names in listings and their RSS feeds, and `undefined` shown for a structured author name without a given name.
7172

7273
## Commands
7374

‎src/project/types/website/listing/website-listing-read.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ import {
103103
} from "../../../../config/constants.ts";
104104
import { projectRelativeHref } from "../website-shared.ts";
105105
import { isYamlPath, readYaml } from "../../../../core/yaml.ts";
106-
import { parseAuthor } from "../../../../core/author.ts";
106+
import { cslNameToString, parseAuthor } from "../../../../core/author.ts";
107107
import { parsePandocDate, resolveDate } from "../../../../core/date.ts";
108108
import { ProjectOutputFile } from "../../types.ts";
109109
import {
@@ -1206,11 +1206,7 @@ async function listItemFromFile(
12061206
);
12071207
}
12081208
const author = structuredAuthors
1209-
? uniq(
1210-
structuredAuthors.map((auth) =>
1211-
auth.literal || `${auth.given} ${auth.family}`
1212-
),
1213-
)
1209+
? uniq(structuredAuthors.map(cslNameToString))
12141210
: [];
12151211

12161212
const readingContext = target?.markdown?.markdown
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.quarto/
2+
_site/
3+
4+
**/*.quarto_ipynb
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "Listing authors with name particles"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Listing of posts by authors with name particles"
3+
listing:
4+
id: author-particles
5+
type: default
6+
contents: posts
7+
_quarto:
8+
render-project: true
9+
tests:
10+
html:
11+
ensureFileRegexMatches:
12+
-
13+
# particles are part of the displayed name, in CSL order
14+
- '<div class="listing-author">\s*Frank S\. de Boer, Ludwig van Beethoven\s*</div>'
15+
# absent name parts are skipped
16+
- '<div class="listing-author">\s*Aristotle\s*</div>'
17+
---
18+
19+
::: {#author-particles}
20+
:::
21+
22+
Listing items show each author's full name, including the dropping and
23+
non-dropping particles of a structured name, as the post's title block does.
24+
A structured name without a given name shows only the parts it has.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Post by an author with only a family name"
3+
author:
4+
- name:
5+
family: Aristotle
6+
---
7+
8+
A post whose author has a structured name with a family name and no given name.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "Post by authors with name particles"
3+
author:
4+
- name:
5+
given: Frank S.
6+
non-dropping-particle: de
7+
family: Boer
8+
- name:
9+
given: Ludwig
10+
dropping-particle: van
11+
family: Beethoven
12+
---
13+
14+
A post whose authors have structured names with particles.

0 commit comments

Comments
 (0)