Merged revisions 64703-64708,64710-64712 via svnmerge from

svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x

........
  r64703 | georg.brandl | 2008-07-04 19:24:00 +0200 (Fri, 04 Jul 2008) | 2 lines

  Fix linkcheck builder crash for malformed URLs.
........
  r64704 | georg.brandl | 2008-07-04 19:32:40 +0200 (Fri, 04 Jul 2008) | 2 lines

  Add 0.5 compatibility for more admonitions.
........
  r64705 | georg.brandl | 2008-07-04 19:38:37 +0200 (Fri, 04 Jul 2008) | 2 lines

  Remove silly "rubric" restriction in latex writer.
........
  r64706 | georg.brandl | 2008-07-04 19:41:44 +0200 (Fri, 04 Jul 2008) | 2 lines

  Document rubric:: Footnotes behavior.
........
  r64707 | georg.brandl | 2008-07-04 19:45:28 +0200 (Fri, 04 Jul 2008) | 2 lines

  Fix XHTML.
........
  r64708 | georg.brandl | 2008-07-04 19:50:56 +0200 (Fri, 04 Jul 2008) | 2 lines

  More XHTML fixes.
........
  r64710 | georg.brandl | 2008-07-04 19:59:56 +0200 (Fri, 04 Jul 2008) | 2 lines

  Copy the html_logo to the output static dir.
........
  r64711 | georg.brandl | 2008-07-04 20:37:43 +0200 (Fri, 04 Jul 2008) | 2 lines

  Fix latex code for module names with underscores that have platforms.
........
  r64712 | georg.brandl | 2008-07-04 20:46:40 +0200 (Fri, 04 Jul 2008) | 2 lines

  Fix a crash with nonlocal image URIs.
........
This commit is contained in:
Georg Brandl 2008-07-04 18:49:39 +00:00
parent 2e698fcb09
commit 17e7e61778
10 changed files with 79 additions and 19 deletions

View File

@ -48,14 +48,14 @@
<h2>Documentation</h2>
<table class="contentstable" align="center" style="margin-left: 30px"><tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Contents</a><br>
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Contents</a><br/>
<span class="linkdescr">for a complete overview</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br>
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br/>
<span class="linkdescr">search the documentation</span></p>
</td><td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br>
<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/>
<span class="linkdescr">all functions, classes, terms</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Module Index</a><br>
<p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Module Index</a><br/>
<span class="linkdescr">quick access to all documented modules</span></p>
</td></tr>
</table>

View File

@ -7,7 +7,7 @@
{% block relbar1 %}
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<img src="{{ pathto("_static/sphinx.png", 1) }}">
<img src="{{ pathto("_static/sphinx.png", 1) }}" alt="Sphinx logo" />
</div>
{{ super() }}
{% endblock %}

View File

@ -215,9 +215,13 @@ that use Sphinx' HTMLWriter class.
.. confval:: html_logo
If given, this must be the name of an image file (within the static path, see
below) that is the logo of the docs. It is placed at the top of the sidebar;
its width should therefore not exceed 200 pixels. Default: ``None``.
If given, this must be the name of an image file that is the logo of the
docs. It is placed at the top of the sidebar; its width should therefore not
exceed 200 pixels. Default: ``None``.
.. versionadded:: 0.4.1
The image file will be copied to the ``_static`` directory of the output
HTML, so an already existing file with that name will be overwritten.
.. confval:: html_favicon

View File

@ -77,7 +77,14 @@ units as well as normal text:
.. directive:: .. rubric:: title
This directive creates a paragraph heading that is not used to create a
table of contents node. It is currently used for the "Footnotes" caption.
table of contents node.
.. note::
If the *title* of the rubric is "Footnotes", this rubric is ignored by
the LaTeX writer, since it is assumed to only contain footnote
definitions and therefore would create an empty heading.
.. directive:: centered

View File

