From 448844d66cef5f4980d0575e783757264c962bb5 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 24 Feb 2023 14:09:38 +0100 Subject: Allow multiple authors --- src/doc.rs | 2 +- src/export/pdf/mod.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/doc.rs b/src/doc.rs index f4a4d968..55e2f467 100644 --- a/src/doc.rs +++ b/src/doc.rs @@ -25,7 +25,7 @@ pub struct Document { /// The document's title. pub title: Option, /// The document's author. - pub author: Option, + pub author: Vec, } /// A finished layout with elements at fixed positions. diff --git a/src/export/pdf/mod.rs b/src/export/pdf/mod.rs index 69fa805b..3813bad5 100644 --- a/src/export/pdf/mod.rs +++ b/src/export/pdf/mod.rs @@ -122,9 +122,11 @@ fn write_catalog(ctx: &mut PdfContext) { info.title(TextStr(title)); xmp.title([(None, title.as_str())]); } - if let Some(author) = &ctx.document.author { - info.author(TextStr(author)); - xmp.creator([(author.as_str())]); + + let authors = &ctx.document.author; + if !authors.is_empty() { + info.author(TextStr(&authors.join(", "))); + xmp.creator(authors.iter().map(|s| s.as_str())); } info.creator(TextStr("Typst")); info.finish(); -- cgit v1.2.3