From a908c141dbbecfacdacf4a3382b526c30eda24d7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 13 Jan 2025 22:10:01 +0530 Subject: [PATCH] Add the "See Also" section to the `TryExamples` directive's trailing section ignore patterns (#251) * Add `..seealso` section as a pattern * Fix escaping of regex characters Co-Authored-By: Albert Steppi <1953382+steppi@users.noreply.github.com> * Reword comment about SymPy's special case Co-Authored-By: Albert Steppi <1953382+steppi@users.noreply.github.com> * Add subset of docutils + Sphinx directives to end at * Revert "Add subset of docutils + Sphinx directives to end at" This reverts commit 79e864e2b5107842fdc2a93d8159f0362245feba. * Reword comment about "See Also" section Co-Authored-By: Albert Steppi <1953382+steppi@users.noreply.github.com> * Remove references to historical PRs Co-authored-by: Albert Steppi <1953382+steppi@users.noreply.github.com> --------- Co-authored-by: Albert Steppi <1953382+steppi@users.noreply.github.com> --- jupyterlite_sphinx/_try_examples.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jupyterlite_sphinx/_try_examples.py b/jupyterlite_sphinx/_try_examples.py index bbd3f78..deb4f4d 100755 --- a/jupyterlite_sphinx/_try_examples.py +++ b/jupyterlite_sphinx/_try_examples.py @@ -308,13 +308,16 @@ def _process_literal_blocks(md_text): _next_section_pattern = re.compile( "|".join( [ - rf".. (rubric|admonition)::\s*{header}" + rf"\.\. (rubric|admonition)::\s*{header}" for header in _non_example_docstring_section_headers ] # If examples section is last, processed by numpydoc may appear at end. + [r"\!\! processed by numpydoc \!\!"] # Attributes section sometimes has no directive. + [r":Attributes:"] + # See Also sections are mapped to Sphinx's `.. seealso::` directive, + # not admonitions or rubrics. + + [r"\.\. seealso::"] ) )