Extract ``@file:path`` references from message text. Returns ------- (cleaned_text, list_of_paths) *cleaned_text* has the ``@file:...`` tokens removed.
(text: str)
| 340 | |
| 341 | |
| 342 | def parse_inline_refs(text: str) -> tuple[str, list[str]]: |
| 343 | """Extract ``@file:path`` references from message text. |
| 344 | |
| 345 | Returns |
| 346 | ------- |
| 347 | (cleaned_text, list_of_paths) |
| 348 | *cleaned_text* has the ``@file:...`` tokens removed. |
| 349 | """ |
| 350 | paths = _INLINE_REF_RE.findall(text) |
| 351 | if not paths: |
| 352 | return text, [] |
| 353 | cleaned = _INLINE_REF_RE.sub("", text).strip() |
| 354 | # Collapse multiple spaces left by removal |
| 355 | cleaned = re.sub(r" +", " ", cleaned) |
| 356 | return cleaned, paths |
| 357 | |
| 358 | |
| 359 | # ------------------------------------------------------------------ # |
no outgoing calls