mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-12 08:25:01 -05:00
literalinclude directive allows combination of :pyobject: and :lines:
This commit is contained in:
1 parent
3eb5b2960a
commit
675b5f4237
3 files changed
+10
-1
No files matched your search
@@ -109,6 +109,8 @@ Features added
|
||||
|
||||
* Support requests-2.0.0 (experimental) (refs: #3367)
|
||||
* (latex) PDF page margin dimensions may be customized (refs: #3387)
|
||||
* ``literalinclude`` directive allows combination of ``:pyobject:`` and
|
||||
``:lines:`` options (refs: #3416)
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
@@ -170,7 +170,6 @@ class CodeBlock(Directive):
|
||||
|
||||
class LiteralIncludeReader(object):
|
||||
INVALID_OPTIONS_PAIR = [
|
||||
('pyobject', 'lines'),
|
||||
('lineno-match', 'lineno-start'),
|
||||
('lineno-match', 'append'),
|
||||
('lineno-match', 'prepend'),
|
||||
|
||||
@@ -65,6 +65,14 @@ def test_LiteralIncludeReader_pyobject3():
|
||||
" 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():
|
||||
options = {'lines': '1-4'}
|
||||
reader = LiteralIncludeReader(LITERAL_INC_PATH, options, DUMMY_CONFIG)
|
||||
|
||||
Reference in new issue
Block a user