From eb8b8836455f34494b9092206fab5a28199e3f8c Mon Sep 17 00:00:00 2001
From: mutantmonkey
Date: Mon, 14 Feb 2011 18:51:13 -0500
Subject: [PATCH] archwiki: fix pages without tables
---
modules/archwiki.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/archwiki.py b/modules/archwiki.py
index 2d2287f..d482b26 100755
--- a/modules/archwiki.py
+++ b/modules/archwiki.py
@@ -18,7 +18,7 @@ wikisearch = 'https://wiki.archlinux.org/index.php/Special:Search?' \
+ 'search=%s&fulltext=Search'
r_tr = re.compile(r'(?ims)]*>.*?
')
-r_content = re.compile(r'(?ims).*?')
+r_content = re.compile(r'(?ims)
\n.*?')
r_paragraph = re.compile(r'(?ims)]*>.*?
|]*>.*?')
r_tag = re.compile(r'<(?!!)[^>]+>')
r_whitespace = re.compile(r'[\t\r\n ]+')
@@ -83,10 +83,10 @@ def archwiki(term, last=False):
# kind of hacky fix to deal with Arch wiki template, should be cleaned up a bit
content = r_content.findall(bytes)
- if content:
- paragraphs = r_paragraph.findall(content[0])
- else:
- paragraphs = r_paragraph.findall(bytes)
+ if not content or len(content) < 1:
+ return None
+ paragraphs = r_paragraph.findall(content[0])
+ print paragraphs
if not paragraphs:
if not last: