summaryrefslogtreecommitdiff
path: root/src/bin/subplot.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-05-10 09:10:25 +0300
committerLars Wirzenius <liw@liw.fi>2023-05-10 09:14:34 +0300
commitace211d2c2e9c775872c4a23087763afff5a5bb2 (patch)
treef6884f4b6c3ee43c9c736f7f91e12d8a5ec98c49 /src/bin/subplot.rs
parent0a81c16df535853c68d5c833a213a81c2a1a9388 (diff)
downloadsubplot-ace211d2c2e9c775872c4a23087763afff5a5bb2.tar.gz
feat! allow multiple markdown files for a subplot
Sponsored-by: author
Diffstat (limited to 'src/bin/subplot.rs')
-rw-r--r--src/bin/subplot.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bin/subplot.rs b/src/bin/subplot.rs
index 41d8894..8da6c2b 100644
--- a/src/bin/subplot.rs
+++ b/src/bin/subplot.rs
@@ -264,8 +264,18 @@ impl Docgen {
} else if let Some(date) = doc.meta().date() {
date.to_string()
} else {
- let filename = doc.meta().basedir().join(doc.meta().markdown_filename());
- Self::mtime_formatted(Self::mtime(&filename)?)
+ let mut newest = None;
+ for filename in doc.meta().markdown_filenames() {
+ let mtime = Self::mtime(filename)?;
+ if let Some(so_far) = newest {
+ if mtime > so_far {
+ newest = Some(mtime);
+ }
+ } else {
+ newest = Some(mtime);
+ }
+ }
+ Self::mtime_formatted(newest.unwrap())
};
if Self::need_output(&mut doc, self.template.as_deref(), &self.output) {