forked from docs/doc-exports
Ensure referred li items has anchors
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
a96a12ecf1
commit
2d3c7b3e97
@ -261,8 +261,21 @@ class OTCDocConvertor:
|
|||||||
underline.unwrap()
|
underline.unwrap()
|
||||||
|
|
||||||
for li in soup.body.find_all("li"):
|
for li in soup.body.find_all("li"):
|
||||||
|
if not li.get("id"):
|
||||||
|
continue
|
||||||
|
local_ref = li.get("id").lower()
|
||||||
|
# Delete li ID to prevent broken RST containers
|
||||||
del li["id"]
|
del li["id"]
|
||||||
|
|
||||||
|
if (
|
||||||
|
self.is_element_referred(local_ref, file_name)
|
||||||
|
and local_ref not in page_anchors
|
||||||
|
):
|
||||||
|
# LI item referred, but no anchor present
|
||||||
|
logging.debug("Adding missing li %s anchor", local_ref)
|
||||||
|
li.insert(0, self.make_label(soup, local_ref))
|
||||||
|
page_anchors.add(local_ref)
|
||||||
|
|
||||||
# Sometimes we have code blocks with line numbers.
|
# Sometimes we have code blocks with line numbers.
|
||||||
# <div class="codecoloring" codetype="xxx"><table class="xxx">
|
# <div class="codecoloring" codetype="xxx"><table class="xxx">
|
||||||
# <tr><td class="linenos"><div class="linenodiv"><pre>1
|
# <tr><td class="linenos"><div class="linenodiv"><pre>1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user