Fix titles join in path

This commit is contained in:
Zoe Roux 2024-04-30 19:25:09 +02:00
parent f67a7b4fd4
commit e0923807c6
No known key found for this signature in database

View File

@ -54,10 +54,13 @@ class UnlistTitles(Rule):
consequence = [RemoveMatch, AppendMatch]
def when(self, matches: Matches, context) -> Any:
titles: List[Match] = matches.named("title", lambda x: x.tagged("title")) # type: ignore
fileparts: List[Match] = matches.markers.named("path") # type: ignore
for part in fileparts:
titles: List[Match] = matches.range(part.start, part.end, lambda x: x.name == "title") # type: ignore
if not titles or len(titles) <= 1:
return
continue
title = copy(titles[0])
for nmatch in titles[1:]: