Commit efff414e authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Fix admonition regex in doc/docstring.py

The regex could, in particular, match exception messages in doctest
strings in docstrings such as "ValueError: ..."
parent f50a6b80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ def mark_admonitions(
	def replace(match: re.Match[str]) -> str:
		return f".. {match.group(1)}::"
	regex = re.compile(
		r"(attention|caution|danger|error|hint|important|note|tip|warning):",
		r"^\s*(attention|caution|danger|error|hint|important|note|tip|warning):",
		re.I,
	)
	lines[:] = (regex.sub(replace, line) for line in lines)