Skip to content

Commit 9850383

Browse files
committed
Fix docutils deprecation and main_menu is_active rendering
Replace deprecated docutils.frontend.OptionParser with get_default_settings(). Override iommi_open_tag in BoundM to set is_active class before delegating to Tag.iommi_open_tag().
1 parent 9e88521 commit 9850383

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

iommi/docs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def uses_from_cookbooks():
5252
from iommi.declarative.util import strip_prefix
5353

5454
parser = docutils.parsers.rst.Parser()
55-
components = (docutils.parsers.rst.Parser,)
56-
settings = docutils.frontend.OptionParser(components=components).get_default_values()
55+
settings = docutils.frontend.get_default_settings(docutils.parsers.rst.Parser)
5756

5857
backrefs = defaultdict(set)
5958

iommi/main_menu.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ def render(self):
386386
def __repr__(self):
387387
return f'<BoundM {self.m.name}>'
388388

389+
def iommi_open_tag(self):
390+
if self.is_active():
391+
self.attrs['class']['is_active'] = True
392+
return super().iommi_open_tag()
393+
389394
def iommi_open_details_tag(self):
390395
return format_html('<details{}>', " open" if self.open else '')
391396

0 commit comments

Comments
 (0)