allow utf8 in page names

このコミットが含まれているのは:
Matthew Scragg 2015-12-08 17:15:11 -06:00
コミット e3508e365f
2個のファイルの変更11行の追加7行の削除

ファイルの表示

@ -86,14 +86,18 @@ def to_canonical(s):
Double space -> single dash
Double dash -> single dash
Remove all non alphanumeric and dash
Limit to first 64 chars
Limit to first 128 chars
"""
s = s.encode('ascii', 'ignore')
reserved_chars = "&$+,/:;=?@#"
unsafe_chars = "?<>[]{}|\^~%"
s = s.encode('utf8')
s = str(s)
s = re.sub(r"\s\s*", "-", s)
s = re.sub(r"\-\-+", "-", s)
s = re.sub(r"[^a-zA-Z0-9\-]", "", s)
s = s[:64]
s = s.strip()
s = re.sub(r"\s", "-", s)
s = re.sub(r"[" + re.escape(reserved_chars) + "]", "", s)
s = re.sub(r"[" + re.escape(unsafe_chars) + "]", "", s)
s = s[:128]
return s

ファイルの表示

@ -183,7 +183,7 @@ class Wiki(HookMixin):
return cached
# commit = gittle.utils.git.commit_info(self.repo[sha])
filename = cname_to_filename(name).encode('latin-1')
filename = cname_to_filename(name).encode('utf8')
sha = sha.encode('latin-1')
try: