Skip to content

Commit

Permalink
fix: Fix Google admonition regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Mar 31, 2023
1 parent 7129477 commit ef0be5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/griffe/docstrings/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
BlockItems = List[BlockItem]
ItemsBlock = Tuple[BlockItems, int]

_RE_ADMONITION: Pattern = re.compile(r"^(?P<type>[\w][\s\w-]*):(\s+(?P<title>[^\s].*))?$", re.I)
_RE_ADMONITION: Pattern = re.compile(r"^(?P<type>[\w][\s\w-]*):(\s+(?P<title>[^\s].*))?\s*$", re.I)
_RE_NAME_ANNOTATION_DESCRIPTION: Pattern = re.compile(r"^(?:(?P<name>\w+)?\s*(?:\((?P<type>.+)\))?:\s*)?(?P<desc>.*)$")
_RE_DOCTEST_BLANKLINE: Pattern = re.compile(r"^\s*<BLANKLINE>\s*$")
_RE_DOCTEST_FLAGS: Pattern = re.compile(r"(\s*#\s*doctest:.+)$")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_docstrings/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_parse_partially_indented_lines(parse_google: ParserType) -> None:
sections, warnings = parse_google(docstring)
assert len(sections) == 2
assert sections[0].kind is DocstringSectionKind.admonition
assert sections[1].kind is DocstringSectionKind.text
assert sections[1].kind is DocstringSectionKind.admonition
assert not warnings


Expand Down

0 comments on commit ef0be5f

Please sign in to comment.