bump dependencies #79
1 changed files with 43 additions and 36 deletions
|
@ -230,8 +230,10 @@ fn fix_images_and_integration(path: &str, html: &str) -> (String, Metadata) {
|
||||||
mail_obfsucated: false,
|
mail_obfsucated: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
(
|
// Collection of any additional metadata
|
||||||
rewrite_str(
|
let mut additional_metadata = Vec::new();
|
||||||
|
|
||||||
|
let result = rewrite_str(
|
||||||
html,
|
html,
|
||||||
RewriteStrSettings {
|
RewriteStrSettings {
|
||||||
element_content_handlers: vec![element!("img", |el| {
|
element_content_handlers: vec![element!("img", |el| {
|
||||||
|
@ -252,24 +254,29 @@ fn fix_images_and_integration(path: &str, html: &str) -> (String, Metadata) {
|
||||||
Some(options),
|
Some(options),
|
||||||
);
|
);
|
||||||
el.replace(&data.content, ContentType::Html);
|
el.replace(&data.content, ContentType::Html);
|
||||||
metadata.merge(&data.metadata);
|
|
||||||
|
// Store the metadata for later merging
|
||||||
|
additional_metadata.push(data.metadata);
|
||||||
} else {
|
} else {
|
||||||
let image = general_purpose::STANDARD.encode(file);
|
let image = general_purpose::STANDARD.encode(file);
|
||||||
|
|
||||||
el.set_attribute("src", &format!("data:{mime};base64,{image}"))
|
el.set_attribute("src", &format!("data:{mime};base64,{image}"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})],
|
})],
|
||||||
..RewriteStrSettings::default()
|
..RewriteStrSettings::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap();
|
||||||
metadata,
|
|
||||||
)
|
// Merge all collected metadata
|
||||||
|
for additional in additional_metadata {
|
||||||
|
metadata.merge(&additional);
|
||||||
|
}
|
||||||
|
|
||||||
|
(result, metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Transform markdown string to File structure
|
/// Transform markdown string to File structure
|
||||||
|
|
Loading…
Reference in a new issue