fix: read a source_ref role per part, prose too

The role a part writes (source or upstream) was kept per path, first
met first kept, so a later part naming the other role was read in the
other repository. In prose the word source made a citation external
and the word upstream was dropped. The role now travels on each part.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 05:14:47 +02:00
1 parent 348c56e94c
commit 64b2967ffb
4 files changed
+201 -27

No files matched your search

+4
View File
@@ -261,6 +261,10 @@ def link_prose_citations(profile: dict, text: str) -> str:
continue
if "/" not in path and path not in structured:
continue
role = parts[0].role
if role and (role_sources(profile).get(role) or (None,))[0] != repo:
# `upstream a.c:5` names a repository this link would not reach.
continue
if any(lo <= path_span[0] < hi for lo, hi in guarded):
continue
for index, ((lo, hi), part) in enumerate(zip(spans, parts)):