mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 1.0
This commit is contained in:
commit
db8189083d
2
CHANGES
2
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.
|
||||
|
||||
|
1
EXAMPLES
1
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
|
||||
|
BIN
doc/_static/pocoo.png
vendored
Normal file
BIN
doc/_static/pocoo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
3
doc/_templates/indexsidebar.html
vendored
3
doc/_templates/indexsidebar.html
vendored
@ -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
|
||||
|
@ -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'
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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']
|
||||
|
@ -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."""
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user