mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-30 13:23:14 +00:00
Added page link alias
This commit is contained in:
parent
9b29fbdb6b
commit
bb0ffb83cb
@ -1190,13 +1190,17 @@ def convert_wiki_link(content, group, repo_id, username):
|
|||||||
filetype, fileext = get_file_type_and_ext(page_name)
|
filetype, fileext = get_file_type_and_ext(page_name)
|
||||||
if fileext == '':
|
if fileext == '':
|
||||||
# convert page_name that extension is missing to a markdown page
|
# 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)
|
dirent = get_wiki_dirent(repo_id, page_name)
|
||||||
if dirent is not None:
|
if dirent is not None:
|
||||||
a_tag = "<a href='%s'>%s</a>"
|
a_tag = "<a href='%s'>%s</a>"
|
||||||
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:
|
else:
|
||||||
a_tag = '''<a class="wiki-page-missing" href='%s'>%s</a>'''
|
a_tag = '''<a class="wiki-page-missing" href='%s'>%s</a>'''
|
||||||
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:
|
elif filetype == IMAGE:
|
||||||
# load image to wiki page
|
# load image to wiki page
|
||||||
path = "/" + page_name
|
path = "/" + page_name
|
||||||
|
Loading…
Reference in New Issue
Block a user