Small change to ApplicationHelper#textilizable to allow links to other wikis main page with custom text (eg. project:|mytext).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@653 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-08-17 12:06:50 +00:00
parent 00238738b1
commit d1780270da
1 changed files with 2 additions and 1 deletions

View File

@ -147,6 +147,7 @@ module ApplicationHelper
# [[mypage|mytext]] # [[mypage|mytext]]
# wiki links can refer other project wikis, using project name or identifier: # wiki links can refer other project wikis, using project name or identifier:
# [[project:]] -> wiki starting page # [[project:]] -> wiki starting page
# [[project:|mytext]]
# [[project:mypage]] # [[project:mypage]]
# [[project:mypage|mytext]] # [[project:mypage|mytext]]
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m| text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m|
@ -155,7 +156,7 @@ module ApplicationHelper
title = $3 title = $3
if page =~ /^([^\:]+)\:(.*)$/ if page =~ /^([^\:]+)\:(.*)$/
link_project = Project.find_by_name($1) || Project.find_by_identifier($1) link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
page = $2 page = title || $2
title = $1 if page.blank? title = $1 if page.blank?
end end
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page') link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page')