diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-04-17 04:36:20 +0100 |
---|---|---|
committer | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-09-27 18:31:47 +0100 |
commit | 080517ce55119a6358337b5f939b3942e4de63b4 (patch) | |
tree | 4514c65dfca9aef4da848f42c41944da1118fd6c /sphinx/util/nodes.py | |
parent | 4660b62de0e83f42b6e2ede7a1a19e861e4d34e4 (diff) | |
download | sphinx-git-080517ce55119a6358337b5f939b3942e4de63b4.tar.gz |
Increase minimum Docutils to 0.17
Diffstat (limited to 'sphinx/util/nodes.py')
-rw-r--r-- | sphinx/util/nodes.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index 0646b44e6..fdbf94fe6 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -226,7 +226,7 @@ def is_translatable(node: Node) -> bool: return True if is_pending_meta(node) or isinstance(node, addnodes.meta): - # docutils-0.17 or older + # docutils-0.17 return True elif isinstance(node, addnodes.docutils_meta): # docutils-0.18+ @@ -268,10 +268,10 @@ def extract_messages(doctree: Element) -> Iterable[Tuple[Element, str]]: else: msg = '' elif isinstance(node, META_TYPE_NODES): - # docutils-0.17 or older + # docutils-0.17 msg = node.rawcontent elif isinstance(node, nodes.pending) and is_pending_meta(node): - # docutils-0.17 or older + # docutils-0.17 msg = node.details['nodes'][0].rawcontent elif isinstance(node, addnodes.docutils_meta): # docutils-0.18+ @@ -625,19 +625,3 @@ def process_only_nodes(document: Node, tags: "Tags") -> None: # the only node, so we make sure docutils can transfer the id to # something, even if it's just a comment and will lose the id anyway... node.replace_self(nodes.comment()) - - -def _new_copy(self: Element) -> Element: - """monkey-patch Element.copy to copy the rawsource and line - for docutils-0.16 or older versions. - - refs: https://sourceforge.net/p/docutils/patches/165/ - """ - newnode = self.__class__(self.rawsource, **self.attributes) - if isinstance(self, nodes.Element): - newnode.source = self.source - newnode.line = self.line - return newnode - - -nodes.Element.copy = _new_copy # type: ignore |