mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Fixe for bug with titles that spread across lines.
This commit is contained in:
parent
f95a804fe9
commit
ecc820a49c
@ -104,7 +104,7 @@ class Http(callbacks.Privmsg):
|
||||
self.deepthoughts.add(thought)
|
||||
irc.reply(msg, thought)
|
||||
|
||||
_titleRe = re.compile(r'<title>(.*)</title>', re.I)
|
||||
_titleRe = re.compile(r'<title>(.*)</title>', re.I | re.S)
|
||||
def title(self, irc, msg, args):
|
||||
"""<url>
|
||||
|
||||
@ -118,7 +118,7 @@ class Http(callbacks.Privmsg):
|
||||
text = fd.read()
|
||||
m = self._titleRe.search(text)
|
||||
if m is not None:
|
||||
irc.reply(msg, utils.htmlToText(m.group(1)))
|
||||
irc.reply(msg, utils.htmlToText(m.group(1).strip()))
|
||||
else:
|
||||
irc.reply(msg, 'That URL appears to have no HTML title.')
|
||||
except ValueError, e:
|
||||
|
@ -47,6 +47,10 @@ class HttpTest(PluginTestCase, PluginDocumentation):
|
||||
'Slashdot: News for nerds, stuff that matters')
|
||||
self.assertResponse('title http://www.slashdot.org/',
|
||||
'Slashdot: News for nerds, stuff that matters')
|
||||
self.assertNotRegexp('http://www.amazon.com/exec/obidos/tg/detail/-/'
|
||||
'1884822312/qid=1063140754/sr=8-1/ref=sr_8_1/'
|
||||
'002-9802970-2308826?v=glance&s=books&n=507846',
|
||||
'no HTML title')
|
||||
|
||||
def testGeekquote(self):
|
||||
self.assertNotError('geekquote')
|
||||
|
Loading…
Reference in New Issue
Block a user