From febf7c41881719783d233d4364261558ca612f9f Mon Sep 17 00:00:00 2001 From: "Antoine Vandevenne (anv)" Date: Tue, 3 Jan 2023 14:12:48 +0000 Subject: [PATCH] [IMP] odoo_theme: tweak the HTML structure of TOC entries task-3046383 X-original-commit: 877d1de3c2240453cbbadb1dbfc33b51c985a044 Part-of: odoo/documentation#4114 --- extensions/custom_admonitions/__init__.py | 8 +-- extensions/odoo_theme/static/js/utils.js | 87 +++++++++++++---------- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/extensions/custom_admonitions/__init__.py b/extensions/custom_admonitions/__init__.py index 153c8c0a0..81cc40436 100644 --- a/extensions/custom_admonitions/__init__.py +++ b/extensions/custom_admonitions/__init__.py @@ -32,15 +32,15 @@ class Dfn(SphinxRole): sphinx.nodes.* class to prevent automatically setting the name of the node as class (e.g., "container") on the element. """ - outer_span = Span(classes=['dfn']) - inner_span = Span() + outer_span = DfnSpan(classes=['dfn']) + inner_span = DfnSpan() outer_span.append(inner_span) text = nodes.Text(self.text) inner_span.append(text) return [outer_span], [] -class Span(nodes.General, nodes.Element): +class DfnSpan(nodes.General, nodes.Element): @staticmethod def visit(translator, node): @@ -63,7 +63,7 @@ def setup(app): lambda self, node: self.depart_admonition(node), )) app.add_role('dfn', Dfn(), override=True) - app.add_node(Span, html=(Span.visit, Span.depart)) + app.add_node(DfnSpan, html=(DfnSpan.visit, DfnSpan.depart)) return { 'parallel_read_safe': True, diff --git a/extensions/odoo_theme/static/js/utils.js b/extensions/odoo_theme/static/js/utils.js index 0d6a6020c..d27facd55 100644 --- a/extensions/odoo_theme/static/js/utils.js +++ b/extensions/odoo_theme/static/js/utils.js @@ -4,63 +4,78 @@ let tocEntryListId = 0; // Used to generate IDs of toc entry lists for both the * Update the provided TOC to allow collapsing its entries with Bootstrap's accordion. * * The typical structure of a TOC menu is a follows: - * + * * * Since a