merge with trunk

This commit is contained in:
Georg Brandl 2010-04-06 09:23:03 +02:00
commit 751e02c767
14 changed files with 77 additions and 38 deletions

14
CHANGES
View File

@ -121,6 +121,20 @@ Release 1.0 (in development)
Release 0.6.6 (in development) Release 0.6.6 (in development)
============================== ==============================
* Fix the handling of multiple toctrees when creating the global
TOC for the ``toctree()`` template function.
* Fix the handling of hidden toctrees when creating the global TOC
for the ``toctree()`` template function.
* Fix the handling of nested lists in the text writer.
* #362: In autodoc, check for the existence of ``__self__`` on
function objects before accessing it.
* #353: Strip leading and trailing whitespace when extracting
search words in the search function.
Release 0.6.5 (Mar 01, 2010) Release 0.6.5 (Mar 01, 2010)
============================ ============================

View File

@ -58,6 +58,7 @@ Documentation using a customized version of the default theme
* Bazaar: http://doc.bazaar.canonical.com/en/ * Bazaar: http://doc.bazaar.canonical.com/en/
* Chaco: http://code.enthought.com/projects/chaco/docs/html/ * Chaco: http://code.enthought.com/projects/chaco/docs/html/
* Djagios: http://djagios.org/ * Djagios: http://djagios.org/
* GetFEM++: http://home.gna.org/getfem/
* GPAW: https://wiki.fysik.dtu.dk/gpaw/ * GPAW: https://wiki.fysik.dtu.dk/gpaw/
* Grok: http://grok.zope.org/doc/current/ * Grok: http://grok.zope.org/doc/current/
* IFM: http://fluffybunny.memebot.com/ifm-docs/index.html * IFM: http://fluffybunny.memebot.com/ifm-docs/index.html
@ -99,6 +100,7 @@ Documentation using the sphinxdoc theme
Documentation using another builtin theme Documentation using another builtin theme
----------------------------------------- -----------------------------------------
* C/C++ Development with Eclipse: http://book.dehlia.in/c-cpp-eclipse/ (agogo)
* Distribute: http://packages.python.org/distribute/ (nature) * Distribute: http://packages.python.org/distribute/ (nature)
* Jinja: http://jinja.pocoo.org/2/documentation/ (scrolls) * Jinja: http://jinja.pocoo.org/2/documentation/ (scrolls)
* pip: http://pip.openplans.org/ (nature) * pip: http://pip.openplans.org/ (nature)

View File

@ -114,7 +114,8 @@ The builder's "name" must be given to the **-b** command-line option of
Note that a direct PDF builder using ReportLab is available in `rst2pdf Note that a direct PDF builder using ReportLab is available in `rst2pdf
<http://rst2pdf.googlecode.com>`_ version 0.12 or greater. You need to add <http://rst2pdf.googlecode.com>`_ version 0.12 or greater. You need to add
``'rst2pdf.pdfbuilder'`` to your :confval:`extensions` to enable it, its name is ``'rst2pdf.pdfbuilder'`` to your :confval:`extensions` to enable it, its name is
``pdf``. ``pdf``. Refer to the `rst2pdf manual
<http://lateral.netmanagers.com.ar/static/manual.pdf>`_ for details.
.. module:: sphinx.builders.text .. module:: sphinx.builders.text
.. class:: TextBuilder .. class:: TextBuilder

View File

@ -177,7 +177,7 @@ the following public API:
* If you provide *parse_node*, it must be a function that takes a string and * If you provide *parse_node*, it must be a function that takes a string and
a docutils node, and it must populate the node with children parsed from a docutils node, and it must populate the node with children parsed from
the string. It must then return the name of the item to be used in the string. It must then return the name of the item to be used in
cross-referencing and index entries. See the :file:`ext.py` file in the cross-referencing and index entries. See the :file:`conf.py` file in the
source for this documentation for an example. source for this documentation for an example.
* The *objname* (if not given, will default to *directivename*) names the * The *objname* (if not given, will default to *directivename*) names the
type of object. It is used when listing objects, e.g. in search results. type of object. It is used when listing objects, e.g. in search results.

View File

