escape word ending with underscore

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-12-02 13:57:52 +00:00 committed by zuul
parent a3ce99ce37
commit 9a315f235c

View File

@ -333,6 +333,7 @@ class OTCDocConvertor:
part.group(1), f"<code>{part.group(1)}</code>"
)
p.replace_with(bs4.BeautifulSoup(new, "html.parser"))
# And now specialities
rawize_strings = [
# "\*\*\*\*\*\*",
@ -357,6 +358,10 @@ class OTCDocConvertor:
r"^(-)$",
# MRS component guide has: "./mydate_\\\\d*/"
r"\w(_)\\",
# Pandoc is not properly escaping _ before special chars what makes
# it invalid for Sphinx. A bit weird regex:
# "[:space:][:word:][:underscore:][:comma:]"
r"\s([\w_]+_)[,]",
]
for to_rawize in rawize_strings:
for p in soup.body.find_all(string=re.compile(to_rawize)):