Rename remove_html_tags to fix_html_tags

This commit is contained in:
Denis-Cosmin Nutiu 2023-05-31 19:34:01 +03:00
parent 6d0444de51
commit a2811a73e3
2 changed files with 8 additions and 5 deletions

View file

@ -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)

View file

@ -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