laracards 0.1.0

Editorial social cards and blog covers for Laravel Rust: SVG templates rendered natively, measured text fitting and pluggable backgrounds.
Documentation
/// Escapes a string so it is safe inside SVG and XML markup.
pub struct Text;

impl Text {
    /// Escape `&`, `<`, `>` and both kinds of quote.
    pub fn escape(value: &str) -> String {
        let mut escaped = String::with_capacity(value.len());

        for character in value.chars() {
            match character {
                '&' => escaped.push_str("&amp;"),
                '<' => escaped.push_str("&lt;"),
                '>' => escaped.push_str("&gt;"),
                '"' => escaped.push_str("&quot;"),
                '\'' => escaped.push_str("&apos;"),
                other => escaped.push(other),
            }
        }

        escaped
    }
}