Commits

Anonymous committed 0ccbfe3

Rename static to _static and consistently name _sources.

Comments (0)

Files changed (5)

 * 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.
 

sphinx/builder.py

 
         # 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]
             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()
 
         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
 
     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':
         # 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)

sphinx/templates/layout.html

     <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">
         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') %}

sphinx/templates/modindex.html

    {%- 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 %}

sphinx/templates/search.html

 {% 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>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.