From 82e94be84b127193a169ed2b9efa8d43e5f65d65 Mon Sep 17 00:00:00 2001 From: Kasper Laudrup Date: Fri, 25 Oct 2024 15:51:45 +0200 Subject: [PATCH] Remove enumerator specifier from generated documentation No reason to add a enumerator specifier to all enumerator values. It's clear what it is from context and this makes it slightly more readable. --- doc/CMakeLists.txt | 2 +- doc/conf.py | 2 +- .../{remove_inline_specifier.py => remove_specifiers.py} | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) rename doc/extensions/{remove_inline_specifier.py => remove_specifiers.py} (59%) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 4cb29d0e..447562dc 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -60,7 +60,7 @@ add_custom_command(OUTPUT ${SPHINX_INDEX_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/templates/layout.html ${CMAKE_CURRENT_SOURCE_DIR}/templates/navbar.html ${CMAKE_CURRENT_SOURCE_DIR}/extensions/toctree_elements.py - ${CMAKE_CURRENT_SOURCE_DIR}/extensions/remove_inline_specifier.py + ${CMAKE_CURRENT_SOURCE_DIR}/extensions/remove_specifiers.py ${CMAKE_CURRENT_SOURCE_DIR}/logo.jpg ${SPHINX_SOURCE_FILES} ${DOXYGEN_INDEX_FILE} diff --git a/doc/conf.py b/doc/conf.py index a028dffe..cc1cf684 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -13,7 +13,7 @@ extensions = ['sphinx.ext.autosectionlabel', 'breathe', 'toctree_elements', - 'remove_inline_specifier', + 'remove_specifiers', 'sphinx_jinja', 'sphinxcontrib.jquery', ] diff --git a/doc/extensions/remove_inline_specifier.py b/doc/extensions/remove_specifiers.py similarity index 59% rename from doc/extensions/remove_inline_specifier.py rename to doc/extensions/remove_specifiers.py index cefc2e7c..7d775554 100644 --- a/doc/extensions/remove_inline_specifier.py +++ b/doc/extensions/remove_specifiers.py @@ -1,6 +1,9 @@ +specifiers = ['enumerator', 'inline'] + + def doctree_resolved(app, doctree, docname): for node in doctree.traverse(): - if (node.astext() == 'inline' and node.parent.tagname == 'desc_signature_line'): + if node.astext() in specifiers and node.parent.tagname == 'desc_signature_line': node.parent.remove(node)