birkenfeld / sphinx (http://sphinx.pocoo.org/)

Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects, written by Georg Brandl and licensed under the BSD license.

Clone this repository (size: 20.7 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/birkenfeld/sphinx/
commit 1798: 9cc7e3233f49
parent 1790: aa25ad2afa30
branch: default
Make the ``start-after`` and ``end-before`` options to the ``literalinclude`` directive work correctly if not used together.
Georg Brandl / birkenfeld
7 weeks ago

Changed (Δ302 bytes):

raw changeset »

CHANGES (3 lines added, 0 lines removed)

sphinx/directives/code.py (2 lines added, 2 lines removed)

tests/root/includes.txt (6 lines added, 0 lines removed)

tests/test_markup.py (0 lines added, 1 lines removed)

Up to file-list CHANGES:

1
1
Release 0.6.5 (in development)
2
2
==============================
3
3
4
* Make the ``start-after`` and ``end-before`` options to the
5
  ``literalinclude`` directive work correctly if not used together.
6
4
7
* #321: Fix link generation in the LaTeX builder.
5
8
6
9

Up to file-list sphinx/directives/code.py:

@@ -155,9 +155,9 @@ class LiteralInclude(Directive):
155
155
            use = not startafter
156
156
            res = []
157
157
            for line in lines:
158
                if not use and startafter in line:
158
                if not use and startafter and startafter in line:
159
159
                    use = True
160
                elif use and endbefore in line:
160
                elif use and endbefore and endbefore in line:
161
161
                    use = False
162
162
                    break
163
163
                elif use:

Up to file-list tests/root/includes.txt:

@@ -44,6 +44,12 @@ Literalinclude options
44
44
   :start-after: coding: utf-8
45
45
   :end-before: class Foo
46
46
47
.. literalinclude:: literal.inc
48
   :start-after: utf-8
49
50
.. literalinclude:: literal.inc
51
   :end-before: class Foo
52
47
53
Test if dedenting before parsing works.
48
54
49
55
.. highlight:: python

Up to file-list tests/test_markup.py:

@@ -16,7 +16,6 @@ from util import *
16
16
from docutils import frontend, utils, nodes
17
17
from docutils.parsers import rst
18
18
19
from sphinx import addnodes
20
19
from sphinx.util import texescape
21
20
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
22
21
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator