diff --git a/otc_doc_convertor/convertor.py b/otc_doc_convertor/convertor.py index 46e12a283..3dbe287d9 100644 --- a/otc_doc_convertor/convertor.py +++ b/otc_doc_convertor/convertor.py @@ -312,14 +312,11 @@ class OTCDocConvertor: escape_asterisk_re = r"\((\*)[\.,]" for p in soup.body.find_all(string=re.compile(escape_asterisk_re)): - if p.string: + if p.string and p.parent.name not in ["b", "strong", "pre"]: curr = p.string part = re.search(escape_asterisk_re, curr) # If we have ` all files (*.*)` - no need to escape - if ( - len(part.groups()) > 0 - and p.parent.name not in ["b", "strong"] - ): + if len(part.groups()) > 0: logging.debug( "Found asterisks to escape: %s", part.group(1) ) @@ -351,16 +348,13 @@ class OTCDocConvertor: ] for to_rawize in rawize_strings: for p in soup.body.find_all(string=re.compile(to_rawize)): - if p.string: + if p.string and p.parent.name not in ["b", "strong", "pre"]: curr = p.string part = re.search(to_rawize, curr) # We should not escape inside of bold - this is wrong - if ( - len(part.groups()) > 0 - and p.parent.name not in ["b", "strong"] - ): + if len(part.groups()) > 0: logging.debug( - "Found element to rawize: %s", part.group(1) + "Found element to rawize %s", part.group(1) ) new = curr.replace( part.group(1), f"{part.group(1)}" @@ -372,7 +366,6 @@ class OTCDocConvertor: logging.error( "Cannot find string for rawization anymore" ) - logging.error(f"String with star: {p}") # Drop parent link at the bottom of the page for parent in soup.body.find_all("p", class_="familylinks"):