diff options
author | James Knight <james.d.knight@live.com> | 2021-12-05 15:03:57 -0500 |
---|---|---|
committer | James Knight <james.d.knight@live.com> | 2021-12-05 15:03:57 -0500 |
commit | 75914c67c77e94b0af71fbab424ad1e18e218b97 (patch) | |
tree | 3ee897536e193fbe1d7e5d8cfe5c362b113b208a /sphinx/writers/manpage.py | |
parent | edd14783f3cc6222066fd63efbe28c2728617e18 (diff) | |
download | sphinx-git-75914c67c77e94b0af71fbab424ad1e18e218b97.tar.gz |
drop translator-specific unknown_visit calls
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]: https://github.com/sphinx-doc/sphinx/issues/9921
Signed-off-by: James Knight <james.d.knight@live.com>
Diffstat (limited to 'sphinx/writers/manpage.py')
-rw-r--r-- | sphinx/writers/manpage.py | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index da5f4c241..db8c1b1d3 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -462,6 +462,3 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator): def depart_math_block(self, node: Element) -> None: self.depart_centered(node) - - def unknown_visit(self, node: Node) -> None: - raise NotImplementedError('Unknown node: ' + node.__class__.__name__) |