Project

General

Profile

Actions

Patch #6096

open

Highlighting Skype links in wiki

Added by Michail Svarichevsky over 14 years ago. Updated over 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
2010-08-10
Due date:
% Done:

0%

Estimated time:

Description

I've implemented this for my 1.0 redmine, and it is very useful for team list thing.

Work like this:

skypei:michail_31415

Gets converted to:

 <a href="skype:michail_31415?chat"><img src="http://mystatus.skype.com/smallclassic/michail_31415" style="border: none; width:114px;height:20px;"></img></a>

Patch included:

/lib/redmine/wiki_formatting/textile/

Index: formatter.rb
===================================================================
--- formatter.rb        (revision 3918)
+++ formatter.rb        (working copy)
@@ -24,7 +24,7 @@
         include ActionView::Helpers::TagHelper

         # auto_link rule after textile rules so that it doesn't break !image_url! tags
-        RULES = [:textile, :block_markdown_rule, :inline_auto_link, :inline_auto_mailto, :inline_toc]
+        RULES = [:textile, :block_markdown_rule, :inline_auto_link, :inline_auto_mailto, :inline_auto_skype, :inline_toc]

         def initialize(*args)
           super

@@ -157,6 +157,16 @@
             end
           end
         end
+
+        # Turns all skype addresses into clickable links which starts chat automagically
+        def inline_auto_skype(text)
+          text.gsub!(/skypei:([a-zA-Z0-9_\.-]+)/) do
+            all, skype = $&, $1
+            # This would not match after replacement
+            content_tag('a', content_tag('img', "", :src => "http://mystatus.skype.com/smallclassic/" + skype, :style => "border: none; width:114px;height:20px;"), :href => "skype:" + skype + "?chat")
+          end
+        end
+
       end
     end
   end
Actions

Also available in: Atom PDF