mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Fix #2253: `:pyobject: option of literalinclude` directive can't detect indented body block when the block starts with blank or comment lines.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
===========================
|
||||
Literal Includes for python
|
||||
===========================
|
||||
|
||||
block start with blank or comment
|
||||
=================================
|
||||
|
||||
.. literalinclude:: target.py
|
||||
:pyobject: block_start_with_comment
|
||||
|
||||
.. literalinclude:: target.py
|
||||
:pyobject: block_start_with_blank
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Literally included file using Python highlighting
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
foo = "Including Unicode characters: üöä"
|
||||
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
class Bar:
|
||||
def baz():
|
||||
pass
|
||||
|
||||
# comment after Bar class definition
|
||||
def bar(): pass
|
||||
|
||||
def block_start_with_comment():
|
||||
# Comment
|
||||
return 1
|
||||
|
||||
def block_start_with_blank():
|
||||
|
||||
return 1
|
||||
Reference in New Issue
Block a user