merge with 1.0

This commit is contained in:
Georg Brandl 2010-10-22 19:26:28 +02:00
commit 5edd11b245
7 changed files with 98 additions and 58 deletions

14
CHANGES
View File

@ -3,13 +3,13 @@ Release 1.1 (in development)
* Added Python 3.x support. * Added Python 3.x support.
* Added a Texinfo builder.
* Added i18n support for content, a ``gettext`` builder and * Added i18n support for content, a ``gettext`` builder and
related utilities. related utilities.
* Added the ``websupport`` library. * Added the ``websupport`` library.
* Added a Texinfo builder.
* #460: Allow limiting the depth of section numbers for HTML. * #460: Allow limiting the depth of section numbers for HTML.
* #138: Add an ``index`` role, to make inline index entries. * #138: Add an ``index`` role, to make inline index entries.
@ -26,11 +26,17 @@ Release 1.1 (in development)
* #526: Added Iranian translation. * #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. * #544: Allow ``.pyw`` as a source file extension.
Release 1.0.4 (Sep 17, 2010)
============================
* #524: Open intersphinx inventories in binary mode on Windows, * #524: Open intersphinx inventories in binary mode on Windows,
since version 2 contains zlib-compressed data. since version 2 contains zlib-compressed data.

View File

@ -23,7 +23,7 @@ from sphinx.builders.html import StandaloneHTMLBuilder
_idpattern = re.compile( _idpattern = re.compile(
r'(?P<title>.+) (\((?P<id>[\w\.]+)( (?P<descr>\w+))?\))$') r'(?P<title>.+) (\((class in )?(?P<id>[\w\.]+)( (?P<descr>\w+))?\))$')
# Qt Help Collection Project (.qhcp). # Qt Help Collection Project (.qhcp).
@ -143,7 +143,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
# keywords # keywords
keywords = [] keywords = []
index = self.env.create_index(self) index = self.env.create_index(self, group_entries=False)
for (key, group) in index: for (key, group) in index:
for title, (refs, subitems) in group: for title, (refs, subitems) in group:
keywords.extend(self.build_keywords(title, refs, subitems)) keywords.extend(self.build_keywords(title, refs, subitems))

View File

