summaryrefslogtreecommitdiff
path: root/src/metadata.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-05-10 07:42:52 +0300
committerLars Wirzenius <liw@liw.fi>2023-05-10 08:26:11 +0300
commit0a81c16df535853c68d5c833a213a81c2a1a9388 (patch)
tree6bae05da8feb06162cab9351918858c50dd1e77a /src/metadata.rs
parent37c46ae17cb3f75a4b34c9e2104110c20fb2cb59 (diff)
downloadsubplot-0a81c16df535853c68d5c833a213a81c2a1a9388.tar.gz
refactor: move document metadata out of Markdown struct
It's _document_ metadata, not metadata for a specific markdown file. It belongs in Document, not Markdown. Make it so. Sponsored-by: author
Diffstat (limited to 'src/metadata.rs')
-rw-r--r--src/metadata.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/metadata.rs b/src/metadata.rs
index 9f25621..d569b40 100644
--- a/src/metadata.rs
+++ b/src/metadata.rs
@@ -176,6 +176,7 @@ pub struct Metadata {
basedir: PathBuf,
title: String,
date: Option<String>,
+ authors: Option<Vec<String>>,
markdown_filename: PathBuf,
bindings_filenames: Vec<PathBuf>,
bindings: Bindings,
@@ -234,6 +235,7 @@ impl Metadata {
basedir: basedir.as_ref().to_path_buf(),
title: yaml.title().into(),
date: yaml.date().map(|s| s.into()),
+ authors: yaml.authors().map(|a| a.into()),
markdown_filename: yaml.markdown().into(),
bindings_filenames,
bindings,
@@ -261,6 +263,11 @@ impl Metadata {
self.date = Some(date);
}
+ /// Authors.
+ pub fn authors(&self) -> Option<&[String]> {
+ self.authors.as_deref()
+ }
+
/// Return base dir for all relative filenames.
pub fn basedir(&self) -> &Path {
&self.basedir