mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 08:15:29 +00:00
Extract score writer changes from SoundCraft 4bdda5ff
This commit is contained in:
1 parent
bfef2e5ce2
commit
160907a80e
1 file changed
+4
-7
@@ -53,13 +53,10 @@ fn spell(pitch: u8) -> (char, i32, i32) {
|
||||
}
|
||||
|
||||
fn xml_escape(s: &str) -> String {
|
||||
s.chars()
|
||||
.filter(|c| matches!(c, '\t' | '\n' | '\r' | '\u{20}'..='\u{D7FF}' | '\u{E000}'..='\u{FFFD}' | '\u{10000}'..='\u{10FFFF}'))
|
||||
.collect::<String>()
|
||||
.replace('&', "&")
|
||||
.replace('<', "<")
|
||||
.replace('>', ">")
|
||||
.replace('"', """)
|
||||
// Keep the score export's existing literal whitespace and quote spelling. The
|
||||
// shared attribute writer owns XML legality/escaping; only its generated
|
||||
// whitespace references are restored (input ampersands were escaped first).
|
||||
craft_xml::esc_attr(s).replace("	", "\t").replace(" ", "\n").replace(" ", "\r")
|
||||
}
|
||||
|
||||
fn note_type(units: u32) -> (&'static str, bool) {
|
||||
|
||||
Reference in new issue
Block a user