svg-filters & basic parser #15

Merged
schrottkatze merged 67 commits from schrottkatze/iowo:svg-filters into main 2024-07-08 18:29:05 +00:00
Showing only changes of commit d87033d320 - Show all commits

View file

@ -43,10 +43,25 @@ impl SvgDocument {
self.filters.get_mut(&id.to_string()).unwrap()
}
pub fn generate_svg_pretty(&self) -> String {
let mut result = Vec::new();
let doc_writer = quick_xml::Writer::new_with_indent(&mut result, b' ', 2);
self.generate(doc_writer);
String::from_utf8_lossy(&result).to_string()
}
pub fn generate_svg(&self) -> String {
let mut result = Vec::new();
let mut doc_writer = quick_xml::Writer::new_with_indent(&mut result, b' ', 2);
let doc_writer = quick_xml::Writer::new(&mut result);
self.generate(doc_writer);
String::from_utf8_lossy(&result).to_string()
}
fn generate(&self, mut doc_writer: quick_xml::Writer<&mut Vec<u8>>) {
doc_writer
.create_element("svg")
.write_inner_content(|writer| {
@ -55,8 +70,6 @@ impl SvgDocument {
.try_fold(writer, Self::gen_filter)
.map(|_| {})
});
String::from_utf8_lossy(&result).to_string()
}
fn gen_filter<'w, 'r>(