-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make build process robust against missing nodes #9921
Comments
To give an extension developer's perspective, raising an
But if Personally, I do not think extension writers (in most cases) should even need to implement an While this can avoid new extensions from introducing this call, this still results in an exception being raised. Since all Sphinx translators appear to inherit from |
Removes the need for various translators from raising a `NotImplementedError` exception when missing support for a specific node type. docutils will already raise [1][2] a `NotImplementedError` exception for these cases. This help reduce the implementation inside Sphinx as well as prevents the possible undesired replication of unknown-node handling with third-party extensions [3]. In most cases, generating a warning message for an unsupported node type can be preferred. Providing an indication that a node is not supported can be easier for a user of Sphinx to understand a limitation of a builder over a generic "not implemented" exception. This commit takes the logging call which is already used by `texinfo` and applies it to the `SphinxTranslator` base class -- which any Sphinx translator implementation can use. [1]: https://repo.or.cz/docutils.git/blob/d169015ee0f412cffd69b33654d8a119d99bc0f3:/docutils/nodes.py#l2048 [2]: https://repo.or.cz/docutils.git/blob/53716a13b48128af6045139d3cd2909f61e7ed8e:/docutils/nodes.py#l1897 [3]: sphinx-doc#9921 Signed-off-by: James Knight <james.d.knight@live.com>
Removes the need for various translators from raising a `NotImplementedError` exception when missing support for a specific node type. docutils will already raise [1][2] a `NotImplementedError` exception for these cases. This help reduce the implementation inside Sphinx as well as prevents the possible undesired replication of unknown-node handling with third-party extensions [3]. In most cases, generating a warning message for an unsupported node type can be preferred. Providing an indication that a node is not supported can be easier for a user of Sphinx to understand a limitation of a builder over a generic "not implemented" exception. This commit takes the logging call which is already used by `texinfo` and applies it to the `SphinxTranslator` base class -- which any Sphinx translator implementation can use. [1]: https://repo.or.cz/docutils.git/blob/d169015ee0f412cffd69b33654d8a119d99bc0f3:/docutils/nodes.py#l2048 [2]: https://repo.or.cz/docutils.git/blob/53716a13b48128af6045139d3cd2909f61e7ed8e:/docutils/nodes.py#l1897 [3]: sphinx-doc#9921 Signed-off-by: James Knight <james.d.knight@live.com>
Is your feature request related to a problem? Please describe.
Projects often pick extensions that introduce new nodes, and at the same time they try to build output other than HTML, perhaps provided by another extension.
A specific case of this is #9919, which uses Sphinx-diagrams (adding a new
diagram
node) combined with sphinxcontrib-confluencebuilder, which doesn't understand the concept of diagrams. Other recent examples include nbsphinx + pdf build.In all these cases, the build crashes, even if
-W
hasn't been used.Describe the solution you'd like
It would be nice to to produce an empty box or generic node with a warning in these cases, rather than failing the build. At least most of the documentation could be build.
Extra points if the warning says which extension registered the node, so the issue can be opened in the right repository straight away.
Describe alternatives you've considered
Naturally, one alternative is not doing anything. I think the current status is problematic, but I haven't weighed the cost of changing it.
This behavior could be made configurable, but I guess it can be treated like any other Sphinx warning.
The text was updated successfully, but these errors were encountered: