From 89d5ddb2cab8409df5b8e5bfb8628ca2b260a8dd Mon Sep 17 00:00:00 2001 From: Corban Beaird <25434156+corban-beaird@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:38:17 -0600 Subject: [PATCH] fix: replace rawsource attribute with node directly, due to removal of rawsource in Docutil 2.0 (#9838) (cherry picked from commit d8314611b2b9296cbf7f91ea0549c7017965aa51) --- docs/rebrand-docs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/rebrand-docs.py b/docs/rebrand-docs.py index 032e00eb877..e2c2b81b0a3 100644 --- a/docs/rebrand-docs.py +++ b/docs/rebrand-docs.py @@ -74,13 +74,12 @@ def Text(node: docutils.nodes.Text, _: rstfmt.FormatContext) -> rstfmt.inline_it exclude_types = (docutils.nodes.literal_block, docutils.nodes.literal) if isinstance(node.parent, exclude_types) or isinstance(node.parent.parent, exclude_types): yield node.astext() - # The rawsource attribute tends not to be set for text nodes not directly under paragraphs. elif isinstance(node.parent, docutils.nodes.paragraph): # Any instance of "\ " disappears in the parsing. It may have an effect if it separates # this text from adjacent inline markup, but in that case it will be replaced by the # wrapping algorithm. Other backslashes may be unnecessary (e.g., "a\` b" or "a\b"), but # finding all of those is future work. - yield rewrite_text(node.rawsource.replace(r"\ ", "")) + yield rewrite_text(node.replace(r"\ ", "")) else: yield rewrite_text(node.astext())