From bb0ffb83cbd0dc7f8849ae9ec6f3b2e50fa332a7 Mon Sep 17 00:00:00 2001 From: zhengxie Date: Sat, 6 Apr 2013 12:06:47 +0800 Subject: [PATCH] Added page link alias --- group/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/group/views.py b/group/views.py index ad8635fb57..05ace87920 100644 --- a/group/views.py +++ b/group/views.py @@ -1190,13 +1190,17 @@ def convert_wiki_link(content, group, repo_id, username): filetype, fileext = get_file_type_and_ext(page_name) if fileext == '': # convert page_name that extension is missing to a markdown page + page_alias = page_name + if len(page_name.split('|')) > 1: + page_alias = page_name.split('|')[0] + page_name = page_name.split('|')[1] dirent = get_wiki_dirent(repo_id, page_name) if dirent is not None: a_tag = "%s" - return a_tag % (reverse('group_wiki', args=[group.id, normalize_page_name(page_name)]), page_name) + return a_tag % (reverse('group_wiki', args=[group.id, normalize_page_name(page_name)]), page_alias) else: a_tag = '''%s''' - return a_tag % (reverse('group_wiki', args=[group.id, page_name.replace('/', '-')]), page_name) + return a_tag % (reverse('group_wiki', args=[group.id, page_name.replace('/', '-')]), page_alias) elif filetype == IMAGE: # load image to wiki page path = "/" + page_name