From a2811a73e3b1fe29a52e8777f2257bb29131e0bc Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Wed, 31 May 2023 19:34:01 +0300 Subject: [PATCH] Rename remove_html_tags to fix_html_tags --- app/converter/wordpress_markdown.py | 9 ++++++--- app/tests/converter/wordpress_markdown_test.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/converter/wordpress_markdown.py b/app/converter/wordpress_markdown.py index 1a58bd9..9eba560 100644 --- a/app/converter/wordpress_markdown.py +++ b/app/converter/wordpress_markdown.py @@ -51,7 +51,10 @@ class WordpressMarkdownConverter: header["author"] = self.configurator.converter_options.author_rewrite return header - def remove_html_tags(self, post_lines): + def fix_html_tags(self, post_lines): + """ + Fixes the html tags from the post lines. + """ fixed_lines = [] for line in post_lines: if line == "": @@ -77,7 +80,7 @@ class WordpressMarkdownConverter: else: tags = list(map(str, content.contents)) if tags: - fixed_tags = self.remove_html_tags(tags) + fixed_tags = self.fix_html_tags(tags) if fixed_tags: fixed_lines.extend(fixed_tags) @@ -105,7 +108,7 @@ class WordpressMarkdownConverter: # fix unknown tags post_lines = post_content.split("\n") - fixed_lines = self.remove_html_tags(post_lines) + fixed_lines = self.fix_html_tags(post_lines) return "\n".join(fixed_lines) diff --git a/app/tests/converter/wordpress_markdown_test.py b/app/tests/converter/wordpress_markdown_test.py index a36d2ef..57c46ca 100644 --- a/app/tests/converter/wordpress_markdown_test.py +++ b/app/tests/converter/wordpress_markdown_test.py @@ -62,10 +62,10 @@ def test_header_fields_drop(header_fields_drop, input_header, expected_header): ), ], ) -def test_remove_html_tags_detect_youtube_links(input_lines, expected_lines): +def test_fix_html_tags_detect_youtube_links(input_lines, expected_lines): configurator = make_fake_configurator( "wordpress_markdown_converter", ConverterOptions(), ) converter = WordpressMarkdownConverter(configurator) - assert converter.remove_html_tags(input_lines) == expected_lines + assert converter.fix_html_tags(input_lines) == expected_lines