forked from docs/doc-exports
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:
parent
ba34ad4eaa
commit
9777c6d162
@ -222,6 +222,19 @@ class OTCDocConvertor:
|
|||||||
for li in soup.body.find_all("li"):
|
for li in soup.body.find_all("li"):
|
||||||
del li['id']
|
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"):
|
for pre in soup.body.find_all("pre"):
|
||||||
text = pre.get_text()
|
text = pre.get_text()
|
||||||
# if text.startswith("{"):
|
# if text.startswith("{"):
|
||||||
@ -238,6 +251,8 @@ class OTCDocConvertor:
|
|||||||
):
|
):
|
||||||
# Something like "DELETE https://some_url"
|
# Something like "DELETE https://some_url"
|
||||||
pre["class"] = "text"
|
pre["class"] = "text"
|
||||||
|
if "class" in pre and pre["class"] in ["codeblock"]:
|
||||||
|
pre["class"] = "text"
|
||||||
|
|
||||||
# And now specialities
|
# And now specialities
|
||||||
rawize_strings = [
|
rawize_strings = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user