Georg Brandl avatar Georg Brandl committed 4d19a76 Merge

merge with 1.0

Comments (0)

Files changed (9)

 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)
 ============================
 * Heapkeeper: http://heapkeeper.org/
 * Hedge: http://documen.tician.de/hedge/
 * 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/
 * mpmath: http://mpmath.googlecode.com/svn/trunk/doc/build/index.html
 * OpenEXR: http://excamera.com/articles/26/doc/index.html
 * MyHDL: http://www.myhdl.org/doc/0.6/
 * NetworkX: http://networkx.lanl.gov/
 * Pweave: http://mpastell.com/pweave/
+* Pyre: http://docs.danse.us/pyre/sphinx/
 * Pysparse: http://pysparse.sourceforge.net/
 * PyTango:
   http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html

File contents unchanged.

sphinx/domains/cpp.py

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

sphinx/environment.py

                 if ret:
                     node.replace_self(node.children)
                 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
         builder.app.emit('doctree-resolved', doctree, fromdocname)

sphinx/ext/autodoc.py

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

sphinx/writers/latex.py

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

tests/root/objects.txt

 
 
 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
+

tests/test_autodoc.py

 from sphinx.ext.autodoc import AutoDirective, add_documenter, \
      ModuleLevelDocumenter, FunctionDocumenter, cut_lines, between, ALL
 
+from StringIO import StringIO
 
 def setup_module():
     global app, lid, options, directive
                    ('attribute', 'test_autodoc.Class.attr'),
                    ('attribute', 'test_autodoc.Class.docattr'),
                    ('attribute', 'test_autodoc.Class.udocattr'),
+                   ('attribute', 'test_autodoc.Class.mdocattr'),
                    ('attribute', 'test_autodoc.Class.inst_attr_comment'),
                    ('attribute', 'test_autodoc.Class.inst_attr_string')
                    ])
                   '   .. py:attribute:: Class.prop',
                   '   .. py:attribute:: Class.docattr',
                   '   .. py:attribute:: Class.udocattr',
+                  '   .. py:attribute:: Class.mdocattr',
                   '   .. py:attribute:: Class.inst_attr_comment',
                   '   .. py:attribute:: Class.inst_attr_string',
                   '   .. py:method:: Class.inheritedmeth()',
                   ],
                  '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
     assert_result_contains(
     udocattr = 'quux'
     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):
         #: a documented instance attribute
         self.inst_attr_comment = None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.