mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 0.6
This commit is contained in:
commit
d10733d137
8
CHANGES
8
CHANGES
@ -40,6 +40,14 @@ Release 1.0 (in development)
|
||||
Release 0.6.3 (in development)
|
||||
==============================
|
||||
|
||||
* #210: Fix nesting of HTML tags for displayed math from pngmath
|
||||
extension.
|
||||
|
||||
* #213: Fix centering of images in LaTeX output.
|
||||
|
||||
* #211: Fix compatibility with docutils 0.5.
|
||||
|
||||
|
||||
Release 0.6.2 (Jun 16, 2009)
|
||||
============================
|
||||
|
||||
|
@ -43,9 +43,9 @@ def main(argv=sys.argv):
|
||||
'first.')
|
||||
else:
|
||||
whichmod += ' module'
|
||||
print >>sys.stderr, \
|
||||
'Error: The %s cannot be found. Did you install Sphinx '\
|
||||
'and its dependencies correctly?' % whichmod
|
||||
print >>sys.stderr, ('Error: The %s cannot be found. '
|
||||
'Did you install Sphinx and its dependencies '
|
||||
'correctly?' % whichmod)
|
||||
if hint:
|
||||
print >> sys.stderr, hint
|
||||
return 1
|
||||
|
@ -194,10 +194,21 @@ def between(marker, what=None, keepempty=False):
|
||||
return process
|
||||
|
||||
|
||||
def safe_getattr(obj, name, *defargs):
|
||||
try:
|
||||
return getattr(obj, name, *defargs)
|
||||
except Exception:
|
||||
# this is a catch-all for all the weird things that some modules do
|
||||
# with attribute access
|
||||
if defargs:
|
||||
return defargs[0]
|
||||
raise AttributeError
|
||||
|
||||
|
||||
def isdescriptor(x):
|
||||
"""Check if the object is some kind of descriptor."""
|
||||
for item in '__get__', '__set__', '__delete__':
|
||||
if hasattr(getattr(x, item, None), '__call__'):
|
||||
if hasattr(safe_getattr(x, item, None), '__call__'):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -235,7 +246,7 @@ class Documenter(object):
|
||||
for typ, func in AutoDirective._special_attrgetters.iteritems():
|
||||
if isinstance(obj, typ):
|
||||
return func(obj, name, *defargs)
|
||||
return getattr(obj, name, *defargs)
|
||||
return safe_getattr(obj, name, *defargs)
|
||||
|
||||
@classmethod
|
||||
def can_document_member(cls, member, membername, isattr, parent):
|
||||
@ -731,11 +742,12 @@ class ModuleDocumenter(Documenter):
|
||||
ret = []
|
||||
for mname in memberlist:
|
||||
try:
|
||||
ret.append((mname, getattr(self.object, mname)))
|
||||
ret.append((mname, safe_getattr(self.object, mname)))
|
||||
except AttributeError:
|
||||
self.directive.warn('missing attribute mentioned in :members: '
|
||||
'or __all__: module %s, attribute %s' %
|
||||
(self.object.__name__, mname))
|
||||
self.directive.warn(
|
||||
'missing attribute mentioned in :members: or __all__: '
|
||||
'module %s, attribute %s' % (
|
||||
safe_getattr(self.object, '__name__', '???'), mname))
|
||||
return False, ret
|
||||
|
||||
|
||||
@ -922,9 +934,12 @@ class ClassDocumenter(ModuleLevelDocumenter):
|
||||
|
||||
def add_content(self, more_content, no_docstring=False):
|
||||
if self.doc_as_attr:
|
||||
content = ViewList(
|
||||
[_('alias of :class:`%s`') % self.object.__name__], source='')
|
||||
ModuleLevelDocumenter.add_content(self, content, no_docstring=True)
|
||||
classname = safe_getattr(self.object, '__name__', None)
|
||||
if classname:
|
||||
content = ViewList(
|
||||
[_('alias of :class:`%s`') % classname], source='')
|
||||
ModuleLevelDocumenter.add_content(self, content,
|
||||
no_docstring=True)
|
||||
else:
|
||||
ModuleLevelDocumenter.add_content(self, more_content)
|
||||
|
||||
|
@ -169,7 +169,7 @@ def render_dot_latex(self, node, code, options, prefix='graphviz'):
|
||||
raise nodes.SkipNode
|
||||
|
||||
if fname is not None:
|
||||
self.body.append('\\includegraphics[]{%s}' % fname)
|
||||
self.body.append('\\includegraphics{%s}' % fname)
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
||||
|
@ -223,12 +223,11 @@ def html_visit_displaymath(self, node):
|
||||
self.body.append('<span class="eqno">(%s)</span>' % node['number'])
|
||||
if fname is None:
|
||||
# something failed -- use text-only as a bad substitute
|
||||
self.body.append('<span class="math">%s</span>' %
|
||||
self.body.append('<span class="math">%s</span></p>\n</div>' %
|
||||
self.encode(node['latex']).strip())
|
||||
else:
|
||||
self.body.append('<img src="%s" alt="%s" />\n</div>' %
|
||||
self.body.append('<img src="%s" alt="%s" /></p>\n</div>' %
|
||||
(fname, self.encode(node['latex']).strip()))
|
||||
self.body.append('</p>')
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
||||
|
@ -234,6 +234,7 @@ class ModuleAnalyzer(object):
|
||||
attr_visitor = AttrDocVisitor(number2name, scope, self.encoding)
|
||||
attr_visitor.visit(self.parsetree)
|
||||
self.attr_docs = attr_visitor.collected
|
||||
self.parsetree = None
|
||||
return attr_visitor.collected
|
||||
|
||||
def find_tags(self):
|
||||
|
@ -695,8 +695,10 @@
|
||||
\image@width\wd\image@box%
|
||||
\ifdim \image@width>\linewidth%
|
||||
\setbox\image@box=\hbox{\py@Oldincludegraphics[width=\linewidth]{#2}}%
|
||||
\box\image@box%
|
||||
\else%
|
||||
\py@Oldincludegraphics{#2}%
|
||||
\fi%
|
||||
\box\image@box%
|
||||
\else%
|
||||
\py@Oldincludegraphics[#1]{#2}%
|
||||
\fi%
|
||||
|
@ -27,8 +27,8 @@ if sys.version_info < (2, 5):
|
||||
# begin code copied from utf_8_sig.py in Python 2.6
|
||||
|
||||
def encode(input, errors='strict'):
|
||||
return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0],
|
||||
len(input))
|
||||
return (codecs.BOM_UTF8 +
|
||||
codecs.utf_8_encode(input, errors)[0], len(input))
|
||||
|
||||
def decode(input, errors='strict'):
|
||||
prefix = 0
|
||||
|
@ -303,11 +303,11 @@ class HTMLTranslator(BaseTranslator):
|
||||
if node['uri'].lower().endswith('svg') or \
|
||||
node['uri'].lower().endswith('svgz'):
|
||||
atts = {'data': node['uri'], 'type': 'image/svg+xml'}
|
||||
if 'width' in node:
|
||||
if node.has_key('width'):
|
||||
atts['width'] = node['width']
|
||||
if 'height' in node:
|
||||
if node.has_key('height'):
|
||||
atts['height'] = node['height']
|
||||
if 'align' in node:
|
||||
if node.has_key('align'):
|
||||
self.body.append('<div align="%s" class="align-%s">' %
|
||||
(node['align'], node['align']))
|
||||
self.context.append('</div>\n')
|
||||
|
@ -261,7 +261,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
# ... and all others are the appendices
|
||||
self.body.append('\n\\appendix\n')
|
||||
self.first_document = -1
|
||||
if 'docname' in node:
|
||||
if node.has_key('docname'):
|
||||
self.body.append('\\hypertarget{--doc-%s}{}' % node['docname'])
|
||||
# "- 1" because the level is increased before the title is visited
|
||||
self.sectionlevel = self.top_sectionlevel - 1
|
||||
@ -640,15 +640,15 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
if self.table.longtable:
|
||||
self.body.append('\\hline\n')
|
||||
self.body.append('\\endfirsthead\n\n')
|
||||
self.body.append('\multicolumn{%s}{c}%%\n' % self.table.colcount)
|
||||
self.body.append('{{\\bfseries \\tablename\\ \\thetable{} -- %s}} '
|
||||
'\\\\\n' % _('continued from previous page'))
|
||||
self.body.append('\\hline\n')
|
||||
self.body.append('\\multicolumn{%s}{c}%%\n' % self.table.colcount)
|
||||
self.body.append(r'{{\bfseries \tablename\ \thetable{} -- %s}} \\'
|
||||
% _('continued from previous page'))
|
||||
self.body.append('\n\\hline\n')
|
||||
self.body.append('\\endhead\n\n')
|
||||
self.body.append('\\hline \multicolumn{%s}{|r|}{{%s}} \\\\ '
|
||||
'\\hline\n' % (self.table.colcount,
|
||||
_('Continued on next page')))
|
||||
self.body.append('\\endfoot\n\n')
|
||||
self.body.append(r'\hline \multicolumn{%s}{|r|}{{%s}} \\ \hline'
|
||||
% (self.table.colcount,
|
||||
_('Continued on next page')))
|
||||
self.body.append('\n\\endfoot\n\n')
|
||||
self.body.append('\\hline\n')
|
||||
self.body.append('\\endlastfoot\n\n')
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user