@ -128,6 +128,9 @@ class Builder(object):
Pick the best candidate for all image URIs.
"""
for node in doctree.traverse(nodes.image):
if '?' in node['candidates']:
# don't rewrite nonlocal image URIs
continue
if '*' not in node['candidates']:
for imgtype in self.supported_image_types:
candidate = node['candidates'].get(imgtype, None)
@ -590,6 +593,11 @@ class StandaloneHTMLBuilder(Builder):
elif path.isdir(fullname):
shutil.rmtree(targetname)
shutil.copytree(fullname, targetname)
# copy logo file (handled differently)
if self.config.html_logo:
logobase = path.basename(self.config.html_logo)
shutil.copyfile(path.join(self.confdir, self.config.html_logo),
path.join(self.outdir, '_static', logobase))
# add pygments style file
f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())

View File

@ -534,11 +534,12 @@ class BuildEnvironment:
# Map the mimetype to the corresponding image. The writer may
# choose the best image from these candidates. The special key * is
# set if there is only single candiate to be used by a writer.
# The special key ? is set for nonlocal URIs.
node['candidates'] = candidates = {}
imguri = node['uri']
if imguri.find('://') != -1:
self.warn(docname, 'Nonlocal image URI found: %s' % imguri, node.line)
candidates['*'] = imguri
candidates['?'] = imguri
continue
imgpath = path.normpath(path.join(docdir, imguri))
node['uri'] = imgpath

View File

@ -285,18 +285,55 @@ class HTMLTranslator(BaseTranslator):
def depart_module(self, node):
pass
# docutils 0.5 compatibility
# these are all for docutils 0.5 compatibility
def visit_note(self, node):
self.visit_admonition(node, 'note')
def depart_note(self, node):
self.depart_admonition(node)
# docutils 0.5 compatibility
def visit_warning(self, node):
self.visit_admonition(node, 'warning')
def depart_warning(self, node):
self.depart_admonition(node)
def visit_attention(self, node):
self.visit_admonition(node, 'attention')
def depart_attention(self, node):
self.depart_admonition()
def visit_caution(self, node):
self.visit_admonition(node, 'caution')
def depart_caution(self, node):
self.depart_admonition()
def visit_danger(self, node):
self.visit_admonition(node, 'danger')
def depart_danger(self, node):
self.depart_admonition()
def visit_error(self, node):
self.visit_admonition(node, 'error')
def depart_error(self, node):
self.depart_admonition()
def visit_hint(self, node):
self.visit_admonition(node, 'hint')
def depart_hint(self, node):
self.depart_admonition()
def visit_important(self, node):
self.visit_admonition(node, 'important')
def depart_important(self, node):
self.depart_admonition()
def visit_tip(self, node):
self.visit_admonition(node, 'tip')
def depart_tip(self, node):
self.depart_admonition()
# these are only handled specially in the SmartyPantsHTMLTranslator
def visit_literal_emphasis(self, node):
return self.visit_emphasis(node)

View File

@ -419,8 +419,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_rubric(self, node):
if len(node.children) == 1 and node.children[0].astext() == 'Footnotes':
raise nodes.SkipNode
self.builder.warn('encountered rubric node not used for footnotes, '
'content will be lost')
self.body.append('\\paragraph{')
self.context.append('}\n')
def depart_rubric(self, node):
self.body.append(self.context.pop())
def visit_footnote(self, node):
# XXX not optimal, footnotes are at section end

View File

@ -64,12 +64,13 @@ class CheckExternalLinksBuilder(Builder):
if uri in self.good:
return
lineno = None
while lineno is None and node:
node = node.parent
lineno = node.line
if uri[0:5] == 'http:' or uri[0:6] == 'https:':
self.info(uri, nonl=1)
lineno = None
while lineno is None and node:
node = node.parent
lineno = node.line
if uri in self.broken:
(r, s) = self.broken[uri]

View File

@ -261,7 +261,7 @@
\@ifundefined{py@modplat@\py@thismodulekey}{
\write\modindexfile{\protect\indexentry{#1@{\texttt{#1}}|hyperpage}{\thepage}}%
}{\write\modindexfile{\protect\indexentry{#1@{\texttt{#1 }%
\emph{(\platformof{#1})}}|hyperpage}{\thepage}}%
\emph{(\platformof{\py@thismodulekey})}}|hyperpage}{\thepage}}%
}
\fi%
}