diff --git a/src/picture.rs b/src/picture.rs
@@ -10,6 +10,7 @@ pub struct Picture {
pub path: PathBuf,
pub file_name: String,
pub alt: String,
+ pub caption: Option<String>,
}
impl<'de> Deserialize<'de> for Picture {
@@ -21,9 +22,14 @@ impl<'de> Deserialize<'de> for Picture {
struct Info {
path: String,
alt: String,
+ caption: Option<String>,
}
- let Info { path: path_str, alt, } = Info::deserialize(deserializer)?;
+ let Info {
+ path: path_str,
+ alt,
+ caption,
+ } = Info::deserialize(deserializer)?;
let mut path = PathBuf::new();
path.push(path_str.clone());
@@ -33,6 +39,7 @@ impl<'de> Deserialize<'de> for Picture {
path: path.clone(),
alt: alt.trim().to_string(),
file_name: String::from(file_name),
+ caption: caption.clone(),
})
} else {
Err(D::Error::invalid_value(