Merge stable into default.

This commit is contained in:
Georg Brandl 2011-11-01 15:41:58 +01:00
commit a50cfec8c4
16 changed files with 57 additions and 31 deletions

25
CHANGES
View File

@ -2,6 +2,22 @@ Release 1.2 (in development)
============================
Release 1.1.1 (Nov 1, 2011)
===========================
* #791: Fix QtHelp, DevHelp and HtmlHelp index entry links.
* #792: Include "sphinx-apidoc" in the source distribution.
* #797: Don't crash on a misformatted glossary.
* #801: Make intersphinx work properly without SSL support.
* #805: Make the ``Sphinx.add_index_to_domain`` method work correctly.
* #780: Fix Python 2.5 compatibility.
Release 1.1 (Oct 9, 2011)
=========================
@ -119,13 +135,10 @@ Features added
- #714: Added Korean locale.
- #766: Added Estonian locale.
* Bugs fixed:
Release 1.0.9 (in development)
==============================
* #778: Fix "hide search matches" link on pages linked by search.
* Fix the source positions referenced by the "viewcode" extension.
- #778: Fix "hide search matches" link on pages linked by search.
- Fix the source positions referenced by the "viewcode" extension.
Release 1.0.8 (Sep 23, 2011)

View File

@ -11,6 +11,7 @@ include distribute_setup.py
include sphinx-autogen.py
include sphinx-build.py
include sphinx-quickstart.py
include sphinx-apidoc.py
recursive-include sphinx/texinputs *
recursive-include sphinx/themes *

View File

@ -115,11 +115,8 @@ the following public API:
<http://docutils.sourceforge.net/docs/howto/rst-directives.html>`_ for
details.
The directive class normally must inherit from the class
``docutils.parsers.rst.Directive``. When writing a directive for usage in
a Sphinx extension, you inherit from ``sphinx.util.compat.Directive``
instead which does the right thing even on docutils 0.4 (which doesn't
support directive classes otherwise).
The directive class must inherit from the class
``docutils.parsers.rst.Directive``.
For example, the (already existing) :rst:dir:`literalinclude` directive would be
added like this:

View File

@ -51,7 +51,7 @@ Prerequisites
-------------
Sphinx needs at least **Python 2.4** or **Python 3.1** to run, as well as the
docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.5
docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.7
or some (not broken) SVN trunk snapshot. If you like to have source code
highlighting support, you must also install the Pygments_ library.

View File

@ -8,7 +8,8 @@
creates a modules index (named modules.<suffix>).
This is derived from the "sphinx-autopackage" script, which is:
Copyright 2008 Société des arts technologiques (SAT), http://www.sat.qc.ca/
Copyright 2008 Société des arts technologiques (SAT),
http://www.sat.qc.ca/
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.

View File

@ -425,11 +425,10 @@ class Sphinx(object):
raise ExtensionError('domain %s not yet registered' % domain)
self.domains[domain].roles[name] = role
def add_index_to_domain(self, domain, name, localname, shortname, func):
def add_index_to_domain(self, domain, index):
if domain not in self.domains:
raise ExtensionError('domain %s not yet registered' % domain)
self.domains[domain].indices.append((name, localname, shortname))
setattr(self.domains[domain], 'get_%s_index' % name, func)
self.domains[domain].indices.append(index)
def add_object_type(self, directivename, rolename, indextemplate='',
parse_node=None, ref_nodeclass=None, objname='',

View File

@ -107,12 +107,12 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
pass
elif len(refs) == 1:
etree.SubElement(functions, 'function',
name=title, link=refs[0])
name=title, link=refs[0][1])
else:
for i, ref in enumerate(refs):
etree.SubElement(functions, 'function',
name="[%d] %s" % (i, title),
link=ref)
link=ref[1])
if subitems:
parent_title = re.sub(r'\s*\(.*\)\s*$', '', title)

View File

@ -258,7 +258,8 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder):
f.write('<UL>\n')
def write_index(title, refs, subitems):
def write_param(name, value):
item = ' <param name="%s" value="%s">\n' % (name, value)
item = ' <param name="%s" value="%s">\n' % \
(name, value[1])
f.write(item)
title = cgi.escape(title)
f.write('<LI> <OBJECT type="text/sitemap">\n')

View File

