mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-24 10:37:03 -06:00
Merge pull request #1064 from Silvertree2010/fix/h848-xml-text-escaping-writes-carriag
This commit is contained in:
@@ -367,6 +367,7 @@ pub fn esc(s: &str) -> String {
|
||||
'&' => o.push_str("&"),
|
||||
'<' => o.push_str("<"),
|
||||
'>' => o.push_str(">"),
|
||||
'\r' => o.push_str(" "),
|
||||
c if xml_char(c) => o.push(c),
|
||||
_ => {}
|
||||
}
|
||||
@@ -506,6 +507,15 @@ mod tests {
|
||||
assert_eq!(t, vec!["one\ntwo\nthree\rfour".to_string(), "x\ny".to_string()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cr_in_text_survives_write_read() {
|
||||
assert_eq!(esc("a\rb"), "a b");
|
||||
let mut w = W::default();
|
||||
w.elt("a:t", "one\rtwo\r\nthree");
|
||||
let d = parse(w.s.as_bytes()).expect("parse");
|
||||
assert_eq!(d.root.text(), "one\rtwo\r\nthree");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_basic_and_entities() {
|
||||
let d = parse(b"<?xml version=\"1.0\"?><a:p xmlns:a=\"x\"><a:r><a:t>A & B A <</a:t></a:r><a:x r:id=\"rId1\" id=\"5\"/></a:p>")
|
||||
|
||||
Reference in New Issue
Block a user