From 15fe77069a3a17a2aa33b1a636b22671d5d2ff73 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 17 Oct 2010 08:41:52 +0200 Subject: [PATCH 1/7] Add pypol. --- EXAMPLES | 1 + 1 file changed, 1 insertion(+) diff --git a/EXAMPLES b/EXAMPLES index 778b235e1..1a1616601 100644 --- a/EXAMPLES +++ b/EXAMPLES @@ -111,6 +111,7 @@ Documentation using another builtin theme * pip: http://pip.openplans.org/ (nature) * Programmieren mit PyGTK und Glade (German): http://www.florian-diesch.de/doc/python-und-glade/online/ (agogo) +* pypol: http://pypol.altervista.org/ (nature) * Spring Python: http://springpython.webfactional.com/current/sphinx/index.html (nature) * sqlparse: http://python-sqlparse.googlecode.com/svn/docs/api/index.html From 08047fc523178f87b812ff72d42b1659696b6b51 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 18 Oct 2010 18:06:02 +0200 Subject: [PATCH 2/7] Add Pocoo logo to the sidebar on the index page. --- doc/_static/pocoo.png | Bin 0 -> 4211 bytes doc/_templates/indexsidebar.html | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 doc/_static/pocoo.png diff --git a/doc/_static/pocoo.png b/doc/_static/pocoo.png new file mode 100644 index 0000000000000000000000000000000000000000..297dcd5e068fcbba3bf21c27d485dcf0e0bf775a GIT binary patch literal 4211 zcmV-(5RC7MP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01T4=01T4>#7OamzNA*~u5B4%i0M|m zY(1tM_3h0!C7(C8rCBOTwX>vp^Y#cEb99TM6J97pv5`^ILa_i%?l%RMt0;lM>5ui> z&T^VLb2&4d!?3>3GtbQ4v)9^duUX&qyRJ20U|?WiU|?WiP$TGIx*$LNFzODx4x9+o z1)jUc^ol_)bTnPiBEAIl1&#$~3$Y9g43SF2Yrrm`8Q1~*%yfx?QSHi8@74i#0CRyU zz^4PxU1)m7z(}Ox2-Lw3qZ5Iiz_7q`9|dLrFZ*F+`pv*dqyhxm2WSG$037YB(?u%1 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GBdKV3*}x<=V;S0z;9(D$)&9<$||!Al^?k{>)Mjdf|}ZC)eoafL_Gkw zPL@QJTE__}H~J3Xkic`_D{%b?nZdRIy#mkO(H761Or__^KmvHcv8^UKe>f_q?KP)L z_NnCF9U;z_#n~~etZS2ER{=cZ*w)Yjb@xKWml{xR^%ah7Z7!lseSuGldbw8GwJXoH zb!65hZ3X6*n#EpEZDG9-pdOW#9F$Q<9LuN!B0r3-%J;`&@)s~;WoG?lTal=M^jO*o z4_&eMSV0jB9R+$ocWDuIZ$JgQOKsC?ii{}<@t2Uv#oH~;hW3mNLZmuTJ<5ST6MY5v zDk^0r7lxu@NZYbhSOY#@50nu5WCd!i+L78NkJrkx)*6x436WZ}Bw^XaeT}dd-4);>{PoaqvrnBMV2_6Du-hN&%Le0@?B&g4$=DPtiW?0 z*RH8UWoeuOtPDK29|n89=&d#A+k$z17?q^H%62=l-au5`WIJkq0s}*&+JbD8^_m=Z&1d5jsN;D} zDm814g&U;KSij$bik=%7BGn`w);@o?%sS4=V@D1`{W~8hZ{21yj0|d(NNH3mNi$II zhf&E(k0r}HTg3zAg^KN?$IK8isAVFp;*(npUsa}>cnRvymUXGrsP)@)GlUFknMlhu zA~gfu{4nZYCYeT%dl#f#viXXEL2VLAb}XH&Ns>;$L9M8A99p1Pu+j`4gIbqJp!U{_ zodxkfN|cMgpw_MED&7V&d<<%yNa63}FsQkt)ok2| z+J5&~G8?3qi#Ji*O05k%cN1#gYXgItSM3Nq_kGlkoQKi+EsVQ~owU;o8v}zf;fK)* zKa8fDo-o)ORl7>!&*a~9-oU`Xz`(%3z`(%3z`(%3z`&q#_!s|3Isbm4mS_L~002ov JPDHLkV1n-_3t9jG literal 0 HcmV?d00001 diff --git a/doc/_templates/indexsidebar.html b/doc/_templates/indexsidebar.html index 85b8fba95..feafd9046 100644 --- a/doc/_templates/indexsidebar.html +++ b/doc/_templates/indexsidebar.html @@ -1,3 +1,6 @@ + +