@ -256,7 +256,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
groupdict = matchobj.groupdict()
shortname = groupdict['title']
id = groupdict.get('id')
# descr = groupdict.get('descr')
#descr = groupdict.get('descr')
if shortname.endswith('()'):
shortname = shortname[:-2]
id = '%s.%s' % (id, shortname)
@ -265,9 +265,9 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
if id:
item = ' '*12 + '<keyword name="%s" id="%s" ref="%s"/>' % (
name, id, ref)
name, id, ref[1])
else:
item = ' '*12 + '<keyword name="%s" ref="%s"/>' % (name, ref)
item = ' '*12 + '<keyword name="%s" ref="%s"/>' % (name, ref[1])
item.encode('ascii', 'xmlcharrefreplace')
return item

View File

@ -259,13 +259,23 @@ class Glossary(Directive):
messages.append(self.state.reporter.system_message(
2, 'glossary terms must not be separated by empty '
'lines', source=source, line=lineno))
if entries:
entries[-1][0].append((line, source, lineno))
else:
messages.append(self.state.reporter.system_message(
2, 'glossary seems to be misformatted, check '
'indentation', source=source, line=lineno))
else:
if not in_definition:
# first line of definition, determines indentation
in_definition = True
indent_len = len(line) - len(line.lstrip())
if entries:
entries[-1][1].append(line[indent_len:], source, lineno)
else:
messages.append(self.state.reporter.system_message(
2, 'glossary seems to be misformatted, check '
'indentation', source=source, line=lineno))
was_empty = False
# now, parse all the entries into a big definition list

View File

@ -198,7 +198,7 @@ class Locale(Transform):
settings, source = self.document.settings, self.document['source']
# XXX check if this is reliable
assert source.startswith(env.srcdir)
docname = path.splitext(relative_path(source, env.srcdir))[0]
docname = path.splitext(relative_path(env.srcdir, source))[0]
textdomain = find_catalog(docname,
self.document.settings.gettext_compact)

View File

@ -27,6 +27,7 @@ import optparse
from jinja2 import FileSystemLoader, TemplateNotFound
from jinja2.sandbox import SandboxedEnvironment
from sphinx import package_dir
from sphinx.ext.autosummary import import_by_name, get_documenter
from sphinx.jinja2glue import BuiltinTemplateLoader
from sphinx.util.osutil import ensuredir
@ -78,7 +79,8 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
sources = [os.path.join(base_path, filename) for filename in sources]
# create our own templating environment
template_dirs = [os.path.join(os.path.dirname(__file__), 'templates')]
template_dirs = [os.path.join(package_dir, 'ext',
'autosummary', 'templates')]
if builder is not None:
# allow the user to override the templates
template_loader = BuiltinTemplateLoader()

View File

@ -42,7 +42,7 @@ handlers = [urllib2.ProxyHandler(), urllib2.HTTPRedirectHandler(),
urllib2.HTTPHandler()]
try:
handlers.append(urllib2.HTTPSHandler)
except NameError:
except AttributeError:
pass
urllib2.install_opener(urllib2.build_opener(*handlers))

View File

@ -11,6 +11,7 @@
from os import path
from sphinx import package_dir
from sphinx.errors import PycodeError
from sphinx.pycode import nodes
from sphinx.pycode.pgen2 import driver, token, tokenize, parse, literals
@ -20,7 +21,7 @@ from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc
# load the Python grammar
_grammarfile = path.join(path.dirname(__file__), 'Grammar.txt')
_grammarfile = path.join(package_dir, 'pycode', 'Grammar.txt')
pygrammar = driver.load_grammar(_grammarfile)
pydriver = driver.Driver(pygrammar, convert=nodes.convert)

View File

@ -267,8 +267,9 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('%(master_str)s', '%(project_fn)s', u'%(project_doc_str)s', u'%(author_str)s',
'%(project_fn)s', 'One line description of project.', 'Miscellaneous'),
('%(master_str)s', '%(project_fn)s', u'%(project_doc_str)s',
u'%(author_str)s', '%(project_fn)s', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.

View File

@ -87,7 +87,7 @@ class WebSupport(object):
def _init_templating(self):
import sphinx
template_path = path.join(path.dirname(sphinx.__file__),
template_path = path.join(sphinx.package_dir,
'themes', 'basic')
loader = FileSystemLoader(template_path)
self.template_env = Environment(loader=loader)