Skip to content

Instantly share code, notes, and snippets.

@pschwede
Created January 11, 2011 13:29
Show Gist options
  • Save pschwede/774408 to your computer and use it in GitHub Desktop.
Save pschwede/774408 to your computer and use it in GitHub Desktop.
Patch for dodo/blain
From 4277c9ea35efd406b9c4cbe0ed3526dacb4f6fc6 Mon Sep 17 00:00:00 2001
From: spazz spz pp2 <a@b.c>
Date: Tue, 11 Jan 2011 14:21:26 +0100
Subject: [PATCH 1/2] Support commas in URL
---
inc/parse.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/inc/parse.py b/inc/parse.py
index 02d49d7..612d023 100644
--- a/inc/parse.py
+++ b/inc/parse.py
@@ -45,7 +45,7 @@ def patchStyleSheet(stylesheet, **kwargs):
months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")
rex = {
- 'url': r'(?<!"|\()((https?|ftp|gopher|file)://(\w|\.|/|\(|\)|\?|=|%|&|:|#|_|-|~|\+)+)',
+ 'url': r'(?<!"|\()((https?|ftp|gopher|file)://(\w|\.|/|\(|\)|\?|=|%|&|:|#|_|-|~|,|\+)+)',
'person': r'@(\w+)',
'hashtag': r'#(\w+)',
'group': r'!(\w+)'
--
1.7.1
From ca3c1a5d6584e25f58991a194b8ecc1aff12c8be Mon Sep 17 00:00:00 2001
From: spazz spz pp2 <a@b.c>
Date: Tue, 11 Jan 2011 14:48:49 +0100
Subject: [PATCH 2/2] Small regex cleanup
---
inc/parse.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/inc/parse.py b/inc/parse.py
index 612d023..128542e 100644
--- a/inc/parse.py
+++ b/inc/parse.py
@@ -45,7 +45,7 @@ def patchStyleSheet(stylesheet, **kwargs):
months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")
rex = {
- 'url': r'(?<!"|\()((https?|ftp|gopher|file)://(\w|\.|/|\(|\)|\?|=|%|&|:|#|_|-|~|,|\+)+)',
+ 'url': r'(?<!"|\()(https?|ftp|gopher|file)://[\w\./\(\)\?=%&:#_-~,\+]+',
'person': r'@(\w+)',
'hashtag': r'#(\w+)',
'group': r'!(\w+)'
--
1.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment