From 40713ae38b0e3aebd9023eb5f54a59162dabbf98 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 1 Feb 2021 11:04:40 +0100 Subject: [PATCH] add entity escaping to the example --- examples/gen_sitemap.rs | 10 ++++++++++ src/lib.rs | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/examples/gen_sitemap.rs b/examples/gen_sitemap.rs index ae0e6d8..1c8836b 100644 --- a/examples/gen_sitemap.rs +++ b/examples/gen_sitemap.rs @@ -37,6 +37,16 @@ fn main() { ), }); + // Entity escaping + sitemap.urls.push(Url { + loc: "https://edgarluque.com/blog/test&id=''", + changefreq: Some(ChangeFreq::Never), + priority: Some(0.5), + lastmod: Some( + Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), + ), + }); + let result = sitemap.into_str(); println!("{}", result); } diff --git a/src/lib.rs b/src/lib.rs index e41ffa1..559dcbb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -240,6 +240,13 @@ mod tests { lastmod: None, }); + sitemap.urls.push(Url { + loc: "https://domain.com/bb&id=''", + changefreq: None, + priority: None, + lastmod: None, + }); + sitemap.into_str(); }