merge with 1.0

This commit is contained in:
Georg Brandl 2011-01-06 13:07:07 +01:00
commit 0d1a8e5720
8 changed files with 54 additions and 10 deletions

View File

@ -60,6 +60,13 @@ Release 1.1 (in development)
Release 1.0.7 (in development) Release 1.0.7 (in development)
============================== ==============================
* #568: Fix lookup of class attribute documentation on descriptors
so that comment documentation now works.
* Fix traceback with ``only`` directives preceded by targets.
* Fix tracebacks occurring for duplicate C++ domain objects.
Release 1.0.6 (Jan 04, 2011) Release 1.0.6 (Jan 04, 2011)
============================ ============================

View File

@ -28,6 +28,8 @@ Documentation using the default theme
* Heapkeeper: http://heapkeeper.org/ * Heapkeeper: http://heapkeeper.org/
* Hedge: http://documen.tician.de/hedge/ * Hedge: http://documen.tician.de/hedge/
* Kaa: http://doc.freevo.org/api/kaa/ * Kaa: http://doc.freevo.org/api/kaa/
* Leo: http://webpages.charter.net/edreamleo/front.html
* Lino: http://lino.saffre-rumma.ee/
* MeshPy: http://documen.tician.de/meshpy/ * MeshPy: http://documen.tician.de/meshpy/
* mpmath: http://mpmath.googlecode.com/svn/trunk/doc/build/index.html * mpmath: http://mpmath.googlecode.com/svn/trunk/doc/build/index.html
* OpenEXR: http://excamera.com/articles/26/doc/index.html * OpenEXR: http://excamera.com/articles/26/doc/index.html
@ -90,6 +92,7 @@ Documentation using the sphinxdoc theme
* MyHDL: http://www.myhdl.org/doc/0.6/ * MyHDL: http://www.myhdl.org/doc/0.6/
* NetworkX: http://networkx.lanl.gov/ * NetworkX: http://networkx.lanl.gov/
* Pweave: http://mpastell.com/pweave/ * Pweave: http://mpastell.com/pweave/
* Pyre: http://docs.danse.us/pyre/sphinx/
* Pysparse: http://pysparse.sourceforge.net/ * Pysparse: http://pysparse.sourceforge.net/
* PyTango: * PyTango:
http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html

View File

@ -165,7 +165,7 @@ class DefExpr(object):
return unicode(self).encode('utf-8') return unicode(self).encode('utf-8')
def __repr__(self): def __repr__(self):
return '<defexpr %s>' % self return '<%s %s>' % (self.__class__.__name__, self)
class PrimaryDefExpr(DefExpr): class PrimaryDefExpr(DefExpr):
@ -822,13 +822,14 @@ class CPPObject(ObjectDescription):
def add_target_and_index(self, sigobj, sig, signode): def add_target_and_index(self, sigobj, sig, signode):
theid = sigobj.get_id() theid = sigobj.get_id()
name = unicode(sigobj.name) name = unicode(sigobj.name)
signode['names'].append(theid) if theid not in self.state.document.ids:
signode['ids'].append(theid) signode['names'].append(theid)
signode['first'] = (not self.names) signode['ids'].append(theid)
self.state.document.note_explicit_target(signode) signode['first'] = (not self.names)
self.state.document.note_explicit_target(signode)
self.env.domaindata['cpp']['objects'].setdefault(name, self.env.domaindata['cpp']['objects'].setdefault(name,
(self.env.docname, self.objtype, theid)) (self.env.docname, self.objtype, theid))
indextext = self.get_index_text(name) indextext = self.get_index_text(name)
if indextext: if indextext:

View File

@ -1409,7 +1409,9 @@ class BuildEnvironment:
if ret: if ret:
node.replace_self(node.children) node.replace_self(node.children)
else: else:
node.replace_self([]) # replacing by [] would result in an "Losing ids" exception
# if there is a target node before the only node
node.replace_self(nodes.comment())
# allow custom references to be resolved # allow custom references to be resolved
builder.app.emit('doctree-resolved', doctree, fromdocname) builder.app.emit('doctree-resolved', doctree, fromdocname)

View File