@ -199,6 +199,8 @@ class StandaloneHTMLBuilder(Builder):
def render_partial(self, node): def render_partial(self, node):
"""Utility: Render a lone doctree node.""" """Utility: Render a lone doctree node."""
if node is None:
return {'fragment': ''}
doc = new_document('<partial node>') doc = new_document('<partial node>')
doc.append(node) doc.append(node)

View File

@ -1022,12 +1022,19 @@ class BuildEnvironment:
def get_toctree_for(self, docname, builder, collapse, maxdepth=0): def get_toctree_for(self, docname, builder, collapse, maxdepth=0):
"""Return the global TOC nodetree.""" """Return the global TOC nodetree."""
doctree = self.get_doctree(self.config.master_doc) doctree = self.get_doctree(self.config.master_doc)
toctrees = []
for toctreenode in doctree.traverse(addnodes.toctree): for toctreenode in doctree.traverse(addnodes.toctree):
result = self.resolve_toctree(docname, builder, toctreenode, toctree = self.resolve_toctree(docname, builder, toctreenode,
prune=True, collapse=collapse, prune=True, collapse=collapse,
maxdepth=maxdepth) maxdepth=maxdepth,
if result is not None: includehidden=True)
return result toctrees.append(toctree)
if not toctrees:
return None
result = toctrees[0]
for toctree in toctrees[1:]:
result.extend(toctree.children)
return result
def get_domain(self, domainname): def get_domain(self, domainname):
"""Return the domain instance with the specified name. """Return the domain instance with the specified name.
@ -1075,7 +1082,7 @@ class BuildEnvironment:
return doctree return doctree
def resolve_toctree(self, docname, builder, toctree, prune=True, maxdepth=0, def resolve_toctree(self, docname, builder, toctree, prune=True, maxdepth=0,
titles_only=False, collapse=False): titles_only=False, collapse=False, includehidden=False):
""" """
Resolve a *toctree* node into individual bullet lists with titles Resolve a *toctree* node into individual bullet lists with titles
as items, returning None (if no containing titles are found) or as items, returning None (if no containing titles are found) or
@ -1088,7 +1095,7 @@ class BuildEnvironment:
If *collapse* is True, all branches not containing docname will If *collapse* is True, all branches not containing docname will
be collapsed. be collapsed.
""" """
if toctree.get('hidden', False): if toctree.get('hidden', False) and not includehidden:
return None return None
def _walk_depth(node, depth, maxdepth): def _walk_depth(node, depth, maxdepth):

View File

@ -1010,6 +1010,7 @@ class MethodDocumenter(ClassLevelDocumenter):
self.member_order = self.member_order - 1 self.member_order = self.member_order - 1
elif isinstance(self.object, FunctionType) or \ elif isinstance(self.object, FunctionType) or \
(isinstance(self.object, BuiltinFunctionType) and (isinstance(self.object, BuiltinFunctionType) and
hasattr(self.object, '__self__') and
self.object.__self__ is not None): self.object.__self__ is not None):
self.directivetype = 'staticmethod' self.directivetype = 'staticmethod'
# document class and static members before ordinary ones # document class and static members before ordinary ones

View File

@ -34,6 +34,7 @@ try:
from pygments.styles import get_style_by_name from pygments.styles import get_style_by_name
from pygments.styles.friendly import FriendlyStyle from pygments.styles.friendly import FriendlyStyle
from pygments.token import Generic, Comment, Number from pygments.token import Generic, Comment, Number
from pygments.util import ClassNotFound
except ImportError: except ImportError:
pygments = None pygments = None
lexers = None lexers = None
@ -173,7 +174,7 @@ class PygmentsBridge(object):
else: else:
return True return True
def highlight_block(self, source, lang, linenos=False): def highlight_block(self, source, lang, linenos=False, warn=None):
if isinstance(source, str): if isinstance(source, str):
source = source.decode() source = source.decode()
if not pygments: if not pygments:
@ -202,8 +203,16 @@ class PygmentsBridge(object):
if lang in lexers: if lang in lexers:
lexer = lexers[lang] lexer = lexers[lang]
else: else:
lexer = lexers[lang] = get_lexer_by_name(lang) try:
lexer.add_filter('raiseonerror') lexer = lexers[lang] = get_lexer_by_name(lang)
except ClassNotFound:
if warn:
warn('Pygments lexer name %s is not known' % lang)
return self.unhighlighted(source)
else:
raise
else:
lexer.add_filter('raiseonerror')
# trim doctest options if wanted # trim doctest options if wanted
if isinstance(lexer, PythonConsoleLexer) and self.trim_doctest_flags: if isinstance(lexer, PythonConsoleLexer) and self.trim_doctest_flags:

