summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-22 11:16:48 +0200
committerGeorg Brandl <georg@python.org>2010-10-22 11:16:48 +0200
commitdb8189083d6022a34b331d4c482776ba301eae1b (patch)
tree4772befc0e005a3cd7f7377d6c5777a8f24ec43b
parent92f6212c98871ddba777524039d8b1950a069c53 (diff)
parent357f8472c7f8b7772d27c561215bc8f981f13001 (diff)
downloadsphinx-git-db8189083d6022a34b331d4c482776ba301eae1b.tar.gz
merge with 1.0
-rw-r--r--CHANGES2
-rw-r--r--EXAMPLES1
-rw-r--r--doc/_static/pocoo.pngbin0 -> 4211 bytes
-rw-r--r--doc/_templates/indexsidebar.html3
-rw-r--r--doc/conf.py1
-rw-r--r--doc/config.rst2
-rw-r--r--sphinx/application.py6
-rw-r--r--sphinx/builders/html.py3
-rw-r--r--sphinx/environment.py8
-rw-r--r--sphinx/ext/autodoc.py2
-rw-r--r--sphinx/highlighting.py2
-rw-r--r--sphinx/util/__init__.py2
-rw-r--r--sphinx/writers/html.py6
-rw-r--r--sphinx/writers/latex.py22
14 files changed, 35 insertions, 25 deletions
diff --git a/CHANGES b/CHANGES
index d57846c6d..c14c570f0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,8 @@ Release 1.1 (in development)
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/EXAMPLES b/EXAMPLES
index b5fd96af4..0dab0046e 100644
--- a/EXAMPLES
+++ b/EXAMPLES
@@ -112,6 +112,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
diff --git a/doc/_static/pocoo.png b/doc/_static/pocoo.png
new file mode 100644
index 000000000..297dcd5e0
--- /dev/null
+++ b/doc/_static/pocoo.png
Binary files differ
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 @@
+<p class="logo"><a href="http://pocoo.org/">
+ <img src="{{ pathto("_static/pocoo.png", 1) }}" /></a></p>
+
<h3>Download</h3>
{% if version.endswith('(hg)') %}
<p>This documentation is for version <b>{{ version }}</b>, which is
diff --git a/doc/conf.py b/doc/conf.py
index dd23b0812..69741661d 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'
diff --git a/doc/config.rst b/doc/config.rst
index fbf7fc40b..4c6735726 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
diff --git a/sphinx/application.py b/sphinx/application.py
index 97b1b396d..cd4503a64 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -209,6 +209,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 78bafda81..cdeb334a2 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -88,6 +88,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()
@@ -398,6 +400,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 883c91e99..85d43fcbf 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -377,12 +377,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/ext/autodoc.py b/sphinx/ext/autodoc.py
index 3a2476a6b..696e5f1d0 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -664,7 +664,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/highlighting.py b/sphinx/highlighting.py
index 6d7109199..798c2d7bc 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/util/__init__.py b/sphinx/util/__init__.py
index ee00e4d11..0028340ff 100644
--- a/sphinx/util/__init__.py
+++ b/sphinx/util/__init__.py
@@ -209,7 +209,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)
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 33d90c915..858681f7a 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 + '</div>\n')
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index de57e35a8..2ded01e3e 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 'linenos' in node:
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
@@ -1238,7 +1236,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