Complete Markdown support ("hr" tag) and add test
authorJakob Cornell <jakob+gpg@jcornell.net>
Thu, 29 Sep 2022 03:27:29 +0000 (22:27 -0500)
committerJakob Cornell <jakob+gpg@jcornell.net>
Sun, 2 Oct 2022 21:14:15 +0000 (16:14 -0500)
strikebot/src/strikebot/tests.py
strikebot/src/strikebot/updates.py

index 7bbf2260a3d82f4aa7622a1ef82002d00ca19b4f..8c8bd26e0d608f3ef90e5ae0cb0070c90944b032 100644 (file)
@@ -48,3 +48,7 @@ class UpdateParsingTests(TestCase):
                pu = parse_update(_build_payload("<span>0490499</span>"), 4999, "")
                self.assertIsNone(pu.number)
                self.assertTrue(pu.count_attempt)
+
+       def test_html_handling(self):
+               pu = parse_update(_build_payload("123<hr>,456"), None, "")
+               self.assertEqual(pu.number, 123)
index 5eb3c00b356aa340103640aca22e9ddd36c41aad..4289ee92b852bf70bf75fd2c23ef0f884029b587 100644 (file)
@@ -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"]: