2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-18 11:57:13 +00:00

aliases twiddle

This commit is contained in:
2025-07-24 12:56:27 +02:00
parent bb74b95aaf
commit 8cf85ca5ef
2 changed files with 21 additions and 15 deletions

View File

@@ -664,7 +664,7 @@ def read_cave(filename, mvf=None, cave=None):
letter = "a"
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
#eurl = f"{cave.url}_cave_edit/"
eurl = Path(cave.url).parent + f"{cave.slug()}_cave_edit/"
eurl = Path(cave.url).parent / f"{cave.slug()}_cave_edit/"
# edit recognizer: (?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$
DataIssue.objects.create(parser="entrances", message=message, url=eurl)
print(message)

View File

@@ -339,22 +339,30 @@ def GetPersonExpeditionNameLookup(expedition):
"""
global Gpersonexpeditionnamelookup
def apply_variations(f, l):
def apply_initials(variations, a, l):
variations.append(a + l)
variations.append(a + " " + l)
variations.append(a + " " + l[0])
variations.append(a + l[0])
variations.append(a + " " + l[0] + ".")
variations.append(a[0] + " " + l)
variations.append(a[0] + ". " + l)
variations.append(a[0] + l)
variations.append(a[0] + l[0]) # initials e.g. gb or bl
return variations
def apply_variations(f, l, n=""):
"""Be generous in guessing possible matches. Any duplicates will be ruled as invalid."""
f = f.lower()
l = l.lower()
variations = []
variations.append(f)
variations.append(l)
variations.append(f + l)
variations.append(f + " " + l)
variations.append(f + " " + l[0])
variations.append(f + l[0])
variations.append(f + " " + l[0] + ".")
variations.append(f[0] + " " + l)
variations.append(f[0] + ". " + l)
variations.append(f[0] + l)
variations.append(f[0] + l[0]) # initials e.g. gb or bl
variations = apply_initials(variations, f, l)
if n:
variations.append(n)
variations = apply_initials(variations, n, f)
variations = apply_initials(variations, n, l)
return variations
res = Gpersonexpeditionnamelookup.get(expedition.name)
@@ -381,10 +389,8 @@ def GetPersonExpeditionNameLookup(expedition):
possnames.append(n)
if l:
possnames += apply_variations(f, l)
possnames += apply_variations(f, l, n)
if n:
possnames += apply_variations(n, l)
if f == "Adeleide".lower():
possnames += apply_variations("Adelaide", l)