[Python-checkins] r64724 - in doctools/trunk: sphinx/builder.py sphinx/directives/other.py sphinx/ext/autodoc.py sphinx/templates/layout.html
georg.brandl
python-checkins at python.org
Sat Jul 5 12:24:06 CEST 2008
Author: georg.brandl
Date: Sat Jul 5 12:24:06 2008
New Revision: 64724
Log:
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.
........
Modified:
doctools/trunk/ (props changed)
doctools/trunk/sphinx/builder.py
doctools/trunk/sphinx/directives/other.py
doctools/trunk/sphinx/ext/autodoc.py
doctools/trunk/sphinx/templates/layout.html
Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py (original)
+++ doctools/trunk/sphinx/builder.py Sat Jul 5 12:24:06 2008
@@ -138,7 +138,7 @@
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:
Modified: doctools/trunk/sphinx/directives/other.py
==============================================================================
--- doctools/trunk/sphinx/directives/other.py (original)
+++ doctools/trunk/sphinx/directives/other.py Sat Jul 5 12:24:06 2008
@@ -83,6 +83,7 @@
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', ''),
@@ -100,13 +101,15 @@
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)
Modified: doctools/trunk/sphinx/ext/autodoc.py
==============================================================================
--- doctools/trunk/sphinx/ext/autodoc.py (original)
+++ doctools/trunk/sphinx/ext/autodoc.py Sat Jul 5 12:24:06 2008
@@ -113,25 +113,33 @@
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
@@ -526,7 +534,10 @@
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)
@@ -542,11 +553,11 @@
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)
Modified: doctools/trunk/sphinx/templates/layout.html
==============================================================================
--- doctools/trunk/sphinx/templates/layout.html (original)
+++ doctools/trunk/sphinx/templates/layout.html Sat Jul 5 12:24:06 2008
@@ -104,7 +104,7 @@
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>
More information about the Python-checkins
mailing list