View File

@ -42,7 +42,7 @@
</div> </div>
<div class="sidebar"> <div class="sidebar">
{%- block sidebartoc %} {%- block sidebartoc %}
<h3>{{ _('Contents') }}</h3> <h3>{{ _('Table Of Contents') }}</h3>
{{ toctree() }} {{ toctree() }}
{%- endblock %} {%- endblock %}
{%- block sidebarsearch %} {%- block sidebarsearch %}

View File

@ -177,7 +177,7 @@ div.body {
} }
div.document ul { div.document ul {
margin-left: 1.2em; margin: 1.5em;
list-style-type: square; list-style-type: square;
} }
@ -229,6 +229,14 @@ div.document .docutils.xref.literal {
padding: 0px; padding: 0px;
} }
div.document blockquote {
margin: 1em;
}
div.document ol {
margin: 1.5em;
}
/* Sidebar */ /* Sidebar */

View File

@ -7,7 +7,5 @@
:copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details. :license: BSD, see LICENSE for details.
#} #}
{%- if display_toc %} <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
<h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3> {{ toctree() }}
{{ toctree() }}
{%- endif %}

View File

@ -312,8 +312,9 @@ var Search = {
var tmp = query.split(/\s+/); var tmp = query.split(/\s+/);
var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null; var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null;
for (var i = 0; i < tmp.length; i++) { for (var i = 0; i < tmp.length; i++) {
if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/)) { if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
// skip this word tmp[i] == "") {
// skip this "word"
continue; continue;
} }
// stem the word // stem the word

View File

@ -163,11 +163,6 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
div.body p, div.body dd, div.body li {
text-align: justify;
line-height: 130%;
}
div.body h1, div.body h1,
div.body h2, div.body h2,
div.body h3, div.body h3,

View File

@ -54,6 +54,7 @@ class TextTranslator(nodes.NodeVisitor):
self.states = [[]] self.states = [[]]
self.stateindent = [0] self.stateindent = [0]
self.list_counter = []
self.sectionlevel = 0 self.sectionlevel = 0
self.table = None self.table = None
@ -429,38 +430,38 @@ class TextTranslator(nodes.NodeVisitor):
raise nodes.SkipNode raise nodes.SkipNode
def visit_bullet_list(self, node): def visit_bullet_list(self, node):
self._list_counter = -1 self.list_counter.append(-1)
def depart_bullet_list(self, node): def depart_bullet_list(self, node):
pass self.list_counter.pop()
def visit_enumerated_list(self, node): def visit_enumerated_list(self, node):
self._list_counter = 0 self.list_counter.append(0)
def depart_enumerated_list(self, node): def depart_enumerated_list(self, node):
pass self.list_counter.pop()
def visit_definition_list(self, node): def visit_definition_list(self, node):
self._list_counter = -2 self.list_counter.append(-2)
def depart_definition_list(self, node): def depart_definition_list(self, node):
pass self.list_counter.pop()
def visit_list_item(self, node): def visit_list_item(self, node):
if self._list_counter == -1: if self.list_counter[-1] == -1:
# bullet list # bullet list
self.new_state(2) self.new_state(2)
elif self._list_counter == -2: elif self.list_counter[-1] == -2:
# definition list # definition list
pass pass
else: else:
# enumerated list # enumerated list
self._list_counter += 1 self.list_counter[-1] += 1
self.new_state(len(str(self._list_counter)) + 2) self.new_state(len(str(self.list_counter[-1])) + 2)
def depart_list_item(self, node): def depart_list_item(self, node):
if self._list_counter == -1: if self.list_counter[-1] == -1:
self.end_state(first='* ', end=None) self.end_state(first='* ', end=None)
elif self._list_counter == -2: elif self.list_counter[-1] == -2:
pass pass
else: else:
self.end_state(first='%s. ' % self._list_counter, end=None) self.end_state(first='%s. ' % self.list_counter[-1], end=None)
def visit_definition_list_item(self, node): def visit_definition_list_item(self, node):
self._li_has_classifier = len(node) >= 2 and \ self._li_has_classifier = len(node) >= 2 and \