summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/skaldpress/main.rs7
-rw-r--r--src/skaldpress/metadata_parser.rs8
2 files changed, 7 insertions, 8 deletions
diff --git a/src/skaldpress/main.rs b/src/skaldpress/main.rs
index bd0ebd3..574bc6a 100644
--- a/src/skaldpress/main.rs
+++ b/src/skaldpress/main.rs
@@ -187,13 +187,6 @@ fn macro_processor_initialize(
macro_processor.define_macro(key.to_string(), value.clone());
}
}
-
- if let Some(publish_date) = metadata.get("publish_date") {
- if !metadata.contains_key("change_date") {
- macro_processor
- .define_macro_string(format!("METADATA_change_date"), publish_date.to_string());
- }
- }
}
fn get_template_path(template: &str, opts: &Opts) -> String {
diff --git a/src/skaldpress/metadata_parser.rs b/src/skaldpress/metadata_parser.rs
index a2abcc2..66a96b6 100644
--- a/src/skaldpress/metadata_parser.rs
+++ b/src/skaldpress/metadata_parser.rs
@@ -4,7 +4,7 @@ use std::cmp::Ordering;
use std::collections::HashMap;
use std::fmt;
-#[derive(Eq, PartialEq, Debug)]
+#[derive(Clone, Eq, PartialEq, Debug)]
pub enum YamlValue {
Scalar(String),
Integer(i64),
@@ -130,5 +130,11 @@ pub fn extract_parse_yaml_metadata<'a>(
end_index = markdown.len();
}
+ if let Some(publish_date) = yaml_map.get("publish_date") {
+ if !yaml_map.contains_key("change_date") {
+ yaml_map.insert("change_date".to_string(), publish_date.clone());
+ }
+ }
+
Some((yaml_map, &markdown[end_index..]))
}