From f4696b35b225c59418b54f4206b9ebb0ba4cb30c Mon Sep 17 00:00:00 2001 From: Denis-Cosmin NUTIU Date: Fri, 2 Jun 2023 10:54:53 +0300 Subject: [PATCH] fix RegexHeuristics _remove_pre_tag --- app/converter/regex_heuristics.py | 2 +- app/tests/converter/wordpress_markdown_test.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/converter/regex_heuristics.py b/app/converter/regex_heuristics.py index 5ba2f4b..5e38124 100644 --- a/app/converter/regex_heuristics.py +++ b/app/converter/regex_heuristics.py @@ -13,7 +13,7 @@ class RegexHeuristics: self.configurator = configurator self._rules = { - "^()(?P.*?)`{0,3}(<\/pre>)?$": self._remove_pre_tag, + "^()`{0,3}(?P.*?)(<\/pre>)?$": self._remove_pre_tag, } def _remove_pre_tag(self, match) -> str: diff --git a/app/tests/converter/wordpress_markdown_test.py b/app/tests/converter/wordpress_markdown_test.py index 5c5f91b..97b1e56 100644 --- a/app/tests/converter/wordpress_markdown_test.py +++ b/app/tests/converter/wordpress_markdown_test.py @@ -124,6 +124,14 @@ def test_fix_html_tags_stripe_tag(input_lines, expected_lines): ], ["```", " ", "```"], ), + ( + [ + "```", + '
```    ',
+                "```",
+            ],
+            ["```", "    ", "```"],
+        ),
         (
             [
                 "```",