Skip to content

Commit

Permalink
Avoid index-out-of-range exception with back-to-back notes.
Browse files Browse the repository at this point in the history
Also modified a test case.
  • Loading branch information
Dave Dolson committed Apr 15, 2021
1 parent 39115c3 commit 6071fc6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doxypypy/doxypypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ def __alterDocstring(self, tail='', writer=None):
match = tagRE.search(line)
if match:
# We've got a simple one-line Doxygen command
lines[-1], inCodeBlock = self._endCodeIfNeeded(
lines[-1], inCodeBlock)
if lines:
lines[-1], inCodeBlock = self._endCodeIfNeeded(
lines[-1], inCodeBlock)
inCodeBlockObj[0] = inCodeBlock
writer.send((firstLineNum, lineNum - 1, lines))
lines = []
Expand Down
2 changes: 2 additions & 0 deletions doxypypy/test/sample_google.out.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
#This is basically as close a copy of the Python examples in the Google
#Python Style Guide as possible while still being valid code.
# @note this is a note
# @note this is also a note
#
#http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#Comments
#
Expand Down
2 changes: 2 additions & 0 deletions doxypypy/test/sample_google.outbare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#
#This is basically as close a copy of the Python examples in the Google
#Python Style Guide as possible while still being valid code.
#NOTE: this is a note
#NOTE: this is also a note
#
#http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#Comments
#
Expand Down
2 changes: 2 additions & 0 deletions doxypypy/test/sample_google.outnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
#This is basically as close a copy of the Python examples in the Google
#Python Style Guide as possible while still being valid code.
# @note this is a note
# @note this is also a note
#
#http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#Comments
#
Expand Down
2 changes: 2 additions & 0 deletions doxypypy/test/sample_google.outnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
#This is basically as close a copy of the Python examples in the Google
#Python Style Guide as possible while still being valid code.
# @note this is a note
# @note this is also a note
#
#http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#Comments
#
Expand Down
2 changes: 2 additions & 0 deletions doxypypy/test/sample_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
This is basically as close a copy of the Python examples in the Google
Python Style Guide as possible while still being valid code.
NOTE: this is a note
NOTE: this is also a note
http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#Comments
"""
Expand Down

0 comments on commit 6071fc6

Please sign in to comment.