From ba12692fb4334474098930c271d1f73714312dc1 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 11 Dec 2014 09:59:08 +0100 Subject: [PATCH] Web: Add support for charrefs. Closes GH-923. --- plugins/Web/plugin.py | 4 ++++ plugins/Web/test.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index 42150215a..59dee9456 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -70,6 +70,10 @@ class Title(HTMLParser.HTMLParser): if name in self.entitydefs: self.title += self.entitydefs[name] + def handle_charref(self, name): + if self.inTitle: + self.title += unichr(int(name)) + class DelayedIrc: def __init__(self, irc): self._irc = irc diff --git a/plugins/Web/test.py b/plugins/Web/test.py index e23568a79..074f38c8e 100644 --- a/plugins/Web/test.py +++ b/plugins/Web/test.py @@ -65,6 +65,9 @@ class WebTestCase(ChannelPluginTestCase): # Checks that the parser doesn't hang on invalid tags self.assertNotError( 'title http://www.youtube.com/watch?v=x4BtiqPN4u8') + self.assertResponse( + 'title http://www.thefreedictionary.com/don%27t', + "don't - definition of don't by The Free Dictionary") def testTitleSnarfer(self): try: