summaryrefslogtreecommitdiff
path: root/src/journal.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal.rs')
-rw-r--r--src/journal.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/journal.rs b/src/journal.rs
index f6f3e61..ee239de 100644
--- a/src/journal.rs
+++ b/src/journal.rs
@@ -71,7 +71,7 @@ impl Journal {
pub fn new_draft(
&self,
title: &str,
- topic: &Option<PathBuf>,
+ topics: &[PathBuf],
editor: &str,
) -> Result<(), JournalError> {
let drafts = self.drafts();
@@ -83,13 +83,15 @@ impl Journal {
let mut context = Context::new();
context.insert("title", title);
context.insert("date", &current_timestamp());
- if let Some(ref topic) = topic {
+ let mut full_topics = vec![];
+ for topic in topics.iter() {
let pathname = topic_path(self.dirname(), topic);
if !pathname.exists() {
return Err(JournalError::NoSuchTopic(topic.to_path_buf()));
}
- context.insert("topic", &topic.display().to_string());
+ full_topics.push(topic.display().to_string());
}
+ context.insert("topics", &full_topics);
let pathname = self.pick_file_id(&drafts)?;
let text = self.templates.new_draft(&context)?;