lo_core 0.3.3

Core data models and XML utilities for ODF document generation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Tiny HTML escaping helper. HTML and XML escaping share the same five
//! characters; we keep a separate function so call sites read clearly.

use crate::xml::escape_text;

pub fn html_escape(value: &str) -> String {
    escape_text(value)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn escapes_html_specials() {
        assert_eq!(html_escape("<a href=\"x\">&"), "&lt;a href=\"x\"&gt;&amp;");
    }
}