mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 0.6
This commit is contained in:
commit
59c3a708a6
3
CHANGES
3
CHANGES
@ -84,6 +84,9 @@ Release 1.0 (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.
|
||||
|
||||
|
||||
|
@ -160,9 +160,9 @@ class LiteralInclude(Directive):
|
||||
use = not startafter
|
||||
res = []
|
||||
for line in lines:
|
||||
if not use and startafter in line:
|
||||
if not use and startafter and startafter in line:
|
||||
use = True
|
||||
elif use and endbefore in line:
|
||||
elif use and endbefore and endbefore in line:
|
||||
use = False
|
||||
break
|
||||
elif use:
|
||||
|
@ -41,14 +41,18 @@ class BuildDoc(Command):
|
||||
self.conf_file_name = 'conf.py'
|
||||
self.builder = 'html'
|
||||
|
||||
def _guess_source_dir(self):
|
||||
for guess in ('doc', 'docs'):
|
||||
if not os.path.isdir(guess):
|
||||
continue
|
||||
for root, dirnames, filenames in os.walk(guess):
|
||||
if 'conf.py' in filenames:
|
||||
return root
|
||||
|
||||
def finalize_options(self):
|
||||
if self.source_dir is None:
|
||||
if os.path.isdir('doc'):
|
||||
for root, dirnames, filenames in os.walk('doc'):
|
||||
if 'conf.py' in filenames:
|
||||
self.source_dir = root
|
||||
self.announce('Using source directory %s' % root)
|
||||
break
|
||||
self.source_dir = self._guess_source_dir()
|
||||
self.announce('Using source directory %s' % self.source_dir)
|
||||
self.ensure_dirname('source_dir')
|
||||
self.source_dir = os.path.abspath(self.source_dir)
|
||||
|
||||
|
@ -49,6 +49,12 @@ Literalinclude options
|
||||
:prepend: START CODE
|
||||
:append: END CODE
|
||||
|
||||
.. literalinclude:: literal.inc
|
||||
:start-after: utf-8
|
||||
|
||||
.. literalinclude:: literal.inc
|
||||
:end-before: class Foo
|
||||
|
||||
.. cssclass:: inc-tab3
|
||||
.. literalinclude:: tabs.inc
|
||||
:tab-width: 3
|
||||
|
@ -16,7 +16,6 @@ from util import *
|
||||
from docutils import frontend, utils, nodes
|
||||
from docutils.parsers import rst
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.util import texescape
|
||||
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
|
||||
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator
|
||||
|
Loading…
Reference in New Issue
Block a user