Download

{% if version.endswith('(hg)') %}

This documentation is for version {{ version }}, which is From 991d0e32b35c21e805f230f9a839a1b4646ca493 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 20 Oct 2010 11:55:11 +0200 Subject: [PATCH 3/7] Fix missing paren. --- doc/config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/config.rst b/doc/config.rst index 8fdb50dbd..804647681 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -98,7 +98,7 @@ General configuration Example patterns: - ``'library/xml.rst'`` -- ignores the ``library/xml.rst`` file (replaces - entry in :confval:`unused_docs` + entry in :confval:`unused_docs`) - ``'library/xml'`` -- ignores the ``library/xml`` directory (replaces entry in :confval:`exclude_trees`) - ``'library/xml*'`` -- ignores all files and directories starting with From f50ce38f9c1cbc2450b8f77a0dbde0d4795d3a67 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 20 Oct 2010 08:10:07 -0400 Subject: [PATCH 4/7] include a blank line before a new line-block so it stands as its own paragraph --- sphinx/writers/latex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 75676f03f..0c71a79fd 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1238,7 +1238,7 @@ class LaTeXTranslator(nodes.NodeVisitor): * inline markup is supported. * serif typeface """ - self.body.append('{\\raggedright{}') + self.body.append('\n{\\raggedright{}') self.literal_whitespace += 1 def depart_line_block(self, node): self.literal_whitespace -= 1 From 39dc69e9d919fda67a599c85ec52be3f12950c4a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 22 Oct 2010 07:10:44 +0200 Subject: [PATCH 5/7] Remove obsolete config value. --- doc/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index b3a1cda79..51e18096d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -21,7 +21,6 @@ show_authors = True html_theme = 'sphinxdoc' modindex_common_prefix = ['sphinx.'] html_static_path = ['_static'] -html_index = 'index.html' html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']} html_additional_pages = {'index': 'index.html'} html_use_opensearch = 'http://sphinx.pocoo.org' From c768b68340f73b69c00d1c5c1bf289e2c9f2a136 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 22 Oct 2010 09:40:03 +0200 Subject: [PATCH 6/7] #544: Allow ``.pyw`` as a source file extension. --- CHANGES | 2 ++ sphinx/ext/autodoc.py | 2 +- sphinx/util/__init__.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 9a03a384b..f0e6759fa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.0.4 (Sep 17, 2010) ============================ +* #544: Allow ``.pyw`` as a source file extension. + * #524: Open intersphinx inventories in binary mode on Windows, since version 2 contains zlib-compressed data. diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index adf08bcde..55253e8ab 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -659,7 +659,7 @@ class Documenter(object): # parse right now, to get PycodeErrors on parsing (results will # be cached anyway) self.analyzer.find_attr_docs() - except PycodeError, err: + except PycodeError: # no source file -- e.g. for builtin and C modules self.analyzer = None # at least add the module.__file__ as a dependency diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index ed27fe640..ccb18e2bf 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -204,7 +204,7 @@ def get_module_source(modname): lfilename = filename.lower() if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'): filename = filename[:-1] - elif not lfilename.endswith('.py'): + elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')): raise PycodeError('source is not a .py file: %r' % filename) if not path.isfile(filename): raise PycodeError('source file is not present: %r' % filename) From 357f8472c7f8b7772d27c561215bc8f981f13001 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 22 Oct 2010 10:02:10 +0200 Subject: [PATCH 7/7] #534: warning message instead of crash if invalid Pygments lexer name is used. --- sphinx/application.py | 6 ++++++ sphinx/builders/html.py | 3 +++ sphinx/environment.py | 8 ++------ sphinx/highlighting.py | 2 +- sphinx/writers/html.py | 6 ++++-- sphinx/writers/latex.py | 20 +++++++++----------- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/sphinx/application.py b/sphinx/application.py index 11f887da9..134f607ac 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -213,6 +213,12 @@ class Sphinx(object): self.builder.cleanup() def warn(self, message, location=None, prefix='WARNING: '): + if isinstance(location, tuple): + docname, lineno = location + if docname: + location = '%s:%s' % (self.env.doc2path(docname), lineno or '') + else: + location = None warntext = location and '%s: %s%s\n' % (location, prefix, message) or \ '%s%s\n' % (prefix, message) if self.warningiserror: diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 951f516d6..f6cb802cc 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -87,6 +87,8 @@ class StandaloneHTMLBuilder(Builder): self.tags_hash = '' # section numbers for headings in the currently visited document self.secnumbers = {} + # currently written docname + self.current_docname = None self.init_templates() self.init_highlighter() @@ -396,6 +398,7 @@ class StandaloneHTMLBuilder(Builder): self.imgpath = relative_uri(self.get_target_uri(docname), '_images') self.post_process_images(doctree) self.dlpath = relative_uri(self.get_target_uri(docname), '_downloads') + self.current_docname = docname self.docwriter.write(doctree, destination) self.docwriter.assemble_parts() body = self.docwriter.parts['fragment'] diff --git a/sphinx/environment.py b/sphinx/environment.py index 4919331b2..77b43d6ef 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -336,12 +336,8 @@ class BuildEnvironment: self.settings['warning_stream'] = WarningStream(func) def warn(self, docname, msg, lineno=None): - if docname: - if lineno is None: - lineno = '' - self._warnfunc(msg, '%s:%s' % (self.doc2path(docname), lineno)) - else: - self._warnfunc(msg) + # strange argument order is due to backwards compatibility + self._warnfunc(msg, (docname, lineno)) def clear_doc(self, docname): """Remove all traces of a source file in the inventory.""" diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 0dcbc0219..ea91b2549 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -207,7 +207,7 @@ class PygmentsBridge(object): lexer = lexers[lang] = get_lexer_by_name(lang) except ClassNotFound: if warn: - warn('Pygments lexer name %s is not known' % lang) + warn('Pygments lexer name %r is not known' % lang) return self.unhighlighted(source) else: raise diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py index f206e479a..9e8c9c2bf 100644 --- a/sphinx/writers/html.py +++ b/sphinx/writers/html.py @@ -232,8 +232,10 @@ class HTMLTranslator(BaseTranslator): lang = node['language'] if node.has_key('linenos'): linenos = node['linenos'] - highlighted = self.highlighter.highlight_block(node.rawsource, - lang, linenos) + def warner(msg): + self.builder.warn(msg, (self.builder.current_docname, node.line)) + highlighted = self.highlighter.highlight_block( + node.rawsource, lang, linenos, warn=warner) starttag = self.starttag(node, 'div', suffix='', CLASS='highlight-%s' % lang) self.body.append(starttag + highlighted + '\n') diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 0c71a79fd..ee30b4ebc 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -429,10 +429,8 @@ class LaTeXTranslator(nodes.NodeVisitor): elif self.this_is_the_title: if len(node.children) != 1 and not isinstance(node.children[0], nodes.Text): - self.builder.warn( - 'document title is not a single Text node', - '%s:%s' % (self.builder.env.doc2path(self.curfilestack[-1]), - node.line or '')) + self.builder.warn('document title is not a single Text node', + (self.curfilestack[-1], node.line)) if not self.elements['title']: # text needs to be escaped since it is inserted into # the output literally @@ -465,8 +463,7 @@ class LaTeXTranslator(nodes.NodeVisitor): self.builder.warn( 'encountered title node not in section, topic, table, ' 'admonition or sidebar', - '%s:%s' % (self.builder.env.doc2path(self.curfilestack[-1]), - node.line or '')) + (self.curfilestack[-1], node.line or '')) self.body.append('\\textbf{') self.context.append('}\n') self.in_title = 1 @@ -1107,10 +1104,8 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append('\\grammartoken{') self.context.append('}') else: - self.builder.warn( - 'unusable reference target found: %s' % uri, - '%s:%s' % (self.builder.env.doc2path(self.curfilestack[-1]), - node.line or '')) + self.builder.warn('unusable reference target found: %s' % uri, + (self.curfilestack[-1], node.line)) self.context.append('') def depart_reference(self, node): self.body.append(self.context.pop()) @@ -1215,7 +1210,10 @@ class LaTeXTranslator(nodes.NodeVisitor): lang = node['language'] if node.has_key('linenos'): linenos = node['linenos'] - hlcode = self.highlighter.highlight_block(code, lang, linenos) + def warner(msg): + self.builder.warn(msg, (self.curfilestack[-1], node.line)) + hlcode = self.highlighter.highlight_block(code, lang, linenos, + warn=warner) # workaround for Unicode issue hlcode = hlcode.replace(u'€', u'@texteuro[]') # must use original Verbatim environment and "tabular" environment