diff --git a/Makefile b/Makefile index aa8def898..c0f780b3a 100644 --- a/Makefile +++ b/Makefile @@ -30,13 +30,16 @@ clean: $(RM_CMD) extensions/odoo_theme/static/style.css @echo "Cleaning finished." -edi: SPHINXOPTS += -A collapse_menu=True +#edi: SPHINXOPTS += -A collapse_menu=True # If needed, comment rather than setting False edi: VERSIONS += 12.0,13.0,14.0 edi: CANONICAL_VERSION += 14.0 edi: LANGUAGES += en,fr,es edi: CURRENT_LANG += fr edi: clean html +static: extensions/odoo_theme/static extensions/odoo_theme/static/style.css + cp -r extensions/odoo_theme/static/* _build/html/_static/ + html: extensions/odoo_theme/static/style.css @echo "Starting build..." $(SPHINX_BUILD) -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(BUILD_DIR)/html diff --git a/content/applications.rst b/content/applications.rst index 5c5b86a92..8ea646be5 100644 --- a/content/applications.rst +++ b/content/applications.rst @@ -1,3 +1,5 @@ +:show_content: + ============ Applications ============ diff --git a/content/contributing/documentation.rst b/content/contributing/documentation.rst index a168b5e12..81b3bef70 100644 --- a/content/contributing/documentation.rst +++ b/content/contributing/documentation.rst @@ -1,5 +1,5 @@ -:empty_page: +:show_content: ================================= Contributing to the documentation diff --git a/extensions/odoo_theme/__init__.py b/extensions/odoo_theme/__init__.py index c9dc239b7..57639caa8 100644 --- a/extensions/odoo_theme/__init__.py +++ b/extensions/odoo_theme/__init__.py @@ -1,32 +1,27 @@ -from . import pygments_override -from . import translator - -import sphinx.builders.html +from docutils import nodes from sphinx import addnodes from sphinx.environment.adapters import toctree -from docutils import nodes + +from . import pygments_override, translator def setup(app): app.set_translator('html', translator.BootstrapTranslator) - # VFE TODO check if default meta initialization is necessary. - # If not, remove update_meta method - app.connect('html-page-context', update_meta) + app.connect('html-page-context', set_missing_meta) + app.add_js_file('js/utils.js') # Keep in first position app.add_js_file('js/layout.js') app.add_js_file('js/menu.js') app.add_js_file('js/page_toc.js') -def update_meta(app, pagename, templatename, context, doctree): - meta = context.get('meta') - if meta is None: - meta = context['meta'] = {} - -# TODO VFE detailed explanation of the patch logic and use. +def set_missing_meta(app, pagename, templatename, context, doctree): + if context.get('meta') is None: # Pages without title (used with `include::`) have no meta + context['meta'] = {} class Monkey(object): + """ Replace patched method of an object by a new method receiving the old one in argument. """ def __init__(self, obj): self.obj = obj def __call__(self, fn): @@ -36,41 +31,67 @@ class Monkey(object): @Monkey(toctree.TocTree) def resolve(old_resolve, tree, docname, *args, **kwargs): + + def _update_toctree_nodes(_node) -> None: + """ Make necessary changes to Docutils' nodes of the toc. + + Internal structure of toc nodes: +