[Python-checkins] r64713 - in doctools/trunk: doc/_templates/index.html doc/_templates/layout.html doc/config.rst doc/markup/para.rst sphinx/builder.py sphinx/environment.py sphinx/htmlwriter.py sphinx/latexwriter.py sphinx/linkcheck.py sphinx/texinputs/sphinx.sty

georg.brandl python-checkins at python.org
Fri Jul 4 20:49:40 CEST 2008


Author: georg.brandl
Date: Fri Jul  4 20:49:39 2008
New Revision: 64713

Log:
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.
........


Modified:
   doctools/trunk/   (props changed)
   doctools/trunk/doc/_templates/index.html
   doctools/trunk/doc/_templates/layout.html
   doctools/trunk/doc/config.rst
   doctools/trunk/doc/markup/para.rst
   doctools/trunk/sphinx/builder.py
   doctools/trunk/sphinx/environment.py
   doctools/trunk/sphinx/htmlwriter.py
   doctools/trunk/sphinx/latexwriter.py
   doctools/trunk/sphinx/linkcheck.py
   doctools/trunk/sphinx/texinputs/sphinx.sty

Modified: doctools/trunk/doc/_templates/index.html
==============================================================================
--- doctools/trunk/doc/_templates/index.html	(original)
+++ doctools/trunk/doc/_templates/index.html	Fri Jul  4 20:49:39 2008
@@ -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>

Modified: doctools/trunk/doc/_templates/layout.html
==============================================================================
--- doctools/trunk/doc/_templates/layout.html	(original)
+++ doctools/trunk/doc/_templates/layout.html	Fri Jul  4 20:49:39 2008
@@ -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 %}

Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst	(original)
+++ doctools/trunk/doc/config.rst	Fri Jul  4 20:49:39 2008
@@ -215,9 +215,13 @@
 
 .. 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
 

Modified: doctools/trunk/doc/markup/para.rst
==============================================================================
--- doctools/trunk/doc/markup/para.rst	(original)
+++ doctools/trunk/doc/markup/para.rst	Fri Jul  4 20:49:39 2008
@@ -77,7 +77,14 @@
 .. 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
 

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Fri Jul  4 20:49:39 2008
@@ -128,6 +128,9 @@
         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 @@
                 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())

Modified: doctools/trunk/sphinx/environment.py
==============================================================================
--- doctools/trunk/sphinx/environment.py	(original)
+++ doctools/trunk/sphinx/environment.py	Fri Jul  4 20:49:39 2008
@@ -534,11 +534,12 @@
             # 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

Modified: doctools/trunk/sphinx/htmlwriter.py
==============================================================================
--- doctools/trunk/sphinx/htmlwriter.py	(original)
+++ doctools/trunk/sphinx/htmlwriter.py	Fri Jul  4 20:49:39 2008
@@ -285,18 +285,55 @@
     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)

Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py	(original)
+++ doctools/trunk/sphinx/latexwriter.py	Fri Jul  4 20:49:39 2008
@@ -419,8 +419,10 @@
     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

Modified: doctools/trunk/sphinx/linkcheck.py
==============================================================================
--- doctools/trunk/sphinx/linkcheck.py	(original)
+++ doctools/trunk/sphinx/linkcheck.py	Fri Jul  4 20:49:39 2008
@@ -64,12 +64,13 @@
         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]

Modified: doctools/trunk/sphinx/texinputs/sphinx.sty
==============================================================================
--- doctools/trunk/sphinx/texinputs/sphinx.sty	(original)
+++ doctools/trunk/sphinx/texinputs/sphinx.sty	Fri Jul  4 20:49:39 2008
@@ -261,7 +261,7 @@
     \@ifundefined{py at modplat@\py at 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 at thismodulekey})}}|hyperpage}{\thepage}}%
     }
   \fi%
 }


More information about the Python-checkins mailing list