From: Jakob Cornell Date: Thu, 29 Sep 2022 03:27:29 +0000 (-0500) Subject: Complete Markdown support ("hr" tag) and add test X-Git-Tag: strikebot-0.0.7~12 X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd4318cdcf647d91f65509ec27fb42f6f7ed12b0;p=counting.git Complete Markdown support ("hr" tag) and add test --- diff --git a/strikebot/src/strikebot/tests.py b/strikebot/src/strikebot/tests.py index 7bbf226..8c8bd26 100644 --- a/strikebot/src/strikebot/tests.py +++ b/strikebot/src/strikebot/tests.py @@ -48,3 +48,7 @@ class UpdateParsingTests(TestCase): pu = parse_update(_build_payload("0490499"), 4999, "") self.assertIsNone(pu.number) self.assertTrue(pu.count_attempt) + + def test_html_handling(self): + pu = parse_update(_build_payload("123
,456"), None, "") + self.assertEqual(pu.number, 123) diff --git a/strikebot/src/strikebot/updates.py b/strikebot/src/strikebot/updates.py index 5eb3c00..4289ee9 100644 --- a/strikebot/src/strikebot/updates.py +++ b/strikebot/src/strikebot/updates.py @@ -43,7 +43,7 @@ def parse_update(payload_data: dict, curr_count: Optional[int], bot_user: str) - out[-1].append(el) elif el is SPACE: out[-1].append(el) - elif el is NEW_LINE or el.name == "br": + elif el is NEW_LINE or el.name in ["br", "hr"]: if out[-1]: out.append([]) elif el.name in ["em", "strong", "del", "span", "sup", "code", "a", "th", "td"]: