From 9caf9bb6263299456ae8969527d66f072e584a03 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 25 Oct 2022 19:38:03 +0300 Subject: feat! subplot metadata field for authors Rename the field "author", which takes a single string value, to "authors", which takes a list of strings. This way we're consistent for single- and multi-author documents. Sponsored-by: author --- examples/seq/seq.subplot | 3 ++- src/ast.rs | 10 +++++++--- subplot.md | 11 ++++++++--- subplot.subplot | 3 ++- tests/subplots/common/files.subplot | 3 ++- tests/subplots/common/runcmd.subplot | 3 ++- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/examples/seq/seq.subplot b/examples/seq/seq.subplot index a6a6219..3bea683 100644 --- a/examples/seq/seq.subplot +++ b/examples/seq/seq.subplot @@ -1,5 +1,6 @@ title: "**seq**(1) acceptance tests" -author: The Subplot project +authors: + - The Subplot project markdowns: - seq.md bindings: diff --git a/src/ast.rs b/src/ast.rs index ceded5c..15843eb 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -285,7 +285,7 @@ pub enum Error { pub struct YamlMetadata { title: String, subtitle: Option, - author: Option, + authors: Option>, date: Option, classes: Option>, bibliography: Option>, @@ -320,8 +320,12 @@ impl YamlMetadata { map.insert("subtitle".into(), meta_string(v)); } - if let Some(v) = &self.author { - map.insert("author".into(), meta_string(v)); + if let Some(authors) = &self.authors { + let authors: Vec = authors + .iter() + .map(|s| MetaValue::MetaString(s.into())) + .collect(); + map.insert("author".into(), MetaValue::MetaList(authors)); } if let Some(v) = &self.date { diff --git a/subplot.md b/subplot.md index 2d494b3..0901133 100644 --- a/subplot.md +++ b/subplot.md @@ -637,7 +637,8 @@ they are how Pandoc recongizes the block. ~~~{.yaml .numberLines} --- title: "Subplot" -author: The Subplot project +authors: +- The Subplot project date: work in progress bindings: - subplot.yaml @@ -2449,7 +2450,9 @@ and file metadate.html contains "WIP" ~~~{#metadate.subplot .file .yaml .numberLines} title: The Fabulous Title -author: Alfred Pennyworth and Geoffrey Butler +authors: +- Alfred Pennyworth +- Geoffrey Butler date: WIP markdowns: - metadate.md @@ -2478,7 +2481,9 @@ and file dateoption.html contains "FANCYDATE" ~~~{#dateless.subplot .file .yaml .numberLines} title: The Fabulous Title -author: Alfred Pennyworth and Geoffrey Butler +authors: +- Alfred Pennyworth +- Geoffrey Butler markdowns: - dateless.md ~~~ diff --git a/subplot.subplot b/subplot.subplot index 61ecd4f..e109430 100644 --- a/subplot.subplot +++ b/subplot.subplot @@ -1,5 +1,6 @@ title: "Subplot" -author: The Subplot project +authors: + - The Subplot project markdowns: - subplot.md bindings: diff --git a/tests/subplots/common/files.subplot b/tests/subplots/common/files.subplot index edf7a26..75726f9 100644 --- a/tests/subplots/common/files.subplot +++ b/tests/subplots/common/files.subplot @@ -1,5 +1,6 @@ title: Acceptance criteria for the files Subplot library -author: The Subplot project +authors: + - The Subplot project markdowns: - files.md bindings: diff --git a/tests/subplots/common/runcmd.subplot b/tests/subplots/common/runcmd.subplot index e30e5a8..dcfd590 100644 --- a/tests/subplots/common/runcmd.subplot +++ b/tests/subplots/common/runcmd.subplot @@ -1,5 +1,6 @@ title: Acceptance criteria for the lib/runcmd Subplot library -author: The Subplot project +authors: + - The Subplot project markdowns: - runcmd.md bindings: -- cgit v1.2.1