Skip to content

Commit 7ca7a2b

Browse files
committed
Properly read structured authors in listing items
Fixes #4881
1 parent 9cde55b commit 7ca7a2b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

news/changelog-1.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
- Permit using computation outputs (plots/figures) as the preview image for an item in a listing ([#2324](https://github.com/quarto-dev/quarto-cli/issues/2324))
143143
- Use alt text from preview image that is discovered for a page in a listing ([#3706](https://github.com/quarto-dev/quarto-cli/issues/3706))
144144
- Add support for `includes:` and `excludes:` in listings, which will use filter the items included in a listing. ([#2577](https://github.com/quarto-dev/quarto-cli/issues/2577)).
145+
- Properly render structured author names in listings ([#4881](https://github.com/quarto-dev/quarto-cli/issues/4881))
145146

146147
## Websites
147148

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ import { projectOutputDir } from "../../../project-shared.ts";
103103
import { directoryMetadataForInputFile } from "../../../project-context.ts";
104104
import { mergeConfigs } from "../../../../core/config.ts";
105105
import { globToRegExp } from "../../../../core/lib/glob.ts";
106+
import { cslNames } from "../../../../core/csl.ts";
106107

107108
// Defaults (a card listing that contains everything
108109
// in the source document's directory)
@@ -988,7 +989,17 @@ async function listItemFromFile(
988989
: undefined;
989990

990991
const authors = parseAuthor(documentMeta?.author);
991-
const author = authors ? authors.map((auth) => auth.name) : [];
992+
let structuredAuthors;
993+
if (authors) {
994+
structuredAuthors = cslNames(
995+
authors?.filter((auth) => auth !== undefined).map((auth) => auth?.name),
996+
);
997+
}
998+
const author = structuredAuthors
999+
? structuredAuthors.map((auth) =>
1000+
auth.literal || `${auth.given} ${auth.family}`
1001+
)
1002+
: [];
9921003

9931004
const readingtime = target?.markdown
9941005
? estimateReadingTimeMinutes(target.markdown.markdown)

0 commit comments

Comments
 (0)