(frontmatter_json: &str)
| 636 | } |
| 637 | |
| 638 | fn frontmatter_memory_id(frontmatter_json: &str) -> Option<String> { |
| 639 | let id = frontmatter_string(frontmatter_json, &["@id", "uid", "id"])?; |
| 640 | if id.starts_with("urn:atomic:") { |
| 641 | Some(id) |
| 642 | } else { |
| 643 | Some(format!("urn:atomic:memory:{id}")) |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | fn frontmatter_string(frontmatter_json: &str, keys: &[&str]) -> Option<String> { |
| 648 | let value = serde_json::from_str::<serde_json::Value>(frontmatter_json).ok()?; |
no test coverage detected