mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 11:27:19 +00:00
fixing accented names
This commit is contained in:
@@ -65,14 +65,24 @@ def parse_blurb(personline, header, person):
|
|||||||
slug_cache = {}
|
slug_cache = {}
|
||||||
def troggle_slugify(longname):
|
def troggle_slugify(longname):
|
||||||
"""Uniqueness enforcement too. Yes we have had two "Dave Johnson"s
|
"""Uniqueness enforcement too. Yes we have had two "Dave Johnson"s
|
||||||
|
This function copied intact to expoweb/scripts/make-folklist.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
|
||||||
|
|
||||||
return slug
|
return slug
|
||||||
|
|
||||||
def load_people_expos():
|
def load_people_expos():
|
||||||
@@ -99,8 +109,9 @@ def load_people_expos():
|
|||||||
print(" - Loading personexpeditions")
|
print(" - Loading personexpeditions")
|
||||||
|
|
||||||
for personline in personreader:
|
for personline in personreader:
|
||||||
|
# This is all horrible: refactor it.
|
||||||
name = personline[header["Name"]]
|
name = personline[header["Name"]]
|
||||||
name = re.sub(r"<.*?>", "", name)
|
plainname = re.sub(r"<.*?>", "", name) # now in slugify
|
||||||
|
|
||||||
match = re.match(r"^([^(]*)(\(([^)]*)\))?", name) # removes nickname in brackets
|
match = re.match(r"^([^(]*)(\(([^)]*)\))?", name) # removes nickname in brackets
|
||||||
displayname = match.group(1)
|
displayname = match.group(1)
|
||||||
@@ -113,7 +124,7 @@ def load_people_expos():
|
|||||||
matchlastname = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname)
|
matchlastname = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname)
|
||||||
lastname = matchlastname.group(1).strip()
|
lastname = matchlastname.group(1).strip()
|
||||||
|
|
||||||
splitnick = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", name)
|
splitnick = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", plainname)
|
||||||
fullname = splitnick.group(1) # removes Nickname in brackets, but also cuts hyphenated names
|
fullname = splitnick.group(1) # removes Nickname in brackets, but also cuts hyphenated names
|
||||||
nick = splitnick.group(2) or ""
|
nick = splitnick.group(2) or ""
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<h3>Surveys done</h3>
|
<h3>Surveys done</h3>
|
||||||
Wallets and surveys mentioning <a href="/wallets/person/{{person}}">{{person.fullname}}</a><br>
|
Wallets and surveys mentioning <a href="/wallets/person/{{person}}">{{person.fullname|safe}}</a><br>
|
||||||
|
|
||||||
{% if person.blurb %}
|
{% if person.blurb %}
|
||||||
{{person.blurb|safe}}
|
{{person.blurb|safe}}
|
||||||
|
|||||||
Reference in New Issue
Block a user