From 80c681294ca12b17e399054e98930ab82fd2554a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 17 Jan 2013 13:24:51 +0530 Subject: [PATCH] fixes in website page naming --- website/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/website/utils.py b/website/utils.py index 4dafd08c05..6963b76f5a 100644 --- a/website/utils.py +++ b/website/utils.py @@ -97,7 +97,14 @@ def page_name(title): import re name = title.lower() name = re.sub('[~!@#$%^&*()<>,."\']', '', name) - return '-'.join(name.split()) + name = re.sub('[:/]', '-', name) + + name = '-'.join(name.split()) + + # replace repeating hyphens + name = re.sub(r"(-)\1+", r"\1", name) + + return name def update_page_name(doc, title): """set page_name and check if it is unique"""