fix trailing hyphen

This commit is contained in:
Philip Sargent 2024-04-21 00:47:05 +01:00
parent 89a8ddb670
commit 0c2b5e095f

View File

@ -35,6 +35,7 @@ def troggle_slugify(longname):
slug = slug.replace('&', '') # otherwise just remove the & slug = slug.replace('&', '') # otherwise just remove the &
slug = slug.replace(';', '') # otherwise just remove the ; slug = slug.replace(';', '') # otherwise just remove the ;
slug = re.sub(r'<[^>]*>','',slug) # remove <span-lang = "hu"> slug = re.sub(r'<[^>]*>','',slug) # remove <span-lang = "hu">
slug=slug.strip("-") # remove spare hyphens
if len(slug) > 40: # slugfield is 50 chars if len(slug) > 40: # slugfield is 50 chars
slug = slug[:40] slug = slug[:40]