mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #3348: Show decorators in literalinclude and viewcode directives
Signed-off-by: Ray Lehtiniemi <rayl@mail.com>
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -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
|
||||
----------
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user