Split "name{attrs}" (or "name") into (name, attrs-source-without-braces).
(s: &str)
| 295 | |
| 296 | /// Split "name{attrs}" (or "name") into (name, attrs-source-without-braces). |
| 297 | fn split_name_attrs(s: &str) -> (String, &str) { |
| 298 | let s = s.trim(); |
| 299 | if let Some(open) = s.find('{') { |
| 300 | let name = s[..open].trim().to_string(); |
| 301 | let attrs = if let Some(close) = s.rfind('}') { |
| 302 | &s[open + 1..close] |
| 303 | } else { |
| 304 | &s[open + 1..] |
| 305 | }; |
| 306 | (name, attrs) |
| 307 | } else { |
| 308 | (s.to_string(), "") |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | /// Parse `#id key=value key2="quoted value"` into (id, attrs). |
| 313 | fn parse_attrs(src: &str) -> Result<(Option<String>, BTreeMap<String, String>)> { |
no outgoing calls
no test coverage detected