|
@@
-142,17
+142,17
module ApplicationHelper
|
|
142
|
# example:
|
|
142
|
# example:
|
|
143
|
# [[link]] -> "link":link
|
|
143
|
# [[link]] -> "link":link
|
|
144
|
# [[link|title]] -> "title":link
|
|
144
|
# [[link|title]] -> "title":link
|
|
145
|
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) }
|
|
145
|
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| link_to(($3 || $1), format_wiki_link.call(Wiki.titleize($1)), :class => 'wiki-page') }
|
|
146
|
|
|
146
|
|
|
147
|
# turn issue ids into links
|
|
147
|
# turn issue ids into links
|
|
148
|
# example:
|
|
148
|
# example:
|
|
149
|
# #52 -> <a href="/issues/show/52">#52</a>
|
|
149
|
# #52 -> <a href="/issues/show/52">#52</a>
|
|
150
|
text = text.gsub(/#(\d+)(?=\b)/) {|m| link_to "##{$1}", :controller => 'issues', :action => 'show', :id => $1}
|
|
150
|
text = text.gsub(/#(\d+)(?=\b)/) {|m| link_to "##{$1}", {:controller => 'issues', :action => 'show', :id => $1}, :class => 'issue' }
|
|
151
|
|
|
151
|
|
|
152
|
# turn revision ids into links (@project needed)
|
|
152
|
# turn revision ids into links (@project needed)
|
|
153
|
# example:
|
|
153
|
# example:
|
|
154
|
# r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (@project.id is 6)
|
|
154
|
# r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (@project.id is 6)
|
|
155
|
text = text.gsub(/(?=\b)r(\d+)(?=\b)/) {|m| link_to "r#{$1}", :controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1} if @project
|
|
155
|
text = text.gsub(/(?=\b)r(\d+)(?=\b)/) {|m| link_to "r#{$1}", {:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1}, :class => 'changeset' } if @project
|
|
156
|
|
|
156
|
|
|
157
|
# when using an image link, try to use an attachment, if possible
|
|
157
|
# when using an image link, try to use an attachment, if possible
|
|
158
|
attachments = options[:attachments]
|
|
158
|
attachments = options[:attachments]
|