diff --git a/CHANGES b/CHANGES index 761d41a1b..e755e6bcb 100644 --- a/CHANGES +++ b/CHANGES @@ -36,6 +36,7 @@ Features added multiple terms per definition. - #478: Added :rst:dir:`py:decorator` directive to describe decorators. - C++ domain now supports array definitions. + - C++ domain now supports doc fields (``:param x:`` inside directives). - Section headings in :rst:dir:`only` directives are now correctly handled. - Added ``emphasize-lines`` option to source code directives. @@ -111,6 +112,32 @@ Features added Release 1.0.8 (in development) ============================== +* #720: Add dummy visitors for graphviz nodes for text and man. + +* #704: Fix image file duplication bug. + +* #677: Fix parsing of multiple signatures in C++ domain. + +* #637: Ignore Emacs lock files when looking for source files. + +* #544: Allow .pyw extension for importable modules in autodoc. + +* #700: Use ``$(MAKE)`` in quickstart-generated Makefiles. + +* #734: Make sidebar search box width consistent in browsers. + +* #644: Fix spacing of centered figures in HTML output. + +* #767: Safely encode SphinxError messages when printing them to + sys.stderr. + +* #611: Fix LaTeX output error with a document with no sections but + a link target. + +* Correctly treat built-in method descriptors as methods in autodoc. + +* #706: Stop monkeypatching the Python textwrap module. + * #657: viewcode now works correctly with source files that have non-ASCII encoding. diff --git a/doc/intro.rst b/doc/intro.rst index 5562f39b3..fe11aec94 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -34,6 +34,9 @@ to reStructuredText/Sphinx from other documentation systems. * Marcin Wojdyr has written a script to convert Docbook to reST with Sphinx markup; it is at `Google Code `_. +* To convert different markups, `Pandoc `_ is + a very helpful tool. + Use with other systems ---------------------- diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index b6f9d1338..e90995424 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -162,17 +162,19 @@ class StandaloneHTMLBuilder(Builder): old_config_hash = old_tags_hash = '' try: fp = open(path.join(self.outdir, '.buildinfo')) - version = fp.readline() - if version.rstrip() != '# Sphinx build info version 1': - raise ValueError - fp.readline() # skip commentary - cfg, old_config_hash = fp.readline().strip().split(': ') - if cfg != 'config': - raise ValueError - tag, old_tags_hash = fp.readline().strip().split(': ') - if tag != 'tags': - raise ValueError - fp.close() + try: + version = fp.readline() + if version.rstrip() != '# Sphinx build info version 1': + raise ValueError + fp.readline() # skip commentary + cfg, old_config_hash = fp.readline().strip().split(': ') + if cfg != 'config': + raise ValueError + tag, old_tags_hash = fp.readline().strip().split(': ') + if tag != 'tags': + raise ValueError + finally: + fp.close() except ValueError: self.warn('unsupported build info format in %r, building all' % path.join(self.outdir, '.buildinfo')) diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index b1f95291c..1fa428e17 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -21,6 +21,7 @@ from sphinx.domains import Domain, ObjType from sphinx.directives import ObjectDescription from sphinx.util.nodes import make_refnode from sphinx.util.compat import Directive +from sphinx.util.docfields import Field, GroupedField _identifier_re = re.compile(r'(~?\b[a-zA-Z_][a-zA-Z0-9_]*)\b') @@ -124,7 +125,7 @@ class DefExpr(object): return False try: for key, value in self.__dict__.iteritems(): - if value != getattr(other, value): + if value != getattr(other, key): return False except AttributeError: return False @@ -894,6 +895,17 @@ class DefinitionParser(object): class CPPObject(ObjectDescription): """Description of a C++ language object.""" + doc_field_types = [ + GroupedField('parameter', label=l_('Parameters'), + names=('param', 'parameter', 'arg', 'argument'), + can_collapse=True), + GroupedField('exceptions', label=l_('Throws'), rolename='cpp:class', + names=('throws', 'throw', 'exception'), + can_collapse=True), + Field('returnvalue', label=l_('Returns'), has_arg=False, + names=('returns', 'return')), + ] + def attach_name(self, node, name): owner, name = name.split_owner() varname = unicode(name) @@ -1196,7 +1208,7 @@ class CPPDomain(Domain): node.line) return None - parent = node['cpp:parent'] + parent = node.get('cpp:parent', None) rv = _create_refnode(expr) if rv is not None or parent is None: diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 886af5058..ee935945d 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -25,6 +25,7 @@ from docutils import nodes from docutils.parsers.rst import directives from sphinx.errors import SphinxError +from sphinx.locale import _ from sphinx.util.osutil import ensuredir, ENOENT, EPIPE, EINVAL from sphinx.util.compat import Directive @@ -294,11 +295,26 @@ def texinfo_visit_graphviz(self, node): render_dot_texinfo(self, node, node['code'], node['options']) +def text_visit_graphviz(self, node): + if 'alt' in node.attributes: + self.add_text(_('[graph: %s]') % node['alt']) + self.add_text(_('[graph]')) + + +def man_visit_graphviz(self, node): + if 'alt' in node.attributes: + self.body.append(_('[graph: %s]') % node['alt'] + '\n') + self.body.append(_('[graph]')) + raise nodes.SkipNode + + def setup(app): app.add_node(graphviz, html=(html_visit_graphviz, None), latex=(latex_visit_graphviz, None), - texinfo=(texinfo_visit_graphviz, None)) + texinfo=(texinfo_visit_graphviz, None), + text=(text_visit_graphviz, None), + man=(man_visit_graphviz, None)) app.add_directive('graphviz', Graphviz) app.add_directive('graph', GraphvizSimple) app.add_directive('digraph', GraphvizSimple) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 0721118e7..0d67da82c 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -112,11 +112,11 @@ class FilenameUniqDict(dict): return uniquename def purge_doc(self, docname): - for filename, (docs, _) in self.items(): + for filename, (docs, unique) in self.items(): docs.discard(docname) if not docs: del self[filename] - self._existing.discard(filename) + self._existing.discard(unique) def __getstate__(self): return self._existing diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 14e24cfbd..e6585f273 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -196,19 +196,21 @@ class LaTeXTranslator(nodes.NodeVisitor): lang = babel.get_language() if lang: self.elements['classoptions'] += ',' + babel.get_language() - elif builder.config.language == 'ja': - self.elements['classoptions'] += ',dvipdfm' - # not elements of babel, but this should be above sphinx.sty. - # because pTeX (Japanese TeX) cannot handle this count. - self.elements['babel'] = r'\newcount\pdfoutput\pdfoutput=0' - # to make the pdf with correct encoded hyperref bookmarks - self.elements['preamble'] += \ - r'\AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}' else: self.builder.warn('no Babel option known for language %r' % builder.config.language) self.elements['shorthandoff'] = babel.get_shorthandoff() self.elements['fncychap'] = '\\usepackage[Sonny]{fncychap}' + + # pTeX (Japanese TeX) for support + if builder.config.language == 'ja': + self.elements['classoptions'] = ',dvipdfm' + # found elements of babel, but this should be above sphinx.sty. + # because pTeX (Japanese TeX) cannot handle this count. + self.elements['babel'] = r'\newcount\pdfoutput\pdfoutput=0' + # to make the pdf with correct encoded hyperref bookmarks + self.elements['preamble'] += \ + r'\AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}' else: self.elements['classoptions'] += ',english' # allow the user to override them all diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index 620873bb7..81f2988b2 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -230,8 +230,8 @@ class ManualPageTranslator(BaseTranslator): # overwritten -- don't emit a warning for images def visit_image(self, node): if 'alt' in node.attributes: - self.body.append('[image: %s]\n' % node['alt']) - self.body.append('[image]\n') + self.body.append(_('[image: %s]') % node['alt'] + '\n') + self.body.append(_('[image]') + '\n') raise nodes.SkipNode # overwritten -- don't visit inner marked up nodes diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 5d6f49ec3..e5ab070c7 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -434,6 +434,8 @@ class TextTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_image(self, node): + if 'alt' in node.attributes: + self.add_text(_('[image: %s]') % node['alt']) self.add_text(_('[image]')) raise nodes.SkipNode diff --git a/tests/root/objects.txt b/tests/root/objects.txt index 51ecee911..533bdae3e 100644 --- a/tests/root/objects.txt +++ b/tests/root/objects.txt @@ -169,6 +169,4 @@ CPP domain .. cpp:class:: n::Array .. cpp:function:: T& operator[]( unsigned j ) - - .. cpp:function:: const T& operator[]( unsigned j ) const - + const T& operator[]( unsigned j ) const