diff --git a/CHANGES b/CHANGES
index d56e3d93d..fb6151d99 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,13 +3,13 @@ Release 1.1 (in development)
* Added Python 3.x support.
+* Added a Texinfo builder.
+
* Added i18n support for content, a ``gettext`` builder and
related utilities.
* Added the ``websupport`` library.
-* Added a Texinfo builder.
-
* #460: Allow limiting the depth of section numbers for HTML.
* #138: Add an ``index`` role, to make inline index entries.
@@ -26,11 +26,17 @@ Release 1.1 (in development)
* #526: Added Iranian translation.
-Release 1.0.4 (Sep 17, 2010)
-============================
+Release 1.0.5 (in development)
+==============================
+
+* #535: Fix LaTeX output generated for line blocks.
* #544: Allow ``.pyw`` as a source file extension.
+
+Release 1.0.4 (Sep 17, 2010)
+============================
+
* #524: Open intersphinx inventories in binary mode on Windows,
since version 2 contains zlib-compressed data.
diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py
index de0021656..69d2cebf9 100644
--- a/sphinx/builders/qthelp.py
+++ b/sphinx/builders/qthelp.py
@@ -23,7 +23,7 @@ from sphinx.builders.html import StandaloneHTMLBuilder
_idpattern = re.compile(
- r'(?P
.+) (\((?P[\w\.]+)( (?P\w+))?\))$')
+ r'(?P.+) (\((class in )?(?P[\w\.]+)( (?P\w+))?\))$')
# Qt Help Collection Project (.qhcp).
@@ -143,7 +143,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
# keywords
keywords = []
- index = self.env.create_index(self)
+ index = self.env.create_index(self, group_entries=False)
for (key, group) in index:
for title, (refs, subitems) in group:
keywords.extend(self.build_keywords(title, refs, subitems))
diff --git a/sphinx/environment.py b/sphinx/environment.py
index 85d43fcbf..0efdcdd34 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -1473,7 +1473,8 @@ class BuildEnvironment:
return rewrite_needed
- def create_index(self, builder, _fixre=re.compile(r'(.*) ([(][^()]*[)])')):
+ def create_index(self, builder, group_entries=True,
+ _fixre=re.compile(r'(.*) ([(][^()]*[)])')):
"""Create the real index from the collected index entries."""
new = {}
@@ -1538,34 +1539,35 @@ class BuildEnvironment:
newlist = new.items()
newlist.sort(key=keyfunc)
- # fixup entries: transform
- # func() (in module foo)
- # func() (in module bar)
- # into
- # func()
- # (in module foo)
- # (in module bar)
- oldkey = ''
- oldsubitems = None
- i = 0
- while i < len(newlist):
- key, (targets, subitems) = newlist[i]
- # cannot move if it has subitems; structure gets too complex
- if not subitems:
- m = _fixre.match(key)
- if m:
- if oldkey == m.group(1):
- # prefixes match: add entry as subitem of the
- # previous entry
- oldsubitems.setdefault(m.group(2), [[], {}])[0].\
- extend(targets)
- del newlist[i]
- continue
- oldkey = m.group(1)
- else:
- oldkey = key
- oldsubitems = subitems
- i += 1
+ if group_entries:
+ # fixup entries: transform
+ # func() (in module foo)
+ # func() (in module bar)
+ # into
+ # func()
+ # (in module foo)
+ # (in module bar)
+ oldkey = ''
+ oldsubitems = None
+ i = 0
+ while i < len(newlist):
+ key, (targets, subitems) = newlist[i]
+ # cannot move if it has subitems; structure gets too complex
+ if not subitems:
+ m = _fixre.match(key)
+ if m:
+ if oldkey == m.group(1):
+ # prefixes match: add entry as subitem of the
+ # previous entry
+ oldsubitems.setdefault(m.group(2), [[], {}])[0].\
+ extend(targets)
+ del newlist[i]
+ continue
+ oldkey = m.group(1)
+ else:
+ oldkey = key
+ oldsubitems = subitems
+ i += 1
# group the entries by letter
def keyfunc2(item, letters=string.ascii_uppercase + '_'):
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index bba3c66df..423af3ae8 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -547,6 +547,7 @@ if "%%1" == "clean" (
if "%%1" == "html" (
\t%%SPHINXBUILD%% -b html %%ALLSPHINXOPTS%% %%BUILDDIR%%/html
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished. The HTML pages are in %%BUILDDIR%%/html.
\tgoto end
@@ -554,6 +555,7 @@ if "%%1" == "html" (
if "%%1" == "dirhtml" (
\t%%SPHINXBUILD%% -b dirhtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/dirhtml
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished. The HTML pages are in %%BUILDDIR%%/dirhtml.
\tgoto end
@@ -561,6 +563,7 @@ if "%%1" == "dirhtml" (
if "%%1" == "singlehtml" (
\t%%SPHINXBUILD%% -b singlehtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/singlehtml
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished. The HTML pages are in %%BUILDDIR%%/singlehtml.
\tgoto end
@@ -568,6 +571,7 @@ if "%%1" == "singlehtml" (
if "%%1" == "pickle" (
\t%%SPHINXBUILD%% -b pickle %%ALLSPHINXOPTS%% %%BUILDDIR%%/pickle
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished; now you can process the pickle files.
\tgoto end
@@ -575,6 +579,7 @@ if "%%1" == "pickle" (
if "%%1" == "json" (
\t%%SPHINXBUILD%% -b json %%ALLSPHINXOPTS%% %%BUILDDIR%%/json
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished; now you can process the JSON files.
\tgoto end
@@ -582,6 +587,7 @@ if "%%1" == "json" (
if "%%1" == "htmlhelp" (
\t%%SPHINXBUILD%% -b htmlhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/htmlhelp
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %%BUILDDIR%%/htmlhelp.
@@ -590,6 +596,7 @@ if "%%1" == "htmlhelp" (
if "%%1" == "qthelp" (
\t%%SPHINXBUILD%% -b qthelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/qthelp
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %%BUILDDIR%%/qthelp, like this:
@@ -601,6 +608,7 @@ if "%%1" == "qthelp" (
if "%%1" == "devhelp" (
\t%%SPHINXBUILD%% -b devhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/devhelp
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished.
\tgoto end
@@ -608,6 +616,7 @@ if "%%1" == "devhelp" (
if "%%1" == "epub" (
\t%%SPHINXBUILD%% -b epub %%ALLSPHINXOPTS%% %%BUILDDIR%%/epub
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished. The epub file is in %%BUILDDIR%%/epub.
\tgoto end
@@ -615,6 +624,7 @@ if "%%1" == "epub" (
if "%%1" == "latex" (
\t%%SPHINXBUILD%% -b latex %%ALLSPHINXOPTS%% %%BUILDDIR%%/latex
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished; the LaTeX files are in %%BUILDDIR%%/latex.
\tgoto end
@@ -622,6 +632,7 @@ if "%%1" == "latex" (
if "%%1" == "text" (
\t%%SPHINXBUILD%% -b text %%ALLSPHINXOPTS%% %%BUILDDIR%%/text
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished. The text files are in %%BUILDDIR%%/text.
\tgoto end
@@ -629,6 +640,7 @@ if "%%1" == "text" (
if "%%1" == "man" (
\t%%SPHINXBUILD%% -b man %%ALLSPHINXOPTS%% %%BUILDDIR%%/man
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Build finished. The manual pages are in %%BUILDDIR%%/man.
\tgoto end
@@ -643,6 +655,7 @@ if "%%1" == "gettext" (
if "%%1" == "changes" (
\t%%SPHINXBUILD%% -b changes %%ALLSPHINXOPTS%% %%BUILDDIR%%/changes
+\tif errorlevel 1 exit /b 1
\techo.
\techo.The overview file is in %%BUILDDIR%%/changes.
\tgoto end
@@ -650,6 +663,7 @@ if "%%1" == "changes" (
if "%%1" == "linkcheck" (
\t%%SPHINXBUILD%% -b linkcheck %%ALLSPHINXOPTS%% %%BUILDDIR%%/linkcheck
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Link check complete; look for any errors in the above output ^
or in %%BUILDDIR%%/linkcheck/output.txt.
@@ -658,6 +672,7 @@ or in %%BUILDDIR%%/linkcheck/output.txt.
if "%%1" == "doctest" (
\t%%SPHINXBUILD%% -b doctest %%ALLSPHINXOPTS%% %%BUILDDIR%%/doctest
+\tif errorlevel 1 exit /b 1
\techo.
\techo.Testing of doctests in the sources finished, look at the ^
results in %%BUILDDIR%%/doctest/output.txt.
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index cee4dc566..bc8df37b8 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -16,6 +16,7 @@
\RequirePackage{amsmath} % for \text
\RequirePackage{makeidx}
\RequirePackage{framed}
+\RequirePackage{ifthen}
\RequirePackage{color}
% For highlighted code.
\RequirePackage{fancyvrb}
@@ -209,7 +210,7 @@
{\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
\titleformat{\subsubsection}{\py@HeaderFamily}%
{\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
-\titleformat{\paragraph}{\large\py@HeaderFamily}%
+\titleformat{\paragraph}{\small\py@HeaderFamily}%
{\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}
% {fulllineitems} is the main environment for object descriptions.
@@ -462,3 +463,21 @@
{#2}% node content
}% close "span"
}
+
+\providecommand*{\DUprovidelength}[2]{
+ \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
+}
+
+\DUprovidelength{\DUlineblockindent}{2.5em}
+\ifthenelse{\isundefined{\DUlineblock}}{
+ \newenvironment{DUlineblock}[1]{%
+ \list{}{\setlength{\partopsep}{\parskip}
+ \addtolength{\partopsep}{\baselineskip}
+ \setlength{\topsep}{0pt}
+ \setlength{\itemsep}{0.15\baselineskip}
+ \setlength{\parsep}{0pt}
+ \setlength{\leftmargin}{#1}}
+ \raggedright
+ }
+ {\endlist}
+}{}
\ No newline at end of file
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index 2ded01e3e..9322de14d 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -1230,31 +1230,19 @@ class LaTeXTranslator(nodes.NodeVisitor):
visit_doctest_block = visit_literal_block
depart_doctest_block = depart_literal_block
- def visit_line_block(self, node):
- """line-block:
- * whitespace (including linebreaks) is significant
- * inline markup is supported.
- * serif typeface
- """
- self.body.append('\n{\\raggedright{}')
- self.literal_whitespace += 1
- def depart_line_block(self, node):
- self.literal_whitespace -= 1
- # remove the last \\
- del self.body[-1]
- self.body.append('}\n')
-
def visit_line(self, node):
- self._line_start = len(self.body)
+ self.body.append('\item[] ')
def depart_line(self, node):
- if self._line_start == len(self.body):
- # no output in this line -- add a nonbreaking space, else the
- # \\ command will give an error
- self.body.append('~')
- if self.table is not None:
- self.body.append('\\newline\n')
+ self.body.append('\n')
+
+ def visit_line_block(self, node):
+ if isinstance(node.parent, nodes.line_block):
+ self.body.append('\\item[]\n'
+ '\\begin{DUlineblock}{\\DUlineblockindent}\n')
else:
- self.body.append('\\\\\n')
+ self.body.append('\n\\begin{DUlineblock}{0em}\n')
+ def depart_line_block(self, node):
+ self.body.append('\\end{DUlineblock}\n')
def visit_block_quote(self, node):
# If the block quote contains a single object and that object
diff --git a/tests/root/markup.txt b/tests/root/markup.txt
index 84d9581ad..fab6d78c0 100644
--- a/tests/root/markup.txt
+++ b/tests/root/markup.txt
@@ -34,6 +34,16 @@ Option list:
-h help
--help also help
+Line block:
+
+| line1
+| line2
+| line3
+| line4
+| line5
+| line6
+| line7
+
Body directives
^^^^^^^^^^^^^^^