MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_leaf

Function parse_leaf

atomic-canonical/src/directive.rs:112–131  ·  view source on GitHub ↗
(line: &str)

Source from the content-addressed store, hash-verified

110}
111
112fn parse_leaf(line: &str) -> Result<Option<Directive>> {
113 let rest = match line.trim().strip_prefix("::") {
114 Some(r) => r,
115 None => return Ok(None),
116 };
117 let (name, attrs_src) = split_name_attrs(rest);
118 if name.is_empty() {
119 return Ok(None);
120 }
121 check_known(&name)?;
122 let (id, attrs) = parse_attrs(attrs_src)?;
123 Ok(Some(Directive {
124 name,
125 id,
126 attrs,
127 body: String::new(),
128 label: None,
129 children: Vec::new(),
130 }))
131}
132
133/// Extract inline directives (`:name[label]{attrs}`) from running prose.
134///

Callers 1

parseFunction · 0.85

Calls 4

split_name_attrsFunction · 0.85
check_knownFunction · 0.85
parse_attrsFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected