djc / askama

Type-safe, compiled Jinja-like templates for Rust
Apache License 2.0
3.37k stars 217 forks source link

SVG support #897

Closed marvinjuette closed 9 months ago

marvinjuette commented 10 months ago

Hey, it would be awesome to be able to use this library for SVG files too.

I want to render some standardized images with varying text, for which the templating would come in handy :D

djc commented 10 months ago

What features would you need for this? Why doesn't this already work for you?

marvinjuette commented 10 months ago

When I save the file as file.svg I get the error error: no escaper defined for extension 'svg' which then causes problems with the Template Macro.

So #[derive(Template)] this line does not work in my code, when I use a file with a SVG extension.

As a workaround, I simply use the HTML file extension and everything works fine. But I thought it would be nice to have native SVG support ^^

Hope this helps :D

djc commented 10 months ago

Okay, well, if you adjust TEXT_TYPES and DEFAULT_ESCAPERS it should work. Maybe submit a PR?

marvinjuette commented 9 months ago

solved with #902