@ -1142,6 +1142,10 @@ class AttributeDocumenter(ClassLevelDocumenter):
def document_members(self, all_members=False): def document_members(self, all_members=False):
pass pass
def get_real_modname(self):
return self.get_attr(self.parent or self.object, '__module__', None) \
or self.modname
class InstanceAttributeDocumenter(AttributeDocumenter): class InstanceAttributeDocumenter(AttributeDocumenter):
""" """

View File

@ -102,8 +102,10 @@ class ExtBabel(Babel):
return '\\shorthandoff{"}' return '\\shorthandoff{"}'
return '' return ''
_ISO639_TO_BABEL = Babel._ISO639_TO_BABEL.copy() # in latest trunk, the attribute is called Babel.language_codes and already
_ISO639_TO_BABEL['sl'] = 'slovene' # includes Slovene
if hasattr(Babel, '_ISO639_TO_BABEL'):
Babel._ISO639_TO_BABEL['sl'] = 'slovene'
class Table(object): class Table(object):

View File

@ -161,3 +161,14 @@ User markup
Referencing :userdescrole:`myobj`. Referencing :userdescrole:`myobj`.
CPP domain
==========
.. cpp:class:: n::Array<T,d>
.. cpp:function:: T& operator[]( unsigned j )
.. cpp:function:: const T& operator[]( unsigned j ) const

View File

@ -17,6 +17,7 @@ from docutils.statemachine import ViewList
from sphinx.ext.autodoc import AutoDirective, add_documenter, \ from sphinx.ext.autodoc import AutoDirective, add_documenter, \
ModuleLevelDocumenter, FunctionDocumenter, cut_lines, between, ALL ModuleLevelDocumenter, FunctionDocumenter, cut_lines, between, ALL
from StringIO import StringIO
def setup_module(): def setup_module():
global app, lid, options, directive global app, lid, options, directive
@ -418,6 +419,7 @@ def test_generate():
('attribute', 'test_autodoc.Class.attr'), ('attribute', 'test_autodoc.Class.attr'),
('attribute', 'test_autodoc.Class.docattr'), ('attribute', 'test_autodoc.Class.docattr'),
('attribute', 'test_autodoc.Class.udocattr'), ('attribute', 'test_autodoc.Class.udocattr'),
('attribute', 'test_autodoc.Class.mdocattr'),
('attribute', 'test_autodoc.Class.inst_attr_comment'), ('attribute', 'test_autodoc.Class.inst_attr_comment'),
('attribute', 'test_autodoc.Class.inst_attr_string') ('attribute', 'test_autodoc.Class.inst_attr_string')
]) ])
@ -486,11 +488,19 @@ def test_generate():
' .. py:attribute:: Class.prop', ' .. py:attribute:: Class.prop',
' .. py:attribute:: Class.docattr', ' .. py:attribute:: Class.docattr',
' .. py:attribute:: Class.udocattr', ' .. py:attribute:: Class.udocattr',
' .. py:attribute:: Class.mdocattr',
' .. py:attribute:: Class.inst_attr_comment', ' .. py:attribute:: Class.inst_attr_comment',
' .. py:attribute:: Class.inst_attr_string', ' .. py:attribute:: Class.inst_attr_string',
' .. py:method:: Class.inheritedmeth()', ' .. py:method:: Class.inheritedmeth()',
], ],
'class', 'Class', member_order='bysource', all_members=True) 'class', 'Class', member_order='bysource', all_members=True)
del directive.env.temp_data['py:module']
# test attribute initialized to class instance from other module
directive.env.temp_data['autodoc:class'] = 'test_autodoc.Class'
assert_result_contains(u' should be documented as well - s\xfc\xdf',
'attribute', 'mdocattr')
del directive.env.temp_data['autodoc:class']
# test autodoc_docstring_signature # test autodoc_docstring_signature
assert_result_contains( assert_result_contains(
@ -561,6 +571,10 @@ class Class(Base):
udocattr = 'quux' udocattr = 'quux'
u"""should be documented as well - süß""" u"""should be documented as well - süß"""
# initialized to any class imported from another module
mdocattr = StringIO()
"""should be documented as well - süß"""
def __init__(self, arg): def __init__(self, arg):
#: a documented instance attribute #: a documented instance attribute
self.inst_attr_comment = None self.inst_attr_comment = None