define(['app','lodash'], function(app,_) {
    'use strict';
    app.filter("uriToLink", function() {
      var  //URLs starting with http://, https://, or ftp://
     replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim,
     //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
     replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim,
     //Change email addresses to mailto:: links.
     replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;

     return function(text) {
         _.each(_.uniq(text.match(replacePattern1)), function(item) {
           text = replaceAll(text,item,"<a href=\"http://"+item+"\" target=\"_blank\">"+item+"</a>");
         });

         _.each(_.uniq(text.match(replacePattern2)), function(item) {
            text = replaceAll(text,item,"<a href=\"http://"+item+"\" target=\"_blank\">"+item+"</a>");
         });

         _.each(_.uniq(text.match(replacePattern3)), function(item) {
            text = text.replace(item, '<a href="mailto:'+item+'">'+item+'</a>');
         });
         return text;
     };
    });
    function replaceAll(string,item,replacement) {

        return string.split(item).reduce(function(prev, curr, index) {
            if (index === 0) return curr;
            else return prev + replacement + curr;
        }, '');

    }
});
@@ -110,155 +110,8 @@
 ar  
-//URLs starting with http://, https://, or ftp://%0A     replacePattern1 = /(%5Cb(https?%7Cftp):%5C/%5C/%5B-A-Z0-9+&@#%5C/%25?=~_%7C!:,.;%5D*%5B-A-Z0-9+&@#%5C/%25=~_%7C%5D)/gim,
 %0A   
@@ -399,25 +399,25 @@
 text) %7B%0A
- 
+%0A
         
 _.each(_
@@ -412,181 +412,92 @@
     
-_.each(_.uniq(text.match(replacePattern1)), function(item) %7B%0A           text = replaceAll(text,item,%22%3Ca href=%5C%22http://%22+item+%22%5C%22 target=%5C%22_blank%5C%22%3E%22+item+%22%3C/a%3E%22);%0A         %7D
+text = replaceAll(text,'https://',' ');%0A        text = replaceAll(text,'http://',' '
 );%0A%0A
@@ -558,32 +558,33 @@
 unction(item) %7B%0A
+%0A
             text
@@ -606,16 +606,23 @@
 ext,item
+.trim()
 ,%22%3Ca hre
@@ -638,16 +638,23 @@
 //%22+item
+.trim()
 +%22%5C%22 tar

fix linker