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