Implement proper clear_doc method for IPDomain
This commit replaces the dummy clear_doc method in jandd.sphinxext.ip.IPDomain with a proper implementation that clears document related items from the domain data dictionary.
This commit is contained in:
parent
0dafa28150
commit
01c31e9263
2 changed files with 17 additions and 1 deletions
|
@ -32,6 +32,7 @@ Changes
|
|||
----------------------
|
||||
|
||||
* fix handling of invalid IP address/range values
|
||||
* implement a proper clear_doc method for the ip domain
|
||||
|
||||
0.2.0 - 2016-05-04
|
||||
------------------
|
||||
|
|
|
@ -191,7 +191,22 @@ class IPDomain(Domain):
|
|||
}
|
||||
|
||||
def clear_doc(self, docname):
|
||||
pass
|
||||
to_remove = []
|
||||
for key, value in self.data['v4range'].items():
|
||||
if docname == value[0]:
|
||||
to_remove.append(key)
|
||||
for key in to_remove:
|
||||
del self.data['v4range'][key]
|
||||
|
||||
to_remove = []
|
||||
for key, value in self.data['v6range'].items():
|
||||
if docname == value[0]:
|
||||
to_remove.append(key)
|
||||
for key in to_remove:
|
||||
del self.data['v6range'][key]
|
||||
self.data['ips'] = [
|
||||
item for item in self.data['ips'] if item['docname'] != docname
|
||||
]
|
||||
|
||||
def resolve_xref(self, env, fromdocname, builder, typ, target, node,
|
||||
contnode):
|
||||
|
|
Loading…
Reference in a new issue