Fix #3348: Show decorators in literalinclude and viewcode directives

Signed-off-by: Ray Lehtiniemi <rayl@mail.com>
This commit is contained in:
Ray Lehtiniemi
2017-03-10 16:28:19 -07:00
parent 87c1f6ef5b
commit c5060079e4
2 changed files with 7 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ Features added
* HTML buildre uses experimental HTML5 writer if ``html_experimental_html5_builder`` is True
and docutils 0.13 and newer is installed.
* LaTeX macros to customize space before and after tables in PDF output (refs #3504)
* #3348: Show decorators in literalinclude and viewcode directives
Bugs fixed
----------

View File

@@ -296,6 +296,7 @@ class ModuleAnalyzer(object):
namespace = [] # type: List[unicode]
stack = [] # type: List[Tuple[unicode, unicode, unicode, int]]
indent = 0
decopos = None
defline = False
expect_indent = False
emptylines = 0
@@ -319,8 +320,12 @@ class ModuleAnalyzer(object):
name = next(tokeniter)[1] # type: ignore
namespace.append(name)
fullname = '.'.join(namespace)
stack.append((tok, fullname, spos[0], indent))
stack.append((tok, fullname, decopos or spos[0], indent))
defline = True
decopos = None
elif type == token.OP and tok == '@':
if decopos is None:
decopos = spos[0]
elif type == token.INDENT:
expect_indent = False
indent += 1