Project

General

Profile

Defect #1456 ยป wiki_formatting_links.patch

Wiki links patch - Pierre Paysant-Le Roux, 2008-06-16 00:05

View differences:

lib/redmine/wiki_formatting.rb (working copy)
152 152
          end
153 153
        end
154 154
      end
155
      
155

  
156 156
      # Turns all email addresses into clickable links (code from Rails).
157 157
      def inline_auto_mailto(text)
158 158
        text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
159
          text = $1
160
          %{<a href="mailto:#{$1}" class="email">#{text}</a>}
159
          mail = $1
160
          if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
161
            mail
162
          else
163
            %{<a href="mailto:#{mail}" class="email">#{mail}</a>}
164
          end
161 165
        end
162 166
      end
163 167
    end
    (1-1/1)