fix: write prose and quoted refs as written

A folded run rewritten whole keeps its separators (boom3, mame), a
double-quoted source_ref is matched as the loader reads it and escaped on
write (etlegacy), two files sharing a name take their build mode in the
field path (supermodel Games.xml), and a project word ending the line
before a path marks the citation external (genesis_plus_gx_expanded).
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 17:23:01 +02:00
1 parent bfd82cedf8
commit 19f22da75f
3 files changed
+164 -7

No files matched your search

+9 -3
View File
@@ -392,13 +392,19 @@ def _prose_runs(
):
path_start -= 1
path = "." + path
role = _prose_role(line, path_start)
if not role and _prose_external(line, path_start, known):
# A path opening its line reads its role or project word at the
# end of the line before: genesis_plus_gx_expanded wrapped
# `(Batocera` and `package/batocera/...mk:7` one line apart.
lead = line[:path_start]
if number and not lead.strip():
lead = lines[number - 1].rstrip() + " "
role = _prose_role(lead, len(lead))
if not role and _prose_external(lead, len(lead), known):
# Kept with its project word, the source_ref convention: the
# report looks for the project inside the declared trees
# (mupen64plus-ae vendors `rice Config.cpp`) and calls the
# citation EXTERNAL only when none carries it.
before = line[:path_start].rstrip()
before = lead.rstrip()
word = before[max(before.rfind(" "), before.rfind("\t"),
before.rfind("(")) + 1:]
path = f"{word} {path}"