Loading md_to_docx_converter/src/to_docx/preprocessing.py +8 −0 Original line number Original line Diff line number Diff line Loading @@ -602,10 +602,18 @@ def create_custom_tags_for_bold_italic_underline_styles(soup: BeautifulSoup): """Some spans apply complex styles part of which involves bolding, italicizing, or underlining. Create custom tags with the class name""" """Some spans apply complex styles part of which involves bolding, italicizing, or underlining. Create custom tags with the class name""" CSS_BIU = combine_biu_classes() CSS_BIU = combine_biu_classes() # Classes that should be handled via custom-style in Lua filter, not via text replacement EXCLUDE_CLASSES = {"HTML-Keyboard", "HTML-Definition"} spans = soup.find_all("span", class_=lambda cls: cls in CSS_BIU if cls else False) spans = soup.find_all("span", class_=lambda cls: cls in CSS_BIU if cls else False) for span in spans: for span in spans: cls = span.get("class")[0] cls = span.get("class")[0] # Skip classes that should maintain their span structure for Lua filter processing if cls in EXCLUDE_CLASSES: continue if cls in HANDLE_UNDERSCORE_CLASSES: if cls in HANDLE_UNDERSCORE_CLASSES: # The styles for these classes do not have the underscores # The styles for these classes do not have the underscores cls = cls.replace("_", " ") cls = cls.replace("_", " ") Loading Loading
md_to_docx_converter/src/to_docx/preprocessing.py +8 −0 Original line number Original line Diff line number Diff line Loading @@ -602,10 +602,18 @@ def create_custom_tags_for_bold_italic_underline_styles(soup: BeautifulSoup): """Some spans apply complex styles part of which involves bolding, italicizing, or underlining. Create custom tags with the class name""" """Some spans apply complex styles part of which involves bolding, italicizing, or underlining. Create custom tags with the class name""" CSS_BIU = combine_biu_classes() CSS_BIU = combine_biu_classes() # Classes that should be handled via custom-style in Lua filter, not via text replacement EXCLUDE_CLASSES = {"HTML-Keyboard", "HTML-Definition"} spans = soup.find_all("span", class_=lambda cls: cls in CSS_BIU if cls else False) spans = soup.find_all("span", class_=lambda cls: cls in CSS_BIU if cls else False) for span in spans: for span in spans: cls = span.get("class")[0] cls = span.get("class")[0] # Skip classes that should maintain their span structure for Lua filter processing if cls in EXCLUDE_CLASSES: continue if cls in HANDLE_UNDERSCORE_CLASSES: if cls in HANDLE_UNDERSCORE_CLASSES: # The styles for these classes do not have the underscores # The styles for these classes do not have the underscores cls = cls.replace("_", " ") cls = cls.replace("_", " ") Loading