Escape .*/ and -*/ asterisks inside paragraphs

Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: gtema <artem.goncharov@gmail.com>
Co-committed-by: gtema <artem.goncharov@gmail.com>
This commit is contained in:
gtema 2022-11-16 11:11:09 +00:00 committed by zuul
parent b3547b53d8
commit 4be65edac3

View File

@ -323,6 +323,13 @@ class OTCDocConvertor:
if p.string and p.parent.name == "p":
p.string.replace_with(p.string.replace("/*", "/``*``"))
# MRS UMN contains: /opt/Bigdata/FusionInsight_Porter_8.*/foo-*/
# This is a pretty special case and we do not want to apply that widely
# therefore only looking for [.-]*/ combinations
for p in soup.body.find_all(string=re.compile(r"([\.-]\*/).+")):
if p.string and p.parent.name == "p":
p.string.replace_with(p.string.replace("*/", "``*``/"))
escape_asterisk_re = r"\((\*)[\.,]"
for p in soup.body.find_all(string=re.compile(escape_asterisk_re)):
if p.string and p.parent.name not in ["b", "strong", "pre"]:
@ -337,7 +344,6 @@ class OTCDocConvertor:
part.group(1), f"<code>{part.group(1)}</code>"
)
p.replace_with(bs4.BeautifulSoup(new, "html.parser"))
# And now specialities
rawize_strings = [
# "\*\*\*\*\*\*",