Mercurial > wikked
changeset 65:c6dcf6716d26
Fixed slugification bug on Windows.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 08 Feb 2013 15:20:08 -0800 |
parents | 0b4f4c23770a |
children | 16e7d101cf53 |
files | wikked/fs.py wikked/page.py |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/wikked/fs.py Thu Feb 07 22:34:13 2013 -0800 +++ b/wikked/fs.py Fri Feb 08 15:20:08 2013 -0800 @@ -91,7 +91,13 @@ return None if self.page_extensions is not None and ext not in self.page_extensions: return None - url = self.slugify(name) + + url = '' + parts = unicode(name).lower().split(os.sep) + for i, part in enumerate(parts): + if i > 0: + url += '/' + url += self.slugify(part) return { 'url': url, 'path': path
--- a/wikked/page.py Thu Feb 07 22:34:13 2013 -0800 +++ b/wikked/page.py Fri Feb 08 15:20:08 2013 -0800 @@ -151,7 +151,7 @@ unicodedata.normalize('NFD', unicode(title)) if unicodedata.category(c) != 'Mn')) # Now replace spaces and punctuation with a hyphen. - return re.sub(r'[^A-Za-z0-9_\.\-\(\)/]+', '-', ansi_title.lower()) + return re.sub(r'[^A-Za-z0-9_\.\-\(\)]+', '-', ansi_title.lower()) @staticmethod def url_to_title(url):