X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fquery%2Fvendor%2Fcouchapp%2Flib%2Flinkup.js;fp=web%2Fquery%2Fvendor%2Fcouchapp%2Flib%2Flinkup.js;h=4b1d5a607340c05074d97d30a0eaa1432ab18eed;hp=0000000000000000000000000000000000000000;hb=85070b3d456667f238051af1a2f1f2a0c12300ab;hpb=607f0e13927eb18075c375fa9ba5527da4fcbb44
diff --git a/web/query/vendor/couchapp/lib/linkup.js b/web/query/vendor/couchapp/lib/linkup.js
new file mode 100644
index 0000000..4b1d5a6
--- /dev/null
+++ b/web/query/vendor/couchapp/lib/linkup.js
@@ -0,0 +1,18 @@
+// this code makes http://example.com into a link,
+// and also handles @name and #hashtag
+
+// todo add [[wiki_links]]
+
+var mustache = require("vendor/couchapp/lib/mustache");
+exports.encode = function(body, person_prefix, tag_prefix) {
+ body = mustache.escape(body);
+ person_prefix = person_prefix || "http://twitter.com/";
+ tag_prefix = tag_prefix || "http://delicious.com/tag/";
+ return body.replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,function(a) {
+ return ''+a+'';
+ }).replace(/\@([\w\-]+)/g,function(user,name) {
+ return ''+user+'';
+ }).replace(/\#([\w\-\.]+)/g,function(word,tag) {
+ return ''+word+'';
+ });
+};
\ No newline at end of file