diff --git a/src/inline_style_processor.py b/src/inline_style_processor.py index b15ecdc..d3b3a1a 100644 --- a/src/inline_style_processor.py +++ b/src/inline_style_processor.py @@ -134,7 +134,7 @@ class InlineStyleProcessor: self.inline_styled_tag.append(correspond_tag) @staticmethod - def wrap_span_in_tag_to_save_style_attrs(initial_tag: Tag) -> Tag: + def wrap_tag_in_span_to_save_style_attrs(initial_tag: Tag) -> Tag: """Function designed to save style attrs that cannot be in tag.name -> span""" # Compile a regex pattern to match tag names that can have certain style attributes dictkeys_pattern = re.compile("|".join(LiveCartaConfig.TAGS_TO_STYLE_ATTRS_CAN_BE_IN_TAG)) @@ -183,7 +183,7 @@ class InlineStyleProcessor: def convert_initial_tag(self) -> Tag: self.change_attrs_with_corresponding_tags() - self.inline_styled_tag = self.wrap_span_in_tag_to_save_style_attrs(self.inline_styled_tag) + self.inline_styled_tag = self.wrap_tag_in_span_to_save_style_attrs(self.inline_styled_tag) return self.inline_styled_tag diff --git a/src/livecarta_config.py b/src/livecarta_config.py index eab7869..abda2ff 100644 --- a/src/livecarta_config.py +++ b/src/livecarta_config.py @@ -9,7 +9,7 @@ class LiveCartaConfig: # Regular expression to match HTML tags that can have a style attribute REGEX_TAGS_WITH_STYLE_ATTR = re.compile( - "(^div$)|(^p$)|(^span$)|(^code$)|(^kbd$)|(^var$)|(^li$)|(^ul$)|(^ol$)|(^td$)|(^th$)|(^h[1-9]$)" + "(^div$)|(^p$)|(^strong$)|(^span$)|(^code$)|(^kbd$)|(^var$)|(^li$)|(^ul$)|(^ol$)|(^td$)|(^th$)|(^h[1-9]$)" ) # Dictionary mapping CSS style attribute-value pairs to HTML tags @@ -31,7 +31,8 @@ class LiveCartaConfig: TAGS_TO_STYLE_ATTRS_CAN_BE_IN_TAG = { "^p$": ["text-align", "text-indent", "border-bottom", "border-top", "border-left", "border-right", "background-color", "background"], - r"(^h[1-9]$)": ["list-style-type", "border-bottom", "border-top", "border-left", "border-right", + "^strong$": [], + "(^h[1-9]$)": ["list-style-type", "border-bottom", "border-top", "border-left", "border-right", "background-color", "background"], "^li$": ["text-align", "list-style-type", "value"], "^ul$": ["list-style-type"],