[Python-checkins] r61902 - in doctools/trunk: CHANGES sphinx/builder.py sphinx/templates/layout.html sphinx/templates/modindex.html sphinx/templates/search.html

georg.brandl python-checkins at python.org
Tue Mar 25 19:32:23 CET 2008


Author: georg.brandl
Date: Tue Mar 25 19:32:23 2008
New Revision: 61902

Modified:
   doctools/trunk/CHANGES
   doctools/trunk/sphinx/builder.py
   doctools/trunk/sphinx/templates/layout.html
   doctools/trunk/sphinx/templates/modindex.html
   doctools/trunk/sphinx/templates/search.html
Log:
Rename static to _static and consistently name _sources.


Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Tue Mar 25 19:32:23 2008
@@ -4,6 +4,9 @@
 * sphinx.htmlwriter, sphinx.latexwriter: Support the ``.. image::``
   directive by copying image files to the output directory.
 
+* sphinx.builder: Consistently name "special" HTML output directories
+  with a leading underscore; this means ``_sources`` and ``_static``.
+
 * sphinx.environment: Take dependent files into account when collecting
   the set of outdated sources.
 

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Tue Mar 25 19:32:23 2008
@@ -496,7 +496,7 @@
 
         # copy static files
         self.info(bold('copying static files...'))
-        ensuredir(path.join(self.outdir, 'static'))
+        ensuredir(path.join(self.outdir, '_static'))
         staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
                          [path.join(self.srcdir, spath)
                           for spath in self.config.html_static_path]
@@ -504,9 +504,9 @@
             for filename in os.listdir(staticdirname):
                 if not filename.startswith('.'):
                     shutil.copyfile(path.join(staticdirname, filename),
-                                    path.join(self.outdir, 'static', filename))
+                                    path.join(self.outdir, '_static', filename))
         # add pygments style file
-        f = open(path.join(self.outdir, 'static', 'pygments.css'), 'w')
+        f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
         f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
         f.close()
 
@@ -514,7 +514,10 @@
         self.handle_finish()
 
     def get_outdated_docs(self):
-        template_mtime = max(mtimes_of_files(self.templates_path, '.html'))
+        if self.templates_path:
+            template_mtime = max(mtimes_of_files(self.templates_path, '.html'))
+        else:
+            template_mtime = 0
         for docname in self.env.found_docs:
             if docname not in self.env.all_docs:
                 yield docname
@@ -603,6 +606,8 @@
 
     def init(self):
         self.init_translator_class()
+        # no templates used, but get_outdated_docs() needs this attribute
+        self.templates_path = []
 
     def get_target_uri(self, docname, typ=None):
         if docname == 'index':
@@ -627,7 +632,7 @@
         # if there is a source file, copy the source file for the
         # "show source" link
         if ctx.get('sourcename'):
-            source_name = path.join(self.outdir, 'sources',
+            source_name = path.join(self.outdir, '_sources',
                                     os_path(ctx['sourcename']))
             ensuredir(path.dirname(source_name))
             shutil.copyfile(self.env.doc2path(pagename), source_name)

Modified: doctools/trunk/sphinx/templates/layout.html
==============================================================================
--- doctools/trunk/sphinx/templates/layout.html	(original)
+++ doctools/trunk/sphinx/templates/layout.html	Tue Mar 25 19:32:23 2008
@@ -46,8 +46,8 @@
     <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}">
     {%- endfor %}
     {%- else %}
-    <link rel="stylesheet" href="{{ pathto('static/' + style, 1) }}" type="text/css">
-    <link rel="stylesheet" href="{{ pathto('static/pygments.css', 1) }}" type="text/css">
+    <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css">
+    <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css">
     {%- endif %}
     {%- if builder != 'htmlhelp' %}
     <script type="text/javascript">
@@ -56,9 +56,9 @@
         VERSION:    '{{ release }}'
       };
     </script>
-    <script type="text/javascript" src="{{ pathto('static/jquery.js', 1) }}"></script>
-    <script type="text/javascript" src="{{ pathto('static/interface.js', 1) }}"></script>
-    <script type="text/javascript" src="{{ pathto('static/doctools.js', 1) }}"></script>
+    <script type="text/javascript" src="{{ pathto('_static/jquery.js', 1) }}"></script>
+    <script type="text/javascript" src="{{ pathto('_static/interface.js', 1) }}"></script>
+    <script type="text/javascript" src="{{ pathto('_static/doctools.js', 1) }}"></script>
     {%- endif %}
 {%- block rellinks %}
     {%- if hasdoc('about') %}

Modified: doctools/trunk/sphinx/templates/modindex.html
==============================================================================
--- doctools/trunk/sphinx/templates/modindex.html	(original)
+++ doctools/trunk/sphinx/templates/modindex.html	Tue Mar 25 19:32:23 2008
@@ -32,7 +32,7 @@
    {%- else -%}
    <tr{% if indent %} class="cg-{{ cgroup }}"{% endif %}>
      <td>{% if collapse -%}
-       <img src="{{ pathto('static/minus.png', 1) }}" id="toggle-{{ cgroup }}"
+       <img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ cgroup }}"
             class="toggler" style="display: none">
          {%- endif %}</td>
      <td>{% if indent %}&nbsp;&nbsp;&nbsp;{% endif %}

Modified: doctools/trunk/sphinx/templates/search.html
==============================================================================
--- doctools/trunk/sphinx/templates/search.html	(original)
+++ doctools/trunk/sphinx/templates/search.html	Tue Mar 25 19:32:23 2008
@@ -1,7 +1,7 @@
 {% extends "layout.html" %}
 {% set title = 'Search Documentation' %}
 {% block extrahead %}
-    <script type="text/javascript" src="{{ pathto('static/searchtools.js', 1) }}"></script>
+    <script type="text/javascript" src="{{ pathto('_static/searchtools.js', 1) }}"></script>
 {% endblock %}
 {% block body %}
   <h1 id="search-documentation">Search Documentation</h1>


More information about the Python-checkins mailing list