@ -1473,7 +1473,8 @@ class BuildEnvironment:
return rewrite_needed 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.""" """Create the real index from the collected index entries."""
new = {} new = {}
@ -1538,34 +1539,35 @@ class BuildEnvironment:
newlist = new.items() newlist = new.items()
newlist.sort(key=keyfunc) newlist.sort(key=keyfunc)
# fixup entries: transform if group_entries:
# func() (in module foo) # fixup entries: transform
# func() (in module bar) # func() (in module foo)
# into # func() (in module bar)
# func() # into
# (in module foo) # func()
# (in module bar) # (in module foo)
oldkey = '' # (in module bar)
oldsubitems = None oldkey = ''
i = 0 oldsubitems = None
while i < len(newlist): i = 0
key, (targets, subitems) = newlist[i] while i < len(newlist):
# cannot move if it has subitems; structure gets too complex key, (targets, subitems) = newlist[i]
if not subitems: # cannot move if it has subitems; structure gets too complex
m = _fixre.match(key) if not subitems:
if m: m = _fixre.match(key)
if oldkey == m.group(1): if m:
# prefixes match: add entry as subitem of the if oldkey == m.group(1):
# previous entry # prefixes match: add entry as subitem of the
oldsubitems.setdefault(m.group(2), [[], {}])[0].\ # previous entry
extend(targets) oldsubitems.setdefault(m.group(2), [[], {}])[0].\
del newlist[i] extend(targets)
continue del newlist[i]
oldkey = m.group(1) continue
else: oldkey = m.group(1)
oldkey = key else:
oldsubitems = subitems oldkey = key
i += 1 oldsubitems = subitems
i += 1
# group the entries by letter # group the entries by letter
def keyfunc2(item, letters=string.ascii_uppercase + '_'): def keyfunc2(item, letters=string.ascii_uppercase + '_'):

View File

@ -547,6 +547,7 @@ if "%%1" == "clean" (
if "%%1" == "html" ( if "%%1" == "html" (
\t%%SPHINXBUILD%% -b html %%ALLSPHINXOPTS%% %%BUILDDIR%%/html \t%%SPHINXBUILD%% -b html %%ALLSPHINXOPTS%% %%BUILDDIR%%/html
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. The HTML pages are in %%BUILDDIR%%/html. \techo.Build finished. The HTML pages are in %%BUILDDIR%%/html.
\tgoto end \tgoto end
@ -554,6 +555,7 @@ if "%%1" == "html" (
if "%%1" == "dirhtml" ( if "%%1" == "dirhtml" (
\t%%SPHINXBUILD%% -b dirhtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/dirhtml \t%%SPHINXBUILD%% -b dirhtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/dirhtml
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. The HTML pages are in %%BUILDDIR%%/dirhtml. \techo.Build finished. The HTML pages are in %%BUILDDIR%%/dirhtml.
\tgoto end \tgoto end
@ -561,6 +563,7 @@ if "%%1" == "dirhtml" (
if "%%1" == "singlehtml" ( if "%%1" == "singlehtml" (
\t%%SPHINXBUILD%% -b singlehtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/singlehtml \t%%SPHINXBUILD%% -b singlehtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/singlehtml
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. The HTML pages are in %%BUILDDIR%%/singlehtml. \techo.Build finished. The HTML pages are in %%BUILDDIR%%/singlehtml.
\tgoto end \tgoto end
@ -568,6 +571,7 @@ if "%%1" == "singlehtml" (
if "%%1" == "pickle" ( if "%%1" == "pickle" (
\t%%SPHINXBUILD%% -b pickle %%ALLSPHINXOPTS%% %%BUILDDIR%%/pickle \t%%SPHINXBUILD%% -b pickle %%ALLSPHINXOPTS%% %%BUILDDIR%%/pickle
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished; now you can process the pickle files. \techo.Build finished; now you can process the pickle files.
\tgoto end \tgoto end
@ -575,6 +579,7 @@ if "%%1" == "pickle" (
if "%%1" == "json" ( if "%%1" == "json" (
\t%%SPHINXBUILD%% -b json %%ALLSPHINXOPTS%% %%BUILDDIR%%/json \t%%SPHINXBUILD%% -b json %%ALLSPHINXOPTS%% %%BUILDDIR%%/json
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished; now you can process the JSON files. \techo.Build finished; now you can process the JSON files.
\tgoto end \tgoto end
@ -582,6 +587,7 @@ if "%%1" == "json" (
if "%%1" == "htmlhelp" ( if "%%1" == "htmlhelp" (
\t%%SPHINXBUILD%% -b htmlhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/htmlhelp \t%%SPHINXBUILD%% -b htmlhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/htmlhelp
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished; now you can run HTML Help Workshop with the ^ \techo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %%BUILDDIR%%/htmlhelp. .hhp project file in %%BUILDDIR%%/htmlhelp.
@ -590,6 +596,7 @@ if "%%1" == "htmlhelp" (
if "%%1" == "qthelp" ( if "%%1" == "qthelp" (
\t%%SPHINXBUILD%% -b qthelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/qthelp \t%%SPHINXBUILD%% -b qthelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/qthelp
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished; now you can run "qcollectiongenerator" with the ^ \techo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %%BUILDDIR%%/qthelp, like this: .qhcp project file in %%BUILDDIR%%/qthelp, like this:
@ -601,6 +608,7 @@ if "%%1" == "qthelp" (
if "%%1" == "devhelp" ( if "%%1" == "devhelp" (
\t%%SPHINXBUILD%% -b devhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/devhelp \t%%SPHINXBUILD%% -b devhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/devhelp
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. \techo.Build finished.
\tgoto end \tgoto end
@ -608,6 +616,7 @@ if "%%1" == "devhelp" (
if "%%1" == "epub" ( if "%%1" == "epub" (
\t%%SPHINXBUILD%% -b epub %%ALLSPHINXOPTS%% %%BUILDDIR%%/epub \t%%SPHINXBUILD%% -b epub %%ALLSPHINXOPTS%% %%BUILDDIR%%/epub
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. The epub file is in %%BUILDDIR%%/epub. \techo.Build finished. The epub file is in %%BUILDDIR%%/epub.
\tgoto end \tgoto end
@ -615,6 +624,7 @@ if "%%1" == "epub" (
if "%%1" == "latex" ( if "%%1" == "latex" (
\t%%SPHINXBUILD%% -b latex %%ALLSPHINXOPTS%% %%BUILDDIR%%/latex \t%%SPHINXBUILD%% -b latex %%ALLSPHINXOPTS%% %%BUILDDIR%%/latex
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished; the LaTeX files are in %%BUILDDIR%%/latex. \techo.Build finished; the LaTeX files are in %%BUILDDIR%%/latex.
\tgoto end \tgoto end
@ -622,6 +632,7 @@ if "%%1" == "latex" (
if "%%1" == "text" ( if "%%1" == "text" (
\t%%SPHINXBUILD%% -b text %%ALLSPHINXOPTS%% %%BUILDDIR%%/text \t%%SPHINXBUILD%% -b text %%ALLSPHINXOPTS%% %%BUILDDIR%%/text
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. The text files are in %%BUILDDIR%%/text. \techo.Build finished. The text files are in %%BUILDDIR%%/text.
\tgoto end \tgoto end
@ -629,6 +640,7 @@ if "%%1" == "text" (
if "%%1" == "man" ( if "%%1" == "man" (
\t%%SPHINXBUILD%% -b man %%ALLSPHINXOPTS%% %%BUILDDIR%%/man \t%%SPHINXBUILD%% -b man %%ALLSPHINXOPTS%% %%BUILDDIR%%/man
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Build finished. The manual pages are in %%BUILDDIR%%/man. \techo.Build finished. The manual pages are in %%BUILDDIR%%/man.
\tgoto end \tgoto end
@ -643,6 +655,7 @@ if "%%1" == "gettext" (
if "%%1" == "changes" ( if "%%1" == "changes" (
\t%%SPHINXBUILD%% -b changes %%ALLSPHINXOPTS%% %%BUILDDIR%%/changes \t%%SPHINXBUILD%% -b changes %%ALLSPHINXOPTS%% %%BUILDDIR%%/changes
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.The overview file is in %%BUILDDIR%%/changes. \techo.The overview file is in %%BUILDDIR%%/changes.
\tgoto end \tgoto end
@ -650,6 +663,7 @@ if "%%1" == "changes" (
if "%%1" == "linkcheck" ( if "%%1" == "linkcheck" (
\t%%SPHINXBUILD%% -b linkcheck %%ALLSPHINXOPTS%% %%BUILDDIR%%/linkcheck \t%%SPHINXBUILD%% -b linkcheck %%ALLSPHINXOPTS%% %%BUILDDIR%%/linkcheck
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Link check complete; look for any errors in the above output ^ \techo.Link check complete; look for any errors in the above output ^
or in %%BUILDDIR%%/linkcheck/output.txt. or in %%BUILDDIR%%/linkcheck/output.txt.
@ -658,6 +672,7 @@ or in %%BUILDDIR%%/linkcheck/output.txt.
if "%%1" == "doctest" ( if "%%1" == "doctest" (
\t%%SPHINXBUILD%% -b doctest %%ALLSPHINXOPTS%% %%BUILDDIR%%/doctest \t%%SPHINXBUILD%% -b doctest %%ALLSPHINXOPTS%% %%BUILDDIR%%/doctest
\tif errorlevel 1 exit /b 1
\techo. \techo.
\techo.Testing of doctests in the sources finished, look at the ^ \techo.Testing of doctests in the sources finished, look at the ^
results in %%BUILDDIR%%/doctest/output.txt. results in %%BUILDDIR%%/doctest/output.txt.

View File

@ -16,6 +16,7 @@
\RequirePackage{amsmath} % for \text \RequirePackage{amsmath} % for \text
\RequirePackage{makeidx} \RequirePackage{makeidx}
\RequirePackage{framed} \RequirePackage{framed}
\RequirePackage{ifthen}
\RequirePackage{color} \RequirePackage{color}
% For highlighted code. % For highlighted code.
\RequirePackage{fancyvrb} \RequirePackage{fancyvrb}
@ -209,7 +210,7 @@
{\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
\titleformat{\subsubsection}{\py@HeaderFamily}% \titleformat{\subsubsection}{\py@HeaderFamily}%
{\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} {\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} {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}
% {fulllineitems} is the main environment for object descriptions. % {fulllineitems} is the main environment for object descriptions.
@ -462,3 +463,21 @@
{#2}% node content {#2}% node content
}% close "span" }% 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}
}{}

View File

@ -1230,31 +1230,19 @@ class LaTeXTranslator(nodes.NodeVisitor):
visit_doctest_block = visit_literal_block visit_doctest_block = visit_literal_block
depart_doctest_block = depart_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): def visit_line(self, node):
self._line_start = len(self.body) self.body.append('\item[] ')
def depart_line(self, node): def depart_line(self, node):
if self._line_start == len(self.body): self.body.append('\n')
# no output in this line -- add a nonbreaking space, else the
# \\ command will give an error def visit_line_block(self, node):
self.body.append('~') if isinstance(node.parent, nodes.line_block):
if self.table is not None: self.body.append('\\item[]\n'
self.body.append('\\newline\n') '\\begin{DUlineblock}{\\DUlineblockindent}\n')
else: 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): def visit_block_quote(self, node):
# If the block quote contains a single object and that object # If the block quote contains a single object and that object

View File

@ -34,6 +34,16 @@ Option list:
-h help -h help
--help also help --help also help
Line block:
| line1
| line2
| line3
| line4
| line5
| line6
| line7
Body directives Body directives
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^