##// END OF EJS Templates
Small change to ApplicationHelper#textilizable to allow links to other wikis main page with custom text (eg. project:|mytext)....
Jean-Philippe Lang -
r647:d1780270da6b
parent child
Show More
@@ -147,6 +147,7 module ApplicationHelper
147 # [[mypage|mytext]]
147 # [[mypage|mytext]]
148 # wiki links can refer other project wikis, using project name or identifier:
148 # wiki links can refer other project wikis, using project name or identifier:
149 # [[project:]] -> wiki starting page
149 # [[project:]] -> wiki starting page
150 # [[project:|mytext]]
150 # [[project:mypage]]
151 # [[project:mypage]]
151 # [[project:mypage|mytext]]
152 # [[project:mypage|mytext]]
152 text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m|
153 text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m|
@@ -155,7 +156,7 module ApplicationHelper
155 title = $3
156 title = $3
156 if page =~ /^([^\:]+)\:(.*)$/
157 if page =~ /^([^\:]+)\:(.*)$/
157 link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
158 link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
158 page = $2
159 page = title || $2
159 title = $1 if page.blank?
160 title = $1 if page.blank?
160 end
161 end
161 link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page')
162 link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page')
General Comments 0
You need to be logged in to leave comments. Login now