mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make the `start-after
and
end-before
options to the
literalinclude
` directive work correctly if not used together.
This commit is contained in:
parent
6aff01ea31
commit
4688518d8d
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
|||||||
Release 0.6.5 (in development)
|
Release 0.6.5 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* Make the ``start-after`` and ``end-before`` options to the
|
||||||
|
``literalinclude`` directive work correctly if not used together.
|
||||||
|
|
||||||
* #321: Fix link generation in the LaTeX builder.
|
* #321: Fix link generation in the LaTeX builder.
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,9 +155,9 @@ class LiteralInclude(Directive):
|
|||||||
use = not startafter
|
use = not startafter
|
||||||
res = []
|
res = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if not use and startafter in line:
|
if not use and startafter and startafter in line:
|
||||||
use = True
|
use = True
|
||||||
elif use and endbefore in line:
|
elif use and endbefore and endbefore in line:
|
||||||
use = False
|
use = False
|
||||||
break
|
break
|
||||||
elif use:
|
elif use:
|
||||||
|
@ -44,6 +44,12 @@ Literalinclude options
|
|||||||
:start-after: coding: utf-8
|
:start-after: coding: utf-8
|
||||||
:end-before: class Foo
|
:end-before: class Foo
|
||||||
|
|
||||||
|
.. literalinclude:: literal.inc
|
||||||
|
:start-after: utf-8
|
||||||
|
|
||||||
|
.. literalinclude:: literal.inc
|
||||||
|
:end-before: class Foo
|
||||||
|
|
||||||
Test if dedenting before parsing works.
|
Test if dedenting before parsing works.
|
||||||
|
|
||||||
.. highlight:: python
|
.. highlight:: python
|
||||||
|
@ -16,7 +16,6 @@ from util import *
|
|||||||
from docutils import frontend, utils, nodes
|
from docutils import frontend, utils, nodes
|
||||||
from docutils.parsers import rst
|
from docutils.parsers import rst
|
||||||
|
|
||||||
from sphinx import addnodes
|
|
||||||
from sphinx.util import texescape
|
from sphinx.util import texescape
|
||||||
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
|
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
|
||||||
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator
|
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator
|
||||||
|
Loading…
Reference in New Issue
Block a user