Skip to content

Commit 2e25318

Browse files
authored
Fix name particles missing from Google Scholar editor names (#15373)
With `google-scholar: true`, `citation_editor` was built from given and family only, so an editor with a non-dropping-particle `van den` was written as "Jan Berg". An editor without a given name was written as "undefined Aristotle". `citation_author` was not affected in practice because author metadata is normalized before it reaches the meta tags, but `citation.editor` is not. Use cslNameToString for both tags. It builds the name in CSL order (given, dropping particle, non-dropping particle, family), skips absent parts, and keeps a literal name as is, matching the title block and the listing author names.
1 parent 4ff0d23 commit 2e25318

3 files changed

Lines changed: 49 additions & 8 deletions

File tree

‎news/changelog-1.12.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ All changes included in 1.12:
4141
- Links inherit the text color unless `linkcolor` is set, and horizontal rules and table borders follow the text color.
4242
- Printed output drops backgrounds and uses the 11pt print size of the other Quarto HTML themes.
4343
- Pandoc 3.13's automatic dark mode is not enabled.
44+
- ([#15373](https://github.com/quarto-dev/quarto-cli/pull/15373)): Fix name particles such as `de` or `van` missing from editor names in the `citation_editor` Google Scholar meta tags, and `undefined` shown for an editor without a given name.
4445

4546
### `pdf`
4647

‎src/format/html/format-html-meta.ts‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from "../../command/render/types.ts";
1212
import { kCanonicalUrl, kCitationTitle } from "../../config/constants.ts";
1313
import { Format, Metadata } from "../../config/types.ts";
14+
import { cslNameToString } from "../../core/author.ts";
1415
import { bibliographyCslJson } from "../../core/bibliography.ts";
1516
import {
1617
CSL,
@@ -123,20 +124,14 @@ function googleScholarMeta(
123124
// Authors
124125
if (csl.author) {
125126
csl.author.forEach((author) => {
126-
write(
127-
"citation_author",
128-
author.literal || `${author.given} ${author.family}`,
129-
);
127+
write("citation_author", cslNameToString(author));
130128
});
131129
}
132130

133131
// Editors
134132
if (csl.editor) {
135133
csl.editor.forEach((editor) => {
136-
write(
137-
"citation_editor",
138-
editor.literal || `${editor.given} ${editor.family}`,
139-
);
134+
write("citation_editor", cslNameToString(editor));
140135
});
141136
}
142137

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "Name particles in Google Scholar metadata"
3+
google-scholar: true
4+
format: html
5+
author:
6+
- given: Frank S.
7+
family: Boer
8+
non-dropping-particle: de
9+
- name:
10+
given: Ludwig
11+
family: Beethoven
12+
dropping-particle: van
13+
citation:
14+
type: article-journal
15+
container-title: Journal
16+
issued: 2024-01-01
17+
editor:
18+
- given: Jan
19+
family: Berg
20+
non-dropping-particle: van den
21+
- name:
22+
given: Anna
23+
family: Roos
24+
dropping-particle: von
25+
- family: Aristotle
26+
_quarto:
27+
tests:
28+
html:
29+
ensureHtmlElements:
30+
-
31+
- 'meta[name="citation_author"][content="Frank S. de Boer"]'
32+
- 'meta[name="citation_author"][content="Ludwig van Beethoven"]'
33+
- 'meta[name="citation_editor"][content="Jan van den Berg"]' # non-dropping-particle
34+
- 'meta[name="citation_editor"][content="Anna von Roos"]' # dropping-particle in name: wrapper
35+
- 'meta[name="citation_editor"][content="Aristotle"]' # no given name
36+
-
37+
- 'meta[name="citation_editor"][content*="undefined"]'
38+
---
39+
40+
The `citation_author` and `citation_editor` meta tags should carry the same
41+
display name as the title block: given name, dropping particle, non-dropping
42+
particle, family name.
43+
Authors are normalized before they reach the meta tags, but `citation.editor`
44+
is not, so the editors exercise the name builder in `googleScholarMeta`.
45+
An editor without a given name must not render as "undefined Aristotle".

0 commit comments

Comments
 (0)