Commits

Anonymous committed a726d21

Merged revisions 64714-64715,64720,64723 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x

........
r64714 | georg.brandl | 2008-07-04 21:19:02 +0200 (Fri, 04 Jul 2008) | 3 lines

Allow the usage of :noindex: in "automodule" directives, as
documented.
........
r64715 | georg.brandl | 2008-07-04 21:30:22 +0200 (Fri, 04 Jul 2008) | 2 lines

Fix the delete() docstring processor function.
........
r64720 | georg.brandl | 2008-07-05 12:04:41 +0200 (Sat, 05 Jul 2008) | 2 lines

Fix warning for nonexisting images.
........
r64723 | georg.brandl | 2008-07-05 12:21:42 +0200 (Sat, 05 Jul 2008) | 2 lines

Fix JS search in IE.
........

Comments (0)

Files changed (4)

sphinx/builder.py

                         break
                 else:
                     self.warn('%s:%s: no matching candidate for image URI %r' %
-                              (node.source, node.lineno, node['uri']))
+                              (node.source, getattr(node, 'lineno', ''), node['uri']))
                     continue
                 node['uri'] = candidate
             else:

sphinx/directives/other.py

                      content_offset, block_text, state, state_machine):
     env = state.document.settings.env
     modname = arguments[0].strip()
+    noindex = 'noindex' in options
     env.currmodule = modname
     env.note_module(modname, options.get('synopsis', ''),
                     options.get('platform', ''),
         node += nodes.Text(options['platform'], options['platform'])
         ret.append(node)
     # the synopsis isn't printed; in fact, it is only used in the modindex currently
-    env.note_index_entry('single', '%s (module)' % modname, 'module-' + modname,
-                         modname)
+    if not noindex:
+        env.note_index_entry('single', '%s (module)' % modname,
+                             'module-' + modname, modname)
     return ret
 
 module_directive.arguments = (1, 0, 0)
 module_directive.options = {'platform': lambda x: x,
                             'synopsis': lambda x: x,
+                            'noindex': directives.flag,
                             'deprecated': directives.flag}
 directives.register_directive('module', module_directive)
 

sphinx/ext/autodoc.py

             del lines[-post:]
     return process
 
-def between(marker, what=None):
+def between(marker, what=None, keepempty=False):
     """
-    Return a listener that only keeps lines between the first two lines that
-    match the *marker* regular expression.  If *what* is a sequence of strings,
-    only docstrings of a type in *what* will be processed.
+    Return a listener that only keeps lines between lines that match the
+    *marker* regular expression.  If no line matches, the resulting docstring
+    would be empty, so no change will be made unless *keepempty* is true.
+
+    If *what* is a sequence of strings, only docstrings of a type in *what* will
+    be processed.
     """
     marker_re = re.compile(marker)
     def process(app, what_, name, obj, options, lines):
         if what and what_ not in what:
             return
-        seen = 0
-        for i, line in enumerate(lines[:]):
+        deleted = 0
+        delete = True
+        orig_lines = lines[:]
+        for i, line in enumerate(orig_lines):
+            if delete:
+                lines.pop(i - deleted)
+                deleted += 1
             if marker_re.match(line):
-                if not seen:
-                    del lines[:i+1]
-                    seen = i+1
-                else:
-                    del lines[i-seen:]
-                    break
+                delete = not delete
+                if delete:
+                    lines.pop(i - deleted)
+                    deleted += 1
+        if not lines and not keepempty:
+            lines[:] = orig_lines
     return process
 
 
 def auto_directive(*args, **kwds):
     return _auto_directive(*args, **kwds)
 
-def auto_directive_withmembers(*args, **kwds):
+def automodule_directive(*args, **kwds):
+    return _auto_directive(*args, **kwds)
+
+def autoclass_directive(*args, **kwds):
     return _auto_directive(*args, **kwds)
 
 
     cls_options = {'members': members_option, 'undoc-members': directives.flag,
                    'noindex': directives.flag, 'inherited-members': directives.flag,
                    'show-inheritance': directives.flag}
-    app.add_directive('automodule', auto_directive_withmembers,
+    app.add_directive('automodule', automodule_directive,
                       1, (1, 0, 1), **mod_options)
-    app.add_directive('autoclass', auto_directive_withmembers,
+    app.add_directive('autoclass', autoclass_directive,
                       1, (1, 0, 1), **cls_options)
-    app.add_directive('autoexception', auto_directive_withmembers,
+    app.add_directive('autoexception', autoclass_directive,
                       1, (1, 0, 1), **cls_options)
     app.add_directive('autofunction', auto_directive, 1, (1, 0, 1),
                       noindex=directives.flag)

sphinx/templates/layout.html

       var DOCUMENTATION_OPTIONS = {
           URL_ROOT:   '{{ pathto("", 1) }}',
           VERSION:    '{{ release }}',
-          COLLAPSE_MODINDEX: false,
+          COLLAPSE_MODINDEX: false
       };
     </script>
     <script type="text/javascript" src="{{ pathto('_static/jquery.js', 1) }}"></script>
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.