Merge regex patches and improve the regex again
authorJulien Valroff <julien@kirya.net>
Sat, 12 Jun 2010 13:59:56 +0000 (15:59 +0200)
committerJulien Valroff <julien@kirya.net>
Sat, 12 Jun 2010 13:59:56 +0000 (15:59 +0200)
debian/patches/003_fix-search-regex.diff [deleted file]
debian/patches/003_improve-regex.diff [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/003_fix-search-regex.diff b/debian/patches/003_fix-search-regex.diff
deleted file mode 100644 (file)
index 06c8e88..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-Description: Fix regex for search/tags
-Author: Julien Valroff <julien@kirya.net>
-Bug: http://code.google.com/p/pino-twitter/issues/detail?id=141
-Forwarded: yes
-
---- a/src/template.vala
-+++ b/src/template.vala
-@@ -60,7 +60,7 @@
-               
-               //compile regex
-               nicks = new Regex("(^|\\s)@([A-Za-z0-9_]+)");
--              tags = new Regex("((^|\\s)\\#[A-Za-z0-9_\\p{Latin}\\p{Greek}]+)");
-+              tags = new Regex("(^|\\s|'|\\()#([A-Za-z0-9_.-\\p{Latin}\\p{Greek}]+)");
-               groups = new Regex("(^|\\s)!([A-Za-z0-9_]+)"); //for identi.ca groups
-               urls = new Regex("((http|https|ftp)://([\\S]+))"); //need something better
-               
-@@ -400,7 +400,7 @@
-               }
-               
-               result = nicks.replace(result, -1, 0, "\\1@<a class='re_nick' href='userinfo://\\2'>\\2</a>");
--              result = tags.replace(result, -1, 0, "<a class='tags' href='%s\\1'>\\1</a>".printf(search_url));
-+              result = tags.replace(result, -1, 0, "\\1#<a class='tags' href='%s\\2'>\\2</a>".printf(search_url));
-               
-               if(service == "identi.ca") //for identi.ca only
-                       result = groups.replace(result, -1, 0, "\\1!<a class='tags' href='http://identi.ca/group/\\2'>\\2</a>");
diff --git a/debian/patches/003_improve-regex.diff b/debian/patches/003_improve-regex.diff
new file mode 100644 (file)
index 0000000..476925c
--- /dev/null
@@ -0,0 +1,29 @@
+Description: Fix regex for search/tags
+Author: Julien Valroff <julien@kirya.net>
+Bug: http://code.google.com/p/pino-twitter/issues/detail?id=141
+Forwarded: yes
+
+--- a/src/template.vala
++++ b/src/template.vala
+@@ -60,9 +60,9 @@
+               
+               //compile regex
+               nicks = new Regex("(^|\\s)@([A-Za-z0-9_]+)");
+-              tags = new Regex("((^|\\s)\\#[A-Za-z0-9_\\p{Latin}\\p{Greek}]+)");
+-              groups = new Regex("(^|\\s)!([A-Za-z0-9_]+)"); //for identi.ca groups
+-              urls = new Regex("((http|https|ftp)://([\\S]+))"); //need something better
++              tags = new Regex("(^|\\s|['+&!\\(-])#([A-Za-z0-9_.-\\p{Latin}\\p{Greek}]+)");
++              groups = new Regex("(^|\\s|['+&!\\(-])!([A-Za-z0-9_]+)"); //for identi.ca groups
++              urls = new Regex("((https?|ftp)://([A-Za-z0-9+&@#/%?=~_|!:,.;-]*)([A-Za-z0-9+&@#/%=~_|$]))"); // still needs to be improved for urls containing () such as wikipedia's
+               
+               // characters must be cleared to know direction of text
+               clear_notice = new Regex("[: \n\t\r♻♺]+|@[^ ]+");
+@@ -400,7 +400,7 @@
+               }
+               
+               result = nicks.replace(result, -1, 0, "\\1@<a class='re_nick' href='userinfo://\\2'>\\2</a>");
+-              result = tags.replace(result, -1, 0, "<a class='tags' href='%s\\1'>\\1</a>".printf(search_url));
++              result = tags.replace(result, -1, 0, "\\1#<a class='tags' href='%s\\2'>\\2</a>".printf(search_url));
+               
+               if(service == "identi.ca") //for identi.ca only
+                       result = groups.replace(result, -1, 0, "\\1!<a class='tags' href='http://identi.ca/group/\\2'>\\2</a>");
index e948d4d..d45d597 100644 (file)
@@ -1,7 +1,5 @@
 001_sec-accounts-file.diff
 002_identica-tags.diff
-003_fix-search-regex.diff
+003_improve-regex.diff
 004_allow-current-user-info.diff
 005_startup-notify.diff
-006_improve-url-regex.diff
-007_improve-group-regex.diff