adapt conversion script

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-09-07 10:23:19 +00:00 committed by zuul
parent ba34ad4eaa
commit 9777c6d162

View File

@ -222,6 +222,19 @@ class OTCDocConvertor:
for li in soup.body.find_all("li"):
del li['id']
# Sometimes we have code blocks with line numbers.
# <div class="codecoloring" codetype="xxx"><table class="xxx">
# <tr><td class="linenos"><div class="linenodiv"><pre>1
# 2
# 3</pre></div></td><td class="code"><div class="highlight"><pre>....
# </pre></div>
for td_lines in soup.body.find_all("td", "linenos"):
codeblock = td_lines.parent.find("td", "code")
table = td_lines.find_parent("table")
if codeblock and table:
# Replace whole table with only codeblock td
table.replace_with(codeblock)
for pre in soup.body.find_all("pre"):
text = pre.get_text()
# if text.startswith("{"):
@ -238,6 +251,8 @@ class OTCDocConvertor:
):
# Something like "DELETE https://some_url"
pre["class"] = "text"
if "class" in pre and pre["class"] in ["codeblock"]:
pre["class"] = "text"
# And now specialities
rawize_strings = [