Svg output

This commit is contained in:
elvis
2025-11-02 15:03:07 +01:00
parent ea05a8d99e
commit 920b9c7280
5 changed files with 215 additions and 27 deletions

View File

@ -2492,7 +2492,27 @@ fn process_template(
#[cfg(target_arch = "wasm32")] {
anyhow::bail!("Cannot sleep on wams");
}
}
},
| NodeInstruction::StringToSvg => {
let s = retrieve_from_cache![1];
let hash_inputs = hash_inputs!(s);
if let BasicValue::String { value } = s {
let res = match super::svg::Svg::parse_dot_string(&value) {
Ok(svg) => svg,
Err(e) => anyhow::bail!(e),
};
let res = BasicValue::Svg { value: res };
set_cache_output!((
output_names.first().unwrap(),
res,
hash_inputs
));
} else {
anyhow::bail!("Not a string");
}
},
}
Ok(None)
}