1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-11 19:53:07 +00:00

added support for links [[page name|displayed text]]

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@296 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-03-04 15:42:16 +00:00
parent eb60359dbe
commit f14e2db66b

View File

@ -94,7 +94,7 @@ module ApplicationHelper
def textilizable(text)
# turn wiki links in textile links: "text":url
text = text.gsub(/\[\[([^\]]+)\]\]/) {|m| "\"#{$1}\":/wiki/#{@project.id}/#{Wiki.titleize($1)}" } if @project
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":/wiki/#{@project.id}/#{Wiki.titleize($1)}" } if @project
text = (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") ? auto_link(RedCloth.new(text, [:filter_html]).to_html) : simple_format(auto_link(h(text)))
# turn "#id" patterns into links to issues
text = text.gsub(/#(\d+)([^;\d])/, "<a href='/issues/show/\\1'>#\\1</a>\\2")