mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-28 10:11:53 +00:00
fixing accented names
This commit is contained in:
parent
99566fe519
commit
3525095691
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
@ -28,12 +28,25 @@ def troggle_slugify(longname):
|
|||||||
This function copied instact from troggle/parsers/people/py
|
This function copied instact from troggle/parsers/people/py
|
||||||
"""
|
"""
|
||||||
slug = longname.strip().lower().replace(" ","-")
|
slug = longname.strip().lower().replace(" ","-")
|
||||||
|
slug = re.sub('\([^\)]*\)','',slug) # remove nickname in brackets
|
||||||
|
slug = slug.replace('é', 'e')
|
||||||
|
slug = slug.replace('á', 'a')
|
||||||
|
slug = slug.replace('ä', 'a')
|
||||||
|
slug = slug.replace('&', '') # otherwise just remove the &
|
||||||
|
slug = slug.replace(';', '') # otherwise just remove the ;
|
||||||
|
slug = re.sub('<[^>]*>','',slug) # remove <span-lang = "hu">
|
||||||
|
|
||||||
if len(slug) > 40: # slugfield is 50 chars
|
if len(slug) > 40: # slugfield is 50 chars
|
||||||
slug = slug[:40]
|
slug = slug[:40]
|
||||||
if slug in slug_cache:
|
if slug in slug_cache:
|
||||||
slug_cache[slug] += 1
|
slug_cache[slug] += 1
|
||||||
slug = f"{slug}_{slug_cache[slug]}"
|
slug = f"{slug}_{slug_cache[slug]}"
|
||||||
slug_cache[slug] = 1
|
slug_cache[slug] = 1
|
||||||
|
|
||||||
|
# t = longname.find("&")
|
||||||
|
# s = longname.find(">")
|
||||||
|
# if t > -1 or s > -1:
|
||||||
|
# sys.stderr.write(f"{t}-{s} '{longname}' {slug}\n")
|
||||||
return slug
|
return slug
|
||||||
|
|
||||||
for r in lines[1:]:
|
for r in lines[1:]:
|
||||||
@ -57,20 +70,16 @@ for r in lines[1:]:
|
|||||||
output += '<tr><td>'
|
output += '<tr><td>'
|
||||||
if expos_caving == 0: output += '<span class="didntcave">'
|
if expos_caving == 0: output += '<span class="didntcave">'
|
||||||
|
|
||||||
# Middle names still not working: MorvenBeranek-Stanley , Sarah Livia Zerbes
|
|
||||||
# Need to manage names e.g. <span lang=""sv"">Leif Hornsved (Nickname)</span> => LeifHornsved
|
# Need to manage names e.g. <span lang=""sv"">Leif Hornsved (Nickname)</span> => LeifHornsved
|
||||||
namevis = name.replace('""', '"').strip('"')
|
namevis = name.replace('""', '"').strip('"')
|
||||||
# Need to manage e.g.Olaf Kähler
|
# Need to manage e.g.Olaf Kähler
|
||||||
# Need to manage e.g. Bal%26aacute%3BzsIzapy
|
# Need to manage e.g. Bal%26aacute%3BzsIzapy
|
||||||
nameurl = namevis.replace(' ', '')
|
# nameurl = namevis.replace(' ', '')
|
||||||
nameurl = nameurl.replace('&', '%26')
|
# nameurl = nameurl.replace('&', '%26')
|
||||||
nameurl = nameurl.replace(';', '%3B')
|
# nameurl = nameurl.replace(';', '%3B')
|
||||||
nameurl = re.sub('<[^>]*>','',nameurl)
|
|
||||||
nameurl = re.sub('\([^\)]*\)','',nameurl) # mostly not needed, but is for Wookey
|
|
||||||
|
|
||||||
# new url using slug
|
# new url using slug
|
||||||
nameurl = re.sub('\([^\)]*\)','',name)
|
nameurl = troggle_slugify(namevis)
|
||||||
nameurl = troggle_slugify(nameurl)
|
|
||||||
namelink= "<a href='/person/" + nameurl + "'>" + namevis + "</a>"
|
namelink= "<a href='/person/" + nameurl + "'>" + namevis + "</a>"
|
||||||
output += namelink
|
output += namelink
|
||||||
#output += name.replace('""', '"')
|
#output += name.replace('""', '"')
|
||||||
|
Loading…
Reference in New Issue
Block a user