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)
|
Release 1.0.4 (Sep 17, 2010)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
* #544: Allow ``.pyw`` as a source file extension.
|
||||||
|
|
||||||
* #524: Open intersphinx inventories in binary mode on Windows,
|
* #524: Open intersphinx inventories in binary mode on Windows,
|
||||||
since version 2 contains zlib-compressed data.
|
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)
|
* pip: http://pip.openplans.org/ (nature)
|
||||||
* Programmieren mit PyGTK und Glade (German):
|
* Programmieren mit PyGTK und Glade (German):
|
||||||
http://www.florian-diesch.de/doc/python-und-glade/online/ (agogo)
|
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
|
* Spring Python: http://springpython.webfactional.com/current/sphinx/index.html
|
||||||
(nature)
|
(nature)
|
||||||
* sqlparse: http://python-sqlparse.googlecode.com/svn/docs/api/index.html
|
* 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>
|
<h3>Download</h3>
|
||||||
{% if version.endswith('(hg)') %}
|
{% if version.endswith('(hg)') %}
|
||||||
<p>This documentation is for version <b>{{ version }}</b>, which is
|
<p>This documentation is for version <b>{{ version }}</b>, which is
|
||||||
|
@ -21,7 +21,6 @@ show_authors = True
|
|||||||
html_theme = 'sphinxdoc'
|
html_theme = 'sphinxdoc'
|
||||||
modindex_common_prefix = ['sphinx.']
|
modindex_common_prefix = ['sphinx.']
|
||||||
html_static_path = ['_static']
|
html_static_path = ['_static']
|
||||||
html_index = 'index.html'
|
|
||||||
html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']}
|
html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']}
|
||||||
html_additional_pages = {'index': 'index.html'}
|
html_additional_pages = {'index': 'index.html'}
|
||||||
html_use_opensearch = 'http://sphinx.pocoo.org'
|
html_use_opensearch = 'http://sphinx.pocoo.org'
|
||||||
|
@ -98,7 +98,7 @@ General configuration
|
|||||||
Example patterns:
|
Example patterns:
|
||||||
|
|
||||||
- ``'library/xml.rst'`` -- ignores the ``library/xml.rst`` file (replaces
|
- ``'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
|
- ``'library/xml'`` -- ignores the ``library/xml`` directory (replaces entry
|
||||||
in :confval:`exclude_trees`)
|
in :confval:`exclude_trees`)
|
||||||
- ``'library/xml*'`` -- ignores all files and directories starting with
|
- ``'library/xml*'`` -- ignores all files and directories starting with
|
||||||
|
@ -209,6 +209,12 @@ class Sphinx(object):
|
|||||||
self.builder.cleanup()
|
self.builder.cleanup()
|
||||||
|
|
||||||
def warn(self, message, location=None, prefix='WARNING: '):
|
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 \
|
warntext = location and '%s: %s%s\n' % (location, prefix, message) or \
|
||||||
'%s%s\n' % (prefix, message)
|
'%s%s\n' % (prefix, message)
|
||||||
if self.warningiserror:
|
if self.warningiserror:
|
||||||
|
@ -88,6 +88,8 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
self.tags_hash = ''
|
self.tags_hash = ''
|
||||||
# section numbers for headings in the currently visited document
|
# section numbers for headings in the currently visited document
|
||||||
self.secnumbers = {}
|
self.secnumbers = {}
|
||||||
|
# currently written docname
|
||||||
|
self.current_docname = None
|
||||||
|
|
||||||
self.init_templates()
|
self.init_templates()
|
||||||
self.init_highlighter()
|
self.init_highlighter()
|
||||||
@ -398,6 +400,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
self.imgpath = relative_uri(self.get_target_uri(docname), '_images')
|
self.imgpath = relative_uri(self.get_target_uri(docname), '_images')
|
||||||
self.post_process_images(doctree)
|
self.post_process_images(doctree)
|
||||||
self.dlpath = relative_uri(self.get_target_uri(docname), '_downloads')
|
self.dlpath = relative_uri(self.get_target_uri(docname), '_downloads')
|
||||||
|
self.current_docname = docname
|
||||||
self.docwriter.write(doctree, destination)
|
self.docwriter.write(doctree, destination)
|
||||||
self.docwriter.assemble_parts()
|
self.docwriter.assemble_parts()
|
||||||
body = self.docwriter.parts['fragment']
|
body = self.docwriter.parts['fragment']
|
||||||
|
@ -377,12 +377,8 @@ class BuildEnvironment:
|
|||||||
self.settings['warning_stream'] = WarningStream(func)
|
self.settings['warning_stream'] = WarningStream(func)
|
||||||
|
|
||||||
def warn(self, docname, msg, lineno=None):
|
def warn(self, docname, msg, lineno=None):
|
||||||
if docname:
|
# strange argument order is due to backwards compatibility
|
||||||
if lineno is None:
|
self._warnfunc(msg, (docname, lineno))
|
||||||
lineno = ''
|
|
||||||
self._warnfunc(msg, '%s:%s' % (self.doc2path(docname), lineno))
|
|
||||||
else:
|
|
||||||
self._warnfunc(msg)
|
|
||||||
|
|
||||||
def clear_doc(self, docname):
|
def clear_doc(self, docname):
|
||||||
"""Remove all traces of a source file in the inventory."""
|
"""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
|
# parse right now, to get PycodeErrors on parsing (results will
|
||||||
# be cached anyway)
|
# be cached anyway)
|
||||||
self.analyzer.find_attr_docs()
|
self.analyzer.find_attr_docs()
|
||||||
except PycodeError, err:
|
except PycodeError:
|
||||||
# no source file -- e.g. for builtin and C modules
|
# no source file -- e.g. for builtin and C modules
|
||||||
self.analyzer = None
|
self.analyzer = None
|
||||||
# at least add the module.__file__ as a dependency
|
# at least add the module.__file__ as a dependency
|
||||||
|
@ -207,7 +207,7 @@ class PygmentsBridge(object):
|
|||||||
lexer = lexers[lang] = get_lexer_by_name(lang)
|
lexer = lexers[lang] = get_lexer_by_name(lang)
|
||||||
except ClassNotFound:
|
except ClassNotFound:
|
||||||
if warn:
|
if warn:
|
||||||
warn('Pygments lexer name %s is not known' % lang)
|
warn('Pygments lexer name %r is not known' % lang)
|
||||||
return self.unhighlighted(source)
|
return self.unhighlighted(source)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
@ -209,7 +209,7 @@ def get_module_source(modname):
|
|||||||
lfilename = filename.lower()
|
lfilename = filename.lower()
|
||||||
if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'):
|
if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'):
|
||||||
filename = filename[:-1]
|
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)
|
raise PycodeError('source is not a .py file: %r' % filename)
|
||||||
if not path.isfile(filename):
|
if not path.isfile(filename):
|
||||||
raise PycodeError('source file is not present: %r' % filename)
|
raise PycodeError('source file is not present: %r' % filename)
|
||||||
|
@ -232,8 +232,10 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
lang = node['language']
|
lang = node['language']
|
||||||
if node.has_key('linenos'):
|
if node.has_key('linenos'):
|
||||||
linenos = node['linenos']
|
linenos = node['linenos']
|
||||||
highlighted = self.highlighter.highlight_block(node.rawsource,
|
def warner(msg):
|
||||||
lang, linenos)
|
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='',
|
starttag = self.starttag(node, 'div', suffix='',
|
||||||
CLASS='highlight-%s' % lang)
|
CLASS='highlight-%s' % lang)
|
||||||
self.body.append(starttag + highlighted + '</div>\n')
|
self.body.append(starttag + highlighted + '</div>\n')
|
||||||
|
@ -429,10 +429,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
elif self.this_is_the_title:
|
elif self.this_is_the_title:
|
||||||
if len(node.children) != 1 and not isinstance(node.children[0],
|
if len(node.children) != 1 and not isinstance(node.children[0],
|
||||||
nodes.Text):
|
nodes.Text):
|
||||||
self.builder.warn(
|
self.builder.warn('document title is not a single Text node',
|
||||||
'document title is not a single Text node',
|
(self.curfilestack[-1], node.line))
|
||||||
'%s:%s' % (self.builder.env.doc2path(self.curfilestack[-1]),
|
|
||||||
node.line or ''))
|
|
||||||
if not self.elements['title']:
|
if not self.elements['title']:
|
||||||
# text needs to be escaped since it is inserted into
|
# text needs to be escaped since it is inserted into
|
||||||
# the output literally
|
# the output literally
|
||||||
@ -465,8 +463,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.builder.warn(
|
self.builder.warn(
|
||||||
'encountered title node not in section, topic, table, '
|
'encountered title node not in section, topic, table, '
|
||||||
'admonition or sidebar',
|
'admonition or sidebar',
|
||||||
'%s:%s' % (self.builder.env.doc2path(self.curfilestack[-1]),
|
(self.curfilestack[-1], node.line or ''))
|
||||||
node.line or ''))
|
|
||||||
self.body.append('\\textbf{')
|
self.body.append('\\textbf{')
|
||||||
self.context.append('}\n')
|
self.context.append('}\n')
|
||||||
self.in_title = 1
|
self.in_title = 1
|
||||||
@ -1107,10 +1104,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.body.append('\\grammartoken{')
|
self.body.append('\\grammartoken{')
|
||||||
self.context.append('}')
|
self.context.append('}')
|
||||||
else:
|
else:
|
||||||
self.builder.warn(
|
self.builder.warn('unusable reference target found: %s' % uri,
|
||||||
'unusable reference target found: %s' % uri,
|
(self.curfilestack[-1], node.line))
|
||||||
'%s:%s' % (self.builder.env.doc2path(self.curfilestack[-1]),
|
|
||||||
node.line or ''))
|
|
||||||
self.context.append('')
|
self.context.append('')
|
||||||
def depart_reference(self, node):
|
def depart_reference(self, node):
|
||||||
self.body.append(self.context.pop())
|
self.body.append(self.context.pop())
|
||||||
@ -1215,7 +1210,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
lang = node['language']
|
lang = node['language']
|
||||||
if 'linenos' in node:
|
if 'linenos' in node:
|
||||||
linenos = node['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
|
# workaround for Unicode issue
|
||||||
hlcode = hlcode.replace(u'€', u'@texteuro[]')
|
hlcode = hlcode.replace(u'€', u'@texteuro[]')
|
||||||
# must use original Verbatim environment and "tabular" environment
|
# must use original Verbatim environment and "tabular" environment
|
||||||
@ -1238,7 +1236,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
* inline markup is supported.
|
* inline markup is supported.
|
||||||
* serif typeface
|
* serif typeface
|
||||||
"""
|
"""
|
||||||
self.body.append('{\\raggedright{}')
|
self.body.append('\n{\\raggedright{}')
|
||||||
self.literal_whitespace += 1
|
self.literal_whitespace += 1
|
||||||
def depart_line_block(self, node):
|
def depart_line_block(self, node):
|
||||||
self.literal_whitespace -= 1
|
self.literal_whitespace -= 1
|
||||||
|
Loading…
Reference in New Issue
Block a user