Use make_refnode for creating the references on the IP list
This commit is contained in:
parent
49a3d89488
commit
e53838acfb
1 changed files with 16 additions and 13 deletions
|
@ -346,30 +346,33 @@ def process_ip_nodes(app, doctree, fromdocname):
|
|||
tbody = nodes.tbody()
|
||||
tgroup += tbody
|
||||
|
||||
for ip_address_sig, ip_info in [(key, addresses[key]) for key in sorted(addresses, key=sort_by_ip)]:
|
||||
for ip_address_sig, ip_info in [
|
||||
(key, addresses[key]) for key in sorted(addresses, key=sort_by_ip)
|
||||
]:
|
||||
para = nodes.paragraph()
|
||||
para += nodes.literal("", ip_info[0][0].to_compressed())
|
||||
|
||||
ref_node = nodes.paragraph()
|
||||
ref_uris = set()
|
||||
ref_nodes = []
|
||||
referenced_docs = set()
|
||||
|
||||
for item in ip_info:
|
||||
ip_address, todocname, anchor = item
|
||||
|
||||
newnode = nodes.reference("", "", internal=True)
|
||||
try:
|
||||
newnode["refuri"] = app.builder.get_relative_uri(
|
||||
fromdocname, todocname
|
||||
)
|
||||
if newnode["refuri"] in ref_uris:
|
||||
if todocname in referenced_docs:
|
||||
continue
|
||||
ref_uris.add(newnode["refuri"])
|
||||
except NoUri:
|
||||
pass
|
||||
referenced_docs.add(todocname)
|
||||
|
||||
title = env.titles[todocname]
|
||||
innernode = nodes.Text(title.astext())
|
||||
newnode.append(innernode)
|
||||
newnode = make_refnode(
|
||||
app.builder,
|
||||
fromdocname,
|
||||
todocname,
|
||||
anchor,
|
||||
innernode,
|
||||
title.astext(),
|
||||
)
|
||||
|
||||
ref_nodes.append(newnode)
|
||||
for count in range(len(ref_nodes)):
|
||||
ref_node.append(ref_nodes[count])
|
||||
|
|
Loading…
Reference in a new issue