mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
literalinclude directive allows combination of :pyobject: and :lines:
This commit is contained in:
parent
3eb5b2960a
commit
675b5f4237
2
CHANGES
2
CHANGES
@ -109,6 +109,8 @@ Features added
|
|||||||
|
|
||||||
* Support requests-2.0.0 (experimental) (refs: #3367)
|
* Support requests-2.0.0 (experimental) (refs: #3367)
|
||||||
* (latex) PDF page margin dimensions may be customized (refs: #3387)
|
* (latex) PDF page margin dimensions may be customized (refs: #3387)
|
||||||
|
* ``literalinclude`` directive allows combination of ``:pyobject:`` and
|
||||||
|
``:lines:`` options (refs: #3416)
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -170,7 +170,6 @@ class CodeBlock(Directive):
|
|||||||
|
|
||||||
class LiteralIncludeReader(object):
|
class LiteralIncludeReader(object):
|
||||||
INVALID_OPTIONS_PAIR = [
|
INVALID_OPTIONS_PAIR = [
|
||||||
('pyobject', 'lines'),
|
|
||||||
('lineno-match', 'lineno-start'),
|
('lineno-match', 'lineno-start'),
|
||||||
('lineno-match', 'append'),
|
('lineno-match', 'append'),
|
||||||
('lineno-match', 'prepend'),
|
('lineno-match', 'prepend'),
|
||||||
|
@ -65,6 +65,14 @@ def test_LiteralIncludeReader_pyobject3():
|
|||||||
" pass\n")
|
" pass\n")
|
||||||
|
|
||||||
|
|
||||||
|
def test_LiteralIncludeReader_pyobject_and_lines():
|
||||||
|
options = {'pyobject': 'Bar', 'lines': '2-'}
|
||||||
|
reader = LiteralIncludeReader(LITERAL_INC_PATH, options, DUMMY_CONFIG)
|
||||||
|
content, lines = reader.read()
|
||||||
|
assert content == (" def baz():\n"
|
||||||
|
" pass\n")
|
||||||
|
|
||||||
|
|
||||||
def test_LiteralIncludeReader_lines1():
|
def test_LiteralIncludeReader_lines1():
|
||||||
options = {'lines': '1-4'}
|
options = {'lines': '1-4'}
|
||||||
reader = LiteralIncludeReader(LITERAL_INC_PATH, options, DUMMY_CONFIG)
|
reader = LiteralIncludeReader(LITERAL_INC_PATH, options, DUMMY_CONFIG)
|
||||||
|
Loading…
Reference in New Issue
Block a user